com.sun.labs.minion
Class SearchEngineFactory

java.lang.Object
  extended by com.sun.labs.minion.SearchEngineFactory

public class SearchEngineFactory
extends java.lang.Object

This is a factory class that can be used to get a search engine instance.


Field Summary
static java.lang.String[] configFiles
           
static java.lang.String DEFAULT_ENGINE
          The configuration name of the default search engine.
static java.lang.String GLOBAL_INDEX_DIRECTORY
          The name of the global property in the configuration containing the index directory.
static java.lang.String logTag
           
 
Constructor Summary
SearchEngineFactory()
          Creates a SearchEngineFactory
 
Method Summary
static java.io.File getDefaultConfigFile(java.lang.String indexDir)
           
static com.sun.labs.util.props.ConfigurationManager getDefaultConfiguration(java.lang.String indexDir)
          Gets the default configuration for an index in the given directory.
static SearchEngine getSearchEngine(com.sun.labs.util.props.ConfigurationManager cm)
           
static SearchEngine getSearchEngine(java.lang.String indexDir)
          Gets a search engine for the index in the provided directory.
static SearchEngine getSearchEngine(java.lang.String indexDir, java.lang.String engineName)
          Gets a search engine that combines the given configuration management file with the default.
static SearchEngine getSearchEngine(java.lang.String indexDir, java.lang.String engineName, java.net.URL configFile)
          Gets a search engine that combines the given configuration management file with the default.
static SearchEngine getSearchEngine(java.lang.String indexDir, java.net.URL configFile)
          Gets a search engine that combines the given configuration management file with the default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_INDEX_DIRECTORY

public static final java.lang.String GLOBAL_INDEX_DIRECTORY
The name of the global property in the configuration containing the index directory.

See Also:
Constant Field Values

DEFAULT_ENGINE

public static final java.lang.String DEFAULT_ENGINE
The configuration name of the default search engine.

See Also:
Constant Field Values

logTag

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

configFiles

public static final java.lang.String[] configFiles
Constructor Detail

SearchEngineFactory

public SearchEngineFactory()
Creates a SearchEngineFactory

Method Detail

getSearchEngine

public static SearchEngine getSearchEngine(java.lang.String indexDir)
                                    throws SearchEngineException
Gets a search engine for the index in the provided directory. This engine will be configured with a set of defaults.

Parameters:
indexDir - the directory containing the index that the search engine will use
Returns:
a search engine for this directory
Throws:
SearchEngineException - if there is any error opening the index

getSearchEngine

public static SearchEngine getSearchEngine(java.lang.String indexDir,
                                           java.lang.String engineName)
                                    throws SearchEngineException
Gets a search engine that combines the given configuration management file with the default.

Parameters:
indexDir - the directory where the index is. If this value is null, the value should be specified in the configuration file!
engineName - the configuration name of the search engine that should be instantiated
Returns:
a search engine for the given index directory and configuration file
Throws:
SearchEngineException - if there is an error opening the search engine

getSearchEngine

public static SearchEngine getSearchEngine(java.lang.String indexDir,
                                           java.net.URL configFile)
                                    throws SearchEngineException
Gets a search engine that combines the given configuration management file with the default.

Parameters:
indexDir - the directory where the index is. If this value is null, the value should be specified in the configuration file!
configFile - a URL that points to a configuration file for the engine. This value may be null.
Returns:
a search engine for the given index directory and configuration file
Throws:
SearchEngineException - if there is an error opening the search engine

getSearchEngine

public static SearchEngine getSearchEngine(java.lang.String indexDir,
                                           java.lang.String engineName,
                                           java.net.URL configFile)
                                    throws SearchEngineException
Gets a search engine that combines the given configuration management file with the default.

Parameters:
indexDir - the directory where the index is. If this value is null, the value should be specified in the configuration file!
engineName - the configuration name of the search engine that should be instantiated
configFile - a URL that points to a configuration file for the engine. This value may be null.
Returns:
a search engine for the given index directory and configuration file
Throws:
SearchEngineException - if there is an error opening the search engine

getSearchEngine

public static SearchEngine getSearchEngine(com.sun.labs.util.props.ConfigurationManager cm)
                                    throws SearchEngineException
Throws:
SearchEngineException

getDefaultConfiguration

public static com.sun.labs.util.props.ConfigurationManager getDefaultConfiguration(java.lang.String indexDir)
                                                                            throws SearchEngineException
Gets the default configuration for an index in the given directory.

Parameters:
indexDir - the index directory containing the config
Returns:
the configuration manager for that index
Throws:
SearchEngineException - if there is an error getting the configuration

getDefaultConfigFile

public static java.io.File getDefaultConfigFile(java.lang.String indexDir)