net.sf.sparql.benchmarking.util
Class ErrorCategories

java.lang.Object
  extended by net.sf.sparql.benchmarking.util.ErrorCategories

public class ErrorCategories
extends Object

Helper class containing constants and methods related to error categories

Author:
rvesse

Field Summary
static int AUTHENTICATION
          Category indicating an authentication error
static int CHILD_MIX
          Category indicating errors in a child mix
static int EXECUTION
          Category indicating an execution error within an operation
static int HTTP_CLIENT_ERROR
          Category indicating a HTTP client error
static int HTTP_NOT_FOUND
          Category indicating a HTTP Not Found (404/410 error)
static int HTTP_SERVER_ERROR
          Category indicating a HTTP server error
static int INTERRUPT
          Category indicating an interrupt
static int NONE
          Category indicating there was no error
static int TIMEOUT
          Category indicating a time out
 
Method Summary
static void addDescription(int category, String description)
          Adds a description for a category
static int categorizeHttpError(HttpException httpError)
          Categorizes a HttpException
static int categorizeHttpError(int status)
          Categorizes a HTTP error based on the status code
static int categorizeHttpError(QueryExceptionHTTP httpError)
          Categorizes a QueryExceptionHTTP
static String getDescription(int category)
          Gets the description for the category which may be null if there is no registered description
static void resetDescriptions()
          Resets the descriptions to their defaults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Category indicating there was no error

See Also:
Constant Field Values

TIMEOUT

public static final int TIMEOUT
Category indicating a time out

See Also:
Constant Field Values

INTERRUPT

public static final int INTERRUPT
Category indicating an interrupt

See Also:
Constant Field Values

EXECUTION

public static final int EXECUTION
Category indicating an execution error within an operation

See Also:
Constant Field Values

AUTHENTICATION

public static final int AUTHENTICATION
Category indicating an authentication error

See Also:
Constant Field Values

HTTP_CLIENT_ERROR

public static final int HTTP_CLIENT_ERROR
Category indicating a HTTP client error

See Also:
Constant Field Values

HTTP_SERVER_ERROR

public static final int HTTP_SERVER_ERROR
Category indicating a HTTP server error

See Also:
Constant Field Values

HTTP_NOT_FOUND

public static final int HTTP_NOT_FOUND
Category indicating a HTTP Not Found (404/410 error)

See Also:
Constant Field Values

CHILD_MIX

public static final int CHILD_MIX
Category indicating errors in a child mix

See Also:
Constant Field Values
Method Detail

resetDescriptions

public static void resetDescriptions()
Resets the descriptions to their defaults


addDescription

public static void addDescription(int category,
                                  String description)
Adds a description for a category

Parameters:
category - Category
description - Description

getDescription

public static String getDescription(int category)
Gets the description for the category which may be null if there is no registered description

Parameters:
category - Category
Returns:
Category description if available, null otherwise

categorizeHttpError

public static int categorizeHttpError(HttpException httpError)
Categorizes a HttpException

Where possible this will use specific error categories such as AUTHENTICATION or HTTP_NOT_FOUND however many possible HTTP status codes are not specifically categorized and will be bucketed into HTTP_CLIENT_ERROR or HTTP_SERVER_ERROR as appropriate.

Parameters:
httpError - HTTP error
Returns:
Most appropriate error category

categorizeHttpError

public static int categorizeHttpError(QueryExceptionHTTP httpError)
Categorizes a QueryExceptionHTTP

Where possible this will use specific error categories such as AUTHENTICATION or HTTP_NOT_FOUND however many possible HTTP status codes are not specifically categorized and will be bucketed into HTTP_CLIENT_ERROR or HTTP_SERVER_ERROR as appropriate.

Parameters:
httpError - HTTP error
Returns:
Most appropriate error category

categorizeHttpError

public static int categorizeHttpError(int status)
Categorizes a HTTP error based on the status code

Where possible this will use specific error categories such as AUTHENTICATION or HTTP_NOT_FOUND however many possible HTTP status codes are not specifically categorized and will be bucketed into HTTP_CLIENT_ERROR or HTTP_SERVER_ERROR as appropriate.

Parameters:
status - Status Code
Returns:
Most appropriate error category


Copyright © 2014. All Rights Reserved.