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.FileSystemDirectoryFromNameFactory

    java.lang.Object
      org.modeshape.search.lucene.LuceneConfigurations.PoolingDirectoryFactory<org.apache.lucene.store.FSDirectory>
          org.modeshape.search.lucene.LuceneConfigurations.FileSystemDirectoryFromNameFactory

All Implemented Interfaces:
  LuceneConfiguration

Enclosing class:
  LuceneConfigurations

    public static class LuceneConfigurations.FileSystemDirectoryFromNameFactory

extends LuceneConfigurations.PoolingDirectoryFactory<org.apache.lucene.store.FSDirectory>

A `LuceneConfiguration` implementation that creates `FSDirectory` instances for each workspace and index name. This factory is created with a parent directory under which all workspace and index directories are created.

This uses the supplied encoders to translate the workspace and index names into valid directory names. By default, no encoding is performed, meaning that the workspace and index names are used explicitly as directory names. This default behavior, then, means that not all values of workspace names or index names will work. If you want to be sure that all workspace names work, supply an encoder for the workspace names. (Index names are currently such that they will always be valid directory names, but you can always supply an encoder if you'd like.)

Constructor Summary
`protected` | `LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent)` Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder.
`protected` | `LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent, org.apache.lucene.store.LockFactory lockFactory)` Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder.
`protected` | `LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent, org.apache.lucene.store.LockFactory lockFactory, TextEncoder workspaceNameEncoder, TextEncoder indexNameEncoder)` Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder.
`protected` | `LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent, TextEncoder workspaceNameEncoder, TextEncoder indexNameEncoder)` Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder.

Method Summary
`protected org.apache.lucene.store.FSDirectory` | `create(File directory, org.apache.lucene.store.LockFactory lockFactory)` Override this method to define which subclass of `FSDirectory` should be created.
`protected org.apache.lucene.store.FSDirectory` | `createDirectory(String workspaceName, String indexName)` Method implemented by subclasses to create a new Directory implementation.
`protected boolean` | `doDestroy(org.apache.lucene.store.FSDirectory directory)`
`org.apache.lucene.util.Version` | `getVersion()` Get the version for the Lucene configuration.
`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 org.modeshape.search.lucene.LuceneConfigurations.PoolingDirectoryFactory
`destroyDirectory, getDirectory`

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

Constructor Detail

### LuceneConfigurations.FileSystemDirectoryFromNameFactory

    protected LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent)

  Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder. Note that this has ramifications on the allowable workspace names.

  Parameters:
    `parent` - the parent folder
  Throws:
    `IllegalArgumentException` - if the parent file is null

### LuceneConfigurations.FileSystemDirectoryFromNameFactory

    protected LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent,
                                                                      org.apache.lucene.store.LockFactory lockFactory)

  Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder. Note that this has ramifications on the allowable workspace names.

  Parameters:
    `parent` - the parent folder
    `lockFactory` - the lock factory; may be null
  Throws:
    `IllegalArgumentException` - if the parent file is null

### LuceneConfigurations.FileSystemDirectoryFromNameFactory

    protected LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent,
                                                                      TextEncoder workspaceNameEncoder,
                                                                      TextEncoder indexNameEncoder)

  Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder. Note that this has ramifications on the allowable workspace names.

  Parameters:
    `parent` - the parent folder
    `workspaceNameEncoder` - the encoder that should be used for encoding the workspace name into a directory name
    `indexNameEncoder` - the encoder that should be used for encoding the index name into a directory name
  Throws:
    `IllegalArgumentException` - if the parent file is null

### LuceneConfigurations.FileSystemDirectoryFromNameFactory

    protected LuceneConfigurations.FileSystemDirectoryFromNameFactory(File parent,
                                                                      org.apache.lucene.store.LockFactory lockFactory,
                                                                      TextEncoder workspaceNameEncoder,
                                                                      TextEncoder indexNameEncoder)

  Create a new `LuceneConfiguration` that creates `FSDirectory` instances mapped to folders under a parent folder, where the workspace name is used to create the workspace folder. Note that this has ramifications on the allowable workspace names.

  Parameters:
    `parent` - the parent folder
    `lockFactory` - the lock factory; may be null
    `workspaceNameEncoder` - the encoder that should be used for encoding the workspace name into a directory name
    `indexNameEncoder` - the encoder that should be used for encoding the index name into a directory name
  Throws:
    `IllegalArgumentException` - if the parent file is null

Method Detail

### getVersion

    public org.apache.lucene.util.Version getVersion()

  Get the version for the Lucene configuration.

  Returns:
    the version
  See Also:
    `LuceneConfiguration.getVersion()`

### createDirectory

    protected org.apache.lucene.store.FSDirectory createDirectory(String workspaceName,
                                                                  String indexName)

  Description copied from class: `LuceneConfigurations.PoolingDirectoryFactory`
  Method implemented by subclasses to create a new Directory implementation.

  Specified by:
    `createDirectory` in class `LuceneConfigurations.PoolingDirectoryFactory<org.apache.lucene.store.FSDirectory>`
  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

### doDestroy

    protected boolean doDestroy(org.apache.lucene.store.FSDirectory directory)
                         throws SearchEngineException

  Specified by:
    `doDestroy` in class `LuceneConfigurations.PoolingDirectoryFactory<org.apache.lucene.store.FSDirectory>`
  Throws:
    `SearchEngineException`
  See Also:
    `LuceneConfigurations.PoolingDirectoryFactory.doDestroy(org.apache.lucene.store.Directory)`

### create

    protected org.apache.lucene.store.FSDirectory create(File directory,
                                                         org.apache.lucene.store.LockFactory lockFactory)
                                                  throws IOException

  Override this method to define which subclass of `FSDirectory` should be created.

  Parameters:
    `directory` - the file system directory; never null
    `lockFactory` - the lock factory; may be null
  Returns:
    the `FSDirectory` instance
  Throws:
    `IOException` - if there is a problem creating the FSDirectory instance

### 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`
  Overrides:
    `hasExistingIndex` in class `LuceneConfigurations.PoolingDirectoryFactory<org.apache.lucene.store.FSDirectory>`
  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.