edu.uci.isr.yancees.server.dispatcher.siena
Class SienaEvent

java.lang.Object
  extended byedu.uci.isr.yancees.server.dispatcher.siena.SienaEvent
All Implemented Interfaces:
EventInterface, MessageInterface, java.io.Serializable

public class SienaEvent
extends java.lang.Object
implements EventInterface

An event An event is structured as a set of named and typed bodyAttributes. Attribute names are strings.

A valid attribute name must begin with a letter ('a'-'z', 'A'-'Z') or an underscore character ('_'), and may contain only letters, underscores, digits ('0'-'9'), the dot character ('.'), the forward slash character ('/'), and the dollar sign ('$'). Attribute names must be unique within a SienaEvent.

Example:


      SienaEvent alert = new SienaEvent();
      alert.putAttribute("threat", "virus");
      alert.putAttribute("name", "melissa");
      alert.putAttribute("total_infected", 25);
      alert.putAttribute("os/name", "win32");
      alert.putAttribute("os/version", "98");
  

See Also:
Serialized Form

Field Summary
static java.lang.String ATTRIBUTE
           
static java.lang.String EVENT
          Tags used from the event to express siena constraints.
static java.lang.String NAME
           
static java.lang.String TYPE_ATTRIBUTE
           
static java.lang.String VALUE
           
 
Constructor Summary
SienaEvent()
          constructs an empty SienaEvent.
SienaEvent(EventInterface evt)
          initialized the current object using the generic event provided.
SienaEvent(org.w3c.dom.Node n)
          initialized the current object using the generic event represented in the form of a DOM tree.
SienaEvent(SienaEvent n)
          creates a deep copy of a given SienaEvent.
 
Method Summary
 void clearAll()
          Removes every attribute from this SienaEvent.
 AttValue getAttribute(java.lang.String name)
          returns the value of an attribute or null if that attribute does not exist in this SienaEvent.
 java.util.Iterator getAttributeNamesIterator()
          Returns an iterator for the set of attribute names of this SienaEvent body.
 int getAttributesSize()
          returns the number of eventAttributes in this SienaEvent.
 AttValue[] getAttributeValues()
           
 java.util.Date getDateCreated()
           
 java.util.Date getDateReceivedInServer()
           
 org.w3c.dom.Node getDOM()
           
 long getId()
           
 java.lang.String getXMLTextContent()
           
 void putAttribute(java.lang.String name, AttValue value)
          set the value of an attribute.
 void putAttribute(java.lang.String name, boolean value)
          set the value of an attribute.
 void putAttribute(java.lang.String name, byte[] value)
          sets the value of an attribute.
 void putAttribute(java.lang.String name, double value)
          set the value of an attribute.
 void putAttribute(java.lang.String name, long value)
          set the value of an attribute.
 void putAttribute(java.lang.String name, java.lang.String value)
          set the value of an attribute.
 void setDOM(org.w3c.dom.Node n)
          Changes current event node, parsing it.
 void setXMLTextContent(java.lang.String content)
          Changes the content of this message.
 int size()
          returns the number of eventAttributes in this SienaEvent.
 java.lang.String toString()
          Prints the structure of the evetn using a free notation.
 java.lang.String toXML()
          Prints the XML hierarchy that represents the current event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EVENT

public static final java.lang.String EVENT
Tags used from the event to express siena constraints. these tags are imported from the sienaEvent.xsd schema and used in the sienaSubscriptin.xsd

See Also:
Constant Field Values

NAME

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

VALUE

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

ATTRIBUTE

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

TYPE_ATTRIBUTE

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

SienaEvent

public SienaEvent()
constructs an empty SienaEvent.


SienaEvent

public SienaEvent(EventInterface evt)
initialized the current object using the generic event provided. In other words, gets a generic event and initializes this specific SienaEvent. Searches the already parsed DOM tree and extracts the attributes and values.

Parameters:
evt - is an object of type Event which will be narrowed and parsed according to the SienaEvent representation.

SienaEvent

public SienaEvent(org.w3c.dom.Node n)
           throws ParsingException
initialized the current object using the generic event represented in the form of a DOM tree.


SienaEvent

public SienaEvent(SienaEvent n)
creates a deep copy of a given SienaEvent.

Method Detail

getId

public long getId()
Specified by:
getId in interface MessageInterface

setDOM

public void setDOM(org.w3c.dom.Node n)
            throws ParsingException
Changes current event node, parsing it.

Specified by:
setDOM in interface MessageInterface
Parameters:
n -
Throws:
EventParsingException
ParsingException

getDOM

public org.w3c.dom.Node getDOM()
Specified by:
getDOM in interface MessageInterface
Returns:
a reference to the current eventDOM model tree.

getAttributeValues

public AttValue[] getAttributeValues()
Returns:
a list of AttValue objects of the body of the event

putAttribute

public void putAttribute(java.lang.String name,
                         java.lang.String value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - String value.

putAttribute

public void putAttribute(java.lang.String name,
                         byte[] value)
sets the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - byte array value.

putAttribute

public void putAttribute(java.lang.String name,
                         long value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - integer value.

putAttribute

public void putAttribute(java.lang.String name,
                         double value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - double value.

putAttribute

public void putAttribute(java.lang.String name,
                         boolean value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - boolean value.

putAttribute

public void putAttribute(java.lang.String name,
                         AttValue value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - value.

getAttribute

public AttValue getAttribute(java.lang.String name)
returns the value of an attribute or null if that attribute does not exist in this SienaEvent.

Parameters:
name - attribute name.

getAttributesSize

public int getAttributesSize()
returns the number of eventAttributes in this SienaEvent.


size

public int size()
returns the number of eventAttributes in this SienaEvent.


clearAll

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


getAttributeNamesIterator

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


toString

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


toXML

public java.lang.String toXML()
Prints the XML hierarchy that represents the current event.


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
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
Returns:
the content of this message in the text form, as a string.

getDateCreated

public java.util.Date getDateCreated()
Specified by:
getDateCreated in interface MessageInterface
Returns:
the date the object was first created

getDateReceivedInServer

public java.util.Date getDateReceivedInServer()
Specified by:
getDateReceivedInServer in interface MessageInterface
Returns:
the date this object arrived in the server