Stuart McCulloch | 26e7a5a | 2011-10-17 10:31:43 +0000 | [diff] [blame^] | 1 | package aQute.bnd.service; |
| 2 | |
| 3 | import java.io.*; |
| 4 | import java.util.*; |
| 5 | |
| 6 | import aQute.lib.osgi.*; |
| 7 | import aQute.libg.version.*; |
| 8 | |
| 9 | public interface RepositoryPlugin { |
| 10 | public enum Strategy { |
| 11 | LOWEST, HIGHEST, EXACT |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Return a URL to a matching version of the given bundle. |
| 16 | * |
| 17 | * @param bsn |
| 18 | * Bundle-SymbolicName of the searched bundle |
| 19 | * @param range |
| 20 | * Version range for this bundle,"latest" if you only want the |
| 21 | * latest, or null when you want all. |
| 22 | * @return A list of URLs sorted on version, lowest version is at index 0. |
| 23 | * null is returned when no files with the given bsn ould be found. |
| 24 | * @throws Exception |
| 25 | * when anything goes wrong |
| 26 | */ |
| 27 | @Deprecated File[] get(String bsn, String range) throws Exception; |
| 28 | |
| 29 | /** |
| 30 | * Return a URL to a matching version of the given bundle. |
| 31 | * |
| 32 | * @param bsn |
| 33 | * Bundle-SymbolicName of the searched bundle |
| 34 | * @param range |
| 35 | * Version range for this bundle,"latest" if you only want the |
| 36 | * latest, or null when you want all. |
| 37 | * @param strategy |
| 38 | * Get the highest or the lowest |
| 39 | * @return A list of URLs sorted on version, lowest version is at index 0. |
| 40 | * null is returned when no files with the given bsn ould be found. |
| 41 | * @throws Exception |
| 42 | * when anything goes wrong |
| 43 | */ |
| 44 | File get(String bsn, String range, Strategy strategy, Map<String,String> properties) throws Exception; |
| 45 | |
| 46 | /** |
| 47 | * Answer if this repository can be used to store files. |
| 48 | * |
| 49 | * @return true if writable |
| 50 | */ |
| 51 | boolean canWrite(); |
| 52 | |
| 53 | /** |
| 54 | * Put a JAR file in the repository. |
| 55 | * |
| 56 | * @param jar |
| 57 | * @throws Exception |
| 58 | */ |
| 59 | File put(Jar jar) throws Exception; |
| 60 | |
| 61 | /** |
| 62 | * Return a list of bsns that are present in the repository. |
| 63 | * |
| 64 | * @param regex |
| 65 | * if not null, match against the bsn and if matches, return |
| 66 | * otherwise skip |
| 67 | * @return A list of bsns that match the regex parameter or all if regex is |
| 68 | * null |
| 69 | * @throws Exception |
| 70 | */ |
| 71 | List<String> list(String regex) throws Exception; |
| 72 | |
| 73 | /** |
| 74 | * Return a list of versions. |
| 75 | * |
| 76 | * @throws Exception |
| 77 | */ |
| 78 | |
| 79 | List<Version> versions(String bsn) throws Exception; |
| 80 | |
| 81 | /** |
| 82 | * @return The name of the repository |
| 83 | */ |
| 84 | String getName(); |
| 85 | |
| 86 | } |