org.aspectj.org.eclipse.jdt.internal.core.search.indexing
Class IndexManager

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
      extended by org.aspectj.org.eclipse.jdt.internal.core.search.indexing.IndexManager
All Implemented Interfaces:
java.lang.Runnable, IIndexConstants

public class IndexManager
extends JobManager
implements IIndexConstants


Field Summary
static boolean DEBUG
           
 SimpleLookupTable indexLocations
           
static java.lang.Integer REBUILDING_STATE
           
static java.lang.Integer SAVED_STATE
           
static java.lang.Integer UNKNOWN_STATE
           
static java.lang.Integer UPDATING_STATE
           
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
activated, awaitingJobs, executing, jobEnd, jobStart, processingThread, progressJob, VERBOSE
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.core.search.indexing.IIndexConstants
AND_PATTERN, ANNOT_REF_PATTERN, ANNOTATION_REF, ANNOTATION_TYPE_SUFFIX, CLASS_AND_ENUM_SUFFIX, CLASS_AND_INTERFACE_SUFFIX, CLASS_SUFFIX, CONSTRUCTOR_DECL, CONSTRUCTOR_PATTERN, CONSTRUCTOR_REF, COUNTS, DEFAULT_CONSTRUCTOR, ENUM_SUFFIX, FIELD_DECL, FIELD_PATTERN, INTERFACE_AND_ANNOTATION_SUFFIX, INTERFACE_SUFFIX, LOCAL_VAR_PATTERN, METHOD_DECL, METHOD_PATTERN, METHOD_REF, OBJECT, ONE_STAR, ONE_STAR_CHAR, ONE_ZERO, ONE_ZERO_CHAR, OR_PATTERN, PARAMETER_SEPARATOR, PKG_DECL_PATTERN, PKG_REF_PATTERN, REF, SECONDARY_SUFFIX, SEPARATOR, SUPER_REF, SUPER_REF_PATTERN, TYPE_DECL, TYPE_DECL_PATTERN, TYPE_PARAM_PATTERN, TYPE_REF_PATTERN, TYPE_SUFFIX, ZERO_CHAR
 
Constructor Summary
IndexManager()
           
 
Method Summary
 void aboutToUpdateIndex(IPath containerPath, java.lang.Integer newIndexState)
           
 void addBinary(IFile resource, IPath containerPath)
          Trigger addition of a resource to an index Note: the actual operation is performed in background
 void addSource(IFile resource, IPath containerPath, SourceElementParser parser)
          Trigger addition of a resource to an index Note: the actual operation is performed in background
 void cleanUpIndexes()
           
 IPath computeIndexLocation(IPath containerPath)
           
 void deleteIndexFiles()
           
 void ensureIndexExists(IPath indexLocation, IPath containerPath)
           
 Index getIndex(IPath indexLocation)
          Returns the index for a given index location
 Index getIndex(IPath containerPath, boolean reuseExistingFile, boolean createIfMissing)
          Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)
 Index getIndex(IPath containerPath, IPath indexLocation, boolean reuseExistingFile, boolean createIfMissing)
          Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)
 Index[] getIndexes(IPath[] locations, IProgressMonitor progressMonitor)
          Returns all the existing indexes for a list of index locations.
 Index getIndexForUpdate(IPath containerPath, boolean reuseExistingFile, boolean createIfMissing)
           
 SourceElementParser getSourceElementParser(IJavaProject project, ISourceElementRequestor requestor)
           
 void indexAll(IProject project)
          Trigger addition of the entire content of a project Note: the actual operation is performed in background
 void indexDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, IPath indexLocation)
           
 void indexLibrary(IPath path, IProject requestingProject)
          Trigger addition of a library to an index Note: the actual operation is performed in background
 void indexSourceFolder(JavaProject javaProject, IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns)
          Index the content of the given source folder.
 void jobWasCancelled(IPath containerPath)
           
protected  void moveToNextJob()
          Advance to the next available job, once the current one has been completed.
protected  void notifyIdle(long idlingTime)
          No more job awaiting.
 java.lang.String processName()
          Name of the background process
 Index recreateIndex(IPath containerPath)
          Recreates the index for a given path, keeping the same read-write monitor.
 void remove(java.lang.String containerRelativePath, IPath indexedContainer)
          Trigger removal of a resource to an index Note: the actual operation is performed in background
 void removeIndex(IPath containerPath)
          Removes the index for a given path.
 void removeIndexFamily(IPath path)
          Removes all indexes whose paths start with (or are equal to) the given path.
 void removeIndexPath(IPath path)
          Removes all indexes whose paths start with (or are equal to) the given path.
 void removeSourceFolderFromIndex(JavaProject javaProject, IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns)
          Remove the content of the given source folder from the index.
 void reset()
          Flush current state
 boolean resetIndex(IPath containerPath)
          Resets the index for a given path.
 void saveIndex(Index index)
           
 void saveIndexes()
          Commit all index memory changes to disk
 void scheduleDocumentIndexing(SearchDocument searchDocument, IPath container, IPath indexLocation, SearchParticipant searchParticipant)
           
 java.lang.String toString()
           
 void updateParticipant(IPath indexLocation, IPath containerPath)
           
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
activateProcessing, awaitingJobsCount, currentJob, disable, discardJobs, enable, isJobWaiting, performConcurrentJob, request, run, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

indexLocations

public SimpleLookupTable indexLocations

SAVED_STATE

public static final java.lang.Integer SAVED_STATE

UPDATING_STATE

public static final java.lang.Integer UPDATING_STATE

UNKNOWN_STATE

public static final java.lang.Integer UNKNOWN_STATE

REBUILDING_STATE

public static final java.lang.Integer REBUILDING_STATE

DEBUG

public static boolean DEBUG
Constructor Detail

IndexManager

public IndexManager()
Method Detail

aboutToUpdateIndex

public void aboutToUpdateIndex(IPath containerPath,
                               java.lang.Integer newIndexState)

addBinary

public void addBinary(IFile resource,
                      IPath containerPath)
Trigger addition of a resource to an index Note: the actual operation is performed in background


addSource

public void addSource(IFile resource,
                      IPath containerPath,
                      SourceElementParser parser)
Trigger addition of a resource to an index Note: the actual operation is performed in background


cleanUpIndexes

public void cleanUpIndexes()

computeIndexLocation

public IPath computeIndexLocation(IPath containerPath)

deleteIndexFiles

public void deleteIndexFiles()

ensureIndexExists

public void ensureIndexExists(IPath indexLocation,
                              IPath containerPath)

getSourceElementParser

public SourceElementParser getSourceElementParser(IJavaProject project,
                                                  ISourceElementRequestor requestor)

getIndex

public Index getIndex(IPath indexLocation)
Returns the index for a given index location

Parameters:
indexLocation - The path of the index file
Returns:
The corresponding index or null if not found

getIndex

public Index getIndex(IPath containerPath,
                      boolean reuseExistingFile,
                      boolean createIfMissing)
Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)


getIndex

public Index getIndex(IPath containerPath,
                      IPath indexLocation,
                      boolean reuseExistingFile,
                      boolean createIfMissing)
Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)


getIndexes

public Index[] getIndexes(IPath[] locations,
                          IProgressMonitor progressMonitor)
Returns all the existing indexes for a list of index locations. Note that this may trigger some indexes recreation work

Parameters:
locations - The list of of the index files path
Returns:
The corresponding indexes list.

getIndexForUpdate

public Index getIndexForUpdate(IPath containerPath,
                               boolean reuseExistingFile,
                               boolean createIfMissing)

indexDocument

public void indexDocument(SearchDocument searchDocument,
                          SearchParticipant searchParticipant,
                          Index index,
                          IPath indexLocation)

indexAll

public void indexAll(IProject project)
Trigger addition of the entire content of a project Note: the actual operation is performed in background


indexLibrary

public void indexLibrary(IPath path,
                         IProject requestingProject)
Trigger addition of a library to an index Note: the actual operation is performed in background


indexSourceFolder

public void indexSourceFolder(JavaProject javaProject,
                              IPath sourceFolder,
                              char[][] inclusionPatterns,
                              char[][] exclusionPatterns)
Index the content of the given source folder.


jobWasCancelled

public void jobWasCancelled(IPath containerPath)

moveToNextJob

protected void moveToNextJob()
Advance to the next available job, once the current one has been completed. Note: clients awaiting until the job count is zero are still waiting at this point.

Overrides:
moveToNextJob in class JobManager

notifyIdle

protected void notifyIdle(long idlingTime)
No more job awaiting.

Overrides:
notifyIdle in class JobManager

processName

public java.lang.String processName()
Name of the background process

Specified by:
processName in class JobManager

recreateIndex

public Index recreateIndex(IPath containerPath)
Recreates the index for a given path, keeping the same read-write monitor. Returns the new empty index or null if it didn't exist before. Warning: Does not check whether index is consistent (not being used)


remove

public void remove(java.lang.String containerRelativePath,
                   IPath indexedContainer)
Trigger removal of a resource to an index Note: the actual operation is performed in background


removeIndex

public void removeIndex(IPath containerPath)
Removes the index for a given path. This is a no-op if the index did not exist.


removeIndexPath

public void removeIndexPath(IPath path)
Removes all indexes whose paths start with (or are equal to) the given path.


removeIndexFamily

public void removeIndexFamily(IPath path)
Removes all indexes whose paths start with (or are equal to) the given path.


removeSourceFolderFromIndex

public void removeSourceFolderFromIndex(JavaProject javaProject,
                                        IPath sourceFolder,
                                        char[][] inclusionPatterns,
                                        char[][] exclusionPatterns)
Remove the content of the given source folder from the index.


reset

public void reset()
Flush current state

Overrides:
reset in class JobManager

resetIndex

public boolean resetIndex(IPath containerPath)
Resets the index for a given path. Returns true if the index was reset, false otherwise.


saveIndex

public void saveIndex(Index index)
               throws java.io.IOException
Throws:
java.io.IOException

saveIndexes

public void saveIndexes()
Commit all index memory changes to disk


scheduleDocumentIndexing

public void scheduleDocumentIndexing(SearchDocument searchDocument,
                                     IPath container,
                                     IPath indexLocation,
                                     SearchParticipant searchParticipant)

toString

public java.lang.String toString()
Overrides:
toString in class JobManager

updateParticipant

public void updateParticipant(IPath indexLocation,
                              IPath containerPath)