Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.xmlBlaster.util.recorder.file
Class FileRecorder  view FileRecorder download FileRecorder.java

java.lang.Object
  extended byorg.xmlBlaster.util.recorder.file.FileRecorder

public class FileRecorder
extends java.lang.Object

Records requests of the client into a file, if the client is not able to connect to the xmlBlaster. By implementing the I_InvocationRecorder it can be plugged into the xmlBlaster. This implementation is very similar to the implementation of RamRecorder for the xmlBlaster ($XMLBLASTER_HOME/src/java/org/xmlBlaster/util/recorder/ram).

Configuration:

 RecorderPlugin[FileRecorder][1.0]=org.xmlBlaster.util.recorder.file.FileRecorder
 
See the util.recorder requirement.


Field Summary
private  boolean autoCommit
          Automatically write curr pos to file?
private  I_CallbackRaw clientCallback
           
private  EraseRetQos[] dummyEraseRetQosArr
           
private  MessageUnit[] dummyMArr
           
private  PublishRetQos dummyPubRet
           
private  PublishRetQos[] dummyPubRetQosArr
           
private  java.lang.String dummyS
           
private  java.lang.String[] dummySArr
           
private  SubscribeRetQos dummySubRet
           
private  java.lang.String fileName
           
private  Global glob
           
private  LogChannel log
           
private  long maxEntries
           
private  java.lang.String ME
           
private  FileIO rb
           
private  I_XmlBlaster serverCallback
           
 
Constructor Summary
FileRecorder()
           
 
Method Summary
private  void callback(RequestContainer cont)
           
private  java.lang.String createPathString(java.lang.String fn)
          Returns the name of the file to store tail back messages.
 void destroy()
          deletes the file
 EraseRetQos[] erase(java.lang.String xmlKey, java.lang.String qos)
          storing erase request
 MessageUnit[] get(java.lang.String xmlKey, java.lang.String qos)
          storing get request
 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()
          Number of requests buffered
 java.lang.String getType()
          Return plugin type for Plugin loader
 java.lang.String getVersion()
          Return plugin version for Plugin loader
 void init(org.xmlBlaster.util.Global glob, java.lang.String[] options)
          This method is called by the PluginManager.
 void initialize(Global glob, java.lang.String fn, long maxEntries, I_XmlBlaster serverCallback, I_CallbackRaw clientCallback)
          File name is:
 boolean isFull()
          Dummy method.
 boolean ping()
           
 void playback(long startDate, long endDate, double motionFactor)
          Not implemented yet
 PublishRetQos publish(MessageUnit msgUnit)
          storing publish request
 PublishRetQos[] publishArr(MessageUnit[] msgUnitArr)
          storing publishArr request
 void publishOneway(MessageUnit[] msgUnitArr)
          storing publishOneway request
 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)
          This method reads out stored requests from the file where they were buffered.
 void setMode(java.lang.String mode)
           
 void shutdown()
           
 SubscribeRetQos subscribe(java.lang.String xmlKey, java.lang.String qos)
          storing subscribe request
 void unSubscribe(java.lang.String xmlKey, java.lang.String qos)
          storing unSubscribe request
 java.lang.String[] update(java.lang.String cbSessionId, MessageUnit[] msgUnitArr)
          storing update request
 void updateOneway(java.lang.String cbSessionId, MessageUnit[] msgUnitArr)
          storing updateOneway request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private final java.lang.String ME
See Also:
Constant Field Values

glob

private Global glob

log

private LogChannel log

rb

private FileIO rb

fileName

private java.lang.String fileName

serverCallback

private I_XmlBlaster serverCallback

clientCallback

private I_CallbackRaw clientCallback

dummyMArr

private final MessageUnit[] dummyMArr

dummySArr

private final java.lang.String[] dummySArr

dummyS

private final java.lang.String dummyS
See Also:
Constant Field Values

dummyPubRetQosArr

private final PublishRetQos[] dummyPubRetQosArr

dummyPubRet

private PublishRetQos dummyPubRet

dummySubRet

private SubscribeRetQos dummySubRet

dummyEraseRetQosArr

private final EraseRetQos[] dummyEraseRetQosArr

maxEntries

private long maxEntries

autoCommit

private boolean autoCommit
Automatically write curr pos to file?

Constructor Detail

FileRecorder

public FileRecorder()
Method Detail

initialize

public void initialize(Global glob,
                       java.lang.String fn,
                       long maxEntries,
                       I_XmlBlaster serverCallback,
                       I_CallbackRaw clientCallback)
                throws XmlBlasterException
File name is:
   Persistence.Path=${user.home}${file.separator}tmp
   recorder.path=${Persistence.Path}${file.separator}fileRecorder

   The file name is
       tailback-[clientClusterNodeId]-[serverClusterNodeId].frc

   For example:
      /home/michelle/tmp/fileRecorder/tailback-heron-to-avalon.frc
 


createPathString

private java.lang.String createPathString(java.lang.String fn)
Returns the name of the file to store tail back messages.

Example:

  For an ordinary client 'joe' with public session id 9

   /home/xmlblast/tmp/fileRecorder/tailback-joe9-to-frodo.frc

  In a cluster environment (which only logs in once (exactly one session):

   /home/xmlblast/tmp/fileRecorder/tailback-bilbo-to-heron.frc  (in cluster environment)
 
See the util.recorder requirement on how to configure.


getFullFileName

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


init

public void init(org.xmlBlaster.util.Global glob,
                 java.lang.String[] options)
          throws XmlBlasterException
This method is called by the PluginManager.


getType

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


getVersion

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


setMode

public void setMode(java.lang.String mode)

isFull

public final boolean isFull()
                     throws XmlBlasterException
Dummy method. Just provided as other recorders also provide it.


getNumUnread

public final long getNumUnread()
Number of requests buffered


pullback

public void pullback(long startDate,
                     long endDate,
                     double motionFactor)
              throws XmlBlasterException
This method reads out stored requests from the file where they were buffered. Depending on the "request-method" the appropriate client operation will be invoked.


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

This method is thread save, even for undo on exceptions.


getNumLost

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


playback

public void playback(long startDate,
                     long endDate,
                     double motionFactor)
              throws XmlBlasterException
Not implemented yet


callback

private void callback(RequestContainer cont)
               throws XmlBlasterException

subscribe

public SubscribeRetQos subscribe(java.lang.String xmlKey,
                                 java.lang.String qos)
                          throws XmlBlasterException
storing subscribe request


unSubscribe

public void unSubscribe(java.lang.String xmlKey,
                        java.lang.String qos)
                 throws XmlBlasterException
storing unSubscribe request


publish

public PublishRetQos publish(MessageUnit msgUnit)
                      throws XmlBlasterException
storing publish request


publishOneway

public void publishOneway(MessageUnit[] msgUnitArr)
                   throws XmlBlasterException
storing publishOneway request


publishArr

public PublishRetQos[] publishArr(MessageUnit[] msgUnitArr)
                           throws XmlBlasterException
storing publishArr request


erase

public EraseRetQos[] erase(java.lang.String xmlKey,
                           java.lang.String qos)
                    throws XmlBlasterException
storing erase request


get

public MessageUnit[] get(java.lang.String xmlKey,
                         java.lang.String qos)
                  throws XmlBlasterException
storing get request


ping

public boolean ping()

update

public java.lang.String[] update(java.lang.String cbSessionId,
                                 MessageUnit[] msgUnitArr)
                          throws XmlBlasterException
storing update request


updateOneway

public void updateOneway(java.lang.String cbSessionId,
                         MessageUnit[] msgUnitArr)
storing updateOneway request


destroy

public void destroy()
deletes the file


shutdown

public void shutdown()