public class Repository extends Object implements VirtualRepository
VirtualRepository implementation.| Constructor and Description |
|---|
Repository()
Creates an instance over all the
RepositoryServices available on the classpath. |
Repository(RepositoryService... services)
Creates an instance over given
RepositoryServices. |
Repository(Services services)
Creates an instance over a collection of
RepositoryServices |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRetrieve(Asset asset,
Class<?> api) |
int |
discover(AssetType... types)
Discovers all the assets of given
AssetTypes which are available through all the underlying
RepositoryServices, using a default timeout. |
int |
discover(Iterable<RepositoryService> services,
AssetType... types)
Discovers all the assets of given
AssetTypes which are available through one or more
RepositoryServices, using a default timeout. |
int |
discover(long timeout,
AssetType... types)
Discovers all the assets of given
AssetTypes which are available through the underlying
RepositoryServices, using a given timeout. |
int |
discover(long timeout,
Iterable<RepositoryService> services,
AssetType... types)
Discovers all the assets of given
AssetTypes which are available through one or more
RepositoryServices, using a default timeout. |
Iterator<Asset> |
iterator() |
Map<AssetType,List<Asset>> |
lookup(AssetType... types)
|
List<Asset> |
lookup(AssetType type)
|
Asset |
lookup(String id)
Returns an
Asset previously discovered. |
void |
publish(Asset asset,
Object content)
Publishes a given
Asset with the RepositoryService bound to the asset. |
<A> A |
retrieve(Asset asset,
Class<A> api)
Retrieves the content of a given
Asset from the RepositoryService bound to the asset, under a
given API. |
Services |
services()
Returns the
RepositoryServices underlying this repository. |
void |
setExecutor(ExecutorService service)
Replaces the default
ExecutorService used to parallelise and/or time-control discovery, retrieval, and publication tasks. |
void |
shutdown()
Closes this repository and releases its resources.
|
Collection<RepositoryService> |
sinks(AssetType... types)
Returns the
RepositoryServices underlying this repository which can publish `Asset`s of at least one of
given AssetTypes. |
Collection<RepositoryService> |
sources(AssetType... types)
Returns the
RepositoryServices underlying this repository which can retrieve `Asset`s of at least one of
given AssetTypes. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic Repository()
RepositoryServices available on the classpath.Services.load()public Repository(RepositoryService... services)
RepositoryServices.services - the servicespublic Repository(Services services)
RepositoryServicesservices - the collectionpublic void setExecutor(ExecutorService service)
ExecutorService used to parallelise and/or time-control discovery, retrieval, and publication tasks.service - the servicepublic Services services()
VirtualRepositoryRepositoryServices underlying this repository.services in interface VirtualRepositorypublic Collection<RepositoryService> sinks(AssetType... types)
VirtualRepositoryRepositoryServices underlying this repository which can publish `Asset`s of at least one of
given AssetTypes.sinks in interface VirtualRepositoryAssetTypespublic Collection<RepositoryService> sources(AssetType... types)
VirtualRepositoryRepositoryServices underlying this repository which can retrieve `Asset`s of at least one of
given AssetTypes.sources in interface VirtualRepositoryAssetTypespublic int discover(AssetType... types)
VirtualRepositoryAssetTypes which are available through all the underlying
RepositoryServices, using a default timeout.discover in interface VirtualRepositorytypes - the asset typesVirtualRepository.discover(long, AssetType...)public int discover(Iterable<RepositoryService> services, AssetType... types)
VirtualRepositoryAssetTypes which are available through one or more
RepositoryServices, using a default timeout.discover in interface VirtualRepositoryservices - the repository servicestypes - the asset typesVirtualRepository.discover(long, AssetType...)public int discover(long timeout,
AssetType... types)
VirtualRepositoryAssetTypes which are available through the underlying
RepositoryServices, using a given timeout.
Discovery may involve networked interactions with repository services, and typically will. Failures that occur when interacting with given repository services are silently tolerated. The interactions do not imply the transfer of asset content, however, only content descriptions.
This method may be invoked multiple times in the lifetime of this repository, typically to discover new assets that may have become available through the repository services. In this case, discovering an asset overwrites any existing description of an asset with the same identifier.
discover in interface VirtualRepositorytypes - the asset typespublic int discover(long timeout,
Iterable<RepositoryService> services,
AssetType... types)
VirtualRepositoryAssetTypes which are available through one or more
RepositoryServices, using a default timeout.discover in interface VirtualRepositoryservices - the repository servicestypes - the asset typesVirtualRepository.discover(long, AssetType...)public Asset lookup(String id)
VirtualRepositoryAsset previously discovered.
This is a local operation and does not trigger network interactions.
lookup in interface VirtualRepositorypublic List<Asset> lookup(AssetType type)
VirtualRepositoryAsset of which AssetType that have been previously discovered.
This is a local operation and does not trigger network interactions.
lookup in interface VirtualRepositoryAssetTypepublic Map<AssetType,List<Asset>> lookup(AssetType... types)
VirtualRepositoryAsset of given AssetTypes which have been previously discovered.
This is a local operation and does not trigger network interactions.
lookup in interface VirtualRepositoryAssetTypespublic <A> A retrieve(Asset asset, Class<A> api)
VirtualRepositoryAsset from the RepositoryService bound to the asset, under a
given API.
Retrieval may involve networked interactions with the repository service, and typically will. Failures are reported as unchecked exceptions.
retrieve in interface VirtualRepositoryasset - the assetapi - the APIpublic void publish(Asset asset, Object content)
VirtualRepositoryAsset with the RepositoryService bound to the asset.
Publication may involve networked interactions with the repository service, and typically will. Failures are reported as unchecked exceptions.
publish in interface VirtualRepositoryasset - the assetcontent - the content of the assetpublic void shutdown()
VirtualRepositoryshutdown in interface VirtualRepositoryCopyright © 2018. All rights reserved.