|
deegree-services-3.0-pre-nightly (2010/03/05 00:04) - official | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.services.controller.AbstractOGCServiceController
public abstract class AbstractOGCServiceController
Each concrete extension of this class is responsible for handling requests to a specific OGC web service (WPS, WMS, WFS, CSW,...).
OGCFrontController
,
ImplementationMetadata
Field Summary | |
---|---|
protected static String |
JAXB_CONFIG_CLASSPATH
JAXB classpath containing the configuration files in commons and other useful configuration locations. |
protected DeegreeServicesMetadata |
mainControllerConf
Common configuration (metadata) of parent OGCFrontController . |
protected SortedSet<org.deegree.commons.types.ows.Version> |
offeredVersions
Versions offered by the AbstractOGCServiceController instance (depends on configuration). |
Constructor Summary | |
---|---|
AbstractOGCServiceController()
|
Method Summary | ||
---|---|---|
protected void |
beginSOAPResponse(HttpResponseBuffer response)
Convenience method that may be used by controller implementations to produce OGC-SOAP responses. |
|
protected void |
checkConfigVersion(String confFileURL,
String configVersionString)
|
|
void |
checkOrCreateDCPGetURL(javax.servlet.http.HttpServletRequest requestWrapper)
Check if the main controller configuration defines a dcp 'GET' url if not, set it with the values gotten from the request. |
|
void |
checkOrCreateDCPPostURL(javax.servlet.http.HttpServletRequest requestWrapper)
Check if the main controller configuration defines a dcp 'POST' url if not, set it with the values gotten from the request. |
|
protected org.deegree.commons.types.ows.Version |
checkVersion(org.deegree.commons.types.ows.Version requestedVersion)
Checks if a request version can be handled by this controller (i.e. if is supported by the implementation *and* offered by the current configuration). |
|
abstract void |
destroy()
Called by the OGCFrontController to indicate to a subcontroller that the subcontroller is being taken out
of service. |
|
protected abstract void |
doKVP(Map<String,String> normalizedKVPParams,
javax.servlet.http.HttpServletRequest request,
HttpResponseBuffer response,
List<org.apache.commons.fileupload.FileItem> multiParts)
Called by the OGCFrontController to allow this AbstractOGCServiceController to handle a KVP
request. |
|
protected void |
doSOAP(org.apache.axiom.soap.SOAPEnvelope soapDoc,
javax.servlet.http.HttpServletRequest request,
HttpResponseBuffer response,
List<org.apache.commons.fileupload.FileItem> multiParts,
org.apache.axiom.soap.SOAPFactory factory)
Called by the OGCFrontController to allow this AbstractOGCServiceController to handle a SOAP
request. |
|
protected abstract void |
doXML(XMLStreamReader xmlStream,
javax.servlet.http.HttpServletRequest request,
HttpResponseBuffer response,
List<org.apache.commons.fileupload.FileItem> multiParts)
Called by the OGCFrontController to allow this AbstractOGCServiceController to handle an XML
request. |
|
protected void |
endSOAPResponse(HttpResponseBuffer response)
Finishes an OGC-SOAP response that has been initiated by beginSOAPResponse(HttpResponseBuffer) . |
|
org.deegree.commons.utils.Pair<XMLExceptionSerializer<OWSException>,String> |
getExceptionSerializer(org.deegree.commons.types.ows.Version requestVersion)
Returns the ExceptionSerializer and mime-type suitable for the given request version. |
|
Set<String> |
getHandledNamespaces()
Returns all namespaces that are handled by this controller. |
|
Set<String> |
getHandledRequests()
Returns the names of all requests that are handled by this controller. |
|
String |
getOfferedVersionsString()
Returns the offered protocol versions. |
|
Schema |
getSchemaForUrl(String schemaFile)
Tries to load a schema file from the given location, which might be useful for the validation of configuration files with JAXB. |
|
Unmarshaller |
getUnmarshaller(String additionalClasspath,
String schemaLocation)
Create a JAXB Unmarshaller which is instantiated with the given classpath (as well as the common
configuration classpath). |
|
protected void |
init(DeegreeServicesMetadata mainControllerConf,
ImplementationMetadata<? extends Enum<?>> serviceInformation,
org.deegree.commons.xml.XMLAdapter controllerConfig)
Initializes the AbstractOGCServiceController instance. |
|
abstract void |
init(org.deegree.commons.xml.XMLAdapter controllerConf,
DeegreeServicesMetadata serviceMetadata)
Called by the OGCFrontController to indicate to a subcontroller that it is being taken into service. |
|
protected org.deegree.commons.types.ows.Version |
negotiateVersion(org.deegree.protocol.ows.capabilities.GetCapabilities request)
Generic version negotiation algorithm for GetCapabilities requests according to OWS Common Specification
1.1.0 (OGC 06-121r3), section 7.3.2 and D.11. |
|
static
|
sendException(String contentType,
String encoding,
Map<String,String> additionalHeaders,
int httpStatusCode,
ExceptionSerializer<T> serializer,
T exception,
javax.servlet.http.HttpServletResponse response)
Sends an exception to the client. |
|
void |
sendSOAPException(org.apache.axiom.soap.SOAPHeader header,
org.apache.axiom.soap.SOAPFactory factory,
HttpResponseBuffer response,
OWSException exception,
XMLExceptionSerializer<OWSException> serializer,
String SOAPFaultCode,
String SOAPMessage,
String SOAPaction,
String characterEncoding)
Encapsulates the given OWSException into a SOAP environment for which the given factory will be used. |
|
protected ServiceIdentificationType |
synchronizeServiceIdentificationWithMainController(ServiceIdentificationType serviceIdentification)
|
|
protected ServiceProviderType |
synchronizeServiceProviderWithMainControllerConf(ServiceProviderType configuredServiceProvider)
|
|
protected void |
validateAndSetOfferedVersions(Collection<String> requestedVersions)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DeegreeServicesMetadata mainControllerConf
OGCFrontController
.
protected static final String JAXB_CONFIG_CLASSPATH
protected SortedSet<org.deegree.commons.types.ows.Version> offeredVersions
AbstractOGCServiceController
instance (depends on configuration).
Versions are sorted from lowest to highest in order to support the (old-style) version negotiation algorithm.
Constructor Detail |
---|
public AbstractOGCServiceController()
Method Detail |
---|
protected void init(DeegreeServicesMetadata mainControllerConf, ImplementationMetadata<? extends Enum<?>> serviceInformation, org.deegree.commons.xml.XMLAdapter controllerConfig) throws ControllerInitException
AbstractOGCServiceController
instance.
mainControllerConf
- serviceInformation
- controllerConfig
- controller configuration, must not be null
ControllerInitException
- if the config version does not match one of the supported versionspublic final Set<String> getHandledRequests()
public final Set<String> getHandledNamespaces()
public abstract void init(org.deegree.commons.xml.XMLAdapter controllerConf, DeegreeServicesMetadata serviceMetadata) throws ControllerInitException
OGCFrontController
to indicate to a subcontroller that it is being taken into service.
controllerConf
- provides access to the (always xml-based) configuration of the controllerserviceMetadata
- services metadata from the main service configuration for all services
ControllerInitException
- indicates that the initialization failedpublic abstract void destroy()
OGCFrontController
to indicate to a subcontroller that the subcontroller is being taken out
of service.
protected final void validateAndSetOfferedVersions(Collection<String> requestedVersions) throws ControllerInitException
requestedVersions
-
ControllerInitException
protected abstract void doKVP(Map<String,String> normalizedKVPParams, javax.servlet.http.HttpServletRequest request, HttpResponseBuffer response, List<org.apache.commons.fileupload.FileItem> multiParts) throws javax.servlet.ServletException, IOException
OGCFrontController
to allow this AbstractOGCServiceController
to handle a KVP
request.
normalizedKVPParams
- request parameters (keys are uppercased)request
- provides access to all information of the original HTTP request (NOTE: may be GET or POST)response
- response that is sent to the clientmultiParts
- A list of multiparts contained in the request. If the request was not a multipart request the list
will be null
. If multiparts were found, the requestDoc will be the first (xml-lized)
FileItem
in the list.
javax.servlet.ServletException
IOException
protected abstract void doXML(XMLStreamReader xmlStream, javax.servlet.http.HttpServletRequest request, HttpResponseBuffer response, List<org.apache.commons.fileupload.FileItem> multiParts) throws javax.servlet.ServletException, IOException
OGCFrontController
to allow this AbstractOGCServiceController
to handle an XML
request.
xmlStream
- provides access to the XML request, cursor points to the START_ELEMENT event of the root element,
never null
request
- provides access to all information of the original HTTP request (NOTE: may be GET or POST), never
null
response
- response that is sent to the client, never null
multiParts
- A list of multiparts contained in the request. If the request was not a multipart request the list
will be null
. If multiparts were found, the xmlStream will provide access to the first
(xml-lized) FileItem
in the list of multi parts
javax.servlet.ServletException
IOException
protected void doSOAP(org.apache.axiom.soap.SOAPEnvelope soapDoc, javax.servlet.http.HttpServletRequest request, HttpResponseBuffer response, List<org.apache.commons.fileupload.FileItem> multiParts, org.apache.axiom.soap.SOAPFactory factory) throws javax.servlet.ServletException, IOException
OGCFrontController
to allow this AbstractOGCServiceController
to handle a SOAP
request.
soapDoc
- XMLAdapter
for parsing the SOAP request documentrequest
- provides access to all information of the original HTTP request (NOTE: may be GET or POST)response
- response that is sent to the clientmultiParts
- A list of multiparts contained in the request. If the request was not a multipart request the list
will be null
. If multiparts were found, the requestDoc will be the first (xml-lized)
FileItem
in the list.factory
- initialized to the soap version of the request.
javax.servlet.ServletException
IOException
- if an IOException occurredprotected void beginSOAPResponse(HttpResponseBuffer response) throws XMLStreamException, IOException
Performs the following actions using the given HttpResponseBuffer
:
application/soap+xml
soapenv:Envelope
and soapenv:Body
elements
After calling this method, the controller may simply write the normal OGC-XML response using the
HttpResponseBuffer.getXMLWriter()
object and call endSOAPResponse(HttpResponseBuffer)
afterwards.
response
-
XMLStreamException
IOException
endSOAPResponse(HttpResponseBuffer)
protected void endSOAPResponse(HttpResponseBuffer response) throws IOException, XMLStreamException
beginSOAPResponse(HttpResponseBuffer)
.
response
-
IOException
XMLStreamException
beginSOAPResponse(HttpResponseBuffer)
protected org.deegree.commons.types.ows.Version checkVersion(org.deegree.commons.types.ows.Version requestedVersion) throws OWSException
NOTE: This method does use exception code OWSException.INVALID_PARAMETER_VALUE
, not
OWSException.VERSION_NEGOTIATION_FAILED
-- the latter should only be used for failed GetCapabilities
requests.
requestedVersion
- version to be checked, may be null (causes exception)
requestedVersion
(if it is not null), or highest version supported
OWSException
- if the requested version is not availablepublic String getOfferedVersionsString()
protected void checkConfigVersion(String confFileURL, String configVersionString) throws ControllerInitException
confFileURL
- configVersionString
-
ControllerInitException
protected org.deegree.commons.types.ows.Version negotiateVersion(org.deegree.protocol.ows.capabilities.GetCapabilities request) throws OWSException
GetCapabilities
requests according to OWS Common Specification
1.1.0 (OGC 06-121r3), section 7.3.2 and D.11.
request
- GetCapabilities
request
OWSException
- if new-style version negotiation is used and no common version existspublic static <T extends ControllerException> void sendException(String contentType, String encoding, Map<String,String> additionalHeaders, int httpStatusCode, ExceptionSerializer<T> serializer, T exception, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
T
- the type of the Exception, which should be subtype of controller exceptioncontentType
- of the exception responseencoding
- of the exception responseadditionalHeaders
- to add to the response.httpStatusCode
- of the exception responseserializer
- responsible for creating the appropriate response format of the exception.exception
- the cause, holding relevant information.response
- to write to.
javax.servlet.ServletException
- if the exception could not be sent.public void sendSOAPException(org.apache.axiom.soap.SOAPHeader header, org.apache.axiom.soap.SOAPFactory factory, HttpResponseBuffer response, OWSException exception, XMLExceptionSerializer<OWSException> serializer, String SOAPFaultCode, String SOAPMessage, String SOAPaction, String characterEncoding) throws javax.servlet.ServletException
OWSException
into a SOAP environment for which the given factory will be used.
header
- SOAPheaders to be set in the envelope, if missing no headers will be set.factory
- to create the soap elements.response
- to write to.exception
- to write in the 'fault/detail' sectionserializer
- to use for writing the OWSException
.SOAPFaultCode
- optional (see SOAPException
for valid once. If missing SOAPException.SENDER
will be
used.SOAPMessage
- optional message to explicitly set. If missing the owsException message will be used.SOAPaction
- to set, optional.characterEncoding
- of the response.
javax.servlet.ServletException
protected ServiceProviderType synchronizeServiceProviderWithMainControllerConf(ServiceProviderType configuredServiceProvider)
configuredServiceProvider
- to be synchronized with the main configuration
protected ServiceIdentificationType synchronizeServiceIdentificationWithMainController(ServiceIdentificationType serviceIdentification)
serviceIdentification
- to be synchronized with the configuration of the main controller.
public Schema getSchemaForUrl(String schemaFile)
schemaFile
- location like: "/META-INF/schemas/[SERVICE_NAME]/[VERSION]/[SERVICE_NAME]_service_configuration.xsd"
null
if no schema could be loaded from the given url.public Unmarshaller getUnmarshaller(String additionalClasspath, String schemaLocation) throws JAXBException
Unmarshaller
which is instantiated with the given classpath (as well as the common
configuration classpath). If the given schemalocation is not null
, the unmarshaller will validate
against the schema file loaded from the given location.
additionalClasspath
- which will be added to the JAXB_CONFIG_CLASSPATH
.schemaLocation
- if not null
this method will try to load the schema from location and set the validation
in the unmarshaller. This location could be:
"/META-INF/schemas/[SERVICE_NAME]/[VERSION]/[SERVICE_NAME]_service_configuration.xsd"
JAXBException
- if the Unmarshaller
could not be created.public void checkOrCreateDCPPostURL(javax.servlet.http.HttpServletRequest requestWrapper)
requestWrapper
- public void checkOrCreateDCPGetURL(javax.servlet.http.HttpServletRequest requestWrapper)
requestWrapper
- to get the requested url from.public org.deegree.commons.utils.Pair<XMLExceptionSerializer<OWSException>,String> getExceptionSerializer(org.deegree.commons.types.ows.Version requestVersion)
ExceptionSerializer
and mime-type suitable for the given request version.
requestVersion
- version of the request for which the exception has to be produced, may be null
(implies
that the serializer and mime type for the highest supported version shall be returned)
null
|
deegree-services-3.0-pre-nightly (2010/03/05 00:04) - official | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |