org.objectweb.proactive.core.runtime.ibis
Class RemoteProActiveRuntimeAdapter

java.lang.Object
  |
  +--org.objectweb.proactive.core.runtime.ibis.RemoteProActiveRuntimeAdapter
All Implemented Interfaces:
Job, ProActiveRuntime, java.io.Serializable

public class RemoteProActiveRuntimeAdapter
extends java.lang.Object
implements ProActiveRuntime, java.io.Serializable

An adapter for a RemoteProActiveRuntime to be able to receive remote calls. This helps isolate Ibis-specific code into a small set of specific classes, thus enabling reuse if we one day decide to switch to another remote objects library.

See Also:
smartProxy Pattern., Serialized Form

Field Summary
protected  boolean alreadykilled
           
protected  java.lang.String proActiveRuntimeURL
           
protected  RemoteProActiveRuntime remoteProActiveRuntime
           
protected  VMInformation vmInformation
           
 
Fields inherited from interface org.objectweb.proactive.core.runtime.ProActiveRuntime
runtimeLogger
 
Constructor Summary
RemoteProActiveRuntimeAdapter()
           
RemoteProActiveRuntimeAdapter(RemoteProActiveRuntime remoteProActiveRuntime)
           
 
Method Summary
 UniversalBody createBody(java.lang.String nodeName, ConstructorCall bodyConstructorCall, boolean isNodeLocal)
           This method is the basis for creating remote active objects.
 java.lang.String createLocalNode(java.lang.String nodeName, boolean replacePreviousBinding, PolicyServer ps, java.lang.String vname, java.lang.String jobId)
          Creates a new Node in the same VM as this ProActiveRuntime
protected  RemoteProActiveRuntime createRemoteProActiveRuntime()
           
 void createVM(UniversalProcess remoteProcess)
          Creates a new ProActiveRuntime associated with a new VM on the host defined in the given process.
 void enableSecurityIfNeeded()
          sets all needed modifications to enable security components MUST be called when the descriptor is ready
 boolean equals(java.lang.Object o)
           
 java.util.ArrayList getActiveObjects(java.lang.String nodeName)
          Returns all Active Objects deployed on the node with the given name on this ProActiveRuntime
 java.util.ArrayList getActiveObjects(java.lang.String nodeName, java.lang.String objectName)
          Returns all Active Objects with the specified class name, deployed on the node with the given name on this ProActiveRuntime
 java.security.cert.X509Certificate getCreatorCertificate()
           
 java.util.ArrayList getEntities()
           
 java.util.ArrayList getEntities(java.lang.String nodeName)
           
 java.util.ArrayList getEntities(UniversalBody uBody)
           
 java.lang.String getJobID()
           
 java.lang.String getJobID(java.lang.String nodeUrl)
           
 java.lang.String[] getLocalNodeNames()
          Returns the name of all nodes known by this ProActiveRuntime on this VM
 java.security.cert.X509Certificate getNodeCertificate(java.lang.String nodeName)
           
 PolicyServer getNodePolicyServer(java.lang.String nodeName)
           
 PolicyServer getPolicyServer()
           
 ProActiveRuntime getProActiveRuntime(java.lang.String proActiveRuntimeName)
          Returns the ProActiveRuntime of specified name
 ProActiveRuntime[] getProActiveRuntimes()
          Returns all the ProActiveRuntime registered on this ProActiveRuntime on this VM
 java.lang.String getURL()
          Returns the url of this ProActiveRuntime on the local or remote VM
 VirtualNode getVirtualNode(java.lang.String virtualNodeName)
          Returns the VirtualNode with the given name
 VMInformation getVMInformation()
          Returns the JVM information as one object.
 java.lang.String getVNName(java.lang.String nodename)
           
 int hashCode()
           
 void killAllNodes()
          **Under development** Kills all Nodes in this ProActiveRuntime
 void killNode(java.lang.String nodeName)
          **Under development** Kills the Node of the given name and all Active Objects deployed on it.
 void killRT(boolean softly)
          Kills this ProActiveRuntime and this VM
 void listVirtualNodes()
           
 UniversalBody receiveBody(java.lang.String nodeName, Body body)
           This method is the basis for migrating active objects.
 void register(ProActiveRuntime proActiveRuntimeDist, java.lang.String proActiveRuntimeName, java.lang.String creatorID, java.lang.String creationProtocol, java.lang.String vmName)
          **For internal use only** Allows this ProactiveRuntime on this VM to register another ProActiveRuntime
 void registerVirtualNode(java.lang.String virtualNodeName, boolean replacePreviousBinding)
          Registers the virtualNode of the given name in a registry such RMIRegistry or Jini Service Lookup
 void setDefaultNodeVirtualNodeName(java.lang.String s)
           
 void setProActiveSecurityManager(ProActiveSecurityManager ps)
           
 void unregisterAllVirtualNodes()
          Unregisters all VirtualNodes from the local runtime
 void unregisterVirtualNode(java.lang.String virtualNodeName)
          Unregisters the VirtualNode of the given name from the local runtime.
 void updateLocalNodeVirtualName()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remoteProActiveRuntime

protected RemoteProActiveRuntime remoteProActiveRuntime

vmInformation

protected VMInformation vmInformation

proActiveRuntimeURL

protected java.lang.String proActiveRuntimeURL

alreadykilled

protected boolean alreadykilled
Constructor Detail

RemoteProActiveRuntimeAdapter

public RemoteProActiveRuntimeAdapter()
                              throws ProActiveException

RemoteProActiveRuntimeAdapter

public RemoteProActiveRuntimeAdapter(RemoteProActiveRuntime remoteProActiveRuntime)
                              throws ProActiveException
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

createLocalNode

public java.lang.String createLocalNode(java.lang.String nodeName,
                                        boolean replacePreviousBinding,
                                        PolicyServer ps,
                                        java.lang.String vname,
                                        java.lang.String jobId)
                                 throws NodeException
Description copied from interface: ProActiveRuntime
Creates a new Node in the same VM as this ProActiveRuntime

Specified by:
createLocalNode in interface ProActiveRuntime
Parameters:
nodeName - the name of the node to create localy
replacePreviousBinding -
Returns:
the url of the newly created node in the target VM
Throws:
NodeException - if the new node cannot be created

killAllNodes

public void killAllNodes()
                  throws ProActiveException
Description copied from interface: ProActiveRuntime
**Under development** Kills all Nodes in this ProActiveRuntime

Specified by:
killAllNodes in interface ProActiveRuntime
ProActiveException

killNode

public void killNode(java.lang.String nodeName)
              throws ProActiveException
Description copied from interface: ProActiveRuntime
**Under development** Kills the Node of the given name and all Active Objects deployed on it.

Specified by:
killNode in interface ProActiveRuntime
Parameters:
nodeName - the name of the node to kill
ProActiveException

createVM

public void createVM(UniversalProcess remoteProcess)
              throws java.io.IOException,
                     ProActiveException
Description copied from interface: ProActiveRuntime
Creates a new ProActiveRuntime associated with a new VM on the host defined in the given process.

Specified by:
createVM in interface ProActiveRuntime
Parameters:
remoteProcess - the process that will originate the creation of the runtime
Throws:
java.io.IOException - if the new VM cannot be created
ProActiveException - if a problem occurs due to the remote nature of this ProActiveRuntime

getLocalNodeNames

public java.lang.String[] getLocalNodeNames()
                                     throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns the name of all nodes known by this ProActiveRuntime on this VM

Specified by:
getLocalNodeNames in interface ProActiveRuntime
Returns:
the name of all nodes known by this ProActiveRuntime on this VM
Throws:
ProActiveException - if a problem occurs due to the remote nature of this ProActiveRuntime

getVMInformation

public VMInformation getVMInformation()
Description copied from interface: ProActiveRuntime
Returns the JVM information as one object. This method allows to retrieve all JVM information in one call to optimize performance.

Specified by:
getVMInformation in interface ProActiveRuntime
Returns:
the JVM information as one object

register

public void register(ProActiveRuntime proActiveRuntimeDist,
                     java.lang.String proActiveRuntimeName,
                     java.lang.String creatorID,
                     java.lang.String creationProtocol,
                     java.lang.String vmName)
Description copied from interface: ProActiveRuntime
**For internal use only** Allows this ProactiveRuntime on this VM to register another ProActiveRuntime

Specified by:
register in interface ProActiveRuntime
Parameters:
proActiveRuntimeDist - the remote ProactiveRuntime to register
proActiveRuntimeName - the name of the remote ProActiveRuntime
creatorID - the name of the creator of the remote ProActiveRuntime
creationProtocol - the protocol used to register the remote ProActiveRuntime when created

getProActiveRuntimes

public ProActiveRuntime[] getProActiveRuntimes()
                                        throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns all the ProActiveRuntime registered on this ProActiveRuntime on this VM

Specified by:
getProActiveRuntimes in interface ProActiveRuntime
Returns:
all the ProActiveRuntime registered on this ProActiveRuntime on this VM
Throws:
ProActiveException - if a problem occurs due to the remote nature of this ProActiveRuntime

getProActiveRuntime

public ProActiveRuntime getProActiveRuntime(java.lang.String proActiveRuntimeName)
                                     throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns the ProActiveRuntime of specified name

Specified by:
getProActiveRuntime in interface ProActiveRuntime
Parameters:
proActiveRuntimeName - the name of the ProActiveruntime to return
Returns:
the ProActiveRuntime of specified name
Throws:
ProActiveException - if a problem occurs due to the remote nature of this ProActiveRuntime

killRT

public void killRT(boolean softly)
            throws java.lang.Exception
Description copied from interface: ProActiveRuntime
Kills this ProActiveRuntime and this VM

Specified by:
killRT in interface ProActiveRuntime
Parameters:
softly - if false, this Runtime is killed abruptely if true, if that runtime originates the creation of a rmi registry, it waits until the registry is empty before dying. To be more precise a thread is created to ask periodically the registry if objects are still registered.
java.lang.Exception

getURL

public java.lang.String getURL()
                        throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns the url of this ProActiveRuntime on the local or remote VM

Specified by:
getURL in interface ProActiveRuntime
ProActiveException

getActiveObjects

public java.util.ArrayList getActiveObjects(java.lang.String nodeName)
                                     throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns all Active Objects deployed on the node with the given name on this ProActiveRuntime

Specified by:
getActiveObjects in interface ProActiveRuntime
Parameters:
nodeName - the name of the node
Returns:
Object[] Active Objects deployed on this ProactiveRuntime
ProActiveException

getActiveObjects

public java.util.ArrayList getActiveObjects(java.lang.String nodeName,
                                            java.lang.String objectName)
                                     throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns all Active Objects with the specified class name, deployed on the node with the given name on this ProActiveRuntime

Specified by:
getActiveObjects in interface ProActiveRuntime
Parameters:
nodeName - the name of the node
Returns:
Object[] Active Objects of the specified class name deployed on this ProactiveRuntime
ProActiveException

getVirtualNode

public VirtualNode getVirtualNode(java.lang.String virtualNodeName)
                           throws ProActiveException
Description copied from interface: ProActiveRuntime
Returns the VirtualNode with the given name

Specified by:
getVirtualNode in interface ProActiveRuntime
Returns:
VirtualNode the virtualnode of the given name or null if such virtualNode does not exist.
ProActiveException

registerVirtualNode

public void registerVirtualNode(java.lang.String virtualNodeName,
                                boolean replacePreviousBinding)
                         throws ProActiveException
Description copied from interface: ProActiveRuntime
Registers the virtualNode of the given name in a registry such RMIRegistry or Jini Service Lookup

Specified by:
registerVirtualNode in interface ProActiveRuntime
Parameters:
virtualNodeName -
ProActiveException

unregisterVirtualNode

public void unregisterVirtualNode(java.lang.String virtualNodeName)
                           throws ProActiveException
Description copied from interface: ProActiveRuntime
Unregisters the VirtualNode of the given name from the local runtime.

Specified by:
unregisterVirtualNode in interface ProActiveRuntime
Parameters:
virtualNodeName - the virtualNode to unregister.
Throws:
ProActiveException - if a problem occurs when trying to unregister the virtualNode

unregisterAllVirtualNodes

public void unregisterAllVirtualNodes()
                               throws ProActiveException
Description copied from interface: ProActiveRuntime
Unregisters all VirtualNodes from the local runtime

Specified by:
unregisterAllVirtualNodes in interface ProActiveRuntime
Throws:
ProActiveException

createBody

public UniversalBody createBody(java.lang.String nodeName,
                                ConstructorCall bodyConstructorCall,
                                boolean isNodeLocal)
                         throws ProActiveException,
                                ConstructorCallExecutionFailedException,
                                java.lang.reflect.InvocationTargetException
Description copied from interface: ProActiveRuntime

This method is the basis for creating remote active objects. It receives a ConstructorCall that is the constructor call of the body of the active object to create. Inside the parameters of this constructor call is the constructor call of the reified object. Upon execution of the constructor call of the body, the body holding a reference on the reified object will get created and returned.

The method returns a reference on the RMI stub of the newly created body.

Specified by:
createBody in interface ProActiveRuntime
Parameters:
nodeName - the name of the node the newly created active object will be associated to
bodyConstructorCall - the Constructor call allowing to create the body
isNodeLocal - boolean. True if proxy and body are on the same vm, false otherwise
Returns:
a stub on the newly created body.
Throws:
ProActiveException - if a problem occurs due to the remote nature of this ProactiveRuntime
ConstructorCallExecutionFailedException - if the constructor call cannot be executed
java.lang.reflect.InvocationTargetException - if the java constructor execution failed

receiveBody

public UniversalBody receiveBody(java.lang.String nodeName,
                                 Body body)
                          throws ProActiveException
Description copied from interface: ProActiveRuntime

This method is the basis for migrating active objects. It receives a Body that embbeds the reified object and its graph of passive objects. Once transfered remotely using serialization, the body should restart itself and perform all updates needed to be functionning.

The method returns a reference on the RMI stub of the migrated body.

Specified by:
receiveBody in interface ProActiveRuntime
Parameters:
nodeName - the name of the node the newly created active object will be associated to
body - the body of the active object migrating to this node.
Returns:
a RMI stub on the migrated body.
Throws:
ProActiveException - if a problem occurs due to the remote nature of this ProActiveRuntime

getPolicyServer

public PolicyServer getPolicyServer()
                             throws ProActiveException
Specified by:
getPolicyServer in interface ProActiveRuntime
Returns:
Policy server
ProActiveException

setProActiveSecurityManager

public void setProActiveSecurityManager(ProActiveSecurityManager ps)
                                 throws ProActiveException
Specified by:
setProActiveSecurityManager in interface ProActiveRuntime
ProActiveException

getCreatorCertificate

public java.security.cert.X509Certificate getCreatorCertificate()
                                                         throws ProActiveException
Specified by:
getCreatorCertificate in interface ProActiveRuntime
Returns:
creator's certificate if exists
ProActiveException

getVNName

public java.lang.String getVNName(java.lang.String nodename)
                           throws ProActiveException
Specified by:
getVNName in interface ProActiveRuntime
ProActiveException

setDefaultNodeVirtualNodeName

public void setDefaultNodeVirtualNodeName(java.lang.String s)
                                   throws ProActiveException
Specified by:
setDefaultNodeVirtualNodeName in interface ProActiveRuntime
ProActiveException

updateLocalNodeVirtualName

public void updateLocalNodeVirtualName()
                                throws ProActiveException
ProActiveException

listVirtualNodes

public void listVirtualNodes()
                      throws ProActiveException
Specified by:
listVirtualNodes in interface ProActiveRuntime
ProActiveException

getNodePolicyServer

public PolicyServer getNodePolicyServer(java.lang.String nodeName)
                                 throws ProActiveException
Specified by:
getNodePolicyServer in interface ProActiveRuntime
ProActiveException

enableSecurityIfNeeded

public void enableSecurityIfNeeded()
                            throws ProActiveException
Description copied from interface: ProActiveRuntime
sets all needed modifications to enable security components MUST be called when the descriptor is ready

Specified by:
enableSecurityIfNeeded in interface ProActiveRuntime
ProActiveException

getNodeCertificate

public java.security.cert.X509Certificate getNodeCertificate(java.lang.String nodeName)
                                                      throws ProActiveException
Specified by:
getNodeCertificate in interface ProActiveRuntime
Parameters:
nodeName -
Returns:
return certificate associated to the node designed by nodeName
ProActiveException

getEntities

public java.util.ArrayList getEntities(java.lang.String nodeName)
                                throws ProActiveException
Specified by:
getEntities in interface ProActiveRuntime
Parameters:
nodeName -
Returns:
returns all entities associated to the node
ProActiveException

getEntities

public java.util.ArrayList getEntities(UniversalBody uBody)
                                throws ProActiveException
Specified by:
getEntities in interface ProActiveRuntime
Returns:
returns all entities associated to the node
ProActiveException

getEntities

public java.util.ArrayList getEntities()
                                throws ProActiveException
Specified by:
getEntities in interface ProActiveRuntime
Returns:
returns all entities associated to this runtime
ProActiveException

getJobID

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

getJobID

public java.lang.String getJobID(java.lang.String nodeUrl)
                          throws ProActiveException
Specified by:
getJobID in interface ProActiveRuntime
Returns:
the jobId of the node with the given name
Throws:
ProActiveException

createRemoteProActiveRuntime

protected RemoteProActiveRuntime createRemoteProActiveRuntime()
                                                       throws ibis.rmi.RemoteException,
                                                              ibis.rmi.AlreadyBoundException
ibis.rmi.RemoteException
ibis.rmi.AlreadyBoundException


Copyright © April 2004 INRIA All Rights Reserved.