xmlBlaster 1.5.1 API

org.xmlBlaster.util.recorder.ram
Class RamRecorder

java.lang.Object
  extended byorg.xmlBlaster.util.recorder.ram.RamRecorder
All Implemented Interfaces:
I_InvocationRecorder, I_Plugin, I_XmlBlaster

public class RamRecorder
extends java.lang.Object
implements I_Plugin, I_InvocationRecorder

You can use this recorder to remember all invocations of the xmlBlaster CORBA methods.

It is based on a queue (FIFO). Every method invocation is timestamped and wrapped into an InvocationContainer object, and pushed into the queue.

Configuration:

 RecorderPlugin[RamRecorder][1.0]=org.xmlBlaster.util.recorder.ram.RamRecorder
 

Author:
xmlBlaster@marcelruff.info
See Also:
org.xmlBlaster.test.qos.TestFailSave, InvocationRecorderTest

Nested Class Summary
private  class RamRecorder.InvocationContainer
          This holds all the necessary info about one method invocation.
 
Field Summary
private  EraseReturnQos[] dummyEraseReturnQosArr
           
private  MsgUnit[] dummyMArr
           
private  PublishReturnQos dummyPubRet
           
private  PublishReturnQos[] dummyPubRetQosArr
           
private  SubscribeReturnQos dummySubRet
           
private  UnSubscribeReturnQos[] dummyUbSubRetQosArr
           
private  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  SimpleXbQueue queue
          The queue to hold the method invocations TODO: Allow persistence store e.g.
private  I_XmlBlaster serverCallback
          Callback which the client must implement.
 
Constructor Summary
RamRecorder()
          Empty constructor for plugin manager
 
Method Summary
private  void callback(RamRecorder.InvocationContainer cont)
          Call back the client through the interfaces
 void destroy()
          Reset the queue, throw all entries to garbage
 EraseReturnQos[] erase(java.lang.String xmlKey_literal, java.lang.String qos_literal)
           
 MsgUnit[] get(java.lang.String xmlKey_literal, java.lang.String qos_literal)
           
 java.lang.String getFullFileName()
          Returns the name of the database file or null if RAM based
 long getNumLost()
          How many messages are silently lost in 'discard' or 'discardOldest' mode?
 long getNumUnread()
          How many objects are in the recorder.
 java.lang.String getType()
          Return plugin type for Plugin loader
 java.lang.String getVersion()
          Return plugin version for Plugin loader
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 void initialize(Global glob, java.lang.String fn, long maxEntries, I_XmlBlaster serverCallback)
          Called by plugin manager.
 boolean isFull()
          Check if the recorder is filled up.
 boolean ping()
          For I_XmlBlaster interface
 void playback(long startDate, long endDate, double motionFactor)
          Playback the stored messages, without removing them form the recorder.
 PublishReturnQos publish(MsgUnit msgUnit)
           
 PublishReturnQos[] publishArr(MsgUnit[] msgUnitArr)
           
 void publishOneway(MsgUnit[] msgUnitArr)
           
 void pullback(float msgPerSec)
          Playback the stored messages, the are removed from the recorder after the callback.
 void pullback(long startDate, long endDate, double motionFactor)
          Playback the stored messages, the are removed from the recorder after the callback.
 void setMode(java.lang.String mode)
           
 void shutdown()
          Cleans up the resource.
 SubscribeReturnQos subscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal)
           
 UnSubscribeReturnQos[] unSubscribe(java.lang.String xmlKey_literal, java.lang.String qos_literal)
          For I_XmlBlaster interface
 java.lang.String[] update(java.lang.String cbSessionId, MsgUnit[] msgUnitArr)
          This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.
 void updateOneway(java.lang.String cbSessionId, MsgUnit[] msgUnitArr)
          This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

queue

private SimpleXbQueue queue
The queue to hold the method invocations TODO: Allow persistence store e.g. via JDBC bridge into Orcale.


serverCallback

private I_XmlBlaster serverCallback
Callback which the client must implement. The recorder calls these methods when doing a playback


dummyMArr

private final MsgUnit[] dummyMArr

dummyPubRetQosArr

private final PublishReturnQos[] dummyPubRetQosArr

dummyPubRet

private PublishReturnQos dummyPubRet

dummySubRet

private SubscribeReturnQos dummySubRet

dummyUbSubRetQosArr

private final UnSubscribeReturnQos[] dummyUbSubRetQosArr

dummyEraseReturnQosArr

private final EraseReturnQos[] dummyEraseReturnQosArr
Constructor Detail

RamRecorder

public RamRecorder()
Empty constructor for plugin manager

Method Detail

initialize

public void initialize(Global glob,
                       java.lang.String fn,
                       long maxEntries,
                       I_XmlBlaster serverCallback)
Description copied from interface: I_InvocationRecorder
Called by plugin manager.

Specified by:
initialize in interface I_InvocationRecorder
Parameters:
maxEntries - The maximum number of invocations to store
fn - The file name (without path information!) for persistence or null (will be generated or ignored if RAM based)
serverCallback - You need to implement I_XmlBlaster to receive the invocations on playback null if you are not interested in those
See Also:
I_InvocationRecorder.initialize(org.xmlBlaster.util.Global, java.lang.String, long, org.xmlBlaster.client.protocol.I_XmlBlaster)

getFullFileName

public java.lang.String getFullFileName()
Returns the name of the database file or null if RAM based

Specified by:
getFullFileName in interface I_InvocationRecorder

init

public void init(Global glob,
                 PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin).

Specified by:
init in interface I_Plugin
See Also:
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)

getType

public java.lang.String getType()
Return plugin type for Plugin loader

Specified by:
getType in interface I_Plugin
Returns:
"RamRecorder"

getVersion

public java.lang.String getVersion()
Return plugin version for Plugin loader

Specified by:
getVersion in interface I_Plugin
Returns:
"1.0"

setMode

public void setMode(java.lang.String mode)
Specified by:
setMode in interface I_InvocationRecorder

isFull

public final boolean isFull()
                     throws XmlBlasterException
Check if the recorder is filled up.

Specified by:
isFull in interface I_InvocationRecorder
Returns:
true space for at least on more entry false quota exceeded
Throws:
XmlBlasterException

getNumUnread

public final long getNumUnread()
How many objects are in the recorder.

Specified by:
getNumUnread in interface I_InvocationRecorder
Returns:
number of objects

pullback

public void pullback(long startDate,
                     long endDate,
                     double motionFactor)
              throws XmlBlasterException
Playback the stored messages, the are removed from the recorder after the callback.

Specified by:
pullback in interface I_InvocationRecorder
Parameters:
startDate - Start date for playback, 0 means from the very start
endDate - End date to stop playback, pass 0 to go to the very end
motionFactor - for fast motion choose for example 4.0 so four reals seconds are elapsing in one second.
For slow motion choose for example 0.5 0. does everything instantly.
Throws:
XmlBlasterException
See Also:
I_InvocationRecorder.playback(long, long, double)

pullback

public void pullback(float msgPerSec)
              throws XmlBlasterException
Playback the stored messages, the are removed from the recorder after the callback.

The messages are retrieved with the given rate per second

NOTE: This is not implemented for this plugin!

Specified by:
pullback in interface I_InvocationRecorder
Parameters:
msgPerSec - 20. is 20 msg/sec, 0.1 is one message every 10 seconds
Throws:
XmlBlasterException

destroy

public void destroy()
Reset the queue, throw all entries to garbage

Specified by:
destroy in interface I_InvocationRecorder

shutdown

public void shutdown()
Description copied from interface: I_Plugin
Cleans up the resource.

Specified by:
shutdown in interface I_Plugin

getNumLost

public long getNumLost()
How many messages are silently lost in 'discard' or 'discardOldest' mode?

Specified by:
getNumLost in interface I_InvocationRecorder

playback

public void playback(long startDate,
                     long endDate,
                     double motionFactor)
              throws XmlBlasterException
Playback the stored messages, without removing them form the recorder.

Specified by:
playback in interface I_InvocationRecorder
Parameters:
startDate - Start date for playback, 0 means from the very start
endDate - End date to stop playback, pass 0 to go to the very end
motionFactor - for fast motion choose for example 4.0 so four reals seconds are elapsing in one second.
For slow motion choose for example 0.5
Throws:
XmlBlasterException
See Also:
I_InvocationRecorder.playback(long, long, double)

callback

private void callback(RamRecorder.InvocationContainer cont)
               throws XmlBlasterException
Call back the client through the interfaces

Throws:
XmlBlasterException

subscribe

public SubscribeReturnQos subscribe(java.lang.String xmlKey_literal,
                                    java.lang.String qos_literal)
                             throws XmlBlasterException
Specified by:
subscribe in interface I_XmlBlaster
Returns:
dummy to match I_XmlBlaster interface
Throws:
XmlBlasterException - if queue is full with id=".MaxSize"
See Also:
CORBA xmlBlaster.idl

unSubscribe

public UnSubscribeReturnQos[] unSubscribe(java.lang.String xmlKey_literal,
                                          java.lang.String qos_literal)
                                   throws XmlBlasterException
For I_XmlBlaster interface

Specified by:
unSubscribe in interface I_XmlBlaster
Throws:
XmlBlasterException - if queue is full
See Also:
CORBA xmlBlaster.idl

publish

public PublishReturnQos publish(MsgUnit msgUnit)
                         throws XmlBlasterException
Specified by:
publish in interface I_XmlBlaster
Returns:
dummy to match I_XmlBlaster interface
Throws:
XmlBlasterException - if queue is full
See Also:
CORBA xmlBlaster.idl

publishOneway

public void publishOneway(MsgUnit[] msgUnitArr)
Specified by:
publishOneway in interface I_XmlBlaster

publishArr

public PublishReturnQos[] publishArr(MsgUnit[] msgUnitArr)
                              throws XmlBlasterException
Specified by:
publishArr in interface I_XmlBlaster
Returns:
dummy to match I_XmlBlaster interface
Throws:
XmlBlasterException - if queue is full
See Also:
CORBA xmlBlaster.idl

erase

public EraseReturnQos[] erase(java.lang.String xmlKey_literal,
                              java.lang.String qos_literal)
                       throws XmlBlasterException
Specified by:
erase in interface I_XmlBlaster
Returns:
dummy to match I_XmlBlaster interface
Throws:
XmlBlasterException - if queue is full
See Also:
CORBA xmlBlaster.idl

get

public MsgUnit[] get(java.lang.String xmlKey_literal,
                     java.lang.String qos_literal)
              throws XmlBlasterException
Specified by:
get in interface I_XmlBlaster
Returns:
dummy to match I_XmlBlaster interface
Throws:
XmlBlasterException - if queue is full
See Also:
CORBA xmlBlaster.idl

ping

public boolean ping()
For I_XmlBlaster interface

Returns:
false No connection to server, off line recording messages.
See Also:
CORBA xmlBlaster.idl

update

public java.lang.String[] update(java.lang.String cbSessionId,
                                 MsgUnit[] msgUnitArr)
                          throws XmlBlasterException
This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.

Throws:
XmlBlasterException
See Also:
I_Callback.update(String, UpdateKey, byte[], UpdateQos)

updateOneway

public void updateOneway(java.lang.String cbSessionId,
                         MsgUnit[] msgUnitArr)
This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.

See Also:
I_Callback.update(String, UpdateKey, byte[], UpdateQos)

xmlBlaster 1.5.1 API

Copyright © 1999-2007 The xmlBlaster.org contributers.