Package org.opengis.cite.cat30.util
Class ServiceMetadataUtils
java.lang.Object
org.opengis.cite.cat30.util.ServiceMetadataUtils
Provides various utility methods for accessing service-related metadata resources such
as an OGC service description or an OpenSearch description document.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Key value that associates an Element node (osd:Url in an OpenSearch description document) with the collection of URL template parameters it declares. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
addDomainValues
(Set<String> valueSet, net.sf.saxon.s9api.XdmValue opMetadata) Adds the allowed values of operation metadata elements to the given set.getConstraintValues
(Document cswMetadata, String name) Searches a CSW capabilities document for the specified constraint and returns its set of allowed values.getOpenSearchQueriesByRole
(Document osDescr, QName role) Returns a list of nodes representing queries defined in an OpenSearch description document.getOpenSearchURLTemplates
(Document osDescr) Returns a list of nodes representing the URL templates defined in an OpenSearch description document.static URI
getOperationEndpoint
(Document cswMetadata, String opName, String httpMethod) Extracts a request endpoint from a service capabilities document.getParameterValues
(Document cswMetadata, String reqName, String paramName) Searches a CSW capabilities document for the specified request parameter and returns its set of allowed values.
-
Field Details
-
URL_TEMPLATE_PARAMS
Key value that associates an Element node (osd:Url in an OpenSearch description document) with the collection of URL template parameters it declares.- See Also:
-
-
Constructor Details
-
ServiceMetadataUtils
public ServiceMetadataUtils()
-
-
Method Details
-
getOperationEndpoint
Extracts a request endpoint from a service capabilities document. If the request URI contains a query component it is ignored.- Parameters:
cswMetadata
- A DOM Document node containing service metadata (OGC capabilities document).opName
- The operation (request) name.httpMethod
- The HTTP method to use (ifnull
or empty the first method listed will be used).- Returns:
- A URI denoting a service endpoint; the URI is empty if no matching endpoint was found.
-
getOpenSearchURLTemplates
Returns a list of nodes representing the URL templates defined in an OpenSearch description document. Each node in the resulting list will be associated with an unmodifiableList<TemplateParamInfo>
containing information about the declared template parameters; it can be accessed viagetUserData
using the key valueURL_TEMPLATE_PARAMS
.- Parameters:
osDescr
- An OpenSearchDescription document (osd:OpenSearchDescription).- Returns:
- A sequence of Element nodes (os:Url) containing URL templates.
-
getOpenSearchQueriesByRole
Returns a list of nodes representing queries defined in an OpenSearch description document.- Parameters:
osDescr
- An OpenSearchDescription document.role
- The (qualified) name of a query role.- Returns:
- A sequence of Element nodes (os:Query) that define specific search requests; the list may be empty if no matching queries are found.
-
getConstraintValues
Searches a CSW capabilities document for the specified constraint and returns its set of allowed values. The default value is returned if present; otherwise the complete list of allowed values.- Parameters:
cswMetadata
- A CSW capabilities document.name
- The name of the constraint (not case-sensitive).- Returns:
- A set containing the allowed values of the constraint; it will be empty if no such constraint exists or it has no value.
-
getParameterValues
public static Set<String> getParameterValues(Document cswMetadata, String reqName, String paramName) Searches a CSW capabilities document for the specified request parameter and returns its set of allowed values. A service-level parameter value may be overridden or supplemented by an operation-specific parameter value.- Parameters:
cswMetadata
- A CSW capabilities document.reqName
- The name of a service request; if omitted, the search is restricted to service-level parameters.paramName
- The name of the request parameter (not case-sensitive).- Returns:
- A set containing the allowed parameter values; it will be empty if no such parameter exists or it has no value.
-
addDomainValues
Adds the allowed values of operation metadata elements to the given set.- Parameters:
valueSet
- The set to which the values are added.opMetadata
- A sequence of operation metadata elements (ows:Parameter or ows:Constraint, of type ows:DomainType).
-