IComponentsRepository
, ISynchronizer
AbstractComponentRepository
public abstract class AbstractExtComponentRepository<FSCRC extends FSCRDBComponent,DB extends FSComponentExtRepositoryDB<FSCRC>> extends java.lang.Object implements IComponentsRepository, ISynchronizer
#scan(DB)
to compute an update of the available components, their properties and revisions#download(FSCRDC, File)
to download a component's resources, if any, to a local file system folderModifier and Type | Class | Description |
---|---|---|
class |
AbstractExtComponentRepository.Repo |
|
static interface |
AbstractExtComponentRepository.RepoMBean |
Modifier and Type | Field | Description |
---|---|---|
static java.util.Map<java.lang.String,AbstractExtComponentRepository<?,?>> |
ALL |
COMPONENT_REPO_IMPLEMENTATION, COMPONENT_REPO_MODE, COMPONENT_REPO_MODE_RELAXED, COMPONENT_REPO_MODE_STRICT
PRIO, TYPE
Constructor | Description |
---|---|
AbstractExtComponentRepository(java.lang.String name,
java.lang.Class<DB> clz) |
Modifier and Type | Method | Description |
---|---|---|
<T> T |
as(java.lang.Class<T> clz) |
Simple type helper for
Resource implementations. |
protected void |
checkOfflineMode() |
Check offline mode and if so throw an exception.
|
void |
complete(ISynchronization sync) |
synchronizers implement this method to re-establish any desired
system state after all invalidations have been performed.
|
protected void |
configure(int prio) |
Is actually
configure(prio,null) . |
protected void |
configure(int prio,
java.lang.Long evictionDelay) |
Is actually
configure(prio,evictionDelay,this.name) . |
protected void |
configure(int prio,
java.lang.Long evictionDelay,
java.lang.String repoKey) |
Finish configuration.
|
abstract void |
download(FSCRC component,
java.io.File folder) |
Download resources of a single component into the given folder
|
java.util.Collection<java.lang.String> |
findComponents(X x) |
shorthand for
IComponentsRepository.findComponents(X, boolean) with a
false second parameter. |
java.util.Collection<java.lang.String> |
findComponents(X x,
boolean localOnly) |
finds all components satisfying a query condition.
|
protected java.io.File |
getCacheRoot() |
|
IComponentDescriptor |
getComponent(java.lang.String cn) |
shorthand for
IComponentsRepository.getComponent(String, boolean) with a
false second parameter. |
IComponentDescriptor |
getComponent(java.lang.String cn,
boolean localOnly) |
retrieves a component descriptor for a fully qualified component, e.g.
|
IComponentsRepositoryContext |
getContext() |
gets the repository context
|
DB |
getDB() |
returns the current DB
|
protected java.util.Properties |
getExpectedConfiguration() |
provided expected repository configuration.
|
java.util.Set<java.lang.String> |
getModules() |
Retrieve the set of modules provided by this repository
|
java.util.Set<java.lang.String> |
getModules(boolean localOnly) |
Retrieve the set of modules provided by this repository.
|
java.lang.String |
getName() |
|
protected long |
getRevision() |
Overall revision of the repository - if available
|
long |
getRevision(java.lang.String cn) |
Shorthand for
IComponentsRepository.getRevision(String, boolean) with a
false second parameter. |
long |
getRevision(java.lang.String cn,
boolean localOnly) |
return the most current revision of the component as available by the
provider.
|
protected java.lang.String |
getURL() |
Some URL style information on the external data source the repository implementation relies on
|
static boolean |
has(java.lang.Class<?> clz) |
Simple type helper for
Resource implementations. |
protected boolean |
isRelaxedMode() |
Operational mode checks
|
void |
preInvalidation(ISynchronization sync) |
pre invalidation collection of outdated components
|
protected void |
preInvalidation(DB currentDB,
DB newDB,
ISynchronization sync) |
Can be overridden to add additional invalidation behavior based on the current DB and
the new DB.
|
java.io.File |
retrieve(java.lang.String cn) |
shorthand for
IComponentsRepository.retrieve(String, boolean) with a
false second parameter. |
java.io.File |
retrieve(java.lang.String cn,
boolean localOnly) |
Retrieve a component's resource folder.
|
abstract DB |
scan(DB current) |
Provide an updated DB.
|
protected void |
setEvictionDelay(long evictionDelay) |
Set eviction of old component copies
|
void |
start() |
Start the repository and register it.
|
void |
stop() |
Stop and unregister the repo.
|
void |
test_setContext(IComponentsRepositoryContext context) |
|
void |
test_setDb(DB db) |
|
void |
test_setInited(boolean inited) |
|
java.lang.String |
toString() |
public static java.util.Map<java.lang.String,AbstractExtComponentRepository<?,?>> ALL
public AbstractExtComponentRepository(java.lang.String name, java.lang.Class<DB> clz)
protected void configure(int prio, java.lang.Long evictionDelay, java.lang.String repoKey)
prio
- Repository priority. See IComponentsRepository
.evictionDelay
- Delay of eviction for old component versions. This should be so high that concurrent home usage may not really happen. Defaults to 24h.repoKey
- A key of the repo that identifies its cache space. For different usages, same name, repo key should. For example the dev repo may be used for different workspaces and is still one repoprotected java.util.Properties getExpectedConfiguration()
FSComponentRepositoryHelper
to make a decision on whether the repository
cache is still valid. Any change in repository configuration between repository
initialization will be taken as reason to completely purge the local repository.
By default this method returns the complete repository configuration.protected void configure(int prio, java.lang.Long evictionDelay)
configure(prio,evictionDelay,this.name)
.prio
- Repository priority. See IComponentsRepository
.evictionDelay
- Delay of eviction for old component versions. This should be so high that concurrent home usage may not really happen. Defaults to 24h.protected void configure(int prio)
configure(prio,null)
.prio
- Repository priority. See IComponentsRepository
.public java.lang.String getName()
protected java.io.File getCacheRoot()
protected void setEvictionDelay(long evictionDelay)
public static boolean has(java.lang.Class<?> clz)
Resource
implementations. Call this to check whether
delegation to the component repository should be implementedpublic <T> T as(java.lang.Class<T> clz)
Resource
implementations. Call this to check whether
delegation to the component repository should be implementedpublic IComponentsRepositoryContext getContext()
public void stop()
public void start()
public void preInvalidation(ISynchronization sync)
preInvalidation
in interface ISynchronizer
protected void preInvalidation(DB currentDB, DB newDB, ISynchronization sync)
currentDB
- newDB
- sync
- public void complete(ISynchronization sync)
ISynchronizer
complete
in interface ISynchronizer
public long getRevision(java.lang.String cn) throws java.io.IOException
IComponentsRepository
IComponentsRepository.getRevision(String, boolean)
with a
false
second parameter.getRevision
in interface IComponentsRepository
java.io.IOException
public long getRevision(java.lang.String cn, boolean localOnly) throws java.io.IOException
IComponentsRepository
If localOnly is set to true, only this repository is looked up. Otherwise all repositories in the chain with lower priority are considered too.
getRevision
in interface IComponentsRepository
java.io.IOException
public java.util.Collection<java.lang.String> findComponents(X x) throws java.io.IOException
IComponentsRepository
IComponentsRepository.findComponents(X, boolean)
with a
false
second parameter.findComponents
in interface IComponentsRepository
java.io.IOException
public java.util.Collection<java.lang.String> findComponents(X x, boolean localOnly) throws java.io.IOException
IComponentsRepository
If localOnly is set to true, only this repository is looked up. Otherwise all repositories in the chain with lower priority are considered too.
findComponents
in interface IComponentsRepository
java.io.IOException
public IComponentDescriptor getComponent(java.lang.String cn)
IComponentsRepository
IComponentsRepository.getComponent(String, boolean)
with a
false
second parameter.getComponent
in interface IComponentsRepository
public IComponentDescriptor getComponent(java.lang.String cn, boolean localOnly)
IComponentsRepository
<module>/java
for a Java component. If localOnly is
set to true, only this repository is looked up. Otherwise all
repositories in the chain with lower priority are considered too.
If localOnly is set to true, only this repository is looked up. Otherwise all repositories in the chain with lower priority are considered too.
getComponent
in interface IComponentsRepository
public java.io.File retrieve(java.lang.String cn) throws java.io.IOException
IComponentsRepository
IComponentsRepository.retrieve(String, boolean)
with a
false
second parameter.retrieve
in interface IComponentsRepository
java.io.IOException
public java.io.File retrieve(java.lang.String cn, boolean localOnly) throws java.io.IOException
IComponentsRepository
A call to this method always returns a folder. Depending on the component type however, this folder may be empty, contain a single z.properties file or more.
If localOnly is set to true, only this repository is looked up. Otherwise all repositories in the chain with lower priority are considered too.
retrieve
in interface IComponentsRepository
null
, if
the component does not exist.java.io.IOException
public java.util.Set<java.lang.String> getModules() throws java.io.IOException
IComponentsRepository
getModules
in interface IComponentsRepository
java.io.IOException
public java.util.Set<java.lang.String> getModules(boolean localOnly) throws java.io.IOException
IComponentsRepository
localOnly
is true, the methods returns only those modules
that are provided by the very repository.getModules
in interface IComponentsRepository
java.io.IOException
protected long getRevision()
protected java.lang.String getURL()
protected boolean isRelaxedMode()
protected void checkOfflineMode()
public abstract DB scan(DB current)
public abstract void download(FSCRC component, java.io.File folder)
public final DB getDB() throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void test_setInited(boolean inited)
public void test_setContext(IComponentsRepositoryContext context)
public void test_setDb(DB db)