com.atlassian.jira.util
Class LuceneDirectoryUtilsImpl

java.lang.Object
  extended by com.atlassian.jira.util.LuceneDirectoryUtilsImpl
All Implemented Interfaces:
LuceneDirectoryUtils

public class LuceneDirectoryUtilsImpl
extends Object
implements LuceneDirectoryUtils

Since:
v5.0

Constructor Summary
LuceneDirectoryUtilsImpl()
           
 
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> getLocks(String path)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneDirectoryUtilsImpl

public LuceneDirectoryUtilsImpl()
Method Detail

getDirectory

public org.apache.lucene.store.Directory getDirectory(File path)
Description copied from interface: LuceneDirectoryUtils
Creates an index directory for the given path on the filesystem.

Specified by:
getDirectory in interface LuceneDirectoryUtils
Parameters:
path - to the index directory.
Returns:
an implementation of Directory

createDirRobust

public void createDirRobust(String path)
                     throws IOException
Description copied from interface: LuceneDirectoryUtils
Creates a directory (robustly) or throws appropriate Exception

Specified by:
createDirRobust in interface LuceneDirectoryUtils
Parameters:
path - Lucene index directory path
Throws:
IOException - if cannot create directory, write to the directory, or not a directory

getStaleLockPaths

public Collection<String> getStaleLockPaths(Collection<String> indexDirectoryPaths)
Description copied from interface: LuceneDirectoryUtils
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());
 

Specified by:
getStaleLockPaths in interface LuceneDirectoryUtils
Parameters:
indexDirectoryPaths - collection of index directory paths
Returns:
collection of file paths of any existing Lucene lock files

getLocks

public Collection<String> getLocks(String path)
                            throws IOException
Throws:
IOException


Copyright © 2002-2012 Atlassian. All Rights Reserved.