|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.project.ExecutionBlock
public class ExecutionBlock
A single execution of a SchedulingBlock
. A scheduling block
is a template for what should happen; an execution block is a record
of what actually happened.
Version Info:
$Revision: 2190 $ |
$Date: 2009-04-13 15:15:03 -0600 (Mon, 13 Apr 2009) $ |
$Author: dharland $ |
Field Summary |
---|
Fields inherited from interface edu.nrao.sss.util.Identifiable |
---|
UNIDENTIFIED |
Constructor Summary | |
---|---|
ExecutionBlock()
Creates a new instance. |
Method Summary | |
---|---|
void |
appendComments(String additionalComments)
Adds additional comments to those already associated with this execution block. |
void |
clearId()
Resets this ExecutionBlock's id to UNIDENTIFIED. |
ExecutionBlock |
clone()
Returns a copy of this execution block. |
boolean |
equals(Object o)
Returns true if o is equal to this execution block. |
static ExecutionBlock |
fromXml(Reader reader)
Creates a new execution block based on the XML data read from reader . |
static ExecutionBlock |
fromXml(String xmlFile)
Creates a new execution block from the XML data in the given file. |
String |
getComments()
Returns comments about this execution block. |
StringBuilder |
getExecScript()
Returns a copy of the execution script held by this block. |
String |
getExecutionScript()
Returns the execution script held by this block. |
EventStatus |
getExecutionStatus()
Returns information about where this entry is in its life cycle. |
Date |
getExecutionStatusChangeDate()
Returns the point in time when this entry's status changed to its current value. |
Long |
getId()
|
SchedulingBlock |
getSchedulingBlock()
Returns the scheduling block to which this execution block belongs. |
int |
hashCode()
|
boolean |
hasSchedulingBlock()
Returns true if this execution block has a non-null scheduling block. |
void |
holdThisAndSiblings()
Will attempt to put this EB and any of its eligible siblings on hold. |
boolean |
isTest()
Returns true if this block is part of a test scheduling block . |
void |
releaseThisAndSiblings()
Will attempt to release this EB and any of its eligible siblings from the on-hold status. |
void |
setComments(String replacementComments)
Sets comments about this execution block. |
void |
setExecScript(StringBuilder newScript)
Sets the execution script that represents this execution block. |
void |
setExecutionScript(String newScript)
Sets the execution script that represents this execution block. |
String |
toXml()
Returns an XML representation of this execution block. |
void |
updateStatusCancel()
Cancels this entry so that it will never be executed or rescheduled. |
void |
updateStatusComplete()
Brings this entry to a successful completion. |
void |
updateStatusExecute()
Executes this entry. |
void |
updateStatusFail()
Indicates that an execution in progress failed to complete. |
void |
updateStatusHold()
Removes this entry from the schedule, with the intention of doing so temporarily. |
void |
updateStatusRelease()
Releases this entry from the on-hold state so that it may be rescheduled. |
void |
updateStatusReschedule()
Puts this entry back in the not-yet-scheduled state, thereby making it available for rescheduling. |
void |
updateStatusSchedule()
Schedules this entry to be executed at the given time. |
void |
updateStatusSubmit()
Submits this entry for scheduling. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this execution block to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExecutionBlock()
Method Detail |
---|
public Long getId()
getId
in interface Identifiable
public void clearId()
public SchedulingBlock getSchedulingBlock()
This execution block may be one of several that belong to the same scheduling block. If this execution block belongs to no scheduling block, the value returned is null.
getSchedulingBlock
in interface ScheduleEntry
hasSchedulingBlock()
public boolean hasSchedulingBlock()
Execution blocks should normally be contained within, and therefore have a non-null, scheduling block. However, there are some situations where this method will return false:
getSchedulingBlock()
and know that it will return a non-null
object.public void setExecScript(StringBuilder newScript)
newScript
- a new execution script. This value is copied into this block, not held
by it directly. If this value is null this block will hold a
one-line script, where that one line is a comment.public StringBuilder getExecScript()
This method never returns null. If no script has been set, or if an attempt was made to store a null script, the returned script will be one line long and that one line will be a comment.
public void setExecutionScript(String newScript)
newScript
- a new execution script.
If this value is null this block will hold a
one-line script, where that one line is a comment.public String getExecutionScript()
getExecScript()
public void setComments(String replacementComments)
replacementComments
- free-form text about this execution block.
These comments replace all previously set comments.
A null value will be replaced by the empty string ("").appendComments(String)
public void appendComments(String additionalComments)
additionalComments
- new, additional, comments about this execution block.setComments(String)
public String getComments()
getComments()
,
appendComments(String)
,
setComments(String)
public boolean isTest()
test scheduling block
.
public EventStatus getExecutionStatus()
ScheduleEntry
getExecutionStatus
in interface ScheduleEntry
public Date getExecutionStatusChangeDate()
ScheduleEntry
getExecutionStatusChangeDate
in interface ScheduleEntry
public void updateStatusSubmit() throws IllegalTransitionException
ScheduleEntry
This method is called on an entry that has just been made ready for scheduling. Typically such an entry has a status of not-ready-for-scheduling. This method will change the entry's status to not-yet-scheduled.
(The reason for the new updateStatus prefix is two fold. First, it is meant to indicate that we're not truly performing the action that the final verb indicates; only a controller of this model can really do that. The model does, though, ensure the transition is legal and may update more things than just a status property. The second reason is that using a common prefix puts all status-altering methods next to each other in an alphabetical listing. We could have collapsed these into one method with a parameter, but the EventStatus and EventSetStatus enumeration elements do not map one-to-one with these methods.)
updateStatusSubmit
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be submitted for scheduling.
For example, it would be illegal to schedule an entry
that has already been canceled.public void updateStatusSchedule() throws IllegalTransitionException
ScheduleEntry
This method may be called on an entry that has already been scheduled if the client wishes to change the time at which it should be executed.
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusSchedule
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be scheduled.
For example, it would be illegal to schedule an entry
that has already been executed.#reschedule()
public void updateStatusExecute() throws IllegalTransitionException
ScheduleEntry
This method is called on an entry that has been scheduled but has not yet been executed.
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusExecute
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in the scheduled-but-not-started state.public void updateStatusComplete() throws IllegalTransitionException
ScheduleEntry
This method is called on an entry that has was most recently in the in-progress state.
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusComplete
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not currently in-progress.public void updateStatusFail() throws IllegalTransitionException
ScheduleEntry
This method is called on an entry that has was most recently in the
in-progress state. If a human wishes to stop an in-progress entry,
the cancel
method should be used.
This method should be called by the execution process, or its proxy,
to indicate that execution failed.
updateStatusFail
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in-progress.public void updateStatusCancel() throws IllegalTransitionException
ScheduleEntry
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusCancel
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be canceled.
For example, it would be illegal to cancel an entry
that has already been completed successfully.public void updateStatusReschedule() throws IllegalTransitionException
ScheduleEntry
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusReschedule
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be rescheduled.
Only entries that have been scheduled but not yet started
may be rescheduled.public void updateStatusHold() throws IllegalTransitionException
ScheduleEntry
#release()
and #cancel()
methods can take it out of the on-hold state.
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusHold
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be held.
An entry may be placed on hold only if it has not yet been
scheduled, or if it has been scheduled but not yet started.public void updateStatusRelease() throws IllegalTransitionException
ScheduleEntry
See ScheduleEntry.updateStatusSubmit()
for an explanation of the new
updateStatus prefix.
updateStatusRelease
in interface ScheduleEntry
IllegalTransitionException
- if this entry is not in a state where it may be released.
Only entries that are on hold may be released.public void holdThisAndSiblings()
public void releaseThisAndSiblings()
public String toXml() throws JAXBException
toXml
in interface ScheduleEntry
JAXBException
- if anything goes wrong during the conversion to XML.writeAsXmlTo(Writer)
public void writeAsXmlTo(Writer writer) throws JAXBException
writer
.
writeAsXmlTo
in interface ScheduleEntry
writer
- the device to which XML is written.
JAXBException
- if anything goes wrong during the conversion to XML.public static ExecutionBlock fromXml(String xmlFile) throws JAXBException, XMLStreamException, FileNotFoundException
xmlFile
- the name of an XML file. This method will attempt to locate
the file by using Class.getResource(String)
.
FileNotFoundException
- if the XML file cannot be found.
JAXBException
- if the schema file used (if any) is malformed, if
the XML file cannot be read, or if the XML file is not
schema-valid.
XMLStreamException
- if there is a problem opening the XML file,
if the XML is not well-formed, or for some other
"unexpected processing conditions".public static ExecutionBlock fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the source of the XML data.
If this value is null, null is returned.
reader
.
XMLStreamException
- if the XML is not well-formed,
or for some other "unexpected processing conditions".
JAXBException
- if anything else goes wrong during the
transformation.public ExecutionBlock clone()
For the most part this block is deeply cloned. There are, however, a few exceptions to the deep copy philosophy:
Identifiable.UNIDENTIFIED
.
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in class Object
public boolean equals(Object o)
o
is equal to this execution block.
In order to be equal to this block, o
must be non-null
and of the same class as this block. Equality is determined by examining
the equality of corresponding attributes, with the following exceptions,
which are ignored when assessing equality:
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |