Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.agent
Class AgentRemoteValue

java.lang.Object
  extended by org.hyperic.hq.agent.AgentRemoteValue
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, GenericValueMap
Direct Known Subclasses:
AgentBundle_args, AgentBundle_result, AgentDie_args, AgentDie_result, AgentPing_args, AgentPing_result, AgentReceiveFileData_args, AgentRestart_args, AgentRestart_result, AgentUpgrade_args, AgentUpgrade_result, ControlPluginAdd_args, ControlPluginAdd_result, ControlPluginCommand_args, ControlPluginCommand_result, ControlPluginRemove_args, ControlPluginRemove_result, CreateToken_args, CreateToken_result, DeleteProperties_args, DeleteProperties_result, GetMeasurements_args, GetMeasurements_result, GetServer_args, GetServer_result, LiveData_args, LiveData_result, ScheduleMeasurements_args, ScheduleMeasurements_result, SetProperties_args, SetProperties_result, SetServer_args, SetServer_result, TrackPluginAdd_args, TrackPluginAdd_result, TrackPluginRemove_args, TrackPluginRemove_result, UnscheduleMeasurements_args, UnscheduleMeasurements_result

public class AgentRemoteValue
extends java.lang.Object
implements GenericValueMap, java.io.Externalizable

An object representing key/value pairs to be passed to, and returned from, remote method calls. This object provides a way for values to be sent and received in a way which abstracts the serialization or protocol implementation.

See Also:
Serialized Form

Constructor Summary
AgentRemoteValue()
          Create a new AgentRemoteValue object with default innards.
AgentRemoteValue(java.lang.String[][] keyvals)
          Create a new AgentRemoteValue object with some default key/value pairs.
 
Method Summary
static AgentRemoteValue fromStream(java.io.DataInput is)
           
 java.util.Set getKeys()
           
 java.lang.String getValue(java.lang.String key)
          Retrieve a value based on the key.
 double getValueAsDouble(java.lang.String key)
          Get a value, interpreted as a double.
 int getValueAsInt(java.lang.String key)
          Get a value, interpreted as an integer.
 long getValueAsLong(java.lang.String key)
          Get a value, interpreted as a long integer.
 void readExternal(java.io.ObjectInput in)
           
 void setValue(java.lang.String key, java.lang.String val)
          Setup a key/value pair.
 void toStream(java.io.DataOutput os)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentRemoteValue

public AgentRemoteValue()
Create a new AgentRemoteValue object with default innards.


AgentRemoteValue

public AgentRemoteValue(java.lang.String[][] keyvals)
                 throws java.lang.IllegalArgumentException
Create a new AgentRemoteValue object with some default key/value pairs.

Parameters:
keyvals - an array of arrays containing 2 elements. The first element is the key, and the second is its associated value.
Throws:
java.lang.IllegalArgumentException - indicating the passed array contained sub-arrays of size != 2.
Method Detail

setValue

public void setValue(java.lang.String key,
                     java.lang.String val)
Setup a key/value pair.

Specified by:
setValue in interface GenericValueMap
Parameters:
key - Key to assign the value to
val - Value to assign to the key

getValue

public java.lang.String getValue(java.lang.String key)
Retrieve a value based on the key.

Specified by:
getValue in interface GenericValueMap
Parameters:
key - Key for which to get the value.
Returns:
the value of a previously set key

getValueAsLong

public long getValueAsLong(java.lang.String key)
                    throws AgentRemoteException
Get a value, interpreted as a long integer.

Parameters:
key - Key for which to get the value.
Returns:
The value for the key 'key', as a long value.
Throws:
AgentRemoteException - if the value cannot be interpted as a long.

getValueAsDouble

public double getValueAsDouble(java.lang.String key)
                        throws AgentRemoteException
Get a value, interpreted as a double.

Parameters:
key - Key for which to get the value.
Returns:
The value for the key 'key', as a double.
Throws:
AgentRemoteException - if the value cannot be interpted as double.

getValueAsInt

public int getValueAsInt(java.lang.String key)
                  throws AgentRemoteException
Get a value, interpreted as an integer.

Parameters:
key - Key for which to get the value.
Returns:
The value for the key 'key', as an integer value.
Throws:
AgentRemoteException - if the value cannot be interpted as an int.

toStream

public void toStream(java.io.DataOutput os)
              throws java.io.IOException
Throws:
java.io.IOException

getKeys

public java.util.Set getKeys()
Specified by:
getKeys in interface GenericValueMap

fromStream

public static AgentRemoteValue fromStream(java.io.DataInput is)
                                   throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.