001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/wass/was/capabilities/WASCapabilitiesDocument.java $ 002 /*---------------- FILE HEADER ------------------------------------------ 003 004 This file is part of deegree. 005 Copyright (C) 2001-2008 by: 006 EXSE, Department of Geography, University of Bonn 007 http://www.giub.uni-bonn.de/deegree/ 008 lat/lon GmbH 009 http://www.lat-lon.de 010 011 This library is free software; you can redistribute it and/or 012 modify it under the terms of the GNU Lesser General Public 013 License as published by the Free Software Foundation; either 014 version 2.1 of the License, or (at your option) any later version. 015 016 This library is distributed in the hope that it will be useful, 017 but WITHOUT ANY WARRANTY; without even the implied warranty of 018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 019 Lesser General Public License for more details. 020 021 You should have received a copy of the GNU Lesser General Public 022 License along with this library; if not, write to the Free Software 023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 024 025 Contact: 026 027 Andreas Poth 028 lat/lon GmbH 029 Aennchenstr. 19 030 53115 Bonn 031 Germany 032 E-Mail: poth@lat-lon.de 033 034 Prof. Dr. Klaus Greve 035 Department of Geography 036 University of Bonn 037 Meckenheimer Allee 166 038 53115 Bonn 039 Germany 040 E-Mail: greve@giub.uni-bonn.de 041 042 043 ---------------------------------------------------------------------------*/ 044 045 package org.deegree.ogcwebservices.wass.was.capabilities; 046 047 048 import java.io.IOException; 049 import java.net.MalformedURLException; 050 import java.net.URISyntaxException; 051 import java.util.ArrayList; 052 053 import org.deegree.framework.log.ILogger; 054 import org.deegree.framework.log.LoggerFactory; 055 import org.deegree.framework.xml.XMLParsingException; 056 import org.deegree.i18n.Messages; 057 import org.deegree.ogcbase.CommonNamespaces; 058 import org.deegree.ogcwebservices.getcapabilities.InvalidCapabilitiesException; 059 import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities; 060 import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification; 061 import org.deegree.ogcwebservices.getcapabilities.ServiceProvider; 062 import org.deegree.ogcwebservices.wass.common.OWSCapabilitiesBaseDocument_1_0; 063 import org.deegree.ogcwebservices.wass.common.OperationsMetadata_1_0; 064 import org.deegree.ogcwebservices.wass.common.SupportedAuthenticationMethod; 065 import org.xml.sax.SAXException; 066 067 /** 068 * Parser for the WAS capabilities according to GDI NRW spec V1.0. 069 * 070 * Namespace: http://www.gdi-nrw.org/was 071 * 072 * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a> 073 * @author last edited by: $Author: apoth $ 074 * 075 * @version $Revision: 9345 $, $Date: 2007-12-27 17:22:25 +0100 (Do, 27 Dez 2007) $ 076 */ 077 public class WASCapabilitiesDocument extends OWSCapabilitiesBaseDocument_1_0 { 078 079 private static final long serialVersionUID = -6646616562364235109L; 080 081 private static final ILogger LOG = LoggerFactory.getLogger( WASCapabilitiesDocument.class ); 082 083 /** 084 * This is the XML template used for the GetCapabilities response document. 085 */ 086 public static final String XML_TEMPLATE = "WASCapabilitiesTemplate.xml"; 087 088 /** 089 * Creates an empty document from default template. 090 * 091 * @throws IOException 092 * @throws SAXException 093 */ 094 public void createEmptyDocument() 095 throws IOException, SAXException { 096 super.createEmptyDocument( XML_TEMPLATE ); 097 } 098 099 /* 100 * (non-Javadoc) 101 * 102 * @see org.deegree.ogcwebservices.getcapabilities.OGCCapabilitiesDocument#parseCapabilities() 103 */ 104 @Override 105 public OGCCapabilities parseCapabilities() 106 throws InvalidCapabilitiesException { 107 108 109 WASCapabilities wasCapabilites = null; 110 try { 111 112 ServiceIdentification sf = parseServiceIdentification(); 113 ServiceProvider sp = parseServiceProvider(); 114 OperationsMetadata_1_0 om = parseOperationsMetadata(); 115 String version = parseVersion(); 116 String updateSequence = parseUpdateSequence(); 117 118 ArrayList<SupportedAuthenticationMethod> am = parseSupportedAuthenticationMethods( CommonNamespaces.GDINRWWAS_PREFIX ); 119 wasCapabilites = new WASCapabilities( version, updateSequence, sf, sp, om, am ); 120 121 } catch ( XMLParsingException e ) { 122 LOG.logError( e.getLocalizedMessage(), e ); 123 throw new InvalidCapabilitiesException( 124 Messages.getMessage( 125 "WASS_ERROR_CAPABILITIES_NOT_PARSED", 126 "WAS" ) ); 127 } catch ( URISyntaxException e ) { 128 LOG.logError( e.getLocalizedMessage(), e ); 129 throw new InvalidCapabilitiesException( 130 Messages.getMessage( 131 "WASS_ERROR_URI_NOT_READ", 132 new Object[] { "WAS", 133 "(unknown)" } ) ); 134 } catch ( MalformedURLException e ) { 135 LOG.logError( e.getLocalizedMessage(), e ); 136 throw new InvalidCapabilitiesException( 137 Messages.getMessage( 138 "WASS_ERROR_URL_NOT_READ", 139 new Object[] { "WAS", 140 "(unknown)" } ) ); 141 } 142 143 144 return wasCapabilites; 145 } 146 147 }