|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.management.config.TaskGenerator
This class provides methods to define or generate configuration information
in XML format. The XML thus got is referred to as a taskXML or task. Tasks
can then be submitted to the ConfigServer using DeviceConfigurationAPI
or ConfigClientAPI for configuring devices.
A task's reusablility can further be increased by defining it as a template.
Such a template based task is created by adding attributes containing standard place
holders as values. ConfigServer supports the following placeholders,
$InventoryInput$<ID>, $NEInput<ID>, $UserInput$<ID> and $DataSourceParam$<ID>
A PlaceHolder has its own way of getting the data.
InventoryInput - Takes values from DB or files. By default ConfigServer takes values from NMS Database for
InventoryInputs.
NEInput - Takes values from Network Element present in the Network.
UserInput - Values provided by the User.
DataSourceParam - Input Values for the DataSource given at the time of executing the Template.
Thus a template based attribute can be created in steps as explained below.
First, the attribute is defined.
SnmpAttribute snmpAttr = new SnmpAttribute("1.6.0", "sysLocation", (byte)4, "$UserInput$location");The PlaceHolders need values and these values are provided by DataSources. So DataSources are needed to be associated for executing template based tasks. They can be generated by using
DataSourceGenerator.
The corresponding DataSource for the above attribute will be
<DataSource>Value of $DataSourceParam$location can be given at the time of executing the template task and this value will be substituted for the Attribute's value on executing the task.
<UserInput id="location" name="NELocation" value="$DataSourceParam$location"/>
</DataSource>
TaskGenerator taskGen = new TaskGenerator();Refer <Web NMS Home>/configtasks/root for some default tasks and <Web NMS Home>/configtasks/root/datasource for the associated dataSources.
taskGen.setTaskName("demoTask");
//Name of the protocol as given in <Web NMS Home>/conf/configprovider.xml
taskGen.setProtocol("snmp");
taskGen.setNewTask(true);
//Devices will be executed in sequential order.
taskGen.setSequential(true);
SnmpDevice device = new SnmpDevice("localhost", "161");
taskGen.setDevices( new SnmpDevice[]{device});
SnmpAttribute snmpAttr = new SnmpAttribute("1.6.0", "sysLocation", (byte)4, "AdventNet");
snmpAttr.setAttribute("MOName", "<Name of the ManagedObject that should be updated in NMS>");
taskGen.addAttribute(snmpAttr);
String taskXML = taskGen.getTask();
ConfigClientAPI,
DeviceConfigurationAPI,
DeviceList,
Device,
Attribute,
DataSourceGenerator, Serialized Form| Field Summary | |
protected java.util.Vector |
attributes
Holds attributes defined for this task. |
protected java.lang.StringBuffer |
buff
Stores the Configuration Information. |
protected org.w3c.dom.Document |
document
Represents the Task XML document. |
| Constructor Summary | |
TaskGenerator()
Creates an empty Attribute Vector for adding attributes. |
|
| Method Summary | |
void |
addAttribute(Attribute attribute)
Method which adds an attribute to the Configuration Task. |
void |
addGroupAttribute(Attribute[] taskAttributes,
java.util.Properties userProps)
Method which adds a group of config attributes and its user properties to the task. |
void |
addProtocolAttribute(java.lang.String name,
java.lang.String value)
Adds protocol specific attribute to a task, like mibsToBeLoaded in SNMP. |
protected void |
generateAttributes(Attribute[] attributes,
org.w3c.dom.Element node)
Called by the generator for generating the attribute specific information. |
Attribute[] |
getAttributeArray()
Returns the assigned attributes for this task. |
java.util.Vector |
getAttributes()
Returns the assigned attributes for this task. |
java.lang.String |
getDataSourceName()
Returns the name of the DataSource asscoiated for this template. |
java.lang.String |
getDescription()
Returns the description of a task. |
java.lang.String[] |
getDeviceList()
Returns the assigned DeviceList names for this task. |
Device[] |
getDevices()
Returns devices that are assigned for configuration. |
java.lang.String |
getProtocol()
Returns the protocol of the task. |
java.lang.String |
getRollbackDocument()
Returns the rollback document name that has been set. |
int |
getRollbackType()
Returns the rollback type which has been set for a task. |
java.util.Vector |
getSubDeviceList()
Returns DeviceList names as a Vector of String array in a CombinedTask. |
java.util.Vector |
getSubDevices()
Returns subDevices as a Vector of Device Array in a CombinedTask. |
java.util.Vector |
getSubTasks()
Returns the subTaskNames as a Vector of Strings in a CombinedTask. |
java.lang.String |
getTask()
Returns configuration data in XML Format. |
java.lang.String |
getTaskName()
Returns the name assigned for this configuration data. |
java.lang.String |
getVersion()
Returns the version of the task XML. |
boolean |
isNewTask()
Returns whether the task is an existing one or to be created from this XML. |
boolean |
isOverwrite()
Says whether the task should be overwritten or not. |
boolean |
isPersistence()
Says whether the task is to be stored in Database or not. |
boolean |
isRollbackNeeded()
Returns whether rollback is needed or not for this task. |
boolean |
isSequential()
Says whether the devices assigned to this task should be executed in a sequential or parallel manner. |
boolean |
isTemplate()
Says whether the Task is a template based one or not. |
void |
saveTask(java.lang.String fileName)
Saves the configuration XML in the specified file. |
void |
setAttributeList(Attribute[] attributeList)
Sets the list of attributes for this task. |
void |
setDataSourceName(java.lang.String dataSourceName)
Sets the DataSource name for this template. |
void |
setDescription(java.lang.String description)
Sets the description for this task. |
void |
setDeviceLevelResult(boolean enableDeviceResult)
Enables the device level result propagation of ConfigServer. |
void |
setDeviceList(java.lang.String[] deviceListNames)
Sets the devicelists for which configuration should be done. |
void |
setDeviceList(java.util.Vector subTaskNames,
java.util.Vector deviceList)
Sets the deviceLists for the subTasks for CombinedTask Configuration. |
void |
setDevices(Device[] devices)
Sets the devices for which the configuration should be done. |
void |
setDevices(java.util.Vector subTaskNames,
java.util.Vector subDevices)
Sets the devices for the sub tasks for CombinedTask Configuration. |
void |
setInterPacketDelay(int timeDelay)
Specifies the delay between successive requests to various agents. |
void |
setNewTask(boolean newTask)
Sets whether the task is a new or an existing task. |
void |
setOverwrite(boolean overwrite)
Specifies whether the task should be overwritten or not. |
void |
setPersistence(boolean persistence)
Specifies whether task should be stored in Database or not. |
void |
setProtocol(java.lang.String protocol)
Sets the protocol for this task. |
void |
setRollback(boolean isRollbackNeeded)
Sets the rollback for the task. |
void |
setRollbackDocument(java.lang.String taskName)
Sets the rollback document for this task. |
void |
setRollbackType(int type)
Specifies the rollback type for this task. |
void |
setSequential(boolean sequential)
Specifies whether the devices should be configured in a sequential or parallel manner. |
void |
setSubTaskNames(java.util.Vector subTaskNames)
Sets the subTasks for Combined Task Configuration. Combined task is the collection of tasks which has already been created .These tasks can belong to different protocols. |
void |
setTaskName(java.lang.String taskName)
Sets the task name for the configuraton information. |
void |
setTemplate(boolean template)
Sets the task to be a template. |
void |
setVersion(java.lang.String version)
Sets the version for the task XML. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Vector attributes
protected org.w3c.dom.Document document
protected java.lang.StringBuffer buff
| Constructor Detail |
public TaskGenerator()
| Method Detail |
public void setDeviceLevelResult(boolean enableDeviceResult)
enableDeviceResult - true if device level results are needed, else false.public void setInterPacketDelay(int timeDelay)
timeDelay - delay time that is to be set in millisecondspublic void setPersistence(boolean persistence)
persistence - true if the task is to be stored in Database otherwise false.public boolean isPersistence()
public void setRollback(boolean isRollbackNeeded)
isRollbackNeeded - true if rollback need to be done for the successfully configured devices, otherwise false.setRollbackType(int),
setRollbackDocument(String)public boolean isRollbackNeeded()
public void setRollbackType(int type)
ConfigConstants.CURRENT_CONFIG
or ConfigConstants.DOCUMENT.If type is CURRENT_CONFIG, ConfigServer keeps the configuration of the
device before applying the task and if the execution fails for this device, ConfigServer applies the previous
configuration for the device. If the type is DOCUMENT, ConfigServer just applies this document for these devices.
By default, rollback type is set to CURRENT_CONFIG.type - the rollback type to be set for the task.ConfigConstants.DOCUMENT,
ConfigConstants.CURRENT_CONFIG,
setRollback(boolean),
setRollbackDocument(String),
getRollbackType()public int getRollbackType()
ConfigConstants.DOCUMENT,
ConfigConstants.CURRENT_CONFIG,
setRollbackType(int)public void setRollbackDocument(java.lang.String taskName)
taskName - the name of the existing task.getRollbackDocument()public java.lang.String getRollbackDocument()
setRollbackDocument(String)public void setDescription(java.lang.String description)
description - description of the task.getDescription()public java.lang.String getDescription()
setDescription(String)public java.util.Vector getAttributes()
public Attribute[] getAttributeArray()
public void setOverwrite(boolean overwrite)
TaskExistsException if one tries to overwrite the existing task if present. By default, the task will
not be overwritten. Also ConfigServer throws ConcurrentModificationException if the task to be
overwritten is currently under execution.overwrite - should be set to true if the task should be overwritten otherwise falsepublic boolean isOverwrite()
public void setSequential(boolean sequential)
sequential - true if the devices are to be configured sequentially otherwise falsepublic boolean isSequential()
public void setProtocol(java.lang.String protocol)
<Web NMS Home>/conf/configprovider.xml.
The protocol value should match with the TYPE value in the provider file.protocol - protocol of the task.getProtocol()public java.lang.String getProtocol()
setProtocol(String)public void setVersion(java.lang.String version)
version - of the task XML.getVersion()public java.lang.String getVersion()
setVersion(String)public void setDevices(Device[] devices)
devices - an array of devices that need to be associated with the task.Device,
setDeviceList(String[])public void setDeviceList(java.lang.String[] deviceListNames)
ConfigClientAPI.saveDeviceList(String).deviceListNames - a String array containing name of deviceLists.DeviceList,
ConfigClientAPI.saveDeviceList(String),
setDevices(Device[]),
getDeviceList()
public void setDevices(java.util.Vector subTaskNames,
java.util.Vector subDevices)
subTaskNames - Vector of subTask names.subDevices - Vector of Device array.setDeviceList(Vector,Vector),
getDevices()
public void setDeviceList(java.util.Vector subTaskNames,
java.util.Vector deviceList)
subTaskNames - Vector of subTaskNames.deviceList - Vector of String array containing deviceListNames.DeviceList,
setDevices(Vector,Vector),
getDeviceList()public void setSubTaskNames(java.util.Vector subTaskNames)
subTaskNames - the names of the subtasks to be included in the Combined Taskpublic java.util.Vector getSubTasks()
public java.util.Vector getSubDevices()
Devicepublic java.util.Vector getSubDeviceList()
DeviceListpublic Device[] getDevices()
setDevices(Device[]),
setDevices(Vector, Vector)public java.lang.String[] getDeviceList()
DeviceList,
setDeviceList(String[]),
setDeviceList(Vector, Vector)public void setTaskName(java.lang.String taskName)
taskName - the name that you want to set for the task.getTaskName()public java.lang.String getTaskName()
setTaskName(String)public void setNewTask(boolean newTask)
newTask - true if the task has to take the attributes
during execution time, false if the task is to be taken from storage.public boolean isNewTask()
public void setDataSourceName(java.lang.String dataSourceName)
dataSourceName - name of the existing DataSource.DataSourceGenerator,
DataSource,
getDataSourceName()public java.lang.String getDataSourceName()
DataSource,
setDataSourceName(String)public boolean isTemplate()
public void setTemplate(boolean template)
template - boolean value which decides whether the task is to be a template or not.DataSourcepublic java.lang.String getTask()
DeviceConfigurationAPI, ConfigClientAPI for executing
the created task XML.DeviceConfigurationAPI,
ConfigClientAPIpublic void saveTask(java.lang.String fileName)
fileName - name of the file for storing the configuration information.
protected void generateAttributes(Attribute[] attributes,
org.w3c.dom.Element node)
attributes - array of Attributes.node - parent node for these attributes.Attributepublic void addAttribute(Attribute attribute)
attribute - an com.adventnet.management.config.xml.Attribute valuesetNewTask(boolean)
public void addGroupAttribute(Attribute[] taskAttributes,
java.util.Properties userProps)
taskAttributes - an array of attributes.userProps - userSpecificProperties.setNewTask(boolean)public void setAttributeList(Attribute[] attributeList)
attributeList - an array of attributes.setNewTask(boolean)
public void addProtocolAttribute(java.lang.String name,
java.lang.String value)
name - protocol specific property like mibsToBeLoaded in SNMP.value - value to be substituted for this specific property.
|
AdventNet Web NMS 4 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||