001: /*****************************************************************************
002: * Source code information
003: * -----------------------
004: * Original author Ian Dickinson, HP Labs Bristol
005: * Author email ian.dickinson@hp.com
006: * Package Jena 2
007: * Web http://sourceforge.net/projects/jena/
008: * Created 11-Sep-2003
009: * Filename $RCSfile: DIGErrorResponseException.java,v $
010: * Revision $Revision: 1.9 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2008/01/02 12:07:11 $
014: * by $Author: andy_seaborne $
015: *
016: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017: * [See end of file]
018: *****************************************************************************/package com.hp.hpl.jena.reasoner.dig;
019:
020: // Imports
021: ///////////////
022:
023: /**
024: * <p>
025: * An exception that encapsulates an error response from the DIG server, including
026: * error number and message.
027: * </p>
028: *
029: * @author Ian Dickinson, HP Labs (<a href="mailto:Ian.Dickinson@hp.com">email</a>)
030: * @version Release @release@ ($Id: DIGErrorResponseException.java,v 1.9 2008/01/02 12:07:11 andy_seaborne Exp $)
031: */
032: public class DIGErrorResponseException extends DIGReasonerException {
033: // Constants
034: //////////////////////////////////
035: private static final long serialVersionUID = 1669564065915390071L;
036:
037: public static final int GENERAL_UNSPECIFIED_ERROR = 100;
038: public static final int UNKNOWN_REQUEST = 101;
039: public static final int MAFORMED_REQUEST = 102;
040: public static final int UNSUPPORTED_OPERATION = 103;
041:
042: public static final int CANNOT_CREATE_NEW_KB = 201;
043: public static final int MALFORMED_KB_URI = 202;
044: public static final int UNKNOWN_OR_STALE_KB_URI = 203;
045: public static final int KB_RELEASE_ERROR = 204;
046: public static final int MISSING_URI = 205;
047:
048: public static final int GENERAL_TELL_ERROR = 301;
049: public static final int UNSUPPORTED_TELL_OPERATION = 302;
050: public static final int UNKNOWN_TELL_OPERATION = 303;
051:
052: public static final int GENERAL_ASK_ERROR = 401;
053: public static final int UNSUPPORTED_ASK_OPERATION = 402;
054: public static final int UNKNOWN_ASK_OPERATION = 403;
055:
056: // Static variables
057: //////////////////////////////////
058:
059: // Instance variables
060: //////////////////////////////////
061:
062: /** The msg attribute from the DIG error message */
063: private String m_msgAttr;
064:
065: /** The DIG error code */
066: private int m_errorCode;
067:
068: // Constructors
069: //////////////////////////////////
070:
071: public DIGErrorResponseException(String msg, String msgAttr,
072: int errorCode) {
073: super ("DIG error: " + msgAttr + " - " + msg);
074: m_msgAttr = msgAttr;
075: m_errorCode = errorCode;
076: }
077:
078: // External signature methods
079: //////////////////////////////////
080:
081: /**
082: * <p>Answer the error code sent back by DIG. Well known error codes are listed
083: * as constants exported from this class.</p>
084: * @return The DIG error code; the value of the <code>code</code> attribute in
085: * the error response returned by the reasoner.
086: */
087: public int getErrorCode() {
088: return m_errorCode;
089: }
090:
091: /**
092: * <p>Answer the error message sent back by DIG as the 'message' attribute.</p>
093: * @return The DIG error message; the value of the <code>message</code> attribute
094: * in the error response returned by the reasoner
095: */
096: public String getDIGMessageAttrib() {
097: return m_msgAttr;
098: }
099:
100: // Internal implementation methods
101: //////////////////////////////////
102:
103: //==============================================================================
104: // Inner class definitions
105: //==============================================================================
106:
107: }
108:
109: /*
110: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
111: * All rights reserved.
112: *
113: * Redistribution and use in source and binary forms, with or without
114: * modification, are permitted provided that the following conditions
115: * are met:
116: * 1. Redistributions of source code must retain the above copyright
117: * notice, this list of conditions and the following disclaimer.
118: * 2. Redistributions in binary form must reproduce the above copyright
119: * notice, this list of conditions and the following disclaimer in the
120: * documentation and/or other materials provided with the distribution.
121: * 3. The name of the author may not be used to endorse or promote products
122: * derived from this software without specific prior written permission.
123: *
124: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
125: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
126: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
127: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
128: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
129: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
130: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
131: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
132: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
133: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134: */
|