001    // $HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/ogcwebservices/ExceptionReport.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.ogcwebservices;
037    
038    import java.util.ArrayList;
039    import java.util.List;
040    
041    /**
042     * <p>
043     * Upon receiving an invalid operation request, each OWS shall respond to the client using an
044     * Exception Report message to describe to the client application and/or its human user the
045     * reason(s) that the request is invalid. Whenever a server detects an exception condition while
046     * responding to a valid operation request, and cannot produce a normal response to that operation,
047     * the server shall also respond to the client using an Exception Report.
048     * </p>
049     * <p>
050     * Each Exception Report shall contain one or more Exception elements, with each such element
051     * signalling detection of an independent error. Each Exception element shall contain the parameters
052     * ExceptionText, exceptionCode and locator.
053     * </p>
054     *
055     * @version $Revision: 18195 $
056     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
057     * @author last edited by: $Author: mschneider $
058     *
059     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
060     *
061     * @since 2.0
062     */
063    public class ExceptionReport {
064    
065        private List<OGCWebServiceException> exceptions = new ArrayList<OGCWebServiceException>();
066    
067        private String version = "1.0.0";
068    
069        private String language = "en";
070    
071        /**
072         * @param exceptions
073         */
074        public ExceptionReport( OGCWebServiceException[] exceptions ) {
075            setExceptions( exceptions );
076        }
077    
078        /**
079         * @param exceptions
080         * @param version
081         */
082        public ExceptionReport( OGCWebServiceException[] exceptions, String version ) {
083            setExceptions( exceptions );
084            setVersion( version );
085        }
086    
087        /**
088         * @param exceptions
089         * @param version
090         * @param language
091         */
092        public ExceptionReport( OGCWebServiceException[] exceptions, String version, String language ) {
093            setExceptions( exceptions );
094            setVersion( version );
095            setLanguage( language );
096        }
097    
098        /**
099         * @return Returns the exceptions.
100         *
101         */
102        public OGCWebServiceException[] getExceptions() {
103            OGCWebServiceException[] owse = new OGCWebServiceException[exceptions.size()];
104            return exceptions.toArray( owse );
105        }
106    
107        /**
108         * @param exceptions
109         *            The exceptions to set.
110         */
111        public void setExceptions( OGCWebServiceException[] exceptions ) {
112            this.exceptions.clear();
113            for ( int i = 0; i < exceptions.length; i++ ) {
114                this.exceptions.add( exceptions[i] );
115            }
116        }
117    
118        /**
119         * @return Returns the language.
120         *
121         */
122        public String getLanguage() {
123            return language;
124        }
125    
126        /**
127         * @param language
128         *            The language to set.
129         *
130         */
131        public void setLanguage( String language ) {
132            this.language = language;
133        }
134    
135        /**
136         * @return Returns the version.
137         */
138        public String getVersion() {
139            return version;
140        }
141    
142        /**
143         * @param version
144         *            The version to set.
145         */
146        public void setVersion( String version ) {
147            this.version = version;
148        }
149    
150    }