org.opennms.netmgt.config.rancid.adapter
Class RancidConfiguration

java.lang.Object
  extended by org.opennms.netmgt.config.rancid.adapter.RancidConfiguration
All Implemented Interfaces:
Serializable

public class RancidConfiguration
extends Object
implements Serializable

Top-level element for the rancid-configuration.xml configuration file.

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

Constructor Summary
RancidConfiguration()
           
 
Method Summary
 void addMapping(int index, Mapping vMapping)
           
 void addMapping(Mapping vMapping)
           
 void deleteDelay()
           
 void deleteRetries()
           
 void deleteUseCategories()
           
 Enumeration<Mapping> enumerateMapping()
          Method enumerateMapping.
 boolean equals(Object obj)
          Overrides the java.lang.Object.equals method.
 String getDefaultType()
          Returns the value of field 'defaultType'.
 long getDelay()
          Returns the value of field 'delay'.
 Mapping[] getMapping()
          Method getMapping.Returns the contents of the collection in an Array.
 Mapping getMapping(int index)
          Method getMapping.
 List<Mapping> getMappingCollection()
          Method getMappingCollection.Returns a reference to '_mappingList'.
 int getMappingCount()
          Method getMappingCount.
 Policies getPolicies()
          Returns the value of field 'policies'.
 int getRetries()
          Returns the value of field 'retries'.
 boolean getUseCategories()
          Returns the value of field 'useCategories'.
 boolean hasDelay()
          Method hasDelay.
 int hashCode()
          Overrides the java.lang.Object.hashCode method.
 boolean hasRetries()
          Method hasRetries.
 boolean hasUseCategories()
          Method hasUseCategories.
 boolean isUseCategories()
          Returns the value of field 'useCategories'.
 boolean isValid()
          Method isValid.
 Iterator<Mapping> iterateMapping()
          Method iterateMapping.
 void marshal(ContentHandler handler)
           
 void marshal(Writer out)
           
 void removeAllMapping()
           
 boolean removeMapping(Mapping vMapping)
          Method removeMapping.
 Mapping removeMappingAt(int index)
          Method removeMappingAt.
 void setDefaultType(String defaultType)
          Sets the value of field 'defaultType'.
 void setDelay(long delay)
          Sets the value of field 'delay'.
 void setMapping(int index, Mapping vMapping)
           
 void setMapping(List<Mapping> vMappingList)
          Sets the value of '_mappingList' by copying the given Vector.
 void setMapping(Mapping[] vMappingArray)
           
 void setMappingCollection(List<Mapping> mappingList)
          Deprecated.  
 void setPolicies(Policies policies)
          Sets the value of field 'policies'.
 void setRetries(int retries)
          Sets the value of field 'retries'.
 void setUseCategories(boolean useCategories)
          Sets the value of field 'useCategories'.
static RancidConfiguration 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

RancidConfiguration

public RancidConfiguration()
Method Detail

addMapping

public void addMapping(Mapping vMapping)
                throws IndexOutOfBoundsException
Parameters:
vMapping -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

addMapping

public void addMapping(int index,
                       Mapping vMapping)
                throws IndexOutOfBoundsException
Parameters:
index -
vMapping -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

deleteDelay

public void deleteDelay()

deleteRetries

public void deleteRetries()

deleteUseCategories

public void deleteUseCategories()

enumerateMapping

public Enumeration<Mapping> enumerateMapping()
Method enumerateMapping.

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.

getDefaultType

public String getDefaultType()
Returns the value of field 'defaultType'. The field 'defaultType' has the following description: The Default Rancid type, it is used when no device type for provisioned node is found.

Returns:
the value of field 'DefaultType'.

getDelay

public long getDelay()
Returns the value of field 'delay'. The field 'delay' has the following description: The time in sec to wait before trying to set the download flag to up in router.db. If schedule is there then it is verified if you are able to write to router.db in rancid. Otherwise you wait until schedule let you write on rancid.

Returns:
the value of field 'Delay'.

getMapping

public Mapping getMapping(int index)
                   throws IndexOutOfBoundsException
Method getMapping.

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

getMapping

public Mapping[] getMapping()
Method getMapping.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

getMappingCollection

public List<Mapping> getMappingCollection()
Method getMappingCollection.Returns a reference to '_mappingList'. No type checking is performed on any modifications to the Vector.

Returns:
a reference to the Vector backing this class

getMappingCount

public int getMappingCount()
Method getMappingCount.

Returns:
the size of this collection

getPolicies

public Policies getPolicies()
Returns the value of field 'policies'. The field 'policies' has the following description: Configuration of Policy functionality

Returns:
the value of field 'Policies'.

getRetries

public int getRetries()
Returns the value of field 'retries'. The field 'retries' has the following description: The maximum number of retry before sending a failure.

Returns:
the value of field 'Retries'.

getUseCategories

public boolean getUseCategories()
Returns the value of field 'useCategories'. The field 'useCategories' has the following description: If you want to use opennms categories to match rancid device type.

Returns:
the value of field 'UseCategories'.

hasDelay

public boolean hasDelay()
Method hasDelay.

Returns:
true if at least one Delay has been added

hasRetries

public boolean hasRetries()
Method hasRetries.

Returns:
true if at least one Retries has been added

hasUseCategories

public boolean hasUseCategories()
Method hasUseCategories.

Returns:
true if at least one UseCategories 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.

isUseCategories

public boolean isUseCategories()
Returns the value of field 'useCategories'. The field 'useCategories' has the following description: If you want to use opennms categories to match rancid device type.

Returns:
the value of field 'UseCategories'.

isValid

public boolean isValid()
Method isValid.

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

iterateMapping

public Iterator<Mapping> iterateMapping()
Method iterateMapping.

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

removeAllMapping

public void removeAllMapping()

removeMapping

public boolean removeMapping(Mapping vMapping)
Method removeMapping.

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

removeMappingAt

public Mapping removeMappingAt(int index)
Method removeMappingAt.

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

setDefaultType

public void setDefaultType(String defaultType)
Sets the value of field 'defaultType'. The field 'defaultType' has the following description: The Default Rancid type, it is used when no device type for provisioned node is found.

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

setDelay

public void setDelay(long delay)
Sets the value of field 'delay'. The field 'delay' has the following description: The time in sec to wait before trying to set the download flag to up in router.db. If schedule is there then it is verified if you are able to write to router.db in rancid. Otherwise you wait until schedule let you write on rancid.

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

setMapping

public void setMapping(int index,
                       Mapping vMapping)
                throws IndexOutOfBoundsException
Parameters:
index -
vMapping -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

setMapping

public void setMapping(Mapping[] vMappingArray)
Parameters:
vMappingArray -

setMapping

public void setMapping(List<Mapping> vMappingList)
Sets the value of '_mappingList' by copying the given Vector. All elements will be checked for type safety.

Parameters:
vMappingList - the Vector to copy.

setMappingCollection

public void setMappingCollection(List<Mapping> mappingList)
Deprecated. 

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

Parameters:
mappingList - the Vector to set.

setPolicies

public void setPolicies(Policies policies)
Sets the value of field 'policies'. The field 'policies' has the following description: Configuration of Policy functionality

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

setRetries

public void setRetries(int retries)
Sets the value of field 'retries'. The field 'retries' has the following description: The maximum number of retry before sending a failure.

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

setUseCategories

public void setUseCategories(boolean useCategories)
Sets the value of field 'useCategories'. The field 'useCategories' has the following description: If you want to use opennms categories to match rancid device type.

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

unmarshal

public static RancidConfiguration 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.rancid.adapter.RancidConfiguration
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.