org.crosswire.jsword.index.lucene

## Class InstalledIndex

- java.lang.Object
- - org.crosswire.jsword.index.lucene.InstalledIndex

-     public final class InstalledIndex
      extends Object

  A singleton that Reads and Maintains Installed Index Metadata (for e.g. version indexed on client machine) in properties file If file does not exist on the client, it will be created File location: {WritableProjectDir}/JSword/lucene /org.crosswire.jsword.index.lucene.InstalledIndex.properties
  Author:
    Sijo Cherian
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static float` | `DEFAULT_INSTALLED_INDEX_VERSION` The Index version for new indexes
    `static String` | `INSTALLED_INDEX_DEFAULT_VERSION`
    `private static org.slf4j.Logger` | `log`
    `private static String` | `metadataFileComment`
    `private static InstalledIndex` | `myInstance`
    `static String` | `PREFIX_INSTALLED_INDEX_VERSION_BOOK_OVERRIDE`
    `private PropertyMap` | `props`
    `private Object` | `writeLock`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `InstalledIndex()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `float` | `getInstalledIndexDefaultVersion()`
    `float` | `getInstalledIndexVersion(Book b)`
    `URI` | `getPropertyFileURI()`
    `static InstalledIndex` | `instance()` All access through this single instance.
    `void` | `removeFromInstalledIndexMetadata(Book b)`
    `protected void` | `storeInstalledIndexMetadata()`
    `void` | `storeInstalledIndexMetadata(Book b, String installedIndexVersionToStore)`
    `void` | `storeInstalledIndexMetadata(PropertyMap updateProps)` Use this method to add/update custom property in the metadata file.
    `void` | `storeLatestVersionAsInstalledIndexMetadata(Book b)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTALLED_INDEX_DEFAULT_VERSION

          public static final String INSTALLED_INDEX_DEFAULT_VERSION

      See Also:
        Constant Field Values

    - #### PREFIX_INSTALLED_INDEX_VERSION_BOOK_OVERRIDE

          public static final String PREFIX_INSTALLED_INDEX_VERSION_BOOK_OVERRIDE

      See Also:
        Constant Field Values

    - #### DEFAULT_INSTALLED_INDEX_VERSION

          public static final float DEFAULT_INSTALLED_INDEX_VERSION

      The Index version for new indexes
      See Also:
        Constant Field Values

    - #### props

          private PropertyMap props

    - #### writeLock

          private Object writeLock

    - #### metadataFileComment

          private static String metadataFileComment

    - #### myInstance

          private static InstalledIndex myInstance

    - #### log

          private static final org.slf4j.Logger log

  - ### Constructor Detail

    - #### InstalledIndex

          private InstalledIndex()

  - ### Method Detail

    - #### instance

          public static InstalledIndex instance()

      All access through this single instance.
      Returns:
        the singleton instance

    - #### getInstalledIndexDefaultVersion

          public float getInstalledIndexDefaultVersion()

    - #### getInstalledIndexVersion

          public float getInstalledIndexVersion(Book b)

    - #### storeLatestVersionAsInstalledIndexMetadata

          public void storeLatestVersionAsInstalledIndexMetadata(Book b)
                                                          throws IOException

      Throws:
        `IOException`

    - #### getPropertyFileURI

          public URI getPropertyFileURI()

    - #### storeInstalledIndexMetadata

          protected void storeInstalledIndexMetadata()
                                              throws IOException

      Throws:
        `IOException`

    - #### storeInstalledIndexMetadata

          public void storeInstalledIndexMetadata(PropertyMap updateProps)
                                           throws IOException

      Use this method to add/update custom property in the metadata file. Note: If all the installed books indices have been upgraded/downloaded, client can pass in property InstalledIndex.INSTALLED_INDEX_DEFAULT_VERSION = <VersionToStore>, for e.g for client managed downloadable index
      Parameters:
        `updateProps` -
      Throws:
        `IOException`

    - #### storeInstalledIndexMetadata

          public void storeInstalledIndexMetadata(Book b,
                                         String installedIndexVersionToStore)
                                           throws IOException

      Throws:
        `IOException`

    - #### removeFromInstalledIndexMetadata

          public void removeFromInstalledIndexMetadata(Book b)
                                                throws IOException

      Throws:
        `IOException`