001 //$HeadURL: $
002 /*---------------- FILE HEADER ------------------------------------------
003 This file is part of deegree.
004 Copyright (C) 2001-2008 by:
005 Department of Geography, University of Bonn
006 http://www.giub.uni-bonn.de/deegree/
007 lat/lon GmbH
008 http://www.lat-lon.de
009
010 This library is free software; you can redistribute it and/or
011 modify it under the terms of the GNU Lesser General Public
012 License as published by the Free Software Foundation; either
013 version 2.1 of the License, or (at your option) any later version.
014 This library is distributed in the hope that it will be useful,
015 but WITHOUT ANY WARRANTY; without even the implied warranty of
016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017 Lesser General Public License for more details.
018 You should have received a copy of the GNU Lesser General Public
019 License along with this library; if not, write to the Free Software
020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021 Contact:
022
023 Andreas Poth
024 lat/lon GmbH
025 Aennchenstr. 19
026 53177 Bonn
027 Germany
028 E-Mail: poth@lat-lon.de
029
030 Prof. Dr. Klaus Greve
031 Department of Geography
032 University of Bonn
033 Meckenheimer Allee 166
034 53115 Bonn
035 Germany
036 E-Mail: greve@giub.uni-bonn.de
037 ---------------------------------------------------------------------------*/
038
039 package org.deegree.ogcwebservices.wcts.operation;
040
041 import org.deegree.framework.xml.XMLParsingException;
042 import org.deegree.i18n.Messages;
043 import org.deegree.ogcbase.ExceptionCode;
044 import org.deegree.ogcwebservices.OGCWebServiceException;
045 import org.deegree.ogcwebservices.wcts.WCTService;
046 import org.w3c.dom.Element;
047
048 /**
049 * <code>GetResourceByIDDocument</code> creates a bean-representation of a xml-dom GetRepository item request.
050 *
051 * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
052 *
053 * @author last edited by: $Author:$
054 *
055 * @version $Revision:$, $Date:$
056 *
057 */
058 public class GetResourceByIDDocument extends org.deegree.owscommon_1_1_0.GetResourceByIDDocument {
059
060 private static final long serialVersionUID = 2724928639257998459L;
061 private final GetResourceByID resourceById;
062
063
064 /**
065 * @param id of the request
066 * @param rootElement of the request
067 * @throws OGCWebServiceException if a mandatory item is missing, or the element could not be parsed.
068 * @throws IllegalArgumentException if the rootElement is <code>null</code>
069 */
070 public GetResourceByIDDocument( String id, Element rootElement ) throws OGCWebServiceException, IllegalArgumentException {
071 if( rootElement == null ){
072 throw new IllegalArgumentException( "The root element may not be null" );
073 }
074 setRootElement( rootElement );
075 try {
076 String service = parseService();
077 if ( !"WCTS".equalsIgnoreCase( service ) ) {
078 throw new OGCWebServiceException( Messages.getMessage( "WCTS_ILLEGAL_SERVICE" ),
079 ExceptionCode.INVALIDPARAMETERVALUE );
080 }
081 String version = parseVersion();
082 if ( !WCTService.version.equalsIgnoreCase( version ) ) {
083 throw new OGCWebServiceException( Messages.getMessage( "WCTS_ILLEGAL_VERSION", WCTService.version ),
084 ExceptionCode.INVALIDPARAMETERVALUE );
085 }
086
087 resourceById = new GetResourceByID( id, version, parseResourceIDs(), parseOutputFormats() );
088 } catch ( XMLParsingException e ) {
089 LOG.logError( e.getMessage(), e );
090 throw new OGCWebServiceException( e.getMessage(), ExceptionCode.MISSINGPARAMETERVALUE );
091 }
092
093 }
094
095 /**
096 * @return the resourceById bean.
097 */
098 public final GetResourceByID getResourceById() {
099 return resourceById;
100 }
101
102
103
104 }