org.opennms.netmgt.config.ami
Class AmiConfig

java.lang.Object
  extended by org.opennms.netmgt.config.ami.AmiConfig
All Implemented Interfaces:
Serializable

public class AmiConfig
extends Object
implements Serializable

This is the top-level element for ami-config.xml, which configures access parameters for the Asterisk Manager Interface (AMI).

Version:
$Revision$ $Date$
See Also:
Serialized Form

Constructor Summary
AmiConfig()
           
 
Method Summary
 void addDefinition(Definition vDefinition)
           
 void addDefinition(int index, Definition vDefinition)
           
 void deletePort()
           
 void deleteRetry()
           
 void deleteTimeout()
           
 void deleteUseSsl()
           
 Enumeration<Definition> enumerateDefinition()
          Method enumerateDefinition.
 boolean equals(Object obj)
          Overrides the java.lang.Object.equals method.
 Definition[] getDefinition()
          Method getDefinition.Returns the contents of the collection in an Array.
 Definition getDefinition(int index)
          Method getDefinition.
 List<Definition> getDefinitionCollection()
          Method getDefinitionCollection.Returns a reference to '_definitionList'.
 int getDefinitionCount()
          Method getDefinitionCount.
 String getPassword()
          Returns the value of field 'password'.
 int getPort()
          Returns the value of field 'port'.
 int getRetry()
          Returns the value of field 'retry'.
 int getTimeout()
          Returns the value of field 'timeout'.
 String getUsername()
          Returns the value of field 'username'.
 boolean getUseSsl()
          Returns the value of field 'useSsl'.
 int hashCode()
          Overrides the java.lang.Object.hashCode method.
 boolean hasPort()
          Method hasPort.
 boolean hasRetry()
          Method hasRetry.
 boolean hasTimeout()
          Method hasTimeout.
 boolean hasUseSsl()
          Method hasUseSsl.
 boolean isUseSsl()
          Returns the value of field 'useSsl'.
 boolean isValid()
          Method isValid.
 Iterator<Definition> iterateDefinition()
          Method iterateDefinition.
 void marshal(ContentHandler handler)
           
 void marshal(Writer out)
           
 void removeAllDefinition()
           
 boolean removeDefinition(Definition vDefinition)
          Method removeDefinition.
 Definition removeDefinitionAt(int index)
          Method removeDefinitionAt.
 void setDefinition(Definition[] vDefinitionArray)
           
 void setDefinition(int index, Definition vDefinition)
           
 void setDefinition(List<Definition> vDefinitionList)
          Sets the value of '_definitionList' by copying the given Vector.
 void setDefinitionCollection(List<Definition> definitionList)
          Deprecated.  
 void setPassword(String password)
          Sets the value of field 'password'.
 void setPort(int port)
          Sets the value of field 'port'.
 void setRetry(int retry)
          Sets the value of field 'retry'.
 void setTimeout(int timeout)
          Sets the value of field 'timeout'.
 void setUsername(String username)
          Sets the value of field 'username'.
 void setUseSsl(boolean useSsl)
          Sets the value of field 'useSsl'.
static AmiConfig unmarshal(Reader reader)
          Method unmarshal.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AmiConfig

public AmiConfig()
Method Detail

addDefinition

public void addDefinition(Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

addDefinition

public void addDefinition(int index,
                          Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
index -
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

deletePort

public void deletePort()

deleteRetry

public void deleteRetry()

deleteTimeout

public void deleteTimeout()

deleteUseSsl

public void deleteUseSsl()

enumerateDefinition

public Enumeration<Definition> enumerateDefinition()
Method enumerateDefinition.

Returns:
an Enumeration over all possible elements of this collection

equals

public boolean equals(Object obj)
Overrides the java.lang.Object.equals method.

Overrides:
equals in class Object
Parameters:
obj -
Returns:
true if the objects are equal.

getDefinition

public Definition getDefinition(int index)
                         throws IndexOutOfBoundsException
Method getDefinition.

Parameters:
index -
Returns:
the value of the org.opennms.netmgt.config.ami.Definition at the given index
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

getDefinition

public Definition[] getDefinition()
Method getDefinition.Returns the contents of the collection in an Array.

Note: Just in case the collection contents are changing in another thread, we pass a 0-length Array of the correct type into the API call. This way we know that the Array returned is of exactly the correct length.

Returns:
this collection as an Array

getDefinitionCollection

public List<Definition> getDefinitionCollection()
Method getDefinitionCollection.Returns a reference to '_definitionList'. No type checking is performed on any modifications to the Vector.

Returns:
a reference to the Vector backing this class

getDefinitionCount

public int getDefinitionCount()
Method getDefinitionCount.

Returns:
the size of this collection

getPassword

public String getPassword()
Returns the value of field 'password'. The field 'password' has the following description: Default AMI password.

Returns:
the value of field 'Password'.

getPort

public int getPort()
Returns the value of field 'port'. The field 'port' has the following description: Default port (in milliseconds).

Returns:
the value of field 'Port'.

getRetry

public int getRetry()
Returns the value of field 'retry'. The field 'retry' has the following description: Default connection retries. Not currently used.

Returns:
the value of field 'Retry'.

getTimeout

public int getTimeout()
Returns the value of field 'timeout'. The field 'timeout' has the following description: Default connection timeout (in milliseconds).

Returns:
the value of field 'Timeout'.

getUseSsl

public boolean getUseSsl()
Returns the value of field 'useSsl'.

Returns:
the value of field 'UseSsl'.

getUsername

public String getUsername()
Returns the value of field 'username'. The field 'username' has the following description: Default AMI username (Name in brackets in Asterisk's manager.conf).

Returns:
the value of field 'Username'.

hasPort

public boolean hasPort()
Method hasPort.

Returns:
true if at least one Port has been added

hasRetry

public boolean hasRetry()
Method hasRetry.

Returns:
true if at least one Retry has been added

hasTimeout

public boolean hasTimeout()
Method hasTimeout.

Returns:
true if at least one Timeout has been added

hasUseSsl

public boolean hasUseSsl()
Method hasUseSsl.

Returns:
true if at least one UseSsl has been added

hashCode

public int hashCode()
Overrides the java.lang.Object.hashCode method.

The following steps came from Effective Java Programming Language Guide by Joshua Bloch, Chapter 3

Overrides:
hashCode in class Object
Returns:
a hash code value for the object.

isUseSsl

public boolean isUseSsl()
Returns the value of field 'useSsl'.

Returns:
the value of field 'UseSsl'.

isValid

public boolean isValid()
Method isValid.

Returns:
true if this object is valid according to the schema

iterateDefinition

public Iterator<Definition> iterateDefinition()
Method iterateDefinition.

Returns:
an Iterator over all possible elements in this collection

marshal

public void marshal(Writer out)
             throws org.exolab.castor.xml.MarshalException,
                    org.exolab.castor.xml.ValidationException
Parameters:
out -
Throws:
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema

marshal

public void marshal(ContentHandler handler)
             throws IOException,
                    org.exolab.castor.xml.MarshalException,
                    org.exolab.castor.xml.ValidationException
Parameters:
handler -
Throws:
IOException - if an IOException occurs during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling

removeAllDefinition

public void removeAllDefinition()

removeDefinition

public boolean removeDefinition(Definition vDefinition)
Method removeDefinition.

Parameters:
vDefinition -
Returns:
true if the object was removed from the collection.

removeDefinitionAt

public Definition removeDefinitionAt(int index)
Method removeDefinitionAt.

Parameters:
index -
Returns:
the element removed from the collection

setDefinition

public void setDefinition(int index,
                          Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
index -
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

setDefinition

public void setDefinition(Definition[] vDefinitionArray)
Parameters:
vDefinitionArray -

setDefinition

public void setDefinition(List<Definition> vDefinitionList)
Sets the value of '_definitionList' by copying the given Vector. All elements will be checked for type safety.

Parameters:
vDefinitionList - the Vector to copy.

setDefinitionCollection

public void setDefinitionCollection(List<Definition> definitionList)
Deprecated. 

Sets the value of '_definitionList' by setting it to the given Vector. No type checking is performed.

Parameters:
definitionList - the Vector to set.

setPassword

public void setPassword(String password)
Sets the value of field 'password'. The field 'password' has the following description: Default AMI password.

Parameters:
password - the value of field 'password'.

setPort

public void setPort(int port)
Sets the value of field 'port'. The field 'port' has the following description: Default port (in milliseconds).

Parameters:
port - the value of field 'port'.

setRetry

public void setRetry(int retry)
Sets the value of field 'retry'. The field 'retry' has the following description: Default connection retries. Not currently used.

Parameters:
retry - the value of field 'retry'.

setTimeout

public void setTimeout(int timeout)
Sets the value of field 'timeout'. The field 'timeout' has the following description: Default connection timeout (in milliseconds).

Parameters:
timeout - the value of field 'timeout'.

setUseSsl

public void setUseSsl(boolean useSsl)
Sets the value of field 'useSsl'.

Parameters:
useSsl - the value of field 'useSsl'.

setUsername

public void setUsername(String username)
Sets the value of field 'username'. The field 'username' has the following description: Default AMI username (Name in brackets in Asterisk's manager.conf).

Parameters:
username - the value of field 'username'.

unmarshal

public static AmiConfig unmarshal(Reader reader)
                           throws org.exolab.castor.xml.MarshalException,
                                  org.exolab.castor.xml.ValidationException
Method unmarshal.

Parameters:
reader -
Returns:
the unmarshaled org.opennms.netmgt.config.ami.AmiConfig
Throws:
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema

validate

public void validate()
              throws org.exolab.castor.xml.ValidationException
Throws:
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema


Copyright © 2011. All Rights Reserved.