net.kwfgrid.gwes.uiproxy
Class AbstractBuffer

java.lang.Object
  extended by net.kwfgrid.gwes.uiproxy.AbstractBuffer
All Implemented Interfaces:
Buffer, Consumer
Direct Known Subclasses:
DefaultBuffer, SequenceBuffer

public abstract class AbstractBuffer
extends Object
implements Buffer

Abstract implementation of buffer. This buffer supports the following properties:


Field Summary
protected  String _id
           
protected  int _size
           
static int DEFAULT_SIZE
           
static String SIZE_PROPERTY_KEY
           
 
Constructor Summary
AbstractBuffer()
           
 
Method Summary
 String getID()
          Get the buffers unique ID.
 int getSize()
           
abstract  void handle(Object message)
          Handle a message.
abstract  Object[] read()
          Read buffered messages.
protected  void setID(String id)
           
 void setProperties(Properties props)
          Generic implementation.
 void setProperty(String key, String value)
          This implementation only interprets the Buffer.size property.
protected  void setSize(int size)
          Size should be set by setting property Buffer.size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values

SIZE_PROPERTY_KEY

public static final String SIZE_PROPERTY_KEY
See Also:
Constant Field Values

_size

protected int _size

_id

protected String _id
Constructor Detail

AbstractBuffer

public AbstractBuffer()
Method Detail

setID

protected void setID(String id)

getID

public String getID()
Description copied from interface: Buffer
Get the buffers unique ID.

Specified by:
getID in interface Buffer

setSize

protected void setSize(int size)
                throws BufferException
Size should be set by setting property Buffer.size.

Throws:
BufferException

getSize

public int getSize()

setProperties

public void setProperties(Properties props)
                   throws BufferException
Generic implementation. Calls setProperty(key, value) for each mapping in the specified properties.

Specified by:
setProperties in interface Buffer
Throws:
BufferException

setProperty

public void setProperty(String key,
                        String value)
                 throws BufferException
This implementation only interprets the Buffer.size property.

Specified by:
setProperty in interface Buffer
Throws:
BufferException

handle

public abstract void handle(Object message)
Description copied from interface: Buffer
Handle a message. The buffer itself determines if it is responsible for buffering the specified Message. Buffer overflows or other exceptions must be remembered internally and notified on forthcoming calls of read().

Specified by:
handle in interface Buffer
Specified by:
handle in interface Consumer
Parameters:
message - The message.

read

public abstract Object[] read()
                       throws BufferException
Description copied from interface: Buffer
Read buffered messages. Details are determined by the implementations.

Specified by:
read in interface Buffer
Throws:
BufferException - If a message could not be handled for some reason.


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