xmlBlaster 2.2.0 API

org.xmlBlaster.engine.persistence
Class MsgFileDumper

java.lang.Object
  extended by org.xmlBlaster.engine.persistence.MsgFileDumper

public final class MsgFileDumper
extends java.lang.Object

A very simple, file based dump of a message.
We store messages on the hard disk, one message to one file (plus a key and a qos file).
All methods are marked final, in hope to have some performance gain (could be changed to allow a customized driver)
Invoke (for testing only):
jaco org.xmlBlaster.engine.persistence.MsgFileDumper

Author:
xmlBlaster@marcelruff.info

Field Summary
private  Global glob
           
private static java.util.logging.Logger log
           
private static java.lang.String ME
           
private  java.lang.String path
           
private  java.lang.String XMLKEY_TOKEN
           
private  java.lang.String XMLQOS_TOKEN
           
 
Constructor Summary
MsgFileDumper()
           
 
Method Summary
 java.lang.String createFileName(java.lang.String oid, long timestamp)
           
 void erase(XmlKey xmlKey)
          Allows a stored message to be deleted.
 MsgUnit fetch(java.lang.String oid, long timestamp)
          Allows to fetch one message by oid and timestamp from the persistence.
 java.util.Enumeration fetchAllOids()
          Fetches all oid's of the messages from the persistence.
 java.lang.String getPersistenceFileName(java.lang.String fileName)
           
 java.lang.String getPersistencePath()
           
 void init(Global glob)
          Initializes an instance, creates and checks harddisk path

 void init(Global glob, java.lang.String path_)
          Initializes an instance, creates and checks harddisk path

static void main(java.lang.String[] args)
          Invoke: java org.xmlBlaster.engine.persistence.MsgFileDumper
 void shutdown()
          Closes the instance of the filedriver plugin

 java.lang.String store(MsgUnitWrapper msgUnitWrapper)
          Allows a message to be stored.
private  java.lang.String store(MsgUnitWrapper msgUnitWrapper, boolean updateOnly)
           
 java.lang.String update(MsgUnitWrapper msgUnitWrapper)
          Allows a stored message content to be updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

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

glob

private Global glob

log

private static java.util.logging.Logger log

path

private java.lang.String path

XMLKEY_TOKEN

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

XMLQOS_TOKEN

private final java.lang.String XMLQOS_TOKEN
See Also:
Constant Field Values
Constructor Detail

MsgFileDumper

public MsgFileDumper()
Method Detail

init

public void init(Global glob)
          throws XmlBlasterException
Initializes an instance, creates and checks harddisk path

Parameters:
ServerScope - Global object holding logging and property informations
Throws:
XmlBlasterException

init

public void init(Global glob,
                 java.lang.String path_)
          throws XmlBlasterException
Initializes an instance, creates and checks harddisk path

Parameters:
glob - Global object holding logging and property informations
path_ - The path were to dump or null/empty
Throws:
XmlBlasterException

shutdown

public void shutdown()
              throws XmlBlasterException
Closes the instance of the filedriver plugin

Throws:
XmlBlasterException

createFileName

public java.lang.String createFileName(java.lang.String oid,
                                       long timestamp)
Returns:
.e.g "HelloWorld-2002-02-10 10:52:40.879456789"

getPersistencePath

public java.lang.String getPersistencePath()

getPersistenceFileName

public java.lang.String getPersistenceFileName(java.lang.String fileName)

store

public java.lang.String store(MsgUnitWrapper msgUnitWrapper)
                       throws XmlBlasterException
Allows a message to be stored.

It only stores the xmlKey, content and qos. The other store() method is called for following messages, to store only message-content.

Parameters:
msgUnitWrapper - The container with all necessary message info.
Returns:
The file name of the message
Throws:
XmlBlasterException

store

private java.lang.String store(MsgUnitWrapper msgUnitWrapper,
                               boolean updateOnly)
                        throws XmlBlasterException
Throws:
XmlBlasterException

update

public java.lang.String update(MsgUnitWrapper msgUnitWrapper)
                        throws XmlBlasterException
Allows a stored message content to be updated.

It only stores the content, so the other store() method needs to be called first if this message is new.

Parameters:
xmlKey - To identify the message
content - The data to store
qos - The quality of service, may contain another publisher name
Returns:
The file name of the message
Throws:
XmlBlasterException

fetch

public MsgUnit fetch(java.lang.String oid,
                     long timestamp)
              throws XmlBlasterException
Allows to fetch one message by oid and timestamp from the persistence.

Parameters:
oid - The message oid (key oid="...")
Returns:
the MsgUnit, which is persistent.
Throws:
XmlBlasterException

fetchAllOids

public java.util.Enumeration fetchAllOids()
                                   throws XmlBlasterException
Fetches all oid's of the messages from the persistence.

It is a helper method to invoke 'fetch(String oid)'.

Returns:
a Enumeration of oids of all persistent MsgUnits. The oid is a String-Type.
Throws:
XmlBlasterException

erase

public void erase(XmlKey xmlKey)
           throws XmlBlasterException
Allows a stored message to be deleted.

Parameters:
xmlKey - To identify the message
Throws:
XmlBlasterException

main

public static void main(java.lang.String[] args)
Invoke: java org.xmlBlaster.engine.persistence.MsgFileDumper


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.