org.gcube.opensearch.opensearchlibrary.utils
Class FactoryResolver

java.lang.Object
  extended by org.gcube.opensearch.opensearchlibrary.utils.FactoryResolver

public class FactoryResolver
extends java.lang.Object

A utility class that is used to create a pair of URL and Query element factories which respectively construct URLElement and QueryElement instances capable of processing the corresponding URL and query elements. The specific classes belonging to the chain of responsibility are specified in the factory parameter Note that the implementation of classes implementing functionality of a specific OpenSearch extension is not a necessary condition for the operation of the library's core logic. However, the correct interpretation of extension-related parameters and elements will be facilitated if all classes needed to implement the functionality of all extensions used are implemented.

Author:
gerasimos.farantatos, NKUA

Method Summary
static FactoryPair getFactories()
           
static void initialize(java.util.Collection<java.lang.String> queryNamespaces, java.util.Map<java.lang.String,FactoryClassNamePair> factories)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static void initialize(java.util.Collection<java.lang.String> queryNamespaces,
                              java.util.Map<java.lang.String,FactoryClassNamePair> factories)
Parameters:
queryNamespaces - A list of all namespaces present in an OpenSearch query, including both the standard namespace and the namespaces of each extension, if present
factories - The mapping from namespace URIs to FactoryClassNamePair entries, which will be used to construct the factories using reflection

getFactories

public static FactoryPair getFactories()
                                throws java.lang.Exception
Returns:
A FactoryPair of URL and Query element factories
Throws:
java.lang.Exception - If the base-type factory class implementing standard OpenSearch functionality is not specified or the constructor of a factory class does not conform to the convention used for reflection-based instance creation (i.e. it does not specify a single constructor with a single factory parameter)