org.gvsig.remoteclient.wms
Class WMSProtocolHandler

java.lang.Object
  extended by org.gvsig.remoteclient.ogc.OGCProtocolHandler
      extended by org.gvsig.remoteclient.wms.WMSProtocolHandler
Direct Known Subclasses:
WMSProtocolHandler1_1_0, WMSProtocolHandler1_1_1, WMSProtocolHandler1_3_0

public abstract class WMSProtocolHandler
extends OGCProtocolHandler

Abstract class that represents handlers to comunicate via WMS protocol.


Field Summary
protected  java.lang.String encoding
          Encoding used to parse different xml documents.
 java.util.TreeMap layers
           
 WMSLayer rootLayer
           
protected  WMSServiceInformation serviceInfo
          WMS metadata
 
Fields inherited from class org.gvsig.remoteclient.ogc.OGCProtocolHandler
downloader, host, name, port, version
 
Constructor Summary
WMSProtocolHandler()
           
 
Method Summary
 byte[] _getMap(WMSStatus status)
          Builds a GetMap request that is sent to the WMS the response (image) will be redirect to the WMS client
static java.lang.String buildCapabilitiesSuitableVersionRequest(java.lang.String _host, java.lang.String _version)
          Builds the GetCapabilitiesRequest according to the OGC WMS Specifications without a VERSION, to get the highest version than a WMS supports.
 void close()
           
protected abstract  WMSGetCapabilitiesRequest createGetCapabilitiesRequest(WMSStatus status)
           
protected abstract  WMSGetFeatureInfoRequest createGetFeatureInfoRequest(WMSStatus status, int x, int y)
           
protected abstract  WMSGetLegendGraphicRequest createGetLegendGraphicRequest(WMSStatus status, java.lang.String layerName)
           
protected abstract  WMSGetMapRequest createGetMapRequest(WMSStatus status)
           
 void getCapabilities(WMSStatus status, boolean override, org.gvsig.compat.net.ICancellable cancel)
          Builds a GetCapabilities request that is sent to the WMS the response will be parse to extract the data needed by the WMS client
 java.lang.String getExceptionMessage(java.io.File f)
          Returns the exception message if the file is a XML instead of a image.
 java.lang.String getFeatureInfo(WMSStatus status, int x, int y, int featureCount, org.gvsig.compat.net.ICancellable cancel)
          It will send a GetFeatureInfo request to the WMS Parsing the response and redirecting the info to the WMS client TODO: return a stored file instead a String.
 java.io.File getLegendGraphic_old(WMSStatus status, java.lang.String layerName, org.gvsig.compat.net.ICancellable cancel)
           
 java.io.File getLegendGraphic(WMSStatus status, java.lang.String layerName, org.gvsig.compat.net.ICancellable cancel)
           
 java.io.File getMap(WMSStatus status, org.gvsig.compat.net.ICancellable cancel)
           
 java.net.URL getMapURL(WMSStatus status, org.gvsig.compat.net.ICancellable cancel)
           
 java.lang.String getName()
          returns the alfanumeric information of the layers at the specified point.
 OGCServiceInformation getServiceInformation()
           
protected  java.lang.String parseException(byte[] data)
           
protected  void parseGetFeatureInfoTag(org.kxml2.io.KXmlParser parser)
          Parses the GetFeatureInfo tag
protected  void parseGetLegendGraphicTag(org.kxml2.io.KXmlParser parser)
          Parses the GetLegendGraphic tag
protected  void parseGetMapTag(org.kxml2.io.KXmlParser parser)
          Parses the GetMap tag
protected  void parseRequestTag(org.kxml2.io.KXmlParser parser)
          Parses the Request tag
 
Methods inherited from class org.gvsig.remoteclient.ogc.OGCProtocolHandler
addOperationByAttribute, fileToBytes, getHost, getPort, getSymbol, getVersion, parseCapabilities, parseHTTPTag, parserDcpType, setHost, setName, setPort, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoding

protected java.lang.String encoding
Encoding used to parse different xml documents.


layers

public java.util.TreeMap layers

rootLayer

public WMSLayer rootLayer

serviceInfo

protected WMSServiceInformation serviceInfo
WMS metadata

Constructor Detail

WMSProtocolHandler

public WMSProtocolHandler()
Method Detail

_getMap

public byte[] _getMap(WMSStatus status)
               throws ServerErrorException,
                      WMSException

Builds a GetMap request that is sent to the WMS the response (image) will be redirect to the WMS client

Throws:
ServerErrorException
WMSException

buildCapabilitiesSuitableVersionRequest

public static java.lang.String buildCapabilitiesSuitableVersionRequest(java.lang.String _host,
                                                                       java.lang.String _version)
Builds the GetCapabilitiesRequest according to the OGC WMS Specifications without a VERSION, to get the highest version than a WMS supports.


close

public void close()

createGetCapabilitiesRequest

protected abstract WMSGetCapabilitiesRequest createGetCapabilitiesRequest(WMSStatus status)

createGetFeatureInfoRequest

protected abstract WMSGetFeatureInfoRequest createGetFeatureInfoRequest(WMSStatus status,
                                                                        int x,
                                                                        int y)

createGetLegendGraphicRequest

protected abstract WMSGetLegendGraphicRequest createGetLegendGraphicRequest(WMSStatus status,
                                                                            java.lang.String layerName)

createGetMapRequest

protected abstract WMSGetMapRequest createGetMapRequest(WMSStatus status)
Parameters:
status - The WMS status
protocolHandler - The handler to parse the requests
Returns:
an object to send the GetMap requests

getCapabilities

public void getCapabilities(WMSStatus status,
                            boolean override,
                            org.gvsig.compat.net.ICancellable cancel)

Builds a GetCapabilities request that is sent to the WMS the response will be parse to extract the data needed by the WMS client

Parameters:
override, - if true the previous downloaded data will be overridden

getExceptionMessage

public java.lang.String getExceptionMessage(java.io.File f)
                                     throws java.io.IOException
Returns the exception message if the file is a XML instead of a image.

Parameters:
file3 -
Returns:
Throws:
java.io.IOException

getFeatureInfo

public java.lang.String getFeatureInfo(WMSStatus status,
                                       int x,
                                       int y,
                                       int featureCount,
                                       org.gvsig.compat.net.ICancellable cancel)

It will send a GetFeatureInfo request to the WMS Parsing the response and redirecting the info to the WMS client

TODO: return a stored file instead a String.


getLegendGraphic_old

public java.io.File getLegendGraphic_old(WMSStatus status,
                                         java.lang.String layerName,
                                         org.gvsig.compat.net.ICancellable cancel)
                                  throws ServerErrorException,
                                         WMSException
Throws:
ServerErrorException
WMSException

getLegendGraphic

public java.io.File getLegendGraphic(WMSStatus status,
                                     java.lang.String layerName,
                                     org.gvsig.compat.net.ICancellable cancel)
                              throws ServerErrorException,
                                     WMSException
Throws:
ServerErrorException
WMSException

getMap

public java.io.File getMap(WMSStatus status,
                           org.gvsig.compat.net.ICancellable cancel)
                    throws ServerErrorException,
                           WMSException
Throws:
ServerErrorException
WMSException

getMapURL

public java.net.URL getMapURL(WMSStatus status,
                              org.gvsig.compat.net.ICancellable cancel)
                       throws ServerErrorException,
                              WMSException
Throws:
ServerErrorException
WMSException

getName

public java.lang.String getName()
returns the alfanumeric information of the layers at the specified point. the diference between the other getfeatureInfo method is that this will be implemented by each specific version because the XML from the server will be parsed and presented by a well known structure.

Overrides:
getName in class OGCProtocolHandler
Returns:
Returns the name.

getServiceInformation

public OGCServiceInformation getServiceInformation()
Specified by:
getServiceInformation in class OGCProtocolHandler

parseException

protected java.lang.String parseException(byte[] data)

parseGetFeatureInfoTag

protected void parseGetFeatureInfoTag(org.kxml2.io.KXmlParser parser)
                               throws java.io.IOException,
                                      org.xmlpull.v1.XmlPullParserException

Parses the GetFeatureInfo tag

Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException

parseGetLegendGraphicTag

protected void parseGetLegendGraphicTag(org.kxml2.io.KXmlParser parser)
                                 throws java.io.IOException,
                                        org.xmlpull.v1.XmlPullParserException

Parses the GetLegendGraphic tag

Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException

parseGetMapTag

protected void parseGetMapTag(org.kxml2.io.KXmlParser parser)
                       throws java.io.IOException,
                              org.xmlpull.v1.XmlPullParserException

Parses the GetMap tag

Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException

parseRequestTag

protected void parseRequestTag(org.kxml2.io.KXmlParser parser)
                        throws java.io.IOException,
                               org.xmlpull.v1.XmlPullParserException

Parses the Request tag

Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException


Copyright © 2014 gvSIG Association. All Rights Reserved.