org.gcube.opensearch.opensearchoperator.resource
Class LocalResourceRepository

java.lang.Object
  extended by org.gcube.opensearch.opensearchoperator.resource.LocalResourceRepository
All Implemented Interfaces:
ResourceRepository

public class LocalResourceRepository
extends java.lang.Object
implements ResourceRepository

Class implementing the ResourceRepository interface that is used to store and retrieve OpenSearch resources in the absence of an InformationSystem

Author:
gerasimos.farantatos

Constructor Summary
LocalResourceRepository(java.io.File schemaFile)
          Creates a new LocalResourceRepository
 
Method Summary
 void add(OpenSearchResource resource)
          Adds a pre-processed OpenSearchResource to the repository
 void add(java.lang.String dirPath)
          Retrieves all OpenSearch resources, whose XML representations are contained in a directory with a given path and adds them to the repository
 void addURL(java.lang.String resourceURL)
          Adds an OpenSearch resource whose XML representation is retrieved through a URL to the repository
 OpenSearchResource get(java.lang.String descriptionDocURL)
          Retrieves an OpenSearchResource identified by the description document URL of the OpenSearch provider associated with it
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalResourceRepository

public LocalResourceRepository(java.io.File schemaFile)
Creates a new LocalResourceRepository

Parameters:
schemaFile - The XSD of the OpenSearch resource that will be used to validate the XML representation of the OpenSearch resources retrieved. This is an optional parameter and can be left null if no validation is to be performed.
Method Detail

add

public void add(java.lang.String dirPath)
         throws java.lang.Exception
Retrieves all OpenSearch resources, whose XML representations are contained in a directory with a given path and adds them to the repository

Parameters:
dirPath - The path of the directory to look for OpenSearch resources
Throws:
java.lang.Exception - In case of error

addURL

public void addURL(java.lang.String resourceURL)
            throws java.lang.Exception
Adds an OpenSearch resource whose XML representation is retrieved through a URL to the repository

Parameters:
resourceURL - The URL of the OpenSearch resource
Throws:
java.lang.Exception - In case of error

add

public void add(OpenSearchResource resource)
Adds a pre-processed OpenSearchResource to the repository

Parameters:
resource - The OpenSearch resource to be added to the repository

get

public OpenSearchResource get(java.lang.String descriptionDocURL)
                       throws java.lang.Exception
Retrieves an OpenSearchResource identified by the description document URL of the OpenSearch provider associated with it

Specified by:
get in interface ResourceRepository
Parameters:
descriptionDocURL - The URL of the description document associated with the OpenSearch provider associated with the OpenSearchResource to be retrieved
Returns:
The requested OpenSearch resource
Throws:
java.lang.Exception
See Also:
ResourceRepository.get(String)