//$Header: /home/deegree/jail/deegreerepository/deegree/src/org/deegree/ogcwebservices/wass/wss/capabilities/WSSCapabilitiesDocument.java,v 1.11 2006/11/27 09:07:53 poth Exp $
/*---------------- FILE HEADER ------------------------------------------
This file is part of deegree.
Copyright (C) 2001-2006 by:
EXSE, Department of Geography, University of Bonn
http://www.giub.uni-bonn.de/exse/
lat/lon GmbH
http://www.lat-lon.de
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact:
Andreas Poth
lat/lon GmbH
Aennchenstraße 19
53177 Bonn
Germany
E-Mail: poth@lat-lon.de
Jens Fitzke
lat/lon GmbH
Aennchenstraße 19
53177 Bonn
Germany
E-Mail: jens.fitzke@uni-bonn.de
---------------------------------------------------------------------------*/
package org.deegree.ogcwebservices.wass.wss.capabilities;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import org.deegree.framework.log.ILogger;
import org.deegree.framework.log.LoggerFactory;
import org.deegree.framework.xml.XMLParsingException;
import org.deegree.framework.xml.XMLTools;
import org.deegree.ogcbase.CommonNamespaces;
import org.deegree.ogcwebservices.getcapabilities.InvalidCapabilitiesException;
import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification;
import org.deegree.ogcwebservices.getcapabilities.ServiceProvider;
import org.deegree.ogcwebservices.wass.common.Messages;
import org.deegree.ogcwebservices.wass.common.OWSCapabilitiesBaseDocument_1_0;
import org.deegree.ogcwebservices.wass.common.OperationsMetadata_1_0;
import org.deegree.ogcwebservices.wass.common.SupportedAuthenticationMethod;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* A <code>WSSCapabilitiesDocument</code> class can parse xml-based requests. The gdi-nrw access
* control specification 1.0 defines xml-elements of type owscommon 1.0 hence this class base class
* is OWSCapabilitiesBaseDocument_1_0. For creating an empty response document a
* XML-Response-Template is located under WSSCapablitiesTemplate.xml .
*
* @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
* @author last edited by: $Author: poth $
*
* @version 2.0, $Revision: 1.11 $, $Date: 2006/11/27 09:07:53 $
*
* @since 2.0
*/
public class WSSCapabilitiesDocument extends OWSCapabilitiesBaseDocument_1_0 {
private static final long serialVersionUID = 4456377564478064784L;
/**
* The logger enhances the quality and simplicity of Debugging within the deegree2 framework
*/
private static final ILogger LOG = LoggerFactory.getLogger( WSSCapabilitiesDocument.class );
/**
* This is the XML template used for the GetCapabilities response document.
*/
public static final String XML_TEMPLATE = "WSSCapabilitiesTemplate.xml";
private static String PRE = CommonNamespaces.GDINRWWSS_PREFIX + ":";
/*
* (non-Javadoc)
*
* @see org.deegree.ogcwebservices.getcapabilities.OGCCapabilitiesDocument#parseCapabilities()
*/
@Override
public OGCCapabilities parseCapabilities()
throws InvalidCapabilitiesException {
LOG.entering();
WSSCapabilities wssCapabilities = null;
try {
ServiceIdentification sf = parseServiceIdentification();
ServiceProvider sp = parseServiceProvider();
OperationsMetadata_1_0 om = parseOperationsMetadata();
String version = parseVersion();
String updateSequence = parseUpdateSequence();
ArrayList<SupportedAuthenticationMethod> am = parseSupportedAuthenticationMethods( CommonNamespaces.GDINRWWSS_PREFIX );
String securedServiceType = parseSecuredServiceType();
wssCapabilities = new WSSCapabilities( version, updateSequence, sf, sp, om,
securedServiceType, am );
} catch ( XMLParsingException e ) {
LOG.logError( e.getLocalizedMessage(), e );
throw new InvalidCapabilitiesException(
Messages.format(
"ogcwebservices.wass.ERROR_CAPABILITIES_NOT_PARSED",
"WSS" ) );
} catch ( URISyntaxException e ) {
LOG.logError( e.getLocalizedMessage(), e );
throw new InvalidCapabilitiesException(
Messages.format(
"ogcwebservices.wass.ERROR_URI_NOT_READ",
new String[] { "WSS",
"(unknown)" } ) );
} catch ( MalformedURLException e ) {
LOG.logError( e.getLocalizedMessage(), e );
throw new InvalidCapabilitiesException(
Messages.format(
"ogcwebservices.wass.ERROR_URL_NOT_READ",
new String[] { "WSS",
"(unknown)" } ) );
}
LOG.exiting();
return wssCapabilities;
}
/**
* @return the secured service as String
* @throws XMLParsingException
*/
public String parseSecuredServiceType()
throws XMLParsingException {
Element capability = (Element) XMLTools.getRequiredNode( getRootElement(), PRE
+ "Capability",
nsContext );
return XMLTools.getRequiredNodeAsString( capability, PRE + "SecuredServiceType", nsContext );
}
/**
* @throws SAXException
* @throws IOException
*
*/
public void createEmptyDocument()
throws IOException, SAXException {
super.createEmptyDocument( XML_TEMPLATE );
}
}
/***************************************************************************************************
* Changes to this class. What the people have been up to: $Log: WSSCapabilitiesDocument.java,v $
* Changes to this class. What the people have been up to: Revision 1.11 2006/11/27 09:07:53 poth
* Changes to this class. What the people have been up to: JNI integration of proj4 has been removed. The CRS functionality now will be done by native deegree code.
* Changes to this class. What the people have been up to:
* Changes to this class. What the people have been up to: Revision 1.10 2006/08/24 06:42:17 poth
* Changes to this class. What the people have been up to: File header corrected
* Changes to this class. What the people have been up to:
* Changes to this class. What the people have been up to: Revision 1.9 2006/06/27 13:10:47 bezema
* Changes to this class. What the people have been up to: Finished the last bits of the configuration of the wass.
* Changes to this class. What the people have been up to:
* Changes to this class. What the people have been up to: Revision 1.8 2006/06/23 13:53:48 schmitz
* Changes to this class. What the people have been up to: Externalized all Strings, fixed up some exceptions and messages, reviewed/fixed some code.
* Changes to this class. What the people have been up to:
* Changes to this class. What the people have been up to: Revision 1.7 2006/06/20 15:31:04 bezema
* Changes to this class. What the people have been up to: It looks like the completion of wss. was needs further checking in a tomcat environment. The Strings must still be externalized. Logging is done, so is the formatting.
* Changes to this class. What the people have been up to:
* Changes to this class. What the people have been up to: Revision 1.6 2006/06/19 15:34:04 bezema
* Changes to this class. What the people have been up to: changed wass to handle things the right
* way Changes to this class. What the people have been up to: Changes to this class. What the
* people have been up to: Revision 1.5 2006/06/09 12:58:32 schmitz Changes to this class. What the
* people have been up to: Set up some tests for WAS/WSS and the URN class. Changes to this class.
* What the people have been up to: Commented out some of the deegree param stuff in order for the
* Changes to this class. What the people have been up to: tests to run. Changes to this class. What
* the people have been up to: Tests have hardcoded URLs in them, so they won't run just anywhere.
* Changes to this class. What the people have been up to: Revision 1.4 2006/05/30 10:12:02 bezema
* Putting the cvs asci option to -kkv which will update the $revision$ $author$ and $date$
* variables in a cvs commit
*
* Revision 1.2 2006/05/30 08:44:48 bezema Reararranging the layout (again) to use features of OOP.
* The owscommonDocument is the real baseclass now.
*
* Revision 1.1 2006/05/29 12:00:58 bezema Refactored the security and authentication webservices
* into one package WASS (Web Authentication -and- Security Services), also created a common package
* and a saml package which could be updated to work in the future.
*
* Revision 1.2 2006/05/23 15:22:02 bezema Added configuration files to the wss and wss is able to
* parse a DoService Request in xml
*
* Revision 1.1 2006/05/22 15:48:16 bezema Starting the parsing of the xml request in wss
*
*
**************************************************************************************************/