org.gcube.searchsystem.environmentadaptor
Class ResourceRegistryAdapter

java.lang.Object
  extended by org.gcube.searchsystem.environmentadaptor.ResourceRegistryAdapter
All Implemented Interfaces:
EnvironmentAdaptor

public class ResourceRegistryAdapter
extends java.lang.Object
implements EnvironmentAdaptor


Constructor Summary
ResourceRegistryAdapter(java.lang.String scope)
          Default constructor which takes the working scope for the ResourceRegistry
 
Method Summary
 java.util.Set<java.lang.String> getCollectionByFieldRelationLang(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap, java.lang.String language, java.util.List<java.lang.String> projections)
          Get the collections for a number of criteria and a specific language.
 java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getCollectionLangsByFieldRelation(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap, java.util.List<java.lang.String> projections)
          Get the collection-languages pairs for a number of criteria.
 java.util.Set<java.lang.String> getLanguageByFieldRelationCol(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap, java.lang.String collection, java.util.List<java.lang.String> projections)
          Get the languages for a number of criteria and a specific collection.
 java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> getProjectionsPerSource(java.util.Set<java.lang.String> sources, java.util.Set<java.lang.String> projectionsNeeded, java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> colLangs)
          Get the fields projected by each of the sources of the input.
 java.util.Set<java.lang.String> getSourceIdsForFieldRelationCollectionLanguage(java.lang.String field, java.lang.String relation, java.lang.String collection, java.lang.String language, java.lang.String indication)
          Get source identifiers for all the sources that publish a searchable field for a specific collection and language AND they also support the specified relation, and they provide the capability(e.g.
static boolean initializeAdapter()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceRegistryAdapter

public ResourceRegistryAdapter(java.lang.String scope)
Default constructor which takes the working scope for the ResourceRegistry

Parameters:
scope - - the working scope
Method Detail

initializeAdapter

public static boolean initializeAdapter()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getProjectionsPerSource

public java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> getProjectionsPerSource(java.util.Set<java.lang.String> sources,
                                                                                                       java.util.Set<java.lang.String> projectionsNeeded,
                                                                                                       java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> colLangs)
                                                                                                throws java.lang.Exception
Description copied from interface: EnvironmentAdaptor
Get the fields projected by each of the sources of the input. For including a field in the output(for a specific source) this field must be presentable for all the collection-language pairs specified in the input(for this specific source)

Specified by:
getProjectionsPerSource in interface EnvironmentAdaptor
Parameters:
sources - - the sources of interest
projectionsNeeded - - the fields of interest
colLangs - - the collection-language pairs of interest
Returns:
a map containing the fields for each source
Throws:
java.lang.Exception

getCollectionLangsByFieldRelation

public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getCollectionLangsByFieldRelation(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap,
                                                                                                         java.util.List<java.lang.String> projections)
                                                                                                  throws java.lang.Exception
Description copied from interface: EnvironmentAdaptor
Get the collection-languages pairs for a number of criteria. The criteria are specified by field-relation pairs. The return map will have all the collection-language pairs for which there are sources for all the searchable field - supported relation pairs specified. The projections is an optional field, which specifies which are the presentable fields that must be published by sources for a collection-language pair

Specified by:
getCollectionLangsByFieldRelation in interface EnvironmentAdaptor
Parameters:
fieldRelationMap - - the search criteria specified
projections - - the presentation criteria specified
Returns:
the collection-language pairs satisfying the criteria
Throws:
java.lang.Exception

getCollectionByFieldRelationLang

public java.util.Set<java.lang.String> getCollectionByFieldRelationLang(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap,
                                                                        java.lang.String language,
                                                                        java.util.List<java.lang.String> projections)
                                                                 throws java.lang.Exception
Description copied from interface: EnvironmentAdaptor
Get the collections for a number of criteria and a specific language. The criteria are specified by field-relation pairs. The return map will have all the collections for which there are sources for all the (language+searchable)(meaning that the source publishes this field as searchable for this specific language and a collection X) field - supported relation pairs specified. The projections is an optional field, which specifies which are the (language+presentable) fields that must be published by sources for a collection

Specified by:
getCollectionByFieldRelationLang in interface EnvironmentAdaptor
Parameters:
fieldRelationMap - - the search criteria specified
language - - the language specifed
projections - - the presentation criteria specified
Returns:
the list of collections satisfying the criteria for the language specified
Throws:
java.lang.Exception

getLanguageByFieldRelationCol

public java.util.Set<java.lang.String> getLanguageByFieldRelationCol(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fieldRelationMap,
                                                                     java.lang.String collection,
                                                                     java.util.List<java.lang.String> projections)
                                                              throws java.lang.Exception
Description copied from interface: EnvironmentAdaptor
Get the languages for a number of criteria and a specific collection. The criteria are specified by field-relation pairs. The return map will have all the languages for which there are sources for all the (collection+searchable)(meaning that the source publishes this field as searchable for this specific collection and a language X) field - supported relation pairs specified. The projections is an optional field, which specifies which are the (collection+presentable) fields that must be published by sources for a language

Specified by:
getLanguageByFieldRelationCol in interface EnvironmentAdaptor
Parameters:
fieldRelationMap - - the search criteria specified
collection - - the collection specified
projections - - the presentation criteria specified
Returns:
the list of languages satisfying the criteria for the collection specified
Throws:
java.lang.Exception

getSourceIdsForFieldRelationCollectionLanguage

public java.util.Set<java.lang.String> getSourceIdsForFieldRelationCollectionLanguage(java.lang.String field,
                                                                                      java.lang.String relation,
                                                                                      java.lang.String collection,
                                                                                      java.lang.String language,
                                                                                      java.lang.String indication)
                                                                               throws java.lang.Exception
Description copied from interface: EnvironmentAdaptor
Get source identifiers for all the sources that publish a searchable field for a specific collection and language AND they also support the specified relation, and they provide the capability(e.g. rank) specified in the indication argument.

Specified by:
getSourceIdsForFieldRelationCollectionLanguage in interface EnvironmentAdaptor
Parameters:
field - - the searchable field specified
relation - - the relation specified
collection - - the collection specified
language - - the language specified
indication - - the capability specified
Returns:
the set of source identifiers - note that these identifiers can be internal to the adaptor and in the next search stages(e.g. workflow), the same adaptor must be used.
Throws:
java.lang.Exception