org.objectweb.proactive.core.body
Class BodyImpl

java.lang.Object
  extended byorg.objectweb.proactive.core.body.AbstractUniversalBody
      extended byorg.objectweb.proactive.core.body.AbstractBody
          extended byorg.objectweb.proactive.core.body.BodyImpl
All Implemented Interfaces:
Body, Job, LocalBodyStrategy, MessageEventProducer, NFEProducer, SecurityEntity, java.io.Serializable, UniversalBody
Direct Known Subclasses:
MigratableBody

public abstract class BodyImpl
extends AbstractBody
implements java.io.Serializable

**For internal use only**

This class gives a common implementation of the Body interface. It provides all the non specific behavior allowing sub-class to write the detail implementation.

Each body is identify by an unique identifier.

All active bodies that get created in one JVM register themselves into a table that allows to tack them done. The registering and deregistering is done by the AbstractBody and the table is managed here as well using some static methods.

In order to let somebody customize the body of an active object without subclassing it, AbstractBody delegates lot of tasks to satellite objects that implements a given interface. Abstract protected methods instantiate those objects allowing subclasses to create them as they want (using customizable factories or instance).

Since:
ProActive 0.9
Version:
1.0, 2001/10/23
Author:
ProActive Team
See Also:
Body, UniqueID, Serialized Form

Field Summary
protected  MessageEventProducerImpl messageEventProducer
           
protected  ReplyReceiver replyReceiver
          The component in charge of receiving reply
protected  RequestReceiver requestReceiver
          The component in charge of receiving request
 
Fields inherited from class org.objectweb.proactive.core.body.AbstractBody
ftmanager, internalBodySecurity, isInterfaceSecureImplemented, isSecurityOn, localBodyStrategy, openedSessions, psm, spmdManager, threadStore
 
Fields inherited from class org.objectweb.proactive.core.body.AbstractUniversalBody
bodyID, jobID, location, nodeURL, remoteBody, remoteBodyFactory, shortcuts
 
Fields inherited from interface org.objectweb.proactive.core.body.UniversalBody
bodyLogger
 
Constructor Summary
BodyImpl()
          Creates a new AbstractBody.
BodyImpl(java.lang.Object reifiedObject, java.lang.String nodeURL, MetaObjectFactory factory, java.lang.String jobId)
          Creates a new AbstractBody for an active object attached to a given node.
 
Method Summary
protected  void activityStopped()
          Signals that the activity of this body, managed by the active thread has just stopped.
 void addMessageEventListener(MessageEventListener listener)
          Adds a listener of MessageEvent to this body.
protected  int internalReceiveReply(Reply reply)
          Receives a reply in response to a former request.
protected  int internalReceiveRequest(Request request)
          Receives a request for later processing.
 void removeImmediateService(java.lang.String methodName, java.lang.Class[] parametersTypes)
          Removes an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.
 void removeMessageEventListener(MessageEventListener listener)
          Removes the MessageEventListener from this body.
 void setImmediateService(java.lang.String methodName)
          For setting an immediate service for this body.
 void setImmediateService(java.lang.String methodName, java.lang.Class[] parametersTypes)
          Adds an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.
 void updateNodeURL(java.lang.String newNodeURL)
          Set the nodeURL of this body
 
Methods inherited from class org.objectweb.proactive.core.body.AbstractBody
acceptCommunication, activityStarted, blockCommunication, checkNewLocation, disableAC, enableAC, enterInThreadStore, exitFromThreadStore, getCertificate, getCertificateEncoded, getEntities, getFTManager, getFuturePool, getName, getPolicy, getProActiveSecurityManager, getProActiveSPMDGroupManager, getPublicKey, getReifiedObject, getRequestQueue, getShortcutTargetBody, getSPMDGroup, getSPMDGroupSize, isActive, isAlive, publicKeyExchange, randomValue, receiveFTMessage, receiveReply, receiveRequest, registerIncomingFutures, renegociateSessionIfNeeded, secretKeyExchange, sendRequest, serve, setFTManager, setLocalBodyImpl, setPolicyServer, setSPMDGroup, startDefaultProActiveSecurityManager, startNewSession, terminate, terminateSession, toString
 
Methods inherited from class org.objectweb.proactive.core.body.AbstractUniversalBody
addNFEListener, createShortcut, fireNFE, getID, getJobID, getNodeURL, getRemoteAdapter, removeNFEListener, updateLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.objectweb.proactive.core.body.UniversalBody
createShortcut, getID, getNodeURL, getRemoteAdapter, updateLocation
 
Methods inherited from interface org.objectweb.proactive.core.exceptions.manager.NFEProducer
addNFEListener, fireNFE, removeNFEListener
 
Methods inherited from interface org.objectweb.proactive.Job
getJobID
 

Field Detail

replyReceiver

protected ReplyReceiver replyReceiver
The component in charge of receiving reply


requestReceiver

protected RequestReceiver requestReceiver
The component in charge of receiving request


messageEventProducer

protected MessageEventProducerImpl messageEventProducer
Constructor Detail

BodyImpl

public BodyImpl()
Creates a new AbstractBody. Used for serialization.


BodyImpl

public BodyImpl(java.lang.Object reifiedObject,
                java.lang.String nodeURL,
                MetaObjectFactory factory,
                java.lang.String jobId)
Creates a new AbstractBody for an active object attached to a given node.

Parameters:
reifiedObject - the active object that body is for
nodeURL - the URL of the node that body is attached to
factory - the factory able to construct new factories for each type of meta objects needed by this body
Method Detail

addMessageEventListener

public void addMessageEventListener(MessageEventListener listener)
Description copied from interface: MessageEventProducer
Adds a listener of MessageEvent to this body. The listener will receive event for all messages sent or received

Specified by:
addMessageEventListener in interface MessageEventProducer
Parameters:
listener - the listener to add

removeMessageEventListener

public void removeMessageEventListener(MessageEventListener listener)
Description copied from interface: MessageEventProducer
Removes the MessageEventListener from this body.

Specified by:
removeMessageEventListener in interface MessageEventProducer
Parameters:
listener - the listener to remove

internalReceiveRequest

protected int internalReceiveRequest(Request request)
                              throws java.io.IOException,
                                     RenegotiateSessionException
Receives a request for later processing. The call to this method is non blocking unless the body cannot temporary receive the request.

Specified by:
internalReceiveRequest in class AbstractBody
Parameters:
request - the request to process
Throws:
java.io.IOException - if the request cannot be accepted
RenegotiateSessionException

internalReceiveReply

protected int internalReceiveReply(Reply reply)
                            throws java.io.IOException
Receives a reply in response to a former request.

Specified by:
internalReceiveReply in class AbstractBody
Parameters:
reply - the reply received
Throws:
java.io.IOException - if the reply cannot be accepted

activityStopped

protected void activityStopped()
Signals that the activity of this body, managed by the active thread has just stopped.

Overrides:
activityStopped in class AbstractBody

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 - if a pb occurs during this method call

setImmediateService

public void setImmediateService(java.lang.String methodName,
                                java.lang.Class[] parametersTypes)
                         throws java.io.IOException
Description copied from interface: UniversalBody
Adds 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
Parameters:
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException - if a pb occurs during this method call

removeImmediateService

public void removeImmediateService(java.lang.String methodName,
                                   java.lang.Class[] parametersTypes)
                            throws java.io.IOException
Description copied from interface: UniversalBody
Removes an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.

Specified by:
removeImmediateService in interface UniversalBody
Parameters:
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException - if a pb occurs during this method call

updateNodeURL

public void updateNodeURL(java.lang.String newNodeURL)
Description copied from interface: Body
Set the nodeURL of this body

Specified by:
updateNodeURL in interface Body
Parameters:
newNodeURL - the new URL of the node


Copyright 2001-2005 INRIA All Rights Reserved.