001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/ogcwebservices/wass/was/capabilities/WASCapabilitiesDocument.java $ 002 /*---------------- FILE HEADER ------------------------------------------ 003 004 This file is part of deegree. 005 Copyright (C) 2001-2004 by: 006 EXSE, Department of Geography, University of Bonn 007 http://www.giub.uni-bonn.de/exse/ 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 Meckenheimer Allee 176 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 package org.deegree.ogcwebservices.wass.was.capabilities; 045 046 047 import java.io.IOException; 048 import java.net.MalformedURLException; 049 import java.net.URISyntaxException; 050 import java.util.ArrayList; 051 052 import org.deegree.framework.log.ILogger; 053 import org.deegree.framework.log.LoggerFactory; 054 import org.deegree.framework.xml.XMLParsingException; 055 import org.deegree.i18n.Messages; 056 import org.deegree.ogcbase.CommonNamespaces; 057 import org.deegree.ogcwebservices.getcapabilities.InvalidCapabilitiesException; 058 import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities; 059 import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification; 060 import org.deegree.ogcwebservices.getcapabilities.ServiceProvider; 061 import org.deegree.ogcwebservices.wass.common.OWSCapabilitiesBaseDocument_1_0; 062 import org.deegree.ogcwebservices.wass.common.OperationsMetadata_1_0; 063 import org.deegree.ogcwebservices.wass.common.SupportedAuthenticationMethod; 064 import org.xml.sax.SAXException; 065 066 /** 067 * Parser for the WAS capabilities according to GDI NRW spec V1.0. 068 * 069 * Namespace: http://www.gdi-nrw.org/was 070 * 071 * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a> 072 * @author last edited by: $Author: aschmitz $ 073 * 074 * @version $Revision: 7341 $, $Date: 2007-05-29 14:03:14 +0200 (Di, 29 Mai 2007) $ 075 */ 076 public class WASCapabilitiesDocument extends OWSCapabilitiesBaseDocument_1_0 { 077 078 private static final long serialVersionUID = -6646616562364235109L; 079 080 private static final ILogger LOG = LoggerFactory.getLogger( WASCapabilitiesDocument.class ); 081 082 /** 083 * This is the XML template used for the GetCapabilities response document. 084 */ 085 public static final String XML_TEMPLATE = "WASCapabilitiesTemplate.xml"; 086 087 /** 088 * Creates an empty document from default template. 089 * 090 * @throws IOException 091 * @throws SAXException 092 */ 093 public void createEmptyDocument() 094 throws IOException, SAXException { 095 super.createEmptyDocument( XML_TEMPLATE ); 096 } 097 098 /* 099 * (non-Javadoc) 100 * 101 * @see org.deegree.ogcwebservices.getcapabilities.OGCCapabilitiesDocument#parseCapabilities() 102 */ 103 @Override 104 public OGCCapabilities parseCapabilities() 105 throws InvalidCapabilitiesException { 106 107 108 WASCapabilities wasCapabilites = null; 109 try { 110 111 ServiceIdentification sf = parseServiceIdentification(); 112 ServiceProvider sp = parseServiceProvider(); 113 OperationsMetadata_1_0 om = parseOperationsMetadata(); 114 String version = parseVersion(); 115 String updateSequence = parseUpdateSequence(); 116 117 ArrayList<SupportedAuthenticationMethod> am = parseSupportedAuthenticationMethods( CommonNamespaces.GDINRWWAS_PREFIX ); 118 wasCapabilites = new WASCapabilities( version, updateSequence, sf, sp, om, am ); 119 120 } catch ( XMLParsingException e ) { 121 LOG.logError( e.getLocalizedMessage(), e ); 122 throw new InvalidCapabilitiesException( 123 Messages.getMessage( 124 "WASS_ERROR_CAPABILITIES_NOT_PARSED", 125 "WAS" ) ); 126 } catch ( URISyntaxException e ) { 127 LOG.logError( e.getLocalizedMessage(), e ); 128 throw new InvalidCapabilitiesException( 129 Messages.getMessage( 130 "WASS_ERROR_URI_NOT_READ", 131 new Object[] { "WAS", 132 "(unknown)" } ) ); 133 } catch ( MalformedURLException e ) { 134 LOG.logError( e.getLocalizedMessage(), e ); 135 throw new InvalidCapabilitiesException( 136 Messages.getMessage( 137 "WASS_ERROR_URL_NOT_READ", 138 new Object[] { "WAS", 139 "(unknown)" } ) ); 140 } 141 142 143 return wasCapabilites; 144 } 145 146 }