jpl.mipl.pgs.jbpm.standalone
Class DefaultStdController

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.activation.Activatable
              extended by jpl.mipl.pgs.core.ActivatableServerBase
                  extended by jpl.mipl.pgs.jbpm.standalone.DefaultStdController
All Implemented Interfaces:
Serializable, Remote, Controller_IF, ProcessControl_IF, ServerBase_IF, StandaloneController_IF

public class DefaultStdController
extends ActivatableServerBase
implements StandaloneController_IF

Default implementation of the StandaloneController_IF interface. This is a light weight implementation of the Controller_IF class. This class provides similar functionality as the Controller class. The main difference is that this class runs all pipelines on single machine, namely the machine on which the instance of this class is running.
Implementation Hints:
The default execution engine, JBPMExeEngine, starts the controller in a separate thread but it does not associate any thread groups with the controller thread. It is a wise idea thus for completely new implementation of the StandaloneController_IF to catch Throwable instead of just exception to avoid thread death.


      Copyright 2004-present, California Institute of Technology.
      ALL RIGHTS RESERVED.
      U.S. Government Sponsorship acknowledge.
  

Author:
Raj Patel {rrp@jpl.nasa.gov}
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class jpl.mipl.pgs.core.ActivatableServerBase
currentStatus, mission, serverName, startUpData, userPassWd
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface jpl.mipl.pgs.jbpm.standalone.StandaloneController_IF
STDCONTROLLER_SERVER_NAME
 
Constructor Summary
protected DefaultStdController(ActivationID activationid, MarshalledObject marshalledobject)
          Create a JBPM execution engine using the scheduler class as specified by JVM environment variable SCHEDULER_CLASS_NAME.
 
Method Summary
 void abort(String processName, Long pIID, String reason)
          Abort the specified process instance.
 void addSF(PGSSession session, ServiceFactory_IF sf)
          No-Op
 void configure(PGSSession session, Map newConfiguration)
          No-Op
 String doCommand(PGSSession session, Map command)
          Pass the command to scheduler.
 PersistentStore_IF getReferenceToPS()
          For obtaining reference to PS.
 int getStatus()
          Always returns 0.
 void pause(String processName, Long pIID, String reason, String nodeName)
          Pause either all or specified process instance.
 void releaseRequest(PGSSession session, Map request)
          Runs the request in separate thread.
 void removeSF(PGSSession session, long sfid)
          No-OP
 void requestCompleted(jpl.mipl.pgs.jbpm.standalone.SimpleRequestRunner rr)
          Called by the SimpleRequestRunner to indicate request completion.
 void resume(String processName, Long pIID, String nodeName)
          Resume the specified process instance.
 boolean shutdown(PGSSession session, String explanation, boolean forceExit)
          Shutdown this engine.
 void stop(String processName, Long pIID, String reason)
          Stop the specified process instance.
 void uncaughtException(Thread t, Throwable e)
          Called by the thread group associated with the threads used in this class to report exceptions not caught by the threads.
 
Methods inherited from class jpl.mipl.pgs.core.ActivatableServerBase
shutDown
 
Methods inherited from class java.rmi.activation.Activatable
exportObject, exportObject, exportObject, exportObject, getID, inactive, register, unexportObject, unregister
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

DefaultStdController

protected DefaultStdController(ActivationID activationid,
                               MarshalledObject marshalledobject)
                        throws Exception
Create a JBPM execution engine using the scheduler class as specified by JVM environment variable SCHEDULER_CLASS_NAME. Please see shutdown(PGSSession, String, boolean) for implementation hints of scheduler.

Throws:
Exception
Method Detail

shutdown

public boolean shutdown(PGSSession session,
                        String explanation,
                        boolean forceExit)
                 throws RemoteException
Shutdown this engine.

Specified by:
shutdown in interface ServerBase_IF
Specified by:
shutdown in class ActivatableServerBase
Parameters:
session - A valid PGSSession
explanation - An explanation for shutting down the engine.
forceExit - If true, each pipeline is aborted. If false, each pipeline is stopped. Note:If this method is called from outside this class (i.e., the main process of this class), than the calling method is responsible for shutting down the main process. For example, after calling this method, the scheduler class should call System.exit to ensure proper shutdown of the engine.
Throws:
RemoteException - If the user is not authorized or an error occurs in shutdown.

getStatus

public int getStatus()
              throws RemoteException
Always returns 0.

Specified by:
getStatus in interface ServerBase_IF
Overrides:
getStatus in class ActivatableServerBase
Throws:
RemoteException

addSF

public void addSF(PGSSession session,
                  ServiceFactory_IF sf)
           throws RemoteException
No-Op

Specified by:
addSF in interface Controller_IF
Parameters:
session - A valid session as created by using the persistent store interface.
sf - the service factory to be added.
Throws:
RemoteException - if the user is not an authorized user or if an exception is received from the activation system.

removeSF

public void removeSF(PGSSession session,
                     long sfid)
              throws RemoteException
No-OP

Specified by:
removeSF in interface Controller_IF
Parameters:
session - A valid session as created by using the persistent store interface.
sfid - the service factory to be removed.
Throws:
RemoteException - if the user is not an authorized user or if an exception is received from the activation system.

configure

public void configure(PGSSession session,
                      Map newConfiguration)
               throws RemoteException
No-Op

Specified by:
configure in interface Controller_IF
Parameters:
session - A valid session as created by using the persistent store interface.
newConfiguration - A hashtable containing any of the parameters in the startup data. jpl.mipl.pgs.utils.UPF.MONITOR_FREQUENCY NOTE: The current implementation does not user perstore for storing/retrieving the configuration information. Thus, in event of server startup, old values will be used. This will change.
Throws:
RemoteException

pause

public void pause(String processName,
                  Long pIID,
                  String reason,
                  String nodeName)
           throws RemoteException
Description copied from interface: ProcessControl_IF
Pause either all or specified process instance. Any null parameters are ignored.

Specified by:
pause in interface ProcessControl_IF
Parameters:
processName - the name of the process that is to be stopped.
pIID - the ID of the process instance that is to be stopped.
reason - an explanation, if appropriate, for the puase.
nodeName - the name of the node where the process is to pause.
Throws:
RemoteException - if the given process instance is not in this engine's list.
See Also:
ProcessControl_IF.pause(java.lang.String, java.lang.Long, java.lang.String, java.lang.String)

resume

public void resume(String processName,
                   Long pIID,
                   String nodeName)
            throws RemoteException
Description copied from interface: ProcessControl_IF
Resume the specified process instance. See #pause for parameter documentation.

Specified by:
resume in interface ProcessControl_IF
Throws:
RemoteException - if the given process instance is not in this engine's list.
See Also:
ProcessControl_IF.resume(java.lang.String, java.lang.Long, java.lang.String)

stop

public void stop(String processName,
                 Long pIID,
                 String reason)
          throws RemoteException
Description copied from interface: ProcessControl_IF
Stop the specified process instance. See #pause for parameter documentation.

Specified by:
stop in interface ProcessControl_IF
Throws:
RemoteException - if the given process instance is not in this engine's list.
See Also:
ProcessControl_IF.stop(java.lang.String, java.lang.Long, java.lang.String)

abort

public void abort(String processName,
                  Long pIID,
                  String reason)
           throws RemoteException
Description copied from interface: ProcessControl_IF
Abort the specified process instance. See #pause for parameter documentation.

Specified by:
abort in interface ProcessControl_IF
Throws:
RemoteException - if the given process instance is not in this engine's list.
See Also:
ProcessControl_IF.abort(java.lang.String, java.lang.Long, java.lang.String)

getReferenceToPS

public PersistentStore_IF getReferenceToPS()
                                    throws RemoteException
For obtaining reference to PS. NOTE:

Specified by:
getReferenceToPS in interface StandaloneController_IF
Returns:
reference to a persistent store object.
Throws:
Exception
RemoteException

releaseRequest

public void releaseRequest(PGSSession session,
                           Map request)
                    throws NoRunningSF,
                           RequestRejected,
                           RemoteException
Runs the request in separate thread. This method is supposed to be called by scheduler.

Specified by:
releaseRequest in interface Controller_IF
Parameters:
session - A valid PGS session object
request - The request parameters
Throws:
RemoteException - if there is an error obtaining reference to PS (if perstor is in use) or error creating process runner.
NoRunningSF - thrown when there are no running SF. RequestRejected thrown when non of the running SF can handle this request. RemoteException unexpected error
RequestRejected

requestCompleted

public void requestCompleted(jpl.mipl.pgs.jbpm.standalone.SimpleRequestRunner rr)
Called by the SimpleRequestRunner to indicate request completion.

Specified by:
requestCompleted in interface StandaloneController_IF

uncaughtException

public void uncaughtException(Thread t,
                              Throwable e)
Called by the thread group associated with the threads used in this class to report exceptions not caught by the threads. These exceptions are emailed using the email logger as described in the class documentation of this class.


doCommand

public String doCommand(PGSSession session,
                        Map command)
                 throws RemoteException
Pass the command to scheduler. Session parameter is not used. Note:This method is called by the engine internally to notify the scheduler the number of running pipelines each time a pipeline completes.

Specified by:
doCommand in interface Controller_IF
Throws:
RemoteException