uk.org.ogsadai.activity.indexedfiles
Class AddAndIndexFileActivityConfiguration

java.lang.Object
  |
  +--uk.org.ogsadai.activity.indexedfiles.AddAndIndexFileActivityConfiguration
All Implemented Interfaces:
ActivityConfiguration

public class AddAndIndexFileActivityConfiguration
extends java.lang.Object
implements ActivityConfiguration

This class processes a configuration document for the AddAndIndexFileActivity.

The configuration document has the following format:

Element configuration - root element which contains one or more of the following: For example:
 <configuration>
   <fileIndexer implementation="uk.org.ogsadai.activity.indexedfiles.SwissProtIndexWriter"
                filetype="SwissProt"
                analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer" />
   <fileIndexer implementation="uk.org.ogsadai.activity.indexedfiles.OMIMIndexWriter"
                filetype="OMIM"
                analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer" />
 </configuration>
 

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static DAILogger LOG
          Logger object for logging in this class
private  java.util.Map mAnalyzers
          Map from file types to file analyzer class names
private  java.util.Map mIndexers
          Map from file types to file indexer class names
private  java.lang.String mName
          Activity name
 
Constructor Summary
AddAndIndexFileActivityConfiguration(java.lang.String name)
          Constructor.
 
Method Summary
 java.lang.String getAnalyzer(java.lang.String filetype)
          Returns the analyzer that is associated with this file type.
private  java.lang.String getAttribute(java.lang.String name, org.w3c.dom.Element element)
          Gets the attribute of an element.
 java.lang.String getIndexHelperClass(java.lang.String filetype)
          Returns the class name of the helper class used for indexing this file type.
 void initialise(org.w3c.dom.Document document)
          Parses the configuration document, initialising any fields that are necessary for the accessor methods to operate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

LOG

private static final DAILogger LOG
Logger object for logging in this class


mIndexers

private java.util.Map mIndexers
Map from file types to file indexer class names


mAnalyzers

private java.util.Map mAnalyzers
Map from file types to file analyzer class names


mName

private java.lang.String mName
Activity name

Constructor Detail

AddAndIndexFileActivityConfiguration

public AddAndIndexFileActivityConfiguration(java.lang.String name)
Constructor.

Parameters:
name - Activity name
Method Detail

initialise

public void initialise(org.w3c.dom.Document document)
                throws ActivityConfigurationException
Description copied from interface: ActivityConfiguration
Parses the configuration document, initialising any fields that are necessary for the accessor methods to operate. This method is called by the ActivityCreator class.

Specified by:
initialise in interface ActivityConfiguration
Parameters:
document - The Document containing the activity configuration information.
Throws:
ActivityConfigurationException - If there is a problem initialising the ActivityConfiguration object. This may be caused by the document containing invalid information, or perhaps by a system problem within the initialisation code.

getAnalyzer

public java.lang.String getAnalyzer(java.lang.String filetype)
Returns the analyzer that is associated with this file type.

Parameters:
filetype - A string that identifies the flat file type (case insensitive).
Returns:
the class name of the analyzer that will be used for indexing.

getIndexHelperClass

public java.lang.String getIndexHelperClass(java.lang.String filetype)
Returns the class name of the helper class used for indexing this file type.

Parameters:
filetype - A string that identifies the flat file type (case insensitive)
Returns:
the class name of indexing strategy that will be used for indexing.

getAttribute

private java.lang.String getAttribute(java.lang.String name,
                                      org.w3c.dom.Element element)
                               throws ActivityConfigurationException
Gets the attribute of an element.

Parameters:
name - Name of the attribute
element - An lement containing the attribute
Returns:
the value of the attribute
Throws:
ActivityConfigurationException - If the attribute does not exist or is empty