org.hibernate.search.store

## Interface DirectoryProvider<TDirectory extends Directory>

- Type Parameters:
    `TDirectory` - a Lucene Directory provider
  All Known Implementing Classes:
    FSDirectoryProvider, FSMasterDirectoryProvider, FSSlaveDirectoryProvider, RAMDirectoryProvider

      public interface DirectoryProvider<TDirectory extends Directory>

  Set up and provide a Lucene `Directory` `equals()` and `hashCode()` must guaranty equality between two providers pointing to the same underlying Lucene Store. Besides that, `hashCode` ordering is used to avoid deadlock when locking a directory provider. This class must be thread safe regarding `getDirectory()` calls
  Author:
    Emmanuel Bernard, Sylvain Vieujot

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `TDirectory` | `getDirectory()` Give access to the initialized Lucene Directory.
    `void` | `initialize(String indexName, Properties properties, BuildContext context)` get the information to initialize the directory and build its hashCode/equals method
    `void` | `start(DirectoryBasedIndexManager indexManager)` Executed after initialize, this method set up the heavy process of starting up the DirectoryProvider IO processing as well as background processing are expected to be set up here
    `void` | `stop()` Executed when the search factory is closed.

- - ### Method Detail

    - #### initialize

          void initialize(String indexName,
                          Properties properties,
                          BuildContext context)

      get the information to initialize the directory and build its hashCode/equals method
      Parameters:
        `indexName` - the name of the index (directory) to create
        `properties` - the configuration properties
        `context` - provide access to some services at initialization

    - #### start

          void start(DirectoryBasedIndexManager indexManager)

      Executed after initialize, this method set up the heavy process of starting up the DirectoryProvider IO processing as well as background processing are expected to be set up here
      Parameters:
        `indexManager` - the index manager

    - #### stop

          void stop()

      Executed when the search factory is closed. This method should stop any background process as well as releasing any resource. This method should avoid raising exceptions and log potential errors instead

    - #### getDirectory

          TDirectory getDirectory()

      Give access to the initialized Lucene Directory. This method call must be threadsafe.
      Returns:
        an initialized Lucene Directory

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved