org.gcube.opensearch.opensearchdatasource
Class OpenSearchDataSourceResource

java.lang.Object
  extended by GCUBEWSResource
      extended by org.gcube.opensearch.opensearchdatasource.OpenSearchDataSourceResource

public class OpenSearchDataSourceResource
extends GCUBEWSResource

A class containing stateful information regarding an OpenSearch adaptor.

Author:
gerasimos.farantatos, NKUA

Field Summary
 java.util.List<java.lang.String> allPresentableNames
           
 ISOpenSearchResourceCache cache
           
 ISOpenSearchResource[] openSearchGenericResources
           
 java.util.List<java.lang.String> presentableFields
           
static java.lang.String RP_ADAPTOR_ID
          The list of standard resource properties defined by every OpenSearch WS resource
static java.lang.String RP_COLLECTION_ID
           
static java.lang.String RP_DESCRIPTION_DOCUMENT_URI
           
static java.lang.String RP_FIELDS
           
static java.lang.String RP_FIXEDPARAMETERS
           
static java.lang.String RP_OPENSEARCH_RESOURCE
           
static java.lang.String RP_SUPPORTED_RELATIONS
           
 java.util.List<java.lang.String> searchableFields
           
 
Constructor Summary
OpenSearchDataSourceResource()
          Empty constructor.
 
Method Summary
 void addCachedOpenSearchResource(java.lang.String ddURL, XMLResult resource)
          Adds an OpenSearch Resource to the brokered provider's resource cache
 void addCachedOpenSearchResources(java.util.Map<java.lang.String,XMLResult> resources)
          Adds the OpenSearch Resources contained in the map to the brokered provider's resource cache
 void addCollectionID(java.lang.String collectionID)
          Adds a collection id to the collectionID resource property
 void addDescriptionDocumentURI(java.lang.String descriptionDocumentURI)
           
 void addProviders(java.lang.String[] fields, java.lang.String[] collectionIds, java.lang.String[] openSearchResourceIDs, java.lang.String[][] fixedParams)
           
 java.lang.String getAdaptorID()
          Getter method for the AdaptorID Resource Property
 OpenSearchResource getCachedOpenSearchResource(java.lang.String ddURL)
          Returns the cached OpenSearch Resource of a brokered provider whose description document URL is ddURL
 java.util.List<OpenSearchResource> getCachedOpenSearchResources()
          Returns all cached OpenSearch Resources of the brokered providers associated with the provider of this WS-Resource
 java.lang.String[] getCollectionID()
          Getter method for the CollectionID list Resource Property
 org.w3c.dom.Document getDescriptionDocument(int i)
          Getter method for the cached Description document
 java.lang.String[] getDescriptionDocumentURI()
          Getter method for the DescriptionDocumentURI list Resource Property
 java.lang.String getDescriptionDocumentURI(int i)
          Getter method for the DescriptionDocument Resource Property
 java.lang.String[] getFields()
          Getter method for the Fields list Resource Property
 java.lang.String[] getFixedParameters()
          Getter method for the FixedParameters list Resource Property
 EnvHintCollection getISEnvHints()
          Retrieves the InformationSystem environmental hints that this resource is using
 java.lang.String[] getOpenSearchResource()
          Getter method for the OpenSearchResource list Resource Property
 java.lang.String getOpenSearchResource(int i)
          Getter method for the OpenSearchResource Resource Property
 java.lang.String[] getPropertyNames()
          Retrieves the property names
 boolean isInitializing()
          Returns the current initialization state of the resource
 void onResourceRemoval()
           
 java.net.URI query(java.lang.String cqlQuery)
          Performs a query on the OpenSearch provider that is connected to this resource.
static XMLResult retrieveGenericResource(java.lang.String id, GCUBEScope scope)
          Retrieves a generic resource using the IS
static java.lang.String[] retrieveTemplates(DescriptionDocument dd, OpenSearchResource res)
           
 void setAdaptorID(java.lang.String adaptorID)
          Setter method for the AdaptorID Resource Property
 void setCollectionID(java.lang.String[] collectionIDs)
          Setter method for the CollectionID list Resource Property
 void setDescriptionDocumentURI(java.lang.String descriptionDocumentURI)
          Setter method for the DescriptionDocument Resource Property
 void setDescriptionDocumentURI(java.lang.String[] descriptionDocumentURIs)
          Setter method for the DescriptionDocumentURI list Resource Property
 void setFixedParameters(java.lang.String[] fixedParameters)
          Setter method for the FixedParameters list Resource Property
 void setIsInitializing(boolean isInitializing)
          Specifies the current state of the resource (initializing or not)
 void setOpenSearchResource(java.lang.String openSearchResource)
          Setter method for the OpenSearchResource Resource Property
 void setOpenSearchResource(java.lang.String[] openSearchResource)
          Setter method for the OpenSearchResource list Resource Property
 void store()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

openSearchGenericResources

public ISOpenSearchResource[] openSearchGenericResources

cache

public ISOpenSearchResourceCache cache

searchableFields

public java.util.List<java.lang.String> searchableFields

presentableFields

public java.util.List<java.lang.String> presentableFields

allPresentableNames

public java.util.List<java.lang.String> allPresentableNames

RP_ADAPTOR_ID

public static final java.lang.String RP_ADAPTOR_ID
The list of standard resource properties defined by every OpenSearch WS resource

See Also:
Constant Field Values

RP_COLLECTION_ID

public static final java.lang.String RP_COLLECTION_ID
See Also:
Constant Field Values

RP_SUPPORTED_RELATIONS

public static final java.lang.String RP_SUPPORTED_RELATIONS
See Also:
Constant Field Values

RP_FIELDS

public static final java.lang.String RP_FIELDS
See Also:
Constant Field Values

RP_DESCRIPTION_DOCUMENT_URI

public static final java.lang.String RP_DESCRIPTION_DOCUMENT_URI
See Also:
Constant Field Values

RP_FIXEDPARAMETERS

public static final java.lang.String RP_FIXEDPARAMETERS
See Also:
Constant Field Values

RP_OPENSEARCH_RESOURCE

public static final java.lang.String RP_OPENSEARCH_RESOURCE
See Also:
Constant Field Values
Constructor Detail

OpenSearchDataSourceResource

public OpenSearchDataSourceResource()
Empty constructor. Initialization is done through the initialize(...) method.

Method Detail

retrieveTemplates

public static java.lang.String[] retrieveTemplates(DescriptionDocument dd,
                                                   OpenSearchResource res)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getPropertyNames

public java.lang.String[] getPropertyNames()
Retrieves the property names

Returns:
An array containing the property names

isInitializing

public boolean isInitializing()
Returns the current initialization state of the resource

Returns:
true if the resoure is currently initializing, false otherwise

setIsInitializing

public void setIsInitializing(boolean isInitializing)
Specifies the current state of the resource (initializing or not)

Parameters:
isInitializing - the initialization state to set

addProviders

public void addProviders(java.lang.String[] fields,
                         java.lang.String[] collectionIds,
                         java.lang.String[] openSearchResourceIDs,
                         java.lang.String[][] fixedParams)
                  throws java.lang.Exception
Throws:
java.lang.Exception

retrieveGenericResource

public static XMLResult retrieveGenericResource(java.lang.String id,
                                                GCUBEScope scope)
                                         throws java.lang.Exception
Retrieves a generic resource using the IS

Parameters:
id - The id of the generic resource to retrieve
scope - The scope to use
Returns:
The generic resource expressed as an XMLResult
Throws:
java.lang.Exception - In case of error

store

public void store()

getAdaptorID

public java.lang.String getAdaptorID()
Getter method for the AdaptorID Resource Property

Returns:
String the requested adaptorID

setAdaptorID

public void setAdaptorID(java.lang.String adaptorID)
Setter method for the AdaptorID Resource Property

Parameters:
adaptorID - String the new AdaptorID

getFields

public java.lang.String[] getFields()
Getter method for the Fields list Resource Property

Returns:
String[] the requested Fields

getCollectionID

public java.lang.String[] getCollectionID()
Getter method for the CollectionID list Resource Property

Returns:
String[] the requested CollectionIDs

setCollectionID

public void setCollectionID(java.lang.String[] collectionIDs)
                     throws java.lang.Exception
Setter method for the CollectionID list Resource Property

Parameters:
collectionIDs - String[] the new CollectionIDs
Throws:
java.lang.Exception

addCollectionID

public void addCollectionID(java.lang.String collectionID)
Adds a collection id to the collectionID resource property

Parameters:
collectionID - String -the ID to be added

getDescriptionDocumentURI

public java.lang.String[] getDescriptionDocumentURI()
Getter method for the DescriptionDocumentURI list Resource Property

Returns:
String[] the requested DescriptionDocumentURIs

getDescriptionDocumentURI

public java.lang.String getDescriptionDocumentURI(int i)
Getter method for the DescriptionDocument Resource Property

Returns:
String the requested DescriptionDocumentURI

setDescriptionDocumentURI

public void setDescriptionDocumentURI(java.lang.String descriptionDocumentURI)
                               throws java.lang.Exception
Setter method for the DescriptionDocument Resource Property

Parameters:
descriptionDocumentURI - String the new DescriptionDocumentURI
Throws:
java.lang.Exception - In case of error

addDescriptionDocumentURI

public void addDescriptionDocumentURI(java.lang.String descriptionDocumentURI)
                               throws java.lang.Exception
Throws:
java.lang.Exception

setDescriptionDocumentURI

public void setDescriptionDocumentURI(java.lang.String[] descriptionDocumentURIs)
                               throws java.lang.Exception
Setter method for the DescriptionDocumentURI list Resource Property

Parameters:
descriptionDocumentURIs - String[] the new DescriptionDocumentURIs
Throws:
java.lang.Exception - In case of error

getFixedParameters

public java.lang.String[] getFixedParameters()
Getter method for the FixedParameters list Resource Property

Returns:
String[] the requested FixedParameters

setFixedParameters

public void setFixedParameters(java.lang.String[] fixedParameters)
                        throws java.lang.Exception
Setter method for the FixedParameters list Resource Property

Parameters:
fixedParameters - String[] the new FixedParameters
Throws:
java.lang.Exception - In case of error

getOpenSearchResource

public java.lang.String getOpenSearchResource(int i)
Getter method for the OpenSearchResource Resource Property

Returns:
String the OpenSearchResource ID

getOpenSearchResource

public java.lang.String[] getOpenSearchResource()
Getter method for the OpenSearchResource list Resource Property

Returns:
String the OpenSearchResource ID

setOpenSearchResource

public void setOpenSearchResource(java.lang.String openSearchResource)
Setter method for the OpenSearchResource Resource Property

Parameters:
openSearchResource - String the new OpenSearchResource ID

setOpenSearchResource

public void setOpenSearchResource(java.lang.String[] openSearchResource)
Setter method for the OpenSearchResource list Resource Property

Parameters:
openSearchResource - String the new OpenSearchResource ID

getDescriptionDocument

public org.w3c.dom.Document getDescriptionDocument(int i)
Getter method for the cached Description document

Returns:
The description document

getCachedOpenSearchResource

public OpenSearchResource getCachedOpenSearchResource(java.lang.String ddURL)
Returns the cached OpenSearch Resource of a brokered provider whose description document URL is ddURL

Parameters:
ddURL - the URL of the brokered provider's description document
Returns:
the brokered provider's cached OpenSearch Resource

getCachedOpenSearchResources

public java.util.List<OpenSearchResource> getCachedOpenSearchResources()
Returns all cached OpenSearch Resources of the brokered providers associated with the provider of this WS-Resource

Returns:
a list containing all OpenSearch Resources associated with this WS-Resource

addCachedOpenSearchResource

public void addCachedOpenSearchResource(java.lang.String ddURL,
                                        XMLResult resource)
                                 throws java.lang.Exception
Adds an OpenSearch Resource to the brokered provider's resource cache

Parameters:
ddURL - the URL of the brokered provider's description document
resource - the OpenSearch Resource for the brokered provider
Throws:
java.lang.Exception - In case of error

addCachedOpenSearchResources

public void addCachedOpenSearchResources(java.util.Map<java.lang.String,XMLResult> resources)
                                  throws java.lang.Exception
Adds the OpenSearch Resources contained in the map to the brokered provider's resource cache

Parameters:
resources - A map containing a mappings from description document URLs to OpenSearch Resources for each brokered provider
Throws:
java.lang.Exception - In case of error

query

public java.net.URI query(java.lang.String cqlQuery)
                   throws java.rmi.RemoteException
Performs a query on the OpenSearch provider that is connected to this resource.

Parameters:
queryString - String - the query to be performed (using custom syntax @see )
Returns:
URI - representation of the EPR for a resultset service which holds the results of the query.
Throws:
java.rmi.RemoteException - In case of error

getISEnvHints

public EnvHintCollection getISEnvHints()
Retrieves the InformationSystem environmental hints that this resource is using

Returns:
The environmental hints

onResourceRemoval

public void onResourceRemoval()