Package gov.nasa.worldwind.ogc.wms
Class WMSCapabilities
- java.lang.Object
-
- gov.nasa.worldwind.util.xml.AbstractXMLEventParser
-
- gov.nasa.worldwind.ogc.OGCCapabilities
-
- gov.nasa.worldwind.ogc.wms.WMSCapabilities
-
- All Implemented Interfaces:
XMLEventParser
public class WMSCapabilities extends OGCCapabilities
-
-
Field Summary
Fields Modifier and Type Field Description protected static javax.xml.namespace.QName
ROOT_ELEMENT_NAME_1_1_1
protected static javax.xml.namespace.QName
ROOT_ELEMENT_NAME_1_3_0
-
Fields inherited from class gov.nasa.worldwind.ogc.OGCCapabilities
CAPABILITY, capabilityInformation, eventReader, parserContext, SERVICE, serviceInformation, UPDATE_SEQUENCE, updateSequence, version, VERSION
-
Fields inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
CHARACTERS_CONTENT, fields, namespaceURI, parent
-
-
Constructor Summary
Constructors Constructor Description WMSCapabilities(CapabilitiesRequest docSource)
WMSCapabilities(java.lang.Object docSource)
Parses a WMS capabilities document.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLEventParser
allocate(XMLEventParserContext ctx, javax.xml.stream.events.XMLEvent event)
Create a parser for a specified event.WMSCapabilityInformation
getCapabilityInformation()
Returns the document's capability information.java.lang.String
getDefaultNamespaceURI()
Returns the default namespace URI.java.util.Set<java.lang.String>
getImageFormats()
WMSLayerCapabilities
getLayerByName(java.lang.String name)
java.lang.Double[]
getLayerExtremeElevations(java.lang.String[] layerNames)
protected java.lang.String
getLayerLastUpdate(WMSLayerCapabilities layerCaps)
Checks the WMS layer capabilities for a LastUpdate entry, either an explicit element by that name or a layer keyword.java.lang.Long
getLayerLatestLastUpdateTime(java.lang.String[] layerNames)
java.util.List<WMSLayerCapabilities>
getNamedLayers()
Returns all named layers in the capabilities document.OGCRequestDescription
getRequestDescription(java.lang.String requestName)
java.lang.String
getRequestURL(java.lang.String requestName, java.lang.String protocol, java.lang.String requestMethod)
boolean
isRootElementName(javax.xml.namespace.QName candidate)
Determines whether a specified element name is the root element name of the schema.boolean
layerHasCoordinateSystem(java.lang.String[] layerNames, java.lang.String coordSys)
Indicates whether the layers corresponding to a specified list of layer names support a specified coordinate system.WMSCapabilities
parse(java.lang.Object... args)
Starts document parsing.protected java.lang.String
parseLastUpdate(java.lang.String lastUpdateString)
Parse a LastUpdate string.static WMSCapabilities
retrieve(java.net.URI uri)
Retrieves the WMS capabilities document from a specified WMS server.java.lang.String
toString()
-
Methods inherited from class gov.nasa.worldwind.ogc.OGCCapabilities
createParserContext, createReader, doParseEventAttributes, doParseEventContent, getParserContext, getServiceInformation, getUpdateSequence, getVersion, setCapabilityInformation, setServiceInformation, setUpdateSequence, setVersion
-
Methods inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
doAddCharacters, doAddEventAttribute, doAddEventContent, freeResources, getAConstructor, getCharacters, getField, getField, getFields, getNamespaceURI, getParent, getRoot, hasField, hasField, hasFields, mergeFields, newInstance, overrideFields, parse, parseCharacterContent, removeField, setField, setField, setFields, setNamespaceURI, setParent
-
-
-
-
Constructor Detail
-
WMSCapabilities
public WMSCapabilities(java.lang.Object docSource)
Parses a WMS capabilities document.- Parameters:
docSource
- the XML source. May be a filename, file, stream or other type allowed byWWXML.openEventReader(Object)
.- Throws:
java.lang.IllegalArgumentException
- if the document source is null.
-
WMSCapabilities
public WMSCapabilities(CapabilitiesRequest docSource) throws java.net.URISyntaxException, java.net.MalformedURLException
- Throws:
java.net.URISyntaxException
java.net.MalformedURLException
-
-
Method Detail
-
retrieve
public static WMSCapabilities retrieve(java.net.URI uri) throws java.lang.Exception
Retrieves the WMS capabilities document from a specified WMS server.- Parameters:
uri
- The URI of the server.- Returns:
- The WMS capabilities document for the specified server.
- Throws:
java.lang.Exception
- if a general error occurs.java.lang.IllegalArgumentException
- if the specified URI is invalid.WWRuntimeException
- if an error occurs retrieving the document.
-
getDefaultNamespaceURI
public java.lang.String getDefaultNamespaceURI()
Description copied from class:OGCCapabilities
Returns the default namespace URI. Must be overridden by subclasses to provide a specific URI. The default namespace is used to match XML elements found in the default namespace of the XML stream.- Specified by:
getDefaultNamespaceURI
in classOGCCapabilities
- Returns:
- the default namespace URI.
-
isRootElementName
public boolean isRootElementName(javax.xml.namespace.QName candidate)
Description copied from class:OGCCapabilities
Determines whether a specified element name is the root element name of the schema.- Specified by:
isRootElementName
in classOGCCapabilities
- Parameters:
candidate
- the name to test.- Returns:
- true if the name is the schema's root element, otherwise false.
-
allocate
public XMLEventParser allocate(XMLEventParserContext ctx, javax.xml.stream.events.XMLEvent event)
Description copied from class:OGCCapabilities
Create a parser for a specified event.- Overrides:
allocate
in classOGCCapabilities
- Parameters:
ctx
- the current parser context.event
- the event for which the parser is created. Only the event type is used; the new parser can operate on any event of that type.- Returns:
- the new parser.
-
parse
public WMSCapabilities parse(java.lang.Object... args) throws javax.xml.stream.XMLStreamException
Description copied from class:OGCCapabilities
Starts document parsing. This method initiates parsing of the XML document and returns when the full capabilities document has been parsed.- Overrides:
parse
in classOGCCapabilities
- Parameters:
args
- optional arguments to pass to parsers of sub-elements.- Returns:
this
if parsing is successful, otherwise null.- Throws:
javax.xml.stream.XMLStreamException
- if an exception occurs while attempting to read the event stream.
-
getNamedLayers
public java.util.List<WMSLayerCapabilities> getNamedLayers()
Returns all named layers in the capabilities document.- Returns:
- an unordered list of the document's named layers.
-
getLayerByName
public WMSLayerCapabilities getLayerByName(java.lang.String name)
-
getCapabilityInformation
public WMSCapabilityInformation getCapabilityInformation()
Description copied from class:OGCCapabilities
Returns the document's capability information.- Overrides:
getCapabilityInformation
in classOGCCapabilities
- Returns:
- the document's capability information.
-
getImageFormats
public java.util.Set<java.lang.String> getImageFormats()
-
getLayerLatestLastUpdateTime
public java.lang.Long getLayerLatestLastUpdateTime(java.lang.String[] layerNames)
-
getLayerLastUpdate
protected java.lang.String getLayerLastUpdate(WMSLayerCapabilities layerCaps)
Checks the WMS layer capabilities for a LastUpdate entry, either an explicit element by that name or a layer keyword.- Parameters:
layerCaps
- The layer's capabilities taken from the server's capabilities document.- Returns:
- A string representation of the epoch time for the last update string, if any, otherwise null.
-
parseLastUpdate
protected java.lang.String parseLastUpdate(java.lang.String lastUpdateString)
Parse a LastUpdate string.- Parameters:
lastUpdateString
- The string containing the LastUpdate string in the format "LastUpdate=yyyy-MM-dd'T'HH:mm:ssZ"- Returns:
- A string representation of the epoch time for the last update string, of null if the string can't be parsed as a date.
-
getLayerExtremeElevations
public java.lang.Double[] getLayerExtremeElevations(java.lang.String[] layerNames)
-
getRequestDescription
public OGCRequestDescription getRequestDescription(java.lang.String requestName)
-
getRequestURL
public java.lang.String getRequestURL(java.lang.String requestName, java.lang.String protocol, java.lang.String requestMethod)
-
layerHasCoordinateSystem
public boolean layerHasCoordinateSystem(java.lang.String[] layerNames, java.lang.String coordSys)
Indicates whether the layers corresponding to a specified list of layer names support a specified coordinate system. If any of the named layers are not in this capabilities document, false is returned.- Parameters:
layerNames
- The names of the layers to check.coordSys
- The coordinate system to search for, e.g., "EPSG:4326".- Returns:
- true if all the layers support the specified coordinate system, otherwise false.
- Throws:
java.lang.IllegalArgumentException
- if the layer names array is null or empty or the specified coordinate system is null or the empty string.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classOGCCapabilities
-
-