stella.xml
Class XMLErrorFinalizer

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.AbstractErrorFinalizer
                  extended by stella.xml.XMLErrorFinalizer
All Implemented Interfaces:
Cloneable, ErrorFinalizing, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
ResetFinalizer

public class XMLErrorFinalizer
extends AbstractErrorFinalizer
implements ErrorFinalizing

A simple error finalizer acting directly on the XMLSequencer. It is used to handle a single KEY_FOLLOWUP by loading an alternate sequence with ResourceSupplying.KEY_URLRESOURCES and KEY_XMLFILE. Depending on KEY_TYPE, this new sequence is inserted into the running sequence in one of three ways.

A simple error handler can only handle errors that change the currently executing sequence by either prepending or appending some additional sequencer steps or by aborting the entire sequence. If your error casters produce errors that can not be treated with this simple schema a new ErrorFinalizing instance has to be coded.


Nested Class Summary
protected  class XMLErrorFinalizer.ErrorDistributor
          Helper class to speed up the return from the error listener method ErrorListener.errorOccured(stella.ErrorEvent).
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String ABORT
          A constant indicating replacement of the non-error sequence.
private  XMLErrorFinalizer.ErrorDistributor alternate
          The thread handling the sequence update.
static String APPEND
          A constant defining appending of the error-handling sequnce.
private static String DEFFOLLOWUP
          The default follow-up.
private static String DEFTYPE
          The default behaviour.
private static String DEFXMLFILE
          A file holding the shutdown sequence.
static String KEY_FOLLOWUP
          The follow-up action.
static String KEY_TYPE
          The way of insertion into the running sequence.
static String KEY_XMLFILE
          The sequence file to load.
static String PREPEND
          A constant defining prepending of the error-handling sequnce.
 
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 util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
XMLErrorFinalizer(Map prop)
          Constructs a new simple error handler.
 
Method Summary
 boolean finalizeError(TargetDefinition ignore, ErrorEvent ee, CommandLaunching[] dummy, Sequencing seq, ParameterClustering set)
          The incomming errors.
 String getFollowUp()
          Gets the follow-up this error finalizer works on.
 boolean isAborting()
          Returns true if this error finalizer is acting on a ErrorEvent.ABORT_TARGET follow-up and is currently finalizing.
 boolean isFinalizing()
          Returns if this error finalizer is still working on the last error.
protected  boolean startRecovery(URL xml, String type, Sequencing seq)
          Starts the sequence-updating thread.
 
Methods inherited from class stella.AbstractErrorFinalizer
createErrorFinalizer, setMonitor, wake
 
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, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.ErrorFinalizing
setMonitor
 
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

KEY_XMLFILE

public static final String KEY_XMLFILE
The sequence file to load.

See Also:
Constant Field Values

KEY_TYPE

public static final String KEY_TYPE
The way of insertion into the running sequence.

See Also:
Constant Field Values

KEY_FOLLOWUP

public static final String KEY_FOLLOWUP
The follow-up action.

See Also:
Constant Field Values

ABORT

public static final String ABORT
A constant indicating replacement of the non-error sequence.

See Also:
Constant Field Values

APPEND

public static final String APPEND
A constant defining appending of the error-handling sequnce.

See Also:
Constant Field Values

PREPEND

public static final String PREPEND
A constant defining prepending of the error-handling sequnce.

See Also:
Constant Field Values

DEFXMLFILE

private static final String DEFXMLFILE
A file holding the shutdown sequence. Last resort of error handling.

See Also:
Constant Field Values

DEFFOLLOWUP

private static final String DEFFOLLOWUP
The default follow-up. Initiates a shutdowen.

See Also:
Constant Field Values

DEFTYPE

private static final String DEFTYPE
The default behaviour. Current sequence is aborted.

See Also:
Constant Field Values

alternate

private XMLErrorFinalizer.ErrorDistributor alternate
The thread handling the sequence update.

Constructor Detail

XMLErrorFinalizer

public XMLErrorFinalizer(Map prop)
Constructs a new simple error handler. Registering the command servers, the sequencer, and the scheduler are done in the parent class.

Method Detail

finalizeError

public boolean finalizeError(TargetDefinition ignore,
                             ErrorEvent ee,
                             CommandLaunching[] dummy,
                             Sequencing seq,
                             ParameterClustering set)
The incomming errors. First, the error message is querried for its single follow-up action. If the follow-up is handled by this finalizer, its alternate sequnece is loaded and than passed to the appropriate sequencer method, i.e., Sequencing.abort(java.util.List), Sequencing.append(java.util.List) , or Sequencing.prepend(java.util.List). To ensure quick return of this method, a seperate thread is started, see XMLErrorFinalizer.ErrorDistributor.

Specified by:
finalizeError in interface ErrorFinalizing

startRecovery

protected boolean startRecovery(URL xml,
                                String type,
                                Sequencing seq)
Starts the sequence-updating thread. This thread is also needed for the isFinalizing() method.


getFollowUp

public String getFollowUp()
Gets the follow-up this error finalizer works on. Different errors may be handled with identical instances of this class.

Specified by:
getFollowUp in interface ErrorFinalizing

isFinalizing

public boolean isFinalizing()
Returns if this error finalizer is still working on the last error. Checks if the XMLErrorFinalizer.ErrorDistributor is non-null and alive.

Specified by:
isFinalizing in interface ErrorFinalizing

isAborting

public boolean isAborting()
Returns true if this error finalizer is acting on a ErrorEvent.ABORT_TARGET follow-up and is currently finalizing.

Specified by:
isAborting in interface ErrorFinalizing
Overrides:
isAborting in class AbstractErrorFinalizer