|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.CastingContainer
stella.AbstractSequencer<Collection<DOMSequence.TaskElement>>
stella.xml.XMLSequencer
public class XMLSequencer
| Nested Class Summary | |
|---|---|
private class |
XMLSequencer.Conditioner
The helper class that deals with incoming reply messages. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
static String |
ACKNOWLEDGE_PREFIX
The String prefixing an acknowledge command trigger. |
private boolean |
cancel
The cancel flag. |
static Object |
CHAINING
The type signaling pure chaining targets with no steps. |
private CommandRendering |
chef
A link to the master command renderer. |
protected static char |
COLON
The seperator char between command templates and ref-attributes. |
private static long |
DEFSLEEP
Default maximum sleeping period, in ms. |
private static ThreadGroup |
DELAY
The thread group the alarms run in ('delay'). |
private CommandLaunching[] |
devices
The devices, abstract representations of remote command servers. |
private DOMSequence |
dom
The DOMSequence helper object. |
static String |
DONE_PREFIX
The String prefixing a done command trigger. |
private ParameterClustering |
extern
A trigger set of external triggers. |
private Map |
finished
The triggers linked to completed tasks, set by the sequencer. |
static String |
KEY_DEVICETRIGGERS
The key matching to a comma-separated list of device trigger endings. |
static String |
KEY_NAMEDTRIGGERS
The key matching to a comma-separated list of additional triggers. |
static String |
KEY_SLEEP
The key matching the maximum sleep period for the sequencer, in ms. |
static String |
KEY_TARGETTYPES
The key matching to the sequence-definition properties file. |
private Map |
local
The local triggers, set by the sequencer. |
private Object |
lock
The synchronizing object. |
private Map |
lookUp
A lookup table matching command templates to a list of replies. |
private Map |
matchUp
A lookup table matching reply events plus time to reply templates. |
private Thread |
mythread
A reference to the thread the sequencer is running in. |
protected static char |
PLUS
The char to indicate delayed trigger response. |
private Map |
replies
The internal triggers constructed from replies. |
private long |
sleep
The sleep time, ms. |
private ListIterator<Collection<DOMSequence.TaskElement>> |
step
The list iterator to pass through the dom sequence. |
private Collection<DOMSequence.TaskElement> |
task
The collection of tasks belonging to the current step. |
private Map |
typetable
The lookup table for target types to sequence xml-files. |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface stella.ReservedTriggers |
|---|
RESERVED |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
XMLSequencer(Map<String,String> parser)
Constructs a new xml-sequence instant. |
|
| Method Summary | |
|---|---|
void |
abort(List<Collection<DOMSequence.TaskElement>> abort)
Aborts current task and sequence. |
void |
append(List<Collection<DOMSequence.TaskElement>> append)
Appends the sequencing step found in the target file at the end of the current sequence. |
void |
cancel()
Cancel this sequencer. |
void |
forward(ReplyEvent answer)
This method is called by the ReplyDeliverer. |
Thread |
getAsociatedThread()
Returns the thread the sequencer is running in. |
DOMSequence |
getStepsForTarget(TargetDefinition target)
Converts an identifier into a list of sequencer steps. |
private String |
getVariableFromReply(ReplyEvent reply)
Converts an incomming reply to a reply variable. |
private void |
insert(int index,
int start,
List xml)
Inserts the sequence dom stored in the argument file at the given position. |
boolean |
isCancel()
Tests if the last sequence was executed successfully. |
void |
load(List<Collection<DOMSequence.TaskElement>> xml)
Loads a sequencer file. |
long |
maxTimeToCancel()
Returns the maximum time the sequencer needs to cancel. |
void |
prepend(List<Collection<DOMSequence.TaskElement>> prep)
Prepends the sequncing step found in the target file at the start of the current sequence.For expansion of comand version, see insert(int, int, java.util.List). |
boolean |
query(String istrue)
Parses a string following the general boolean algebra rules. |
void |
registerCluster(ParameterClustering externals)
Register the set of external triggers. |
void |
registerLauncher(CommandLaunching[] launch)
Registers a set of devices. |
void |
registerRender(CommandRendering boss)
Registers the master mind. |
void |
retrieveReplies()
Parses boolean expression for all variable names. |
void |
run()
The run method of the sequencer. |
private void |
setReady(String[] template,
boolean to)
Sets directly stated triggers. |
protected void |
setReply(String varname,
Boolean val)
Sets a specified variable to a value. |
private void |
setTaskTriggers()
Scans the DOMSequence for all task references. |
private void |
setupLocals()
Sets up the local variables. |
Thread |
start()
Starts the sequencer in a well-known thread. |
String |
toString()
Returns the class name of this sequencer and the current tasks worked on. |
| Methods inherited from class stella.AbstractSequencer |
|---|
createSequencer |
| Methods inherited from class stella.CastingContainer |
|---|
addErrorListener, addRmiErrorListener, exit, isValid, notifyErrorListener, removeErrorListener, removeRmiErrorListener, sendError, sendError, sendError, sendStatus, sendStatus, sendStatus |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, getBindName, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String DONE_PREFIX
public static final String ACKNOWLEDGE_PREFIX
public static final Object CHAINING
public static final String KEY_TARGETTYPES
public static final String KEY_SLEEP
public static final String KEY_DEVICETRIGGERS
public static final String KEY_NAMEDTRIGGERS
private static final long DEFSLEEP
protected static final char COLON
protected static final char PLUS
private CommandRendering chef
private CommandLaunching[] devices
private ParameterClustering extern
private Map local
private Map finished
private Map replies
private Map matchUp
private Map lookUp
private Map typetable
private DOMSequence dom
DOMSequence helper object.
private ListIterator<Collection<DOMSequence.TaskElement>> step
private Collection<DOMSequence.TaskElement> task
private Thread mythread
private boolean cancel
private Object lock
private long sleep
private static final ThreadGroup DELAY
| Constructor Detail |
|---|
public XMLSequencer(Map<String,String> parser)
The properties handed over to the constructer are also used to define
the properties of the helper class, DOMSequence.
If the KEY_TARGETTYPES is not present in this sequencers
properties an NullPointerException is thrown.
| Method Detail |
|---|
public void registerRender(CommandRendering boss)
registerRender in interface Sequencing<Collection<DOMSequence.TaskElement>>public void registerCluster(ParameterClustering externals)
registerCluster in interface ClusterDependingpublic void registerLauncher(CommandLaunching[] launch)
Additionally, this sequencer registers as the
ReplySubscriber at all command launchers if the
argument is non-null.
registerLauncher in interface Sequencing<Collection<DOMSequence.TaskElement>>public Thread start()
start in interface Sequencing<Collection<DOMSequence.TaskElement>>public Thread getAsociatedThread()
getAsociatedThread in interface CancelRunnablepublic DOMSequence getStepsForTarget(TargetDefinition target)
DOMSequence list is returned.
getStepsForTarget in interface Sequencing<Collection<DOMSequence.TaskElement>>public void load(List<Collection<DOMSequence.TaskElement>> xml)
DOMSequence.
No clearing steps are performed.
load in interface Sequencing<Collection<DOMSequence.TaskElement>>public void abort(List<Collection<DOMSequence.TaskElement>> abort)
abort in interface Sequencing<Collection<DOMSequence.TaskElement>>public void append(List<Collection<DOMSequence.TaskElement>> append)
insert(int, int, java.util.List).
append in interface Sequencing<Collection<DOMSequence.TaskElement>>public void prepend(List<Collection<DOMSequence.TaskElement>> prep)
insert(int, int, java.util.List).
prepend in interface Sequencing<Collection<DOMSequence.TaskElement>>public void cancel()
cancel in interface CancelRunnablepublic long maxTimeToCancel()
maxTimeToCancel in interface CancelRunnablepublic boolean isCancel()
isCancel in interface Sequencing<Collection<DOMSequence.TaskElement>>public void run()
run in interface Runnablepublic void forward(ReplyEvent answer)
ReplyDeliverer.
It spawns an extra
thread that process the reply to allow fast-return of this method.
ReplyEvent.getReplyMatch() is called.
forward in interface ReplySubscriber
protected void setReply(String varname,
Boolean val)
public boolean query(String istrue)
throws ParseException
ParseExceptionExpressionNode
public void retrieveReplies()
throws ParseException
ParseExceptionpublic String toString()
toString in class PropertyContainerprivate void setupLocals()
KEY_DEVICETRIGGERS and the
KEY_NAMEDTRIGGERS already point to an entire list.
private void setReady(String[] template,
boolean to)
DTDConstants.TRUE
and DTDConstants.FALSE work on the following triggers:
extern. If the
reference is resolvable, the trigger is set to the appropriate value.
Note that not all external triggers allow setting of their
value. An UnsupportedException may be thrown as a result.KEY_NAMEDTRIGGERS is used for resolving the reference.finished. If this look-up is successful, the
appropriate task's done attribute is set to the stated
value, regardless of the actual execution status of the task.
private void insert(int index,
int start,
List xml)
step.Inserting a new sequence into an old one has a problem with command template version numbers. It is believed, however, that a simple procedure is sufficient to overcome this problem and to cover all possible error cases. The general contract is:
This method does not abort the current tasks. If this behaviour
is intended the DOMSequence.abortStep(int) has to be called
before this method.
IllegalArgumentException - If index is less than zero or higher
than the number of active orders in the current sequence.private void setTaskTriggers()
DOMSequence for all task references. Each reference
is used as a task trigger, consisting of the tag name of the task
element, DTDConstants.TASK, plus its unique reference.
All tasks present in the dom sequence are scanned and their
DTDConstants.TASKDONE flag is evaluated.
private String getVariableFromReply(ReplyEvent reply)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||