org.vfny.geoserver.responses.wms
Class WmsCapabilitiesResponseHandler

java.lang.Object
  extended byorg.vfny.geoserver.responses.XmlResponseHandler
      extended byorg.vfny.geoserver.responses.CapabilitiesResponseHandler
          extended byorg.vfny.geoserver.responses.wms.WmsCapabilitiesResponseHandler
All Implemented Interfaces:
ResponseHandler

public class WmsCapabilitiesResponseHandler
extends CapabilitiesResponseHandler

Handler methods to print out a valid wms capabilities document from the WMS config. Will be called by a transformer in Capabilities response, and should turn itself into xml events that will then be consumed by a writer and written to the output stream (ie sent to the client).


Field Summary
protected  java.lang.String BBOX_ELEM_NAME
           
 
Fields inherited from class org.vfny.geoserver.responses.XmlResponseHandler
atts
 
Constructor Summary
WmsCapabilitiesResponseHandler(org.xml.sax.ContentHandler handler, Request r)
          Creates a new WmsCapabilitiesResponseHandler object.
 
Method Summary
 void endDocument(Service config)
          Closes the WMT_MS_Capabilities element.
protected  void endService(Service config)
          Calls endElement for Service
protected  java.lang.String getBboxElementName()
          Gets the name of the WMS bbox element name.
protected  void handleCapabilities(Service Service)
          Handles the capabilities section - request, exceptions, vendor, sld and layers - of the caps document.
protected  void handleCapability(WMS config, java.lang.String capabilityName)
          Handles an individual capability, printing where it can be found and the formats it supports.
protected  void handleContactInformation(Service config)
          Handles the contact information portion of the service section.
protected  void handleExceptions(WMS config)
          Handles the printing of the exceptions information, prints the formats that GeoServer can return exceptions in.
protected  void handleFeatureType(FeatureTypeInfo ftype)
          Calls super.handleFeatureType to add common FeatureType content such as Name, Title and LatLonBoundingBox, and then writes WMS specific layer properties as Styles, Scale Hint, etc.
protected  void handleKeywords(java.util.List kwords)
          Overrides BasicConfig.handleKeywords to write the keywords list in WMS style
protected  void handleLayers(WMS config)
          Handles the layers portion of the document.
protected  void handleOnlineResource(Service config)
          Overrides CapabilitiesResponseHandler.handlerOnlineResource to write WMS style service online resource
protected  void handleOnlineResource(java.lang.String url)
          Convenience method to print the appropriate xlink attributes for an online resource.
protected  void handleRequest(WMS config)
          Handles the request portion of the document, printing out the capabilities and where to bind to them.
 void handleService(Service config)
          Handles the service section of the document.
protected  void handleSLD(WMS config)
          Handles the sld styling support provided by the server.
protected  void handleVendorSpecifics(WMS config)
          Handles the vendoer specific capabilities.
protected  void startDocument(Service config)
          Prints the dtd declaration and root WMT_MS_Capabilities declaration.
protected  void startService(Service config)
          Starts the Service element.
 
Methods inherited from class org.vfny.geoserver.responses.CapabilitiesResponseHandler
handleDocument, handleOnlineResouce
 
Methods inherited from class org.vfny.geoserver.responses.XmlResponseHandler
characters, cReturn, endElement, endElement, handleSingleElem, handleSingleElem, indent, indent, setPrettyPrint, startElement, startElement, startElement, unIndent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BBOX_ELEM_NAME

protected java.lang.String BBOX_ELEM_NAME
Constructor Detail

WmsCapabilitiesResponseHandler

public WmsCapabilitiesResponseHandler(org.xml.sax.ContentHandler handler,
                                      Request r)
Creates a new WmsCapabilitiesResponseHandler object.

Parameters:
handler - DOCUMENT ME!
r - DOCUMENT ME!
Method Detail

startDocument

protected void startDocument(Service config)
                      throws org.xml.sax.SAXException
Prints the dtd declaration and root WMT_MS_Capabilities declaration.

Specified by:
startDocument in class CapabilitiesResponseHandler
Parameters:
config - Must be an instance of WMS. If not a class cast exception will be thrown.
Throws:
org.xml.sax.SAXException - For any problems creating the SAX.

endDocument

public void endDocument(Service config)
                 throws org.xml.sax.SAXException
Closes the WMT_MS_Capabilities element.

Parameters:
config - The wms config used to start the document.
Throws:
org.xml.sax.SAXException - For any problems.

startService

protected void startService(Service config)
                     throws org.xml.sax.SAXException
Starts the Service element.

Parameters:
config - The Wms config to turn into a capabilities document.
Throws:
org.xml.sax.SAXException - If anything goes wrong.

endService

protected void endService(Service config)
                   throws org.xml.sax.SAXException
Calls endElement for Service

Overrides:
endService in class CapabilitiesResponseHandler
Parameters:
config - The Wms config to turn into a capabilities document.
Throws:
org.xml.sax.SAXException - For any problems.

handleService

public void handleService(Service config)
                   throws org.xml.sax.SAXException
Handles the service section of the document. Just calls super which calls the appropriate sub methods.

Overrides:
handleService in class CapabilitiesResponseHandler
Parameters:
config - The Wms config to turn into a capabilities document.
Throws:
org.xml.sax.SAXException - For any problems.

handleCapabilities

protected void handleCapabilities(Service Service)
                           throws org.xml.sax.SAXException
Handles the capabilities section - request, exceptions, vendor, sld and layers - of the caps document.

Specified by:
handleCapabilities in class CapabilitiesResponseHandler
Parameters:
Service - The Wms config to turn into a capabilities document.
Throws:
org.xml.sax.SAXException - If anything goes wrong.

handleLayers

protected void handleLayers(WMS config)
                     throws org.xml.sax.SAXException
Handles the layers portion of the document. Prints a root layer that all others descend from, as it appears that only one layer element is allowed. For now just calls handle config, which prints out the server's title, abstract and keywords, which are all valid elements.

Parameters:
config - The Wms config to handle the layers of.
Throws:
org.xml.sax.SAXException - For any problems.

handleFeatureType

protected void handleFeatureType(FeatureTypeInfo ftype)
                          throws org.xml.sax.SAXException
Calls super.handleFeatureType to add common FeatureType content such as Name, Title and LatLonBoundingBox, and then writes WMS specific layer properties as Styles, Scale Hint, etc.

Overrides:
handleFeatureType in class CapabilitiesResponseHandler
Parameters:
ftype - The featureType to write out.
Throws:
org.xml.sax.SAXException - For any problems.

handleSLD

protected void handleSLD(WMS config)
                  throws org.xml.sax.SAXException
Handles the sld styling support provided by the server.

Parameters:
config - The WMS config to get sld info from.
Throws:
org.xml.sax.SAXException - For any problems.

handleVendorSpecifics

protected void handleVendorSpecifics(WMS config)
                              throws org.xml.sax.SAXException
Handles the vendoer specific capabilities. Right now there are none, so we do nothing.

Parameters:
config - The global config that may contain vendor specifics.
Throws:
org.xml.sax.SAXException - For any problems.

handleRequest

protected void handleRequest(WMS config)
                      throws org.xml.sax.SAXException
Handles the request portion of the document, printing out the capabilities and where to bind to them.

Parameters:
config - The global wms.
Throws:
org.xml.sax.SAXException - For any problems.

handleCapability

protected void handleCapability(WMS config,
                                java.lang.String capabilityName)
                         throws org.xml.sax.SAXException
Handles an individual capability, printing where it can be found and the formats it supports.

Parameters:
config - The wms service config.
capabilityName - The name of the capability to print out.
Throws:
org.xml.sax.SAXException - For any problems.

handleExceptions

protected void handleExceptions(WMS config)
                         throws org.xml.sax.SAXException
Handles the printing of the exceptions information, prints the formats that GeoServer can return exceptions in.

Parameters:
config - The wms service global config.
Throws:
org.xml.sax.SAXException - For any problems.

handleContactInformation

protected void handleContactInformation(Service config)
                                 throws org.xml.sax.SAXException
Handles the contact information portion of the service section.

Parameters:
config - The global service information.
Throws:
org.xml.sax.SAXException - For any problems.

handleKeywords

protected void handleKeywords(java.util.List kwords)
                       throws org.xml.sax.SAXException
Overrides BasicConfig.handleKeywords to write the keywords list in WMS style

Overrides:
handleKeywords in class CapabilitiesResponseHandler
Parameters:
kwords - A list of keywords to print out. If null or of size 0 then nothing will be printed, since the keyword(s) element is not mandatory.
Throws:
org.xml.sax.SAXException - For any problems.

handleOnlineResource

protected void handleOnlineResource(Service config)
                             throws org.xml.sax.SAXException
Overrides CapabilitiesResponseHandler.handlerOnlineResource to write WMS style service online resource

Parameters:
config - The WMS config to write out an online resource from.
Throws:
org.xml.sax.SAXException - For any problems.

handleOnlineResource

protected void handleOnlineResource(java.lang.String url)
                             throws org.xml.sax.SAXException
Convenience method to print the appropriate xlink attributes for an online resource.

Parameters:
url - The url to be linked to.
Throws:
org.xml.sax.SAXException - For any problems.

getBboxElementName

protected java.lang.String getBboxElementName()
Gets the name of the WMS bbox element name.

Returns:
The string 'LatLonBoundingBox', as that's what wms uses.