org.gcube.opensearch.opensearchoperator
Class OpenSearchWorker

java.lang.Object
  extended by org.gcube.opensearch.opensearchoperator.OpenSearchWorker
All Implemented Interfaces:
java.lang.Runnable

public class OpenSearchWorker
extends java.lang.Object
implements java.lang.Runnable

Used to perform the actual OpenSearchOp operations needed to obtain results and to return the locator of the output

Author:
gerasimos.farantatos, NKUA

Constructor Summary
OpenSearchWorker(OpenSearchResource resource, ResourceRepository resources, OpenSearchOpConfig config, java.lang.String terms, java.util.Map<java.lang.String,java.lang.String> params, java.lang.String fixedTerms, java.util.Map<java.lang.String,java.lang.String> fixedParams, java.util.Set<java.lang.String> queryNamespaces, java.lang.Object synchLocator)
          Creates a new OpenSearchWorker
 
Method Summary
 java.lang.Integer getFinalResultCount()
           
 java.net.URI getLocator()
          Returns the locator of the output
 void run()
          Performs the operations needed to obtain the requested search results.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenSearchWorker

public OpenSearchWorker(OpenSearchResource resource,
                        ResourceRepository resources,
                        OpenSearchOpConfig config,
                        java.lang.String terms,
                        java.util.Map<java.lang.String,java.lang.String> params,
                        java.lang.String fixedTerms,
                        java.util.Map<java.lang.String,java.lang.String> fixedParams,
                        java.util.Set<java.lang.String> queryNamespaces,
                        java.lang.Object synchLocator)
                 throws java.lang.Exception
Creates a new OpenSearchWorker

Parameters:
resource - The OpenSearchResource associated with the provider that will be queried for results
resources - A repository capable of retrieving OpenSearchResources on demand
config - The configuration to be used
terms - The search terms to be used while querying the provider
params - The OpenSearch parameters that to be used while querying the provider
fixedTerms - The pre-fixed terms to be used while querying the top-level broker
fixedParams - The pre-fixed parameters to be used while querying the top-level broker
queryNamespaces - The namespaces present in the query
Throws:
java.lang.Exception - An error has ocurred
Method Detail

getLocator

public java.net.URI getLocator()
Returns the locator of the output

Returns:
The locator of the output

getFinalResultCount

public java.lang.Integer getFinalResultCount()

run

public void run()
Performs the operations needed to obtain the requested search results. After analyzing the description document corresponding to the provider described in the OpenSearchResource that is being processed, search queries are issued to obtain the results page by page. At each step the results are transformed using a transformation specification described in the OpenSearchResource, matching one of the result MIME types that the provider supports. If the provider acts as a broker, the OpenSearchResource objects of the brokered providers are retrieved and are used to obtain the actual results from the brokered providers, either sequentially or concurrently depending on configuration

Specified by:
run in interface java.lang.Runnable