"WEBNMS_5 API Docs"

com.adventnet.management.policydb
Class PolicyObject

java.lang.Object
  extended by com.adventnet.management.policydb.PolicyObject
All Implemented Interfaces:
DBExtendedInterface, DBInterface, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
PeriodicPolicyObject

public abstract class PolicyObject
extends java.lang.Object
implements java.io.Serializable, DBExtendedInterface

The PolicyObject class is the abstract root class from which all other Policies can be derived.

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable actions
          HashTable which stores all the valid Actions of this PolicyObject
protected  java.util.Hashtable conditions
          HashTable which stores all the conditions of this PolicyObject
protected  java.lang.String groupName
          The group name of the PolicyObject
protected  java.lang.String helpURL
          Variable that stores helpURL for the Policy
protected  boolean isAlreadyInExecution
          boolean to specify the current execution status of the PolicyObject
protected  java.lang.String name
          The identifier the PolicyObject.
protected  java.lang.String policyObjectCustomizer
          Variable that stores fully qualified classname of PolicyObjecCustomizer
protected  java.lang.Runnable runnableInst
          runnable instance which is responsible for scheduling the policy
protected  int status
          The status of the PolicyObject.
protected  java.util.Properties userProperties
          For storing user defined properties
 
Constructor Summary
PolicyObject()
           
 
Method Summary
 boolean addAction(PolicyAction pa)
          Adds the PolicyAction to the PolicyObject.
 boolean addCondition(PolicyCondition pc)
          Deprecated. Instead use addPolicyActionAndCondition(PolicyAction , PolicyCondtion)
 boolean addPolicyActionAndCondition(PolicyAction pa, PolicyCondition pc)
           
protected  boolean checkConditions(java.lang.String key, PolicyEvent policyEvt)
          Checks whether the PolicyCondition with key key is satisfied or not.
 java.lang.Object clone()
          A method to return a new object which is a clone of this object.
protected abstract  void executeAction(PolicyEvent policyEvt)
          executes action of this PolicyObject.
protected  void executePolicy(PolicyEvent policyEvt)
          Method to execute the Policy.
 java.util.Vector getActionKeys()
          Method to get a list of keys (Strings) of the actions
 java.util.Vector getActions(java.lang.String key)
          Deprecated. Instead use getPolicyAction
protected  java.util.Properties getBaseProperties()
          Returns all the base properties(namely name,groupName and status) of the policy object
 java.util.Vector getConditionKeys()
          Method to get a list of keys (Strings) of the conditions
 java.util.Vector getConditions(java.lang.String key)
          Deprecated. Use getPolicyCondition instead
 java.lang.String getGroupName()
          Returns the group name of the PolicyObject.
 java.lang.String getHelpURL()
          Returns the help URL of this PolicyObject.
 java.lang.String getKey()
          This is the primary key value of the persistent object.
 java.lang.String getKeyName()
          The field which is used as key for the object.
 java.lang.String getName()
          Returns the name of the PolicyObject.
 PolicyAction getPolicyAction(java.lang.String key)
          Returns PolicyAction associated with the key
 PolicyCondition getPolicyCondition(java.lang.String key)
          Returns PolicyCondition for the corresponding key
 java.lang.String getPolicyObjectCustomizer()
          Returns the fully qualified name of the customizer class for this PolicyObject.
abstract  java.util.Properties getProperties()
          Returns the properties of this PolicyObject
protected  java.lang.Runnable getRunnableInstance()
          returns the runnable instance which is responsible for scheduling the policy.
 int getStatus()
          Returns the status of the PolicyObject.
 java.util.Vector getTimeVector()
          Gets the vetcor containing information about when to schedule.
 java.util.Properties getUserProperties()
          This should return a Properties object .
 java.lang.String getUserProperty(java.lang.String nam)
           
protected  void performRequiredActions(java.lang.String key, PolicyEvent policyEvt)
          Perfroms the PolicyAction with key represented by key
 java.lang.String removeUserProperty(java.lang.String nam)
           
protected  void setBaseProperties(java.util.Properties p)
          sets all the base properties(groupName and status) of the policy object
 void setGroupName(java.lang.String str)
          Sets the group name of the PolicyObject.
 void setHelpURL(java.lang.String url)
          Method for setting helpURL for a PolicyObject
 void setName(java.lang.String s)
          Sets the name of the PolicyObject.
 void setPolicyObjectCustomizer(java.lang.String customizerClassName)
          Method to set PolicyObjectCuatomizer class name
abstract  void setProperties(java.util.Properties prop)
          Sets the properties for this PolicyObject
protected  void setRunnableInstance(java.lang.Runnable r)
          sets the runnable instance which is responsible for scheduling the policy.
 void setStatus(int i)
          Sets the status of the PolicyObject.
 void setTimeVector(java.util.Vector timeVector)
          Set's the timeVector
 void setUserProperty(java.lang.String nam, java.lang.String val)
          To set any additional user property during runtime .
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The identifier the PolicyObject.


groupName

protected java.lang.String groupName
The group name of the PolicyObject


status

protected int status
The status of the PolicyObject. PolicyObjects can have one of the two status - Enabled or Disabled. Default value is Enabled.

NOTE only PolicyObjects with status enabled can be executed.

VALID VALUES Valid values - NmsPolicyAPI.POLICY_ENABLED,NmsPolicyAPI.POLICY_DISABLED

See Also:
NmsPolicyAPI.POLICY_ENABLED, NmsPolicyAPI.POLICY_DISABLED

conditions

protected java.util.Hashtable conditions
HashTable which stores all the conditions of this PolicyObject


actions

protected java.util.Hashtable actions
HashTable which stores all the valid Actions of this PolicyObject


policyObjectCustomizer

protected java.lang.String policyObjectCustomizer
Variable that stores fully qualified classname of PolicyObjecCustomizer


helpURL

protected java.lang.String helpURL
Variable that stores helpURL for the Policy


runnableInst

protected transient java.lang.Runnable runnableInst
runnable instance which is responsible for scheduling the policy


isAlreadyInExecution

protected boolean isAlreadyInExecution
boolean to specify the current execution status of the PolicyObject


userProperties

protected java.util.Properties userProperties
For storing user defined properties

Constructor Detail

PolicyObject

public PolicyObject()
Method Detail

getName

public java.lang.String getName()
Returns the name of the PolicyObject.

Returns:
name of the policy object

setName

public void setName(java.lang.String s)
Sets the name of the PolicyObject.

Parameters:
s - the name to be set

getGroupName

public java.lang.String getGroupName()
Returns the group name of the PolicyObject.

Returns:
group name of the policy object

setGroupName

public void setGroupName(java.lang.String str)
Sets the group name of the PolicyObject.

Parameters:
str - the group name to be set

getStatus

public int getStatus()
Returns the status of the PolicyObject.

Returns:
status of the policy object

setStatus

public void setStatus(int i)
Sets the status of the PolicyObject.

Parameters:
i - the status to be set

NOTE

Valid values are NmsPolicyAPI.POLICY_ENABLED and NmsPolicyAPI.POLICY_DISABLED

See Also:
NmsPolicyAPI.POLICY_ENABLED, NmsPolicyAPI.POLICY_DISABLED

addCondition

public boolean addCondition(PolicyCondition pc)
Deprecated. Instead use addPolicyActionAndCondition(PolicyAction , PolicyCondtion)

Adds the PolicyCondition to the PolicyObject.

Parameters:
pc - the PolicyCondition to be added
Returns:
boolean to represent success or failure

getConditions

public java.util.Vector getConditions(java.lang.String key)
Deprecated. Use getPolicyCondition instead

Returns the Vector containing the conditions of the PolicyObject.

Parameters:
key - the key of the PolicyCondition
Returns:
Vector containing the conditions

NOTE

Returns null if PolicyCondition with specified key is not found


getPolicyCondition

public PolicyCondition getPolicyCondition(java.lang.String key)
Returns PolicyCondition for the corresponding key

Parameters:
key - Key of the PolicyCondition
Returns:
PolicyCondition for the given key
Since:
WebNMS 2.3

addAction

public boolean addAction(PolicyAction pa)
Adds the PolicyAction to the PolicyObject.

Parameters:
pa - the PolicyAction to be added
Returns:
boolean to represent success or failure

getActions

public java.util.Vector getActions(java.lang.String key)
Deprecated. Instead use getPolicyAction

Returns the Vector containing the actions the PolicyObject.

Parameters:
key - the key of the PolicyAction
Returns:
Vector containing the actions

NOTE

Returns null if PolicyAction with specified key is not found


getPolicyAction

public PolicyAction getPolicyAction(java.lang.String key)
Returns PolicyAction associated with the key

Parameters:
key - The key of the PolicyAction
Returns:
PolicyAction associated with the key
Since:
WebNMS 2.3

getActionKeys

public java.util.Vector getActionKeys()
Method to get a list of keys (Strings) of the actions

Returns:
Vector containing the action keys

getConditionKeys

public java.util.Vector getConditionKeys()
Method to get a list of keys (Strings) of the conditions

Returns:
Vector containing the condition keys

addPolicyActionAndCondition

public boolean addPolicyActionAndCondition(PolicyAction pa,
                                           PolicyCondition pc)

executePolicy

protected void executePolicy(PolicyEvent policyEvt)
Method to execute the Policy. This is invoked by the policy Mgr. This method checks if the conditions vector size, If 0 then it calls the executeAction of the PolicyObject. else walks through the conditions and invokes checkConditions. If checkConditions returns true it invokes performActions. Please note that once a condition gets satisfied this implementation does not check other conditions.

Parameters:
polcicyEvt - the PolicyEvent

executeAction

protected abstract void executeAction(PolicyEvent policyEvt)
executes action of this PolicyObject.

Parameters:
policyEvt - PolicyEvent

checkConditions

protected boolean checkConditions(java.lang.String key,
                                  PolicyEvent policyEvt)
Checks whether the PolicyCondition with key key is satisfied or not.

Parameters:
key - key of the PolicyCondition to be checked.
policyEvt - PolicyEvent
Returns:
boolen to indicate whether the condition is statisfied or not

performRequiredActions

protected void performRequiredActions(java.lang.String key,
                                      PolicyEvent policyEvt)
Perfroms the PolicyAction with key represented by key

Parameters:
key - key of the PolicyAction to executed
policyEvt - PolicyEvent

setBaseProperties

protected void setBaseProperties(java.util.Properties p)
sets all the base properties(groupName and status) of the policy object

All instances of this class are expected to call this method in their setProperties method (Abstract method in this class) to set their base properties.

Parameters:
p - Properties to be set

getBaseProperties

protected java.util.Properties getBaseProperties()
Returns all the base properties(namely name,groupName and status) of the policy object

All instances of this class are expected to call this method in their getProperties method (Abstract method in this class) to get their base properties.

Returns:
Properties

getProperties

public abstract java.util.Properties getProperties()
Returns the properties of this PolicyObject

Specified by:
getProperties in interface DBInterface
Returns:
Properties

setProperties

public abstract void setProperties(java.util.Properties prop)
Sets the properties for this PolicyObject

Specified by:
setProperties in interface DBInterface
Parameters:
prop - the property to be set.

getPolicyObjectCustomizer

public java.lang.String getPolicyObjectCustomizer()
Returns the fully qualified name of the customizer class for this PolicyObject.

Returns:
name of Customizer class of the this PolicyObject

NOTE

Returns null if there is no customizer class.


setPolicyObjectCustomizer

public void setPolicyObjectCustomizer(java.lang.String customizerClassName)
Method to set PolicyObjectCuatomizer class name

Parameters:
customizerClassName - PolicyObjectCustomizer Class Name as a String

getHelpURL

public java.lang.String getHelpURL()
Returns the help URL of this PolicyObject. The URL must be relative to the help directory.

Returns:
string representing the url

NOTE

Returns null if there is no help associated with the policy object.


setHelpURL

public void setHelpURL(java.lang.String url)
Method for setting helpURL for a PolicyObject

Parameters:
url - HelpURl for the PolicyObject

setRunnableInstance

protected void setRunnableInstance(java.lang.Runnable r)
sets the runnable instance which is responsible for scheduling the policy.

Parameters:
r - Runnable instance

getRunnableInstance

protected java.lang.Runnable getRunnableInstance()
returns the runnable instance which is responsible for scheduling the policy.

Returns:
Runnable instance of the PolicyObject

getTimeVector

public java.util.Vector getTimeVector()
Gets the vetcor containing information about when to schedule. This Vector may may be of size 7 (week basesd ) or 31 (monthbased).

Returns:
Vector containing information about scheduling.

setTimeVector

public void setTimeVector(java.util.Vector timeVector)
Set's the timeVector

Parameters:
timeVector - Vector containing information about scheduling

clone

public java.lang.Object clone()
Description copied from interface: DBInterface
A method to return a new object which is a clone of this object.

Specified by:
clone in interface DBInterface
Overrides:
clone in class java.lang.Object

getKey

public java.lang.String getKey()
Description copied from interface: DBInterface
This is the primary key value of the persistent object.

Specified by:
getKey in interface DBInterface

getKeyName

public java.lang.String getKeyName()
Description copied from interface: DBInterface
The field which is used as key for the object.

Specified by:
getKeyName in interface DBInterface

getUserProperties

public java.util.Properties getUserProperties()
Description copied from interface: DBExtendedInterface
This should return a Properties object . Note it should not return any properties which are fields in the object.It should return those which say are added during runtime in a Hashtable or Properties member field of the object.

Specified by:
getUserProperties in interface DBExtendedInterface

getUserProperty

public java.lang.String getUserProperty(java.lang.String nam)
Specified by:
getUserProperty in interface DBExtendedInterface

removeUserProperty

public java.lang.String removeUserProperty(java.lang.String nam)
Specified by:
removeUserProperty in interface DBExtendedInterface

setUserProperty

public void setUserProperty(java.lang.String nam,
                            java.lang.String val)
Description copied from interface: DBExtendedInterface
To set any additional user property during runtime . Internally it might be stored in a Hashtable or Properties member But should be available from the getUserProperties and getUserProperty methods

Specified by:
setUserProperty in interface DBExtendedInterface

"WEBNMS_5 API Docs"

Copyright © 2013 ZOHO Corp., All Rights Reserved.