org.networkupstools.jnut
Class Variable

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

public class Variable
extends java.lang.Object

Class representing a variable of a device.

It can be used to get and set its value (if possible). A Variable object can be retrieved from Device instance and can not be constructed directly.

Author:
Emilien Kia

Constructor Summary
protected Variable(java.lang.String name, Device device)
          Internally create a variable.
 
Method Summary
 java.lang.String getDescription()
          Retrieve the variable description from UPSD and store it in cache.
 Device getDevice()
          Return the device to which the variable is related.
 java.lang.String getName()
          Return the variable name.
 java.lang.String getValue()
          Retrieve the variable value from UPSD and store it in cache.
 void setValue(java.lang.String value)
          Set the variable value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variable

protected Variable(java.lang.String name,
                   Device device)
Internally create a variable.

Parameters:
name - Variable name.
device - Device to which the variable is attached.
Method Detail

getDevice

public Device getDevice()
Return the device to which the variable is related.

Returns:
Attached device.

getName

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

Returns:
Command name.

getValue

public java.lang.String getValue()
                          throws java.io.IOException,
                                 NutException
Retrieve the variable value from UPSD and store it in cache.

Returns:
Variable value
Throws:
java.io.IOException
NutException

getDescription

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

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

setValue

public void setValue(java.lang.String value)
              throws java.io.IOException,
                     NutException
Set the variable value. Note the new value can be applied with a little delay depending of UPSD and connection.

Parameters:
value - New value for the variable
Throws:
java.io.IOException
NutException


Copyright © 2011. All Rights Reserved.