org.gcube.opensearch.opensearchlibrary.urlelements
Class BasicURLElement

java.lang.Object
  extended by org.gcube.opensearch.opensearchlibrary.urlelements.BasicURLElement
All Implemented Interfaces:
URLElement

public class BasicURLElement
extends java.lang.Object
implements URLElement

URL element class implementing the URLElement interface, which provides standard OpenSearch URL element functionality

Author:
gerasimos.farantatos

Constructor Summary
BasicURLElement(org.w3c.dom.Element url, java.util.Map<java.lang.String,java.lang.String> nsPrefixes)
          Creates a new BasicURLElement
 
Method Summary
 int getIndexOffset()
          Returns the value of the indexOffset OpenSearch parameter contained in this URL element.
 java.lang.String getMimeType()
          Retrieves the MIME type associated with the results obtained after issuing a query using the template contained in this URL element
 int getPageOffset()
          Returns the value of the pageOffset OpenSearch parameter contained in this URL element.
 QueryBuilder getQueryBuilder()
          Constructs and returns a QueryBuilder object that can be used to construct queries based on the template contained in this query element.
 java.lang.String getRel()
          Returns the role of the resource being described in relation to the description document
 boolean isRelSupported()
          Answers whether the rel value of the URL element can be interpreted by this URL element type
 void parse()
          Processes a URL element
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicURLElement

public BasicURLElement(org.w3c.dom.Element url,
                       java.util.Map<java.lang.String,java.lang.String> nsPrefixes)
Creates a new BasicURLElement

Parameters:
url - An Element instance containing the URL element to be processed
nsPrefixes - The mapping from namespace URIs to namespace prefixes for all namespaces contained in a description document
Method Detail

parse

public void parse()
           throws java.lang.Exception
Processes a URL element

Specified by:
parse in interface URLElement
Throws:
java.lang.Exception - If the URL element is not valid according to the OpenSearch specification or in case of other error
See Also:
URLElement.parse()

getMimeType

public java.lang.String getMimeType()
                             throws java.lang.Exception
Retrieves the MIME type associated with the results obtained after issuing a query using the template contained in this URL element

Specified by:
getMimeType in interface URLElement
Returns:
The requested MIME type
Throws:
java.lang.Exception - If the URL element is not initialized or in case of other error
See Also:
URLElement.getMimeType()

getIndexOffset

public int getIndexOffset()
                   throws java.lang.Exception
Returns the value of the indexOffset OpenSearch parameter contained in this URL element. The indexOffset defines the index number of the first search result

Specified by:
getIndexOffset in interface URLElement
Returns:
The value of the indexOffset parameter contained in the URL element
Throws:
java.lang.Exception - If the URL element is not initialized or in case of other error
See Also:
URLElement.getIndexOffset()

getPageOffset

public int getPageOffset()
                  throws java.lang.Exception
Returns the value of the pageOffset OpenSearch parameter contained in this URL element. The pageOffset defines the page number of the first set of search results

Specified by:
getPageOffset in interface URLElement
Returns:
The value of the pageOffset parameter contained in the URL element
Throws:
java.lang.Exception - If the URL element is not initialized or in case of other error
See Also:
URLElement.getPageOffset()

getRel

public java.lang.String getRel()
                        throws java.lang.Exception
Returns the role of the resource being described in relation to the description document

Specified by:
getRel in interface URLElement
Returns:
The rel value of the URL element
Throws:
java.lang.Exception - If the URL element is not initialized or in case of other error
See Also:
URLElement.getRel()

isRelSupported

public boolean isRelSupported()
                       throws java.lang.Exception
Answers whether the rel value of the URL element can be interpreted by this URL element type

Specified by:
isRelSupported in interface URLElement
Returns:
true if the rel value is supported, false otherwise
Throws:
java.lang.Exception - If the URL element is not initialized or in case of other error
See Also:
URLElement.isRelSupported()

getQueryBuilder

public QueryBuilder getQueryBuilder()
                             throws java.lang.Exception
Constructs and returns a QueryBuilder object that can be used to construct queries based on the template contained in this query element. The exact type of QueryBuilder returned depends on the type of the present URLElement instance

Specified by:
getQueryBuilder in interface URLElement
Returns:
A query builder that can be used to construct search queries
Throws:
java.lang.Exception - In case of other error during QueryBuilder construction
See Also:
URLElement.getQueryBuilder()