edu.uci.isr.yancees.server.dispatcher.elvin
Class ElvinEvent

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

public class ElvinEvent
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 ElvinEvent.

Example:


      ElvinEvent alert = new ElvinEvent();
      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
ElvinEvent()
          constructs an empty ElvinEvent.
ElvinEvent(ElvinEvent n)
          creates a deep copy of a given ElvinEvent.
ElvinEvent(EventInterface evt)
          initialized the current object using the generic event provided.
ElvinEvent(org.w3c.dom.Node n)
          initialized the current object using the generic event represented in the form of a DOM tree.
 
Method Summary
 void clearAll()
          Removes every attribute from this ElvinEvent.
 AttValue getAttribute(java.lang.String name)
          returns the value of an attribute or null if that attribute does not exist in this ElvinEvent.
 java.util.Iterator getAttributeNamesIterator()
          Returns an iterator for the set of attribute names of this ElvinEvent body.
 AttValue[] getAttributeValues()
           
 java.util.Date getDateCreated()
           
 java.util.Date getDateReceivedInServer()
           
 org.w3c.dom.Node getDOM()
           
 long getId()
           
 int getSize()
          returns the number of eventAttributes in this ElvinEvent.
 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.
 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

ElvinEvent

public ElvinEvent()
constructs an empty ElvinEvent.


ElvinEvent

public ElvinEvent(EventInterface evt)
initialized the current object using the generic event provided. In other words, gets a generic event and initializes this specific ElvinEvent. 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 ElvinEvent representation.

ElvinEvent

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


ElvinEvent

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

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 ElvinEvent.

Parameters:
name - attribute name.

getSize

public int getSize()
returns the number of eventAttributes in this ElvinEvent.


clearAll

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


getAttributeNamesIterator

public java.util.Iterator getAttributeNamesIterator()
Returns an iterator for the set of attribute names of this ElvinEvent 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