at.ac.tuwien.infosys.sm4all.copal.api.event
Class XMLContextEvent

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.event.BaseEvent
      extended by at.ac.tuwien.infosys.sm4all.copal.api.event.ContextEvent
          extended by at.ac.tuwien.infosys.sm4all.copal.api.event.XMLContextEvent

public class XMLContextEvent
extends ContextEvent

Class which must be used to wrap a Document event so COPAL can inject Event Element as needed for processing of the event. Each XMLContextEvent also has a XMLContextEventType associated with it to be able to easily distinguish XMLContextEvents of same type.

Author:
sanjin

Nested Class Summary
static class XMLContextEvent.Property
          Retrievable property marshaled in a XMLContextEvent.
 
Field Summary
static java.lang.String ACTIONS_ELEMENT
          The local name of child Element that holds marshaled ContextEventActions.
static UnmarshallerBuilder<java.util.List<Attribute>> ATTRIBUTES
          The UnmarshallerBuilder for the Attributes of a XMLContextEvent.
static java.lang.String ATTRIBUTES_ELEMENT
          The local name of child Element that holds marshaled Attributes.
static UnmarshallerBuilder<java.util.List<Authorization>> AUTHORIZATIONS
          The UnmarshallerBuilder for the Authorizations of a XMLContextEvent.
static java.lang.String AUTHORIZATIONS_ELEMENT
          The local name of child Element that holds marshaled Authorizations.
static UnmarshallerBuilder<CurrentAction> CURRENT_ACTION
          The UnmarshallerBuilder for the CurrentAction of a XMLContextEvent.
static java.lang.String CURRENT_ACTION_ELEMENT
          The local name of child Element that holds marshaled CurrentAction.
static java.lang.String EVENT_ELEMENT
          The local name of Element that holds injected marshaled properties of XMLContextEvent.
static UnmarshallerBuilder<java.lang.Integer> PRIORITY
          The UnmarshallerBuilder for the priority of a XMLContextEvent.
static java.lang.String PRIORITY_ATTRIBUTE
          The name of attribute that holds marshaled priority.
static UnmarshallerBuilder<java.util.List<ProcessedAction>> PROCESSED_ACTIONS
          The UnmarshallerBuilder for the ProcessedActions of a XMLContextEvent.
static java.lang.String PROCESSED_ACTIONS_ELEMENT
          The local name of child Element that holds marshaled ProcessedActions.
static UnmarshallerBuilder<java.lang.String> SOURCE_ID
          The UnmarshallerBuilder for the source ID of a XMLContextEvent.
static java.lang.String SOURCE_ID_ATTRIBUTE
          The name of attribute that holds marshaled type.
static UnmarshallerBuilder<java.util.Date> TIME_STAMP
          The UnmarshallerBuilder for the time stamp of a XMLContextEvent.
static java.lang.String TIME_STAMP_ATTRIBUTE
          The name of attribute that holds marshaled type.
static UnmarshallerBuilder<java.lang.Long> TTL
          The UnmarshallerBuilder for the time-to-live of a XMLContextEvent.
static java.lang.String TTL_ATTRIBUTE
          The name of attribute that holds marshaled time-to-live.
static UnmarshallerBuilder<java.lang.String> TYPE
          The UnmarshallerBuilder for the name of the XMLContextEventType of a XMLContextEvent.
static java.lang.String TYPE_ATTRIBUTE
          The name of attribute that holds marshaled type.
static UnmarshallerBuilder<java.util.List<UnprocessedAction>> UNPROCESSED_ACTIONS
          The UnmarshallerBuilder for the UnprocessedActions of a XMLContextEvent.
static java.lang.String UNPROCESSED_ACTIONS_ELEMENT
          The local name of child Element that holds marshaled UnprocessedActions.
 
Constructor Summary
XMLContextEvent(XMLContextEventType eventType, org.w3c.dom.Document document)
          Create instance of the XMLContextEvent with specified XMLContextEventType and Document.
XMLContextEvent(XMLContextEventType eventType, java.lang.String sourceID, java.util.Date timeStamp, org.w3c.dom.Document document)
          Create instance of XMLContextEvent with specified XMLContextEventType, source ID, time stamp and Document.
XMLContextEvent(XMLContextEventType eventType, java.lang.String sourceID, org.w3c.dom.Document document)
          Create instance of XMLContextEvent with specified XMLContextEventType, source ID and Document.
 
Method Summary
 org.w3c.dom.Document getDocument()
           
static
<T> T
getProperty(org.w3c.dom.Document document, UnmarshallerBuilder<T> builder)
          Return the unmarshaled property of a XMLContextEvent that is marshaled in specified Document using specified UnmarshallerBuilder.
 XMLContextEventType getType()
          Returns the XMLContextEventType associated with this XMLContextEvent.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.event.ContextEvent
add, add, equals, getAttribute, getAttributes, getAuthorization, getAuthorizations, getPriority, getTTL, hasAttribute, hasAuthorization, hasAuthorizations, hashCode, isStale, removeAttribute, removeAuthorization, set, set, setPriority, setTTL
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.event.BaseEvent
append, getAction, getActions, getCurrentAction, getCurrentActionIndex, getNumberOfActions, getSourceID, getTimeStamp, hasAction, insert, nextAction, removeAction, replace, set
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_ELEMENT

public static final java.lang.String EVENT_ELEMENT
The local name of Element that holds injected marshaled properties of XMLContextEvent.

See Also:
Constant Field Values

SOURCE_ID_ATTRIBUTE

public static final java.lang.String SOURCE_ID_ATTRIBUTE
The name of attribute that holds marshaled type.

See Also:
Constant Field Values

TIME_STAMP_ATTRIBUTE

public static final java.lang.String TIME_STAMP_ATTRIBUTE
The name of attribute that holds marshaled type.

See Also:
Constant Field Values

TYPE_ATTRIBUTE

public static final java.lang.String TYPE_ATTRIBUTE
The name of attribute that holds marshaled type.

See Also:
Constant Field Values

TTL_ATTRIBUTE

public static final java.lang.String TTL_ATTRIBUTE
The name of attribute that holds marshaled time-to-live.

See Also:
Constant Field Values

PRIORITY_ATTRIBUTE

public static final java.lang.String PRIORITY_ATTRIBUTE
The name of attribute that holds marshaled priority.

See Also:
Constant Field Values

ATTRIBUTES_ELEMENT

public static final java.lang.String ATTRIBUTES_ELEMENT
The local name of child Element that holds marshaled Attributes.

See Also:
Constant Field Values

AUTHORIZATIONS_ELEMENT

public static final java.lang.String AUTHORIZATIONS_ELEMENT
The local name of child Element that holds marshaled Authorizations.

See Also:
Constant Field Values

ACTIONS_ELEMENT

public static final java.lang.String ACTIONS_ELEMENT
The local name of child Element that holds marshaled ContextEventActions.

See Also:
Constant Field Values

UNPROCESSED_ACTIONS_ELEMENT

public static final java.lang.String UNPROCESSED_ACTIONS_ELEMENT
The local name of child Element that holds marshaled UnprocessedActions.

See Also:
Constant Field Values

CURRENT_ACTION_ELEMENT

public static final java.lang.String CURRENT_ACTION_ELEMENT
The local name of child Element that holds marshaled CurrentAction.

See Also:
Constant Field Values

PROCESSED_ACTIONS_ELEMENT

public static final java.lang.String PROCESSED_ACTIONS_ELEMENT
The local name of child Element that holds marshaled ProcessedActions.

See Also:
Constant Field Values

SOURCE_ID

public static final UnmarshallerBuilder<java.lang.String> SOURCE_ID
The UnmarshallerBuilder for the source ID of a XMLContextEvent.


TIME_STAMP

public static final UnmarshallerBuilder<java.util.Date> TIME_STAMP
The UnmarshallerBuilder for the time stamp of a XMLContextEvent.


TYPE

public static final UnmarshallerBuilder<java.lang.String> TYPE
The UnmarshallerBuilder for the name of the XMLContextEventType of a XMLContextEvent.


TTL

public static final UnmarshallerBuilder<java.lang.Long> TTL
The UnmarshallerBuilder for the time-to-live of a XMLContextEvent.


PRIORITY

public static final UnmarshallerBuilder<java.lang.Integer> PRIORITY
The UnmarshallerBuilder for the priority of a XMLContextEvent.


ATTRIBUTES

public static final UnmarshallerBuilder<java.util.List<Attribute>> ATTRIBUTES
The UnmarshallerBuilder for the Attributes of a XMLContextEvent.


AUTHORIZATIONS

public static final UnmarshallerBuilder<java.util.List<Authorization>> AUTHORIZATIONS
The UnmarshallerBuilder for the Authorizations of a XMLContextEvent.


UNPROCESSED_ACTIONS

public static final UnmarshallerBuilder<java.util.List<UnprocessedAction>> UNPROCESSED_ACTIONS
The UnmarshallerBuilder for the UnprocessedActions of a XMLContextEvent.


CURRENT_ACTION

public static final UnmarshallerBuilder<CurrentAction> CURRENT_ACTION
The UnmarshallerBuilder for the CurrentAction of a XMLContextEvent.


PROCESSED_ACTIONS

public static final UnmarshallerBuilder<java.util.List<ProcessedAction>> PROCESSED_ACTIONS
The UnmarshallerBuilder for the ProcessedActions of a XMLContextEvent.

Constructor Detail

XMLContextEvent

public XMLContextEvent(XMLContextEventType eventType,
                       org.w3c.dom.Document document)
                throws MalformedDocumentException
Create instance of the XMLContextEvent with specified XMLContextEventType and Document. The specified Document is deep cloned, thus ensuring that any later changes on this instance will not be reflected in Document saved in the XMLContextEvent.

Parameters:
eventType - the XMLContextEventType of this XMLContextEvent.
document - the event Document.
Throws:
MalformedDocumentException - if specified Document is malformed XMLContextEvent.
java.lang.NullPointerException - if specified Document is null.

XMLContextEvent

public XMLContextEvent(XMLContextEventType eventType,
                       java.lang.String sourceID,
                       org.w3c.dom.Document document)
                throws MalformedDocumentException
Create instance of XMLContextEvent with specified XMLContextEventType, source ID and Document. The specified Document is deep cloned, thus ensuring that any later changes on this instance will not be reflected in Document saved in the XMLContextEvent.

Parameters:
eventType - the XMLContextEventType of this XMLContextEvent.
sourceID - the source ID of the XMLContextEvent.
document - the event Document.
Throws:
MalformedDocumentException - if specified Document is malformed for specified ContextEventType.
java.lang.NullPointerException - if specified XMLContextEventType, source ID, or Document is null.
java.lang.IllegalArgumentException - if specified source ID is an empty or blank string.

XMLContextEvent

public XMLContextEvent(XMLContextEventType eventType,
                       java.lang.String sourceID,
                       java.util.Date timeStamp,
                       org.w3c.dom.Document document)
                throws MalformedDocumentException
Create instance of XMLContextEvent with specified XMLContextEventType, source ID, time stamp and Document. The given Document is deep cloned, thus ensuring that any later changes on this instance will not be reflected in Document saved in the XMLContextEvent.

Parameters:
eventType - the XMLContextEventType of the XMLContextEvent.
sourceID - the source ID of the XMLContextEvent.
timeStamp - the time stamp for the XMLContextEvent.
document - the event as XML DOM document.
Throws:
MalformedDocumentException - if specified Document is malformed for specified XMLContextEventType.
java.lang.NullPointerException - if specified event type, source ID, time stamp or document is null.
java.lang.IllegalArgumentException - if specified source ID is an empty or blank string.
Method Detail

getType

public XMLContextEventType getType()
Returns the XMLContextEventType associated with this XMLContextEvent.

Overrides:
getType in class ContextEvent
Returns:
the XMLContextEventType associated with this XMLContextEvent.

getDocument

public org.w3c.dom.Document getDocument()
Returns:
Document with all COPAL Elements injected.

getProperty

public static <T> T getProperty(org.w3c.dom.Document document,
                                UnmarshallerBuilder<T> builder)
                     throws FailedUnmarshallingException
Return the unmarshaled property of a XMLContextEvent that is marshaled in specified Document using specified UnmarshallerBuilder.

Type Parameters:
T - the type of unmarshaled property.
Parameters:
document - the Document
builder - the UnmarshallerBuilder.
Returns:
the unmarshaled property of a XMLContextEvent
Throws:
FailedUnmarshallingException - if unmarshalling was unsuccessful.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.