AdventNet Web NMS 4 API Specification

com.adventnet.management.config.xml
Class ConfigTask

java.lang.Object
  |
  +--com.adventnet.management.config.xml.BaseElement
        |
        +--com.adventnet.management.config.xml.ConfigTask
All Implemented Interfaces:
java.io.Serializable

public class ConfigTask
extends BaseElement

This class holds configuration data that has to be applied over a set of Network Elements. Configuration data are represented in the form of Attributes. Once a task is created , it can be reused for configuring different set of devices latter. Tasks of same or different protocols can also be combined and can be executed over a set of devices at a strech.This class holds configuration data in XML and its corresponding DTD is present in <Web NMS Home>/configtasks/Task.dtd. Task XML can be generated using TaskGenerator class. ConfigServer also supports template based tasks. These tasks contain placeholders ( instead of having static data ) which will be replaced at the time of executing the task.DataSources need to be associated for executing template tasks.DataSources define the rules for getting the data for template tasks.

Task XML

<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- Example SNMP ConfigTask for configuring snmp attributes of a remote host. -->

<ConfigTask taskName="SystemGroupConfiguration"
            description="This task is used for configuring the snmp attributes of a remote host."
            isNewTask="true"
            isOverwrite="true"
            sSequential="false" >
<!-- Protocol used for configuration ie., SNMP protocol is specified here. -->
 <ProtocolMap  name="snmp" />

<!-- SNMP attribute sysContact of the remote host is set to test1. -->
 <Attribute identifier="1.4.0" type="4" label="sysContact" value="sysAdmin"/>

<!-- SNMP attribute sysLocation of the remote host is set to test2. -->
 <Attribute identifier="1.6.0" type="4" label="sysLocation" value="AdventNet"/>

</ConfigTask>
 

Task XML - Combined Task

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example Task that Combines two SubTasks. -->

<ConfigTask taskName="combinedTask"
                    version="1.0"
                    combinedTask="true"
                    isOverwrite="true"
                    isSequential="false"
                    rollbackNeeded="false"
                    isNewTask="true">
<!-- SubTasks and its DeviceList Mapping -->
<DeviceTaskMap
        taskName="FileTransfer">
</DeviceTaskMap>
<DeviceTaskMap
        taskName="SystemGroupConfiguration">
</DeviceTaskMap>

</ConfigTask>

See Also:
TaskGenerator, SnmpTaskGenerator, Serialized Form

Fields inherited from class com.adventnet.management.config.xml.BaseElement
element, isServer
 
Constructor Summary
ConfigTask()
          Creates a ConfigTask by initializing an empty Element of name "ConfigTask".
ConfigTask(org.w3c.dom.Element element)
          Creates a ConfigTask from this element.
ConfigTask(java.lang.String xmlString)
          Creates a ConfigTask from the XML String.
 
Method Summary
 Attribute[] getConfigAttributes()
          Returns the attributes defined for this task.If the task is a combinedtask, then it returns null.
 java.lang.String getDescription()
          Returns the detailed description about the task.
 DeviceList[] getDeviceList()
          Returns the DeviceList array defined for this ConfigTask.
 Device[] getDevices()
          Returns the devices associated for this task.
 java.lang.String getProtocol()
          Returns the name of the protocol for this task.If the task is a combined task , it returns null.
 java.lang.String getRollbackDocument()
          Returns the name of the rollback document.
 int getRollbackType()
          Returns the type of rollback for the task ,which can be either CurrentConfiguration or RollbackDocument.
 java.util.Vector getSubDeviceList()
          Returns the Vector of DeviceList array for CombinedTasks.
 java.util.Vector getSubDevices()
          Returns the Vector of Device array for CombinedTasks.
 java.lang.String[] getSubTaskNames()
          Returns an array of subtasks present in a CombinedTask.
 java.lang.String getTaskName()
          Returns the name of the ConfigTask.
 java.lang.String getVersion()
          Returns the version of the task.
 boolean isCombinedTask()
          Returns whether the task is a CombinedTask or Single Task.
 boolean isPersistence()
          Returns whether the task is a persistence one or not.
 boolean isRollbackNeeded()
          Returns whether rollback is required or not for the task.
 boolean isTemplate()
          Returns true for template based tasks.
 java.lang.String toString()
          Returns the ConfigTask in XML format by transforming the ConfigTask Element.
 
Methods inherited from class com.adventnet.management.config.xml.BaseElement
addSubTag, getAttribute, getElement, getProperties, getSubTagsByName, hasAttribute, removeSubTagsByName, setAttribute, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigTask

public ConfigTask(org.w3c.dom.Element element)
           throws InvalidTemplateException
Creates a ConfigTask from this element.
Parameters:
element - element containing ConfigTask as the root element.
Throws:
InvalidTemplateException - if the element is null or element's tag name is not equal to ConfigTask.

ConfigTask

public ConfigTask()
           throws InvalidTemplateException
Creates a ConfigTask by initializing an empty Element of name "ConfigTask".
Throws:
InvalidTemplateException - if any exception araises in creating the Element.

ConfigTask

public ConfigTask(java.lang.String xmlString)
           throws InvalidTemplateException
Creates a ConfigTask from the XML String.
Parameters:
xmlString - a String represents the task XML.
Throws:
InvalidTemplateException - if string is an invalid XML.
Method Detail

isCombinedTask

public boolean isCombinedTask()
Returns whether the task is a CombinedTask or Single Task. CombinedTask consists of a group of subtasks of same or different protocols that can be executed over a different set of devices.
Returns:
true if the task is a CombinedTask,otherwise false.

getRollbackDocument

public java.lang.String getRollbackDocument()
Returns the name of the rollback document. Rollback document is nothing but a task which will be applied to the devices if configuration fails for any one of a device during configuration and thus maintaining the configuration consistency in all the devices.Rollback document won't be applied for devices with status either IGNORED or NOT_STARTED during configuration.
Returns:
name of the rollback document if assigned or null.

isRollbackNeeded

public boolean isRollbackNeeded()
Returns whether rollback is required or not for the task.
Returns:
true if rollback is required for the task.

getRollbackType

public int getRollbackType()
Returns the type of rollback for the task ,which can be either CurrentConfiguration or RollbackDocument. If the returned value is 1 then ConfigServer uploads the current configuration before configuring the particular device. This configuration will later be applied if configuration fails for any one of the device.If the returned value is 2 ,then specified rollback document will be applied. If attribute "rollbackType" is not defined, then it returns -1.
Returns:
an int value.

getTaskName

public java.lang.String getTaskName()
Returns the name of the ConfigTask.
Returns:
name of the Task.

getConfigAttributes

public Attribute[] getConfigAttributes()
Returns the attributes defined for this task.If the task is a combinedtask, then it returns null.
Returns:
an Attribute[] value.

getProtocol

public java.lang.String getProtocol()
Returns the name of the protocol for this task.If the task is a combined task , it returns null.
Returns:
Protocol for the task.

getVersion

public java.lang.String getVersion()
Returns the version of the task. This version attribute is intended for future use.
Returns:
version of the task.

getDevices

public Device[] getDevices()
Returns the devices associated for this task. If the task is a CombinedTask, it returns null.Even though devices are associated during task execution, it won't get stored, only the attribute related information will get stored. Devices can be stored by means of DeviceList.
Returns:
Device[] value

getDeviceList

public DeviceList[] getDeviceList()
Returns the DeviceList array defined for this ConfigTask. DeviceList defines a group of devices which can be stored in DB and reused like a Task. Once a DeviceList is defined,it can be referred by its name for futhur configuration of these devices for different tasks. If the task is a Combined one, it returns null.
Returns:
DeviceList[] value

getSubDeviceList

public java.util.Vector getSubDeviceList()
Returns the Vector of DeviceList array for CombinedTasks. Each element( DeviceList array ) in the vector correponds to a subtask in a Combined Task.If DeviceLists are not defined for a subtask, then the corresponding element in the vector will be null. If the task is not a combined one,it returns null.
Returns:
vector of DeviceList array.

getSubTaskNames

public java.lang.String[] getSubTaskNames()
Returns an array of subtasks present in a CombinedTask.
Returns:
subtasks defined for this CombinedTask.

getSubDevices

public java.util.Vector getSubDevices()
Returns the Vector of Device array for CombinedTasks. Each element( Device array ) in the vector correponds to a subtask in a Combined Task.If Devices are not defined for a subtask, then the corresponding element in the vector will be null. If the task is not a combined one,it returns null.
Returns:
vector of Device array.

isTemplate

public boolean isTemplate()
Returns true for template based tasks. DataSources need to be associated for executing template based tasks.
Returns:
true if the task is a template, otherwise false.

getDescription

public java.lang.String getDescription()
Returns the detailed description about the task. If the description attribute is not defined, it returns null.
Returns:
description about the task.

isPersistence

public boolean isPersistence()
Returns whether the task is a persistence one or not. By default, it is true. If the value is true, ConfigServer stores the task in DB or flat files ( depending on the mode, configurable through <Web NMS Home > /conf/NmsProcessesBE.conf )on executing the task, otherwise it won't be stored in DB.
Returns:
true if persistence attribute is not defined or its value is true, otherwise false.

toString

public java.lang.String toString()
Returns the ConfigTask in XML format by transforming the ConfigTask Element.
Overrides:
toString in class BaseElement
Returns:
task in XML.

AdventNet Web NMS 4 API Specification