org.gcube.opensearch.opensearchdatasource
Class OpenSearchDataSourceResource

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>
          extended by org.gcube.common.core.state.GCUBEWSResource
              extended by org.gcube.opensearch.opensearchdatasource.OpenSearchDataSourceResource
All Implemented Interfaces:
org.gcube.common.core.utils.handlers.GCUBEServiceClient, org.globus.wsrf.PersistenceCallback, org.globus.wsrf.Resource, org.globus.wsrf.ResourceLifetime, org.globus.wsrf.ResourceProperties, org.globus.wsrf.TopicListAccessor

public class OpenSearchDataSourceResource
extends org.gcube.common.core.state.GCUBEWSResource

A class containing stateful information regarding an OpenSearch adaptor.

Author:
gerasimos.farantatos, NKUA

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEStatefulResource
org.gcube.common.core.state.GCUBEStatefulResource.LOCK, org.gcube.common.core.state.GCUBEStatefulResource.TaskContext
 
Field Summary
 List<String> allPresentableNames
           
protected  boolean bInitializing
          Is the resource in the initialization state or not?
 org.gcube.opensearch.opensearchoperator.resource.ISOpenSearchResourceCache cache
           
 org.gcube.opensearch.opensearchoperator.resource.ISOpenSearchResource[] openSearchGenericResources
           
 List<String> presentableFields
           
static String RP_ADAPTOR_ID
          The list of standard resource properties defined by every OpenSearch WS resource
static String RP_COLLECTION_ID
           
static String RP_DESCRIPTION_DOCUMENT_URI
           
static String RP_FIELDS
           
static String RP_FIXEDPARAMETERS
           
static String RP_OPENSEARCH_RESOURCE
           
static String RP_SUPPORTED_RELATIONS
           
protected static String[] RPNames
           
 List<String> searchableFields
           
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
uuidGen
 
Constructor Summary
OpenSearchDataSourceResource()
          Empty constructor.
 
Method Summary
 void addCachedOpenSearchResource(String ddURL, org.gcube.common.core.informationsystem.client.XMLResult resource)
          Adds an OpenSearch Resource to the brokered provider's resource cache
 void addCachedOpenSearchResources(Map<String,org.gcube.common.core.informationsystem.client.XMLResult> resources)
          Adds the OpenSearch Resources contained in the map to the brokered provider's resource cache
 void addCollectionID(String collectionID)
          Adds a collection id to the collectionID resource property
 void addDescriptionDocumentURI(String descriptionDocumentURI)
           
 void addProviders(String[] fields, String[] collectionIds, String[] openSearchResourceIDs, String[][] fixedParams)
           
protected  void filterFieldInfo(List<String> presentableFields, List<String> searchableFields)
           
 String getAdaptorID()
          Getter method for the AdaptorID Resource Property
 org.gcube.opensearch.opensearchoperator.resource.OpenSearchResource getCachedOpenSearchResource(String ddURL)
          Returns the cached OpenSearch Resource of a brokered provider whose description document URL is ddURL
 List<org.gcube.opensearch.opensearchoperator.resource.OpenSearchResource> getCachedOpenSearchResources()
          Returns all cached OpenSearch Resources of the brokered providers associated with the provider of this WS-Resource
 String[] getCollectionID()
          Getter method for the CollectionID list Resource Property
 Document getDescriptionDocument(int i)
          Getter method for the cached Description document
 String[] getDescriptionDocumentURI()
          Getter method for the DescriptionDocumentURI list Resource Property
 String getDescriptionDocumentURI(int i)
          Getter method for the DescriptionDocument Resource Property
 String[] getFields()
          Getter method for the Fields list Resource Property
 String[] getFixedParameters()
          Getter method for the FixedParameters list Resource Property
 gr.uoa.di.madgik.environment.hint.EnvHintCollection getISEnvHints()
          Retrieves the InformationSystem environmental hints that this resource is using
 String[] getOpenSearchResource()
          Getter method for the OpenSearchResource list Resource Property
 String getOpenSearchResource(int i)
          Getter method for the OpenSearchResource Resource Property
 String[] getPropertyNames()
          Retrieves the property names
protected  void initialise(Object... args)
          This method is used to initialize the resource instance, and must be called before using the resource instance.
 boolean isInitializing()
          Returns the current initialization state of the resource
protected  void onLoad(ObjectInputStream ois, boolean firstLoad)
          Invoked when a resource is being created from a serialized, previously saved state.
 void onResourceRemoval()
           
protected  void onStore(ObjectOutputStream oos)
          Invoked when the state of the resource must be saved (resource serialization)
 URI query(String cqlQuery)
          Performs a query on the OpenSearch provider that is connected to this resource.
static org.gcube.common.core.informationsystem.client.XMLResult retrieveGenericResource(String id, org.gcube.common.core.scope.GCUBEScope scope)
          Retrieves a generic resource using the IS
static String[] retrieveTemplates(org.gcube.opensearch.opensearchlibrary.DescriptionDocument dd, org.gcube.opensearch.opensearchoperator.resource.OpenSearchResource res)
           
 void setAdaptorID(String adaptorID)
          Setter method for the AdaptorID Resource Property
 void setCollectionID(String[] collectionIDs)
          Setter method for the CollectionID list Resource Property
 void setDescriptionDocumentURI(String descriptionDocumentURI)
          Setter method for the DescriptionDocument Resource Property
 void setDescriptionDocumentURI(String[] descriptionDocumentURIs)
          Setter method for the DescriptionDocumentURI list Resource Property
 void setFixedParameters(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(String openSearchResource)
          Setter method for the OpenSearchResource Resource Property
 void setOpenSearchResource(String[] openSearchResource)
          Setter method for the OpenSearchResource list Resource Property
 void store()
           
 
Methods inherited from class org.gcube.common.core.state.GCUBEWSResource
getCurrentTime, getEPR, getPorttypeContext, getProperty, getPublisher, getResourcePropertySet, getServiceContext, getTerminationTime, getTopicList, getTopicNames, initialise, initialiseContainers, inScope, load, publish, setPortTypeContext, setTerminationTime, unpublish
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, onRemove, setID, setPersistenceDelegate, stopTask
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
getPortTypeMap, setPortTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

openSearchGenericResources

public org.gcube.opensearch.opensearchoperator.resource.ISOpenSearchResource[] openSearchGenericResources

cache

public org.gcube.opensearch.opensearchoperator.resource.ISOpenSearchResourceCache cache

searchableFields

public List<String> searchableFields

presentableFields

public List<String> presentableFields

allPresentableNames

public List<String> allPresentableNames

RP_ADAPTOR_ID

public static final 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 String RP_COLLECTION_ID
See Also:
Constant Field Values

RP_SUPPORTED_RELATIONS

public static final String RP_SUPPORTED_RELATIONS
See Also:
Constant Field Values

RP_FIELDS

public static final String RP_FIELDS
See Also:
Constant Field Values

RP_DESCRIPTION_DOCUMENT_URI

public static final String RP_DESCRIPTION_DOCUMENT_URI
See Also:
Constant Field Values

RP_FIXEDPARAMETERS

public static final String RP_FIXEDPARAMETERS
See Also:
Constant Field Values

RP_OPENSEARCH_RESOURCE

public static final String RP_OPENSEARCH_RESOURCE
See Also:
Constant Field Values

RPNames

protected static String[] RPNames

bInitializing

protected boolean bInitializing
Is the resource in the initialization state or not?

Constructor Detail

OpenSearchDataSourceResource

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

Method Detail

retrieveTemplates

public static String[] retrieveTemplates(org.gcube.opensearch.opensearchlibrary.DescriptionDocument dd,
                                         org.gcube.opensearch.opensearchoperator.resource.OpenSearchResource res)
                                  throws Exception
Throws:
Exception

getPropertyNames

public String[] getPropertyNames()
Retrieves the property names

Overrides:
getPropertyNames in class org.gcube.common.core.state.GCUBEWSResource
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

initialise

protected void initialise(Object... args)
                   throws Exception
This method is used to initialize the resource instance, and must be called before using the resource instance.

Specified by:
initialise in class org.gcube.common.core.state.GCUBEWSResource
Parameters:
key - String - used as the key for this OpenSearch adaptor
collectionIDs - String[] - a list of IDs of the collections(for now we have only one collection) that refer to this OpenSearch adaptor
genericResource - String - the openSearch generic resource expressed as an XMLResult
openSearchResource - String - the ID of the openSearch generic resource
fixedParameters - String - parameters that must be fixed in the templates of a broker, in the broker-case
Throws:
Exception

addProviders

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

onLoad

protected void onLoad(ObjectInputStream ois,
                      boolean firstLoad)
               throws Exception
Invoked when a resource is being created from a serialized, previously saved state.

Parameters:
ois - the input stream through which the state can be read
indicates - if the resource is being loaded for the first time (hard load) or not (soft load)
Throws:
Exception - an error occured during resource deserialization

onStore

protected void onStore(ObjectOutputStream oos)
                throws Exception
Invoked when the state of the resource must be saved (resource serialization)

Parameters:
oos - the output stream to write the resource state to
Throws:
Exception - an error occured during resource serialization

retrieveGenericResource

public static org.gcube.common.core.informationsystem.client.XMLResult retrieveGenericResource(String id,
                                                                                               org.gcube.common.core.scope.GCUBEScope scope)
                                                                                        throws 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:
Exception - In case of error

store

public void store()
Specified by:
store in interface org.globus.wsrf.PersistenceCallback
Overrides:
store in class org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>

getAdaptorID

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

Returns:
String the requested adaptorID

setAdaptorID

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

Parameters:
adaptorID - String the new AdaptorID

getFields

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

Returns:
String[] the requested Fields

getCollectionID

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

Returns:
String[] the requested CollectionIDs

setCollectionID

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

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

addCollectionID

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

Parameters:
collectionID - String -the ID to be added

getDescriptionDocumentURI

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

Returns:
String[] the requested DescriptionDocumentURIs

getDescriptionDocumentURI

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

Returns:
String the requested DescriptionDocumentURI

setDescriptionDocumentURI

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

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

addDescriptionDocumentURI

public void addDescriptionDocumentURI(String descriptionDocumentURI)
                               throws Exception
Throws:
Exception

setDescriptionDocumentURI

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

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

getFixedParameters

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

Returns:
String[] the requested FixedParameters

setFixedParameters

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

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

getOpenSearchResource

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

Returns:
String the OpenSearchResource ID

getOpenSearchResource

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

Returns:
String the OpenSearchResource ID

setOpenSearchResource

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

Parameters:
openSearchResource - String the new OpenSearchResource ID

setOpenSearchResource

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

Parameters:
openSearchResource - String the new OpenSearchResource ID

getDescriptionDocument

public Document getDescriptionDocument(int i)
Getter method for the cached Description document

Returns:
The description document

getCachedOpenSearchResource

public org.gcube.opensearch.opensearchoperator.resource.OpenSearchResource getCachedOpenSearchResource(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 List<org.gcube.opensearch.opensearchoperator.resource.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(String ddURL,
                                        org.gcube.common.core.informationsystem.client.XMLResult resource)
                                 throws 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:
Exception - In case of error

addCachedOpenSearchResources

public void addCachedOpenSearchResources(Map<String,org.gcube.common.core.informationsystem.client.XMLResult> resources)
                                  throws 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:
Exception - In case of error

query

public URI query(String cqlQuery)
          throws 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:
RemoteException - In case of error

getISEnvHints

public gr.uoa.di.madgik.environment.hint.EnvHintCollection getISEnvHints()
Retrieves the InformationSystem environmental hints that this resource is using

Returns:
The environmental hints

onResourceRemoval

public void onResourceRemoval()

filterFieldInfo

protected void filterFieldInfo(List<String> presentableFields,
                               List<String> searchableFields)


Copyright © 2013. All Rights Reserved.