Package org.opengis.cite.cat30.util
Class OpenSearchTemplateUtils
java.lang.Object
org.opengis.cite.cat30.util.OpenSearchTemplateUtils
Provides various utility methods for processing OpenSearch URL templates.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URI
buildRequestURI
(Element urlElem, Map<QName, String> values) Builds a request URI by processing a URL template according to the given parameter substitution values.filterURLTemplatesByParam
(List<Node> urlTemplates, QName paramName) Filters a list of OpenSearch URL templates to include only those that contain the specified parameter.static String
getDefaultParamValue
(List<TemplateParamInfo> paramList, QName paramName) Returns the default value of the specified template parameter.getQueryParameters
(Node query) Extracts the actual parameters from an OpenSearch query specification.static QName
getTemplateParameterName
(String param, Node contextNode) Returns the qualified name of the given OpenSearch URL template parameter.static void
updateOpenSearchParameter
(TemplateParamInfo paramInfo, Element urlElem) Updates the type and default value of a standard OpenSearch parameter.
-
Constructor Details
-
OpenSearchTemplateUtils
public OpenSearchTemplateUtils()
-
-
Method Details
-
getTemplateParameterName
Returns the qualified name of the given OpenSearch URL template parameter.- Parameters:
param
- A parameter in a URL template (e.g. "searchTerms", "geo:box?").contextNode
- The context node; this is used to perform a namespace lookup if necessary.- Returns:
- A QName representing the name of the template parameter.
-
filterURLTemplatesByParam
Filters a list of OpenSearch URL templates to include only those that contain the specified parameter.- Parameters:
urlTemplates
- A list of (Element) nodes representing URL templates.paramName
- The qualified name of a template parameter.- Returns:
- A new list containing templates with the specified parameter.
-
buildRequestURI
Builds a request URI by processing a URL template according to the given parameter substitution values. The default value is used if there is no replacement value for a parameter.- Parameters:
urlElem
- An Element node that represents a query endpoint (osd:Url).values
- A Map containing replacement values for template parameters.- Returns:
- A URI representing the resulting request URI.
-
getDefaultParamValue
Returns the default value of the specified template parameter.- Parameters:
paramList
- A list of TemplateParamInfo objects describing the declared template parameters.paramName
- The qualified name of a template parameter.- Returns:
- A String representing the default value (possibly an empty string).
-
updateOpenSearchParameter
Updates the type and default value of a standard OpenSearch parameter.- Parameters:
paramInfo
- A TemplateParamInfo object describing a standard OpenSearch parameter.urlElem
- An Element node (osd:Url) that defines an OpenSearch request containing the parameter.- See Also:
-
getQueryParameters
Extracts the actual parameters from an OpenSearch query specification.- Parameters:
query
- A Node representing an osd:Query element.- Returns:
- A Map containing the query parameters, where the key is the (qualified) parameter name.
-