org.objectweb.jeremie.stub_factories.std
Class RefImpl

java.lang.Object
  extended by org.objectweb.jeremie.stub_factories.std.RefImpl
All Implemented Interfaces:
Externalizable, Serializable, RemoteRef, JRMIOptRef, JRMIRef, org.objectweb.jonathan.binding.api.Reference

public class RefImpl
extends Object
implements JRMIOptRef

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

A Jeremie reference contains:

See Also:
Serialized Form

Field Summary
protected  org.objectweb.jonathan.protocols.api.SessionIdentifier ep
          The session identifier associated with this reference.
protected  org.objectweb.jonathan.binding.api.Identifier[] ids
          The set of identifiers held by this reference.
protected  org.objectweb.jonathan.presentation.api.MarshallerFactory mfactory
          The marshaller factory associated with this reference.
protected  org.objectweb.jonathan.protocols.api.Session_High session
          The protocol session high object associated with this reference.
 
Fields inherited from interface java.rmi.server.RemoteRef
packagePrefix, serialVersionUID
 
Constructor Summary
  RefImpl()
           
protected RefImpl(org.objectweb.jonathan.binding.api.Identifier[] ids, org.objectweb.jonathan.presentation.api.MarshallerFactory mfactory)
          Creates a Jeremie reference containing the given object identifiers and marshaller factory.
protected RefImpl(org.objectweb.jonathan.protocols.api.SessionIdentifier ep, org.objectweb.jonathan.binding.api.Identifier[] ids, org.objectweb.jonathan.presentation.api.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()
           
 org.objectweb.jonathan.binding.api.Identifier[] getIdentifiers()
          Returns the identifiers contained in this reference.
 String getRefClass(ObjectOutput out)
          Not used; left for compatibility with RemoteRef
 void invoke(org.objectweb.jonathan.presentation.api.Marshaller marshaller)
          Sends the marshaller with the invocation data down the protocol stack.
 void invoke(RemoteCall call)
          Deprecated.  
 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.
 RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash)
          Deprecated.  
 org.objectweb.jonathan.protocols.api.ReplyInterface prepareInvocation(org.objectweb.jonathan.presentation.api.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.
 org.objectweb.jonathan.presentation.api.Marshaller request()
          Obtains a marshaller for marshalling invocation data.
 void setIdentifiers(org.objectweb.jonathan.binding.api.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.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ids

protected transient org.objectweb.jonathan.binding.api.Identifier[] ids
The set of identifiers held by this reference.


mfactory

protected transient org.objectweb.jonathan.presentation.api.MarshallerFactory mfactory
The marshaller factory associated with this reference.


ep

protected transient org.objectweb.jonathan.protocols.api.SessionIdentifier ep
The session identifier associated with this reference.


session

protected transient org.objectweb.jonathan.protocols.api.Session_High session
The protocol session high object associated with this reference.

Constructor Detail

RefImpl

public RefImpl()

RefImpl

protected RefImpl(org.objectweb.jonathan.binding.api.Identifier[] ids,
                  org.objectweb.jonathan.presentation.api.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(org.objectweb.jonathan.protocols.api.SessionIdentifier ep,
                  org.objectweb.jonathan.binding.api.Identifier[] ids,
                  org.objectweb.jonathan.presentation.api.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 Detail

setIdentifiers

public void setIdentifiers(org.objectweb.jonathan.binding.api.Identifier[] ids)
Sets the identifiers contained in this reference to the given identifiers.

Specified by:
setIdentifiers in interface org.objectweb.jonathan.binding.api.Reference
Parameters:
ids - a set of identifiers.

getIdentifiers

public org.objectweb.jonathan.binding.api.Identifier[] getIdentifiers()
Returns the identifiers contained in this reference.

Specified by:
getIdentifiers in interface org.objectweb.jonathan.binding.api.Reference
Returns:
a set of identifiers.

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.

Specified by:
invoke in interface RemoteRef
Parameters:
obj - ignored; left for compatibility with RemoteRef;
method - the remote method to be invoked;
params - arguments to the invocation of the remote method;
opnum - ignored; left for compatibility with RemoteRef.
Returns:
the result of the remote method invocation, if successful.
Throws:
Exception - any exception thrown either by the remote method invocation, or if something goes wrong (network error, etc.).

getRefClass

public String getRefClass(ObjectOutput out)
Not used; left for compatibility with RemoteRef

Specified by:
getRefClass in interface RemoteRef

remoteHashCode

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

Specified by:
remoteHashCode in interface RemoteRef
Returns:
a hashcode.

remoteEquals

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

Specified by:
remoteEquals in interface RemoteRef
Parameters:
obj - the remote reference to be compared with.
Returns:
the result of the object equality (==) test.

remoteToString

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

Specified by:
remoteToString in interface RemoteRef
Returns:
a string representation of this reference.

request

public org.objectweb.jonathan.presentation.api.Marshaller request()
                                                           throws MarshalException
Obtains a marshaller for marshalling invocation data.

Specified by:
request in interface JRMIOptRef
Returns:
a marshaller for marshalling invocation data;
Throws:
MarshalException - if something goes wrong.

prepareInvocation

public org.objectweb.jonathan.protocols.api.ReplyInterface prepareInvocation(org.objectweb.jonathan.presentation.api.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;
Throws:
MarshalException - if something goes wrong.

invoke

public void invoke(org.objectweb.jonathan.presentation.api.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;
Throws:
MarshalException - if something goes wrong.

writeExternal

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

Specified by:
writeExternal in interface Externalizable
Parameters:
stream - the underlying object output stream.
Throws:
java.io.Exception - if something goes wrong.
IOException

readExternal

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

Specified by:
readExternal in interface Externalizable
Parameters:
stream - the underlying object input stream.
Throws:
ClassNotFoundException - if an object in the stream can not be read because its class can not be found;
java.io.Exception - if something else goes wrong.
IOException

newCall

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

Specified by:
newCall in interface RemoteRef
Parameters:
obj -
op -
opnum -
hash -
Returns:
a remote call

invoke

public void invoke(RemoteCall call)
Deprecated. 

Specified by:
invoke in interface RemoteRef
Parameters:
call -

done

public void done(RemoteCall call)
Deprecated. 

Specified by:
done in interface RemoteRef
Parameters:
call -

finalize

protected void finalize()
Overrides:
finalize in class Object

toString

public String toString()
Overrides:
toString in class Object