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.SerializableA utility for component repository implementers. This helps implementing the index of components provided and query functionality (seeIComponentsRepository.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 intFIND_CACHE_SIZEstatic longserialVersionUID
-
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 voidclearCache()Clear the "find" cache.protected booleandelegate(java.lang.String componentName)Decides whether a component should be allowed to be found by repos down the priority chain.booleanequals(java.lang.Object obj)java.util.Collection<java.lang.String>findComponents(X propertyExpression)Find locally in this DB (see alsoIComponentsRepository.findComponents(X)intgetCacheHits()Stats of "find" cache.intgetCacheQueries()Stats of "find" cache.intgetCacheSize()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 modulejava.util.Set<java.lang.String>getModules()gets the modules read-onlylonggetRevision(java.lang.String cn)Gets rev of local componentbooleanhasComponentModule(java.lang.String componentName)Checks whether this DB has the named component's moduleinthashCode()booleanhasModule(java.lang.String moduleName)Checks whether this DB has the modulestatic java.lang.StringmoduleOf(java.lang.String componentName)Extracts module name from component name (i.e.voidputComponent(java.lang.String componentName, FSCRC c)Adds a component, updates modules set.voidremoveComponent(java.lang.String componentName)Remove a componentvoidremoveModule(java.lang.String moduleName)Remove a complete module
-
-
-
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 alsoIComponentsRepository.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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-