org.networkupstools.jnut
Class Command

java.lang.Object
  extended by org.networkupstools.jnut.Command

public class Command
extends java.lang.Object

Class representing a command of a device.

It can be used to retrieve description and execute commands. A Command object can be retrieved from Device instance and can not be constructed directly.

Author:
Emilien Kia

Constructor Summary
protected Command(java.lang.String name, Device device)
          Internally create a command.
 
Method Summary
 void execute()
          Execute the instant command.
 java.lang.String getDescription()
          Retrieve the command description from UPSD and store it in cache.
 Device getDevice()
          Return the device to which the command can be executed.
 java.lang.String getName()
          Return the command name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

protected Command(java.lang.String name,
                  Device device)
Internally create a command.

Parameters:
name - Command name.
device - Device to which the command is attached.
Method Detail

getDevice

public Device getDevice()
Return the device to which the command can be executed.

Returns:
Attached device.

getName

public java.lang.String getName()
Return the command name.

Returns:
Command name.

getDescription

public java.lang.String getDescription()
                                throws java.io.IOException,
                                       NutException
Retrieve the command description from UPSD and store it in cache.

Returns:
Command description
Throws:
java.io.IOException
NutException

execute

public void execute()
             throws java.io.IOException,
                    NutException
Execute the instant command.

Throws:
java.io.IOException
NutException


Copyright © 2011. All Rights Reserved.