org.gcube.opensearch.opensearchlibrary.query
Class BasicURLTemplate

java.lang.Object
  extended by org.gcube.opensearch.opensearchlibrary.query.BasicURLTemplate
All Implemented Interfaces:
URLTemplate

public class BasicURLTemplate
extends java.lang.Object
implements URLTemplate

Class implementing the URLTemplate interface

Author:
gerasimos.farantatos

Constructor Summary
BasicURLTemplate(java.lang.String template, java.util.Map<java.lang.String,java.lang.String> nsPrefixes)
          Creates a new BasicURLTemplate object
 
Method Summary
 java.util.List<java.lang.String> getOptionalParameters()
          Returns a list containing the qualified names of all optional parameters contained in the template
 java.util.List<java.lang.String> getRequiredParameters()
          Returns a list containing the qualified names of all required parameters contained in the template
 java.lang.String getTemplate()
          Returns the query template
 boolean hasParameter(java.lang.String name)
          Determines if the template contains a parameter with a given qualified name
 boolean isParameterRequired(java.lang.String name)
          Determines if a parameter with a given qualified name is a required parameter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicURLTemplate

public BasicURLTemplate(java.lang.String template,
                        java.util.Map<java.lang.String,java.lang.String> nsPrefixes)
                 throws java.lang.Exception
Creates a new BasicURLTemplate object

Parameters:
template - The query template that will be used
nsPrefixes - The mapping from namespace URIs to namespace prefixes for all namespaces contained in a description document
Throws:
java.lang.Exception - If a parameter namespace URI is not present in the description document or in case of other error
Method Detail

getRequiredParameters

public java.util.List<java.lang.String> getRequiredParameters()
Returns a list containing the qualified names of all required parameters contained in the template

Specified by:
getRequiredParameters in interface URLTemplate
Returns:
A list of all required parameters of the template
See Also:
URLTemplate.getRequiredParameters()

getOptionalParameters

public java.util.List<java.lang.String> getOptionalParameters()
Returns a list containing the qualified names of all optional parameters contained in the template

Specified by:
getOptionalParameters in interface URLTemplate
Returns:
A list of all optional parameters of the template
See Also:
URLTemplate.getOptionalParameters()

isParameterRequired

public boolean isParameterRequired(java.lang.String name)
                            throws NonExistentParameterException
Determines if a parameter with a given qualified name is a required parameter

Specified by:
isParameterRequired in interface URLTemplate
Parameters:
name - The qualified name of the parameter
Returns:
true if the parameter is required, false otherwise
Throws:
NonExistentParameterException - If the parameter is not found among the parameters contained in the template
See Also:
URLTemplate.isParameterRequired(String)

hasParameter

public boolean hasParameter(java.lang.String name)
Determines if the template contains a parameter with a given qualified name

Specified by:
hasParameter in interface URLTemplate
Parameters:
name - The qualified name of the parameter
Returns:
true if the parameter is contained in the template, false otherwise
See Also:
URLTemplate.hasParameter(String)

getTemplate

public java.lang.String getTemplate()
Returns the query template

Specified by:
getTemplate in interface URLTemplate
Returns:
The query template
See Also:
URLTemplate.getTemplate()