com.atlassian.jira.util.index
Class MockIndexLifecycleManager

java.lang.Object
  extended by com.atlassian.jira.util.index.MockIndexLifecycleManager
All Implemented Interfaces:
Sized, IndexLifecycleManager, Shutdown

public class MockIndexLifecycleManager
extends Object
implements IndexLifecycleManager


Constructor Summary
MockIndexLifecycleManager()
           
 
Method Summary
 long activate(Context ctx)
          Activates search indexes.
 void deactivate()
          De-activates indexing (as happens from the admin page) and removes index directories.
 Collection<String> getAllIndexPaths()
           
 boolean isEmpty()
           
 boolean isIndexConsistent()
           
 boolean isIndexingEnabled()
           
 long optimize()
          Optimize the underlying indexes.
 long reIndexAll(Context ctx)
          Reindex everything.
 long reIndexAllIssuesInBackground(Context context)
          Reindex everything, but don't stop the world
 void shutdown()
          Shuts down the indexing manager and closes its resources (if any).
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockIndexLifecycleManager

public MockIndexLifecycleManager()
Method Detail

activate

public long activate(Context ctx)
Description copied from interface: IndexLifecycleManager
Activates search indexes.

Specified by:
activate in interface IndexLifecycleManager
Parameters:
ctx - used to report progress back to the user or to the logs. Must not be null.
Returns:
Reindex time in ms

deactivate

public void deactivate()
Description copied from interface: IndexLifecycleManager
De-activates indexing (as happens from the admin page) and removes index directories.

Specified by:
deactivate in interface IndexLifecycleManager

getAllIndexPaths

public Collection<String> getAllIndexPaths()
Specified by:
getAllIndexPaths in interface IndexLifecycleManager
Returns:
a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.

isIndexingEnabled

public boolean isIndexingEnabled()
Specified by:
isIndexingEnabled in interface IndexLifecycleManager
Returns:
whether this index is enabled or true if all sub indexes are enabled

optimize

public long optimize()
Description copied from interface: IndexLifecycleManager
Optimize the underlying indexes. Make the subsequent searching more efficient.

Specified by:
optimize in interface IndexLifecycleManager
Returns:
the amount of time in millis this method took (because you are too lazy to time me), 0 if indexing is not enabled or -1 if we cannot obtain the index writeLock.

reIndexAll

public long reIndexAll(Context ctx)
Description copied from interface: IndexLifecycleManager
Reindex everything.

Specified by:
reIndexAll in interface IndexLifecycleManager
Parameters:
ctx - used to report progress back to the user or to the logs. Must not be null.
Returns:
Reindex time in ms.

reIndexAllIssuesInBackground

public long reIndexAllIssuesInBackground(Context context)
Description copied from interface: IndexLifecycleManager
Reindex everything, but don't stop the world

Specified by:
reIndexAllIssuesInBackground in interface IndexLifecycleManager
Parameters:
context - used to report progress back to the user or to the logs. Must not be null.
Returns:
Reindex time in ms.

size

public int size()
Specified by:
size in interface Sized
Specified by:
size in interface IndexLifecycleManager
Returns:
how many Entities will be re-indexed by IndexLifecycleManager.reIndexAll(Context)

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Sized

isIndexConsistent

public boolean isIndexConsistent()
Specified by:
isIndexConsistent in interface IndexLifecycleManager
Returns:
the result of a simple consistency check that compares the index state to the current number of issues. A background re-index should not be attempted when this returns false.

shutdown

public void shutdown()
Description copied from interface: IndexLifecycleManager
Shuts down the indexing manager and closes its resources (if any).

Specified by:
shutdown in interface IndexLifecycleManager
Specified by:
shutdown in interface Shutdown


Copyright © 2002-2013 Atlassian. All Rights Reserved.