org.objectweb.proactive.core.body.http
Class RemoteBodyAdapter

java.lang.Object
  extended byorg.objectweb.proactive.core.body.http.RemoteBodyAdapter
All Implemented Interfaces:
BodyAdapter, Handlerizable, Job, java.io.Serializable, UniversalBody

public class RemoteBodyAdapter
extends java.lang.Object
implements BodyAdapter, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  UniqueID bodyID
          The unique ID of the body
protected  java.lang.String jobID
          Cache the jobID locally for speed
protected  int port
          The port of the Runntime where the body is located
protected  java.lang.String url
          The url of the Runtime where the body is located
protected static java.util.Hashtable urnBodys
          an Hashtable containing all the http adapters registered.
 
Constructor Summary
RemoteBodyAdapter()
           
RemoteBodyAdapter(UniversalBody body)
           
 
Method Summary
 void changeProxiedBody(Body newBody)
          This method must be called only locally.
 void clearHandlersLevel()
          Clear the local map of handlers
 void disableAC()
          Disables automatic continuation mechanism for this body
 void enableAC()
          Enables automatic continuation mechanism for this body
 boolean equals(java.lang.Object o)
           
static UniversalBody getBodyFromUrn(java.lang.String urn)
           
 UniqueID getBodyID()
           
 java.security.cert.X509Certificate getCertificate()
           
 byte[] getCertificateEncoded()
           
 java.util.ArrayList getEntities()
           
 java.lang.String getHandlerizableInfo()
          Get information about the handlerizable object
 java.util.HashMap getHandlersLevel()
          Give a reference to a local map of handlers
 UniqueID getID()
          Returns the UniqueID of this body This identifier is unique accross all JVMs
 java.lang.String getJobID()
           
 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 getURL()
           
 java.lang.String getVNName()
           
 int hashCode()
           
 void initiateSession(int type, UniversalBody body)
           
static UniversalBody lookup(java.lang.String urn)
          Looks-up an active object previously registered in the bodys table .
 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)
           
 int receiveFTMessage(FTMessage ev)
          For sending a non fonctional message to the FTManager linked to this object.
 int receiveReply(Reply reply)
          Receives a reply in response to a former request.
 int receiveRequest(Request request)
          Receives a request for later processing.
static void register(RemoteBodyAdapter paBody, java.lang.String urn)
          Registers an active object into the table of body.
 byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1, byte[] tmp2, byte[] tmp3, byte[] tmp4)
           
 void setExceptionHandler(Handler handler, java.lang.Class exception)
          Set a new handler within the table of the Handlerizable Object
 void setImmediateService(java.lang.String methodName)
          For setting an immediate service for this body.
 long startNewSession(Communication policy)
           
 void terminate()
          Terminate the body.
 void terminateSession(long sessionID)
           
static void unregister(java.lang.String urn)
          Unregisters an active object previously registered into the bodys table
 Handler unsetExceptionHandler(java.lang.Class exception)
          Remove a handler from the table of the Handlerizable Object
 void updateLocation(UniqueID id, UniversalBody body)
          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

urnBodys

protected static transient java.util.Hashtable urnBodys
an Hashtable containing all the http adapters registered. They can be retrieved thanks to the ProActive.lookupActive method


jobID

protected java.lang.String jobID
Cache the jobID locally for speed


bodyID

protected UniqueID bodyID
The unique ID of the body


url

protected java.lang.String url
The url of the Runtime where the body is located


port

protected int port
The port of the Runntime where the body is located

Constructor Detail

RemoteBodyAdapter

public RemoteBodyAdapter()

RemoteBodyAdapter

public RemoteBodyAdapter(UniversalBody body)
                  throws ProActiveException
Method Detail

register

public static void register(RemoteBodyAdapter paBody,
                            java.lang.String urn)
                     throws java.io.IOException
Registers an active object into the table of body.

Parameters:
paBody - the body of the active object to register.
urn - The urn of the body (in fact his url + his name)
Throws:
java.io.IOException - if the remote body cannot be registered

unregister

public static void unregister(java.lang.String urn)
                       throws java.io.IOException
Unregisters an active object previously registered into the bodys table

Parameters:
urn - the urn under which the active object has been registered
Throws:
java.io.IOException

lookup

public static UniversalBody lookup(java.lang.String urn)
                            throws java.io.IOException
Looks-up an active object previously registered in the bodys table .

Parameters:
urn - the urn (in fact its url + name) the remote Body is registered to
Returns:
a UniversalBody
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object o)

receiveRequest

public int receiveRequest(Request request)
                   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:
request - the request to process
Returns:
value for fault-tolerance protocol
Throws:
java.io.IOException - if the request cannot be accepted
RenegotiateSessionException

receiveReply

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

Specified by:
receiveReply in interface UniversalBody
Parameters:
reply - the reply received
Returns:
value for fault-tolerance procotol
Throws:
java.io.IOException - if the reply cannot be accepted

terminate

public void terminate()
               throws java.io.IOException
Description copied from interface: UniversalBody
Terminate the body. After this call the body is no more alive and no more active although the active thread is not interrupted. The body is unuseable after this call.

Specified by:
terminate in interface UniversalBody
Throws:
java.io.IOException
See Also:
UniversalBody.terminate()

getURL

public java.lang.String getURL()

getBodyFromUrn

public static UniversalBody getBodyFromUrn(java.lang.String urn)

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 body)
                    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
body - the stub to the new location
Throws:
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
Throws:
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
Throws:
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
Throws:
java.io.IOException

initiateSession

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

terminateSession

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

getCertificate

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

getPolicyFrom

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

startNewSession

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

negociateKeyReceiverSide

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

getPublicKey

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

randomValue

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

publicKeyExchange

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

secretKeyExchange

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

getPolicyTo

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

getPolicy

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

getVNName

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

getCertificateEncoded

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

getEntities

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

getProActiveSecurityManager

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

getHandlersLevel

public java.util.HashMap getHandlersLevel()
                                   throws java.io.IOException
Description copied from interface: Handlerizable
Give a reference to a local map of handlers

Specified by:
getHandlersLevel in interface Handlerizable
Returns:
A reference to a map of handlers
Throws:
java.io.IOException

unsetExceptionHandler

public Handler unsetExceptionHandler(java.lang.Class exception)
                              throws java.io.IOException
Description copied from interface: Handlerizable
Remove a handler from the table of the Handlerizable Object

Specified by:
unsetExceptionHandler in interface Handlerizable
Parameters:
exception - A class of non functional exception. It is a subclass of NonFunctionalException.
Returns:
The removed handler or null
Throws:
java.io.IOException

setExceptionHandler

public void setExceptionHandler(Handler handler,
                                java.lang.Class exception)
                         throws java.io.IOException
Description copied from interface: Handlerizable
Set a new handler within the table of the Handlerizable Object

Specified by:
setExceptionHandler in interface Handlerizable
Parameters:
handler - A handler associated with a class of non functional exception.
exception - A class of non functional exception. It is a subclass of NonFunctionalException.
Throws:
java.io.IOException

getJobID

public java.lang.String getJobID()
Specified by:
getJobID in interface Job
Returns:
the jobID associated with this object

clearHandlersLevel

public void clearHandlersLevel()
                        throws java.io.IOException
Clear the local map of handlers

Specified by:
clearHandlersLevel in interface Handlerizable
Throws:
java.io.IOException

getHandlerizableInfo

public java.lang.String getHandlerizableInfo()
                                      throws java.io.IOException
Get information about the handlerizable object

Specified by:
getHandlerizableInfo in interface Handlerizable
Throws:
java.io.IOException

getBodyID

public UniqueID getBodyID()

hashCode

public int hashCode()

receiveFTMessage

public int receiveFTMessage(FTMessage ev)
                     throws java.io.IOException
Description copied from interface: UniversalBody
For sending a non fonctional message to the FTManager linked to this object.

Specified by:
receiveFTMessage in interface UniversalBody
Parameters:
ev - the message to send
Returns:
still not used
Throws:
java.io.IOException
See Also:
UniversalBody.receiveFTMessage(org.objectweb.proactive.core.body.ft.internalmsg.FTMessage)

changeProxiedBody

public void changeProxiedBody(Body newBody)
This method must be called only locally.

Specified by:
changeProxiedBody in interface BodyAdapter
Parameters:
newBody - the body referenced after the call


Copyright ? April 2005 INRIA All Rights Reserved.