|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception org.biomoby.shared.MobyException org.biomoby.shared.parser.ServiceException
public class ServiceException
A container for an exception raised by a service provider when
something wrong has to be reported back to a client. These
exceptions are carried in "service notes" in MobyPackage
.
It also contains constants for known error codes and for exception severity levels.
Field Summary | |
---|---|
static int |
COMMUNICATION_FAILURE
Error code: A generic network failure. |
static int |
ERROR
A severity code that corresponds to a fatal error. |
static int |
INFO
A severity code that corresponds to a message not related to any error. |
static int |
INPUT_EMPTY_OBJECT
Error code: Given an empty input data. |
static int |
INPUT_INCORRECT_COLLECTION
Error code: Given input of type Collection is incorrect. |
static int |
INPUT_INCORRECT_NAMESPACE
Error code: Incorrect Namespace in the input object. |
static int |
INPUT_INCORRECT_PARAMETER
Error code: Given parameter is incorrect. |
static int |
INPUT_INCORRECT_SIMPLE
Error code: Given input of type Simple is incorrect. |
static int |
INPUT_NOT_ACCEPTED
Error code: Used when a client tries to send input data to a job created in a previous call but the server does not any more accept input data. |
static int |
INPUT_REQUIRED_PARAMETER
Error code: Service requires a parameter but none was given. |
static int |
INPUT_REQUIRED_PARAMETERS
Error code: Service requires two or more data inputs. |
static int |
INPUTS_INVALID
Error code: Input data are invalid; they do not match with their definitions, or with their dependency conditions. |
static int |
INTERNAL_PROCESSING_ERROR
Error code: A placeholder for all other errors not defined explicitly in the Biomoby API. |
static int |
NO_METADATA_AVAILABLE
Error code: There are no metadata available for the executed service/analysis. |
static int |
NOT_IMPLEMENTED
Error code: A requested method is not implemented. |
static int |
NOT_RUNNABLE
Error code: The same job (analysis) has already been executed, or the data that had been set previously do not exist or are not accessible anymore. |
static int |
NOT_RUNNING
Error code: A job (analysis) has not yet been started. |
static int |
NOT_TERMINATED
Error code: For some reasons, a job (analysis) is not interruptible, but an attempt to do so was done. |
static int |
OK
Error code: No error. |
static int |
PROTOCOLS_UNACCEPTED
Error code: Used when a service does not agree on using any of the proposed notification protocols. |
static int |
UNKNOWN_NAME
Error code: Setting input data under a non-existing name, or asking for a result using an unknown name. |
static int |
UNKNOWN_STATE
Error code: Used when a service call expects to find an existing state but failed. |
static int |
WARNING
A severity code that corresponds to an informative diagnostic message. |
Constructor Summary | |
---|---|
ServiceException()
An empty constructor. |
|
ServiceException(int severity,
int code,
String message)
A usual constructor setting severity, code and message about an exception. |
|
ServiceException(int severity,
int code,
String jobId,
String dataName)
A richer constructor setting more details about an exception. |
|
ServiceException(int severity,
int code,
String jobId,
String dataName,
String msg)
A full constructor setting more details about an exception. |
Method Summary | |
---|---|
static ServiceException |
error(int code,
String msg)
Create an instance of ServiceException that represents an error. |
static ServiceException |
error(String msg)
Create an instance of ServiceException that represents an error. |
static ServiceException[] |
extractExceptions(org.jdom.Element serviceNotes)
Extract all exceptions from a serviceNotes XML element. |
String |
format(int indent)
Return the same contents as toString() method but
indented by level expressed in the parameter 'indent'. |
String |
getDataName()
Return an article (data) name of an offending data input. |
int |
getErrorCode()
Return an error code associated with this exception. |
String |
getErrorCodeAsString()
Return a stringified form of the error code associated with this exception. |
String |
getJobId()
Return an identifier of an offending job. |
String |
getMessage()
Return an error message associated with this exception. |
int |
getSeverity()
Return the current severity level. |
String |
getSeverityAsString()
Return the current severity level in a stringified form. |
static ServiceException |
info(String msg)
Create an instance of ServiceException that represents an info. |
void |
setDataName(String name)
Set an article name of an offending data input. |
void |
setErrorCode(int code)
Assign an error code to this exception. |
void |
setJobId(MobyJob job)
Set an identifier of an offending job. |
void |
setJobId(String id)
Set an identifier of an offending job. |
void |
setMessage(String msg)
Assign an error message to this exception. |
void |
setSeverity(int severity)
Set severity level. |
void |
setSeverity(String severityName)
Set severity level. |
String |
toString()
|
org.jdom.Element |
toXML()
|
String |
toXMLString()
|
static ServiceException |
warning(String msg)
Create an instance of ServiceException that represents a warning. |
Methods inherited from class org.biomoby.shared.MobyException |
---|
formatAndLog, getOriginalException |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int ERROR
public static final int WARNING
public static final int INFO
public static final int OK
INFO
-
indicating that actually no error occured and the service was
executed normally.
public static final int UNKNOWN_NAME
public static final int INPUTS_INVALID
public static final int INPUT_NOT_ACCEPTED
public static final int INPUT_REQUIRED_PARAMETER
public static final int INPUT_INCORRECT_PARAMETER
public static final int INPUT_INCORRECT_SIMPLE
public static final int INPUT_REQUIRED_PARAMETERS
public static final int INPUT_INCORRECT_COLLECTION
public static final int INPUT_EMPTY_OBJECT
public static final int INPUT_INCORRECT_NAMESPACE
public static final int NOT_RUNNABLE
public static final int NOT_RUNNING
public static final int NOT_TERMINATED
public static final int NO_METADATA_AVAILABLE
public static final int PROTOCOLS_UNACCEPTED
public static final int INTERNAL_PROCESSING_ERROR
public static final int COMMUNICATION_FAILURE
public static final int UNKNOWN_STATE
public static final int NOT_IMPLEMENTED
Constructor Detail |
---|
public ServiceException()
INFO
and
error code to OK
.
public ServiceException(int severity, int code, String message)
public ServiceException(int severity, int code, String jobId, String dataName)
public ServiceException(int severity, int code, String jobId, String dataName, String msg)
Method Detail |
---|
public static ServiceException error(int code, String msg)
code
- error codemsg
- error messagepublic static ServiceException error(String msg)
msg
- error messagepublic static ServiceException warning(String msg)
msg
- warning messagepublic static ServiceException info(String msg)
msg
- info messagepublic String getJobId()
public void setJobId(String id)
public void setJobId(MobyJob job)
job
- a job whose Id is usedpublic String getDataName()
public void setDataName(String name)
public String getMessage()
getMessage
in class Throwable
setMessage(java.lang.String)
,
or a default description (if nothing was set and the error code
is known to this class), or null.public void setMessage(String msg)
public int getSeverity()
ERROR
,
WARNING
,
INFO
public String getSeverityAsString()
public void setSeverity(int severity)
public void setSeverity(String severityName)
public int getErrorCode()
public String getErrorCodeAsString()
public void setErrorCode(int code)
public String toString()
toString
in class Throwable
public String format(int indent)
toString()
method but
indented by level expressed in the parameter 'indent'.
indent
- means a level of wanted indentation: number 1
means three spaces, number two six spaces, etc.
public org.jdom.Element toXML()
public static ServiceException[] extractExceptions(org.jdom.Element serviceNotes)
MobyPackage
.
serviceNotes
- a piece of XML
<serviceNotes>...</serviceNotes>
public String toXMLString()
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |