Interface IStatus
-
- All Known Subinterfaces:
IJobStatus,IMergeStatus,IResourceStatus,ITeamStatus
- All Known Implementing Classes:
MergeStatus,ModelStatus,MultiStatus,OperationStatus,Status,TeamStatus,ValidationStatus
public interface IStatusA status object represents the outcome of an operation. AllCoreExceptions carry a status object to indicate what went wrong. Status objects are also returned by methods needing to provide details of failures (e.g., validation methods).A status carries the following information:
- plug-in identifier (required)
- severity (required)
- status code (required)
- message (required) - localized to current locale
- exception (optional) - for problems stemming from a failure at a lower level
Some status objects, known as multi-statuses, have other status objects as children.
The class
Statusis the standard public implementation of status objects; the subclassMultiStatusis the implements multi-status objects.This interface can be used without OSGi running.
- See Also:
MultiStatus,Status
-
-
Field Summary
Fields Modifier and Type Field Description static intCANCELStatus type severity (bit mask, value 8) indicating this status represents a cancelationstatic intERRORStatus type severity (bit mask, value 4) indicating this status represents an error.static intINFOStatus type severity (bit mask, value 1) indicating this status is informational only.static intOKStatus severity constant (value 0) indicating this status represents the nominal case.static intWARNINGStatus type severity (bit mask, value 2) indicating this status represents a warning.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IStatus[]getChildren()Returns a list of status object immediately contained in this multi-status, or an empty list if this is not a multi-status.intgetCode()Returns the plug-in-specific status code describing the outcome.ThrowablegetException()Returns the relevant low-level exception, ornullif none.StringgetMessage()Returns the message describing the outcome.StringgetPlugin()Returns the unique identifier of the plug-in associated with this status (this is the plug-in that defines the meaning of the status code).intgetSeverity()Returns the severity.booleanisMultiStatus()Returns whether this status is a multi-status.booleanisOK()Returns whether this status indicates everything is okay (neither info, warning, nor error).booleanmatches(int severityMask)Returns whether the severity of this status matches the given severity mask.
-
-
-
Field Detail
-
OK
static final int OK
Status severity constant (value 0) indicating this status represents the nominal case. This constant is also used as the status code representing the nominal case.- See Also:
getSeverity(),isOK(),Status.OK_STATUS, Constant Field Values
-
INFO
static final int INFO
Status type severity (bit mask, value 1) indicating this status is informational only.- See Also:
getSeverity(),matches(int), Constant Field Values
-
WARNING
static final int WARNING
Status type severity (bit mask, value 2) indicating this status represents a warning.- See Also:
getSeverity(),matches(int), Constant Field Values
-
ERROR
static final int ERROR
Status type severity (bit mask, value 4) indicating this status represents an error.- See Also:
getSeverity(),matches(int), Constant Field Values
-
CANCEL
static final int CANCEL
Status type severity (bit mask, value 8) indicating this status represents a cancelation- Since:
- 3.0
- See Also:
getSeverity(),matches(int),Status.CANCEL_STATUS, Constant Field Values
-
-
Method Detail
-
getChildren
IStatus[] getChildren()
Returns a list of status object immediately contained in this multi-status, or an empty list if this is not a multi-status.- Returns:
- an array of status objects
- See Also:
isMultiStatus()
-
getCode
int getCode()
Returns the plug-in-specific status code describing the outcome.- Returns:
- plug-in-specific status code
-
getException
Throwable getException()
Returns the relevant low-level exception, ornullif none. For example, when an operation fails because of a network communications failure, this might return thejava.io.IOExceptiondescribing the exact nature of that failure.- Returns:
- the relevant low-level exception, or
nullif none
-
getMessage
String getMessage()
Returns the message describing the outcome. The message is localized to the current locale.- Returns:
- a localized message
-
getPlugin
String getPlugin()
Returns the unique identifier of the plug-in associated with this status (this is the plug-in that defines the meaning of the status code).- Returns:
- the unique identifier of the relevant plug-in
-
getSeverity
int getSeverity()
Returns the severity. The severities are as follows (in descending order):CANCEL- cancelation occurredERROR- a serious error (most severe)WARNING- a warning (less severe)INFO- an informational ("fyi") message (least severe)OK- everything is just fine
The severity of a multi-status is defined to be the maximum severity of any of its children, or
OKif it has no children.- Returns:
- the severity: one of
OK,ERROR,INFO,WARNING, orCANCEL - See Also:
matches(int)
-
isMultiStatus
boolean isMultiStatus()
Returns whether this status is a multi-status. A multi-status describes the outcome of an operation involving multiple operands.The severity of a multi-status is derived from the severities of its children; a multi-status with no children is
OKby definition. A multi-status carries a plug-in identifier, a status code, a message, and an optional exception. Clients may treat multi-status objects in a multi-status unaware way.- Returns:
truefor a multi-status,falseotherwise- See Also:
getChildren()
-
isOK
boolean isOK()
Returns whether this status indicates everything is okay (neither info, warning, nor error).- Returns:
trueif this status has severityOK, andfalseotherwise
-
matches
boolean matches(int severityMask)
Returns whether the severity of this status matches the given severity mask. Note that a status with severityOKwill never match; useisOKinstead to detect a status with a severity ofOK.- Parameters:
severityMask- a mask formed by bitwise or'ing severity mask constants (ERROR,WARNING,INFO,CANCEL)- Returns:
trueif there is at least one match,falseif there are no matches- See Also:
getSeverity(),CANCEL,ERROR,WARNING,INFO
-
-