xmlBlaster 2.2.0 client API

javaclients
Class HelloWorldNative2

java.lang.Object
  extended by javaclients.HelloWorldNative2
All Implemented Interfaces:
I_Plugin

public class HelloWorldNative2
extends java.lang.Object
implements I_Plugin

This native client plugin is loaded by xmlBlaster on startup, it then connects to xmlBlaster and subscribes to a topic and publishes a message.

You need to register this plugin to xmlBlasterPlugins.xml, for example:

  <plugin id='HelloWorldNative2' className='javaclients.HelloWorldNative2'>
     <attribute id='loginName'>nativeClient2</attribute>
     <attribute id='topicName'>aNativeTopic2</attribute>
     <action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/>
     <action do='STOP' onShutdownRunlevel='6' sequence='5'/>
  </plugin>
 

Note how the attributes loginName and topicName are passed to the plugin.

As a protocol driver to talk to xmlBlaster it has configured "LOCAL", this plugin works only if client and server is in the same virtual machine (JVM). Other protocols like CORBA or SOCKET would work as well but carry the overhead of sending the message over TCP/IP.

See Also:
run level requirement

Constructor Summary
HelloWorldNative2()
          To start as a plugin
HelloWorldNative2(java.lang.String[] args)
          To start as a standalone client: java javaclients.HelloWorldNative2
 
Method Summary
 void finalize()
           
 java.lang.String getType()
           
 java.lang.String getVersion()
           
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager.
static void main(java.lang.String[] args)
           
 void shutdown()
          Cleans up the resource.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelloWorldNative2

public HelloWorldNative2()
To start as a plugin


HelloWorldNative2

public HelloWorldNative2(java.lang.String[] args)
To start as a standalone client: java javaclients.HelloWorldNative2

Method Detail

init

public void init(Global glob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
Description copied from interface: I_Plugin
This method is called by the PluginManager.

Example how options are evaluated:

   // An entry in xmlBlaster.properties (in one line):
   MimeSubscribePlugin[ContentLenFilter][1.0]=\
                 org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
                 DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20

  // Access it like this:
  java.util.Properties props = pluginInfo.getParameters();
  String maxLen = (String)props.get("DEFAULT_MAX_LEN");
  String throwLen = (String)props.get("THROW_EXCEPTION_FOR_LEN");
 

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException

getType

public java.lang.String getType()
Specified by:
getType in interface I_Plugin

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface I_Plugin

shutdown

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

Specified by:
shutdown in interface I_Plugin

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.