Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.search.lucene
Class LuceneConfigurations.PoolingDirectoryFactory<DirectoryType extends org.apache.lucene.store.Directory>

    java.lang.Object
      org.modeshape.search.lucene.LuceneConfigurations.PoolingDirectoryFactory<DirectoryType>

Type Parameters:
  `DirectoryType` - the concrete type of the directory

All Implemented Interfaces:
  LuceneConfiguration

Direct Known Subclasses:
  LuceneConfigurations.FileSystemDirectoryFromNameFactory, LuceneConfigurations.RamDirectoryFactory

Enclosing class:
  LuceneConfigurations

    @ThreadSafe
    protected abstract static class LuceneConfigurations.PoolingDirectoryFactory<DirectoryType extends org.apache.lucene.store.Directory>

extends Object
implements LuceneConfiguration

A `LuceneConfiguration` implementation that creates `Directory` instances of the supplied type for each workspace and pools the results, ensuring that the same `Directory` instance is always returned for the same workspace name.

Constructor Summary
`protected` | `LuceneConfigurations.PoolingDirectoryFactory()`

Method Summary
`protected abstract DirectoryType` | `createDirectory(String workspaceName, String indexName)` Method implemented by subclasses to create a new Directory implementation.
`boolean` | `destroyDirectory(String workspaceName, String indexName)` Destroy the `Directory` that is used for the workspace with the supplied name.
`protected abstract boolean` | `doDestroy(DirectoryType directory)`
`org.apache.lucene.store.Directory` | `getDirectory(String workspaceName, String indexName)` Get the `Directory` that should be used for the workspace with the supplied name.
`boolean` | `hasExistingIndex(String workspaceName, String indexName)` Return whether the index with the given name already exists for the given workspace name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.modeshape.search.lucene.LuceneConfiguration
`getVersion`

Constructor Detail

### LuceneConfigurations.PoolingDirectoryFactory

    protected LuceneConfigurations.PoolingDirectoryFactory()

Method Detail

### getDirectory

    public org.apache.lucene.store.Directory getDirectory(String workspaceName,
                                                          String indexName)
                                                   throws SearchEngineException

  Get the `Directory` that should be used for the workspace with the supplied name.

  Specified by:
    `getDirectory` in interface `LuceneConfiguration`
  Parameters:
    `workspaceName` - the workspace name
    `indexName` - the name of the index to be created
  Returns:
    the directory; never null
  Throws:
    `SearchEngineException` - if there is a problem creating the directory
  See Also:
    `LuceneConfiguration.getDirectory(java.lang.String, java.lang.String)`

### destroyDirectory

    public boolean destroyDirectory(String workspaceName,
                                    String indexName)
                             throws SearchEngineException

  Destroy the `Directory` that is used for the workspace with the supplied name.

  Specified by:
    `destroyDirectory` in interface `LuceneConfiguration`
  Parameters:
    `workspaceName` - the workspace name
    `indexName` - the name of the index to be created
  Returns:
    true if the directory existed and was destroyed, or false if the directory didn't exist
  Throws:
    `SearchEngineException` - if there is a problem creating the directory
  See Also:
    `LuceneConfiguration.destroyDirectory(java.lang.String, java.lang.String)`

### createDirectory

    protected abstract DirectoryType createDirectory(String workspaceName,
                                                     String indexName)
                                                                                        throws SearchEngineException

  Method implemented by subclasses to create a new Directory implementation.

  Parameters:
    `workspaceName` - the name of the workspace for which the `Directory` is to be created; never null
    `indexName` - the name of the index to be created
  Returns:
    the new directory; may not be null
  Throws:
    `SearchEngineException` - if there is a problem creating the directory

### doDestroy

    protected abstract boolean doDestroy(DirectoryType directory)
                                  throws SearchEngineException

  Throws:
    `SearchEngineException`

### hasExistingIndex

    public boolean hasExistingIndex(String workspaceName,
                                    String indexName)
                             throws SearchEngineException

  Description copied from interface: `LuceneConfiguration`
  Return whether the index with the given name already exists for the given workspace name.

  Specified by:
    `hasExistingIndex` in interface `LuceneConfiguration`
  Parameters:
    `workspaceName` - the workspace name
    `indexName` - the name of the index to be created
  Returns:
    true if the directory and any related files exist, or false if the directory or index files do not exist
  Throws:
    `SearchEngineException` - if there is a problem creating the directory

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.