net.kwfgrid.gwes.uiproxy.jdom
Class JDOMSequenceBuffer

java.lang.Object
  extended by net.kwfgrid.gwes.uiproxy.AbstractBuffer
      extended by net.kwfgrid.gwes.uiproxy.SequenceBuffer
          extended by net.kwfgrid.gwes.uiproxy.jdom.JDOMSequenceBuffer
All Implemented Interfaces:
Buffer, Consumer

public abstract class JDOMSequenceBuffer
extends SequenceBuffer

Implementation of SequenceBuffer for sequenced XML messages in the JDOM object model. The sequence number of the messages must be accessible by an XPath query. The jaxen XPath engine is used to query incoming messages for their sequence number.

This buffer supports the following properties:

The JDOMSequenceBuffer.* properties must be set at initialization time of the buffer.


Field Summary
static String XPATH_SEQUENCE_NUMBER_PROPERTY_KEY
           
static String XPATH_SHOULD_HANDLE_PROPERTY_KEY
           
 
Fields inherited from class net.kwfgrid.gwes.uiproxy.SequenceBuffer
_content, _exception, _first, _initialized, _precontent, FIRST_PROPERTY_KEY
 
Fields inherited from class net.kwfgrid.gwes.uiproxy.AbstractBuffer
_id, _size, DEFAULT_SIZE, SIZE_PROPERTY_KEY
 
Constructor Summary
JDOMSequenceBuffer(String xpath)
          Constructor.
 
Method Summary
protected  int getSequenceNumber(Object message)
          Generic method to access the sequence number of the specified message.
 void setProperty(String key, String value)
          This implementation only interprets the Buffer.size property.
protected  boolean shouldHandle(Object message)
          This buffer handles messages which are instance of org.jdom.Element.
 
Methods inherited from class net.kwfgrid.gwes.uiproxy.SequenceBuffer
handle, initialize, read, setSize
 
Methods inherited from class net.kwfgrid.gwes.uiproxy.AbstractBuffer
getID, getSize, setID, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPATH_SEQUENCE_NUMBER_PROPERTY_KEY

public static final String XPATH_SEQUENCE_NUMBER_PROPERTY_KEY
See Also:
Constant Field Values

XPATH_SHOULD_HANDLE_PROPERTY_KEY

public static final String XPATH_SHOULD_HANDLE_PROPERTY_KEY
See Also:
Constant Field Values
Constructor Detail

JDOMSequenceBuffer

public JDOMSequenceBuffer(String xpath)
                   throws InstantiationException
Constructor.

Parameters:
xpath - The XPath expression to access the sequence number inside of an incoming message.
Throws:
InstantiationException - If the XPath string could not be parsed.
Method Detail

setProperty

public void setProperty(String key,
                        String value)
                 throws BufferException
Description copied from class: AbstractBuffer
This implementation only interprets the Buffer.size property.

Specified by:
setProperty in interface Buffer
Overrides:
setProperty in class SequenceBuffer
Throws:
BufferException

getSequenceNumber

protected int getSequenceNumber(Object message)
                         throws org.jaxen.JaxenException,
                                NumberFormatException,
                                IllegalStateException
Description copied from class: SequenceBuffer
Generic method to access the sequence number of the specified message. Sequence numbers are expected to be positive integers.

Specified by:
getSequenceNumber in class SequenceBuffer
Throws:
IllegalStateException - If the property JDOMSequenceBuffer.xpath_sequenceNumber is not set.
org.jaxen.JaxenException
NumberFormatException

shouldHandle

protected boolean shouldHandle(Object message)
                        throws org.jaxen.JaxenException,
                               IllegalStateException
This buffer handles messages which are instance of org.jdom.Element. Additionally the XPath expression provided through property JDOMSequenceBuffer.xpath_shouldHandle must evaluate to true for the incoming message.

Specified by:
shouldHandle in class SequenceBuffer
Throws:
IllegalStateException - If the property JDOMSequenceBuffer.xpath_shouldHandle is not set.
org.jaxen.JaxenException


Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.