xmlBlaster 2.2.0 client API

org.xmlBlaster.util
Class EmbeddedXmlBlaster

java.lang.Object
  extended by org.xmlBlaster.util.EmbeddedXmlBlaster

public class EmbeddedXmlBlaster
extends java.lang.Object

Helper to create/start/stop a xmlBlaster server instance in a thread.

TODO: change to use util.Global (or engine.Global as xmlBlaster.Main needs it).


Method Summary
 int changeRunlevel(int newRunlevel, boolean force)
          Change the run level to the given newRunlevel.
 org.xmlBlaster.I_Main getMain()
           
static void main(java.lang.String[] args)
          Invoke: java org.xmlBlaster.util.EmbeddedXmlBlaster

instead of the JacORB ORB, which won't work.

 void run()
           
static EmbeddedXmlBlaster startXmlBlaster(Global glob)
          Creates an instance of xmlBlaster and starts the server.
static EmbeddedXmlBlaster startXmlBlaster(int serverPort)
          Creates an instance of xmlBlaster and starts the server.
static EmbeddedXmlBlaster startXmlBlaster(java.lang.String[] args)
          Creates an instance of xmlBlaster and starts the server.
static EmbeddedXmlBlaster startXmlBlaster(java.lang.String[] args, java.lang.String clusterNodeId)
           
 void stopServer(boolean sync)
           
static void stopXmlBlaster(EmbeddedXmlBlaster serverThread)
          Stop xmlBlaster server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

startXmlBlaster

public static EmbeddedXmlBlaster startXmlBlaster(int serverPort)
Creates an instance of xmlBlaster and starts the server.

The returned xmlBlaster handle allows to control more than one xmlBlaster server simultaneously (on different ports).

Parameters:
serverPort - Default bootstrapPort is 3412
Returns:
the xmlBlaster handle, pass this to method stopXmlBlaster to shutdown the server again.

startXmlBlaster

public static EmbeddedXmlBlaster startXmlBlaster(java.lang.String[] args)
Creates an instance of xmlBlaster and starts the server.

Parameters:
args - Key/value array, containing command line arguments or xmlBlaster.properties variables to be used
Returns:
the xmlBlaster handle, pass this to method stopXmlBlaster to shutdown the server again.

startXmlBlaster

public static EmbeddedXmlBlaster startXmlBlaster(java.lang.String[] args,
                                                 java.lang.String clusterNodeId)

startXmlBlaster

public static EmbeddedXmlBlaster startXmlBlaster(Global glob)
Creates an instance of xmlBlaster and starts the server.

Parameters:
glob - The specific handle for this xmlBlaster server
Returns:
the xmlBlaster handle, pass this to method stopXmlBlaster to shutdown the server again.

stopXmlBlaster

public static void stopXmlBlaster(EmbeddedXmlBlaster serverThread)
Stop xmlBlaster server.

Parameters:
serverThread - The handle you got from startXmlBlaster()

getMain

public org.xmlBlaster.I_Main getMain()

stopServer

public void stopServer(boolean sync)
Parameters:
sync - if true the method blocks until the server is shutdown In this case global.shutdown() is called after shutdown and the Global is not usable anymore.

run

public void run()

changeRunlevel

public int changeRunlevel(int newRunlevel,
                          boolean force)
                   throws XmlBlasterException
Change the run level to the given newRunlevel.

See RUNLEVEL_HALTED etc.

Note that there are four main run levels:

and every RUNLEVEL sends a pre and a post run level event, to allow the listeners to prepare or log before or after successfully changing levels.
NOTE that the pre/post events are no run level states - they are just events.

Parameters:
newRunlevel - The new run level we want to switch to
force - Ignore exceptions during change, currently only force == true is supported
Returns:
numErrors
Throws:
XmlBlasterException - for invalid run level
See Also:
RunlevelManager.changeRunlevel(int, boolean)

main

public static void main(java.lang.String[] args)
Invoke: java org.xmlBlaster.util.EmbeddedXmlBlaster

instead of the JacORB ORB, which won't work.


xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.