|
DJAVA | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectau.gov.aao.drama.DramaTask
public class DramaTask
This class implements an AAO
import au.gov.aao.drama.DramaException;
import au.gov.aao.drama.DramaTask;
class main {
public static void main(String[] args) throws DramaException {
DramaTask task = new DramaTask("TICKER");
task.Add("TICK",new MyAction());
task.Add("EXIT",new ExitAction());
task.RunDrama();
task.Close();
}
}
class MyAction implements DramaTask.KickableAction {
public void Obey(DramaTask t) throws DramaException {
t.MsgOut("Obey routine hit");
t.PutRequestWait(10);
}
public void Kick(DramaTask t) throws DramaException {
t.MsgOut("Kick routine hit");
t.PutRequestEnd();
}
}
class ExitAction implements DramaTask.Action {
public void Obey(DramaTask t) throws DramaException {
System.out.println("EXIT action invoked");
t.PutRequestExit();
}
}
Use the
DramaPath,
DramaStatus,
DramaException,
DramaErs,
SdsID,
Arg| Nested Class Summary | |
|---|---|
static interface |
DramaTask.Action
This interface is be used by objects which implement DRAMA Obey message handlers. |
static interface |
DramaTask.ErsHandler
An inteface to be implemented by objects which output ERS messages. |
static class |
DramaTask.ErsMessage
A Class used to represent a DRAMA ERS message report. |
static interface |
DramaTask.KickableAction
This interface is be used by objects which implement DRAMA Obey message handlers. |
static interface |
DramaTask.KickHandler
This interface is be used by objects which implement DRAMA Kick message handlers. |
static interface |
DramaTask.MsgHandler
An inteface to be implemented by objects which output MsgOut messages. |
static class |
DramaTask.TaskInfo
A class used with the DramaTask.Tasks() function, to return the details of currently known DRAMA tasks. |
| Field Summary | |
|---|---|
static int |
ARG_COPY
A flag supplied to RequestExit()/RequestEnd() which indicates the argument should be copied immediately and deleted by DRAMA when appropiate. |
static int |
ARG_DELETE
A flag supplied to RequestExit()/RequestEnd() which indicates the argument should be deleted by DRAMA when appropiate. |
static int |
ARG_FREEID
A flag supplied to RequestExit()/RequestEnd() which indicates the argument (and SDS id) should be free-ed by DRAMA when appropiate. |
static int |
ARG_NODELETE
A flag supplied to RequestExit()/RequestEnd() which indicates the argument should not be deleted and not be copied. |
static int |
ARG_READFREE
A flag supplied to RequestExit()/RequestEnd() which indicates the argument is an SDS id obtained by reading an SDS file and should be cleaned-up appropiately by DRAMA when appropiate. |
static int |
CTX_KICKED
Possible value from GetContext - Indicates Kick context. |
static int |
CTX_OBEY
Possible value from GetContext - Indicates Obey context. |
static int |
CTX_UFACE
Possible value from GetContext - Indicates User Interface context.. |
static int |
FC_IC
Possible flag to DramaTask constructor. |
static int |
LOG_ACT
Possible value for SetDebug - Output details of action handling. |
static int |
LOG_ALL
Possible value for SetDebug - Log everything. |
static int |
LOG_BASIC
Possible value for SetDebug - Basic level debugging. |
static int |
LOG_BULK
Possible value for SetDebug - Log details of bulk data operations. |
static int |
LOG_DETAILS
Possible value for SetDebug - Log details of such things as message lengths. |
static int |
LOG_IMPEVENTS
Possible value for SetDebug - Turn IMP level event logging on. |
static int |
LOG_IMPINIT
Possible value for SetDebug - Output details of calls which initiaite IMP operations. |
static int |
LOG_IMPSYS
Possible value for SetDebug - Output details of IMP System messages |
static int |
LOG_INST
Possible flag to DramaTask.Log. |
static int |
LOG_LIBS
Possible value for SetDebug - Log details of some libraries (DCPP). |
static int |
LOG_MON
Possible value for SetDebug - Output details of monitor system. |
static int |
LOG_OFF
Possible value for SetDebug - Turn debugging off |
static int |
LOG_RXLPEXIT
Possible value for SetDebug - Log a message indicating exit from the main message receiving routine. |
static int |
LOG_STARTUP
Possible flag to DramaTask.Log. |
static int |
LOG_USER1
Possible flag to DramaTask.Log. |
static int |
LOG_USER2
Possible flag to DramaTask.Log. |
static int |
MAY_LOAD
Possible flag to DramaTask constructor. |
static int |
NO_FC_AC
Possible flag to DramaTask constructor. |
static String |
RCSID
The RCS (ACMM) ID. |
static int |
REA_ASTINT
Deprecated. Replaced by REA_SIGNAL. |
static int |
REA_BULK_DONE
Possible return value from GetReason - Indicates notification of bulk data transfer complete. |
static int |
REA_BULK_TRANSFERRED
Possible return value from GetReason - Indicates notification of bulk data transfer progress. |
static int |
REA_COMPLETE
Possible return value from GetReason - Indicates a Subsidary Action/ message has completed. |
static int |
REA_DIED
Possible return value from GetReason - Indicates a Subsidary Task died whilst an action was outstanding. |
static int |
REA_ERROR
Possible return value from GetReason - Indicates an Ers message has been recevied from a subsidary task. |
static int |
REA_EXIT
Possible return value from GetReason - Indicates an "Loaded Task has Exited" message has been received. |
static int |
REA_KICK
Possible return value from GetReason - Indicates Kick entry. |
static int |
REA_LOAD
Possible return value from GetReason - Indicates a Load Success message entry. |
static int |
REA_LOADFAILED
Possible return value from GetReason - Indicates Load Failure message entry. |
static int |
REA_MESREJECTED
Possible return value from GetReason - Indicates Message Rejected message entry. |
static int |
REA_MESSAGE
Possible return value from GetReason. |
static int |
REA_NOTIFY
Possible return value from GetReason - Indicates notification of buffer empty has been received. |
static int |
REA_OBEY
Possible return value from GetReason - Indicates Obey entry. |
static int |
REA_PATHFAILED
Possible return value from GetReason - Indicates a Get Path failure message has been received. |
static int |
REA_PATHFOUND
Possible return value from GetReason - Indicates a Path Found message has been received. |
static int |
REA_RESCHED
Possible return value from GetReason - Indicates Reschedule Event (timeout) entry. |
static int |
REA_SIGNAL
Possible return value from GetReason - Indicates entry for reception of a Signal message (Signal functions). |
static int |
REA_TRIGGER
Possible return value from GetReason - Indicates entry for reception of a Trigger message from a subsidary task. |
static int |
UNIQUE
Possible flag to DramaTask constructor. |
| Constructor Summary | |
|---|---|
DramaTask(String name)
Creates a DRAMA task of a given name, default initializations. |
|
DramaTask(String name,
int bytes)
Creates a DRAMA task of a given name with global buffer size specified. |
|
DramaTask(String name,
int bytes,
int flags)
Creates a DRAMA task of a given name, global buffer and flags specified. |
|
DramaTask(String name,
int bytes,
int flags,
int selfbytes)
Creates a DRAMA task of a given name with all details specified. |
|
| Method Summary | |
|---|---|
void |
Add(String name,
DramaTask.Action obj)
Add an action to the task. |
void |
Add(String name,
DramaTask.KickableAction obj)
Add a kickable action to the task. |
void |
Close()
Deprecated. Replaced by DramaTask.CloseTask()
which does not throw any checked exceptions. |
int |
CloseTask()
Close down a DRAMA task. |
int |
CloseTask(DramaException exception)
Close down a DRAMA task. |
int |
CloseTask(int status)
Close down a DRAMA task. |
protected void |
finalize()
DramaTask Destructor. |
void |
ForceMsgLoopExit()
Force RunDrama() to retrun. |
int |
GetActIndex()
Returns the action index of the current action. |
Arg |
GetArgument()
Get action argument. |
int |
GetContext()
Return DRAMA Context. |
String |
GetEntName()
Get the entry name. |
int |
GetEntReason()
Get the Reason for this action entry. |
DramaStatus |
GetEntStatus()
Get the DRAMA Status associated with this action entry. |
long |
GetEntTransId()
Get the entry transaction id. |
String |
GetName()
Get the action name. |
int |
GetSeq()
Return DRAMA action Sequence number. |
static String |
GetSymbol(String name)
Get a symbol (environment variable) value. |
String |
GetTaskName()
|
void |
GitLogger(String system)
Enable the GIT Logger. |
void |
GitLogger(String system,
String dir)
Enable the GIT Logger. |
boolean |
IsOrphan(long transid)
Indicate if a transaction has been orphaned. |
void |
Kill(int index,
DramaStatus killstat)
Indicate that the SDS argument to an action should not be freeed or deleted on return of the action. |
void |
Kill(int index,
SdsID arg,
DramaStatus killstat)
Kill an action by index. |
void |
Kill(String name,
DramaStatus killstat)
Kill an action by name. |
void |
Kill(String name,
SdsID arg,
DramaStatus killstat)
Kill an action by name. |
void |
Log(int level,
String prefix,
String message)
Log a message using the DRAMA Logging system. |
void |
MsgOut(String message)
Use DRAMA to send a message to user interface. |
void |
PrintReason()
Print using DRAMA MsgOut/Ers routines the reason for an entry. |
void |
PutHandlers(DramaTask.KickableAction obj)
Change both the Obey and Kick handlers for the next reschedule. |
void |
PutKickHandler(DramaTask.Action obj)
Change the Kick handler for the next attempt to kick this action. |
void |
PutKickHandler(DramaTask.KickableAction obj)
Change the Kick handler for the next attempt to kick this action. |
void |
PutObeyHandler(DramaTask.Action obj)
Change the Obey handler for the next reschedule event of this action. |
void |
PutRequestEnd()
Request action completion. |
void |
PutRequestEnd(SdsID argument,
int mode)
Request action completion and return an argument to the parent. |
void |
PutRequestExit()
Request action completion and task exit. |
void |
PutRequestExit(SdsID argument,
int mode)
Request action completion and task exit, return argument. |
void |
PutRequestSleep()
Request action delay. |
void |
PutRequestWait(double delay)
Request action delay. |
void |
PutRequestWaitMessage()
Request action wait for message with no timeout. |
void |
PutRequestWaitMessage(double timeout)
Request action wait for message with timeout. |
void |
PutUfaceErsHandler(DramaTask.ErsHandler obj)
Supply a handler for UFACE context Ers messages. |
void |
PutUfaceMsgHandler(DramaTask.MsgHandler obj)
Supply a handler for UFACE context MsgOut messages. |
static void |
ReadFacility(String name)
Read a DRAMA Facility file into the task. |
static void |
ReadFacilityEnv(String directory,
String file)
Read a DRAMA Facility file into the task but don't complain if not found. |
void |
RemoveKickHandler()
Clear the Kick handler. |
void |
RunDrama()
Run the DRAMA task - enter the DRAMA message received loop. |
void |
SetDebug(int flag)
Set DRAMA internal debugging level. |
void |
SetDetails(int type,
String description)
Set the task details. |
void |
Signal(int index)
Signal an action by index. |
void |
Signal(int index,
SdsID arg)
Signal an action by index. |
void |
Signal(String name)
Signal an action by name. |
void |
Signal(String name,
SdsID arg)
Signal an action by name. |
void |
TakeOrphans()
Take over orphan transactions. |
DramaTask.TaskInfo[] |
Tasks()
Returns an array of details on all the locally known running DRAMA tasks. |
void |
TimerCanel(long timerId)
Cancel a timer setup with TimerInit. |
long |
TimerInit(DramaTask.Action obj,
double timeout)
Invoke a handler after a timeout, using DRAMA's timeout code. |
String |
toString()
Returns the name of the DRAMA task. |
void |
Trigger(SdsID id)
Trigger parent action. |
void |
UfaceCtxEnable(DramaTask.Action obj)
Enable DRAMA's UFACE context. |
void |
UfaceRespond()
Invoke the DRAMA standard response to a UFACE message entry. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String RCSID
public static final int FC_IC
public static final int MAY_LOAD
public static final int NO_FC_AC
public static final int UNIQUE
public static final int REA_OBEY
public static final int REA_KICK
public static final int REA_RESCHED
public static final int REA_TRIGGER
public static final int REA_ASTINT
public static final int REA_SIGNAL
public static final int REA_LOAD
public static final int REA_LOADFAILED
public static final int REA_MESREJECTED
public static final int REA_COMPLETE
public static final int REA_DIED
public static final int REA_PATHFOUND
public static final int REA_PATHFAILED
public static final int REA_MESSAGE
public static final int REA_ERROR
public static final int REA_EXIT
public static final int REA_NOTIFY
public static final int REA_BULK_TRANSFERRED
public static final int REA_BULK_DONE
public static final int CTX_OBEY
public static final int CTX_KICKED
public static final int CTX_UFACE
public static final int LOG_OFF
public static final int LOG_BASIC
public static final int LOG_IMPSYS
public static final int LOG_IMPINIT
public static final int LOG_MON
public static final int LOG_ACT
public static final int LOG_DETAILS
public static final int LOG_BULK
public static final int LOG_LIBS
public static final int LOG_IMPEVENTS
public static final int LOG_RXLPEXIT
public static final int LOG_ALL
public static final int ARG_NODELETE
public static final int ARG_DELETE
public static final int ARG_COPY
public static final int ARG_FREEID
public static final int ARG_READFREE
public static final int LOG_STARTUP
public static final int LOG_INST
public static final int LOG_USER1
public static final int LOG_USER2
| Constructor Detail |
|---|
public DramaTask(String name)
throws DramaException
name - The name for the task
DramaException - Thrown on errors in the DRAMA code.
public DramaTask(String name,
int bytes)
throws DramaException
name - The name for the taskbytes - Global buffer space for this task.
DramaException - Thrown on errors in the DRAMA code.
public DramaTask(String name,
int bytes,
int flags)
throws DramaException
name - The name for the taskbytes - Global buffer space for this task.flags - The initialisation flags. An exclusive or of
one or more of MAYLOAD, NOEXHAND, NO_FC_AC, FC_IC.
DramaException - Thrown on errors in the DRAMA code.
public DramaTask(String name,
int bytes,
int flags,
int selfbytes)
throws DramaException
name - The name for the taskbytes - Global buffer space for this task.flags - The initialisation flags. An exclusive or of
one or more of MAYLOAD, NO_FC_AC, FC_IC.selfbytes - The number of bytes for the self message buffer.
DramaException - Thrown on errors in the DRAMA code.| Method Detail |
|---|
public void UfaceCtxEnable(DramaTask.Action obj)
throws DramaException
obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void UfaceRespond()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void Add(String name,
DramaTask.Action obj)
throws DramaException
name - The name for this action. Should not exceed 19 characters
in length. Case sensitive.obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void Add(String name,
DramaTask.KickableAction obj)
throws DramaException
name - The name for this action. Should not exceed 19 characters
in length. Case sensitive.obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void RunDrama()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public long TimerInit(DramaTask.Action obj,
double timeout)
throws DramaException
obj - This argument is an object which implements the
timeout - The time in seconds after which the timeout will
be triggered. If 0 or negative, it happens immediately.
DramaException - Thrown on errors in the DRAMA code.
public void TimerCanel(long timerId)
throws DramaException
timerId - A value returned by TimerInit.
DramaException - Thrown on errors in the DRAMA code.
public void ForceMsgLoopExit()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void Close()
throws DramaException
DramaTask.CloseTask()
which does not throw any checked exceptions.
DramaTask.CloseTask()
DramaException - Thrown on errors in the DRAMA code.public int CloseTask(int status)
System.exit()
status - The shutdown status of the task. Zero indicates
success. Othervalues result in an error message and
the return value indicating an error.
Other versions take a DramaException or nothing here.public int CloseTask(DramaException exception)
System.exit()
exception - An exception releated to the shutdown of the task.
If this is null, then a successfull shutdown is presumed.
If non-null, then a report is made to stderr and
the assoicated DramaStatus is used to shutdown the task and
will cause the return value to be set to indicate the status.public int CloseTask()
System.exit() but will only indicate a
error shutdown if the underlying shutdown fails.
protected void finalize()
throws DramaException,
Throwable
finalize in class ObjectDramaException - Thrown on errors in the DRAMA code.
Throwable - As per
public void MsgOut(String message)
throws DramaException
message - The message to be written to the user.
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestExit()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestExit(SdsID argument,
int mode)
throws DramaException
argument - The argument to return to the parent action
with the action completion message.mode - How to handle the argument, one of
ARG_COPY, ARG_DELETE or ARG_NODELETE.
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestEnd()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestEnd(SdsID argument,
int mode)
throws DramaException
argument - The argument to return to the parent action
with the action completion message.mode - How to handle the argument, one of
ARG_COPY, ARG_DELETE or ARG_NODELETE.
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestWait(double delay)
throws DramaException
delay - The delay in seconds.
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestSleep()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestWaitMessage(double timeout)
throws DramaException
timeout - The maximum wait. Should be positive.
DramaException - Thrown on errors in the DRAMA code.
public void PutRequestWaitMessage()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.public DramaStatus GetEntStatus()
public int GetEntReason()
public Arg GetArgument()
public long GetEntTransId()
public String GetEntName()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public String GetName()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public static String GetSymbol(String name)
throws DramaException
name - The name of the symbol to get the value of
DramaException - Thrown on errors in the DRAMA code.public boolean IsOrphan(long transid)
public int GetContext()
public int GetSeq()
public void Trigger(SdsID id)
throws DramaException
DramaException
public void PrintReason()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void PutObeyHandler(DramaTask.Action obj)
throws DramaException
obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void PutKickHandler(DramaTask.Action obj)
throws DramaException
obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void PutKickHandler(DramaTask.KickableAction obj)
throws DramaException
There is no effect on Obey handler. The Kick handler is reset to the original value when the action completes.
This method may only be called within a DRAMA action handler implementation method.
obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void PutHandlers(DramaTask.KickableAction obj)
throws DramaException
obj - This argument is an object which implements the
DramaException - Thrown on errors in the DRAMA code.
public void RemoveKickHandler()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void PutUfaceMsgHandler(DramaTask.MsgHandler obj)
throws DramaException
obj - The object to handle MsgOut messages received in UFACE context.
Must implement the MsgHandler interface.
DramaException - Thrown on a DRAMA error.
public void PutUfaceErsHandler(DramaTask.ErsHandler obj)
throws DramaException
obj - The object to handle Ers messages received in UFACE context.
Must implement the ErsHandler interface.
DramaException - Thrown on a DRAMA error.public String GetTaskName()
public String toString()
toString in class Object
public int GetActIndex()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void Signal(int index)
throws DramaException
index - The index of the action to signal. See GetActIndex().
DramaException - Thrown on errors in the DRAMA code.
public void Signal(String name)
throws DramaException
name - The name of the action to signal.
DramaException - Thrown on errors in the DRAMA code.
public void Signal(int index,
SdsID arg)
throws DramaException
index - The index of the action to signal. See GetActIndex().arg - An SDS argument to be sent with the signal. You
should call ClearFree() and ClearDelete() on this to ensure the
underyting SDS structure still exists when the action is
rescheduled.
DramaException - Thrown on errors in the DRAMA code.
public void Signal(String name,
SdsID arg)
throws DramaException
name - The name of the action to signal.arg - An SDS argument to be sent with the signal. You
should call ClearFree() and ClearDelete() on this to ensure the
underyting SDS structure still exists when the action is
rescheduled.
DramaException - Thrown on errors in the DRAMA code.
public void Kill(int index,
DramaStatus killstat)
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void Kill(String name,
DramaStatus killstat)
throws DramaException
name - the name the action to kill.killstat - The completion status for the action.
DramaException - Thrown on errors in the DRAMA code.
public void Kill(int index,
SdsID arg,
DramaStatus killstat)
throws DramaException
index - The index of the action to kill. See GetActIndex().arg - An SDS argument to be sent with the specified argument.killstat - The completion status for the action.
DramaException - Thrown on errors in the DRAMA code.
public void Kill(String name,
SdsID arg,
DramaStatus killstat)
throws DramaException
name - the name the action to kill.arg - An SDS argument to be sent with the specified argument.killstat - The completion status for the action.
DramaException - Thrown on errors in the DRAMA code.
public void TakeOrphans()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public static void ReadFacility(String name)
throws DramaException
name - The name of the facility file to load.
DramaException - Thrown on errors in the DRAMA code.
public static void ReadFacilityEnv(String directory,
String file)
throws DramaException
directory - The name of an environment variable pointing to
the directory containing the file.file - The name of the facility file to load.
DramaException - Thrown on errors in the DRAMA code.
public void SetDebug(int flag)
throws DramaException
LOG_OFF, LOG_BASIC, LOG_IMPSYS, LOG_IMPINIT, LOG_MON, LOG_MON, LOG_DETAILS, LOG_IMPEVENTS LOG_BULK, LOG_LIBS, LOG_RXLPEXIT, LOG_ALL
flag - The debugging flag to set.
DramaException - Thrown on errors in the DRAMA code.
public DramaTask.TaskInfo[] Tasks()
throws DramaException
DramaException - Thrown on errors in the DRAMA code.
public void SetDetails(int type,
String description)
throws DramaException
type - An integer value which becomes the task type. These
values are defined by system developers.description - A string which becomes the task description.
DramaException - Thrown on errors in the DRAMA code.
public void GitLogger(String system)
throws DramaException
system - The logging system name. Normally releated
to the task name or the task type and appropaite
for setting an environment variable.
DramaException - Thrown on errors in the DRAMA code.Log(int, String, String)
public void GitLogger(String system,
String dir)
throws DramaException
system - The logging system name. Normally releated
to the task name or the task type and appropaite
for setting an environment variable.dir - The directory to put the log file in.
DramaException - Thrown on errors in the DRAMA code.Log(int, String, String)
public void Log(int level,
String prefix,
String message)
throws DramaException
level - The logging level to specify. A mask of
LOG_STARTUP LOG_INST, LOG_USER1, LOG_USER2.prefix - A prefix for the log message, allowing you to
indicate say the class which is outputting the
message.message - The log message itself.
DramaException - Thrown on errors in the DRAMA code.GitLogger(String),
GitLogger(String, String)
|
DJAVA | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tjf@aaoepp.aao.gov.au.