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

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

public class PolicyManage
extends Object
implements Serializable

This represents a policy to manage a provisioned node if matched a node will be added updated or deleted using the element attribute definitions .

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

Constructor Summary
PolicyManage()
           
 
Method Summary
 void addSchedule(int index, Schedule vSchedule)
           
 void addSchedule(Schedule vSchedule)
           
 void deleteDelay()
           
 void deleteRetries()
           
 void deleteUseCategories()
           
 Enumeration<Schedule> enumerateSchedule()
          Method enumerateSchedule.
 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'.
 String getName()
          Returns the value of field 'name'.
 Package getPackage()
          Returns the value of field 'package'.
 int getRetries()
          Returns the value of field 'retries'.
 Schedule[] getSchedule()
          Method getSchedule.Returns the contents of the collection in an Array.
 Schedule getSchedule(int index)
          Method getSchedule.
 List<Schedule> getScheduleCollection()
          Method getScheduleCollection.Returns a reference to '_scheduleList'.
 int getScheduleCount()
          Method getScheduleCount.
 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<Schedule> iterateSchedule()
          Method iterateSchedule.
 void marshal(ContentHandler handler)
           
 void marshal(Writer out)
           
 void removeAllSchedule()
           
 boolean removeSchedule(Schedule vSchedule)
          Method removeSchedule.
 Schedule removeScheduleAt(int index)
          Method removeScheduleAt.
 void setDefaultType(String defaultType)
          Sets the value of field 'defaultType'.
 void setDelay(long delay)
          Sets the value of field 'delay'.
 void setName(String name)
          Sets the value of field 'name'.
 void setPackage(Package _package)
          Sets the value of field 'package'.
 void setRetries(int retries)
          Sets the value of field 'retries'.
 void setSchedule(int index, Schedule vSchedule)
           
 void setSchedule(List<Schedule> vScheduleList)
          Sets the value of '_scheduleList' by copying the given Vector.
 void setSchedule(Schedule[] vScheduleArray)
           
 void setScheduleCollection(List<Schedule> scheduleList)
          Deprecated.  
 void setUseCategories(boolean useCategories)
          Sets the value of field 'useCategories'.
static PolicyManage 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

PolicyManage

public PolicyManage()
Method Detail

addSchedule

public void addSchedule(Schedule vSchedule)
                 throws IndexOutOfBoundsException
Parameters:
vSchedule -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

addSchedule

public void addSchedule(int index,
                        Schedule vSchedule)
                 throws IndexOutOfBoundsException
Parameters:
index -
vSchedule -
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()

enumerateSchedule

public Enumeration<Schedule> enumerateSchedule()
Method enumerateSchedule.

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'.

getName

public String getName()
Returns the value of field 'name'. The field 'name' has the following description: The name of the policy

Returns:
the value of field 'Name'.

getPackage

public Package getPackage()
Returns the value of field 'package'. The field 'package' has the following description: Package encapsulating addresses, services to be polled for these addresses, etc..

Returns:
the value of field 'Package'.

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'.

getSchedule

public Schedule getSchedule(int index)
                     throws IndexOutOfBoundsException
Method getSchedule.

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

getSchedule

public Schedule[] getSchedule()
Method getSchedule.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

getScheduleCollection

public List<Schedule> getScheduleCollection()
Method getScheduleCollection.Returns a reference to '_scheduleList'. No type checking is performed on any modifications to the Vector.

Returns:
a reference to the Vector backing this class

getScheduleCount

public int getScheduleCount()
Method getScheduleCount.

Returns:
the size of this collection

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

iterateSchedule

public Iterator<Schedule> iterateSchedule()
Method iterateSchedule.

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

removeAllSchedule

public void removeAllSchedule()

removeSchedule

public boolean removeSchedule(Schedule vSchedule)
Method removeSchedule.

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

removeScheduleAt

public Schedule removeScheduleAt(int index)
Method removeScheduleAt.

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'.

setName

public void setName(String name)
Sets the value of field 'name'. The field 'name' has the following description: The name of the policy

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

setPackage

public void setPackage(Package _package)
Sets the value of field 'package'. The field 'package' has the following description: Package encapsulating addresses, services to be polled for these addresses, etc..

Parameters:
_package -
package - the value of field 'package'.

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'.

setSchedule

public void setSchedule(int index,
                        Schedule vSchedule)
                 throws IndexOutOfBoundsException
Parameters:
index -
vSchedule -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

setSchedule

public void setSchedule(Schedule[] vScheduleArray)
Parameters:
vScheduleArray -

setSchedule

public void setSchedule(List<Schedule> vScheduleList)
Sets the value of '_scheduleList' by copying the given Vector. All elements will be checked for type safety.

Parameters:
vScheduleList - the Vector to copy.

setScheduleCollection

public void setScheduleCollection(List<Schedule> scheduleList)
Deprecated. 

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

Parameters:
scheduleList - the Vector to set.

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 PolicyManage 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.PolicyManage
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.