Class FSComponentExtRepositoryDB<FSCRC extends FSCRDBComponent>

java.lang.Object
com.zfabrik.components.provider.util.FSComponentExtRepositoryDB<FSCRC>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FSComponentRepositoryDB

public abstract class FSComponentExtRepositoryDB<FSCRC extends FSCRDBComponent> extends Object implements 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:
  • Field Details

  • Constructor Details

    • FSComponentExtRepositoryDB

      public FSComponentExtRepositoryDB()
    • FSComponentExtRepositoryDB

      public FSComponentExtRepositoryDB(FSComponentExtRepositoryDB<FSCRC> db)
  • Method Details

    • 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(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 Collection<String> findComponents(X propertyExpression) throws IOException
      Find locally in this DB (see also IComponentsRepository.findComponents(X)
      Parameters:
      propertyExpression -
      Throws:
      IOException
    • getRevision

      public long getRevision(String cn)
      Gets rev of local component
      Parameters:
      cn -
    • getComponents

      public Map<String,FSCRC> getComponents()
    • putComponent

      public void putComponent(String componentName, FSCRC c)
      Adds a component, updates modules set.
    • createSyntheticComponent

      protected abstract FSCRC createSyntheticComponent(String componentName)
      Create a synthetic component without any particular properties yet. This is used for filling synthetic components, e.g. links to an existing component during alias expansion.
    • removeComponent

      public void removeComponent(String componentName)
      Remove a component
    • removeModule

      public void removeModule(String moduleName)
      Remove a complete module
    • hasModule

      public boolean hasModule(String moduleName)
      Checks whether this DB has the module
    • hasComponentModule

      public boolean hasComponentModule(String componentName)
      Checks whether this DB has the named component's module
    • getModules

      public Set<String> getModules()
      gets the modules read-only
    • getComponentsOfModule

      public Set<String> getComponentsOfModule(String moduleName)
      Gets all components of a given module
    • moduleOf

      public static String moduleOf(String componentName)
      Extracts module name from component name (i.e. the "/" separated prefix)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object