aQute.lib.deployer
Class FileRepo

java.lang.Object
  extended by aQute.lib.deployer.FileRepo
All Implemented Interfaces:
Plugin, Refreshable, RegistryPlugin, RepositoryPlugin
Direct Known Subclasses:
FileInstallRepo

public class FileRepo
extends Object
implements Plugin, RepositoryPlugin, Refreshable, RegistryPlugin


Nested Class Summary
 
Nested classes/interfaces inherited from interface aQute.bnd.service.RepositoryPlugin
RepositoryPlugin.Strategy
 
Field Summary
static String LOCATION
           
static String NAME
           
static String READONLY
           
protected  File root
           
 
Constructor Summary
FileRepo()
           
FileRepo(String name, File location, boolean canWrite)
           
 
Method Summary
 boolean canWrite()
          Answer if this repository can be used to store files.
protected  void fireBundleAdded(Jar jar, File file)
           
 File[] get(String bsn, String versionRange)
          Get a list of URLs to bundles that are constrained by the bsn and versionRange.
 File get(String bsn, String version, RepositoryPlugin.Strategy strategy, Map<String,String> properties)
          Return a URL to a matching version of the given bundle.
 String getName()
           
 File getRoot()
           
protected  void init()
           
 List<String> list(String regex)
          Return a list of bsns that are present in the repository.
 File put(Jar jar)
          Put a JAR file in the repository.
 boolean refresh()
           
 void setLocation(String string)
           
 void setProperties(Map<String,String> map)
          Give the plugin the remaining properties.
 void setRegistry(Registry registry)
           
 void setReporter(Reporter reporter)
          Set the current reporter.
 String toString()
           
 List<Version> versions(String bsn)
          Return a list of versions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCATION

public static String LOCATION

READONLY

public static String READONLY

NAME

public static String NAME

root

protected File root
Constructor Detail

FileRepo

public FileRepo()

FileRepo

public FileRepo(String name,
                File location,
                boolean canWrite)
Method Detail

init

protected void init()
             throws Exception
Throws:
Exception

setProperties

public void setProperties(Map<String,String> map)
Description copied from interface: Plugin
Give the plugin the remaining properties. When a plugin is declared, the clause can contain extra properties. All the properties and directives are given to the plugin to use.

Specified by:
setProperties in interface Plugin
Parameters:
map - attributes and directives for this plugin's clause

get

public File[] get(String bsn,
                  String versionRange)
           throws Exception
Get a list of URLs to bundles that are constrained by the bsn and versionRange.

Specified by:
get in interface RepositoryPlugin
Parameters:
bsn - Bundle-SymbolicName of the searched bundle
versionRange - Version range for this bundle,"latest" if you only want the latest, or null when you want all.
Returns:
A list of URLs sorted on version, lowest version is at index 0. null is returned when no files with the given bsn ould be found.
Throws:
Exception - when anything goes wrong

canWrite

public boolean canWrite()
Description copied from interface: RepositoryPlugin
Answer if this repository can be used to store files.

Specified by:
canWrite in interface RepositoryPlugin
Returns:
true if writable

put

public File put(Jar jar)
         throws Exception
Description copied from interface: RepositoryPlugin
Put a JAR file in the repository.

Specified by:
put in interface RepositoryPlugin
Throws:
Exception

fireBundleAdded

protected void fireBundleAdded(Jar jar,
                               File file)

setLocation

public void setLocation(String string)

setReporter

public void setReporter(Reporter reporter)
Description copied from interface: Plugin
Set the current reporter. This is called at init time. This plugin should report all errors and warnings to this reporter.

Specified by:
setReporter in interface Plugin

list

public List<String> list(String regex)
                  throws Exception
Description copied from interface: RepositoryPlugin
Return a list of bsns that are present in the repository.

Specified by:
list in interface RepositoryPlugin
Parameters:
regex - if not null, match against the bsn and if matches, return otherwise skip
Returns:
A list of bsns that match the regex parameter or all if regex is null
Throws:
Exception

versions

public List<Version> versions(String bsn)
                       throws Exception
Description copied from interface: RepositoryPlugin
Return a list of versions.

Specified by:
versions in interface RepositoryPlugin
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

getRoot

public File getRoot()
Specified by:
getRoot in interface Refreshable

refresh

public boolean refresh()
Specified by:
refresh in interface Refreshable

getName

public String getName()
Specified by:
getName in interface RepositoryPlugin
Returns:
The name of the repository

get

public File get(String bsn,
                String version,
                RepositoryPlugin.Strategy strategy,
                Map<String,String> properties)
         throws Exception
Description copied from interface: RepositoryPlugin
Return a URL to a matching version of the given bundle.

Specified by:
get in interface RepositoryPlugin
Parameters:
bsn - Bundle-SymbolicName of the searched bundle
version - Version range for this bundle,"latest" if you only want the latest, or null when you want all.
strategy - Get the highest or the lowest
Returns:
A list of URLs sorted on version, lowest version is at index 0. null is returned when no files with the given bsn ould be found.
Throws:
Exception - when anything goes wrong

setRegistry

public void setRegistry(Registry registry)
Specified by:
setRegistry in interface RegistryPlugin


Copyright © 2012 aQute SARL. All Rights Reserved.