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 abstract 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 (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 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 Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearCache()
Clear the "find" cache.protected abstract FSCRC
createSyntheticComponent(java.lang.String componentName)
Create a synthetic component without any particular properties yet.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 alsoIComponentsRepository.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 modulejava.util.Set<java.lang.String>
getModules()
gets the modules read-onlylong
getRevision(java.lang.String cn)
Gets rev of local componentboolean
hasComponentModule(java.lang.String componentName)
Checks whether this DB has the named component's moduleint
hashCode()
boolean
hasModule(java.lang.String moduleName)
Checks whether this DB has the modulestatic 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 componentvoid
removeModule(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.
-
createSyntheticComponent
protected abstract FSCRC createSyntheticComponent(java.lang.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(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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-