AdventNet Web NMS 4 API Specification

com.adventnet.management.config.xml
Class DataSource

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

public class DataSource
extends BaseElement

This class provides various resources of getting data for configuration. DataSource supports data gathering from Inventory, NetworkElement and User. They are identified by the tags InventoryInput, NEInput and UserInput.

A sample DataSource is given below.

<DataSource name="sampleDataSource" associatedTasks="sampleTask" description="Uploads the configuration from one NetworkElement to another NetworkElement">

<!-- User specified Network Element that is to be configured -->
<UserInput id="NEName" name="NetworkElement" value="$DataSourceParam$NEName" />

<!-- Port of the NE to be configured, which is taken from the Inventory maintained by the Web NMS -->
<InventoryInput id="NEPort" MOName="$DataSourceParam$NEName" MOField="DataSourceParam$port" default="161" />

<!-- Port of the NE from which the configuration is to be uploaded -->
<InventoryInput id="port" MOName="$DataSourceParam$name" MOField="$DataSourceParam$port" default="161" />

<!-- Uploading Configuration -->
<NEInput id="1">
<ProtocolMap name="snmp"/>
<Device name="$DataSourceParam$name" port="$InventoryInput$port" />
<Attribute label="location" identifier="1.6.0" type="4" default="AdventNet"/>
</NEInput>
</DataSource>


The input values for this DataSource are
$DataSourceParam$NEName - Specifies the NetworkElement to be configured.
$DataSourceParam$port - ManagedObject property name for the port.
$DataSourceParam$name - Specifies the NetworkElement from which the configuration should be uploaded.

These inputs need to be given by the user on submiting the DataSource and template for execution. ConfigServer substitutes these values in the DataSource XML and starts collecting data for the various inputs defined in the DataSource. Then these collected values will be populated to the template on execution. For UserInputs and InventoryInputs, attribute IDs will be appended to $UserInput$ and $InventoryInput$ respectively and for NEInputs, attributes label will be appended to $NEInput for replacing the attributes values in Template.

The corresponding Template will be
<ConfigTask taskName="sampleTask" version="1.0" isTemplate="true" >
<ProtocolMap name="snmp" >
<Device name="$DataSourceParam$NEName" port="$InventoryInput$NEPort"/>
</ProtocolMap>
<Attribute identifier="1.6.0" label="location" type="4" value=$NEInput$location"/>
</ConfigTask>
On submitting the Task, ConfigServer replaces all the placeholders defined in the Template with the values collected from the DataSource and executes the task for the associated devices.

See Also:
ConfigClientAPI.executeTask(String,Properties), ConfigClientAPI.executeTask(String,String,Device[],Properties), ConfigClientAPI.executeTask(String,String,String[],Properties), Serialized Form

Fields inherited from class com.adventnet.management.config.xml.BaseElement
element, isServer
 
Constructor Summary
DataSource(org.w3c.dom.Element element)
          Constructs DataSource from the element.
DataSource(java.lang.String dataSourceXML)
          Constructs DataSource from dataSourceXML.
 
Method Summary
 java.lang.String[] getAssociatedTasks()
          Returns an array of task names for which the DataSource can be associated for execution.
 java.lang.Object[] getChildElements()
          Returns an object array containing NEInput,UserInput and InventoryInput in the same order as defined in the DataSource.
 java.lang.String getDataSource()
          Returns the DataSource as XML.
 java.lang.String getDataSourceName()
          Returns the name of the DataSource.
 java.lang.String[] getDataSourceParams()
          Returns all the DataSource parameters like $DataSourceParam$<id> ..
 java.lang.String getDescription()
          Returns the description of the DataSource.
 java.lang.String getInventoryHandler()
          Returns the InventoryHandler class that handles the InventoryInput elements present in the DataSource.
 InventoryInput[] getInventoryInputArr()
          Returns an array of InventoryInput present in the DataSource.
 NEInput[] getNEInputArr()
          Returns an array of NEInput present in the DataSource.
 java.lang.String[] getParams(java.lang.String type)
          Returns a String array of NEInput or InventoryInput or DataSourceParam parameter names depending on the type passed.
 UserInput[] getUserInputArr()
          Returns as array of UserInput present in the DataSource.
 java.lang.String toString()
          Returns the DataSource in XML format by transforming the DataSource 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

DataSource

public DataSource(org.w3c.dom.Element element)
           throws InvalidTemplateException
Constructs DataSource from the element.
Parameters:
element - represents the XML document from which the DataSource will be constructed.
Throws:
InvalidTemplateException - if the element is invalid.

DataSource

public DataSource(java.lang.String dataSourceXML)
           throws InvalidTemplateException
Constructs DataSource from dataSourceXML.
Parameters:
dataSourceXML - the dataSourceXML as a string.
Throws:
InvalidTemplateException - if the string passed is invalid.
Method Detail

getDataSourceName

public java.lang.String getDataSourceName()
Returns the name of the DataSource.
Returns:
the dataSource's name if present, else returns null.

getAssociatedTasks

public java.lang.String[] getAssociatedTasks()
Returns an array of task names for which the DataSource can be associated for execution.
Returns:
an array of taskNames associated with the dataSource, null if no taskNames are present.

getDescription

public java.lang.String getDescription()
Returns the description of the DataSource.
Returns:
the dataSource's description if present, else null.

getNEInputArr

public NEInput[] getNEInputArr()
Returns an array of NEInput present in the DataSource.
Returns:
an array of NEInputs that were set into the dataSource, null if no NEInput is present.

getInventoryInputArr

public InventoryInput[] getInventoryInputArr()
Returns an array of InventoryInput present in the DataSource.
Returns:
an array of InventoryInputs that were set into the dataSource, null if no InventoryInput is present.

getUserInputArr

public UserInput[] getUserInputArr()
Returns as array of UserInput present in the DataSource.
Returns:
an array of UserInputs that were set into the dataSource, null if no UserInput is present.

getChildElements

public java.lang.Object[] getChildElements()
Returns an object array containing NEInput,UserInput and InventoryInput in the same order as defined in the DataSource.
Returns:
an object array containing all the inputs, null if no inputs present.
See Also:
NEInput, InventoryInput, UserInput

getDataSource

public java.lang.String getDataSource()
Returns the DataSource as XML.
Returns:
the dataSource as an XML string.

getDataSourceParams

public java.lang.String[] getDataSourceParams()
Returns all the DataSource parameters like $DataSourceParam$<id> .. defined in the DataSource. The values for these placeholders can be given at the time of execution.
Returns:
a string array containing all the dataSourceParams.

getInventoryHandler

public java.lang.String getInventoryHandler()
Returns the InventoryHandler class that handles the InventoryInput elements present in the DataSource.
Returns:
the name of the InventoryHandler associated with the dataSource.
See Also:
InventoryHandler

getParams

public java.lang.String[] getParams(java.lang.String type)
Returns a String array of NEInput or InventoryInput or DataSourceParam parameter names depending on the type passed. If the type is "InventoryInput", it returns an array of $InventoryInput$<id> etc present in the DataSource.
Parameters:
type - the type of the params needed.
Returns:
a string array of the specific type of params that has been requested.

toString

public java.lang.String toString()
Returns the DataSource in XML format by transforming the DataSource Element. Transformation will be done with the default encoding (ISO-8859-1) if encoding pattern is not explicitly specified.
Overrides:
toString in class BaseElement
Returns:
the DataSource XML as a String.

AdventNet Web NMS 4 API Specification