public abstract class AbstractBaseOBR extends Object implements RegistryPlugin, Plugin, RemoteRepositoryPlugin, OBRIndexProvider
The repository implementation is read-only by default. To implement a writable
repository, subclasses should override canWrite()
and put(Jar)
.
RepositoryPlugin.Strategy
Modifier and Type | Field and Description |
---|---|
protected String |
name |
static String |
PROP_NAME |
static String |
PROP_RESOLUTION_MODE |
static String |
PROP_RESOLUTION_MODE_ANY |
protected Registry |
registry |
protected Reporter |
reporter |
static String |
REPOSITORY_FILE_NAME |
protected Set<OBRResolutionMode> |
supportedModes |
Constructor and Description |
---|
AbstractBaseOBR() |
Modifier and Type | Method and Description |
---|---|
protected void |
addResourceToIndex(Resource resource) |
boolean |
canWrite()
Answer if this repository can be used to store files.
|
File[] |
get(String bsn,
String range)
Return a URL to a matching version of the given bundle.
|
File |
get(String bsn,
String range,
RepositoryPlugin.Strategy strategy,
Map<String,String> properties)
Return a URL to a matching version of the given bundle.
|
ResourceHandle |
getHandle(String bsn,
String range,
RepositoryPlugin.Strategy strategy,
Map<String,String> properties)
Retrieve a resource handle from the repository.
|
protected ResourceHandle[] |
getHandles(String bsn,
String rangeStr) |
String |
getName() |
Set<OBRResolutionMode> |
getSupportedModes() |
protected void |
init() |
protected void |
initialiseIndexes()
Initialize the indexes prior to main initialisation of internal
data structures.
|
List<String> |
list(String regex)
Return a list of bsns that are present in the repository.
|
protected static List<URL> |
parseLocations(String locationsStr)
Utility function for parsing lists of URLs.
|
File |
put(Jar jar)
Put a JAR file in the repository.
|
protected static File[] |
requestAll(ResourceHandle[] handles) |
protected void |
reset() |
void |
setProperties(Map<String,String> map)
Give the plugin the remaining properties.
|
void |
setRegistry(Registry registry) |
void |
setReporter(Reporter reporter)
Set the current reporter.
|
List<Version> |
versions(String bsn)
Return a list of versions.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCacheDirectory
getOBRIndexes
public static final String PROP_NAME
public static final String PROP_RESOLUTION_MODE
public static final String PROP_RESOLUTION_MODE_ANY
public static final String REPOSITORY_FILE_NAME
protected Registry registry
protected Reporter reporter
protected String name
protected Set<OBRResolutionMode> supportedModes
protected void addResourceToIndex(Resource resource)
protected void reset()
protected void initialiseIndexes() throws Exception
Exception
public final void setRegistry(Registry registry)
setRegistry
in interface RegistryPlugin
public void setProperties(Map<String,String> map)
Plugin
setProperties
in interface Plugin
map
- attributes and directives for this plugin's clausepublic File[] get(String bsn, String range) throws Exception
RepositoryPlugin
get
in interface RepositoryPlugin
bsn
- Bundle-SymbolicName of the searched bundlerange
- Version range for this bundle,"latest" if you only want the
latest, or null when you want all.Exception
- when anything goes wrongprotected static File[] requestAll(ResourceHandle[] handles) throws IOException
IOException
protected ResourceHandle[] getHandles(String bsn, String rangeStr) throws Exception
Exception
public void setReporter(Reporter reporter)
Plugin
setReporter
in interface Plugin
public File get(String bsn, String range, RepositoryPlugin.Strategy strategy, Map<String,String> properties) throws Exception
RepositoryPlugin
get
in interface RepositoryPlugin
bsn
- Bundle-SymbolicName of the searched bundlerange
- Version range for this bundle,"latest" if you only want the
latest, or null when you want all.strategy
- Get the highest or the lowestException
- when anything goes wrongpublic ResourceHandle getHandle(String bsn, String range, RepositoryPlugin.Strategy strategy, Map<String,String> properties) throws Exception
RemoteRepositoryPlugin
getFile(bsn, range, strategy, props)
should always return the same result as getResource(bsn, range, strategy, props).request()
.getHandle
in interface RemoteRepositoryPlugin
Exception
public boolean canWrite()
RepositoryPlugin
canWrite
in interface RepositoryPlugin
public File put(Jar jar) throws Exception
RepositoryPlugin
put
in interface RepositoryPlugin
Exception
public List<String> list(String regex) throws Exception
RepositoryPlugin
list
in interface RepositoryPlugin
regex
- if not null, match against the bsn and if matches, return
otherwise skipException
public List<Version> versions(String bsn) throws Exception
RepositoryPlugin
versions
in interface RepositoryPlugin
Exception
public String getName()
getName
in interface RepositoryPlugin
protected static List<URL> parseLocations(String locationsStr) throws MalformedURLException
locationsStr
- Comma-separated list of URLsMalformedURLException
public Set<OBRResolutionMode> getSupportedModes()
getSupportedModes
in interface OBRIndexProvider
Copyright © 2019 aQute SARL. All Rights Reserved.