Package com.zfabrik.components.provider.util

## Class FSComponentRepositoryHelper<DB extends FSComponentExtRepositoryDB<? extends FSCRDBComponent>>

- java.lang.Object
- - com.zfabrik.components.provider.util.FSComponentRepositoryHelper<DB>

-     public class FSComponentRepositoryHelper<DB extends FSComponentExtRepositoryDB<? extends FSCRDBComponent>>
      extends java.lang.Object

  General repo implementation helper class. Can be forced to purge repo cache on init by setting the system prop `com.zfabrik.cr.purge`
  Author:
    hb

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `DEF_EVICTION_DELAY` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FSComponentRepositoryHelper​(java.lang.Class<DB> clz, java.io.File root)` | Compatibility constructor with empty check properties.
    `FSComponentRepositoryHelper​(java.lang.Class<DB> clz, java.io.File root, java.util.Properties checkProps)` | Initialize a repo helper with a specific DB class, a local store folder and a set of check props that are to be found again to validate the repository storage.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `evictLocalComponent​(java.lang.String name)` |
    `java.io.File` | `getComponentFolder​(FSCRDBComponent c)` |
    `java.io.File` | `getComponentRIFolder​(java.lang.String name)` |
    `Lock` | `lockComponent​(java.lang.String component)` |
    `Lock` | `lockDB()` |
    `DB` | `readDB()` |
    `void` | `saveDB​(DB db)` |
    `void` | `setEvictionDelay​(long evictionDelay)` |

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

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

- - ### Field Detail

    - #### DEF_EVICTION_DELAY

          public static final long DEF_EVICTION_DELAY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FSComponentRepositoryHelper

          public FSComponentRepositoryHelper​(java.lang.Class<DB> clz,
                                             java.io.File root)

      Compatibility constructor with empty check properties.

    - #### FSComponentRepositoryHelper

          public FSComponentRepositoryHelper​(java.lang.Class<DB> clz,
                                             java.io.File root,
                                             java.util.Properties checkProps)

      Initialize a repo helper with a specific DB class, a local store folder and a set of check props that are to be found again to validate the repository storage. If the latter check fails, local repository content will be evicted.

  - ### Method Detail

    - #### setEvictionDelay

          public void setEvictionDelay​(long evictionDelay)

    - #### lockDB

          public Lock lockDB()
                      throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### lockComponent

          public Lock lockComponent​(java.lang.String component)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getComponentFolder

          public java.io.File getComponentFolder​(FSCRDBComponent c)

    - #### getComponentRIFolder

          public java.io.File getComponentRIFolder​(java.lang.String name)

    - #### evictLocalComponent

          public void evictLocalComponent​(java.lang.String name)
                                   throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readDB

          public DB readDB()
                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### saveDB

          public void saveDB​(DB db)
                      throws java.io.IOException

      Throws:
        `java.io.IOException`