|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface NmsPolicyAPI
The AdventNet Web NMS Policy Module provides support for network based management with an extensible framework for scalable administration of the Web NMS server and the network elements managed by Web NMS. The primary goal of the engine is to enable administration of complex functions easily. In the context of network management, policies are specifications for network management systems or network elements directly, which can be used by administrators to control a range of network activities. In the context of Web NMS, policies are used to customize the behaviour of the NMS and to provide a framework for adding policies for different network elements.
For example, Web NMS provides the following policies.
1. Deleting all failed nodes from the management system, if down for more than a specified time.
2. Escalating alarms of a specific severity, if in the same state for more than a specified time.
3. Changing the tester class at runtime to get more details about the object, apart from status.
NmsPolicyAPI defines the methods for accessing PolicyObject in PolicyModule.
Some of the important methods available are :
addPolicy(PolicyObject po) - For adding a new PolicyObject
updatePolicy(String policyname,Properties prop) - For updating existing PolicyObject
executePolicy(PolicyEvent policyEvt) - For executing PolicyObjects
stopPolicy(String policyname) - For stopping the execution of a PolicyObject
deletePolicy(String name) - For deleting a PolicyObject
register(PolicyObserver observer) - For registering as a PolicyObserver thereby getting notification
NmsPolicyAPI handle can be obtained from one of the following ways.
On the same JVM with Web NMS it can be obtained using,
NmsPolicyAPI api = (NmsPolicyAPI)NmsUtil.getAPI("NmsPolicyAPI");
This API is also available as a Remote Object. Use the following statement for getting a remote handle
(assuming rmihost as localhost and port as 1099) to NmsPolicyAPI
NmsPolicyAPI api = (NmsPolicyAPI)Naming.lookup("rmi://localhost:1099/NmsPolicyAPI");
In case of RMI secure mode handle can be obtained using
RMIAccessAPI rmiApi = (RMIAccessAPI) Naming.lookup ("rmi://localhost:1099/RMIAccessAPI");
NmsPolicyAPI api = (NmsPolicyAPI)rmiApi.getAPI ("username", "password","NmsPolicyAPI");
| Field Summary | |
|---|---|
static int |
AND_CONDITION
Deprecated. |
static int |
DEFAULT_PERIOD
variable to represent periodicity for PeriodicPolicyObject. |
static int |
OR_CONDITION
Deprecated. |
static int |
POLICY_ADDED
Variable to represent Policy addition |
static int |
POLICY_DELETED
Variable for PolicyObject Deletion |
static int |
POLICY_DISABLED
variable to represent the status of the PolicyObject as disabled. |
static int |
POLICY_ENABLED
variable to represent the status of the PolicyObject as enabled. |
static int |
POLICY_EXECUTED
Variable to represent PolicyObject execution |
static int |
POLICY_SCHEDULED
Variable to represent scheduling of PolicyObject |
static int |
POLICY_STOPPED
Variable to represent stopping of a PolicyObject |
static int |
POLICY_UPDATED
Variable to represent PolicyObject modification |
| Method Summary | |
|---|---|
boolean |
addAction(java.lang.String policyname,
PolicyAction pa)
Deprecated. We strongly recommend you to use addPolicyActionAndCondition(String policyname , PolicyAction pa , PolicyCondition pc) |
boolean |
addCondition(java.lang.String policyname,
PolicyCondition pc)
Deprecated. We strongly recommend you to use addPolicyActionAndCondition(String policyname , PolicyAction pa , PolicyCondition pc) |
boolean |
addPolicy(PolicyObject po)
Adds the policy represented by the PolicyObject to the Policy Module. |
boolean |
addPolicyActionAndCondition(java.lang.String policyname,
PolicyAction pa,
PolicyCondition pc)
Adds the PolicyAction and PolicyCondition to the PolicyObject whose name corresponds to policyname. |
boolean |
deletePolicy(java.lang.String name)
Deletes the policy represented by name
from the system and returns true on successful deletion. |
void |
executePolicy(PolicyEvent policyEvt)
Executes the policy which are all listed in PolicyEvent. |
PolicyObject |
getPolicy(java.lang.String name)
Returns the PolicyObject whose name correspondsc to name. |
PolicyObject |
getPolicy(java.lang.String name,
boolean newInstance)
Deprecated. as of WebNMS2.2 |
java.util.Hashtable |
getPolicyConfParameters()
Method to get all parameters available in conf/policy.conf |
java.util.Vector |
getPolicyNames()
Returns the name of all the PolicyObjects that exist in PolicyModule. |
boolean |
isInitialized()
Returns status of the policy module. |
boolean |
register(PolicyObserver observer)
Registers the PolicyObserver to the Policy module returns true if successful. |
void |
removeAllObservers()
Remove all PolicyObservers registered to the Policy module |
boolean |
removeObserver(PolicyObserver observer)
Removes the PolicyObserver registered to the Policy module. |
void |
setPolicyStatus(java.lang.String policyname,
int status)
Sets the status of the PolicyObject whose name corresponds to policyname to status. |
boolean |
stopPolicy(java.lang.String policyname)
Stops the execution of PolicyObject for the given policyname. |
boolean |
updatePolicy(java.lang.String policyname,
java.util.Properties prop)
updates the PolicyObject whose name corresponds to policyname
with the Properties prop. |
| Methods inherited from interface com.adventnet.nms.util.CommonAPI |
|---|
getCompleteList, getObjectNamesWithProps, getPropertiesOfObject |
| Field Detail |
|---|
static final int POLICY_ENABLED
NOTE
Only Enabled PolicyObjects can be executed.
static final int POLICY_DISABLED
NOTE
Disabled PolicyObjects cannot be executed.
static final int AND_CONDITION
NOTE
This is the default value of the conditionType of the PolicyObject
static final int DEFAULT_PERIOD
NOTE
The default value is 10 seconds.
static final int OR_CONDITION
NOTE
This is not the default value for the conditionType of the PolicyObject.
static final int POLICY_ADDED
static final int POLICY_UPDATED
static final int POLICY_DELETED
static final int POLICY_EXECUTED
static final int POLICY_STOPPED
static final int POLICY_SCHEDULED
| Method Detail |
|---|
boolean addPolicy(PolicyObject po)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
po - the PolicyObject to be added
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
boolean deletePolicy(java.lang.String name)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
name
from the system and returns true on successful deletion.
Otherwise, returns false.
name - Name of the PolicyObject to be deleted
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
PolicyObject getPolicy(java.lang.String name,
boolean newInstance)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
name.
A new instance will be returned if the boolean createNewInstance is true.
NOTE
Creating new instance of policy depending on boolean passed
is no longer exists. Functionality of this method
is same as the method
getPolicy(String policyName)
name - name of the PolicyObject to be retrievedcreateNewInstance - boolean to determine whether to create new instance or not
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
PolicyObject getPolicy(java.lang.String name)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
name.
Returns null if no policy exist with the specified
name.
name - name of the PolicyObject to be retrieved
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
java.util.Vector getPolicyNames()
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
boolean addAction(java.lang.String policyname,
PolicyAction pa)
throws java.rmi.RemoteException
addPolicyActionAndCondition(String policyname , PolicyAction pa , PolicyCondition pc)
pa to the PolicyObject whose name
corresponds to policyname.
policyname - name of the PolicyObjectpa - the PolicyAction to be added
java.rmi.RemoteException - if export fails
boolean addCondition(java.lang.String policyname,
PolicyCondition pc)
throws java.rmi.RemoteException
addPolicyActionAndCondition(String policyname , PolicyAction pa , PolicyCondition pc)
pc to the PolicyObject whose name
corresponds to policyname.
policyname - name of the PolicyObjectpc - the PolicyCondition to be added
java.rmi.RemoteException - if export fails
boolean addPolicyActionAndCondition(java.lang.String policyname,
PolicyAction pa,
PolicyCondition pc)
throws java.rmi.RemoteException
policyname. While adding PolicyAction and Conditon through
this method key for PolicyAction and PolicyCondition should match each other. Otherwise
PolicyAction and PolicyCondition won't get added and false will be returned
policyname - name of the PolicyObject to which Action and Condition are to be addedpa - PolicyAction to be addedpc - the PolicyCondition to be added
java.rmi.RemoteException - if export fails
void executePolicy(PolicyEvent policyEvt)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
Code snippet for executing a PolicyObject
First PolicyEvent has to be constructed as
PolicyEvent pe = new PolicyEvent(java.lang.Object source);
where, source specifies the object from which the event is fired.
Then policies which has to executed are added as
pe.addPolicyNamesToTrigger("testpolicy1");
then added PolicyObject with the name "testpolicy1" can be executed as
api.executePolicy(pe);
Even all policies belonging to a group group can be executed as
PolicyEvent pe = new PolicyEvent(this);
pe.addPolicyNamesToTrigger("testpolicy1");
pe.addPolicyGroupsToTrigger("backuppolicygroup")
then all PolicyObjects with the groupName "backuppolicygroup" can be executed as
api.executePolicy(pe);
policyEvt - PolicyEvent with list of policies to be executed
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.PolicyEvent
void setPolicyStatus(java.lang.String policyname,
int status)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
policyname to status. Status can be
any one of NmsPolicyAPI.POLICY_ENABLED or
NmsPolicyAPI.POLICY_DISABLED
policyname - name of the PolicyObjectstatus - the status to be set for the PolicyObject
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.POLICY_ENABLED,
POLICY_DISABLED
boolean updatePolicy(java.lang.String policyname,
java.util.Properties prop)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
policyname
with the Properties prop.
policyname - name of the PolicyObjectprop - the properties
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
boolean stopPolicy(java.lang.String policyname)
throws java.rmi.RemoteException,
NmsStorageException,
UserTransactionException
policyname - name of the PolicyObject
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
NmsStorageException - if any SQL error occurs while
doing database operations
UserTransactionException - if the current transaction
is timed out or rolled back.
boolean register(PolicyObserver observer)
throws java.rmi.RemoteException
observer - the PolicyObserver to be registered
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
boolean isInitialized()
throws java.rmi.RemoteException
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
boolean removeObserver(PolicyObserver observer)
throws java.rmi.RemoteException
observer - the PolicyObserver to be removed
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
void removeAllObservers()
throws java.rmi.RemoteException
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
java.util.Hashtable getPolicyConfParameters()
throws java.rmi.RemoteException
Key Data Typeclassnames String array containing all available class names displaynames String array containing all available display names policycolor Properties with the information policy color. It will be some thing like Key --- Value DISABLED = "191-191-191" STOPPED = "255-223-128" EXECUTED = "32-255-255" SCHEDULED = "0-255-75"
java.rmi.RemoteException - if any remote export fails during the
execution of a remote method call.
|
"WEBNMS_5 API Docs" | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||