001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.ows;
017:
018: import org.xml.sax.SAXException;
019:
020: /**
021: * <p>
022: * DOCUMENT ME!
023: * </p>
024: *
025: * @author dzwiers
026: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/ows/ServiceException.java $
027: */
028: public class ServiceException extends SAXException {
029: /*
030: * Constants used in communications with Web Map Servers
031: */
032: /** Request contains a Format not offered by the service instance */
033: public static final String INVALID_FORMAT = "InvalidFormat";
034: /**
035: * Request contains an SRS not offered by the service instance
036: * for one or more of the Layers in the request.
037: */
038: public static final String INVALID_SRS = "InvalidSRS";
039: /**
040: * Request contains a CRS not offered by the server for one or
041: * more of the Layers in the request.
042: */
043: public static final String INVALID_CRS = "InvalidCRS";
044: /** Request is for a Layer not offered by the service instance. */
045: public static final String LAYER_NOT_DEFINED = "LayerNotDefined";
046: /** Request is for a Layer in a Style not offered by the service instance. */
047: public static final String STYLE_NOT_DEFINED = "StyleNotDefined";
048: /** GetFeatureInfo request is applied to a Layer which is not declared queryable. */
049: public static final String LAYER_NOT_QUERYABLE = "LayerNotQueryable";
050: /**
051: * Value of (optional) UpdateSequence parameter in GetCapabilities request is
052: * equal to current value of Capabilities XML update sequence number.
053: */
054: public static final String CURRENT_UPDATE_SEQUENCE = "CurrentUpdateSequence";
055: /**
056: * Value of (optional) UpdateSequence parameter in GetCapabilities request is
057: * greater than current value of Capabilities XML update sequence number.
058: */
059: public static final String INVALID_UPDATE_SEQUENCE = "InvalidUpdateSequence";
060: /**
061: * Request does not include a sample dimension value, and the service instance
062: * did not declare a default value for that dimension.
063: */
064: public static final String MISSING_DIMENSION_VALUE = "MissingDimensionValue";
065: /** Request contains an invalid sample dimension value. */
066: public static final String INVALID_DIMENSION_VALUE = "InvalidDimensionValue";
067: /** Request is for an optional operation that is not supported by the server. */
068: public static final String OPERATION_NOT_SUPPORTED = "OperationNotSupported";
069: /*
070: * END WMS Constants
071: */
072:
073: /**
074: * Comment for <code>serialVersionUID</code>
075: */
076: private static final long serialVersionUID = (("org.geotools.data.ows.ServiceException")
077: .hashCode());
078: private String code = "";
079: private String locator = null;
080: private ServiceException next; //So they can be chained
081:
082: private ServiceException() {
083: super ("");
084: // should not be called
085: }
086:
087: /**
088: * @param msg Message
089: * @see SAXException#SAXException(java.lang.String)
090: */
091: public ServiceException(String msg) {
092: super (msg);
093: }
094:
095: public ServiceException(String msg, String code) {
096: super (msg);
097: this .code = code;
098: }
099:
100: /**
101: * Passes the message to the parent, or the code if the message is null.
102: *
103: * @param msg Message
104: * @param code Error Code
105: * @param locator Error Location
106: * @see SAXException#SAXException(java.lang.String)
107: */
108: public ServiceException(String msg, String code, String locator) {
109: super ((msg == null) ? code : msg);
110: this .code = code;
111: this .locator = locator;
112: }
113:
114: /**
115: * @return String the error code, such as 404-Not Found
116: */
117: public String getCode() {
118: return code;
119: }
120:
121: /**
122: * @return String the location of the error, useful for parse errors
123: */
124: public String getLocator() {
125: return locator;
126: }
127:
128: public ServiceException getNext() {
129: return next;
130: }
131:
132: public void setNext(ServiceException next) {
133: this.next = next;
134: }
135: }
|