org.activemath.omdocjdom.lucene
Class LuceneBuilder

java.lang.Object
  extended by org.activemath.omdocjdom.lucene.LuceneBuilder

public class LuceneBuilder
extends Object

This class provides the functionality to build a lucene base MBase database. It loads all the omdoc element one time in the memory then resolve the references. If the database is updated then it also resolve references from database.

Version:
created August 18, 2003 date

Constructor Summary
LuceneBuilder(Subconfiguration config)
           Properties that can be set are the following (note that the ActiveMath manager uses the prefix OmdocJdomMbase dbpath = path The path where lucene database exist.
 
Method Summary
 org.apache.lucene.document.Document buildIndexDocuments(OJElement elt)
           
 void createDatabase()
          This method create indexes in the lucene database.
 Collection generateImportIDs(String col, String fileName)
          This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements
 String generateImports(String col, String fileName)
          This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements
static void main(String[] args)
          Main launcher, see LuceneMBaseXmlRpcServer.main(String[]).
static Properties makeDefaultProperties()
          Description of the Method
 void reload(List errorAccumulator, String fileName)
          This method update only those documents which are modified by user.
 void setSearchIndex(AMIndex index)
           
 void updateDatabase(String col)
          This method load omdoc documents from file system then add imports statement in source documents for each target element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneBuilder

public LuceneBuilder(Subconfiguration config)
              throws Exception

Properties that can be set are the following (note that the ActiveMath manager uses the prefix OmdocJdomMbase

Parameters:
config - a Subconfiguration value
Throws:
MBaseException - if an error occurs
Exception
Method Detail

setSearchIndex

public void setSearchIndex(AMIndex index)

makeDefaultProperties

public static Properties makeDefaultProperties()
Description of the Method

Returns:
Description of the Return Value

createDatabase

public void createDatabase()
                    throws Exception
This method create indexes in the lucene database. It always create new database and overwrite old one. It loads all documents from all collections.

Throws:
Exception - Description of the Exception
MBaseException - if it can not succesfully add doucments in the database

generateImports

public String generateImports(String col,
                              String fileName)
                       throws Exception
This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements

Parameters:
col - a String value. The name of the collection.
fileName - It is a absoulte path of the omdoc fileName
Returns:
It returns a string of all imports statements
Throws:
Exception - Description of the Exception

generateImportIDs

public Collection generateImportIDs(String col,
                                    String fileName)
                             throws Exception
This method makes omdoc documents compatible with the databse It resolve all references and add necessary imports statements

Parameters:
col - a String value. The name of the collection.
fileName - It is a absoulte path of the omdoc fileName
Returns:
Collection returns a Collection of MBaseID
Throws:
Exception - Description of the Exception

updateDatabase

public void updateDatabase(String col)
                    throws Exception
This method load omdoc documents from file system then add imports statement in source documents for each target element.

Parameters:
col - Description of the Parameter
Throws:
Exception - Description of the Exception

reload

public void reload(List errorAccumulator,
                   String fileName)
            throws Exception
This method update only those documents which are modified by user.

Parameters:
errorAccumulator - a java.util.List value
Throws:
Exception - Description of the Exception

main

public static void main(String[] args)
                 throws Exception
Main launcher, see LuceneMBaseXmlRpcServer.main(String[]).

Parameters:
args -
Throws:
Exception - Description of the Exception

buildIndexDocuments

public org.apache.lucene.document.Document buildIndexDocuments(OJElement elt)
                                                        throws IOException
Throws:
IOException