AdventNet Web NMS 4 API Specification

com.adventnet.management.config
Interface DeviceConfigurationAPI

All Superinterfaces:
java.rmi.Remote

public interface DeviceConfigurationAPI
extends java.rmi.Remote

This is an API interface for configuring devices through Configuration Server. These APIs can be accessed either through RMI or directly. This interface can be got from getDeviceConfigurationAPI(String) method in ConfigAPIFactory

//To get DeviceConfigurationAPI instance
ConfigAPIFactory configAPIFactory = (ConfigAPIFactory)Naming.lookup
        ("rmi://<Host where NMS is running>:<RMIRegistry Port>/ConfigurationAPI");
DeviceConfigurationAPI deviceConfigurationAPI =
        configAPIFactory.getDeviceConfigurationAPI("<User Name>");

//For getting hostName in case of Applet Clients
String hostName = <Applet>.getDocumentBase().getHost();

Since:
2.2
See Also:
ConfigAPIFactory

Method Summary
 void createTask(java.lang.String taskXML)
          Creates a new configuration task.
 void deregisterTaskListener(java.lang.String taskName)
          Deregisters all the listeners associated with the task.
 void executeTask(java.lang.String taskXML)
          Starts Configuration for the specified devices.
 java.lang.String executeTask(java.lang.String taskXML, int timeout)
          Starts Configuration for the specified devices.
 java.lang.String getDeviceConfiguration(java.lang.String taskXML)
          Uploads configuration from the device specified.
 java.util.Vector getDevices(java.lang.String taskName)
          Returns a Vector devices assigned for this task.
 java.util.Vector getPendingDevices(java.lang.String taskName)
          Returns a Vector of pending devices associated with that task.
 java.util.Vector getPendingTasks()
          Returns a Vector of pending task names that needs to be executed over pending devices.
 java.lang.String getStatus(java.lang.String taskName)
          Returns the status of the task.
 java.lang.String getStatus(java.lang.String taskName, java.lang.String device)
          Returns the status of a specific device in a task.
 java.lang.String getTask(java.lang.String taskName)
          Returns the task stored by ConfigServer.
 void registerTaskListener(java.lang.String taskName, ConfigTaskListener listener)
          Registers a listener for this task.
 void removeTask(java.lang.String taskName)
          Removes the task from ConfigServer.
 void retainSession()
          Retains the Session for a particular user
 void terminateSession()
          Terminates the session for the particular user
 

Method Detail

createTask

public void createTask(java.lang.String taskXML)
                throws ConfigException,
                       TaskExistsException,
                       java.rmi.RemoteException,
                       UserTransactionException
Creates a new configuration task. TaskGenerator class can be used to generate taskXML. This taskXML contains the configuration data for configuring the devices. It throws TaskExistsException if task with the same name already exists and attribute overwrite is false in the task XML.
Parameters:
taskXML - task in XML.
Throws:
ConfigException - if task is not successfully created.
TaskExistsException - if task already exists.
ConcurrentModificationException - if ConfigServer is currently executing this task.
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
UserTransactionException - if any DB error occurs on saving the ConfigTask.
See Also:
TaskGenerator

executeTask

public void executeTask(java.lang.String taskXML)
                 throws TaskExistsException,
                        TaskNotFoundException,
                        ConfigException,
                        InvalidTaskException,
                        java.rmi.RemoteException
Starts Configuration for the specified devices. TaskGenerator class can be used to generate taskXML. This taskXML contains information for configuring the devices.
Parameters:
taskXML - task in XML.
Throws:
TaskExistsException - if task already exists( isOverwrite attribute is false in taskXML).
TaskNotFoundException - if task does not exist( isNewTask attribute is false in taskXML).
ConfigException - if it fails to execute the task.
InvalidTaskException - if taskXML is an invalid one.
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
See Also:
TaskGenerator

executeTask

public java.lang.String executeTask(java.lang.String taskXML,
                                    int timeout)
                             throws TaskExistsException,
                                    TaskNotFoundException,
                                    ConfigException,
                                    InvalidTaskException,
                                    java.rmi.RemoteException
Starts Configuration for the specified devices. TaskGenerator class can be used to generate taskXML. This taskXML contains information for configuring the devices. If the task is not finished within the specified time, ConfigException is thrown but the task continues its execution in ConfigServer.
Parameters:
taskXML - task in XML.
timeout - time in milliseconds, if timeout is -1, it waits till the task is over.
Returns:
ConfigResult in XML.
Throws:
TaskExistsException - if task already exists( isOverwrite attribute is false in taskXML).
TaskNotFoundException - if task does not exist.( isNewTask attribute is false in taskXML).
ConfigException - if it fails to execute the task.
InvalidTaskException - if taskXML is an invalid one.
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
See Also:
TaskGenerator, ConfigResult

getDeviceConfiguration

public java.lang.String getDeviceConfiguration(java.lang.String taskXML)
                                        throws ConfigException,
                                               TaskNotFoundException,
                                               java.rmi.RemoteException
Uploads configuration from the device specified.
Parameters:
taskXML - task in XML
Returns:
task in XML containing the uploaded configuration.
Throws:
TaskNotFoundException - if the requested task is not found.
ConfigException - if Upload fails for the device.
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
See Also:
TaskGenerator

getTask

public java.lang.String getTask(java.lang.String taskName)
                         throws TaskNotFoundException,
                                java.rmi.RemoteException,
                                ConfigException,
                                UserTransactionException
Returns the task stored by ConfigServer. ConfigTask can be created from this XML by using one of its constructor.
Parameters:
taskName - name of the task to be retrieved.
Returns:
taskXML
Throws:
TaskNotFoundException - if task does not exist.
ConfigException - if it fails to retrieve the task.
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
UserTransactionException - if any DB error occurs on retrieving the ConfigTask.
See Also:
ConfigTask

getStatus

public java.lang.String getStatus(java.lang.String taskName)
                           throws java.rmi.RemoteException
Returns the status of the task.
Parameters:
taskName - name of the task which is currently under execution.
Returns:
a String representing the status of the task or null if the task is not currently under execution.

OVER
when all the devices of the specified task has the status either Finished or Failed

INPROGRESS
If the Status is InProgress for atleast a device

NOTSTARTED
If the status is NotStarted for all the devices.

Throws:
java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
See Also:
ConfigConstants.OVER, ConfigConstants.INPROGRESS, ConfigConstants.NOTSTARTED

getStatus

public java.lang.String getStatus(java.lang.String taskName,
                                  java.lang.String device)
                           throws java.rmi.RemoteException
Returns the status of a specific device in a task.
Parameters:
taskName - name of the task to which this device belongs.
device - name of the device assigned to this task for configuration.
Returns:
  • Status of the device in ConfigServer
  • null if there is no such device assigned for the task or task is not currently under execution.
  • Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
    See Also:
    ConfigConstants.FINISHED, ConfigConstants.FAILED, ConfigConstants.INPROGRESS, ConfigConstants.NOTSTARTED

    getDevices

    public java.util.Vector getDevices(java.lang.String taskName)
                                throws java.rmi.RemoteException
    Returns a Vector devices assigned for this task.
    Parameters:
    taskName - name of the task.
    Returns:
    a Vector of device names or null if this task is not currently under execution.
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
    See Also:
    Device

    getPendingDevices

    public java.util.Vector getPendingDevices(java.lang.String taskName)
                                       throws java.rmi.RemoteException
    Returns a Vector of pending devices associated with that task.
    Parameters:
    taskName - name of the task.
    Returns:
    a Vector of device names or null if the task is not currently execution.
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
    See Also:
    Device

    getPendingTasks

    public java.util.Vector getPendingTasks()
                                     throws java.rmi.RemoteException
    Returns a Vector of pending task names that needs to be executed over pending devices.
    Returns:
    a vector containing all the pending tasks.
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.

    removeTask

    public void removeTask(java.lang.String taskName)
                    throws ConfigException,
                           java.rmi.RemoteException,
                           UserTransactionException
    Removes the task from ConfigServer.
    Parameters:
    taskName - Specifies the task to be removed.
    Throws:
    ConfigException - if removal of task fails.
    ConcurrentModificationException, - if the task is currently in execution by ConfigServer.
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.
    UserTransactionException - if any error occurs during transaction.

    retainSession

    public void retainSession()
                       throws java.rmi.RemoteException
    Retains the Session for a particular user
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.

    terminateSession

    public void terminateSession()
                          throws java.rmi.RemoteException
    Terminates the session for the particular user
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.

    registerTaskListener

    public void registerTaskListener(java.lang.String taskName,
                                     ConfigTaskListener listener)
                              throws java.rmi.RemoteException
    Registers a listener for this task.
    Method attributeSetStatus(AttributeEvent ae) will be called for each identfier(for each retry), deviceTaskStatus(ConfigTaskEvent cts) will be called for each device (on completing the total retry for that device) and taskStatus(ConfigTaskOverEvent ctoe) will be called, on the completion of the Task.
    Parameters:
    taskName - name of the task for which ConfigServer sends the Configuration results.
    listener - any class implementing ConfigTaskListener
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.

    deregisterTaskListener

    public void deregisterTaskListener(java.lang.String taskName)
                                throws java.rmi.RemoteException
    Deregisters all the listeners associated with the task.
    Parameters:
    taskName - name of the task for which the listener has to be deregistered.
    Throws:
    java.rmi.RemoteException - if any communication related exceptions occur on executing this remote method call.

    AdventNet Web NMS 4 API Specification