org.objectweb.proactive
Class ProActive

java.lang.Object
  extended by org.objectweb.proactive.ProActive

public class ProActive
extends java.lang.Object

Provides static methods to manipulate or use Active Objects(creation, exception handling, migration,...), futures, deployment descritpors, components, groups. This class is the central point of the library.

Active Object Creation

 newActive(...)
 turnActive(...)
 

Active Object Manipulation

 getBodyOnThis()
 getActiveObjectNodeUrl(Object)
 getStubOnThis()
 migrateTo(...)
 lookupActive(String, String)
 register(Object, String)
 setImmediateService(...)
 

Synchronization, Futures

 isAwaited(Object)
 waitFor(Object)
 waitForAll(Vector)
 waitForAny(Vector)
 waitForPotentialException()
 waitForTheNth(Vector, int)
 Previous methods provide also the ability to pass a timeout value

 allAwaited(Vector)
 getFutureValue(Object)
 isException(Object)
 

Groups Creation

 newActiveAsGroup(...)
 

Components

 newActiveComponent(...)
 

XML Descritpors

 getProactiveDescriptor(String)
 

Non Functionnal Exceptions

 addNFEListenerOnAO(Object, NFEListener)
 addNFEListenerOnJVM(NFEListener)
 addNFEListenerOnProxy(Object, NFEListener)
 removeNFEListenerOnAO(Object, NFEListener)
 removeNFEListenerOnJVM(NFEListener)
 removeNFEListenerOnProxy(Object, NFEListener)
 

Functionnal Exceptions

 tryWithCatch(Class)
 removeTryWithCatch()
 endTryWithCatch()
 throwArrivedException()
 

Automatic Continuations

 enableAC(Object)
 disableAC(Object)
 

Web Services

 exposeAsWebService(Object, String, String, String[])
 exposeComponentAsWebService(Component, String, String)
 

Since:
ProActive 0.7
Author:
ProActive Team
See Also:
ProActiveDescriptor, ProActiveGroup

Field Summary
protected static org.apache.log4j.Logger logger
           
static org.apache.log4j.Logger loggerGroup
           
 
Method Summary
static void addNFEListenerOnAO(java.lang.Object ao, NFEListener listener)
          Add a listener for NFE reaching a given active object
static void addNFEListenerOnGroup(java.lang.Object group, NFEListener listener)
          Add a listener for NFE regarding a group.
static void addNFEListenerOnJVM(NFEListener listener)
          Add a listener for NFE reaching the local JVM
static void addNFEListenerOnProxy(java.lang.Object ao, NFEListener listener)
          Add a listener for NFE reaching the client side of a given active object
static boolean allAwaited(java.util.Vector futures)
          Return false if one object of futures is available.
static java.lang.Object createStubObject(java.lang.String className, UniversalBody body)
           
static void disableAC(java.lang.Object obj)
          Disable the automatic continuation mechanism for this active object.
static void enableAC(java.lang.Object obj)
          Enable the automatic continuation mechanism for this active object.
 void enableExitOnEmpty()
          After this call, when the JVM has no more active objects it will be killed.
static void endTryWithCatch()
          This has to be called at the end of the try block.
static void exitFailure()
          Call this method at the end of the application if it did not complete successfully, for the launcher to be aware of it.
static void exitSuccess()
          Call this method at the end of the application if it completed successfully, for the launcher to be aware of it.
static void exposeAsWebService(java.lang.Object o, java.lang.String url, java.lang.String urn, java.lang.String[] methods)
          Expose an active object as a web service
static void exposeComponentAsWebService(Component component, java.lang.String url, java.lang.String componentName)
          Deploy a component as a webservice.
static java.lang.String getActiveObjectNodeUrl(java.lang.Object activeObject)
          Return the URL of the remote activeObject.
static java.util.Collection getAllExceptions()
          Get the exceptions that have been caught in the current ProActive.tryWithCatch()/ProActive.removeTryWithCatch() block.
static Body getBodyOnThis()
          When an active object is created, it is associated with a Body that takes care of all non fonctionnal properties.
static java.lang.Object getFutureValue(java.lang.Object future)
          Return the object contains by the future (ie its target).
static java.lang.String getJobId()
           
static Node getNode()
           
static ProActiveDescriptor getProactiveDescriptor()
          Returns a ProActiveDescriptor that gives an object representation of the XML document located at the url given by proactive.pad system's property.
static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl)
          Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url.
static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl, VariableContract variableContract)
          Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url, and uses the given Variable Contract.
static java.lang.String getProActiveVersion()
          Returns the number of this version
static StubObject getStubOnThis()
          Returns a Stub-Proxy couple pointing to the local body associated to the active object whose active thread is calling this method.
static boolean isAwaited(java.lang.Object future)
          Return false if the object future is available.
static boolean isException(java.lang.Object future)
          Find out if the object contains an exception that should be thrown
static java.lang.String[] listActive(java.lang.String url)
          Looks-up all Active Objects registered on a host, using a registry(RMI or JINI or HTTP or IBIS) The registry where to look for is fully determined with the protocol included in the url.
static java.lang.Object lookupActive(java.lang.String classname, java.lang.String url)
          Looks-up an active object previously registered in a registry(RMI, IBIS, HTTP).
static VirtualNode lookupVirtualNode(java.lang.String url)
          Looks-up a VirtualNode previously registered in a registry(RMI or JINI or HTTP or IBIS) The registry where to look for is fully determined with the protocol included in the url
static void migrateTo(Body bodyToMigrate, Node node, boolean isNFRequest)
          Migrates the body bodyToMigrate to the given node.
static void migrateTo(Body bodyToMigrate, Node node, boolean isNFRequest, int priority)
          Migrates the body bodyToMigrate to the given node.
static void migrateTo(Body bodyToMigrate, java.lang.Object activeObject, boolean isNFRequest)
          Migrates the given body to the same location as the active object given in parameter.
static void migrateTo(Body bodyToMigrate, java.lang.String nodeURL, boolean isNFRequest)
          Migrates the given body to the node caracterized by the given url.
static void migrateTo(Node node)
          Migrates the active object whose active thread is calling this method to the given node.
static void migrateTo(java.lang.Object activeObject)
          Migrates the active object whose active thread is calling this method to the same location as the active object given in parameter.
static void migrateTo(java.lang.String nodeURL)
          Migrates the active object whose active thread is calling this method to the node caracterized by the given url.
static java.lang.Object newActive(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters)
          Creates a new ActiveObject based on classname attached to a default node in the local JVM.
static java.lang.Object newActive(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, Node node)
          Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.
static java.lang.Object newActive(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, Node node, Active activity, MetaObjectFactory factory)
          Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.
static java.lang.Object newActive(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, java.lang.String nodeURL)
          Creates a new ActiveObject based on classname attached to the node of the given URL.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters)
          Creates a new ActiveObject based on classname attached to a default node in the local JVM.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, Node node)
          Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, java.lang.String nodeURL)
          Creates a new ActiveObject based on classname attached to the node of the given URL.
static java.lang.Object newActiveAsGroup(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, VirtualNode virtualnode)
          Creates a new group of Active Objects.
static java.lang.Object newActiveAsGroup(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, VirtualNode virtualnode, Active activity, MetaObjectFactory factory)
          Creates a new group of Active Objects.
static java.lang.Object newActiveAsGroup(java.lang.String classname, java.lang.Object[] constructorParameters, VirtualNode virtualnode)
          Creates a new group of Active Objects.
static java.lang.Object newActiveAsGroup(java.lang.String className, java.lang.Object[] constructorParameters, VirtualNode virtualNode, Active activity, MetaObjectFactory factory)
          Creates a new group of Active Objects.
static Component newActiveComponent(java.lang.String classname, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, Node node, Active activity, MetaObjectFactory factory, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static Component newActiveComponent(java.lang.String className, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, VirtualNode vn, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static Component newActiveComponent(java.lang.String className, java.lang.Object[] constructorParameters, Node node, Active activity, MetaObjectFactory factory, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static Component newActiveComponent(java.lang.String className, java.lang.Object[] constructorParameters, VirtualNode vn, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static java.lang.Object[] newActiveInParallel(java.lang.String className, java.lang.Class[] genericParameters, java.lang.Object[][] constructorParameters, Node[] nodes)
          Create a set of active objects with given construtor parameters.
static java.lang.Object[] newActiveInParallel(java.lang.String className, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, VirtualNode virtualNode)
          Create a set of identical active objects on a given virtual node.
static java.lang.Object[] newActiveInParallel(java.lang.String className, java.lang.Object[][] constructorParameters, Node[] nodes)
          Create a set of active objects with given construtor parameters.
static java.lang.Object[] newActiveInParallel(java.lang.String className, java.lang.Object[] constructorParameters, VirtualNode virtualNode)
          Create a set of identical active objects on a given virtual node.
static void newMain(java.lang.String classname, java.lang.String[] mainParameters, Node node)
          Launches the main method of the main class through the node node
static void newRemote(java.lang.String classname, Node node)
          Creates an instance of the remote class.
static void register(java.lang.Object obj, java.lang.String url)
          Registers an active object into a registry(RMI or IBIS or HTTP, default is RMI).
static void registerVirtualNode(VirtualNode virtualNode, java.lang.String registrationProtocol, boolean replacePreviousBinding)
          Registers locally the given VirtualNode in a registry such RMIRegistry or JINI Lookup Service or HTTP registry.
static void removeImmediateService(java.lang.Object obj, java.lang.String methodName, java.lang.Class[] parametersTypes)
          Removes an immmediate execution for the active object obj, i.e. requests corresponding to the name and types of parameters will be executed by the calling thread, and not added in the request queue.
static void removeNFEListenerOnAO(java.lang.Object ao, NFEListener listener)
          Remove a listener for NFE reaching a given active object
static void removeNFEListenerOnGroup(java.lang.Object group, NFEListener listener)
          Remove a listener for NFE regarding a group.
static void removeNFEListenerOnJVM(NFEListener listener)
          Remove a listener for NFE reaching the local JVM
static void removeNFEListenerOnProxy(java.lang.Object ao, NFEListener listener)
          Remove a listener for NFE reaching the client side of a given active object
static void removeTryWithCatch()
          This has to be called at the beginning of the finally block, so it requires one.
static void setImmediateService(java.lang.Object obj, java.lang.String methodName)
          Set an immediate execution for the target active object obj of the method String, ie request of name methodName will be executed right away upon arrival at the target AO context.
static void setImmediateService(java.lang.Object obj, java.lang.String methodName, java.lang.Class[] parametersTypes)
          Set an immediate execution for the target active object obj of the method String, ie request of name methodName will be executed right away upon arrival at the target AO context.
static void terminateActiveObject(java.lang.Object ao, boolean immediate)
          Kill an Active Object while calling terminate() method on its body.
static void throwArrivedException()
          This can be used to query a potential returned exception, and throw it if it exists.
static void tryWithCatch(java.lang.Class c)
          This has to be called just before a try block for a single exception.
static void tryWithCatch(java.lang.Class[] c)
          This has to be called just before a try block for many exceptions.
static java.lang.Object turnActive(java.lang.Object target)
          Turns the target object into an ActiveObject attached to a default node in the local JVM.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters)
          Turns the target object into an ActiveObject attached to a default node in the local JVM.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters, Node node)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters, Node node, Active activity, MetaObjectFactory factory)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters, java.lang.String nodeURL)
          Turns the target object into an Active Object and send it to the Node identified by the given url.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters, java.lang.String nameOfTargetType, Node node)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.Class[] genericParameters, java.lang.String nameOfTargetType, Node node, Active activity, MetaObjectFactory factory)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, Node node)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, Node node, Active activity, MetaObjectFactory factory)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nodeURL)
          Turns the target object into an Active Object and send it to the Node identified by the given url.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, java.lang.Class[] genericParameters, Node node, Active activity, MetaObjectFactory factory)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, Node node)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, Node node, Active activity, MetaObjectFactory factory)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActiveAsGroup(java.lang.Object target, java.lang.Class[] genericParameters, java.lang.String nameOfTargetType, VirtualNode virtualnode)
          Turns a Java object into a group of Active Objects and sends the elements of the group to remote Nodes mapped to the given virtualnode in the XML deployment descriptor.
static java.lang.Object turnActiveAsGroup(java.lang.Object target, java.lang.String nameOfTargetType, VirtualNode virtualnode)
          Turns a Java object into a group of Active Objects and sends the elements of the group to remote Nodes mapped to the given virtualnode in the XML deployment descriptor.
static void unExposeAsWebService(java.lang.String urn, java.lang.String url)
          Delete the service on a web server
static void unExposeComponentAsWebService(java.lang.String componentName, java.lang.String url, Component component)
          Undeploy component interfaces on a web server
static void unregister(java.lang.String url)
          Unregisters an active object previously registered into a registry.
static void unregisterVirtualNode(VirtualNode virtualNode)
          Unregisters the virtualNode previoulsy registered in a registry such as JINI or RMI.
static void waitFor(java.lang.Object future)
          Blocks the calling thread until the object future is available.
static void waitFor(java.lang.Object future, long timeout)
          Blocks the calling thread until the object future is available or until the timeout expires.
static void waitForAll(java.util.Vector futures)
          Blocks the calling thread until all futures in the vector are available.
static void waitForAll(java.util.Vector futures, long timeout)
          Blocks the calling thread until all futures in the vector are available or until the timeout expires.
static int waitForAny(java.util.Vector futures)
          Blocks the calling thread until one of the futures in the vector is available.
static int waitForAny(java.util.Vector futures, long timeout)
          Blocks the calling thread until one of the futures in the vector is available or until the timeout expires.
static void waitForPotentialException()
          This is used to wait for the return of every call, so that we know the execution can continue safely with no pending exception.
static void waitForTheNth(java.util.Vector futures, int n)
          Blocks the calling thread until the N-th of the futures in the vector is available.
static void waitForTheNth(java.util.Vector futures, int n, long timeout)
          Blocks the calling thread until the N-th of the futures in the vector is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

loggerGroup

public static final org.apache.log4j.Logger loggerGroup
Method Detail

newMain

public static void newMain(java.lang.String classname,
                           java.lang.String[] mainParameters,
                           Node node)
                    throws java.lang.ClassNotFoundException,
                           java.lang.NoSuchMethodException,
                           ProActiveException
Launches the main method of the main class through the node node

Parameters:
classname - classname of the main method to launch
mainParameters - parameters
node - node in which launch the main method
Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
ProActiveException

newRemote

public static void newRemote(java.lang.String classname,
                             Node node)
                      throws java.lang.ClassNotFoundException,
                             ProActiveException
Creates an instance of the remote class. This instance is created with the default constructor

Parameters:
classname -
node -
Throws:
java.lang.ClassNotFoundException
ProActiveException

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to a default node in the local JVM.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         java.lang.String nodeURL)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the node of the given URL.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
nodeURL - the URL of the node where to create the active object. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node URL cannot be resolved as an existing Node

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         Node node)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
node - the possibly null node where to create the active object.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveInParallel

public static java.lang.Object[] newActiveInParallel(java.lang.String className,
                                                     java.lang.Object[][] constructorParameters,
                                                     Node[] nodes)
                                              throws java.lang.ClassNotFoundException

Create a set of active objects with given construtor parameters. The object activation is optimized by a thread pool.

The total of active objects created is equal to the number of nodes and to the total of constructor paramaters also.

The condition to use this method is that: constructorParameters.length == nodes.length

Parameters:
className - the name of the class to instanciate as active.
constructorParameters - the array that contains the parameters used to build the active objects. All active objects have the same constructor parameters.
nodes - the array of nodes where the active objects are created.
Returns:
an array of references (possibly remote) on Stubs of the newly created active objects.
Throws:
java.lang.ClassNotFoundException - in the case of className is not a class.

newActiveInParallel

public static java.lang.Object[] newActiveInParallel(java.lang.String className,
                                                     java.lang.Object[] constructorParameters,
                                                     VirtualNode virtualNode)
                                              throws NodeException,
                                                     java.lang.ClassNotFoundException

Create a set of identical active objects on a given virtual node. The object activation is optimized by a thread pool.

When the given virtual node is not previously activated, this method employ the node creation event producer/listerner mechanism joined to the thread pool. That aims to create an active object just after the node deploying.

Parameters:
className - the name of the class to instanciate as active.
constructorParameters - the array that contains the parameters used to build the active objects. All active objects have the same constructor parameters.
virtualNode - the virtual node where the active objects are created.
Returns:
an array of references (possibly remote) on Stubs of the newly created active objects.
Throws:
NodeException - happens when the given virtualNode is already activated and throws an exception.
java.lang.ClassNotFoundException - in the case of className is not a class.

newActiveAsGroup

public static java.lang.Object newActiveAsGroup(java.lang.String classname,
                                                java.lang.Object[] constructorParameters,
                                                VirtualNode virtualnode)
                                         throws ActiveObjectCreationException,
                                                NodeException
Creates a new group of Active Objects. The type of the group and the type of the active objects it contains correspond to the classname parameter. This group will contain one active object per node mapped onto the virtual node given as a parameter.

Parameters:
classname - classname the name of the class to instanciate as active
constructorParameters - constructorParameters the parameters of the constructor.
virtualnode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
Object a Group of references (possibly remote) on Stub of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

newActiveAsGroup

public static java.lang.Object newActiveAsGroup(java.lang.String className,
                                                java.lang.Object[] constructorParameters,
                                                VirtualNode virtualNode,
                                                Active activity,
                                                MetaObjectFactory factory)
                                         throws ActiveObjectCreationException,
                                                NodeException
Creates a new group of Active Objects. The type of the group and the type of the active objects it contains correspond to the classname parameter. This group will contain one active object per node mapped onto the virtual node given as a parameter.

Parameters:
className - classname the name of the class to instanciate as active
constructorParameters - constructorParameters the parameters of the constructor.
virtualNode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
Object a Group of references (possibly remote) on Stubs of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

newActiveComponent

public static Component newActiveComponent(java.lang.String className,
                                           java.lang.Object[] constructorParameters,
                                           Node node,
                                           Active activity,
                                           MetaObjectFactory factory,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
className - the name of the base class. "Composite" if the component is a composite, "ParallelComposite" if the component is a parallel composite component
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
node - the possibly null node where to create the active object. If null, the active object is created localy on a default node
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - should be null for components (automatically created)
componentParameters - the parameters of the component
Returns:
a component representative of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveComponent

public static Component newActiveComponent(java.lang.String className,
                                           java.lang.Object[] constructorParameters,
                                           VirtualNode vn,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. This method allows automatic of primitive components on Virtual Nodes. In that case, the appendix -cyclicInstanceNumber-number is added to the name of each of these components. If the component is not a primitive, only one instance of the component is created, on the first node retreived from the specified virtual node. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
className - the name of the base class. "Composite" if the component is a composite, "ParallelComposite" if the component is a parallel composite component
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
vn - the possibly null node where to create the active object. If null, the active object is created localy on a default node
componentParameters - the parameters of the component
Returns:
a typed group of component representative elements, of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an ActiveObject attached to a default node in the local JVM. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nodeURL)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the Node identified by the given url. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
nodeURL - the URL of the node where to create the active object on. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType. A Stub is dynamically generated for the existing object. The result of the call will be an instance of the Stub class pointing to the proxy object pointing to the body object pointing to the existing object. The body can be remote or local depending if the existing is sent remotely or not.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActiveAsGroup

public static java.lang.Object turnActiveAsGroup(java.lang.Object target,
                                                 java.lang.String nameOfTargetType,
                                                 VirtualNode virtualnode)
                                          throws ActiveObjectCreationException,
                                                 NodeException
Turns a Java object into a group of Active Objects and sends the elements of the group to remote Nodes mapped to the given virtualnode in the XML deployment descriptor. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
virtualnode - The VirtualNode where the target object will be turn into an Active Object Target object will be turned into an Active Object on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
an array of references (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Class[] genericParameters,
                                         java.lang.Object[] constructorParameters)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to a default node in the local JVM.

Parameters:
classname - the name of the class to instanciate as active
genericParameters - parameterizing types (of class @param classname)
constructorParameters - the parameters of the constructor.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Class[] genericParameters,
                                         java.lang.Object[] constructorParameters,
                                         java.lang.String nodeURL)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the node of the given URL.

Parameters:
classname - the name of the class to instanciate as active
genericParameters - parameterizing types (of class @param classname)
constructorParameters - the parameters of the constructor.
nodeURL - the URL of the node where to create the active object. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node URL cannot be resolved as an existing Node

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Class[] genericParameters,
                                         java.lang.Object[] constructorParameters,
                                         Node node)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.

Parameters:
classname - the name of the class to instanciate as active
genericParameters - parameterizing types (of class @param classname)
constructorParameters - the parameters of the constructor.
node - the possibly null node where to create the active object.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Class[] genericParameters,
                                         java.lang.Object[] constructorParameters,
                                         Node node,
                                         Active activity,
                                         MetaObjectFactory factory)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null. The object returned is a stub class that extends the target class and that is automatically generated on the fly. The Stub class reference a the proxy object that reference the body of the active object. The body referenced by the proxy can either be local of remote, depending or the respective location of the object calling the newActive and the active object itself.

Parameters:
classname - the name of the class to instanciate as active
genericParameters - parameterizing types (of class @param classname)
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
node - the possibly null node where to create the active object. If null, the active object is created localy on a default node
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MetaObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveInParallel

public static java.lang.Object[] newActiveInParallel(java.lang.String className,
                                                     java.lang.Class[] genericParameters,
                                                     java.lang.Object[][] constructorParameters,
                                                     Node[] nodes)
                                              throws java.lang.ClassNotFoundException

Create a set of active objects with given construtor parameters. The object activation is optimized by a thread pool.

The total of active objects created is equal to the number of nodes and to the total of constructor paramaters also.

The condition to use this method is that: constructorParameters.length == nodes.length

Parameters:
className - the name of the class to instanciate as active.
genericParameters - genericParameters parameterizing types
constructorParameters - the array that contains the parameters used to build the active objects. All active objects have the same constructor parameters.
nodes - the array of nodes where the active objects are created.
Returns:
an array of references (possibly remote) on Stubs of the newly created active objects.
Throws:
java.lang.ClassNotFoundException - in the case of className is not a class.

newActiveInParallel

public static java.lang.Object[] newActiveInParallel(java.lang.String className,
                                                     java.lang.Class[] genericParameters,
                                                     java.lang.Object[] constructorParameters,
                                                     VirtualNode virtualNode)
                                              throws NodeException,
                                                     java.lang.ClassNotFoundException

Create a set of identical active objects on a given virtual node. The object activation is optimized by a thread pool.

Parameters:
className - the name of the class to instanciate as active.
genericParameters - genericParameters parameterizing types
constructorParameters - the array that contains the parameters used to build the active objects. All active objects have the same constructor parameters.
virtualNode - the virtual node where the active objects are created.
Returns:
an array of references (possibly remote) on Stubs of the newly created active objects.
Throws:
NodeException - happens when the given virtualNode is already activated and throws an exception.
java.lang.ClassNotFoundException - in the case of className is not a class.

newActiveAsGroup

public static java.lang.Object newActiveAsGroup(java.lang.String classname,
                                                java.lang.Class[] genericParameters,
                                                java.lang.Object[] constructorParameters,
                                                VirtualNode virtualnode)
                                         throws ActiveObjectCreationException,
                                                NodeException
Creates a new group of Active Objects. The type of the group and the type of the active objects it contains correspond to the classname parameter. This group will contain one active object per node mapped onto the virtual node given as a parameter.

Parameters:
classname - classname the name of the class to instanciate as active
genericParameters - genericParameters parameterizing types
constructorParameters - constructorParameters the parameters of the constructor.
virtualnode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
Object a Group of references (possibly remote) on Stub of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

newActiveAsGroup

public static java.lang.Object newActiveAsGroup(java.lang.String classname,
                                                java.lang.Class[] genericParameters,
                                                java.lang.Object[] constructorParameters,
                                                VirtualNode virtualnode,
                                                Active activity,
                                                MetaObjectFactory factory)
                                         throws ActiveObjectCreationException,
                                                NodeException
Creates a new group of Active Objects. The type of the group and the type of the active objects it contains correspond to the classname parameter. This group will contain one active object per node mapped onto the virtual node given as a parameter.

Parameters:
classname - classname the name of the class to instanciate as active
genericParameters - genericParameters parameterizing types
constructorParameters - constructorParameters the parameters of the constructor.
virtualnode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
Object a Group of references (possibly remote) on Stubs of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          java.lang.Class[] genericParameters,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType. A Stub is dynamically generated for the existing object. The result of the call will be an instance of the Stub class pointing to the proxy object pointing to the body object pointing to the existing object. The body can be remote or local depending if the existing is sent remotely or not.

Parameters:
target - The object to turn active
genericParameters - parameterizing types (of class @param classname)
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveComponent

public static Component newActiveComponent(java.lang.String classname,
                                           java.lang.Class[] genericParameters,
                                           java.lang.Object[] constructorParameters,
                                           Node node,
                                           Active activity,
                                           MetaObjectFactory factory,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
classname - the name of the base class. "Composite" if the component is a composite, "ParallelComposite" if the component is a parallel composite component
genericParameters - genericParameters parameterizing types
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
node - the possibly null node where to create the active object. If null, the active object is created localy on a default node
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - should be null for components (automatically created)
componentParameters - the parameters of the component
Returns:
a component representative of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveComponent

public static Component newActiveComponent(java.lang.String className,
                                           java.lang.Class[] genericParameters,
                                           java.lang.Object[] constructorParameters,
                                           VirtualNode vn,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. This method allows automatic of primitive components on Virtual Nodes. In that case, the appendix -cyclicInstanceNumber-number is added to the name of each of these components. If the component is not a primitive, only one instance of the component is created, on the first node retreived from the specified virtual node. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
className - the name of the base class. "Composite" if the component is a composite, "ParallelComposite" if the component is a parallel composite component
genericParameters - genericParameters parameterizing types
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
vn - the possibly null node where to create the active object. If null, the active object is created localy on a default node
componentParameters - the parameters of the component
Returns:
a typed group of component representative elements, of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an ActiveObject attached to a default node in the local JVM. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters,
                                          java.lang.String nodeURL)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the Node identified by the given url. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
nodeURL - the URL of the node where to create the active object on. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters,
                                          java.lang.String nameOfTargetType,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.Class[] genericParameters,
                                          java.lang.String nameOfTargetType,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType. A Stub is dynamically generated for the existing object. The result of the call will be an instance of the Stub class pointing to the proxy object pointing to the body object pointing to the existing object. The body can be remote or local depending if the existing is sent remotely or not.

Parameters:
target - The object to turn active
genericParameters - genericParameters parameterizing types
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActiveAsGroup

public static java.lang.Object turnActiveAsGroup(java.lang.Object target,
                                                 java.lang.Class[] genericParameters,
                                                 java.lang.String nameOfTargetType,
                                                 VirtualNode virtualnode)
                                          throws ActiveObjectCreationException,
                                                 NodeException
Turns a Java object into a group of Active Objects and sends the elements of the group to remote Nodes mapped to the given virtualnode in the XML deployment descriptor. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
genericParameters - parameterizing types (of class @param classname)
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
virtualnode - The VirtualNode where the target object will be turn into an Active Object Target object will be turned into an Active Object on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
an array of references (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

register

public static void register(java.lang.Object obj,
                            java.lang.String url)
                     throws java.io.IOException
Registers an active object into a registry(RMI or IBIS or HTTP, default is RMI). In fact it is the remote version of the body of the active object that is registered into the registry under the given URL. According to the type of the associated body(default is Rmi), the registry in which to register is automatically found.

Parameters:
obj - the active object to register.
url - the url under which the remote body is registered. The url must point to the localhost since registering is always a local action. The url can take the form:protocol://localhost:port/nam or //localhost:port/name if protocol is RMI or //localhost/name if port is 1099 or only the name. The registered object will be reachable with the following url: protocol://machine_name:port/name using lookupActive method. Protocol and port can be removed if default
Throws:
java.io.IOException - if the remote 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 registry.

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

lookupActive

public static java.lang.Object lookupActive(java.lang.String classname,
                                            java.lang.String url)
                                     throws ActiveObjectCreationException,
                                            java.io.IOException
Looks-up an active object previously registered in a registry(RMI, IBIS, HTTP). In fact it is the remote version of the body of an active object that can be registered into the Registry under a given URL. If the lookup is successful, the method reconstructs a Stub-Proxy couple and point it to the RmiRemoteBody found. The registry where to look for is fully determined with the protocol included in the url

Parameters:
classname - the fully qualified name of the class the stub should inherit from.
url - the url under which the remote body is registered. The url takes the following form: protocol://machine_name:port/name. Protocol and port can be ommited if respectively RMI and 1099: //machine_name/name
Returns:
a remote reference on a Stub of type classname pointing to the remote body found
Throws:
java.io.IOException - if the remote body cannot be found under the given url or if the object found is not of type RmiRemoteBody
ActiveObjectCreationException - if the stub-proxy couple cannot be created

listActive

public static java.lang.String[] listActive(java.lang.String url)
                                     throws java.io.IOException
Looks-up all Active Objects registered on a host, using a registry(RMI or JINI or HTTP or IBIS) The registry where to look for is fully determined with the protocol included in the url.

Parameters:
url - The url where to perform the lookup. The url takes the following form: protocol://machine_name:port. Protocol and port can be ommited if respectively RMI and 1099: //machine_name
Returns:
String [] the list of names registered on the host; if no Registry found, returns {}
Throws:
java.io.IOException - If the given url does not map to a physical host, or if the connection is refused.

getActiveObjectNodeUrl

public static java.lang.String getActiveObjectNodeUrl(java.lang.Object activeObject)
Return the URL of the remote activeObject.

Parameters:
activeObject - the remote active object.
Returns:
the URL of activeObject.

isException

public static boolean isException(java.lang.Object future)
Find out if the object contains an exception that should be thrown

Parameters:
future - the future object that is examinated
Returns:
true iff an exception should be thrown when accessing the object

waitFor

public static void waitFor(java.lang.Object future)
Blocks the calling thread until the object future is available. future must be the result object of an asynchronous call. Usually the the wait by necessity model take care of blocking the caller thread asking for a result not yet available. This method allows to block before the result is first used.

Parameters:
future - object to wait for

waitFor

public static void waitFor(java.lang.Object future,
                           long timeout)
                    throws ProActiveException
Blocks the calling thread until the object future is available or until the timeout expires. future must be the result object of an asynchronous call. Usually the the wait by necessity model take care of blocking the caller thread asking for a result not yet available. This method allows to block before the result is first used.

Parameters:
future - object to wait for
timeout - to wait in ms
Throws:
ProActiveException - if the timeout expire

getProactiveDescriptor

public static ProActiveDescriptor getProactiveDescriptor()
                                                  throws ProActiveException,
                                                         java.io.IOException
Returns a ProActiveDescriptor that gives an object representation of the XML document located at the url given by proactive.pad system's property.

Returns:
the pad located at the url given by proactive.pad system's property
Throws:
ProActiveException
ibis.rmi.RemoteException
java.io.IOException

getProactiveDescriptor

public static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl)
                                                  throws ProActiveException
Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url.

Parameters:
xmlDescriptorUrl - The url of the XML document
Returns:
ProActiveDescriptor. The object representation of the XML document
Throws:
ProActiveException - if a problem occurs during the creation of the object
See Also:
ProActiveDescriptor, VirtualNode, VirtualMachine

getProactiveDescriptor

public static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl,
                                                         VariableContract variableContract)
                                                  throws ProActiveException
Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url, and uses the given Variable Contract.

Parameters:
xmlDescriptorUrl - The url of the XML document
Returns:
ProActiveDescriptor. The object representation of the XML document
Throws:
ProActiveException - if a problem occurs during the creation of the object
See Also:
ProActiveDescriptor, VirtualNode, VirtualMachine

registerVirtualNode

public static void registerVirtualNode(VirtualNode virtualNode,
                                       java.lang.String registrationProtocol,
                                       boolean replacePreviousBinding)
                                throws ProActiveException,
                                       java.rmi.AlreadyBoundException
Registers locally the given VirtualNode in a registry such RMIRegistry or JINI Lookup Service or HTTP registry. The VirtualNode to register must exist on the local runtime. This is done when using XML Deployment Descriptors

Parameters:
virtualNode - the VirtualNode to register.
registrationProtocol - The protocol used for registration or null in order to use the protocol used to start the jvm. At this time RMI, JINI, HTTP, IBIS are supported. If set to null, the registration protocol will be set to the system property: proactive.communication.protocol
replacePreviousBinding -
Throws:
ProActiveException - If the VirtualNode with the given name has not been yet activated or does not exist on the local runtime
java.rmi.AlreadyBoundException

lookupVirtualNode

public static VirtualNode lookupVirtualNode(java.lang.String url)
                                     throws ProActiveException
Looks-up a VirtualNode previously registered in a registry(RMI or JINI or HTTP or IBIS) The registry where to look for is fully determined with the protocol included in the url

Parameters:
url - The url where to perform the lookup. The url takes the following form: protocol://machine_name:port/name. Protocol and port can be ommited if respectively RMI and 1099: //machine_name/name
Returns:
VirtualNode The virtualNode returned by the lookup
Throws:
ProActiveException - If no objects are bound with the given url

unregisterVirtualNode

public static void unregisterVirtualNode(VirtualNode virtualNode)
                                  throws ProActiveException
Unregisters the virtualNode previoulsy registered in a registry such as JINI or RMI. Calling this method removes the VirtualNode from the local runtime.

Parameters:
virtualNode - The VirtualNode to unregister
Throws:
ProActiveException - if a problem occurs whle unregistering the VirtualNode

getBodyOnThis

public static Body getBodyOnThis()
When an active object is created, it is associated with a Body that takes care of all non fonctionnal properties. Assuming that the active object is only accessed by the different Stub objects, all method calls end-up as Requests sent to this Body. Therefore the only thread calling the method of the active object is the active thread managed by the body. There is an unique mapping between the active thread and the body responsible for it. From any method in the active object the current thread caller of the method is the active thread. When a reified method wants to get a reference to the Body associated to the active object, it can invoke this method. Assuming that the current thread is the active thread, the associated body is returned.

Returns:
the body associated to the active object whose active thread is calling this method.

getStubOnThis

public static StubObject getStubOnThis()
Returns a Stub-Proxy couple pointing to the local body associated to the active object whose active thread is calling this method.

Returns:
a Stub-Proxy couple pointing to the local body.
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(java.lang.Object activeObject)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the same location as the active object given in parameter. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method. The object given as destination must be an active object.

Parameters:
activeObject - the active object indicating the destination of the migration.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(java.lang.String nodeURL)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the node caracterized by the given url. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method. The url must be the url of an existing node.

Parameters:
nodeURL - the url of an existing where to migrate to.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(Node node)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the given node. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method.

Parameters:
node - an existing node where to migrate to.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             java.lang.Object activeObject,
                             boolean isNFRequest)
                      throws MigrationException
Migrates the given body to the same location as the active object given in parameter. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
activeObject - the active object indicating the destination of the migration.
isNFRequest - a boolean indicating that the request is not functional i.e it does not modify the application's computation
Throws:
MigrationException - if the migration fails

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             java.lang.String nodeURL,
                             boolean isNFRequest)
                      throws MigrationException
Migrates the given body to the node caracterized by the given url. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
nodeURL - the url of an existing where to migrate to.
isNFRequest - a boolean indicating that the request is not functional i.e it does not modify the application's computation
Throws:
MigrationException - if the migration fails

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             Node node,
                             boolean isNFRequest)
                      throws MigrationException
Migrates the body bodyToMigrate to the given node. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
node - an existing node where to migrate to.
isNFRequest - a boolean indicating that the request is not functional i.e it does not modify the application's computation
Throws:
MigrationException - if the migration fails

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             Node node,
                             boolean isNFRequest,
                             int priority)
                      throws MigrationException
Migrates the body bodyToMigrate to the given node. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
node - an existing node where to migrate to.
isNFRequest - a boolean indicating that the request is not functional i.e it does not modify the application's computation
priority - the level of priority of the non functional request. Levels are defined in Request interface of ProActive.
Throws:
MigrationException - if the migration fails

waitForAny

public static int waitForAny(java.util.Vector futures)
Blocks the calling thread until one of the futures in the vector is available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures
Returns:
index of the available future in the vector

waitForAny

public static int waitForAny(java.util.Vector futures,
                             long timeout)
                      throws ProActiveException
Blocks the calling thread until one of the futures in the vector is available or until the timeout expires. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures
timeout - to wait in ms
Returns:
index of the available future in the vector
Throws:
ProActiveException - if the timeout expires

waitForAll

public static void waitForAll(java.util.Vector futures)
Blocks the calling thread until all futures in the vector are available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures

waitForAll

public static void waitForAll(java.util.Vector futures,
                              long timeout)
                       throws ProActiveException
Blocks the calling thread until all futures in the vector are available or until the timeout expires. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures
timeout - to wait in ms
Throws:
ProActiveException - if the timeout expires

waitForTheNth

public static void waitForTheNth(java.util.Vector futures,
                                 int n)
Blocks the calling thread until the N-th of the futures in the vector is available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures

waitForTheNth

public static void waitForTheNth(java.util.Vector futures,
                                 int n,
                                 long timeout)
                          throws ProActiveException
Blocks the calling thread until the N-th of the futures in the vector is available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures
n -
timeout - to wait in ms
Throws:
ProActiveException - if the timeout expires

allAwaited

public static boolean allAwaited(java.util.Vector futures)
Return false if one object of futures is available.

Parameters:
futures - a table with futures.
Returns:
true if all futures are awaited, else false .

isAwaited

public static boolean isAwaited(java.lang.Object future)
Return false if the object future is available. This method is recursive, i.e. if result of future is a future too, isAwaited is called again on this result, and so on.


getFutureValue

public static java.lang.Object getFutureValue(java.lang.Object future)
Return the object contains by the future (ie its target). If parameter is not a future, it is returned. A wait-by-necessity occurs if future is not available. This method is recursive, i.e. if result of future is a future too, getFutureValue is called again on this result, and so on.


enableAC

public static void enableAC(java.lang.Object obj)
                     throws java.io.IOException
Enable the automatic continuation mechanism for this active object.

Throws:
java.io.IOException

disableAC

public static void disableAC(java.lang.Object obj)
                      throws java.io.IOException
Disable the automatic continuation mechanism for this active object.

Throws:
java.io.IOException

terminateActiveObject

public static void terminateActiveObject(java.lang.Object ao,
                                         boolean immediate)
Kill an Active Object while calling terminate() method on its body.

Parameters:
ao - the active object to kill
immediate - if this boolean is true, this method is served as an immediate service. The active object dies immediatly. Else, the kill request is served as a normal request, it is put on the request queue.

setImmediateService

public static void setImmediateService(java.lang.Object obj,
                                       java.lang.String methodName)
                                throws java.io.IOException
Set an immediate execution for the target active object obj of the method String, ie request of name methodName will be executed right away upon arrival at the target AO context. Warning: the execution of an Immediate Service method is achieved in parallel of the current services, so it is the programmer responsibility to ensure that Immediate Services do not interfere with any other methods.

Parameters:
obj - the object on which to set this immediate service
methodName - the name of the method
Throws:
java.io.IOException

setImmediateService

public static void setImmediateService(java.lang.Object obj,
                                       java.lang.String methodName,
                                       java.lang.Class[] parametersTypes)
                                throws java.io.IOException
Set an immediate execution for the target active object obj of the method String, ie request of name methodName will be executed right away upon arrival at the target AO context. Warning: the execution of an Immediate Service method is achieved in parallel of the current services, so it is the programmer responsibility to ensure that Immediate Services do not interfere with any other methods.

Parameters:
obj - the object on which to set this immediate service
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException

removeImmediateService

public static void removeImmediateService(java.lang.Object obj,
                                          java.lang.String methodName,
                                          java.lang.Class[] parametersTypes)
                                   throws java.io.IOException
Removes an immmediate execution for the active object obj, i.e. requests corresponding to the name and types of parameters will be executed by the calling thread, and not added in the request queue. BE CAREFUL : for the first release of this method, do not make use of getCurrentThreadBody nor getStubOnThis in the method defined by methodName !!

Parameters:
obj - the object from which to remove this immediate service
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException

getJobId

public static java.lang.String getJobId()
Returns:
the jobId associated with the object calling this method

exposeAsWebService

public static void exposeAsWebService(java.lang.Object o,
                                      java.lang.String url,
                                      java.lang.String urn,
                                      java.lang.String[] methods)
Expose an active object as a web service

Parameters:
o - The object to expose as a web service
url - The url of the host where the object will be seployed (typically http://localhost:8080)
urn - The name of the object
methods - The methods that will be exposed as web services functionnalities

unExposeAsWebService

public static void unExposeAsWebService(java.lang.String urn,
                                        java.lang.String url)
Delete the service on a web server

Parameters:
urn - The name of the object
url - The url of the web server

exposeComponentAsWebService

public static void exposeComponentAsWebService(Component component,
                                               java.lang.String url,
                                               java.lang.String componentName)
Deploy a component as a webservice. Each interface of the component will be accessible by the urn [componentName]_[interfaceName]in order to identify the component an interface belongs to. All the interfaces public methods will be exposed.

Parameters:
componentName - The name of the component
url - The web server url where to deploy the service - typically "http://localhost:8080"
component - The component owning the interfaces that will be deployed as web services.

unExposeComponentAsWebService

public static void unExposeComponentAsWebService(java.lang.String componentName,
                                                 java.lang.String url,
                                                 Component component)
Undeploy component interfaces on a web server

Parameters:
componentName - The name of the component
url - The url of the web server
component - The component owning the services interfaces

createStubObject

public static java.lang.Object createStubObject(java.lang.String className,
                                                UniversalBody body)
                                         throws MOPException
Throws:
MOPException

tryWithCatch

public static void tryWithCatch(java.lang.Class c)
This has to be called just before a try block for a single exception.

Parameters:
c - the caught exception type in the catch block

tryWithCatch

public static void tryWithCatch(java.lang.Class[] c)
This has to be called just before a try block for many exceptions.

Parameters:
c - the caught exception types in the catch block

endTryWithCatch

public static void endTryWithCatch()
This has to be called at the end of the try block.


removeTryWithCatch

public static void removeTryWithCatch()
This has to be called at the beginning of the finally block, so it requires one.


throwArrivedException

public static void throwArrivedException()
This can be used to query a potential returned exception, and throw it if it exists.


waitForPotentialException

public static void waitForPotentialException()
This is used to wait for the return of every call, so that we know the execution can continue safely with no pending exception.


addNFEListenerOnJVM

public static void addNFEListenerOnJVM(NFEListener listener)
Add a listener for NFE reaching the local JVM

Parameters:
listener - The listener to add

removeNFEListenerOnJVM

public static void removeNFEListenerOnJVM(NFEListener listener)
Remove a listener for NFE reaching the local JVM

Parameters:
listener - The listener to remove

addNFEListenerOnAO

public static void addNFEListenerOnAO(java.lang.Object ao,
                                      NFEListener listener)
Add a listener for NFE reaching a given active object

Parameters:
ao - The active object receiving the NFE
listener - The listener to add

removeNFEListenerOnAO

public static void removeNFEListenerOnAO(java.lang.Object ao,
                                         NFEListener listener)
Remove a listener for NFE reaching a given active object

Parameters:
ao - The active object receiving the NFE
listener - The listener to remove

addNFEListenerOnProxy

public static void addNFEListenerOnProxy(java.lang.Object ao,
                                         NFEListener listener)
Add a listener for NFE reaching the client side of a given active object

Parameters:
ao - The active object receiving the NFE
listener - The listener to add

removeNFEListenerOnProxy

public static void removeNFEListenerOnProxy(java.lang.Object ao,
                                            NFEListener listener)
Remove a listener for NFE reaching the client side of a given active object

Parameters:
ao - The active object receiving the NFE
listener - The listener to remove

addNFEListenerOnGroup

public static void addNFEListenerOnGroup(java.lang.Object group,
                                         NFEListener listener)
Add a listener for NFE regarding a group.

Parameters:
group - The group receiving the NFE
listener - The listener to add

removeNFEListenerOnGroup

public static void removeNFEListenerOnGroup(java.lang.Object group,
                                            NFEListener listener)
Remove a listener for NFE regarding a group.

Parameters:
group - The group receiving the NFE
listener - The listener to remove

getAllExceptions

public static java.util.Collection getAllExceptions()
Get the exceptions that have been caught in the current ProActive.tryWithCatch()/ProActive.removeTryWithCatch() block. This waits for every call in this block to return.

Returns:
a collection of these exceptions

getNode

public static Node getNode()
                    throws NodeException
Returns:
The node of the current active object.
Throws:
NodeException - problem with the node.

exitSuccess

public static void exitSuccess()
Call this method at the end of the application if it completed successfully, for the launcher to be aware of it.


exitFailure

public static void exitFailure()
Call this method at the end of the application if it did not complete successfully, for the launcher to be aware of it.


enableExitOnEmpty

public void enableExitOnEmpty()
After this call, when the JVM has no more active objects it will be killed.


getProActiveVersion

public static java.lang.String getProActiveVersion()
Returns the number of this version

Returns:
String


Copyright 2001-2007 INRIA All Rights Reserved.