org.gcube.dir.master.index
Class JDBCManager

java.lang.Object
  extended by org.gcube.dir.master.index.JDBCManager
All Implemented Interfaces:
IndexManager<DefaultTerm,DefaultTermStats>

public class JDBCManager
extends java.lang.Object
implements IndexManager<DefaultTerm,DefaultTermStats>

A specialisation of to DefaultTerm and DefaultTermStats of an IndexManager based on a JDBC-compliant database implementations of an inverted index.

Author:
Fabio Simeoni (University of Strathclyde)

Constructor Summary
JDBCManager()
          Creates an uninitialised instance.
 
Method Summary
 void addTerm(java.lang.String collectionID, DefaultTerm term)
          Adds a term from a collection into the index.
 void createIndex(IndexCreationParameters params)
          Creates the index.
 void deleteIndex()
          Deletes the index.
 java.util.Map<java.lang.String,DefaultTermStats> getPostings(java.lang.String termName, java.util.Collection<java.lang.String> collectionIDs)
          Retrieves all statistics of a term wich occurs in one or more collections.
 java.util.List<DefaultTerm> getTerms(java.lang.String collectionID)
          Retrieves all the terms in a given collection from the index.
 void removeTerms(java.lang.String collectionID)
          Removes all terms in a given collection from the index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCManager

public JDBCManager()
            throws java.lang.Exception
Creates an uninitialised instance. Available for reflective instantiation.

Throws:
java.lang.Exception
Method Detail

createIndex

public void createIndex(IndexCreationParameters params)
                 throws java.lang.Exception
Creates the index.

Specified by:
createIndex in interface IndexManager<DefaultTerm,DefaultTermStats>
Parameters:
params - the creation parameters.
Throws:
java.lang.Exception - if the index could not be created.

addTerm

public void addTerm(java.lang.String collectionID,
                    DefaultTerm term)
             throws java.lang.Exception
Adds a term from a collection into the index.

Specified by:
addTerm in interface IndexManager<DefaultTerm,DefaultTermStats>
Parameters:
collectionID - the collection identifier.
term - the terms.
Throws:
java.lang.Exception - if the term could not be added.

getTerms

public java.util.List<DefaultTerm> getTerms(java.lang.String collectionID)
                                     throws java.lang.Exception
Retrieves all the terms in a given collection from the index.

Specified by:
getTerms in interface IndexManager<DefaultTerm,DefaultTermStats>
Returns:
the terms.
Throws:
java.lang.Exception - if the terms could not be retrieved.

removeTerms

public void removeTerms(java.lang.String collectionID)
                 throws java.lang.Exception
Removes all terms in a given collection from the index.

Specified by:
removeTerms in interface IndexManager<DefaultTerm,DefaultTermStats>
Throws:
java.lang.Exception - if the terms could not be removed.

getPostings

public java.util.Map<java.lang.String,DefaultTermStats> getPostings(java.lang.String termName,
                                                                    java.util.Collection<java.lang.String> collectionIDs)
                                                             throws java.lang.Exception
Retrieves all statistics of a term wich occurs in one or more collections. * @param collectionIDs the collection identifiers.

Specified by:
getPostings in interface IndexManager<DefaultTerm,DefaultTermStats>
Returns:
the statistics, indexed by collection identifier.
Throws:
java.lang.Exception - if the statistics could not be retrieved.

deleteIndex

public void deleteIndex()
                 throws java.lang.Exception
Deletes the index.

Specified by:
deleteIndex in interface IndexManager<DefaultTerm,DefaultTermStats>
Throws:
java.lang.Exception - if the index could not be deleted.