|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFourMS.SequenceSubaction
public abstract class SequenceSubaction
This is a base class which will be used by the instrument controller tasks to create compound high level, sequence actions. For example in the case of the PFIP controller, there exists a single subaction which can be used to set the position of both of the ADC elements.
This class provides base functionality which can be inherited and subsequently used by such classes. Note that this class is abstract and should only be used as a super class.
Field Summary | |
---|---|
protected SubActionCompletionListener |
ActionCompletionListener
A CORBA reference to the action completion listener which can be used by a subclass in order to pass things about |
protected SubActionCompletionListenerImpl |
ActionCompletionListenerImpl
This is a CORBA listener object which will be called when a subaction that this object has initiated completes. |
protected int |
ActionState
This is the current state of the action. |
protected int |
ExpectedNoOfArgs
Indicates the number of arguments which are expected for this subaction when initiated by a CORBA client. |
protected java.lang.String |
InstrumentName
Name of the Instrument |
protected int |
NumberOfSubactionsInSequenceOutstanding
Number of subactions which have been started by the subclass simultaneously and need to be tracked for completion. |
protected org.omg.CORBA.ORB |
Orb
The CORBA request broker or ORB which will be used for handling CORBA requests |
protected iParameterNoticeBoard.ParameterNoticeBoardSupplier |
ParameterNoticeBoard
This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard |
protected org.omg.PortableServer.POA |
Poa
The portable object adapter which will be used by this class |
protected org.omg.CosNaming.NamingContextExt |
RootNamingServiceContext
This is a reference to the COS naming service |
protected int |
SecondsBeforeTimeout
This holds the amount of time before the subaction sequence times out. |
protected SubActionCompletionListener |
SequenceSubActionInitiatorCB
If specified by the CORBA client when the subaction sequence was initiated, a CORBA subaction completion object which will be informed when the sequence subaction has completed. |
protected java.lang.String |
SequenceSubactionName
This is the name of the sequence subaction |
protected java.lang.String[] |
SubactionArgumentList
This is a copy of the list of arguments associated with the current invocation of the subaction, this will be set when the subaction is initiated |
protected java.lang.Thread |
SubactionThread
This is a thread which the subaction can run within so control can immediately be returned to the caller should it be necessary. |
protected MessageHandler |
SyslogMessageHandler
An instance of the a syslog message handler which will be used to put messages into the syslog. |
protected int |
TimeOut
This is the timeout for an an a 4MS dialogue sequence to complete before the subaction is considered failed. |
Constructor Summary | |
---|---|
SequenceSubaction()
The default constructor, this should only be used if you are NOT intending using any of the functionality within the super class |
|
SequenceSubaction(java.lang.String InstrumentName,
org.omg.PortableServer.POA Poa,
org.omg.CORBA.ORB Orb,
MessageHandler SyslogMessageHandler,
org.omg.CosNaming.NamingContextExt RootNamingServiceContext,
java.lang.String SequenceSubactionName)
This is the constructor and will be used to create a subaction listener which can be used to listen for subactions completing |
Method Summary | |
---|---|
boolean |
cancelAction()
We have to specify this but we do not implement it. |
protected void |
informSubactionInitiator()
Informs the subaction initiator that the subaction that he initiated has completed, it uses the data items returned by the last subaction initiated by this subclass when reporting that the subaction has finished. |
protected void |
informSubactionInitiator(java.lang.String SubactionName,
java.lang.String MechanismName,
java.lang.String InstrumentName,
int ReasonCode,
java.lang.String Reason,
int CmdError,
java.lang.String CmdErrorStr,
int MechError,
java.lang.String Severity,
java.lang.String MechErrorStr)
Used to inform a subaction initiator that a subaction is completed. |
void |
registerSubactionInNameService(SubActionPOATie SubActionPseudoImpl)
Registers the sequence subaction with the name service so that other CORBA clients can use it. |
protected void |
returnResult(java.lang.String Message,
int SubactionCompletionState)
Packages up the code which informs the sequence subaction client of the result of the subaction. |
boolean |
startAction(java.lang.String[] subactionArgs,
SubActionCompletionListener subActionInitiator)
This method starts the subaction. |
void |
subActionEnded(java.lang.String SubactionName,
java.lang.String MechanismName,
java.lang.String InstrumentName,
int ReasonCode,
java.lang.String Reason,
int CmdError,
java.lang.String CmdErrorStr,
int MechError,
java.lang.String Severity,
java.lang.String MechErrorStr)
This is the contractual obligation of this class to implement the callback for the SubActionCompletionListenerOperations interface. |
boolean |
waitForActionToComplete(java.lang.String ErrorString)
This method is called if the subclass wants to execute the current subaction of the sequence subaction synchronously. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
protected int TimeOut
protected int ExpectedNoOfArgs
protected java.lang.String[] SubactionArgumentList
protected java.lang.String InstrumentName
protected java.lang.String SequenceSubactionName
protected SubActionCompletionListener SequenceSubActionInitiatorCB
protected int NumberOfSubactionsInSequenceOutstanding
protected SubActionCompletionListenerImpl ActionCompletionListenerImpl
protected SubActionCompletionListener ActionCompletionListener
protected java.lang.Thread SubactionThread
protected int ActionState
SUBACTIONIDLE
SUBACTIONINPROGRESS
Both of these constants can be found in the FourMSConstants class.
protected int SecondsBeforeTimeout
protected MessageHandler SyslogMessageHandler
protected org.omg.CosNaming.NamingContextExt RootNamingServiceContext
protected org.omg.CORBA.ORB Orb
protected org.omg.PortableServer.POA Poa
protected iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
Constructor Detail |
---|
public SequenceSubaction()
public SequenceSubaction(java.lang.String InstrumentName, org.omg.PortableServer.POA Poa, org.omg.CORBA.ORB Orb, MessageHandler SyslogMessageHandler, org.omg.CosNaming.NamingContextExt RootNamingServiceContext, java.lang.String SequenceSubactionName)
Method Detail |
---|
public void subActionEnded(java.lang.String SubactionName, java.lang.String MechanismName, java.lang.String InstrumentName, int ReasonCode, java.lang.String Reason, int CmdError, java.lang.String CmdErrorStr, int MechError, java.lang.String Severity, java.lang.String MechErrorStr)
Note that in the case of the compound subactions, not all of these fields will be relevent.
subActionEnded
in interface SubActionCompletionListenerOperations
SubactionName
- This is the name of the subaction which has completedMechanismName
- This is the name of the mechanism which is associated with the subaction which has completedInstrumentName
- This is the name of the instrumentReasonCode
- This is the code associated with any failureReason
- This is the textual representation of any failure to execute a commandCmdError
- This is the command error code associated with a subaction completingCmdErrorStr
- This is the textual representation of the command error codeMechError
- This is the error code associated with any mechanism failure.Severity
- This is the severity of any error which was encounteredMechErrorStr
- This is a textual representation of any error which ocurred with a mechanismpublic void registerSubactionInNameService(SubActionPOATie SubActionPseudoImpl)
SubActionPseudoImpl
- This is the CORBA object which is to be registered into the name service
protected void informSubactionInitiator(java.lang.String SubactionName, java.lang.String MechanismName, java.lang.String InstrumentName, int ReasonCode, java.lang.String Reason, int CmdError, java.lang.String CmdErrorStr, int MechError, java.lang.String Severity, java.lang.String MechErrorStr)
SubactionName
- This is the name of the subaction which has completedMechanismName
- This is the name of the mechanism which is associated with the subaction which has completedInstrumentName
- This is the name of the instrumentReasonCode
- This is the code associated with any failureReason
- This is the textual representation of any failure to execute a commandCmdError
- This is the command error code associated with a subaction completingCmdErrorStr
- This is the textual representation of the command error codeMechError
- This is the error code associated with any mechanism failure.Severity
- This is the severity of any error which was encounteredMechErrorStr
- This is a textual representation of any error which ocurred with a mechanismprotected void informSubactionInitiator()
public boolean startAction(java.lang.String[] subactionArgs, SubActionCompletionListener subActionInitiator) throws SubActionInProgressException, UnableToStartSubactionException
Once the subaction has completed, the subaction initiator will be informed using the standard subaction callback mechanism which is used throughout the application.
subactionArgs
- - This is a list of the arguments which
pertain to this subactionsubActionInitiator
- - This is a reference to the object
that has started the subaction and must implement the
iActionFinishedInterface. The subaction will rely on this
interface in order to inform the initiator that the subaction
has terminated.
SubActionInProgressException
- When the subaction is already in progress.
UnableToStartSubactionException
- Thrown when unable to start the subaction.public boolean cancelAction() throws SubActionNotInProgressException
SubActionNotInProgressException
public boolean waitForActionToComplete(java.lang.String ErrorString)
The use of the method is demonstrated in the following code. Note that when we started the telescope focus action, we passed as the action completion handler the ActionCompletionListener object which is a local attribute. This is very important so as the super class is informed once the subaction has completed and it can therefore perform any post subaction handling of errors etc. If the super class is not informed when the subaction is completed then the sequence subaction will wait indefinitely as it waits on the thread being woken up by the subaction ending.
TelescopeFocusAction.startAction(subactionArgs,ActionCompletionListener); // Wait for the telescope to stop moving Now wait for the MFW to stop moving before we attempt to // refocus the telescope if (!waitForActionToComplete("Telescope focus did not complete")) { return; }
If the subaction that we are waiting for fails for whatever reason, if the initiator of the action registered a callback, the callback will be called and then subsequently the state of the subaction will be reset to IDLE. The calling process needs to do no more, the subaction should be ready to be used again.
ErrorString
- A string that contains the error text that should be returned
to the subaction initiator should there be a problem with
executing the subactionprotected void returnResult(java.lang.String Message, int SubactionCompletionState)
Message
- A text string to be reported as the status of the subaction completionSubactionCompletionState
- This is the completion state of the subaction completion, this
should be set to either FourMSConstants.SUBACTIONFAILED
or to FourMSConstants.SUBACTIONCOMPLETEDOK If this is
not set to this value, the method will assume SUBACTIONFAILED.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |