Package com.zfabrik.components.provider.util

## Class FSComponentExtRepositoryDB<FSCRC extends FSCRDBComponent>

- java.lang.Object
- - com.zfabrik.components.provider.util.FSComponentExtRepositoryDB<FSCRC>

- All Implemented Interfaces:
    `java.io.Serializable`
  Direct Known Subclasses:
    `FSComponentRepositoryDB`

      public class FSComponentExtRepositoryDB<FSCRC extends FSCRDBComponent>
      extends java.lang.Object
      implements java.io.Serializable

  A utility for component repository implementers. This helps implementing the index of components provided and query functionality (see `IComponentsRepository.findComponents(X)` as well as a simple query cache. This class is not thread safe.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `FIND_CACHE_SIZE` |
    `static long` | `serialVersionUID` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FSComponentExtRepositoryDB()` |
    `FSComponentExtRepositoryDB​(FSComponentExtRepositoryDB<FSCRC> db)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `clearCache()` | Clear the "find" cache.
    `protected boolean` | `delegate​(java.lang.String componentName)` | Decides whether a component should be allowed to be found by repos down the priority chain.
    `boolean` | `equals​(java.lang.Object obj)` |
    `java.util.Collection<java.lang.String>` | `findComponents​(X propertyExpression)` | Find locally in this DB (see also `IComponentsRepository.findComponents(X)`
    `int` | `getCacheHits()` | Stats of "find" cache.
    `int` | `getCacheQueries()` | Stats of "find" cache.
    `int` | `getCacheSize()` | Stats of "find" cache.
    `java.util.Map<java.lang.String,​FSCRC>` | `getComponents()` |
    `java.util.Set<java.lang.String>` | `getComponentsOfModule​(java.lang.String moduleName)` | Gets all components of a given module
    `java.util.Set<java.lang.String>` | `getModules()` | gets the modules read-only
    `long` | `getRevision​(java.lang.String cn)` | Gets rev of local component
    `boolean` | `hasComponentModule​(java.lang.String componentName)` | Checks whether this DB has the named component's module
    `int` | `hashCode()` |
    `boolean` | `hasModule​(java.lang.String moduleName)` | Checks whether this DB has the module
    `static java.lang.String` | `moduleOf​(java.lang.String componentName)` | Extracts module name from component name (i.e.
    `void` | `putComponent​(java.lang.String componentName, FSCRC c)` | Adds a component, updates modules set.
    `void` | `removeComponent​(java.lang.String componentName)` | Remove a component
    `void` | `removeModule​(java.lang.String moduleName)` | Remove a complete module

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

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

- - ### Field Detail

    - #### FIND_CACHE_SIZE

          public static final int FIND_CACHE_SIZE

      See Also:
        Constant Field Values

    - #### serialVersionUID

          public static final long serialVersionUID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FSComponentExtRepositoryDB

          public FSComponentExtRepositoryDB()

    - #### FSComponentExtRepositoryDB

          public FSComponentExtRepositoryDB​(FSComponentExtRepositoryDB<FSCRC> db)

  - ### Method Detail

    - #### clearCache

          protected void clearCache()

      Clear the "find" cache.

    - #### getCacheHits

          public int getCacheHits()

      Stats of "find" cache.

    - #### getCacheQueries

          public int getCacheQueries()

      Stats of "find" cache.

    - #### getCacheSize

          public int getCacheSize()

      Stats of "find" cache.

    - #### delegate

          protected boolean delegate​(java.lang.String componentName)

      Decides whether a component should be allowed to be found by repos down the priority chain. Defaults to not delegate if the component's module was found here and to delegate otherwise.
      Parameters:
        `componentName` -

    - #### findComponents

          public java.util.Collection<java.lang.String> findComponents​(X propertyExpression)
                                                                throws java.io.IOException

      Find locally in this DB (see also `IComponentsRepository.findComponents(X)`
      Parameters:
        `propertyExpression` -
      Throws:
        `java.io.IOException`

    - #### getRevision

          public long getRevision​(java.lang.String cn)

      Gets rev of local component
      Parameters:
        `cn` -

    - #### getComponents

          public java.util.Map<java.lang.String,​FSCRC> getComponents()

    - #### putComponent

          public void putComponent​(java.lang.String componentName,
                                   FSCRC c)

      Adds a component, updates modules set.

    - #### removeComponent

          public void removeComponent​(java.lang.String componentName)

      Remove a component

    - #### removeModule

          public void removeModule​(java.lang.String moduleName)

      Remove a complete module

    - #### hasModule

          public boolean hasModule​(java.lang.String moduleName)

      Checks whether this DB has the module

    - #### hasComponentModule

          public boolean hasComponentModule​(java.lang.String componentName)

      Checks whether this DB has the named component's module

    - #### getModules

          public java.util.Set<java.lang.String> getModules()

      gets the modules read-only

    - #### getComponentsOfModule

          public java.util.Set<java.lang.String> getComponentsOfModule​(java.lang.String moduleName)

      Gets all components of a given module

    - #### moduleOf

          public static java.lang.String moduleOf​(java.lang.String componentName)

      Extracts module name from component name (i.e. the "/" separated prefix)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`