Siena (v.1.5.5) API documentation

siena
Class Notification

java.lang.Object
  extended by siena.Notification
All Implemented Interfaces:
java.io.Serializable

public class Notification
extends java.lang.Object
implements java.io.Serializable

an event notification The primary data entity used within Siena. A notification is structured as a set of named and typed attributes. 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 Notification.

Example:


      Notification alert = new Notification();
      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:
AttributeValue, Filter, Siena.publish(Notification), Serialized Form

Constructor Summary
Notification()
          constructs an empty notification.
Notification(Notification n)
          creates a deep copy of a given notification.
 
Method Summary
 java.util.Iterator attributeNamesIterator()
          returns an iterator for the set of attribute names of this notification.
 void clear()
          removes every attribute from this notification.
 AttributeValue getAttribute(java.lang.String name)
          returns the value of an attribute or null if that attribute does not exist in this notification.
 java.util.Iterator iterator()
          Deprecated. as of Siena 1.1.2
static Notification parseNotification(java.lang.String s)
           
 void putAttribute(java.lang.String name, AttributeValue 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.
 AttributeValue removeAttribute(java.lang.String name)
          remove an attribute from this notification.
 int size()
          returns the number of attributes in this notification.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Notification

public Notification()
constructs an empty notification.


Notification

public Notification(Notification n)
creates a deep copy of a given notification.

Method Detail

parseNotification

public static Notification parseNotification(java.lang.String s)
                                      throws SENPInvalidFormat
Throws:
SENPInvalidFormat

iterator

public java.util.Iterator iterator()
Deprecated. as of Siena 1.1.2

returns an iterator over the set of attribute names.


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,
                         AttributeValue value)
set the value of an attribute. Add the attribute if that is not present.

Parameters:
name - attribute name.
value - value.

getAttribute

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

Parameters:
name - attribute name.

removeAttribute

public AttributeValue removeAttribute(java.lang.String name)
remove an attribute from this notification.

Parameters:
name - attribute name.
Returns:
the removed attribute value, or null if the given attribute does not exist in this notification.

size

public int size()
returns the number of attributes in this notification.


clear

public void clear()
removes every attribute from this notification.


attributeNamesIterator

public java.util.Iterator attributeNamesIterator()
returns an iterator for the set of attribute names of this notification.


toString

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

Siena (v.1.5.5) API documentation

Copyright © 2000-2005 University of Colorado.
Copyright © 2005-2008 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga