Package aQute.bnd.service
Interface RepositoryPlugin
-
- All Known Subinterfaces:
InfoRepository,RemoteRepositoryPlugin
- All Known Implementing Classes:
FileRepo,InfoFileRepo,MavenRemoteRepository,MavenRepository,Workspace.CachedFileRepo,WorkspaceRepository
public interface RepositoryPluginA Repository Plugin abstract a bnd repository. This interface allows bnd to find programs from their bsn and revisions from their bsn-version combination. It is also possible to put revisions in a repository if the repository is not read only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRepositoryPlugin.DownloadListenerThe caller can specify any number of DownloadListener objects that are called back when a download is finished (potentially before the get method has returned).static classRepositoryPlugin.PutOptionsOptions used to steer the put operationstatic classRepositoryPlugin.PutResultResults returned by the put operation
-
Field Summary
Fields Modifier and Type Field Description static RepositoryPlugin.PutOptionsDEFAULTOPTIONS
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanWrite()Answer if this repository can be used to store files.java.io.Fileget(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> properties, RepositoryPlugin.DownloadListener... listeners)Return a URL to a matching version of the given bundle.default java.lang.StringgetIcon()Return a name of an iconjava.lang.StringgetLocation()Return a location identifier of this repositoryjava.lang.StringgetName()default java.lang.StringgetStatus()Return a status of this repository, if it is null, status is ok.default booleanisOk()Convenience method to see if the status is nulldefault booleanisRemote()Indicate if this repo is remote or localjava.util.List<java.lang.String>list(java.lang.String pattern)Return a list of bsns that are present in the repository.RepositoryPlugin.PutResultput(java.io.InputStream stream, RepositoryPlugin.PutOptions options)Put an artifact (from the InputStream) into the repository.
There is no guarantee that the artifact on the input stream has not been modified after it's been put in the repository since that is dependent on the implementation of the repository.java.util.SortedSet<Version>versions(java.lang.String bsn)Return a list of versions.
-
-
-
Field Detail
-
DEFAULTOPTIONS
static final RepositoryPlugin.PutOptions DEFAULTOPTIONS
-
-
Method Detail
-
put
RepositoryPlugin.PutResult put(java.io.InputStream stream, RepositoryPlugin.PutOptions options) throws java.lang.Exception
Put an artifact (from the InputStream) into the repository.
There is no guarantee that the artifact on the input stream has not been modified after it's been put in the repository since that is dependent on the implementation of the repository.- Parameters:
stream- The input stream with the artifactoptions- The put options. SeeRepositoryPlugin.PutOptions, can benull, which will then take the default options like new PutOptions().- Returns:
- The result of the put, never null. See
RepositoryPlugin.PutResult - Throws:
java.lang.Exception- When the repository root directory doesn't exist, when the repository is read-only, when the specified checksum doesn't match the checksum of the fetched artifact (seeRepositoryPlugin.PutOptions.digest), when the implementation wants to modify the artifact but isn't allowed, or when another error has occurred.
-
get
java.io.File get(java.lang.String bsn, Version version, java.util.Map<java.lang.String,java.lang.String> properties, RepositoryPlugin.DownloadListener... listeners) throws java.lang.ExceptionReturn a URL to a matching version of the given bundle. If download listeners are specified then the returned file is not guaranteed to exist before a download listener is notified of success or failure. The callback can happen before the method has returned. If the returned file is null then download listeners are not called back. The intention of the Download Listeners is to allow a caller to obtain references to files that do not yet exist but are to be downloaded. If the downloads were done synchronously in the call, then no overlap of downloads could take place.- Parameters:
bsn- Bundle-SymbolicName of the searched bundleversion- Version requestedlisteners- Zero or more download listener that will be notified of the outcome.- Returns:
- A file to the revision or null if not found
- Throws:
java.lang.Exception- when anything goes wrong, in this case no listeners will be called back.
-
canWrite
boolean canWrite()
Answer if this repository can be used to store files.- Returns:
- true if writable
-
list
java.util.List<java.lang.String> list(java.lang.String pattern) throws java.lang.ExceptionReturn a list of bsns that are present in the repository.- Parameters:
pattern- Aglob pattern to be matched against bsns present in the repository, or null.- Returns:
- A list of bsns that match the pattern parameter or all if pattern is null; repositories that do not support browsing or querying should return an empty list.
- Throws:
java.lang.Exception
-
versions
java.util.SortedSet<Version> versions(java.lang.String bsn) throws java.lang.Exception
Return a list of versions.- Throws:
java.lang.Exception
-
getName
java.lang.String getName()
- Returns:
- The name of the repository
-
getLocation
java.lang.String getLocation()
Return a location identifier of this repository
-
getStatus
default java.lang.String getStatus()
Return a status of this repository, if it is null, status is ok. Otherwise the return value represents a reason.- Returns:
- a status or null if all ok
-
isOk
default boolean isOk()
Convenience method to see if the status is null
-
getIcon
default java.lang.String getIcon()
Return a name of an icon
-
isRemote
default boolean isRemote()
Indicate if this repo is remote or local- Returns:
- true if this is a remote repo
-
-