xmlBlaster 2.2.0 API

org.xmlBlaster.protocol.rmi
Class RmiDriver

java.lang.Object
  extended by org.xmlBlaster.protocol.rmi.RmiDriver
All Implemented Interfaces:
I_Driver, I_Plugin

public class RmiDriver
extends java.lang.Object
implements I_Driver

RmiDriver class to invoke the xmlBlaster server using RMI.

Design issues:

How to identify the calling client.

How does RMI handle incoming requests?
Is it a worker thread model, or a 1 client/one thread model, or 1 worker thread per RMI call? When a call comes in a random thread is taken from a pool.
According to the rmi specs "A method dispatched by the RMI runtime to a remote object implementation (a server) may or may not execute in a separate thread. Some calls originating from the same client virtual machine will execute in the same thread; some will execute in different threads. Calls originating from different client virtual machines will execute in different threads. Other than this last case of different client virtual machines, the RMI runtime makes no guarantees with respect to mapping remote object invocations to threads. "

Possible soultions:

We will choose the second solution (pass the sessionId).

RMI has not fine controlled policy like the CORBA POA!

A rmi-registry server is created automatically, if there is running already one, that is used.
You can specify another port or host to create/use a rmi-registry server:

     -plugin/rmi/registryPort   Specify a port number where rmiregistry listens.
                         Default is port 1099, the port 0 switches this feature off.
     -plugin/rmi/hostname Specify a hostname where rmiregistry runs.
                         Default is the localhost.
 

Invoke options:

   java -Djava.rmi.server.codebase=file:///${XMLBLASTER_HOME}/classes/  \
        -Djava.security.policy=${XMLBLASTER_HOME}/config/xmlBlaster.policy \
        -Djava.rmi.server.hostname=hostname.domainname
        MyApp -plugin/rmi/registryPort 2078
 
Another option is to include the directory of xmlBlaster.policy into your CLASSPATH.

See Also:
The RMI requirement, RMI FAQ, RMI USERS

Field Summary
private  AddressServer addressServer
          The protocol plugin configuration
private  java.lang.String authBindName
          The name for the RMI registry
private  I_Authenticate authenticate
          The singleton handle for this xmlBlaster server
private  AuthServerImpl authRmiServer
          The RMI implementation, which delegates to authenticate
static int DEFAULT_REGISTRY_PORT
          XmlBlaster RMI registry listen port is 1099, to access for bootstrapping
private  Global glob
           
private  boolean isActive
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  java.lang.String xmlBlasterBindName
          The name for the RMI registry
private  I_XmlBlaster xmlBlasterImpl
          The singleton handle for this xmlBlaster server
private  XmlBlasterImpl xmlBlasterRmiServer
          The RMI implementation, which delegates to xmlBlaster server
 
Constructor Summary
RmiDriver()
           
 
Method Summary
 void activate()
          Activate xmlBlaster access through this protocol.
private  void bindToRegistry()
          Publish the RMI xmlBlaster server to rmi registry.
 void deActivate()
          Deactivate xmlBlaster access (standby), no clients can connect.
 java.lang.String getName()
          Get a human readable name of this driver
 java.lang.String getProtocolId()
          Access the xmlBlaster internal name of the protocol driver.
 java.lang.String getRawAddress()
          Get the address how to access this driver.
 java.lang.String getType()
          Enforced by I_Plugin
 java.lang.String getVersion()
          Enforced by I_Plugin
private  void init(Global glob, AddressServer addressServer, I_Authenticate authenticate, I_XmlBlaster xmlBlasterImpl)
          Start xmlBlaster RMI access.
 void init(Global glob, PluginInfo pluginInfo)
          This method is called by the PluginManager (enforced by I_Plugin).
 void shutdown()
          Instructs RMI to shut down.
 java.lang.String usage()
          Command line usage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

DEFAULT_REGISTRY_PORT

public static final int DEFAULT_REGISTRY_PORT
XmlBlaster RMI registry listen port is 1099, to access for bootstrapping

See Also:
Constant Field Values

authenticate

private I_Authenticate authenticate
The singleton handle for this xmlBlaster server


xmlBlasterImpl

private I_XmlBlaster xmlBlasterImpl
The singleton handle for this xmlBlaster server


authRmiServer

private AuthServerImpl authRmiServer
The RMI implementation, which delegates to authenticate


authBindName

private java.lang.String authBindName
The name for the RMI registry


xmlBlasterRmiServer

private XmlBlasterImpl xmlBlasterRmiServer
The RMI implementation, which delegates to xmlBlaster server


xmlBlasterBindName

private java.lang.String xmlBlasterBindName
The name for the RMI registry


isActive

private boolean isActive

addressServer

private AddressServer addressServer
The protocol plugin configuration

Constructor Detail

RmiDriver

public RmiDriver()
Method Detail

getName

public java.lang.String getName()
Get a human readable name of this driver

Specified by:
getName in interface I_Driver

getProtocolId

public java.lang.String getProtocolId()
Access the xmlBlaster internal name of the protocol driver.

Specified by:
getProtocolId in interface I_Driver
Returns:
"RMI"

getType

public java.lang.String getType()
Enforced by I_Plugin

Specified by:
getType in interface I_Plugin

getVersion

public java.lang.String getVersion()
Enforced by I_Plugin

Specified by:
getVersion in interface I_Plugin

init

public void init(Global glob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
This method is called by the PluginManager (enforced by I_Plugin).

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)

getRawAddress

public java.lang.String getRawAddress()
Get the address how to access this driver.

Specified by:
getRawAddress in interface I_Driver
Returns:
"rmi://www.mars.universe:1099/I_AuthServer"

init

private void init(Global glob,
                  AddressServer addressServer,
                  I_Authenticate authenticate,
                  I_XmlBlaster xmlBlasterImpl)
           throws XmlBlasterException
Start xmlBlaster RMI access.

Parameters:
glob - Global handle to access logging, property and commandline args
Throws:
XmlBlasterException

activate

public void activate()
              throws XmlBlasterException
Activate xmlBlaster access through this protocol.

Specified by:
activate in interface I_Driver
Throws:
XmlBlasterException

deActivate

public void deActivate()
                throws XmlBlasterException
Deactivate xmlBlaster access (standby), no clients can connect.

Specified by:
deActivate in interface I_Driver
Throws:
XmlBlasterException

shutdown

public void shutdown()
              throws XmlBlasterException
Instructs RMI to shut down.

Specified by:
shutdown in interface I_Plugin
Throws:
XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.


bindToRegistry

private void bindToRegistry()
                     throws XmlBlasterException
Publish the RMI xmlBlaster server to rmi registry.

The bind name is typically "rmi://localhost:1099/xmlBlaster"

Throws:
XmlBlasterException - RMI registry error handling

usage

public java.lang.String usage()
Command line usage.

Specified by:
usage in interface I_Driver

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.