com.atlassian.jira.util
Interface LuceneDirectoryUtils

All Known Implementing Classes:
LuceneDirectoryUtilsImpl

@InjectableComponent
public interface LuceneDirectoryUtils

Since:
v5.0

Method Summary
 void createDirRobust(String path)
          Creates a directory (robustly) or throws appropriate Exception
 org.apache.lucene.store.Directory getDirectory(File path)
          Creates an index directory for the given path on the filesystem.
 Collection<String> getStaleLockPaths(Collection<String> indexDirectoryPaths)
          Given a Collection of paths that represent index directories checks if there are any existing Lucene lock files for the passed paths.
 

Method Detail

getDirectory

org.apache.lucene.store.Directory getDirectory(File path)
Creates an index directory for the given path on the filesystem.

Parameters:
path - to the index directory.
Returns:
an implementation of Directory
Throws:
IOException - if there is a problem when creating the index directory for the given path.

createDirRobust

void createDirRobust(String path)
                     throws IOException
Creates a directory (robustly) or throws appropriate Exception

Parameters:
path - Lucene index directory path
Throws:
IOException - if cannot create directory, write to the directory, or not a directory

getStaleLockPaths

Collection<String> getStaleLockPaths(Collection<String> indexDirectoryPaths)
Given a Collection of paths that represent index directories checks if there are any existing Lucene lock files for the passed paths. This method returns a Collection of file paths of any existing Lucene lock files. If no lock files are found an empty collection is returned.

A common usage of this methdo would be:

 Collection existingLockFilepaths = LuceneUtils.getStaleLockPaths(indexManager.getAllIndexPaths());
 

Parameters:
indexDirectoryPaths - collection of index directory paths
Returns:
collection of file paths of any existing Lucene lock files


Copyright © 2002-2012 Atlassian. All Rights Reserved.