xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.filewriter
Class FileWriter

java.lang.Object
  extended by org.xmlBlaster.contrib.GlobalInfo
      extended by org.xmlBlaster.contrib.filewriter.FileWriter
All Implemented Interfaces:
org.xmlBlaster.client.I_Callback, I_Info, org.xmlBlaster.util.plugin.I_Plugin

public class FileWriter
extends GlobalInfo
implements org.xmlBlaster.client.I_Callback

XmlBlaster plugin wrapper code. A plugin registration example (xmlBlasterPlugins.xml):

    <plugin create='true' id='FileWriter'
           className='org.xmlBlaster.contrib.filewriter.Receiver'>
      <attribute id='mom.topicName'>fileWriterTopic</attribute>
      <attribute id='connectQos'><![CDATA[
           <qos>
              <securityService type='htpasswd' version='1.0'>
                <user>FileWriter</user>
                <passwd>secret</passwd>
              </securityService>
              <session name='client/FileWriter/session/1' timeout='0' maxSessions='1'
                          clearSessions='true' reconnectSameClientOnly='false'/>
           </qos>
           ]]>
      </attribute>
      <attribute id='directoryName'>${user.home}${file.separator}FileDumps</attribute>
      <action do='LOAD' onStartupRunlevel='6' sequence='6'
                 onFail='resource.configuration.pluginFailed'/>
      <action do='STOP' onShutdownRunlevel='5' sequence='6'/>
   </plugin>
 

Author:
Michele Laghi

Field Summary
 
Fields inherited from class org.xmlBlaster.contrib.GlobalInfo
LOWER_CASE, ORIGINAL_ENGINE_GLOBAL, pluginInfo, UNTOUCHED, UPPER_CASE
 
Fields inherited from interface org.xmlBlaster.contrib.I_Info
ID, JMX_PREFIX
 
Constructor Summary
FileWriter()
           
FileWriter(org.xmlBlaster.util.Global globOrig, java.lang.String name, org.xmlBlaster.util.plugin.I_PluginConfig config)
           
 
Method Summary
 void doInit(org.xmlBlaster.util.Global glob, org.xmlBlaster.util.plugin.PluginInfo info)
           
 java.lang.String getType()
          The plugin name as configured im xmlBlasterPlugins.xml
 java.lang.String getVersion()
          The plugin version as configured in xmlBlasterPlugins.xml
 void shutdown()
          If an exception occurs it means it could not publish the entry
 java.lang.String update(java.lang.String cbSessionId, org.xmlBlaster.client.key.UpdateKey updateKey, byte[] content, org.xmlBlaster.client.qos.UpdateQos updateQos)
          This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new message.
 
Methods inherited from class org.xmlBlaster.contrib.GlobalInfo
dump, get, getBoolean, getGlobal, getInt, getKeys, getLong, getObject, getObjectKeys, getOriginalGlobal, getRaw, getStrippedString, init, loadPlugin, put, putObject, putRaw, replaceAllEntries, setStrippedHostname
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileWriter

public FileWriter()

FileWriter

public FileWriter(org.xmlBlaster.util.Global globOrig,
                  java.lang.String name,
                  org.xmlBlaster.util.plugin.I_PluginConfig config)
           throws org.xmlBlaster.util.XmlBlasterException
Throws:
org.xmlBlaster.util.XmlBlasterException
Method Detail

shutdown

public void shutdown()
              throws org.xmlBlaster.util.XmlBlasterException
If an exception occurs it means it could not publish the entry

Specified by:
shutdown in interface org.xmlBlaster.util.plugin.I_Plugin
Overrides:
shutdown in class GlobalInfo
Throws:
org.xmlBlaster.util.XmlBlasterException
See Also:
I_Plugin.shutdown()

getType

public java.lang.String getType()
Description copied from class: GlobalInfo
The plugin name as configured im xmlBlasterPlugins.xml

Specified by:
getType in interface org.xmlBlaster.util.plugin.I_Plugin
Overrides:
getType in class GlobalInfo
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
Description copied from class: GlobalInfo
The plugin version as configured in xmlBlasterPlugins.xml

Specified by:
getVersion in interface org.xmlBlaster.util.plugin.I_Plugin
Overrides:
getVersion in class GlobalInfo
See Also:
I_Plugin.getVersion()

doInit

public void doInit(org.xmlBlaster.util.Global glob,
                   org.xmlBlaster.util.plugin.PluginInfo info)
            throws org.xmlBlaster.util.XmlBlasterException
Specified by:
doInit in class GlobalInfo
Parameters:
glob - The global passed by the RunLevelManager, this is not the object owned by the plugin. It is the original global.
Throws:
org.xmlBlaster.util.XmlBlasterException

update

public java.lang.String update(java.lang.String cbSessionId,
                               org.xmlBlaster.client.key.UpdateKey updateKey,
                               byte[] content,
                               org.xmlBlaster.client.qos.UpdateQos updateQos)
                        throws org.xmlBlaster.util.XmlBlasterException
Description copied from interface: org.xmlBlaster.client.I_Callback
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new message.

So you should implement in your client code the I_Callback interface - suppling the update() method where you can do with the message whatever you want.

The raw protocol driver specific update() method (e.g. CORBA-BlasterCallback.update()) is unpacked and for each arrived message this update is called.

Specified by:
update in interface org.xmlBlaster.client.I_Callback
Parameters:
cbSessionId - The session ID specified by the client which registered the callback. You can specify a cbSessionId during connection (with ConnectQos) and this is bounced back here so you can authenticate the message.
updateKey - The arrived key containing the topic name
content - The arrived message content. This is your payload.
Throws:
org.xmlBlaster.util.XmlBlasterException
See Also:
I_XmlBlasterAccess

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.