org.mbari.siam.distributed
Class StateAttribute

java.lang.Object
  extended by org.mbari.siam.distributed.StateAttribute
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Exportable

public class StateAttribute
extends java.lang.Object
implements java.io.Externalizable, Exportable

StateAttribute is a class from which all StateAttributes inherit.

Author:
Kent Headley
See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger _logger
          Log4j logger
protected  java.lang.String _name
          Name of this attribute
protected  AttributeValueObject _value
          Value of this attribute
static int STATEATTRIBUTE_SERIAL_TAG
           
 
Fields inherited from interface org.mbari.siam.distributed.Exportable
EX_BASE, EX_BOOLEANOBJATT, EX_BYTEARRAYOBJATT, EX_DEVICEMESSAGEPACKET, EX_DEVICEPACKET, EX_DOUBLEOBJATT, EX_FLOATOBJATT, EX_INTEGEROBJATT, EX_LONGOBJATT, EX_MAX, EX_METADATAPACKET, EX_MNEMONICINTEGEROBJATT, EX_SCHEDULESPECIFIEROBJATT, EX_SENSORDATAPACKET, EX_STATE, EX_STATEATTRIBUTE
 
Constructor Summary
StateAttribute()
           
StateAttribute(java.lang.String name, AttributeValueObject value)
           
StateAttribute(java.lang.String name, AttributeValueObject value, boolean accessible)
          Create a new attribute from an object
 
Method Summary
 void export(java.io.DataOutput out)
          Fulfills Exportable interface
 java.lang.String getName()
          Return the name of this attribute
 AttributeValueObject getValue()
          Return _value member variable.
 long getVersion()
          Return serialization version of this instance
 boolean isAccessible()
          Return value of accessible member variable
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toString()
          Return String representation.
 java.lang.Object value()
          Return Object representation of value.
 void writeExternal(java.io.ObjectOutput out)
           
static void writeStateAttribute(java.io.ObjectOutput out, StateAttribute attribute)
          Write a state attribute object to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_logger

protected static org.apache.log4j.Logger _logger
Log4j logger


STATEATTRIBUTE_SERIAL_TAG

public static final int STATEATTRIBUTE_SERIAL_TAG
See Also:
Constant Field Values

_name

protected java.lang.String _name
Name of this attribute


_value

protected AttributeValueObject _value
Value of this attribute

Constructor Detail

StateAttribute

public StateAttribute()

StateAttribute

public StateAttribute(java.lang.String name,
                      AttributeValueObject value,
                      boolean accessible)
Create a new attribute from an object


StateAttribute

public StateAttribute(java.lang.String name,
                      AttributeValueObject value)
Method Detail

isAccessible

public boolean isAccessible()
Return value of accessible member variable


getName

public java.lang.String getName()
Return the name of this attribute


getValue

public AttributeValueObject getValue()
Return _value member variable.


value

public java.lang.Object value()
Return Object representation of value. Some attributes may, for example, store _value as a String, but value() may return an Integer, ScheduleSpecifier, or other Object.


toString

public java.lang.String toString()
Return String representation.

Overrides:
toString in class java.lang.Object

getVersion

public long getVersion()
Return serialization version of this instance


writeStateAttribute

public static void writeStateAttribute(java.io.ObjectOutput out,
                                       StateAttribute attribute)
                                throws java.io.IOException
Write a state attribute object to an output stream. Adds a state object to a metadata packet payload, which is a stream of serialized State and StateAttributes.

Throws:
java.io.IOException

writeExternal

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

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

export

public void export(java.io.DataOutput out)
            throws java.io.IOException
Fulfills Exportable interface

Specified by:
export in interface Exportable
Throws:
java.io.IOException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.