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

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

public abstract class ConcreteElement<T>
extends XMLElement<T>

The abstract class for concrete COPAL elements i.e. elements that are injected and can be retrieved from a XML DOM document generated by the XMLContextEvent.getDocument() method.

Author:
sanjin

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

Constructor Detail

ConcreteElement

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

getXPath

public String getXPath()
Specified by:
getXPath in class XMLElement<T>
Returns:
the XPath which can be used to retrieve the value of this COPAL element from a Document.

retrieve

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

Parameters:
element - the Element.
Returns:
the value of this property.
Throws:
FailedUnmarshallingException - if retrieving was not successful.

update

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

Parameters:
element - the Element to update.
event - the ContextEvent.

createElement

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

Parameters:
document - the Document used to create the Element.
event - the ContextEvent to use for updating the Element.
Returns:
the Element.

retrieve

public T retrieve(Document document)
           throws FailedUnmarshallingException
Description copied from class: XMLElement
Retrieve the value of this element from specified Document.

Specified by:
retrieve in class XMLElement<T>
Parameters:
document - the Document.
Returns:
the value of this property.
Throws:
FailedUnmarshallingException - if retrieving was not successful.

getElement

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

Parameters:
document - the Document.
Returns:
the first Element that matches or null.


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