org.objectweb.proactive.core.runtime
Class RuntimeFactory

java.lang.Object
  extended byorg.objectweb.proactive.core.runtime.RuntimeFactory
Direct Known Subclasses:
HttpRuntimeFactory, IbisRuntimeFactory, JiniRuntimeFactory, RmiRuntimeFactory

public abstract class RuntimeFactory
extends java.lang.Object

The RuntimeFactory provides a generic way to create and lookup ProActiveRuntime without protocol specific code (such as RMI, HTTP, IBIS, RMI/SSH, JINI).

RuntimeFactory provides a set of static methods to create and lookup ProActiveRuntime and to associate protocol specific factory to concrete protocols. To create a proActiveRuntime it is only necessary to associate the protocol as parameter. For instance :

                 RuntimeFactory.getProtocolSpecificRuntime("rmi");
                 RuntimeFactory.getProtocolSpecificRuntime("jini");
 

As long as a protocol specific factory has been registered to this RuntimeFactory for the given protocol, the creation of the ProActiveRuntime will be delegated to the right factory.

This class also provide the concept of default protocol and default ProActiveRuntime. When an active object is created in the local JVM but without being attached to any node , a default node is created in the default ProActiveRuntime(with the default protocol) associated with the JVM to hold that active object.

Since:
ProActive 0.9
Version:
1.0, 2002/08/28
Author:
ProActive Team

Field Summary
static org.apache.log4j.Logger runtimeLogger
           
static boolean XMLHTTP_ENABLED
           
 
Constructor Summary
RuntimeFactory()
           
 
Method Summary
protected abstract  ProActiveRuntimeAdapterImpl createRuntimeAdapter()
          Creates a new Adapter
protected  ProActiveRuntimeAdapterImpl createRuntimeAdapter(RemoteProActiveRuntime remoteProActiveRuntime)
          Creates an Adapter for the given RemoteProActiveRuntime
static ProActiveRuntime getDefaultRuntime()
          Returns the reference of the only one instance of the default ProActiveRuntime associated with the local JVM.
static ProActiveRuntime getProtocolSpecificRuntime(java.lang.String protocol)
          Returns the reference of the only one instance of the ProActiveRuntime created with the given protocol, associated with the local JVM.
protected abstract  ProActiveRuntime getProtocolSpecificRuntimeImpl()
          Returns the reference of the only one instance of the ProActiveRuntime associated with the local JVM.
protected abstract  ProActiveRuntime getRemoteRuntimeImpl(java.lang.String s)
          Returns the reference to the proActiveRuntime located at s
static ProActiveRuntime getRuntime(java.lang.String proActiveRuntimeURL, java.lang.String protocol)
          Returns a reference to the ProActiveRuntime created with the given protocol and located at the given url.This url can be either local or remote
static boolean isRuntimeLocal(ProActiveRuntime proActiveRuntime)
          Returns true if the given proActiveRuntime belongs to this JVM false else.
static void setFactory(java.lang.String protocol, RuntimeFactory factoryObject)
          Associates the factory of class factoryClassName as the factory to create proactiveRuntime for the given protocol.
static void setFactory(java.lang.String protocol, java.lang.String factoryClassName)
          Associates the factory of class factoryClassName as the factory to create proactiveRuntime for the given protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runtimeLogger

public static org.apache.log4j.Logger runtimeLogger

XMLHTTP_ENABLED

public static boolean XMLHTTP_ENABLED
Constructor Detail

RuntimeFactory

public RuntimeFactory()
Method Detail

setFactory

public static void setFactory(java.lang.String protocol,
                              java.lang.String factoryClassName)
Associates the factory of class factoryClassName as the factory to create proactiveRuntime for the given protocol. Replaces any previous association.

Parameters:
protocol - the protocol to associate the factory to
factoryClassName - the fully qualified name of the class of the factory responsible of creating the proActiveRuntime for that protocol

setFactory

public static void setFactory(java.lang.String protocol,
                              RuntimeFactory factoryObject)
Associates the factory of class factoryClassName as the factory to create proactiveRuntime for the given protocol. Replaces any previous association.

Parameters:
protocol - the protocol to associate the factory to
factoryObject - the class of the factory responsible of creating the proactiveRuntime for that protocol

isRuntimeLocal

public static boolean isRuntimeLocal(ProActiveRuntime proActiveRuntime)
Returns true if the given proActiveRuntime belongs to this JVM false else.

Returns:
true if the given proActiveRuntime belongs to this JVM false else

getDefaultRuntime

public static ProActiveRuntime getDefaultRuntime()
                                          throws ProActiveException
Returns the reference of the only one instance of the default ProActiveRuntime associated with the local JVM. If this runtime does not yet exist, it creates it with the default protocol.

Returns:
The only one ProActiveRuntime associated with the local JVM
Throws:
ProActiveException - if the default runtime cannot be created

getProtocolSpecificRuntime

public static ProActiveRuntime getProtocolSpecificRuntime(java.lang.String protocol)
                                                   throws ProActiveException
Returns the reference of the only one instance of the ProActiveRuntime created with the given protocol, associated with the local JVM. If this runtime does not yet exist, it creates it with the given protocol.

Parameters:
protocol -
Returns:
ProActiveRuntime
Throws:
ProActiveException - if this ProActiveRuntime cannot be created

getRuntime

public static ProActiveRuntime getRuntime(java.lang.String proActiveRuntimeURL,
                                          java.lang.String protocol)
                                   throws ProActiveException
Returns a reference to the ProActiveRuntime created with the given protocol and located at the given url.This url can be either local or remote

Parameters:
proActiveRuntimeURL -
protocol -
Returns:
ProActiveRuntime
Throws:
ProActiveException - if the runtime cannot be found

createRuntimeAdapter

protected ProActiveRuntimeAdapterImpl createRuntimeAdapter(RemoteProActiveRuntime remoteProActiveRuntime)
                                                    throws ProActiveException
Creates an Adapter for the given RemoteProActiveRuntime

Parameters:
remoteProActiveRuntime - object we will create an Adapter for
Returns:
the newly created Adpater for the given RemoteProActiveRuntime
Throws:
ProActiveException - if a pb occurs during the creation

getProtocolSpecificRuntimeImpl

protected abstract ProActiveRuntime getProtocolSpecificRuntimeImpl()
                                                            throws ProActiveException
Returns the reference of the only one instance of the ProActiveRuntime associated with the local JVM. If this runtime does not yet exist, it creates it with the associated protocol.

Returns:
ProActiveRuntime
Throws:
ProActiveException - if this ProActiveRuntime cannot be created

getRemoteRuntimeImpl

protected abstract ProActiveRuntime getRemoteRuntimeImpl(java.lang.String s)
                                                  throws ProActiveException
Returns the reference to the proActiveRuntime located at s

Throws:
ProActiveException

createRuntimeAdapter

protected abstract ProActiveRuntimeAdapterImpl createRuntimeAdapter()
                                                             throws ProActiveException
Creates a new Adapter

Returns:
the newly created Adapter
Throws:
ProActiveException - if a pb occurs during the creation


Copyright 2001-2005 INRIA All Rights Reserved.