SmartFrog 3.10.000

org.smartfrog.sfcore.processcompound
Class SFProcess

java.lang.Object
  extended by org.smartfrog.sfcore.processcompound.SFProcess
All Implemented Interfaces:
MessageKeys

public class SFProcess
extends java.lang.Object
implements MessageKeys

Access point to the single allowed process compound for a VM. It holds the single instance of the process compound. It also knows how to get a process compound from a given host and process name by forwarding the request to the process compound on that host. Thirdly it maintains a root locator which knows how to make a process compound the root process compound for a host, and to get a root process compound.


Field Summary
protected static ProcessCompound processCompound
          Single instance of process compound for this process
protected static ComponentDescription processCompoundDescription
          processCompound description
protected static Reference refProcessCompound
          Reference to process compound.
protected static Reference refRootLocatorClass
          Reference to root locator class.
protected static RootLocator rootLocator
          Root locator to get and set the root process compound for this HOST
 
Fields inherited from interface org.smartfrog.sfcore.common.MessageKeys
CANNOT_LINK_TO_PREDICATE, COMPONENT_TERMINATED, COPY_FAILED, COPY_SERIALIZE_FAILED, ERROR_NO_SECURITY_BUT_REQUIRED, ILLEGAL_BOOLEAN_PARAMETER, ILLEGAL_NUMERIC_PARAMETER, ILLEGAL_STRING_PARAMETER, ILLEGAL_VECTOR_PARAMETER, LIVENESS_SEND_FAILURE, LIVENESS_SEND_FAILURE_IN, MISSING_PARAMETER, MSG_CLASS_NOT_FOUND, MSG_CONNECT_ERR, MSG_CONT_OTHER_DEPLOY, MSG_DEPLOY_COMP_TERMINATED, MSG_DEPLOY_SUCCESS, MSG_DEPLOYWITH_PHASE_FAILED, MSG_DETACH_SUCCESS, MSG_DETACH_TERMINATE_SUCCESS, MSG_ERR_DEPLOY_FROM_URL, MSG_ERR_PARSE, MSG_ERR_RESOLVE_PHASE, MSG_ERR_SF_RUNNING, MSG_ERR_TERM, MSG_FAILED_INET_ADDRESS_LOOKUP, MSG_FAILED_TO_CONTACT_PARENT, MSG_FILE_NOT_FOUND, MSG_HOOK_ACTION_FAILED, MSG_ILLEGAL_ACCESS, MSG_ILLEGAL_CLASS_TYPE, MSG_ILLEGAL_CLASS_TYPE_EXPECTING_GOT, MSG_ILLEGAL_REFERENCE, MSG_INPUTSTREAM_NULL, MSG_INSTANTIATION_ERROR, MSG_INVALID_OBJECT_TYPE, MSG_INVOCATION_TARGET, MSG_LANG_NOT_FOUND, MSG_LIVENESS_START_FAILED, MSG_LOADING_URL, MSG_METHOD_NOT_FOUND, MSG_NON_REP_ATTRIB, MSG_NOT_COMPONENT_REFERENCE, MSG_NOT_FOUND_ATTRIBUTE, MSG_NOT_FOUND_REFERENCE, MSG_NOT_VALUE_REFERENCE, MSG_NULL_DEF_METHOD, MSG_NULL_URL, MSG_OBJECT_REGISTRATION_FAILED, MSG_PARENT_LOCATION_FAILED, MSG_PING_SUCCESS, MSG_RANDM_ERR, MSG_REMOTE_CONNECT_ERR, MSG_REPEATED_ATTRIBUTE, MSG_SF_DEAD, MSG_SF_READY, MSG_SF_TERMINATED, MSG_STACKTRACE_FOLLOWS, MSG_START_COMP_TERMINATED, MSG_TERMINATE_SUCCESS, MSG_UNHANDLED_EXCEPTION, MSG_UNKNOWN_HOST, MSG_UNRESOLVED_REFERENCE, MSG_UNRESOLVED_REFERENCE_IN, MSG_UPDATE_SUCCESS, MSG_URL_NOT_FOUND, MSG_URL_TO_PARSE_NOT_FOUND, MSG_WARNING_LIVENESS_ENABLED, MSG_WARNING_STACKTRACE_DISABLED, MSG_WARNING_STACKTRACE_ENABLED, ROOT_MUST_BE_COMPONENT, WARN_NO_SECURITY
 
Method Summary
static void addDefaultProcessDescriptions(ComponentDescription compDesc)
           
protected static Prim deployComponent(ComponentDescription comp)
          Deploys given component description.
static ProcessCompound deployProcessCompound(boolean addShutdownHook)
          Deploys the local process compound, if not already there
static ComponentDescription getCoreProcessCompoundDescription()
          Gets the core description for process compound out of processcompound.sf.
static ProcessCompound getProcessCompound()
          Returns the process local process compound.
static ComponentDescription getProcessCompoundDescription()
          Gets the description for the process compound.
static RootLocator getRootLocator()
          Gets the root locator for this process.
static ProcessCompound resetRootProcessCompound(Reference terminatorCompleteName)
          Resets the root process compound
static void setProcessCompound(ProcessCompound pc)
          Sets the single instance of process compound for this process.
static void setProcessCompoundDescription(ComponentDescription descr)
          Sets the description which will create the process compound if it has not already been created
static void setRootLocator(RootLocator c)
          Sets the root locator for this process.
static ProcessCompound sfSelectTargetProcess(java.net.InetAddress host, java.lang.String subProcess)
          Select target process compound using host InetAddress and subprocess name
static ProcessCompound sfSelectTargetProcess(java.lang.String host, java.lang.String subProcess)
          Select target process compound using host and subprocess names
protected static Prim startComponent(Prim comp)
          Starts given component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

processCompound

protected static ProcessCompound processCompound
Single instance of process compound for this process


processCompoundDescription

protected static ComponentDescription processCompoundDescription
processCompound description


rootLocator

protected static RootLocator rootLocator
Root locator to get and set the root process compound for this HOST


refRootLocatorClass

protected static final Reference refRootLocatorClass
Reference to root locator class.


refProcessCompound

protected static final Reference refProcessCompound
Reference to process compound.

Method Detail

setRootLocator

public static void setRootLocator(RootLocator c)
                           throws java.lang.Exception
Sets the root locator for this process. The root locator will be used to set the root proces compound for this host and get a root process compound for other hosts. The root locator can only be set once.

Parameters:
c - root locator to use.
Throws:
java.lang.Exception - if failed to set root locator

setProcessCompound

public static void setProcessCompound(ProcessCompound pc)
                               throws java.lang.Exception
Sets the single instance of process compound for this process. The ProcessCompound can only be set once.

Parameters:
pc - root locator to use.
Throws:
java.lang.Exception - if failed to set process compound

getRootLocator

public static RootLocator getRootLocator()
                                  throws SmartFrogException,
                                         java.rmi.RemoteException
Gets the root locator for this process. If the root locator is not set a default root locator is created and returned based on the sfRootLocatorClass system property (offset by propBase). Default root locator is the DefaultRootLocatorImpl.

Returns:
root locator for this process
Throws:
java.rmi.RemoteException - In case of network/rmi error
SmartFrogDeploymentException - In case of any error while deploying the component
SmartFrogException

getProcessCompound

public static ProcessCompound getProcessCompound()
Returns the process local process compound.

Returns:
host process compound

deployComponent

protected static Prim deployComponent(ComponentDescription comp)
                               throws SmartFrogException,
                                      java.rmi.RemoteException
Deploys given component description. First does a type and deploy resolution step. If any error occurs on deployment the component is terminated

Parameters:
comp - description of component that is to be deployed
Returns:
Prim
Throws:
SmartFrogException - Failed to deploy component
java.rmi.RemoteException - trouble on the wire

startComponent

protected static Prim startComponent(Prim comp)
                              throws java.lang.Exception
Starts given component. If any errors occur on start the component is terminated.

Parameters:
comp - component to start
Returns:
started deployed component
Throws:
java.lang.Exception - if failed to start component

addDefaultProcessDescriptions

public static void addDefaultProcessDescriptions(ComponentDescription compDesc)
                                          throws SmartFrogException,
                                                 java.rmi.RemoteException
Throws:
SmartFrogException
java.rmi.RemoteException

deployProcessCompound

public static ProcessCompound deployProcessCompound(boolean addShutdownHook)
                                             throws SmartFrogException,
                                                    java.rmi.RemoteException
Deploys the local process compound, if not already there

Parameters:
addShutdownHook - flag to enable shutdown hook listening
Returns:
local process compound
Throws:
SmartFrogException - if failed to deploy process compound
java.rmi.RemoteException

resetRootProcessCompound

public static ProcessCompound resetRootProcessCompound(Reference terminatorCompleteName)
                                                throws SmartFrogException,
                                                       java.rmi.RemoteException
Resets the root process compound

Parameters:
terminatorCompleteName - reference of terminatorCompleteName
Returns:
new root process compound
Throws:
SmartFrogException - if failed to deploy process compound, the root process compound didn't exist or ir the local process compound is not a root process compound
java.rmi.RemoteException

getProcessCompoundDescription

public static ComponentDescription getProcessCompoundDescription()
                                                          throws SmartFrogException,
                                                                 java.rmi.RemoteException
Gets the description for the process compound. Retrieves the default description out of processcompound.sf. Then allows overrides from any system property starting with the contents of the propBase variable. The description is type and deployResolved. Since system properties do not handle numbers, the number representation for system properties is restricted to doubles. For each value in the targetted system properties conversion is attempted to a number.

Returns:
component description for process compound
Throws:
SmartFrogException - failed to create description
java.rmi.RemoteException - In case of network/rmi error

getCoreProcessCompoundDescription

public static ComponentDescription getCoreProcessCompoundDescription()
                                                              throws SmartFrogException,
                                                                     java.rmi.RemoteException
Gets the core description for process compound out of processcompound.sf.

Returns:
process compound description type and deployResolved
Throws:
java.rmi.RemoteException - In case of network/rmi error
SmartFrogRuntimeException - In case of SmartFrog system error
SmartFrogException

setProcessCompoundDescription

public static void setProcessCompoundDescription(ComponentDescription descr)
Sets the description which will create the process compound if it has not already been created

Parameters:
descr - description to maintain

sfSelectTargetProcess

public static ProcessCompound sfSelectTargetProcess(java.lang.String host,
                                                    java.lang.String subProcess)
                                             throws SmartFrogException,
                                                    java.rmi.RemoteException
Select target process compound using host and subprocess names

Parameters:
host - host name. If null, assumes localhost.
subProcess - subProcess name (optional; can be null)
Returns:
ProcessCompound the target process compound
Throws:
SmartFrogException - In case of SmartFrog system error
java.rmi.RemoteException

sfSelectTargetProcess

public static ProcessCompound sfSelectTargetProcess(java.net.InetAddress host,
                                                    java.lang.String subProcess)
                                             throws SmartFrogException,
                                                    java.rmi.RemoteException
Select target process compound using host InetAddress and subprocess name

Parameters:
host - host InetAddress object. If null, assumes localhost.
subProcess - subProcess name (optional; can be null)
Returns:
ProcessCompound the target process compound
Throws:
SmartFrogException - In case of SmartFrog system error
java.rmi.RemoteException

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP