stella.net.tpl
Class TsiError

java.lang.Object
  extended by stella.net.tpl.TsiError
Direct Known Subclasses:
ErrAxisMechanicBlocked, ErrAzimuthEtelerror, ErrAzimuthEtelexecerror, ErrAzimuthEtelwarning, ErrAzmFault, ErrBrakeClosedfromother, ErrElevationEtelerror, ErrElevationEtelwarning, ErrGpsPositionlost, ErrPower, ErrUsvBatteryalarm

public class TsiError
extends Object

Format of an OpenTSI error, including severness, error message and affected component. Defined in OpenTSI.pdf, sec. 5.3 (TELESCOPE.STATUS.LIST), p8: | => Level of entire group. : |;|;... => Level of affected components : |||;... => The individual errors , | => The next group.


Nested Class Summary
static class TsiError.DefaultErrorPolicy
          The default policy.
 
Field Summary
static char COLON
          The separator char between the group, the component and the list.
static char COMMA
          The separator char between individual groups.
private  String component
          The component the error occured at.
private  String detail
          The detailed message, unparsed for escaped parts.
private  String error
          The error message as a string.
static int ERROR
          The bit describing a serious error, disabling parts of the telescope
static int INFO
          The bit defining a status.
private  int level
          The level of that error, a bit from above.
private static String LEVELS
          The old designations for the error level.
static int PANIC
          The bit describing the most severe error, can't continue.
static char PIPE
          The separator char between individual parts of the error.
private static TsiErrorPolicy policy
          The error handling policy class, changed at run-time with TSI_ERROR_POLICY.
static char SEMICOLON
          The separator char between the list of errors on same group.
static String TSI_ERROR_POLICY
          The system key for a class that replaces the default policy.
private static String TSIPACKAGE
          The package name, where individual classes reside.
static int WARNING
          Errors that do not currently, but might might lead to disabling errs.
 
Constructor Summary
TsiError(String err, String det, int lev, String what)
          Constructs a new tsi error from all its components without parsing.
 
Method Summary
private static TsiError createTsiError(String err, String det, int lev, String comp)
          Try to crete a customized error, if the error name matches a known class name or produce a standard error.
static TsiError deprecated(String read)
          Parses the old error format, where the level is a single-letter in and the component is within .
 boolean equals(Object other)
          On equal, we check for equal error, level, detail and component.
 int getAccumulateCount()
          The default implementation for the maximum allowed occurence for accumulation test on an error.
 long getAccumulateSpan()
          The default implementation for the maximum accumulation time span for an error of this type.
 String getComponent()
          Returns the component onto which this error occured.
 String getDetail()
          Returns the unparsed detail message.
 String getError()
          Returns the error designation.
 int getLevel()
          Returns the error level.
 long getResetLag()
          The default implementation for the minimum time-lag between resetting an error of this type.
 int getResetMax()
          The default implementation for the maximum allowed occurence for resetting an error.
 int hashCode()
          Hash code is hash from error.
 boolean ignore()
          Returns true, if this error should be ignored.
static TsiError parse(String read)
          Parses a TsiError from a string formatted according to: error|detail|level|comp like ERR_USV_BatteryAlarm|USV\\| Alarm|4|CABINET The separator char is '|'.
protected  void setComponent(String err)
          Sets the main error occurence component.
protected  void setDetail(String err)
          Sets the main error detail.
protected  void setError(String err)
          Sets the main error designation.
protected  void setLevel(int err)
          Sets the main error level.
 String toString()
          Converts that TsiError to a parsable string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TSI_ERROR_POLICY

public static final String TSI_ERROR_POLICY
The system key for a class that replaces the default policy.

See Also:
Constant Field Values

PIPE

public static final char PIPE
The separator char between individual parts of the error.

See Also:
Constant Field Values

SEMICOLON

public static final char SEMICOLON
The separator char between the list of errors on same group.

See Also:
Constant Field Values

COLON

public static final char COLON
The separator char between the group, the component and the list.

See Also:
Constant Field Values

COMMA

public static final char COMMA
The separator char between individual groups.

See Also:
Constant Field Values

PANIC

public static final int PANIC
The bit describing the most severe error, can't continue.

See Also:
Constant Field Values

ERROR

public static final int ERROR
The bit describing a serious error, disabling parts of the telescope

See Also:
Constant Field Values

WARNING

public static final int WARNING
Errors that do not currently, but might might lead to disabling errs.

See Also:
Constant Field Values

INFO

public static final int INFO
The bit defining a status.

See Also:
Constant Field Values

LEVELS

private static final String LEVELS
The old designations for the error level.

See Also:
Constant Field Values

TSIPACKAGE

private static final String TSIPACKAGE
The package name, where individual classes reside.

See Also:
Constant Field Values

error

private String error
The error message as a string.


detail

private String detail
The detailed message, unparsed for escaped parts.


level

private int level
The level of that error, a bit from above.


component

private String component
The component the error occured at.


policy

private static TsiErrorPolicy policy
The error handling policy class, changed at run-time with TSI_ERROR_POLICY.

Constructor Detail

TsiError

public TsiError(String err,
                String det,
                int lev,
                String what)
Constructs a new tsi error from all its components without parsing.

Method Detail

parse

public static TsiError parse(String read)
                      throws ParseException
Parses a TsiError from a string formatted according to: error|detail|level|comp like ERR_USV_BatteryAlarm|USV\\| Alarm|4|CABINET The separator char is '|'. Parsing is done such that the component is the part after the last '|', the level the integer between the last and the second last '|', and the error is the part until the first '|'. Everything between the first and the second-to-last '|' is the detail, no parsing for escaped sequences is done here.

Throws:
ParseException

createTsiError

private static TsiError createTsiError(String err,
                                       String det,
                                       int lev,
                                       String comp)
Try to crete a customized error, if the error name matches a known class name or produce a standard error.


deprecated

public static TsiError deprecated(String read)
                           throws ParseException
Parses the old error format, where the level is a single-letter in and the component is within . The error is the rest, trimmed. Old format e.g.
 ERR_oil_Level_low [I] (CABINET)
 

Throws:
ParseException

getError

public String getError()
Returns the error designation.


getDetail

public String getDetail()
Returns the unparsed detail message. Though called detail it normally does not carry additional information.


getLevel

public int getLevel()
Returns the error level. This should be one of the bit-masks mentioned above.


getComponent

public String getComponent()
Returns the component onto which this error occured. This is a string like AZ for azimuth axis.


ignore

public boolean ignore()
Returns true, if this error should be ignored.


getResetMax

public int getResetMax()
The default implementation for the maximum allowed occurence for resetting an error. This is done by checking the system property TSI_ERROR_POLICY. If that points to a valid, default constructable class, we use an instance of this class for the policy, otherwise the default policy is used.


getAccumulateCount

public int getAccumulateCount()
The default implementation for the maximum allowed occurence for accumulation test on an error. This is done by checking the system property TSI_ERROR_POLICY. If that points to a valid, default constructable class, we use an instance of this class for the policy, otherwise the default policy is used.


getAccumulateSpan

public long getAccumulateSpan()
The default implementation for the maximum accumulation time span for an error of this type. This is done by checking the system property TSI_ERROR_POLICY. If that points to a valid, default constructable class, we use an instance of this class for the policy, otherwise the default policy is used.


getResetLag

public long getResetLag()
The default implementation for the minimum time-lag between resetting an error of this type. This is done by checking the system property TSI_ERROR_POLICY. If that points to a valid, default constructable class, we use an instance of this class for the policy, otherwise the default policy is used.


setError

protected void setError(String err)
Sets the main error designation.


setDetail

protected void setDetail(String err)
Sets the main error detail.


setComponent

protected void setComponent(String err)
Sets the main error occurence component.


setLevel

protected void setLevel(int err)
Sets the main error level.


toString

public String toString()
Converts that TsiError to a parsable string.

Overrides:
toString in class Object

equals

public boolean equals(Object other)
On equal, we check for equal error, level, detail and component. The creation date is not checked.

Overrides:
equals in class Object

hashCode

public int hashCode()
Hash code is hash from error.

Overrides:
hashCode in class Object