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

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended byorg.objectweb.proactive.core.body.jini.JiniBodyImpl
All Implemented Interfaces:
JiniBody, java.rmi.Remote, java.io.Serializable, java.rmi.server.Unreferenced

public class JiniBodyImpl
extends java.rmi.server.UnicastRemoteObject
implements JiniBody, java.rmi.server.Unreferenced

An adapter for a LocalBody to be able to receive jini 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 anothe jini objects library.

See Also:
Serialized Form

Field Summary
protected  UniversalBody body
          The encapsulated local body transient to deal with custom serialization of requests.
protected static RandomPortSocketFactory factory
          A custom socket Factory
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
JiniBodyImpl()
           
JiniBodyImpl(UniversalBody body)
           
 
Method Summary
 void changeProxiedBody(Body newBody)
          Change the body referenced by this adapter
 void disableAC()
          Disables automatic continuation mechanism for this body
 void enableAC()
          Enables automatic continuation mechanism for this body
 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 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()
           
 java.lang.String getVNName()
           
 void initiateSession(int type, UniversalBody body)
           
 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 fte)
          For sending an event to the FTManager linked to this object
 int receiveReply(Reply r)
          Receives a reply in response to a former request.
 int receiveRequest(Request r)
          Receives a request for later processing.
 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 terminate()
          Terminate the body.
 void terminateSession(long sessionID)
           
 void unreferenced()
           
 void updateLocation(UniqueID id, UniversalBody jiniBody)
          Signals to this body that the body identified by id is now to a new jini location.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

protected static RandomPortSocketFactory factory
A custom socket Factory


body

protected transient UniversalBody body
The encapsulated local body transient to deal with custom serialization of requests.

Constructor Detail

JiniBodyImpl

public JiniBodyImpl()
             throws java.rmi.RemoteException

JiniBodyImpl

public JiniBodyImpl(UniversalBody body)
             throws java.rmi.RemoteException
Method Detail

getJobID

public java.lang.String getJobID()
Specified by:
getJobID in interface JiniBody

receiveRequest

public int receiveRequest(Request r)
                   throws java.io.IOException,
                          RenegotiateSessionException
Description copied from interface: JiniBody
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 JiniBody
Parameters:
r - the request to process
Throws:
java.io.IOException - if the request cannot be accepted
RenegotiateSessionException

terminate

public void terminate()
               throws java.io.IOException
Description copied from interface: JiniBody
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 JiniBody
Throws:
java.io.IOException
See Also:
JiniBody.terminate()

receiveReply

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

Specified by:
receiveReply in interface JiniBody
Parameters:
r - the reply received
Throws:
java.io.IOException - if the reply cannot be accepted

getNodeURL

public java.lang.String getNodeURL()
Description copied from interface: JiniBody
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 JiniBody
Returns:
the url of the node this body is associated to

getID

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

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

updateLocation

public void updateLocation(UniqueID id,
                           UniversalBody jiniBody)
                    throws java.io.IOException
Description copied from interface: JiniBody
Signals to this body that the body identified by id is now to a new jini 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 JiniBody
Parameters:
id - the id of the body
jiniBody - the stub to the new location
Throws:
java.io.IOException - if an exception occured during the jini communication

enableAC

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

Specified by:
enableAC in interface JiniBody
Throws:
java.io.IOException

disableAC

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

Specified by:
disableAC in interface JiniBody
Throws:
java.io.IOException

setImmediateService

public void setImmediateService(java.lang.String methodName)
                         throws java.io.IOException
Description copied from interface: JiniBody
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 JiniBody
Throws:
java.io.IOException

unreferenced

public void unreferenced()
Specified by:
unreferenced in interface java.rmi.server.Unreferenced

initiateSession

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

terminateSession

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

getCertificate

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

getProActiveSecurityManager

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

getPolicyFrom

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

startNewSession

public long startNewSession(Communication policy)
                     throws SecurityNotAvailableException,
                            java.io.IOException,
                            RenegotiateSessionException
Specified by:
startNewSession in interface JiniBody
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 JiniBody
Throws:
SecurityNotAvailableException
KeyExchangeException
java.io.IOException

getPublicKey

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

randomValue

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

publicKeyExchange

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

secretKeyExchange

public byte[][] secretKeyExchange(long sessionID,
                                  byte[] tmp,
                                  byte[] tmp1,
                                  byte[] tmp2,
                                  byte[] tmp3,
                                  byte[] tmp4)
                           throws java.lang.Exception
Specified by:
secretKeyExchange in interface JiniBody
Throws:
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 JiniBody
Throws:
SecurityNotAvailableException
java.io.IOException

getVNName

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

getCertificateEncoded

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

getPolicy

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

getEntities

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

changeProxiedBody

public void changeProxiedBody(Body newBody)
Description copied from interface: JiniBody
Change the body referenced by this adapter

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

receiveFTMessage

public int receiveFTMessage(FTMessage fte)
                     throws java.io.IOException
Description copied from interface: JiniBody
For sending an event to the FTManager linked to this object

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


Copyright ? April 2005 INRIA All Rights Reserved.