jpl.mipl.pgs.core
Class Controller

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.core.Controller
All Implemented Interfaces:
Serializable, Remote, Controller_IF, ProcessControl_IF, ServerBase_IF

public class Controller
extends ActivatableServerBase
implements Controller_IF

The Controller is responsible for scheduling requests to appropriate Service Factory, while performing load balancing among service factories. It also monitors service factories for overall system integrity and functioning.

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

Author:
Raj Patel (rrp@mipl.jpl.nasa.gov)
See Also:
Serialized Form

Nested Class Summary
static class Controller.ThreadGroupNotifier
           
 
Field Summary
static long serialVersionUID
           
 
Fields inherited from class jpl.mipl.pgs.core.ActivatableServerBase
currentStatus, logger, mission, serverName, startUpData, userPassWd
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Controller(ActivationID activationid, MarshalledObject marshalledobject)
          Constructs a Controller.
 
Method Summary
 void abort(String processName, Long pIID, String reason)
          Abort the specified process instance.
 void addSF(PGSSession tsession, ServiceFactory_IF sf)
          For adding the given Service Factory to Controller's list.
 void configure(PGSSession tsession, Map ht)
          For updating Controller's configuration.
 String doCommand(PGSSession tsession, Map command)
          Pass the command to scheduler.
 void pause(String processName, Long pIID, String reason, String nodeName)
          Pause either all or specified process instance.
 void reassingRequests(long sfid)
          No-Op.
 void releaseRequest(Map request)
           
 void releaseRequest(PGSSession tsession, Map request)
          Runs the given request.
 void removeSF(PGSSession tsession, long sfid)
          Removes the Service Factory identified with sfId from the list.
 void resume(String processName, Long pIID, String nodeName)
          Resume the specified process instance.
 boolean shutdown(PGSSession tsession, String explanation, boolean forceExit)
          Stops this server.
 void stop(String processName, Long pIID, String reason)
          Stop the specified process instance.
 
Methods inherited from class jpl.mipl.pgs.core.ActivatableServerBase
getStatus, 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
 
Methods inherited from interface jpl.mipl.pgs.core.ServerBase_IF
getStatus
 

Field Detail

serialVersionUID

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

Controller

public Controller(ActivationID activationid,
                  MarshalledObject marshalledobject)
           throws ActivationException,
                  RemoteException
Constructs a Controller.

Parameters:
activationid - The usual.
marshalledobject - A marshalled object containing the serialized Configuration file (UPF).
Throws:
ActivationException
RemoteException
See Also:
for details.
Method Detail

configure

public void configure(PGSSession tsession,
                      Map ht)
               throws RemoteException
Description copied from interface: Controller_IF
For updating Controller's configuration. This method also invokes configure method on scheduler.

Specified by:
configure in interface Controller_IF
Parameters:
tsession - A valid session as created by using the persistent store interface.
ht - 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

shutdown

public boolean shutdown(PGSSession tsession,
                        String explanation,
                        boolean forceExit)
                 throws RemoteException
Description copied from class: ActivatableServerBase
Stops this server. Any call to the server after shutdown will result in RMI exception.

Specified by:
shutdown in interface ServerBase_IF
Specified by:
shutdown in class ActivatableServerBase
Parameters:
tsession - A valid session created by the persistent store interface.
explanation - A human readable explanation for shutting down the server.
forceExit - if true, exit without completing any pending work.
Throws:
RemoteException - If the user is not authorized or an error occurs in shutdown.

reassingRequests

public void reassingRequests(long sfid)
No-Op. Couldn't decide wheather this is a good idea. The project may not want to restart requests until some clean-up.


removeSF

public void removeSF(PGSSession tsession,
                     long sfid)
              throws RemoteException
Removes the Service Factory identified with sfId from the list.

Specified by:
removeSF in interface Controller_IF
Parameters:
tsession -
sfid - The id of the service factory that is to be removed from the list.
Throws:
RemoteException - If the user is not authorized or the sfId is invalid.

addSF

public void addSF(PGSSession tsession,
                  ServiceFactory_IF sf)
           throws RemoteException
Description copied from interface: Controller_IF
For adding the given Service Factory to Controller's list.

Specified by:
addSF in interface Controller_IF
Parameters:
tsession - 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.

releaseRequest

public final void releaseRequest(Map request)
                          throws RemoteException
Throws:
RemoteException
See Also:
releaseRequest(PGSSession,Map)

doCommand

public String doCommand(PGSSession tsession,
                        Map command)
                 throws RemoteException
Description copied from interface: Controller_IF
Pass the command to scheduler.

Specified by:
doCommand in interface Controller_IF
Throws:
RemoteException

releaseRequest

public final void releaseRequest(PGSSession tsession,
                                 Map request)
                          throws NoRunningSF,
                                 RequestRejected,
                                 RemoteException
Runs the given request.

Specified by:
releaseRequest in interface Controller_IF
Parameters:
tsession - A valid PGSSession object.
request - A map containing the UPF content that specifies which ProcessDefinition or ProcessInstance is to be executed
Throws:
NoRunningSF - if there aren't any running SF that can handle this request or the request parameter contains SFID, the ID of the service factory that is to be used for running this request and that SF is no longer available.
RequestRejected - if between asking the SF that it can handle this request and dispatching to SF an error occurs (such as SF is shutting down).
RemoteException - For generic errors.

pause

public void pause(String processName,
                  Long pIID,
                  String reason,
                  String nodeName)
           throws RemoteException
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 pause.
nodeName - the name of the node where the process is to pause. The algorithm is as follows: -- if process id is not null, then pause it at the specified node. -- else if process name is not null, then pause all processes with that given name at the specified node -- else pause all process instances.
Throws:
RemoteException

resume

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

Specified by:
resume in interface ProcessControl_IF
Throws:
RemoteException

stop

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

Specified by:
stop in interface ProcessControl_IF
Throws:
RemoteException

abort

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

Specified by:
abort in interface ProcessControl_IF
Throws:
RemoteException