fedora.server.resourceIndex
Class ResourceIndexModule

java.lang.Object
  extended by fedora.server.Parameterized
      extended by fedora.server.Pluggable
          extended by fedora.server.Module
              extended by fedora.server.resourceIndex.ResourceIndexModule
All Implemented Interfaces:
Constants, ResourceIndex, org.trippi.TriplestoreReader, org.trippi.TriplestoreWriter

public class ResourceIndexModule
extends Module
implements ResourceIndex

Fedora's ResourceIndex as a configurable module.

Author:
cwilper@cs.cornell.edu

Nested Class Summary
 
Nested classes/interfaces inherited from interface fedora.common.Constants
Constants.FedoraHome
 
Field Summary
 
Fields inherited from interface fedora.server.resourceIndex.ResourceIndex
INDEX_LEVEL_OFF, INDEX_LEVEL_ON, INDEX_LEVEL_PERMUTATIONS
 
Fields inherited from interface fedora.common.Constants
ACTION, BDEF, BMECH, DATASTREAM, DC, DISSEMINATOR, ENVIRONMENT, FEDORA, FEDORA_HOME, FEDORA_SYSTEM_DEF_PID, FEDORA_SYSTEM_DEF_URI, HTTP_REQUEST, MODEL, OBJECT, RDF, RECOVERY, RELS_EXT, RESOURCE, SUBJECT, TUCANA, VIEW, XSD
 
Constructor Summary
ResourceIndexModule(java.util.Map parameters, Server server, java.lang.String role)
          Instantiate the module.
 
Method Summary
 void add(java.util.List triples, boolean flush)
          
 void add(org.jrdf.graph.Triple triple, boolean flush)
          
 void add(org.trippi.TripleIterator triples, boolean flush)
          
 void addBDefObject(BDefReader reader)
          Adds a behavior definition object.
 void addBMechObject(BMechReader reader)
          Adds a behavior mechanism object.
 void addDataObject(DOReader reader)
          Adds a data object.
 void close()
          
 int countTriples(java.lang.String queryLang, java.lang.String tripleQuery, int limit, boolean distinct)
          
 int countTriples(java.lang.String queryLang, java.lang.String tupleQuery, java.lang.String tripleTemplate, int limit, boolean distinct)
          
 int countTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          
 int countTuples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          
 void delete(java.util.List triples, boolean flush)
          
 void delete(org.jrdf.graph.Triple triple, boolean flush)
          
 void delete(org.trippi.TripleIterator triples, boolean flush)
          
 void deleteBDefObject(BDefReader oldReader)
          Deletes a behavior definition object.
 void deleteBMechObject(BMechReader oldReader)
          Deletes a behavior definition object.
 void deleteDataObject(DOReader oldReader)
          Deletes a behavior definition object.
 void export(java.io.OutputStream out, org.trippi.RDFFormat format)
          Exports all triples in the RI.
 java.util.List findBufferedUpdates(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int updateType)
          
 org.trippi.TripleIterator findTriples(java.lang.String queryLang, java.lang.String tripleQuery, int limit, boolean distinct)
          
 org.trippi.TripleIterator findTriples(java.lang.String queryLang, java.lang.String tupleQuery, java.lang.String tripleTemplate, int limit, boolean distinct)
          
 org.trippi.TripleIterator findTriples(org.jrdf.graph.SubjectNode subject, org.jrdf.graph.PredicateNode predicate, org.jrdf.graph.ObjectNode object, int limit)
          
 org.trippi.TupleIterator findTuples(java.lang.String queryLang, java.lang.String tupleQuery, int limit, boolean distinct)
          
 void flushBuffer()
          
 java.util.Map getAliasMap()
          
 int getBufferSize()
          
 int getIndexLevel()
          Gets the index level of the ResourceIndex.
 java.lang.String[] listTripleLanguages()
          
 java.lang.String[] listTupleLanguages()
          
 void modifyBDefObject(BDefReader oldReader, BDefReader newReader)
          Modifies a behavior definition object.
 void modifyBMechObject(BMechReader oldReader, BMechReader newReader)
          Modifies a behavior mechanism object.
 void modifyDataObject(DOReader oldReader, DOReader newReader)
          Modifies a data object.
 void postInitModule()
          Perform post-initialization of this module.
 void setAliasMap(java.util.Map aliasToPrefix)
          
 void setFlushErrorHandler(org.trippi.FlushErrorHandler h)
          
 void shutdownModule()
          Shutdown the RI module by closing the wrapped ResourceIndex.
 
Methods inherited from class fedora.server.Module
getRole, getServer, initModule
 
Methods inherited from class fedora.server.Pluggable
getHelp, getOptionalParameters, getParameterHelp, getRequiredModuleRoles, getRequiredParameters
 
Methods inherited from class fedora.server.Parameterized
getParameter, getParameter, getParameters, parameterNames, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceIndexModule

public ResourceIndexModule(java.util.Map parameters,
                           Server server,
                           java.lang.String role)
                    throws ModuleInitializationException
Instantiate the module.

Throws:
ModuleInitializationException
Method Detail

postInitModule

public void postInitModule()
                    throws ModuleInitializationException
Perform post-initialization of this module. ResourceIndexModule takes the following parameters:

Overrides:
postInitModule in class Module
Throws:
ModuleInitializationException - If initialization values are invalid or initialization fails for some other reason.

shutdownModule

public void shutdownModule()
                    throws ModuleShutdownException
Shutdown the RI module by closing the wrapped ResourceIndex.

Overrides:
shutdownModule in class Module
Throws:
ModuleShutdownException - if any error occurs while closing.

getIndexLevel

public int getIndexLevel()
Gets the index level of the ResourceIndex.

Specified by:
getIndexLevel in interface ResourceIndex
Returns:
the current index level of the RI, which is either INDEX_LEVEL_OFF, INDEX_LEVEL_ON, or INDEX_LEVEL_PERMUTATIONS.

addBDefObject

public void addBDefObject(BDefReader reader)
                   throws ResourceIndexException
Adds a behavior definition object.

Specified by:
addBDefObject in interface ResourceIndex
Parameters:
reader - the behavior definition to add.
Throws:
ResourceIndexException - if the operation fails for any reason.

addBMechObject

public void addBMechObject(BMechReader reader)
                    throws ResourceIndexException
Adds a behavior mechanism object.

Specified by:
addBMechObject in interface ResourceIndex
Parameters:
reader - the behavior definition to add.
Throws:
ResourceIndexException - if the operation fails for any reason.

addDataObject

public void addDataObject(DOReader reader)
                   throws ResourceIndexException
Adds a data object.

Specified by:
addDataObject in interface ResourceIndex
Parameters:
reader - the data object to add.
Throws:
ResourceIndexException - if the operation fails for any reason.

modifyBDefObject

public void modifyBDefObject(BDefReader oldReader,
                             BDefReader newReader)
                      throws ResourceIndexException
Modifies a behavior definition object.

Specified by:
modifyBDefObject in interface ResourceIndex
Parameters:
oldReader - the original behavior definition.
newReader - the modified behavior definition.
Throws:
ResourceIndexException - if the operation fails for any reason.

modifyBMechObject

public void modifyBMechObject(BMechReader oldReader,
                              BMechReader newReader)
                       throws ResourceIndexException
Modifies a behavior mechanism object.

Specified by:
modifyBMechObject in interface ResourceIndex
Parameters:
oldReader - the original behavior mechanism.
newReader - the modified behavior mechanism.
Throws:
ResourceIndexException - if the operation fails for any reason.

modifyDataObject

public void modifyDataObject(DOReader oldReader,
                             DOReader newReader)
                      throws ResourceIndexException
Modifies a data object.

Specified by:
modifyDataObject in interface ResourceIndex
Parameters:
oldReader - the original data object.
newReader - the modified data object.
Throws:
ResourceIndexException - if the operation fails for any reason.

deleteBDefObject

public void deleteBDefObject(BDefReader oldReader)
                      throws ResourceIndexException
Deletes a behavior definition object.

Specified by:
deleteBDefObject in interface ResourceIndex
Parameters:
oldReader - the original behavior definition.
Throws:
ResourceIndexException

deleteBMechObject

public void deleteBMechObject(BMechReader oldReader)
                       throws ResourceIndexException
Deletes a behavior definition object.

Specified by:
deleteBMechObject in interface ResourceIndex
Parameters:
oldReader - the original behavior mechanism.
Throws:
ResourceIndexException

deleteDataObject

public void deleteDataObject(DOReader oldReader)
                      throws ResourceIndexException
Deletes a behavior definition object.

Specified by:
deleteDataObject in interface ResourceIndex
Parameters:
oldReader - the original data object.
Throws:
ResourceIndexException

export

public void export(java.io.OutputStream out,
                   org.trippi.RDFFormat format)
            throws ResourceIndexException
Exports all triples in the RI.

Specified by:
export in interface ResourceIndex
Parameters:
out - the output stream to which the RDF should be written. The caller is responsible for eventually closing this stream.
format - the output format (RDF_XML, TURTLE, N_TRIPLESs, etc).
Throws:
ResourceIndexException - if triples in the RI cannot be serialized for any reason.

setAliasMap

public void setAliasMap(java.util.Map aliasToPrefix)
                 throws org.trippi.TrippiException

Specified by:
setAliasMap in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

getAliasMap

public java.util.Map getAliasMap()
                          throws org.trippi.TrippiException

Specified by:
getAliasMap in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTuples

public org.trippi.TupleIterator findTuples(java.lang.String queryLang,
                                           java.lang.String tupleQuery,
                                           int limit,
                                           boolean distinct)
                                    throws org.trippi.TrippiException

Specified by:
findTuples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTuples

public int countTuples(java.lang.String queryLang,
                       java.lang.String tupleQuery,
                       int limit,
                       boolean distinct)
                throws org.trippi.TrippiException

Specified by:
countTuples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(java.lang.String queryLang,
                                             java.lang.String tripleQuery,
                                             int limit,
                                             boolean distinct)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(java.lang.String queryLang,
                        java.lang.String tripleQuery,
                        int limit,
                        boolean distinct)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(org.jrdf.graph.SubjectNode subject,
                                             org.jrdf.graph.PredicateNode predicate,
                                             org.jrdf.graph.ObjectNode object,
                                             int limit)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(org.jrdf.graph.SubjectNode subject,
                        org.jrdf.graph.PredicateNode predicate,
                        org.jrdf.graph.ObjectNode object,
                        int limit)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

findTriples

public org.trippi.TripleIterator findTriples(java.lang.String queryLang,
                                             java.lang.String tupleQuery,
                                             java.lang.String tripleTemplate,
                                             int limit,
                                             boolean distinct)
                                      throws org.trippi.TrippiException

Specified by:
findTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

countTriples

public int countTriples(java.lang.String queryLang,
                        java.lang.String tupleQuery,
                        java.lang.String tripleTemplate,
                        int limit,
                        boolean distinct)
                 throws org.trippi.TrippiException

Specified by:
countTriples in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

listTupleLanguages

public java.lang.String[] listTupleLanguages()

Specified by:
listTupleLanguages in interface org.trippi.TriplestoreReader

listTripleLanguages

public java.lang.String[] listTripleLanguages()

Specified by:
listTripleLanguages in interface org.trippi.TriplestoreReader

close

public void close()
           throws org.trippi.TrippiException

Specified by:
close in interface org.trippi.TriplestoreReader
Throws:
org.trippi.TrippiException

add

public void add(java.util.List triples,
                boolean flush)
         throws java.io.IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

add

public void add(org.trippi.TripleIterator triples,
                boolean flush)
         throws java.io.IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

add

public void add(org.jrdf.graph.Triple triple,
                boolean flush)
         throws java.io.IOException,
                org.trippi.TrippiException

Specified by:
add in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

delete

public void delete(java.util.List triples,
                   boolean flush)
            throws java.io.IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

delete

public void delete(org.trippi.TripleIterator triples,
                   boolean flush)
            throws java.io.IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

delete

public void delete(org.jrdf.graph.Triple triple,
                   boolean flush)
            throws java.io.IOException,
                   org.trippi.TrippiException

Specified by:
delete in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException,
                        org.trippi.TrippiException

Specified by:
flushBuffer in interface org.trippi.TriplestoreWriter
Throws:
java.io.IOException
org.trippi.TrippiException

setFlushErrorHandler

public void setFlushErrorHandler(org.trippi.FlushErrorHandler h)

Specified by:
setFlushErrorHandler in interface org.trippi.TriplestoreWriter

getBufferSize

public int getBufferSize()

Specified by:
getBufferSize in interface org.trippi.TriplestoreWriter

findBufferedUpdates

public java.util.List findBufferedUpdates(org.jrdf.graph.SubjectNode subject,
                                          org.jrdf.graph.PredicateNode predicate,
                                          org.jrdf.graph.ObjectNode object,
                                          int updateType)

Specified by:
findBufferedUpdates in interface org.trippi.TriplestoreWriter