org.objectweb.proactive.core.body
Class BodyImpl

java.lang.Object
  |
  +--org.objectweb.proactive.core.body.AbstractUniversalBody
        |
        +--org.objectweb.proactive.core.body.AbstractBody
              |
              +--org.objectweb.proactive.core.body.BodyImpl
All Implemented Interfaces:
Body, Job, LocalBodyStrategy, MessageEventProducer, java.io.Serializable, UniversalBody
Direct Known Subclasses:
ComponentBodyImpl

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  java.lang.String JobID
           
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
internalBodySecurity, isSecurityOn, localBodyStrategy, logger, openedSessions, pgm, psm, threadStore
 
Fields inherited from class org.objectweb.proactive.core.body.AbstractUniversalBody
bodyID, location, nodeURL, remoteBody, remoteBodyFactory
 
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.
 java.lang.String getJobID()
           
protected  void internalReceiveReply(Reply reply)
          Receives a reply in response to a former request.
protected  void internalReceiveRequest(Request request)
          Receives a request for later processing.
 void removeMessageEventListener(MessageEventListener listener)
          Removes the MessageEventListener from this body.
 void setImmediateService(java.lang.String methodName)
          For setting an immediate service for this body.
 
Methods inherited from class org.objectweb.proactive.core.body.AbstractBody
acceptCommunication, activityStarted, blockCommunication, checkNewLocation, disableAC, enableAC, enterInThreadStore, exitFromThreadStore, getCertificate, getCertificateEncoded, getEntities, getFuturePool, getName, getPolicy, getPolicyFrom, getPolicyTo, getProActiveSecurityManager, getPublicKey, getReifiedObject, getRequestQueue, getSPMDGroup, getVNName, initiateSession, isActive, isAlive, negociateKeyReceiverSide, publicKeyExchange, randomValue, receiveReply, receiveRequest, renegociateSessionIfNeeded, secretKeyExchange, sendRequest, serve, setLocalBodyImpl, setSPMDGroup, startDefaultProActiveSecurityManager, startNewSession, terminate, terminateSession, test, toString
 
Methods inherited from class org.objectweb.proactive.core.body.AbstractUniversalBody
getID, getNodeURL, getRemoteAdapter, 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
getID, getNodeURL, getRemoteAdapter, updateLocation
 

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

JobID

protected java.lang.String JobID
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

getJobID

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

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 void 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 void 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
java.io.IOException


Copyright © April 2004 INRIA All Rights Reserved.