com.bbn.openmap.image.wms
Class WmsRequestHandler

java.lang.Object
  extended by com.bbn.openmap.image.ImageServer
      extended by com.bbn.openmap.image.wms.WmsRequestHandler
All Implemented Interfaces:
ImageServerConstants, WMTConstants, PropertyConsumer
Direct Known Subclasses:
DynamicWmsRequestHandler

public class WmsRequestHandler
extends ImageServer
implements ImageServerConstants

Version:
$Header: /cvs/CVS_LEBA/external/openmap/openmap/src/openmap/com/bbn/openmap /wms/WmsRequestHandler.java,v 1.2 2006/03/27 10:51:13 tomrak Exp $
Author:
Adam Dawidowski, wachu, pitek

Field Summary
static java.lang.String WMSPrefix
           
 
Fields inherited from class com.bbn.openmap.image.ImageServer
AntiAliasingProperty, background, BackgroundProperty, doAntiAliasing, formatter, imageFormatters, ImageFormattersProperty, ImageServerLayersProperty, layers, logger, OpenMapPrefix, projectionFactory, propertiesPrefix
 
Fields inherited from interface com.bbn.openmap.image.ImageServerConstants
AZIMUTH, LAT, LAYERMASK, LAYERS, LON, PAN, PROJTYPE, QUERY, RECENTER, SCALE, X, Y
 
Fields inherited from interface com.bbn.openmap.image.WMTConstants
BBOX, BGCOLOR, CAPABILITIES, CRS, EXCEPTIONS, FORMAT, GETCAPABILITIES, GETFEATUREINFO, GETLEGENDGRAPHIC, GETMAP, HEIGHT, IMAGEFORMAT_GEOTIFF, IMAGEFORMAT_GIF, IMAGEFORMAT_JPEG, IMAGEFORMAT_PNG, IMAGEFORMAT_PPM, IMAGEFORMAT_SVG, IMAGEFORMAT_TIFF, IMAGEFORMAT_WBMP, INFO_FORMAT, LAYER, MAP, QUERY_LAYERS, REQUEST, SERVICE, SRS, STYLE, STYLES, TRANSPARENT, VERSION, WIDTH, WMTVER
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
WmsRequestHandler(java.lang.String wmsScheme, java.lang.String wmsHostName, int wmsPort, java.lang.String wmsUrlPath, java.util.Properties props)
          Creates a new WmsRequestHandler object.
 
Method Summary
protected  void createWmsLayers()
          For each layer managed by ImageServer create corresponding IWmsLayer which contains additional information for WMS service about given openmap layer.
 CapabilitiesSupport getCapabilities()
          Get the CapabilitiesSupport object.
protected  byte[] getFormattedImage(ImageFormatter formatter, int scaledWidth, int scaledHeight)
          TODO: This method covers the equivalent of a base class and returns the drawing, which is not rescaled.
protected  IWmsLayer getLayerByName(java.lang.String wmsName)
           
protected  Layer getTopLayerByName(java.lang.String wmsName)
          Return the top OpenMap Layer for the given wms layer name.
 java.lang.String handleGetCapabilitiesRequest(java.util.Properties requestProperties)
           
 void handleGetCapabilitiesRequest(java.util.Properties requestProperties, IHttpResponse httpResponse)
           
 void handleGetFeatureInfoRequest(java.util.Properties requestProperties, IHttpResponse httpResponse)
           VERSION - checked REQUEST - checked EXCEPTIONS - checked all from GetMap except VERSION and REQUEST QUERY_LAYERS - specific INFO_FORMAT - specific FEATURE_COUNT - specific I,J - specific
 byte[] handleGetLegendGraphicRequest(java.util.Properties requestProperties)
           
 void handleGetLegendGraphicRequest(java.util.Properties requestProperties, IHttpResponse httpResponse)
           
 byte[] handleGetMapRequest(java.util.Properties requestProperties)
           
 void handleGetMapRequest(java.util.Properties requestProperties, IHttpResponse httpResponse)
           
 void handleRequest(java.util.Properties requestProperties, IHttpResponse httpResponse)
           
protected  void setRequestParametersOnLayers(java.util.Properties requestProperties)
          Set the request parameters on all the layers
 
Methods inherited from class com.bbn.openmap.image.ImageServer
calculateVisibleLayerMask, createGraphics, createImage, createImage, createImage, createImage, createImage, createImage, createImageFile, createImageFromLayers, createImageFromLayers, getBackground, getBackground, getDoAntiAliasing, getFormatter, getFormatters, getFormatters, getLayers, getLayers, getLayers, getMaskedLayers, getProjectionFactory, getProperties, getPropertyInfo, getPropertyPrefix, getTransparent, main, setBackground, setDoAntiAliasing, setFormatter, setFormatter, setFormatters, setLayers, setProjectionFactory, setProperties, setProperties, setProperties, setPropertyPrefix, setTransparent, writeImageFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WMSPrefix

public static final java.lang.String WMSPrefix
See Also:
Constant Field Values
Constructor Detail

WmsRequestHandler

public WmsRequestHandler(java.lang.String wmsScheme,
                         java.lang.String wmsHostName,
                         int wmsPort,
                         java.lang.String wmsUrlPath,
                         java.util.Properties props)
                  throws java.io.IOException,
                         WMSException
Creates a new WmsRequestHandler object.

Parameters:
wmsScheme - for capabilities description
wmsHostName - for capabilities description
wmsPort - for capabilities description
wmsUrlPath - for capabilities description
props - openmap properties to configure layers
Throws:
java.io.IOException
WMSException
Method Detail

createWmsLayers

protected void createWmsLayers()
For each layer managed by ImageServer create corresponding IWmsLayer which contains additional information for WMS service about given openmap layer. For Layers that already implement IWmsLayer, the instances will be the same.


setRequestParametersOnLayers

protected void setRequestParametersOnLayers(java.util.Properties requestProperties)
Set the request parameters on all the layers

Parameters:
requestProperties -
See Also:
IWmsLayer.setRequestParameters(Properties requestParameters)

getLayerByName

protected IWmsLayer getLayerByName(java.lang.String wmsName)

getTopLayerByName

protected Layer getTopLayerByName(java.lang.String wmsName)
Return the top OpenMap Layer for the given wms layer name.

Parameters:
wmsName -
Returns:
top layer

handleRequest

public void handleRequest(java.util.Properties requestProperties,
                          IHttpResponse httpResponse)
                   throws java.io.IOException,
                          MapRequestFormatException
Parameters:
requestProperties -
httpResponse - output
Throws:
java.io.IOException
MapRequestFormatException

handleGetMapRequest

public void handleGetMapRequest(java.util.Properties requestProperties,
                                IHttpResponse httpResponse)
                         throws java.io.IOException,
                                MapRequestFormatException,
                                WMSException
Parameters:
requestProperties -
httpResponse - output
Throws:
java.io.IOException
MapRequestFormatException
WMSException

handleGetMapRequest

public byte[] handleGetMapRequest(java.util.Properties requestProperties)
                           throws java.io.IOException,
                                  MapRequestFormatException,
                                  WMSException
Parameters:
requestProperties -
Returns:
byte array for image, formatted
Throws:
java.io.IOException
MapRequestFormatException
WMSException

handleGetLegendGraphicRequest

public byte[] handleGetLegendGraphicRequest(java.util.Properties requestProperties)
                                     throws java.io.IOException,
                                            MapRequestFormatException,
                                            WMSException
Throws:
java.io.IOException
MapRequestFormatException
WMSException

handleGetCapabilitiesRequest

public void handleGetCapabilitiesRequest(java.util.Properties requestProperties,
                                         IHttpResponse httpResponse)
                                  throws java.io.IOException,
                                         MapRequestFormatException,
                                         WMSException
Parameters:
requestProperties -
httpResponse - out
Throws:
java.io.IOException
MapRequestFormatException
WMSException

getCapabilities

public CapabilitiesSupport getCapabilities()
Get the CapabilitiesSupport object. The CapabilitiesSupport object can be modified and will be kept as long as the WmsRequestHandler.

Returns:
CapabilitiesSupport for capabilities

handleGetCapabilitiesRequest

public java.lang.String handleGetCapabilitiesRequest(java.util.Properties requestProperties)
                                              throws java.io.IOException,
                                                     MapRequestFormatException,
                                                     WMSException
Parameters:
requestProperties -
Returns:
String describing capabilities
Throws:
java.io.IOException
MapRequestFormatException
WMSException

handleGetLegendGraphicRequest

public void handleGetLegendGraphicRequest(java.util.Properties requestProperties,
                                          IHttpResponse httpResponse)
                                   throws java.io.IOException,
                                          MapRequestFormatException,
                                          WMSException
Parameters:
requestProperties -
httpResponse - out
Throws:
java.io.IOException
MapRequestFormatException
WMSException

handleGetFeatureInfoRequest

public void handleGetFeatureInfoRequest(java.util.Properties requestProperties,
                                        IHttpResponse httpResponse)
                                 throws java.io.IOException,
                                        MapRequestFormatException,
                                        WMSException

Parameters:
requestProperties -
httpResponse -
Throws:
java.io.IOException
MapRequestFormatException
WMSException

getFormattedImage

protected byte[] getFormattedImage(ImageFormatter formatter,
                                   int scaledWidth,
                                   int scaledHeight)
TODO: This method covers the equivalent of a base class and returns the drawing, which is not rescaled. To them may be a problem. Scaling has been locked, because the forms are drawing without the alpha channel, and at least it will look odd.

Overrides:
getFormattedImage in class ImageServer
Parameters:
formatter -
scaledWidth -
scaledHeight -
Returns:
byte array of formatted image bytes


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details