org.openanzo.server.repository.indexer
Class IndexQueryApi

java.lang.Object
  extended by org.openanzo.server.repository.indexer.IndexQueryApi
All Implemented Interfaces:
IndexQueryApiMBean, IServerService, IServerServiceMBean, UpdateResultListener

public class IndexQueryApi
extends java.lang.Object
implements IServerService, IndexQueryApiMBean, UpdateResultListener

A wrapper for most index-related operations. The functionality for searching an index is contained here. The indexUpdateHandler member handles modification of the index.

Author:
Wing Yung (wingyung@us.ibm.com)

Constructor Summary
IndexQueryApi(ModelServiceApi modelServiceApi, java.util.Properties properties)
           
 
Method Summary
 void close()
          Close the service
 boolean getClearIndex()
          Determine if the index should be cleared on startup
 boolean getIndexingEnabled()
          Determine if indexing is enabled
 IndexUpdateHandler getIndexUpdateHandler()
          Get the indexUpdateHandler
 boolean getIsStarted()
          Determine if the service is started
 boolean getRebuildIndex()
          Determine if the index should be rebuilt on startup
 void rebuild(RepositoryConnection connection)
          Rebuilds the index based on what is currently in the store.
 void registerMBean(javax.management.MBeanServer mbs, javax.management.ObjectName parentObjectName)
          Register the service with the server's jmx server
 void reset()
          Resets the index, clearing everything in the index.
 void setClearIndex(boolean clearIndex)
          Set if the index should be cleared on startup
 void setIndexingEnabled(boolean indexingEnabled)
          Set if indexing is enabled
 void setRebuildIndex(boolean rebuildIndex)
          Set if the index should be rebuilt on startup
 void start()
          Start the service
 void stop()
          Stop the service
 void updateComplete(UpdateResults results, RepositoryConnection repositoryConnection)
          Handles the updateComplete event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexQueryApi

public IndexQueryApi(ModelServiceApi modelServiceApi,
                     java.util.Properties properties)
Parameters:
modelServiceApi - Passed down to the IndexUpdateHandler member, which uses it to get a repository connection (for rebuildling).
properties - Contains properties used to set up indexing functions.
Method Detail

start

public void start()
           throws AnzoException
Description copied from interface: IServerService
Start the service

Specified by:
start in interface IServerService
Specified by:
start in interface IServerServiceMBean
Throws:
AnzoException

close

public void close()
           throws AnzoException
Description copied from interface: IServerService
Close the service

Specified by:
close in interface IServerService
Throws:
AnzoException

getIsStarted

public boolean getIsStarted()
Description copied from interface: IServerService
Determine if the service is started

Specified by:
getIsStarted in interface IServerService
Specified by:
getIsStarted in interface IServerServiceMBean
Returns:
true if the service is started

stop

public void stop()
          throws AnzoException
Description copied from interface: IServerService
Stop the service

Specified by:
stop in interface IServerService
Specified by:
stop in interface IServerServiceMBean
Throws:
AnzoException

reset

public void reset()
           throws IndexerException
Resets the index, clearing everything in the index.

Throws:
IndexerException

rebuild

public void rebuild(RepositoryConnection connection)
             throws IndexerException
Rebuilds the index based on what is currently in the store.

Parameters:
connection -
Throws:
IndexerException

getIndexUpdateHandler

public IndexUpdateHandler getIndexUpdateHandler()
Get the indexUpdateHandler

Returns:
the indexUpdateHandler

getIndexingEnabled

public boolean getIndexingEnabled()
Determine if indexing is enabled

Specified by:
getIndexingEnabled in interface IndexQueryApiMBean
Returns:
true if indexing is enabled

setIndexingEnabled

public void setIndexingEnabled(boolean indexingEnabled)
Set if indexing is enabled

Specified by:
setIndexingEnabled in interface IndexQueryApiMBean
Parameters:
indexingEnabled - is indexing enabled

updateComplete

public void updateComplete(UpdateResults results,
                           RepositoryConnection repositoryConnection)
                    throws AnzoException
Description copied from interface: UpdateResultListener
Handles the updateComplete event.

Specified by:
updateComplete in interface UpdateResultListener
Parameters:
results - Final state and other useful details of statements added/updated/removed during a update call.
repositoryConnection - The repository graph the update was run against.
Throws:
AnzoException

registerMBean

public void registerMBean(javax.management.MBeanServer mbs,
                          javax.management.ObjectName parentObjectName)
Description copied from interface: IServerService
Register the service with the server's jmx server

Specified by:
registerMBean in interface IServerService
Parameters:
mbs - the jmx server
parentObjectName - the name under which this object will be registered

getClearIndex

public boolean getClearIndex()
Determine if the index should be cleared on startup

Specified by:
getClearIndex in interface IndexQueryApiMBean
Returns:
true if the index should be cleared on startup

setClearIndex

public void setClearIndex(boolean clearIndex)
Set if the index should be cleared on startup

Specified by:
setClearIndex in interface IndexQueryApiMBean
Parameters:
clearIndex - whether the index should be cleared on startup

getRebuildIndex

public boolean getRebuildIndex()
Determine if the index should be rebuilt on startup

Specified by:
getRebuildIndex in interface IndexQueryApiMBean
Returns:
true if the index should be rebuilt on startup

setRebuildIndex

public void setRebuildIndex(boolean rebuildIndex)
Set if the index should be rebuilt on startup

Specified by:
setRebuildIndex in interface IndexQueryApiMBean
Parameters:
rebuildIndex - whether the index should be rebuilt on startup


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.