org.objectweb.proactive.core.runtime
Class RuntimeFactory

java.lang.Object
  |
  +--org.objectweb.proactive.core.runtime.RuntimeFactory
Direct Known Subclasses:
JiniRuntimeFactory, RemoteRuntimeFactory, RemoteRuntimeFactory

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 or 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 boolean IBIS_ENABLED
           
static boolean JINI_ENABLED
           
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
RuntimeFactory()
           
 
Method Summary
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

logger

protected static org.apache.log4j.Logger logger

JINI_ENABLED

public static boolean JINI_ENABLED

IBIS_ENABLED

public static boolean IBIS_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.


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.


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

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

ProActiveException


Copyright © April 2004 INRIA All Rights Reserved.