at.ac.tuwien.infosys.sm4all.copal.api.event.xml
Class COPALElement<T>

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.event.xml.COPALElement<T>
Type Parameters:
T - the class of element's value.
Direct Known Subclasses:
Actions, Attributes, EventType, Priority, SourceID, TimeStamp, TimeToLive, VirtualElement

public abstract class COPALElement<T>
extends Object

The interface which all COPAL elements that are injected and/or can be retrieved from a XML DOM document generated by XMLContextEvent.

Author:
sanjin

Constructor Summary
protected COPALElement(Class<?> type)
           
 
Method Summary
 Element createElement(Document document, ContextEvent event)
          Creates a XML DOM element with namespace URI set to Constants.COPAL_NAMESPACE_URI and qualified name set to getQualifiedName() and updated using the update(Element, ContextEvent) method.
 Element getElement(Document document)
          Get the XML DOM element of this COPAL element in specified XML DOM document.
protected  XPathExpression getExpression()
           
 String getQualifiedName()
           
 Class<?> getXMLType()
           
 String getXPath()
           
 T retrieve(Document document)
          Retrieve the value of this element from specified XML DOM document.
protected abstract  T retrieve(Element element)
          Retrieve the value of this element from specified XML DOM element.
abstract  void update(Element element, ContextEvent event)
          Update specified XML DOM element with value retrieved from specified ContextEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

COPALElement

protected COPALElement(Class<?> type)
Parameters:
type - the XML type of this COPAL element returned by the xPath.
Method Detail

retrieve

protected abstract T retrieve(Element element)
Retrieve the value of this element from specified XML DOM element.

Parameters:
element - the XML DOM element.
Returns:
the value of this property.

update

public abstract void update(Element element,
                            ContextEvent event)
Update specified XML DOM element with value retrieved from specified ContextEvent.

Parameters:
element - the XML DOM element to update.
event - the ContextEvent.

getQualifiedName

public String getQualifiedName()
Returns:
the qualified name of this COPAL element.

getXPath

public String getXPath()
Returns:
the XPath which can be used to retrieve the value of this COPAL element from a XML DOM document.

getXMLType

public Class<?> getXMLType()
Returns:
the XML type of this COPAL element returned by the xPath.

createElement

public Element createElement(Document document,
                             ContextEvent event)
Creates a XML DOM element with namespace URI set to Constants.COPAL_NAMESPACE_URI and qualified name set to getQualifiedName() and updated using the update(Element, ContextEvent) method.

Parameters:
document - the XML DOM document used to create the XML DOM element.
event - the ContextEvent to use for updating the XML DOM element.
Returns:
the XML DOM element.

retrieve

public T retrieve(Document document)
Retrieve the value of this element from specified XML DOM document.

Parameters:
document - the XML DOM element.
Returns:
the value of this property.

getElement

public Element getElement(Document document)
Get the XML DOM element of this COPAL element in specified XML DOM document.

Parameters:
document - the XML DOM document.
Returns:
the first element that matches or null.

getExpression

protected XPathExpression getExpression()
Returns:
the XPath expression created from the getXPath().


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