|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
fr.paris5.shaman.insight.component.AbstractExposedService
The base class for all exposed services, which MUST derive of it.
This class manages RMI export, but does not derive from
UnicastRemoteObject
in order to avoid RMI registration when using standalone.
How this is done :
JDK doc says that it's not mandatory to derive from
UnicastRemoteObject if the exported Object does provide
implementations of hashCode, equals,
and toString, which are compatible with remote object behavior.
Since this behavior relies on the knowledge of
remote reference
, some methods have been copied to provide
a consistent handling of this reference.
Note about support of Serializable interface :
A RMI server object must be serializable, but the intend is
not to serialize the whole server object, only its
remote reference
. Derived classes should not
take care of serialization.
Note about support of Avalon-Framework lifecycle-related
interface :
Those methods are declared final.
Field Summary | |
private InsightContext |
iContext
|
private InsightManager |
insightManager
|
private boolean |
isRMIServer
|
private org.apache.avalon.excalibur.logger.LogKitManager |
logManager
|
private int |
port
|
private static java.lang.Class[] |
portFactoryParamTypes
Parameter types for server ref constructor invocation used below |
private static java.lang.Class[] |
portParamTypes
Parameter types for server ref constructor invocation used below |
private java.rmi.server.RemoteRef |
ref
|
private java.lang.String |
rmiIdentifier
|
Fields inherited from interface fr.paris5.shaman.system.SystemConfigurationConstants |
BASEDIRURL_ATTRIBUTE, DEFAULTHOSTNAME, EMPTYSYSTEM_RESOURCE, HOSTNAME_ATTRIBUTE, PORT_ATTRIBUTE, RUNSTYLE_ATTRIBUTE, SYSTEMCONFIGURATION_DEFAULT_RESOURCE |
Fields inherited from interface fr.paris5.shaman.insight.component.InsightConfigurationConstants |
CLASS_ATTRIBUTE, COMMANDLOGS_ELEMENT, DEFAULT_PREVALENCEBASE_DIR, DIR_ELEMENT, EXPOSEDAS_ATTRIBUTE, LOGKITCONFIGURATION_DEFAULT_RESOURCE, PERSISTING_ATTRIBUTE, ROLE_ATTRIBUTE, SNAPSHOTDIR_ELEMENT, SYSTEMCONFIGURATIONURL_ATTRIBUTE |
Constructor Summary | |
|
AbstractExposedService()
Constructor for using service in an in-process context. |
|
AbstractExposedService(int port)
Constructor for exporting service as accessible remotely. |
protected |
AbstractExposedService(java.rmi.server.RemoteRef ref)
|
Method Summary | |
java.lang.Object |
clone()
Documentation copied from JDK 1.3.1_03 sources : Returns a clone of the remote object that is distinct from the original. |
void |
compose(org.apache.avalon.framework.component.ComponentManager componentManager)
|
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
|
void |
contextualize(org.apache.avalon.framework.context.Context context)
|
void |
dispose()
|
protected void |
doCompose()
Subclasses may define their own behavior by overriding this method. |
protected void |
doConfigure(org.apache.avalon.framework.configuration.Configuration configuration)
Subclasses may define their own behavior by overriding this method. |
protected void |
doContextualize(InsightContext context)
Subclasses may define their own behavior by overriding this method. |
protected void |
doDispose()
Subclasses may define their own behavior by overriding this method. |
protected void |
doInitialize()
Subclasses may define their own behavior by overriding this method. |
boolean |
equals(java.lang.Object obj)
Documentation copied from JDK 1.3.1_03 sources : Compares two remote objects for equality. |
static java.rmi.Remote |
exportObject(java.rmi.Remote obj,
int port)
Documentation copied from JDK 1.3.1_03 sources : Export the remote object to make it available to receive incoming calls, using the particular supplied port. |
static java.rmi.Remote |
exportObject(java.rmi.Remote obj,
int port,
java.rmi.server.RMIClientSocketFactory csf,
java.rmi.server.RMIServerSocketFactory ssf)
Documentation copied from JDK 1.3.1_03 sources : Export the remote object to make it available to receive incoming calls, using a transport specified by the given socket factory. |
private static java.rmi.Remote |
exportObject(java.rmi.Remote obj,
java.lang.String refType,
java.lang.Class[] params,
java.lang.Object[] args)
Documentation copied from JDK 1.3.1_03 sources : Create instance of given server ref type with constructor chosen by indicated paramters and supplied with given arguements, and export remote object with it. |
protected InsightManager |
getInsightManager()
|
protected org.apache.avalon.excalibur.logger.LogKitManager |
getLogManager()
|
java.rmi.server.RemoteRef |
getRef()
|
int |
hashCode()
Documentation copied from JDK 1.3.1_03 sources : Returns a hashcode for a remote object. |
void |
initialize()
|
private void |
readObject(java.io.ObjectInputStream in)
Documentation copied from JDK 1.3.1_03 sources : Re-export the remote object when it is deserialized. |
private void |
reexport()
|
void |
setLogKitManager(org.apache.avalon.excalibur.logger.LogKitManager logManager)
|
java.lang.String |
toString()
Documentation copied from JDK 1.3.1_03 sources : Returns a String that represents the value of this remote object. |
private void |
writeObject(java.io.ObjectOutputStream out)
Writes object for serialization, taking care of not writing non-transient fields. |
Field Detail |
private final boolean isRMIServer
private int port
private InsightContext iContext
private InsightManager insightManager
private java.lang.String rmiIdentifier
private org.apache.avalon.excalibur.logger.LogKitManager logManager
private static java.lang.Class[] portParamTypes
private static java.lang.Class[] portFactoryParamTypes
private transient java.rmi.server.RemoteRef ref
Constructor Detail |
public AbstractExposedService()
public AbstractExposedService(int port) throws java.rmi.RemoteException
port
- Use 0 if you don't know which port to use.protected AbstractExposedService(java.rmi.server.RemoteRef ref)
Method Detail |
protected void doContextualize(InsightContext context) throws org.apache.avalon.framework.context.ContextException
public final void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException
protected void doCompose()
public final void compose(org.apache.avalon.framework.component.ComponentManager componentManager) throws org.apache.avalon.framework.component.ComponentException
protected final InsightManager getInsightManager()
protected void doConfigure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
public final void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException
protected final void doInitialize() throws java.lang.Exception
public final void initialize() throws java.lang.Exception
protected void doDispose()
public final void dispose()
protected final org.apache.avalon.excalibur.logger.LogKitManager getLogManager()
public void setLogKitManager(org.apache.avalon.excalibur.logger.LogKitManager logManager)
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
private void reexport() throws java.rmi.RemoteException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if clone failed due to
a RemoteException.public static java.rmi.Remote exportObject(java.rmi.Remote obj, int port) throws java.rmi.RemoteException
obj
- the remote object to be exportedport
- the port to export the object onjava.rmi.RemoteException
- if export failspublic static java.rmi.Remote exportObject(java.rmi.Remote obj, int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf) throws java.rmi.RemoteException
obj
- the remote object to be exportedport
- the port to export the object oncsf
- the client-side socket factory for making calls to the
remote objectssf
- the server-side socket factory for receiving remote callsjava.rmi.RemoteException
- if export failsprivate static java.rmi.Remote exportObject(java.rmi.Remote obj, java.lang.String refType, java.lang.Class[] params, java.lang.Object[] args) throws java.rmi.RemoteException
public java.rmi.server.RemoteRef getRef()
public int hashCode()
Hashtable
public boolean equals(java.lang.Object obj)
equals
method of its parameter with this remote object
as the argument.obj
- the Object to compare withHashtable
public java.lang.String toString()
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException, java.lang.ClassNotFoundException
Documentation copied from JDK 1.3.1_03 sources :
writeObject for object serialization. Writes out the class
name of the remote reference contained in this class and
delegates to the reference to write out its representation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |