edu.uci.isr.yancees
Class YanceesEvent

java.lang.Object
  extended by edu.uci.isr.yancees.GenericMessage
      extended by edu.uci.isr.yancees.GenericEvent
          extended by edu.uci.isr.yancees.YanceesEvent
All Implemented Interfaces:
EventInterface, MessageInterface, java.io.Serializable

public class YanceesEvent
extends GenericEvent

Author:
Roberto Silveira Silva Filho [rsilvafi@ics.uci.edu] This class implements an event using the xml schema defined in yanceesEvent.xsd. It extends the GenericEvent to include methods that allow the programmer to add and remove attributes in a programmatic way, not having to provide an XML file as an input. This class builds an XML document based on the event description at yanceesEvent.xsd
See Also:
Serialized Form

Field Summary
static java.lang.String YANCEES_DATE_CREATED
           
static java.lang.String YANCEES_DATE_RECEIVED
           
static java.lang.String YANCEES_ID
           
static java.lang.String YANCEES_VERSION
           
static java.lang.String YANCEES_VERSION_TAG
           
 
Fields inherited from class edu.uci.isr.yancees.GenericMessage
dateCreated, dateReceivedInServer, messageDOM, myId, textContent
 
Constructor Summary
YanceesEvent()
          This is the preferential constructor for this object.
YanceesEvent(EventInterface evi)
          Initializes this event with a generic event.
YanceesEvent(java.io.File file)
           
YanceesEvent(java.lang.String content)
           
 
Method Summary
 void clearAll()
          Removes every attribute from this YanceesEvent.
 boolean containsAttribute(java.lang.String name)
           
protected  void finalize()
           
 java.lang.Object get(java.lang.String attName)
           
 java.util.Iterator getAttributeNamesIterator()
          Returns an iterator for the set of attribute names of this SienaEvent body.
 boolean getBoolean(java.lang.String attName)
          Gets a boolean attribute
 byte[] getByteArray(java.lang.String attName)
          Gets a byte[] attribute
 double getDouble(java.lang.String attName)
          Gets a double attribute
 float getFloat(java.lang.String attName)
          Gets a float attribute
 int getInt(java.lang.String attName)
          Gets a int attribute
 long getLong(java.lang.String attName)
          Gets a long attribute
 java.lang.Object getObject(java.lang.String attName)
          Gets a Byte array as an object
 java.lang.Object[] getObjectArray(java.lang.String attName)
          Gets a Byte array as an object array: Object[]
 java.lang.String getXMLTextContent()
           
 int numberOfAttributes()
           
 void put(java.lang.String attName, boolean value)
           
 void put(java.lang.String attName, byte[] value)
           
 void put(java.lang.String attName, double value)
           
 void put(java.lang.String attName, float value)
           
 void put(java.lang.String attName, int value)
           
 void put(java.lang.String attName, long value)
           
 void put(java.lang.String attName, java.lang.Object value)
          Puts an object that is serialized as a byte array.
 void put(java.lang.String attName, java.lang.Object[] arrayValue)
          Puts an object array that is serialized as a byte array.
 void put(java.lang.String attName, java.lang.String value)
           
 void remove(java.lang.String attName)
           
 void setDateCreated(java.util.Date newDate)
          used to reconstruct the id when an event is re-created in the ohter side of the network
 void setDOM(org.w3c.dom.Node n)
          Changes the content of the event by providing a new XML representation for it.
 void setID(long originalId)
          used to reconstruct the id when an event is re-created in the ohter side of the network
 void setXMLTextContent(java.lang.String content)
          Changes the content of this message.
 java.lang.String toString()
          Prints the structure of the event using a free notation.
 
Methods inherited from class edu.uci.isr.yancees.GenericMessage
convertTextToMessageDOM, getDateCreated, getDateReceivedInServer, getDOM, getId, setDateReceivedInServer, writeTextToTempFile
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.uci.isr.yancees.MessageInterface
getDateCreated, getDateReceivedInServer, getDOM, getId
 

Field Detail

YANCEES_DATE_RECEIVED

public static final java.lang.String YANCEES_DATE_RECEIVED
See Also:
Constant Field Values

YANCEES_DATE_CREATED

public static final java.lang.String YANCEES_DATE_CREATED
See Also:
Constant Field Values

YANCEES_ID

public static final java.lang.String YANCEES_ID
See Also:
Constant Field Values

YANCEES_VERSION_TAG

public static final java.lang.String YANCEES_VERSION_TAG
See Also:
Constant Field Values

YANCEES_VERSION

public static final java.lang.String YANCEES_VERSION
See Also:
Constant Field Values
Constructor Detail

YanceesEvent

public YanceesEvent(EventInterface evi)
             throws MessageParsingException
Initializes this event with a generic event. The event is then parsed into the internal hashtable format.

Throws:
MessageParsingException

YanceesEvent

public YanceesEvent(java.io.File file)
             throws java.io.IOException
Parameters:
file - is the File object with the XML representation of an event according to the standard format, supported by the adapter and the plug-ins. The event here can be desribed in many formats, as well as the adapters and plug-ins in the server know how to handle it.
Throws:
java.io.IOException

YanceesEvent

public YanceesEvent(java.lang.String content)
Parameters:
content - is the XML representation of the event in textual, string in memory.

YanceesEvent

public YanceesEvent()
This is the preferential constructor for this object. It creates an empty event that will be stuffed with attribute/value pairs with the setAttribute() methods.

Method Detail

setDOM

public void setDOM(org.w3c.dom.Node n)
            throws MessageParsingException
Changes the content of the event by providing a new XML representation for it. The representation is provided in the form of a DOM tree in the parameter n

Specified by:
setDOM in interface MessageInterface
Overrides:
setDOM in class GenericMessage
Throws:
MessageParsingException

getObject

public java.lang.Object getObject(java.lang.String attName)
                           throws WrongAttributeTypeException,
                                  AttributeNotFoundException
Gets a Byte array as an object

Parameters:
attName -
Returns:
an Object that was serialized as an attribute of the event
Throws:
WrongAttributeTypeException
AttributeNotFoundException

getObjectArray

public java.lang.Object[] getObjectArray(java.lang.String attName)
                                  throws WrongAttributeTypeException,
                                         AttributeNotFoundException
Gets a Byte array as an object array: Object[]

Parameters:
attName -
Returns:
an Object that was serialized as an attribute of the event
Throws:
WrongAttributeTypeException
AttributeNotFoundException

getDouble

public double getDouble(java.lang.String attName)
                 throws WrongAttributeTypeException,
                        AttributeNotFoundException
Gets a double attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

getFloat

public float getFloat(java.lang.String attName)
               throws WrongAttributeTypeException,
                      AttributeNotFoundException
Gets a float attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

getInt

public int getInt(java.lang.String attName)
           throws WrongAttributeTypeException,
                  AttributeNotFoundException
Gets a int attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

getLong

public long getLong(java.lang.String attName)
             throws WrongAttributeTypeException,
                    AttributeNotFoundException
Gets a long attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

getByteArray

public byte[] getByteArray(java.lang.String attName)
                    throws WrongAttributeTypeException,
                           AttributeNotFoundException
Gets a byte[] attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

getBoolean

public boolean getBoolean(java.lang.String attName)
                   throws WrongAttributeTypeException,
                          AttributeNotFoundException
Gets a boolean attribute

Parameters:
attName - is the name of the attribute to be retrieved
Returns:
the String type attribute or null if the attribute does not exist or it cannot be converted to a string.
Throws:
WrongAttributeTypeException - if the attribute exists but the type is wrong
AttributeNotFoundException

clearAll

public void clearAll()
Removes every attribute from this YanceesEvent.


numberOfAttributes

public int numberOfAttributes()

get

public java.lang.Object get(java.lang.String attName)

remove

public void remove(java.lang.String attName)

put

public void put(java.lang.String attName,
                java.lang.String value)

put

public void put(java.lang.String attName,
                double value)

put

public void put(java.lang.String attName,
                float value)

put

public void put(java.lang.String attName,
                boolean value)

put

public void put(java.lang.String attName,
                byte[] value)

put

public void put(java.lang.String attName,
                java.lang.Object value)
Puts an object that is serialized as a byte array.

Parameters:
attName -
value -

put

public void put(java.lang.String attName,
                java.lang.Object[] arrayValue)
Puts an object array that is serialized as a byte array.

Parameters:
attName -
value -

put

public void put(java.lang.String attName,
                int value)

put

public void put(java.lang.String attName,
                long value)

getAttributeNamesIterator

public java.util.Iterator getAttributeNamesIterator()
Returns an iterator for the set of attribute names of this SienaEvent body.


containsAttribute

public boolean containsAttribute(java.lang.String name)

toString

public java.lang.String toString()
Prints the structure of the event using a free notation.

Overrides:
toString in class GenericMessage

setXMLTextContent

public void setXMLTextContent(java.lang.String content)
Changes the content of this message. Replaces it with the XML content provided in the String provided

Specified by:
setXMLTextContent in interface MessageInterface
Overrides:
setXMLTextContent in class GenericMessage
Parameters:
content - is the new XML format contnet in the form of a String

getXMLTextContent

public java.lang.String getXMLTextContent()
Specified by:
getXMLTextContent in interface MessageInterface
Overrides:
getXMLTextContent in class GenericMessage
Returns:
the content of this message in the text form, as a string.

setDateCreated

public void setDateCreated(java.util.Date newDate)
used to reconstruct the id when an event is re-created in the ohter side of the network

Parameters:
newDate - is the original creation date of the object.

setID

public void setID(long originalId)
used to reconstruct the id when an event is re-created in the ohter side of the network

Parameters:
originalId - is the original id of this event

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable