stella
Class ErrorEvent

java.lang.Object
  extended by java.util.EventObject
      extended by util.rmi.RmiEvent
          extended by stella.MessageEvent
              extended by stella.ErrorEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AccumulationStart, AccumulationStop, AdapterFwhm, AltAzRotation, AmbiguousStarPattern, AutoMaster, BadSeeingGuiding, BadWeather, CannotCloseMirrorCover, CannotCloseRoof, CannotFocusMirror, CannotInitAdapter, CannotInitCcd, CannotInitTelescope, CannotMoveDome, CannotMoveTelescope, CannotOffsetTelescope, CannotOpenMirrorCover, CannotOpenRoof, CannotParkTelescope, CannotWriteFile, CcdParametersOff, CentralFocus, CommandAborted, CommandConflict, ConfigurationError, DropTarget, EncoderError, ExactFocus, ExposureFinished, ExposureStart, ExternalAbort, ExtraFocal, FieldOfView, FitsWrittn, GoodWeather, GuiderFits, GuidingStart, HighWindGuiding, IncompleteDone, IntraFocal, ISquareT, LimitSwitchDefect, LimitSwitchFailure, LostConnection, LostGuiding, LostSerial, LostTarget, MissingParameter, MotorProtection, NoAutoClearing, NoCalibration, NoCatalogStars, NoCcd, NoDaughterAvailable, NoDiskSpace, NoExactFocus, NoFilterWheel, NoFlashing, NoFlatField, NoGuiding, NoRoof, NoSequenceAvailable, NoStarOnAcquire, NoStarOnGuide, NoSuchFilter, NoSuchReadoutMode, NoTelescope, NotGuiding, ObjectInLimit, ObservationFinished, ParameterError, ParseError, PidOffset, PixelOffset, ProtocolError, QueueError, RecordFocus, RegainedGuiding, RepositionTelescope, RequestTelescopePosition, RoofPosition, ScsConnectFailure, ScsConnectionLost, SkyFlatAbort, SocketError, SoftwareError, StageStuck, TargetError, TargetNotAvailable, TargetStarMagnitude, TcpAccessDenied, TcpNoFreeConnections, TelescopeOffsets, TelescopePosition, TelescopePowerLost, TelescopeProtection, TelescopeStalled, TelescopeStatus, TimeOutError, TimeOutLimitSwitch, TimeOutRoof, TracktimeRemaining, TsiConnected, TsiConnectFailure, TsiConnectionLost, TsiTccConnected, TsiTccConnectFailure, TsiTccConnectionLost, UnknownCommand, UnsupportedCommand, WeatherAccess

public class ErrorEvent
extends MessageEvent

A Message describing an error event. It has a strict principle of how it is constructed.

Error events should also serve as a guide of recover stragetgies. These strategies are coded within the first token of the command line of the error message. Each name should link to a single definite recovery strategy. Unknown follow-ups should always lead to a shut-down of the entire site. Known recovery strategies allow the running Sequencing instance to augment the current instruction flow, either as a sequnece of single instructions or as a single command.

As in version 3.0, following follow-ups are defined (but not necessarily coded):

Though this class should not be used directly it may be used for basic status messages, see constructors/creator section for details.

See Also:
Serialized Form

Field Summary
static String ABORT_EXPOSURE
          The follow-up for abort integration (exposure).
static String ABORT_TARGET
          The follow-up for abort target.
static String ALARM_OFF
          The follow-up for stop (audible) alarm.
static String ALARM_ON
          The follow-up for start (audible) alarm.
static String BAD_SEEING
          The follow-up for too high guiding failures due to bad seeing.
static String BAD_WEATHER
          The follow-up for bad weather.
static String CLEAR_TEL
          The follow-up for resetting the telescope.
static String CLOSE_COVER
          The follow-up for close cover.
static String CLOSE_ROOF
          The follow-up for close roof.
static String CLOSE_SHUTTER
          The follow-up for close shutter.
private  boolean consumed
          Indicates that this error event was already handled.
static String CONT_TIME
          The follow-up for continue internal exposure time count.
private static String DEFFOLLOWUP
          The default follow-up (NONE).
private static boolean DEFPIPE
          The default pipe flag (false).
private static int DEFSEV
          The default severeness level (trivial status message).
static String ERROR_TOKEN
          The type token for errors.
private  String errorClass
          The optional name of the error class, as a class name in the ERROR sub.
protected static char ERRORCOMBINE
          The char for combining single follow-ups.
static String ERRORPACKAGE
          The package name of the error subdir to prepend to the class name.
private  String followUp
          The follow-up actions.
static String GOOD_WEATHER
          The follow-up for good weather.
static String HIGH_WIND
          The follow-up for too high guiding failures under wind condition.
private  String[] human
          The human readable part of the error message.
static String MAIL_HOME
          The follow-up for e-mail someone remote .
static String MAIL_LOCAL
          The follow-up for e-mail someone on site .
static String MOVE_HOME
          The follow-up for move telescope to home position.
static String MOVE_PARK
          The follow-up for move telescope to park position.
static String NONE
          The no-follow-up.
static String OPEN_COVER
          The follow-up for close cover.
static String OPEN_SHUTTER
          The follow-up for (re)open shutter.
private  boolean pipe
          The pipe-to-scheduler flag.
protected static String PIPE
          The pipe-through flag as a string.
static String REACQUIRE
          The follow-up for re-acquiring a pointing/guiding.
static String REPOSITION
          The follow-up for re-position telescope.
static String RESEND_COMMAND
          The follow-up for resend command.
static String RESET_ADAPTER
          The follow-up for resetting the adapter.
static String RESET_CALIBRATION
          The follow-up for resetting the spectrograph.
static String RESET_CCD
          The follow-up for resetting the ccd.
static String RESET_ENV
          The follow-up for resetting the ccd.
static String RESET_ERRORS
          The follow-up for ignoring telescope errors and simply reset them.
static String RESET_SPEC
          The follow-up for resetting the spectrograph.
static String RESET_TEL
          The follow-up for parking and intitializing the telescope.
static String SHUT_DOWN
          The follow-up for shutdown.
static String STATUS_TOKEN
          The type token for status messages.
static String STOP_TIME
          The follow-up for stop internal exposure time count.
 
Fields inherited from class stella.MessageEvent
SEPCHAR
 
Fields inherited from class util.rmi.RmiEvent
localHost, sourceName
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
protected ErrorEvent(Object src)
          Constructs an invalid ErrorEvent.
protected ErrorEvent(Object src, String type, long time)
          Constructs an invalid ErrorEvent.
 
Method Summary
 void consume()
          Sets the consumed flag.
private static ErrorEvent create(Object src, String type, String follow, boolean pipe, String humall)
          Creates a fully qualified error or status event.
static ErrorEvent createError(MessageBin bin)
          Creates an error event from a message bin.
static ErrorEvent createError(Object src, int severe, String follow, boolean pipe, String humall)
          Creates an error event with the given severeness, the defined follow-up action, the appropriate pipe flag and the human-readable part of the error as an NL-separated String.
static ErrorEvent createError(Object src, String mess)
          Creates a error event with the default severeness and the default follow-up.
static ErrorEvent createError(Object src, String follow, boolean pipe, String mess)
          Creates a error event with the default severeness and the specified follow-up.
static ErrorEvent createError(Object src, String follow, String mess)
          Creates a error event with the default severeness and the specified follow-up.
static ErrorEvent createStatus(Object src, boolean pipe, String humall)
          Creates a status event with the given importance level, pipe-flag and status message.
static ErrorEvent createStatus(Object src, int severe, boolean pipe, String humall)
          Creates a status event with the given importance level, pipe-flag and status message.
static ErrorEvent createStatus(Object src, String humall)
          Creates a status event with the given importance level, pipe-flag and status message.
protected static String extractClassName(String firstline)
          Returns the error class name template.
protected static String extractFollowUp(String firstline)
          Parses the follow-up from the first command line.
protected static boolean extractPipe(String firstline)
          Returns the value of the pipe-through flag.
 String getErrorClass()
          Returns the error class template name.
 String getFollowUp()
          Read-access to the follow-up property.
 String getHuman()
          Read-access to the human property, the human-readable part of the error message.
 String[] getLine()
          Returns the command lines of the error.
 int getSevereness()
          Read-access to the severeness property.
private static String headLineBreakup(String input, int count)
          Parses the header command line.
 boolean isConsumed()
          Returns true if this error event was already consumed, i.e.
 boolean isPipe()
          Returns true if the type of the error is of pipe-through.
 boolean isStatus()
          Return true if the error event is a status message.
protected static String parseClassName(String firstline)
          Returns the name of the error class if any.
protected  boolean parseHeader(String[] all)
          PArses the command lines including the error class and pipe.
 boolean parseLine(String[] all)
          Parses the command lines into something readable.
protected  void setFollowUp(String follow)
          Set-access to the follow-up property.
protected  void setHuman(String humall)
          Set-access to the human property.
protected  void setHuman(String[] humall)
          Set-access to the human property.
protected  void setPipe(boolean piping)
          Sets the pipe-through flag.
 
Methods inherited from class stella.MessageEvent
checkType, equals, equalTime, equalTime, fromAscii, getAllCommandLines, getExecuteGroupKey, getHead, getNr, getTime, getType, hashCode, isValid, parseFromSingleString, readFromBufferedStream, setNr, setTime, setType, setValid, toString
 
Methods inherited from class util.rmi.RmiEvent
getHost, getSourceName, setSourceName
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ERRORPACKAGE

public static final String ERRORPACKAGE
The package name of the error subdir to prepend to the class name.

See Also:
Constant Field Values

ERROR_TOKEN

public static final String ERROR_TOKEN
The type token for errors. Augmented with the severeness level to yield the type.

See Also:
Constant Field Values

STATUS_TOKEN

public static final String STATUS_TOKEN
The type token for status messages. Augmented with the severeness level to yield the type.

See Also:
Constant Field Values

NONE

public static final String NONE
The no-follow-up.

See Also:
Constant Field Values

SHUT_DOWN

public static final String SHUT_DOWN
The follow-up for shutdown. Always last resort.

See Also:
Constant Field Values

BAD_WEATHER

public static final String BAD_WEATHER
The follow-up for bad weather.

See Also:
Constant Field Values

GOOD_WEATHER

public static final String GOOD_WEATHER
The follow-up for good weather.

See Also:
Constant Field Values

BAD_SEEING

public static final String BAD_SEEING
The follow-up for too high guiding failures due to bad seeing.

See Also:
Constant Field Values

HIGH_WIND

public static final String HIGH_WIND
The follow-up for too high guiding failures under wind condition.

See Also:
Constant Field Values

STOP_TIME

public static final String STOP_TIME
The follow-up for stop internal exposure time count.

See Also:
Constant Field Values

CONT_TIME

public static final String CONT_TIME
The follow-up for continue internal exposure time count.

See Also:
Constant Field Values

CLOSE_COVER

public static final String CLOSE_COVER
The follow-up for close cover.

See Also:
Constant Field Values

OPEN_COVER

public static final String OPEN_COVER
The follow-up for close cover.

See Also:
Constant Field Values

CLOSE_SHUTTER

public static final String CLOSE_SHUTTER
The follow-up for close shutter.

See Also:
Constant Field Values

OPEN_SHUTTER

public static final String OPEN_SHUTTER
The follow-up for (re)open shutter.

See Also:
Constant Field Values

ABORT_EXPOSURE

public static final String ABORT_EXPOSURE
The follow-up for abort integration (exposure).

See Also:
Constant Field Values

ABORT_TARGET

public static final String ABORT_TARGET
The follow-up for abort target.

See Also:
Constant Field Values

REPOSITION

public static final String REPOSITION
The follow-up for re-position telescope.

See Also:
Constant Field Values

REACQUIRE

public static final String REACQUIRE
The follow-up for re-acquiring a pointing/guiding.

See Also:
Constant Field Values

MOVE_HOME

public static final String MOVE_HOME
The follow-up for move telescope to home position.

See Also:
Constant Field Values

MOVE_PARK

public static final String MOVE_PARK
The follow-up for move telescope to park position.

See Also:
Constant Field Values

CLOSE_ROOF

public static final String CLOSE_ROOF
The follow-up for close roof.

See Also:
Constant Field Values

MAIL_HOME

public static final String MAIL_HOME
The follow-up for e-mail someone remote .

See Also:
Constant Field Values

MAIL_LOCAL

public static final String MAIL_LOCAL
The follow-up for e-mail someone on site .

See Also:
Constant Field Values

ALARM_ON

public static final String ALARM_ON
The follow-up for start (audible) alarm.

See Also:
Constant Field Values

ALARM_OFF

public static final String ALARM_OFF
The follow-up for stop (audible) alarm.

See Also:
Constant Field Values

RESEND_COMMAND

public static final String RESEND_COMMAND
The follow-up for resend command.

See Also:
Constant Field Values

RESET_TEL

public static final String RESET_TEL
The follow-up for parking and intitializing the telescope.

See Also:
Constant Field Values

CLEAR_TEL

public static final String CLEAR_TEL
The follow-up for resetting the telescope.

See Also:
Constant Field Values

RESET_ADAPTER

public static final String RESET_ADAPTER
The follow-up for resetting the adapter.

See Also:
Constant Field Values

RESET_SPEC

public static final String RESET_SPEC
The follow-up for resetting the spectrograph.

See Also:
Constant Field Values

RESET_CALIBRATION

public static final String RESET_CALIBRATION
The follow-up for resetting the spectrograph.

See Also:
Constant Field Values

RESET_CCD

public static final String RESET_CCD
The follow-up for resetting the ccd.

See Also:
Constant Field Values

RESET_ENV

public static final String RESET_ENV
The follow-up for resetting the ccd.

See Also:
Constant Field Values

RESET_ERRORS

public static final String RESET_ERRORS
The follow-up for ignoring telescope errors and simply reset them.

See Also:
Constant Field Values

ERRORCOMBINE

protected static final char ERRORCOMBINE
The char for combining single follow-ups.

See Also:
Constant Field Values

PIPE

protected static final String PIPE
The pipe-through flag as a string.

See Also:
Constant Field Values

DEFSEV

private static final int DEFSEV
The default severeness level (trivial status message).

See Also:
Constant Field Values

DEFFOLLOWUP

private static final String DEFFOLLOWUP
The default follow-up (NONE).

See Also:
Constant Field Values

DEFPIPE

private static final boolean DEFPIPE
The default pipe flag (false).

See Also:
Constant Field Values

followUp

private String followUp
The follow-up actions.


pipe

private boolean pipe
The pipe-to-scheduler flag.


errorClass

private String errorClass
The optional name of the error class, as a class name in the ERROR sub.


human

private String[] human
The human readable part of the error message.


consumed

private boolean consumed
Indicates that this error event was already handled.

Constructor Detail

ErrorEvent

protected ErrorEvent(Object src)
Constructs an invalid ErrorEvent. Never use this constructer directly.


ErrorEvent

protected ErrorEvent(Object src,
                     String type,
                     long time)
Constructs an invalid ErrorEvent. Never use this constructer directly.

Method Detail

createError

public static ErrorEvent createError(Object src,
                                     String mess)
Creates a error event with the default severeness and the default follow-up. Piping to the scheduler is disabled. The human readable part is given as a single String. If it consists of several lines, they are separated into individual command lines.


createError

public static ErrorEvent createError(Object src,
                                     String follow,
                                     String mess)
Creates a error event with the default severeness and the specified follow-up. Piping to the scheduler is disabled. The human readable part is given as a single String. If it consists of several lines, they are separated into individual command lines.


createError

public static ErrorEvent createError(Object src,
                                     String follow,
                                     boolean pipe,
                                     String mess)
Creates a error event with the default severeness and the specified follow-up. Piping to the scheduler is disabled. The human readable part is given as a single String. If it consists of several lines, they are separated into individual command lines.


createError

public static ErrorEvent createError(Object src,
                                     int severe,
                                     String follow,
                                     boolean pipe,
                                     String humall)
Creates an error event with the given severeness, the defined follow-up action, the appropriate pipe flag and the human-readable part of the error as an NL-separated String.


createStatus

public static ErrorEvent createStatus(Object src,
                                      String humall)
Creates a status event with the given importance level, pipe-flag and status message. The follow-up action is implicetly set to NONE.


createStatus

public static ErrorEvent createStatus(Object src,
                                      boolean pipe,
                                      String humall)
Creates a status event with the given importance level, pipe-flag and status message. The follow-up action is implicetly set to NONE.


createStatus

public static ErrorEvent createStatus(Object src,
                                      int severe,
                                      boolean pipe,
                                      String humall)
Creates a status event with the given importance level, pipe-flag and status message. The follow-up action is implicetly set to NONE.


createError

public static ErrorEvent createError(MessageBin bin)
Creates an error event from a message bin.


create

private static ErrorEvent create(Object src,
                                 String type,
                                 String follow,
                                 boolean pipe,
                                 String humall)
Creates a fully qualified error or status event. The creation time is set to the current system time.


getSevereness

public int getSevereness()
Read-access to the severeness property. The severeness is the integer constructed from the last digit of the type of the error event. If the type is not set or its last character cannot be converted into an int the default severness level is returned. Note that there is no appropriate setSevereness method because the severeness is inseparable from the type.

Returns:
An integer specifiying the severness level of this error.

isStatus

public boolean isStatus()
Return true if the error event is a status message. The type of the error event is probed for starting with STATUS_TOKEN.


getErrorClass

public String getErrorClass()
Returns the error class template name. This is the class name of the specific error class, but in capitalized letters.

See Also:
CommandEvent.classNameToTemplate(java.lang.String), parseClassName(java.lang.String)

getFollowUp

public String getFollowUp()
Read-access to the follow-up property.

Returns:
A string specifiying the required follow-ups of this error.

isPipe

public boolean isPipe()
Returns true if the type of the error is of pipe-through.


isConsumed

public boolean isConsumed()
Returns true if this error event was already consumed, i.e. if this error event was already treated elsewhere and does not need further processing.


consume

public void consume()
Sets the consumed flag. This method is called if the error event was taken care of and ErrorHandling instances do not need to process the follow-up action further.


setFollowUp

protected void setFollowUp(String follow)
Set-access to the follow-up property. This method is non-public, because the follow-up is an immutable property of an ErrorEvent object.

Parameters:
follow - The follow-up actions for this error.

setPipe

protected void setPipe(boolean piping)
Sets the pipe-through flag.


parseClassName

protected static String parseClassName(String firstline)
Returns the name of the error class if any. This name can be used in retrieving the class from the class loader with the Class.forName method, except if packaages have to be added.


extractClassName

protected static String extractClassName(String firstline)
Returns the error class name template.


extractFollowUp

protected static String extractFollowUp(String firstline)
Parses the follow-up from the first command line.


extractPipe

protected static boolean extractPipe(String firstline)
Returns the value of the pipe-through flag.


headLineBreakup

private static String headLineBreakup(String input,
                                      int count)
Parses the header command line. In the header command line, the error class, the follow-up and the pipe flag are given.


parseHeader

protected boolean parseHeader(String[] all)
PArses the command lines including the error class and pipe.


parseLine

public boolean parseLine(String[] all)
Parses the command lines into something readable.

Specified by:
parseLine in class MessageEvent
Returns:
True, if parsing was successful.

getLine

public String[] getLine()
Returns the command lines of the error.

Specified by:
getLine in class MessageEvent
Returns:
An array containing all command lines.

getHuman

public String getHuman()
Read-access to the human property, the human-readable part of the error message. If more than one line constitute to the human readable part they are linked together separated by a newline character.

Returns:
A String holding a readable description of the error.

setHuman

protected void setHuman(String humall)
Set-access to the human property. This method is non-public, because the human is an immutable property of an ErrorEvent object.

Parameters:
human - A String specifiying the human-readable part of this error.

setHuman

protected void setHuman(String[] humall)
Set-access to the human property. This method is non-public, because the human is an immutable property of an ErrorEvent object.

Parameters:
human - A String specifiying the human-readable part of this error.