Package org.openstreetmap.josm.io
Class Capabilities
java.lang.Object
org.openstreetmap.josm.io.Capabilities
Represents the OSM API server capabilities.
Example capabilities document:
<osm version="0.6" generator="OpenStreetMap server">
<api>
<version minimum="0.6" maximum="0.6"/>
<area maximum="0.25"/>
<tracepoints per_page="5000"/>
<waynodes maximum="2000"/>
<changesets maximum_elements="10000"/>
<timeout seconds="300"/>
<status database="online" api="online" gpx="online"/>
</api>
<policy>
<imagery>
<blacklist regex=".*\.google\.com/.*"/>
<blacklist regex=".*209\.85\.2\d\d.*"/>
<blacklist regex=".*209\.85\.1[3-9]\d.*"/>
<blacklist regex=".*209\.85\.12[89].*"/>
</imagery>
</policy>
</osm>
This class is used in conjunction with a very primitive parser
and simply stuffs the each tag and its attributes into a hash
of hashes, with the exception of the "blacklist" tag which gets
a list of its own. The DOM hierarchy is disregarded.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA parser for the "capabilities" response XML. -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()Clears the API capabilities.Returns the value of configuration item in the capabilities as string value.Returns the value of configuration item in the capabilities as double value.Returns the full list of imagery blacklist regular expressions.Returns the value of configuration item in the capabilities as long value.intReturns the max number of objects in a changeset.longReturns the max number of nodes in a way.booleanDetermines if given element and attribute are defined.booleanChecks if the given URL is blacklisted by one of the of the regular expressions.voidAdds a new configuration item.booleansupportsVersion(String version) Determines if a given API version is supported.private static voidwarnIllegalValue(String attr, String elem, Object val)
-
Field Details
-
capabilities
-
imageryBlacklist
-
-
Constructor Details
-
Capabilities
public Capabilities()Constructs newCapabilities.
-
-
Method Details
-
isDefined
Determines if given element and attribute are defined.- Parameters:
element- the name of the elementattribute- the name of the attribute- Returns:
trueif defined,falseotherwise
-
get
Returns the value of configuration item in the capabilities as string value.- Parameters:
element- the name of the elementattribute- the name of the attribute- Returns:
- the value;
null, if the respective configuration item does not exist
-
getDouble
Returns the value of configuration item in the capabilities as double value.- Parameters:
element- the name of the elementattribute- the name of the attribute- Returns:
- the value;
null, if the respective configuration item does not exist - Throws:
NumberFormatException- if the value is not a valid double
-
getLong
Returns the value of configuration item in the capabilities as long value.- Parameters:
element- the name of the elementattribute- the name of the attribute- Returns:
- the value;
null, if the respective configuration item does not exist - Throws:
NumberFormatException- if the value is not a valid long
-
put
Adds a new configuration item.- Parameters:
element- the name of the elementattribute- the name of the attributevalue- the value as string
-
clear
Clears the API capabilities. -
supportsVersion
Determines if a given API version is supported.- Parameters:
version- The API version to check- Returns:
trueis version is between the minimum supported version and the maximum one,falseotherwise
-
warnIllegalValue
-
getMaxChangesetSize
Returns the max number of objects in a changeset. -1 if either the capabilities don't include this parameter or if the parameter value is illegal (not a number, a negative number)- Returns:
- the max number of objects in a changeset
-
getMaxWayNodes
Returns the max number of nodes in a way. -1 if either the capabilities don't include this parameter or if the parameter value is illegal (not a number, a negative number)- Returns:
- the max number of nodes in a way
-
isOnImageryBlacklist
Checks if the given URL is blacklisted by one of the of the regular expressions.- Parameters:
url- Imagery URL to check- Returns:
trueif URL is blacklisted,falseotherwise
-
getImageryBlacklist
Returns the full list of imagery blacklist regular expressions.- Returns:
- full list of imagery blacklist regular expressions
-