org.deegree_impl.services.wms.protocol
Class WMSProtocolFactory

java.lang.Object
  extended byorg.deegree_impl.services.wms.protocol.WMSProtocolFactory

public class WMSProtocolFactory
extends java.lang.Object

Factory that builds the different types of WMS-Requests & Responses.

Version:
$Revision: 1.59 $ $Date: 2004/05/06 12:01:27 $
Author:
Markus Schneider, Andreas Poth, Jeronimo Wanhoff

Constructor Summary
WMSProtocolFactory()
           
 
Method Summary
static WMSGetCapabilitiesRequest createGetCapabilitiesRequest(java.lang.String id, java.util.HashMap paramMap)
          creates an WMS GetCapabilities Request
static WMSGetCapabilitiesResponse createGetCapabilitiesResponse(OGCWebServiceRequest request, OGCWebServiceException exception, WMSCapabilities capabilities)
          creates an instance of a WMSGetCapabilitiesResponse object
static WMSGetFeatureInfoRequest createGetFeatureInfoRequest(java.lang.String id, java.util.HashMap model)
          creates a WMSFeatureInfoRequest from a HashMap that contains the request parameters as key-value-pairs.
static WMSGetFeatureInfoRequest createGetFeatureInfoRequest(java.lang.String version, java.lang.String id, java.lang.String[] queryLayers, WMSGetMapRequest getMapRequestCopy, java.lang.String infoFormat, int featureCount, java.awt.Point clickPoint, java.lang.String exceptions, StyledLayerDescriptor sld, java.util.HashMap vendorSpecificParameter)
          creates a WMSFeatureInfoRequest from the request parameters.
static WMSGetFeatureInfoResponse createGetFeatureInfoResponse(OGCWebServiceRequest request, OGCWebServiceException exception, java.lang.String featureInfo)
          creates a WFSGetFeatureInfoResponse object
static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id, java.util.Map model)
           
static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id, java.lang.String request)
           
static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id, java.lang.String version, java.lang.String layer, java.lang.String style, java.lang.String featureType, java.lang.String rule, double scale, java.net.URL sld, java.lang.String sld_body, java.lang.String format, int width, int height, java.lang.String exceptions, java.util.Map vendorSpecificParameter)
           
static WMSGetLegendGraphicResponse createGetLegendGraphicResponse(OGCWebServiceRequest request, org.w3c.dom.Document exception)
           
static WMSGetLegendGraphicResponse createGetLegendGraphicResponse(OGCWebServiceRequest request, java.lang.Object legendGraphic)
           
static WMSGetMapRequest createGetMapRequest(java.lang.String id, org.w3c.dom.Element root)
          creates a WMSGetMapRequest from its XML representation as defined in SLD 1.0.0 specification
static WMSGetMapRequest createGetMapRequest(java.lang.String id, java.util.Map model)
          creates a WMSGetMapRequest from a HashMap that contains the request parameters as key-value-pairs.
static WMSGetMapRequest createGetMapRequest(java.lang.String id, java.lang.String request)
          creates a WMSGetMapRequest from a HashMap that contains the request parameters as key-value-pairs.
static WMSGetMapRequest createGetMapRequest(java.lang.String version, java.lang.String id, WMSGetMapRequest.Layer[] layers, double[] elevation, java.lang.String[] sampleDimension, java.lang.String format, int width, int height, java.lang.String srs, GM_Envelope boundingBox, boolean transparency, java.awt.Color bGColor, java.lang.String exceptions, java.lang.String time, java.net.URL sldURL, StyledLayerDescriptor sld, java.util.HashMap vendorSpecificParameter)
          creates a WTSGetViewRequest from a set of parameters and builds up the complete SLD.
static WMSGetMapResponse createGetMapResponse(OGCWebServiceRequest request, OGCWebServiceException exception, java.lang.Object response)
          creates a WFSGetMapResponse object
static WMSGetScaleBarRequest createGetScaleBarRequest(java.lang.String id, java.util.HashMap model)
           
static WMSGetScaleBarResponse createGetScaleBarResponse(WMSGetScaleBarRequest request, java.lang.Object response)
           
static WMSGetScaleBarResponse createGetScaleBarResponse(WMSGetScaleBarRequest request, OGCWebServiceException e)
           
static OGCWebServiceRequest createRequest(java.lang.String id, java.util.HashMap paramMap)
          creates a request
private static GM_Envelope getBoundingBoxFromGazetteer(java.lang.String location, java.lang.String locationType, double radius, GazetteerParam gazetteer)
          returns the bounding box of the submitted location.
private static java.util.Map toMap(java.lang.String request)
          puts a http-GET request to a HashMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WMSProtocolFactory

public WMSProtocolFactory()
Method Detail

createRequest

public static OGCWebServiceRequest createRequest(java.lang.String id,
                                                 java.util.HashMap paramMap)
                                          throws InconsistentRequestException,
                                                 XMLParsingException,
                                                 java.net.MalformedURLException
creates a request

Parameters:
id - an unique id of the request
paramMap - the request parameters
Returns:
the request as an OGC WebService Request
Throws:
InconsistentRequestException - if the Capabilities-document and the including configuration was invalid / inconsistent.
XMLParsingException
java.net.MalformedURLException

createGetCapabilitiesRequest

public static WMSGetCapabilitiesRequest createGetCapabilitiesRequest(java.lang.String id,
                                                                     java.util.HashMap paramMap)
                                                              throws InconsistentRequestException
creates an WMS GetCapabilities Request

Parameters:
id - an unique ID of the request
paramMap - the parameters of the request
Returns:
the GetCapabilities request
Throws:
InconsistentRequestException - if the request is inconsistent

createGetCapabilitiesResponse

public static WMSGetCapabilitiesResponse createGetCapabilitiesResponse(OGCWebServiceRequest request,
                                                                       OGCWebServiceException exception,
                                                                       WMSCapabilities capabilities)
creates an instance of a WMSGetCapabilitiesResponse object

Parameters:
request - request that lead to the response
exception - exception if one occuered
capabilities - WMS capabilities
Returns:
WMSGetCapabilitiesResponse

createGetMapRequest

public static WMSGetMapRequest createGetMapRequest(java.lang.String id,
                                                   org.w3c.dom.Element root)
                                            throws InconsistentRequestException,
                                                   XMLParsingException,
                                                   java.net.MalformedURLException
creates a WMSGetMapRequest from its XML representation as defined in SLD 1.0.0 specification

Parameters:
id - an unique id of the request
root -
Returns:
an instance of WMSGetMapRequest
Throws:
InconsistentRequestException
XMLParsingException
java.net.MalformedURLException

createGetMapRequest

public static WMSGetMapRequest createGetMapRequest(java.lang.String id,
                                                   java.lang.String request)
                                            throws InconsistentRequestException,
                                                   XMLParsingException,
                                                   java.net.MalformedURLException
creates a WMSGetMapRequest from a HashMap that contains the request parameters as key-value-pairs. Keys are expected to be in upper case notation.

Parameters:
id - an unique id of the request
request -
Returns:
an instance of WMSGetMapRequest
Throws:
InconsistentRequestException
XMLParsingException
java.net.MalformedURLException

createGetMapRequest

public static WMSGetMapRequest createGetMapRequest(java.lang.String id,
                                                   java.util.Map model)
                                            throws InconsistentRequestException,
                                                   XMLParsingException,
                                                   java.net.MalformedURLException
creates a WMSGetMapRequest from a HashMap that contains the request parameters as key-value-pairs. Keys are expected to be in upper case notation.

Parameters:
id - an unique id of the request
model - HashMap containing the request parameters
Returns:
an instance of WMSGetMapRequest
Throws:
InconsistentRequestException
XMLParsingException
java.net.MalformedURLException

getBoundingBoxFromGazetteer

private static GM_Envelope getBoundingBoxFromGazetteer(java.lang.String location,
                                                       java.lang.String locationType,
                                                       double radius,
                                                       GazetteerParam gazetteer)
                                                throws InconsistentRequestException
returns the bounding box of the submitted location. The vounding box will be read from a gazetteer service. If the location represent a point geometry that hasn't an extent the submitted radius will be used to create a bbox the the radius' width and height.

Parameters:
location - location from which to get the boundingbox
locationType - type of the location. all locationTypes will be find if not set.
radius - radius to use to create the boundingbox if location represents a point geometry
Throws:
InconsistentRequestException

createGetMapRequest

public static WMSGetMapRequest createGetMapRequest(java.lang.String version,
                                                   java.lang.String id,
                                                   WMSGetMapRequest.Layer[] layers,
                                                   double[] elevation,
                                                   java.lang.String[] sampleDimension,
                                                   java.lang.String format,
                                                   int width,
                                                   int height,
                                                   java.lang.String srs,
                                                   GM_Envelope boundingBox,
                                                   boolean transparency,
                                                   java.awt.Color bGColor,
                                                   java.lang.String exceptions,
                                                   java.lang.String time,
                                                   java.net.URL sldURL,
                                                   StyledLayerDescriptor sld,
                                                   java.util.HashMap vendorSpecificParameter)
                                            throws XMLParsingException
creates a WTSGetViewRequest from a set of parameters and builds up the complete SLD.

Parameters:
version - Request version.
layers - list of one or more map layers. Optional if SLD parameter is present. Contains list of one rendering style per requested layer. Optional if SLD parameter is present.
elevation - Elevation of layer desired.
sampleDimension - Value of other dimensions as appropriate.
format - Output format of map.
width - Width in pixels of map picture.
height - Height in pixels of map picture.
srs - the requested Spatial Reference System.
boundingBox - Bounding box corners (lower left, upper right) in SRS units.
transparency - Background transparency of map.
bGColor - Hexadecimal red-green-blue color value for the background color.
exceptions - The format in which exceptions are to be reported by the WMS.
time - Time value of layer desired
sld - Styled Layer Descriptor
id - an unique ID of the request
vendorSpecificParameter - Vendor Specific Parameter
Returns:
an instance of WMSGetMapRequest
Throws:
XMLParsingException

createGetMapResponse

public static WMSGetMapResponse createGetMapResponse(OGCWebServiceRequest request,
                                                     OGCWebServiceException exception,
                                                     java.lang.Object response)
creates a WFSGetMapResponse object

Parameters:
request - a copy of the request that leads to this response
exception - a describtion of an excetion (only if raised)
response - the response to the request

createGetFeatureInfoRequest

public static WMSGetFeatureInfoRequest createGetFeatureInfoRequest(java.lang.String id,
                                                                   java.util.HashMap model)
                                                            throws InconsistentRequestException
creates a WMSFeatureInfoRequest from a HashMap that contains the request parameters as key-value-pairs. Keys are expected to be in upper case notation.

Parameters:
id - an unique id of the request
model - HashMap containing the request parameters
Returns:
an instance of WMSFeatureInfoRequest
Throws:
InconsistentRequestException

createGetFeatureInfoRequest

public static WMSGetFeatureInfoRequest createGetFeatureInfoRequest(java.lang.String version,
                                                                   java.lang.String id,
                                                                   java.lang.String[] queryLayers,
                                                                   WMSGetMapRequest getMapRequestCopy,
                                                                   java.lang.String infoFormat,
                                                                   int featureCount,
                                                                   java.awt.Point clickPoint,
                                                                   java.lang.String exceptions,
                                                                   StyledLayerDescriptor sld,
                                                                   java.util.HashMap vendorSpecificParameter)
creates a WMSFeatureInfoRequest from the request parameters.

Parameters:
version - VERSION=version (R): Request version.
queryLayers - QUERY_LAYERS=layer_list (R): Comma-separated list of one or more layers to be queried.
getMapRequestCopy - <map_request_copy> (R): Partial copy of the Map request parameters that generated the map for which information is desired.
infoFormat - INFO_FORMAT=output_format (O): Return format of feature information (MIME type).
featureCount - FEATURE_COUNT=number (O): Number of features about which to return information (default=1).
clickPoint - X=pixel_column (R): X coordinate in pixels of feature (measured from upper left corner=0) Y=pixel_row (R): Y coordinate in pixels of feature (measured from upper left corner=0)
exceptions - EXCEPTIONS=exception_format (O): The format in which exceptions are to be reported by the WMS (default=application/vnd.ogc.se_xml).
sld - StyledLayerDescriptor
vendorSpecificParameter - Vendor-specific parameters (O): Optional experimental parameters.
Returns:
an instance of WMSFeatureInfoRequest

createGetFeatureInfoResponse

public static WMSGetFeatureInfoResponse createGetFeatureInfoResponse(OGCWebServiceRequest request,
                                                                     OGCWebServiceException exception,
                                                                     java.lang.String featureInfo)
creates a WFSGetFeatureInfoResponse object

Parameters:
request - a copy of the request that leads to this response
exception - a describtion of an excetion (only if raised)
featureInfo -

createGetScaleBarRequest

public static WMSGetScaleBarRequest createGetScaleBarRequest(java.lang.String id,
                                                             java.util.HashMap model)
                                                      throws InconsistentRequestException
Parameters:
id -
model -
Returns:
Throws:
InconsistentRequestException

createGetScaleBarResponse

public static WMSGetScaleBarResponse createGetScaleBarResponse(WMSGetScaleBarRequest request,
                                                               OGCWebServiceException e)
Parameters:
request -
e -
Returns:

createGetScaleBarResponse

public static WMSGetScaleBarResponse createGetScaleBarResponse(WMSGetScaleBarRequest request,
                                                               java.lang.Object response)
Parameters:
request -
response -
Returns:

createGetLegendGraphicRequest

public static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id,
                                                                       java.lang.String request)
                                                                throws InconsistentRequestException
Parameters:
id - ID of the request
request - string representation of the request as received from a client
Returns:
Throws:
InconsistentRequestException

createGetLegendGraphicRequest

public static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id,
                                                                       java.util.Map model)
                                                                throws InconsistentRequestException
Parameters:
id - ID of the request
model - key-value-pair representation of the request
Returns:
Throws:
InconsistentRequestException

createGetLegendGraphicRequest

public static WMSGetLegendGraphicRequest createGetLegendGraphicRequest(java.lang.String id,
                                                                       java.lang.String version,
                                                                       java.lang.String layer,
                                                                       java.lang.String style,
                                                                       java.lang.String featureType,
                                                                       java.lang.String rule,
                                                                       double scale,
                                                                       java.net.URL sld,
                                                                       java.lang.String sld_body,
                                                                       java.lang.String format,
                                                                       int width,
                                                                       int height,
                                                                       java.lang.String exceptions,
                                                                       java.util.Map vendorSpecificParameter)
Parameters:
id - unique id of the request
version - version of the target WMS
layer - name of the layer the style is assigned to
style - name of the style (optional; if not present -> 'default')
featureType - name of the feature type a legend element shall be created for --> SLD
rule - name of the rule a legend element shall be created for --> SLD
scale - scale for which a rule must be valid --> SLD
sld - refernce to a SLD document
sld_body - SLD document
format - image format of the returned legend element
width -
height -
exceptions - format of the excpetion if something went wrong
vendorSpecificParameter -
Returns:
instance of WMSGetLegendGraphicRequest

createGetLegendGraphicResponse

public static WMSGetLegendGraphicResponse createGetLegendGraphicResponse(OGCWebServiceRequest request,
                                                                         java.lang.Object legendGraphic)
Parameters:
request -
legendGraphic -
Returns:

createGetLegendGraphicResponse

public static WMSGetLegendGraphicResponse createGetLegendGraphicResponse(OGCWebServiceRequest request,
                                                                         org.w3c.dom.Document exception)
Parameters:
request -
exception -
Returns:

toMap

private static java.util.Map toMap(java.lang.String request)
puts a http-GET request to a HashMap