|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.util.PacketBufferFactory
public abstract class PacketBufferFactory
A packet buffer factory holds a predefined list of packet buffers identified by a key (one per buffer) The key allows to the buffer used to store and retrieve the packets
Field Summary | |
---|---|
protected java.util.HashMap |
map
|
Constructor Summary | |
---|---|
protected |
PacketBufferFactory()
Creates an empty factory to be filled by overiding |
Method Summary | |
---|---|
java.lang.Object |
add(java.nio.ByteBuffer bb)
Add a new packet to a packet buffer according to the key returned by getKey |
void |
addDataError(java.lang.String data,
java.lang.String error)
Add a data error |
java.lang.Object |
addPacketBuffer(java.lang.Object key,
PacketBuffer packetBuffer)
Method addPacketBuffer Summary: Use this method to add a packetBuffer to the factory. |
protected void |
addRejectedPacket(java.lang.Object key)
Add a rejected packet to the given key. |
protected abstract PacketBuffer |
contructPacketBuffer(java.lang.Object key)
Method contructPacketBuffer. |
java.lang.String |
getDataErrorMessage()
Returns the message that contains the errors for each data name. |
int |
getDataErrorNumber()
return the total number of data errors. |
PacketBufferFactory |
getFactory(java.lang.Class factoryClass)
Method getFactory Summary: return the Factory instance, that correspond with the given class. |
abstract PacketBufferFactory |
getInnerFactory()
Method getInnerFactory Summary: This method return the inner factory, if exists. |
protected abstract java.lang.Object |
getInnerKey(java.lang.Object localKey)
Return the key to be used in the inner factory computed from a local key. |
abstract java.lang.Object |
getKey(java.nio.ByteBuffer bb)
Return the packet key |
protected java.lang.String |
getKeyStringDisplay(java.lang.Object key)
Return a String representation of the given key. |
PacketBuffer |
getPacketBuffer(java.lang.Object key,
boolean createIfNotFound)
Method getPacketBuffer Summary: Use this method to get a packetBuffer from the facotry, using the given key. |
java.lang.String |
getRejectedPacketMessage()
Returns the message that contains the number of errors for each filter. |
int |
getRejectedPacketNumber()
return the total number of rejected packet for this factory. |
protected java.lang.String |
logByteBuffer(java.nio.ByteBuffer bb)
Returns the String representation of a byteBuffer, with a byte content view, displayed as hexadecimal content. |
void |
registerListener(PacketBuffer.Listener listener,
java.lang.Object key)
register the given listener to the corresponding key. |
void |
reset()
Reset all the buffers available in this factory and the inner factories if any |
void |
resetDataErrorMap()
Resets the error and rejected maps. |
void |
resetRejectedPacketMap()
Resets the error and rejected maps. |
void |
unregisterListener(PacketBuffer.Listener listener,
java.lang.Object key)
Unregister the given listener to the corresponding key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap map
Constructor Detail |
---|
protected PacketBufferFactory()
Method Detail |
---|
public java.lang.Object add(java.nio.ByteBuffer bb) throws PacketBufferValidationError
getKey
bb
- The byteBuffer to add to factory.
PacketBufferValidationError
protected void addRejectedPacket(java.lang.Object key)
key
- The key of the rejected packet.public void addDataError(java.lang.String data, java.lang.String error)
data
- The dataName concerned by this errorerror
- The message of the error.public int getRejectedPacketNumber()
public java.lang.String getRejectedPacketMessage()
protected java.lang.String getKeyStringDisplay(java.lang.Object key)
key
- The key to return the String representation.
public int getDataErrorNumber()
public java.lang.String getDataErrorMessage()
protected java.lang.String logByteBuffer(java.nio.ByteBuffer bb)
bb
- The byteBuffer to be displayed.
public abstract java.lang.Object getKey(java.nio.ByteBuffer bb)
bb
-
public java.lang.Object addPacketBuffer(java.lang.Object key, PacketBuffer packetBuffer)
key
- To key to store the PacketBuffer.packetBuffer
- The PacketBuffer to store.
public PacketBuffer getPacketBuffer(java.lang.Object key, boolean createIfNotFound)
key
- The key to found the PacketBuffer.createIfNotFound
- If true, the call to the method will create the packet buffer if not found.
protected abstract PacketBuffer contructPacketBuffer(java.lang.Object key)
key
- The key used to contruct the new packetBuffer.
public abstract PacketBufferFactory getInnerFactory()
protected abstract java.lang.Object getInnerKey(java.lang.Object localKey)
localKey
- The local key to convert to the inner key.
public PacketBufferFactory getFactory(java.lang.Class factoryClass)
factoryClass
- The Factory's class to find.
public void reset()
public void resetDataErrorMap()
public void resetRejectedPacketMap()
public void registerListener(PacketBuffer.Listener listener, java.lang.Object key)
listener
- The listener to register.key
- The key to find the packetBuffer to register the listener.public void unregisterListener(PacketBuffer.Listener listener, java.lang.Object key)
listener
- The listener to unregister.key
- The key to find the packetBuffer to register the listener.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |