org.objectweb.jeremie.stub_factories.std

Class RefImpl

Implemented Interfaces:
JRMIOptRef, JRMIRef, Reference, RemoteRef

public class RefImpl
extends Object
implements JRMIOptRef

Provides an implementation of a Jeremie reference to a remote object.

A Jeremie reference contains:

Field Summary

protected SessionIdentifier
ep
The session identifier associated with this reference.
protected Identifier[]
ids
The set of identifiers held by this reference.
protected MarshallerFactory
mfactory
The marshaller factory associated with this reference.
protected Session_High
session
The protocol session high object associated with this reference.

Constructor Summary

RefImpl()
RefImpl(Identifier[] ids, MarshallerFactory mfactory)
Creates a Jeremie reference containing the given object identifiers and marshaller factory.
RefImpl(SessionIdentifier ep, Identifier[] ids, MarshallerFactory mfactory)
Creates a Jeremie reference containing the given session identifier, object identifiers and marshaller factory.

Method Summary

void
done(RemoteCall call)
Deprecated.
protected void
finalize()
Identifier[]
getIdentifiers()
Returns the identifiers contained in this reference.
String
getRefClass(ObjectOutput out)
Not used; left for compatibility with java.rmi.server.RemoteRef
void
invoke(Marshaller marshaller)
Sends the marshaller with the invocation data down the protocol stack.
Object
invoke(Remote obj, Method method, Object[] params, long opnum)
Carries out a remote method invocation and either returns the result of the invocation is successful, otherwise an exception.
void
invoke(RemoteCall call)
Deprecated.
RemoteCall
newCall(RemoteObject obj, Operation[] op, int opnum, long hash)
Deprecated.
ReplyInterface
prepareInvocation(Marshaller marshaller)
Prepares the marshaller prior to marshalling invocation data.
void
readExternal(ObjectInput stream)
Reads an external representation of this reference from an underlying object input stream.
boolean
remoteEquals(RemoteRef obj)
Tests for object equality (==) of this reference with the given reference.
int
remoteHashCode()
Returns a hashcode for this reference.
String
remoteToString()
Provides a string representation of this reference.
Marshaller
request()
Obtains a marshaller for marshalling invocation data.
void
setIdentifiers(Identifier[] ids)
Sets the identifiers contained in this reference to the given identifiers.
String
toString()
void
writeExternal(ObjectOutput stream)
Writes an external representation of this reference to an underlying object output stream.

Field Details

ep

protected SessionIdentifier ep
The session identifier associated with this reference.


ids

protected Identifier[] ids
The set of identifiers held by this reference.


mfactory

protected MarshallerFactory mfactory
The marshaller factory associated with this reference.


session

protected Session_High session
The protocol session high object associated with this reference.

Constructor Details

RefImpl

public RefImpl()


RefImpl

protected RefImpl(Identifier[] ids,
                  MarshallerFactory mfactory)
Creates a Jeremie reference containing the given object identifiers and marshaller factory.

Parameters:
ids - a set of object identifiers;
mfactory - a marshaller factory.


RefImpl

protected RefImpl(SessionIdentifier ep,
                  Identifier[] ids,
                  MarshallerFactory mfactory)
Creates a Jeremie reference containing the given session identifier, object identifiers and marshaller factory.

Parameters:
ep - a session identifier;
ids - a set of object identifiers;
mfactory - a marshaller factory.

Method Details

done

public void done(RemoteCall call)

Deprecated.

Parameters:
call -


finalize

protected void finalize()


getIdentifiers

public Identifier[] getIdentifiers()
Returns the identifiers contained in this reference.

Returns:
a set of identifiers.


getRefClass

public String getRefClass(ObjectOutput out)
Not used; left for compatibility with java.rmi.server.RemoteRef


invoke

public void invoke(Marshaller marshaller)
            throws MarshalException
Sends the marshaller with the invocation data down the protocol stack.
Specified by:
invoke in interface JRMIOptRef

Parameters:
marshaller - a marshaller with the invocation data;


invoke

public Object invoke(Remote obj,
                     Method method,
                     Object[] params,
                     long opnum)
            throws Exception
Carries out a remote method invocation and either returns the result of the invocation is successful, otherwise an exception.

Parameters:
obj - ignored; left for compatibility with java.rmi.server.RemoteRef;
method - the remote method to be invoked;
params - arguments to the invocation of the remote method;
opnum - ignored; left for compatibility with java.rmi.server.RemoteRef.

Returns:
the result of the remote method invocation, if successful.


invoke

public void invoke(RemoteCall call)

Deprecated.

Parameters:
call -


newCall

public RemoteCall newCall(RemoteObject obj,
                          Operation[] op,
                          int opnum,
                          long hash)

Deprecated.

Parameters:
obj -
op -
opnum -
hash -

Returns:
a remote call


prepareInvocation

public ReplyInterface prepareInvocation(Marshaller marshaller)
            throws MarshalException
Prepares the marshaller prior to marshalling invocation data. This preparation is protocol-specific and typically consists of adding headers to the marshaller. In line with Java method invocation semantics, a reply is expected after the remote invocation is executed; a reply interface is thus returned in order to listen for the reply.
Specified by:
prepareInvocation in interface JRMIOptRef

Parameters:
marshaller - a marshaller to be used for the invocation data;

Returns:
a reply interface for listening for the reply;


readExternal

public void readExternal(ObjectInput stream)
            throws ClassNotFoundException,
                   IOException
Reads an external representation of this reference from an underlying object input stream.

Parameters:
stream - the underlying object input stream.


remoteEquals

public boolean remoteEquals(RemoteRef obj)
Tests for object equality (==) of this reference with the given reference.

Parameters:
obj - the remote reference to be compared with.

Returns:
the result of the object equality (==) test.


remoteHashCode

public int remoteHashCode()
Returns a hashcode for this reference.

Returns:
a hashcode.


remoteToString

public String remoteToString()
Provides a string representation of this reference.

Returns:
a string representation of this reference.


request

public Marshaller request()
            throws MarshalException
Obtains a marshaller for marshalling invocation data.
Specified by:
request in interface JRMIOptRef

Returns:
a marshaller for marshalling invocation data;


setIdentifiers

public void setIdentifiers(Identifier[] ids)
Sets the identifiers contained in this reference to the given identifiers.

Parameters:
ids - a set of identifiers.


toString

public String toString()


writeExternal

public void writeExternal(ObjectOutput stream)
            throws IOException
Writes an external representation of this reference to an underlying object output stream.

Parameters:
stream - the underlying object output stream.