|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.core.dist.RemoteRef
RemoteRef
stores the reference of a remote object.
The way the remote object is accessed depends on
the underlying communication protocol (eg CORBA or RMI).
Supporting a new communication protocol requires to subclass RemoteRef (eg RMIRemoteRef or CORBARemoteRef) and to implement the resolve and reresolve methods.
resolve(java.lang.String)
,
reresolve()
,
RMIRemoteRef
,
CORBARemoteRef
,
Serialized FormField Summary | |
protected String |
name
The name of the remote object that is of will be associated to the remote ref. |
protected RemoteContainer |
remCont
The reference of the container that handles the remote object. |
protected int |
remIndex
The index (see org.objectweb.jac.core.JacObject) of the remote object. |
protected static String |
toAdaptProp
Following constants are property keys used by remoteNew(). |
Constructor Summary | |
protected |
RemoteRef()
Empty default constructor for RemoteRef needed by the compiler whenever RemoteRef is subclasses (eg RMIRemoteRef or CORBARemoteRef). |
|
RemoteRef(RemoteContainer remCont,
int remIndex)
This is a full constructor for RemoteRef. |
|
RemoteRef(String contName,
int remIndex)
This is a more friendly constructor for RemoteRef. |
Method Summary | |
static RemoteRef |
create(String name)
This class method returns a new RemoteRef object. |
static RemoteRef |
create(String name,
Object localObject)
Create a remote reference from a local JAC object (in order, for example, to transmit it to a remote container). |
static RemoteRef |
create(String name,
RemoteContainer remCont,
int remIndex)
This class method returns a remote reference for an existing remote JAC object. |
boolean |
equals(Object o)
Test the equality of 2 remote references. |
String |
getName()
The getter method for the name. |
RemoteContainer |
getRemCont()
The getter method for the remCont field. |
int |
getRemIndex()
The getter method for the remIndex field. |
Object |
invoke(String methodName,
Object[] methodArgs)
Forward a call to the referenced object. |
Object |
invoke(String methodName,
Object[] methodArgs,
Boolean[] refs)
Forward a call to the referenced object. |
Object |
invokeRoleMethod(String methodName,
Object[] methodArgs)
Forward a role method call to the referenced object. |
void |
remoteCopy(Object src)
Copy the state of a given object into the remote object referenced by the current reference. |
void |
remoteCopy(Object src,
String[] fieldsName)
Copy the state of a given object into the remote object referenced by the current reference. |
void |
remoteNew(String host,
String clName)
Remotely instantiate a class. |
void |
remoteNew(String host,
String clName,
Object[] args)
Remotely instantiate a class. |
void |
remoteNewWithCopy(String host,
String clName,
Object src)
Remotely instantiate a class. |
void |
remoteNewWithCopy(String host,
String clName,
Object[] args,
Object src)
Remotely instantiate a class. |
void |
remoteNewWithCopy(String host,
String clName,
Object[] args,
Object src,
String[] fieldsName)
Remotely instantiate a class. |
void |
remoteNewWithCopy(String host,
String clName,
Object src,
String[] fieldsName)
Remotely instantiate a class. |
RemoteContainer |
reresolve()
This method re-gets the reference of a remote container. |
RemoteContainer |
resolve(String contName)
This method resolves a container from a container name. |
void |
setName(String name)
The setter method for the name. |
String |
toString()
Create a textual representation of the remote reference. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected RemoteContainer remCont
protected int remIndex
protected String name
protected static final String toAdaptProp
Constructor Detail |
public RemoteRef(RemoteContainer remCont, int remIndex)
remCont
- the ref of the container that handles the remote
object.remIndex
- the index of the remote objectpublic RemoteRef(String contName, int remIndex)
remIndex
- the index of the remote object.protected RemoteRef()
This constructor should never be called in other cases (this is why it is protected).
Method Detail |
public static RemoteRef create(String name)
Property org.objectweb.jac.dist.remoteRefClass defines the class of the actual RemoteRef returned (e.g. CORBARemoteRef). If the property is not defined or if the class does not exist, RMIRemoteRef is the default.
name
- the name to give to the remote ref (should be equal
to the pointed object name)
public static RemoteRef create(String name, RemoteContainer remCont, int remIndex)
Property org.objectweb.jac.dist.remoteRefClass defines the class of the actual RemoteRef returned (e.g. CORBARemoteRef). If the property is not defined or if the class does not exist, RMIRemoteRef is the default.
name
- the remote object name (can be null if not needed)remCont
- the remote container where the JAC object is
instantiatedremIndex
- the index of the JAC object in the remote
container
public static RemoteRef create(String name, Object localObject)
name
- the name to be given to the remote referencelocalObject
- the object to create the reference from
public RemoteContainer getRemCont()
It returns a the container that handles the remote object. If the remote container is local, then the object pointed by the remote reference is also local.
public void setName(String name)
name
- the new namepublic String getName()
public int getRemIndex()
remIndex
field.
remIndex
is the index (see org.objectweb.jac.core.JacObject) of
the remote object.
public RemoteContainer resolve(String contName)
Its implementation is protocol dependent (eg RMI or CORBA). Most concrete implementations of this method (see RMIRemoteRef) simply delegate the resolution to a resolve() class method defined in a container class (see RMIRemoteContainer).
contName
- the name of the container
RMIRemoteRef.resolve(String)
,
CORBARemoteRef.resolve(String)
public RemoteContainer reresolve()
Its implementation is protocol dependent (eg RMI or CORBA). Some communication protocols (eg CORBA) do not linearalize remote references in a standard way. Thus a remote reference may need to be adapted whenever it is transmitted.
This method is called when a remote reference
is recieved by a RemoteContainer
.
RMIRemoteRef.reresolve()
,
CORBARemoteRef.reresolve()
public void remoteNew(String host, String clName)
Make the current RemoteRef
instance reference the
created object.
host
- the host machineclName
- the class to instantiatepublic void remoteNew(String host, String clName, Object[] args)
Make the current RemoteRef
instance reference the
created object.
host
- the host machineclName
- the class to instantiateargs
- initialization arguments for the instantiationpublic void remoteNewWithCopy(String host, String clName, Object src)
Make the current RemoteRef
instance reference the
created object and copy the state of the given object into the
remote object.
All the fields of the object are copied.
host
- the host machineclName
- the class to instantiatesrc
- the source object containing the data to copypublic void remoteNewWithCopy(String host, String clName, Object[] args, Object src)
Make the current RemoteRef
instance reference the
created object and copy the state of the given object into the
remote object.
All the fields of the object are copied.
host
- the host machineclName
- the class to instantiateargs
- initialization arguments for the instantiationsrc
- the source object containing the data to copypublic void remoteNewWithCopy(String host, String clName, Object src, String[] fieldsName)
Make the current RemoteRef
instance reference the
created object and copy the state of the given object into the
remote object.
Only specified fields are copied.
host
- the host machineclName
- the class to instantiatesrc
- the source object containing the data to copyfieldsName
- the fields name to copypublic void remoteNewWithCopy(String host, String clName, Object[] args, Object src, String[] fieldsName)
RemoteRef
instance reference the
created object and copy the state of the given object into the
remote object.Only specified fields are copied.
host
- the host machineclName
- the class to instantiateargs
- initialization arguments for the instantiationsrc
- the source object containing the data to copyfieldsName
- the fields name to copypublic void remoteCopy(Object src)
All the fields of the object are copied.
src
- the source object containing the data to copypublic void remoteCopy(Object src, String[] fieldsName)
Only specified fields are copied.
src
- the source object containing the data to copyfieldsName
- the fields name to copypublic Object invoke(String methodName, Object[] methodArgs)
methodName
- the called method namemethodArgs
- the called method arguments
public Object invoke(String methodName, Object[] methodArgs, Boolean[] refs)
methodName
- the called method namemethodArgs
- the called method arguments
public Object invokeRoleMethod(String methodName, Object[] methodArgs)
methodName
- the called role method namemethodArgs
- the called role method arguments
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
o
- the remote reference to check
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |