OCSEPICS
Class EPICSAction

java.lang.Object
  extended by java.util.TimerTask
      extended by OCSEPICS.EPICSAction
All Implemented Interfaces:
FourMSControllerInterfaces.SubActionOperations, java.lang.Runnable, CAEventListener
Direct Known Subclasses:
OCSAction

public abstract class EPICSAction
extends java.util.TimerTask
implements FourMSControllerInterfaces.SubActionOperations, CAEventListener, java.lang.Runnable

This will be used as a base class for EPICS related actions. This is an abstract class. It provides the base functionality expected of a EPICS action and inherits the standard ICS action interface which will be used to invoke the action from a remote CORBA client. The EPICS action layers above a set of process variables (PV) which are associated with the mechanism which is to be controlled. These PVs will be used to command the mechanism to do something and then read back the status of the mechanism so that the action can ascertain if the action been completed successfully or not.

Version:
1.0
Author:
Craige Bevil

Field Summary
protected  java.util.Hashtable<java.lang.String,ProcessVariable> ActionRelatedPVs
          These are the PVs which are associated with the action.
protected  java.lang.String ClstatPV
          This is the name of the PV which wil be used used to hold the state of the mechanism control status.
protected  java.lang.String CommPV
          This is the PV which will hold the command to be executed from the user.
protected  java.lang.String CommStatPV
          This is the PV into which the EPICS system will write whether the command which was entered is actually OK or not.
protected  java.lang.String CommStrPV
          This is the PV associated with any error which is associated with the comamnd validation status.
protected  OCSCORBAHelper CORBAHelper
          This will be used to perform OCS CORBA related tasks
protected  java.lang.String CurrentPositionPV
          This is the PV which contains the current position of the mechanism
protected  java.lang.String DemandPV
          This is the PV into which the demand value for a given action should be written.
protected  java.lang.String ErrStrPV
          This PV holds the error description string for the mechanism
protected  int ExpectedNumberOfSubactionArguments
          This is the expected number of arguments which will be passed from the client when this subaction is started
protected  java.lang.String InstrumentName
          This is the name of the instrument with which this action is associated.
protected  java.lang.String IOCAction
          This is the name of the IOC action which is associated with this subaction
(package private)  OCSEPICSConsts.IOCSubactionStateType iocActionState
          This is the state of the underlying IOC action which this action supports.
protected  OCSEPICSConsts.SubactionCompletionStates LastSubactionCompletionState
          Completion state of the last subaction which was executed.
protected  java.lang.String MechName
          This is the name of the mechanism with which this subaction is associated.
protected  java.lang.String MechStatPV
          This PV holds the mechanism status
protected  FourMS.FourMSParameterConverter ParameterConvertor
          This will be used by the PV class to convert between engineering and logical units.
protected  int SecondsBeforeTimeout
          This holds the amount of time that a subaction has to go before it timesout,this is reset when an action is started and the value which is used is normally determined by the timeout PV which is contained with the IOC.
protected  FourMSControllerInterfaces.SubActionCompletionListener SubActionInitiatorCB
          This is a reference to the last object that initiated this subaction.
protected  java.lang.String SubactionName
          This is the name of the subaction.
protected  OCSEPICSConsts.SubactionStateType SubactionState
          This attribute relects the current state of the subaction whether it be active or idle.
protected  int SubactionTimeout
          This is the timeout which is associated with the subaction
protected  java.util.Timer SubActionTimer
          This is a timer object which will be used for scheduling timer based operations on the subaction.
protected  MessageHandler SyslogMessageHandler
          This will be used for reporting things to the syslog
protected  java.lang.String TimeoutPV
          This is the PV which holds the timeout value which is associated with a particular action
 
Fields inherited from interface OCSEPICS.CAEventListener
UnitOfInterest
 
Constructor Summary
EPICSAction(MessageHandler SyslogMessageHandler, java.lang.String SubactionName, java.lang.String MechName, java.lang.String InstrumentName, java.util.Hashtable<java.lang.String,ProcessVariable> ActionRelatedPVs, OCSCORBAHelper CORBAHelper, FourMS.FourMSParameterConverter ParameterConvertor)
          This is the main constructor for the class.
 
Method Summary
protected abstract  boolean actionTimedOut()
          This method will be called when a subaction times out.
 void finalize()
           
 void run()
          This is the obligation to the TimerTask subclass which is extended.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface FourMSControllerInterfaces.SubActionOperations
cancelAction, startAction
 
Methods inherited from interface OCSEPICS.CAEventListener
channelAccessEvent, observerUnableToListen
 

Field Detail

SubActionInitiatorCB

protected FourMSControllerInterfaces.SubActionCompletionListener SubActionInitiatorCB
This is a reference to the last object that initiated this subaction. It is stored as part of the subaction until the subaction completes. When it is completed, the subaction will call a method in the subaction initiator which will inform it of the result of the execution of the subaction. The initiator is expected to be a CORBA object and this is a CORBA oneway callback


CORBAHelper

protected OCSCORBAHelper CORBAHelper
This will be used to perform OCS CORBA related tasks


SecondsBeforeTimeout

protected int SecondsBeforeTimeout
This holds the amount of time that a subaction has to go before it timesout,this is reset when an action is started and the value which is used is normally determined by the timeout PV which is contained with the IOC.


SubActionTimer

protected java.util.Timer SubActionTimer
This is a timer object which will be used for scheduling timer based operations on the subaction. This will be used for keeping track of whether or not a scheduled subaction has not completed in time for instance


SubactionName

protected java.lang.String SubactionName
This is the name of the subaction.


ExpectedNumberOfSubactionArguments

protected int ExpectedNumberOfSubactionArguments
This is the expected number of arguments which will be passed from the client when this subaction is started


SubactionState

protected OCSEPICSConsts.SubactionStateType SubactionState
This attribute relects the current state of the subaction whether it be active or idle.


iocActionState

OCSEPICSConsts.IOCSubactionStateType iocActionState
This is the state of the underlying IOC action which this action supports.


SyslogMessageHandler

protected MessageHandler SyslogMessageHandler
This will be used for reporting things to the syslog


SubactionTimeout

protected int SubactionTimeout
This is the timeout which is associated with the subaction


LastSubactionCompletionState

protected OCSEPICSConsts.SubactionCompletionStates LastSubactionCompletionState
Completion state of the last subaction which was executed.


ActionRelatedPVs

protected java.util.Hashtable<java.lang.String,ProcessVariable> ActionRelatedPVs
These are the PVs which are associated with the action. These PVs will be used to set up actions in the EPICS controller, invoke actions and determine if the actions has completed.


IOCAction

protected java.lang.String IOCAction
This is the name of the IOC action which is associated with this subaction


ClstatPV

protected java.lang.String ClstatPV
This is the name of the PV which wil be used used to hold the state of the mechanism control status. This will normally be set to DONE or ACTIVE


CommPV

protected java.lang.String CommPV
This is the PV which will hold the command to be executed from the user. This value is normally one of MOVE,STOP,DATUM OR UPDATE.


DemandPV

protected java.lang.String DemandPV
This is the PV into which the demand value for a given action should be written.


CommStatPV

protected java.lang.String CommStatPV
This is the PV into which the EPICS system will write whether the command which was entered is actually OK or not.


CommStrPV

protected java.lang.String CommStrPV
This is the PV associated with any error which is associated with the comamnd validation status.


CurrentPositionPV

protected java.lang.String CurrentPositionPV
This is the PV which contains the current position of the mechanism


ErrStrPV

protected java.lang.String ErrStrPV
This PV holds the error description string for the mechanism


MechName

protected java.lang.String MechName
This is the name of the mechanism with which this subaction is associated.


InstrumentName

protected java.lang.String InstrumentName
This is the name of the instrument with which this action is associated.


MechStatPV

protected java.lang.String MechStatPV
This PV holds the mechanism status


ParameterConvertor

protected FourMS.FourMSParameterConverter ParameterConvertor
This will be used by the PV class to convert between engineering and logical units. The conversion is data-driven by the contents of the WHT ICS database which determines for a given PV which conversion is to be used to convert it.


TimeoutPV

protected java.lang.String TimeoutPV
This is the PV which holds the timeout value which is associated with a particular action

Constructor Detail

EPICSAction

public EPICSAction(MessageHandler SyslogMessageHandler,
                   java.lang.String SubactionName,
                   java.lang.String MechName,
                   java.lang.String InstrumentName,
                   java.util.Hashtable<java.lang.String,ProcessVariable> ActionRelatedPVs,
                   OCSCORBAHelper CORBAHelper,
                   FourMS.FourMSParameterConverter ParameterConvertor)
            throws java.lang.Exception
This is the main constructor for the class.

Parameters:
SyslogMessageHandler - This will be used for reporting information to the syslog which is running on the whtics.
SubactionName - This is the name which is associated with subaction.
MechName - This is the name of the mechanism with which this action is associated.
InstrumentName - This is the name of the instrument with which this action is associated.
ActionRelatedPVs - This is a hashtable of PV within which we can expect to find all of the PVs which this subaction is going to need to use in order to perform it's tasks.
CORBAHelper - This will be used for performing OCS related CORBA activities.
ParameterConvertor - This will be used to convert parameters between logical and engineering units.
Throws:
java.lang.Exception - Should there be an error when initialising the object.
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

run

public void run()
This is the obligation to the TimerTask subclass which is extended. Should the subaction be running, this ensures that it times out when it should. Once the subaction times out, we call the actionTimedOut method which will result in any state machine which may be in use can be reset and that the CORBA client that invoked the action can be informed of any progress.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

actionTimedOut

protected abstract boolean actionTimedOut()
                                   throws StateMachineException
This method will be called when a subaction times out. It should be overidden by the derived class.

Throws:
StateMachineException