org.objectweb.proactive.core.body.jini
Class JiniBodyAdapter

java.lang.Object
  |
  +--org.objectweb.proactive.core.body.jini.JiniBodyAdapter
All Implemented Interfaces:
java.io.Serializable, UniversalBody

public class JiniBodyAdapter
extends java.lang.Object
implements UniversalBody, java.io.Serializable

An adapter for a JiniBody to be able to receive remote calls. This helps isolate JINI-specific code into a small set of specific classes, thus enabling reuse if we one day decide to switch to another jini objects library.

See Also:
Serialized Form

Field Summary
protected  UniqueID bodyID
          Cache the ID of the Body locally for speed
protected  JiniBody proxiedJiniBody
          The encapsulated JiniBody
 
Constructor Summary
JiniBodyAdapter()
           
JiniBodyAdapter(JiniBody jiniBody)
           
JiniBodyAdapter(UniversalBody body)
           
 
Method Summary
 void disableAC()
          Disables automatic continuation mechanism for this body
 void enableAC()
          Enables automatic continuation mechanism for this body
 boolean equals(java.lang.Object o)
           
 java.security.cert.X509Certificate getCertificate()
           
 byte[] getCertificateEncoded()
           
 java.util.ArrayList getEntities()
           
 UniqueID getID()
          Returns the UniqueID of this body This identifier is unique accross all JVMs
 java.lang.String getNodeURL()
          Returns the url of the node this body is associated to The url of the node can change if the active object migrates
 SecurityContext getPolicy(SecurityContext securityContext)
           
 Policy getPolicyFrom(java.security.cert.X509Certificate certificate)
           
 Communication getPolicyTo(java.lang.String type, java.lang.String from, java.lang.String to)
           
 ProActiveSecurityManager getProActiveSecurityManager()
           
 java.security.PublicKey getPublicKey()
           
 UniversalBody getRemoteAdapter()
          Returns the remote friendly version of this body
 java.lang.String getVNName()
           
 int hashCode()
           
 void initiateSession(int type, UniversalBody body)
           
static UniversalBody lookup(java.lang.String url)
          Looks-up an active object previously registered in a RMI registry.
 ConfidentialityTicket negociateKeyReceiverSide(ConfidentialityTicket confidentialityTicket, long sessionID)
           
 byte[][] publicKeyExchange(long sessionID, UniversalBody distantBody, byte[] my_pub, byte[] my_cert, byte[] sig_code)
           
 byte[] randomValue(long sessionID, byte[] cl_rand)
           
 void receiveReply(Reply r)
          Receives a reply in response to a former request.
 void receiveRequest(Request r)
          Receives a request for later processing.
static void register(JiniBodyAdapter bodyAdapter, java.lang.String url)
          Registers an active object into a RMI registry.
 byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1, byte[] tmp2, byte[] tmp3, byte[] tmp4)
           
 void setImmediateService(java.lang.String methodName)
          For setting an immediate service for this body.
 long startNewSession(Communication policy)
           
 void terminateSession(long sessionID)
           
static void unregister(java.lang.String url)
          Unregisters an active object previously registered into a RMI registry.
 void updateLocation(UniqueID id, UniversalBody jiniBody)
          Signals to this body that the body identified by id is now to a new remote location.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxiedJiniBody

protected JiniBody proxiedJiniBody
The encapsulated JiniBody


bodyID

protected UniqueID bodyID
Cache the ID of the Body locally for speed

Constructor Detail

JiniBodyAdapter

public JiniBodyAdapter()

JiniBodyAdapter

public JiniBodyAdapter(JiniBody jiniBody)
                throws ProActiveException

JiniBodyAdapter

public JiniBodyAdapter(UniversalBody body)
                throws ProActiveException
Method Detail

register

public static void register(JiniBodyAdapter bodyAdapter,
                            java.lang.String url)
                     throws java.io.IOException
Registers an active object into a RMI registry. In fact it is the jini version of the body of the active object that is registered into the RMI Registry under the given URL.

Parameters:
url - the url under which the jini body is registered.
Throws:
java.io.IOException - if the jini body cannot be registered

unregister

public static void unregister(java.lang.String url)
                       throws java.io.IOException
Unregisters an active object previously registered into a RMI registry.

Parameters:
url - the url under which the active object is registered.
Throws:
java.io.IOException - if the jini object cannot be removed from the registry

lookup

public static UniversalBody lookup(java.lang.String url)
                            throws java.io.IOException
Looks-up an active object previously registered in a RMI registry. In fact it is the jini version of the body of an active object that can be registered into the RMI Registry under a given URL.

Parameters:
url - the url the jini Body is registered to
Returns:
a UniversalBody
Throws:
java.io.IOException - if the jini body cannot be found under the given url or if the object found is not of type JiniBody

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

receiveRequest

public void receiveRequest(Request r)
                    throws java.io.IOException,
                           RenegotiateSessionException
Description copied from interface: UniversalBody
Receives a request for later processing. The call to this method is non blocking unless the body cannot temporary receive the request.

Specified by:
receiveRequest in interface UniversalBody
Parameters:
r - the request to process
Throws:
java.io.IOException - if the request cannot be accepted
RenegotiateSessionException

receiveReply

public void receiveReply(Reply r)
                  throws java.io.IOException
Description copied from interface: UniversalBody
Receives a reply in response to a former request.

Specified by:
receiveReply in interface UniversalBody
Throws:
java.io.IOException - if the reply cannot be accepted

getNodeURL

public java.lang.String getNodeURL()
Description copied from interface: UniversalBody
Returns the url of the node this body is associated to The url of the node can change if the active object migrates

Specified by:
getNodeURL in interface UniversalBody
Returns:
the url of the node this body is associated to

getID

public UniqueID getID()
Description copied from interface: UniversalBody
Returns the UniqueID of this body This identifier is unique accross all JVMs

Specified by:
getID in interface UniversalBody
Returns:
the UniqueID of this body

updateLocation

public void updateLocation(UniqueID id,
                           UniversalBody jiniBody)
                    throws java.io.IOException
Description copied from interface: UniversalBody
Signals to this body that the body identified by id is now to a new remote location. The body given in parameter is a new stub pointing to this new location. This call is a way for a body to signal to his peer that it has migrated to a new location

Specified by:
updateLocation in interface UniversalBody
Parameters:
id - the id of the body
jiniBody - the stub to the new location
java.io.IOException

getRemoteAdapter

public UniversalBody getRemoteAdapter()
Description copied from interface: UniversalBody
Returns the remote friendly version of this body

Specified by:
getRemoteAdapter in interface UniversalBody
Returns:
the remote friendly version of this body

enableAC

public void enableAC()
              throws java.io.IOException
Description copied from interface: UniversalBody
Enables automatic continuation mechanism for this body

Specified by:
enableAC in interface UniversalBody
java.io.IOException

disableAC

public void disableAC()
               throws java.io.IOException
Description copied from interface: UniversalBody
Disables automatic continuation mechanism for this body

Specified by:
disableAC in interface UniversalBody
java.io.IOException

setImmediateService

public void setImmediateService(java.lang.String methodName)
                         throws java.io.IOException
Description copied from interface: UniversalBody
For setting an immediate service for this body. An immediate service is a method that will bw excecuted by the calling thread.

Specified by:
setImmediateService in interface UniversalBody
java.io.IOException

initiateSession

public void initiateSession(int type,
                            UniversalBody body)
                     throws java.rmi.RemoteException,
                            java.io.IOException,
                            CommunicationForbiddenException,
                            AuthenticationException,
                            RenegotiateSessionException,
                            SecurityNotAvailableException
Specified by:
initiateSession in interface UniversalBody
java.rmi.RemoteException
java.io.IOException
CommunicationForbiddenException
AuthenticationException
RenegotiateSessionException
SecurityNotAvailableException

terminateSession

public void terminateSession(long sessionID)
                      throws java.io.IOException,
                             SecurityNotAvailableException
Specified by:
terminateSession in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

getCertificate

public java.security.cert.X509Certificate getCertificate()
                                                  throws java.io.IOException,
                                                         SecurityNotAvailableException
Specified by:
getCertificate in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

getProActiveSecurityManager

public ProActiveSecurityManager getProActiveSecurityManager()
                                                     throws java.io.IOException,
                                                            SecurityNotAvailableException
Specified by:
getProActiveSecurityManager in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

getPolicyFrom

public Policy getPolicyFrom(java.security.cert.X509Certificate certificate)
                     throws java.io.IOException,
                            SecurityNotAvailableException
Specified by:
getPolicyFrom in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

startNewSession

public long startNewSession(Communication policy)
                     throws java.io.IOException,
                            RenegotiateSessionException,
                            SecurityNotAvailableException
Specified by:
startNewSession in interface UniversalBody
java.io.IOException
RenegotiateSessionException
SecurityNotAvailableException

negociateKeyReceiverSide

public ConfidentialityTicket negociateKeyReceiverSide(ConfidentialityTicket confidentialityTicket,
                                                      long sessionID)
                                               throws java.io.IOException,
                                                      KeyExchangeException,
                                                      SecurityNotAvailableException
Specified by:
negociateKeyReceiverSide in interface UniversalBody
java.io.IOException
KeyExchangeException
SecurityNotAvailableException

getPublicKey

public java.security.PublicKey getPublicKey()
                                     throws java.io.IOException,
                                            SecurityNotAvailableException
Specified by:
getPublicKey in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

randomValue

public byte[] randomValue(long sessionID,
                          byte[] cl_rand)
                   throws java.lang.Exception,
                          SecurityNotAvailableException
Specified by:
randomValue in interface UniversalBody
java.lang.Exception
SecurityNotAvailableException

publicKeyExchange

public byte[][] publicKeyExchange(long sessionID,
                                  UniversalBody distantBody,
                                  byte[] my_pub,
                                  byte[] my_cert,
                                  byte[] sig_code)
                           throws java.lang.Exception,
                                  SecurityNotAvailableException
Specified by:
publicKeyExchange in interface UniversalBody
java.lang.Exception
SecurityNotAvailableException

secretKeyExchange

public byte[][] secretKeyExchange(long sessionID,
                                  byte[] tmp,
                                  byte[] tmp1,
                                  byte[] tmp2,
                                  byte[] tmp3,
                                  byte[] tmp4)
                           throws java.lang.Exception,
                                  SecurityNotAvailableException
Specified by:
secretKeyExchange in interface UniversalBody
java.lang.Exception
SecurityNotAvailableException

getPolicyTo

public Communication getPolicyTo(java.lang.String type,
                                 java.lang.String from,
                                 java.lang.String to)
                          throws java.io.IOException,
                                 SecurityNotAvailableException
Specified by:
getPolicyTo in interface UniversalBody
java.io.IOException
SecurityNotAvailableException

getVNName

public java.lang.String getVNName()
                           throws java.io.IOException,
                                  SecurityNotAvailableException
Specified by:
getVNName in interface UniversalBody
Returns:
name of the virtual node where the object has been created
java.io.IOException
SecurityNotAvailableException

getCertificateEncoded

public byte[] getCertificateEncoded()
                             throws java.io.IOException,
                                    SecurityNotAvailableException
Specified by:
getCertificateEncoded in interface UniversalBody
Returns:
object's X509Certificate as byte array
java.io.IOException
SecurityNotAvailableException

getPolicy

public SecurityContext getPolicy(SecurityContext securityContext)
                          throws SecurityNotAvailableException,
                                 java.io.IOException
Specified by:
getPolicy in interface UniversalBody
SecurityNotAvailableException
java.io.IOException

getEntities

public java.util.ArrayList getEntities()
                                throws SecurityNotAvailableException,
                                       java.io.IOException
Specified by:
getEntities in interface UniversalBody
SecurityNotAvailableException
java.io.IOException


Copyright © April 2004 INRIA All Rights Reserved.