Richard S. Hall | a2dc451 | 2006-04-04 13:17:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | * $Header: /cvshome/build/org.osgi.service.obr/src/org/osgi/service/obr/RepositoryAdmin.java,v 1.3 2006/03/16 14:56:17 hargrave Exp $ |
| 3 | * |
| 4 | * Copyright (c) OSGi Alliance (2006). All Rights Reserved. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | // This document is an experimental draft to enable interoperability |
| 20 | // between bundle repositories. There is currently no commitment to |
| 21 | // turn this draft into an official specification. |
| 22 | package org.osgi.service.obr; |
| 23 | |
| 24 | import java.net.URL; |
| 25 | |
| 26 | /** |
| 27 | * Provides centralized access to the distributed repository. |
| 28 | * |
| 29 | * A repository contains a set of <i>resources</i>. A resource contains a |
| 30 | * number of fixed attributes (name, version, etc) and sets of: |
| 31 | * <ol> |
| 32 | * <li>Capabilities - Capabilities provide a named aspect: a bundle, a display, |
| 33 | * memory, etc.</li> |
| 34 | * <li>Requirements - A named filter expression. The filter must be satisfied |
| 35 | * by one or more Capabilties with the given name. These capabilities can come |
| 36 | * from other resources or from the platform. If multiple resources provide the |
| 37 | * requested capability, one is selected. (### what algorithm? ###)</li> |
| 38 | * <li>Requests - Requests are like requirements, except that a request can be |
| 39 | * fullfilled by 0..n resources. This feature can be used to link to resources |
| 40 | * that are compatible with the given resource and provide extra functionality. |
| 41 | * For example, a bundle could request all its known fragments. The UI |
| 42 | * associated with the repository could list these as optional downloads.</li> |
| 43 | * |
| 44 | * @version $Revision: 1.3 $ |
| 45 | */ |
| 46 | public interface RepositoryAdmin |
| 47 | { |
| 48 | /** |
| 49 | * Discover any resources that match the given filter. |
| 50 | * |
| 51 | * This is not a detailed search, but a first scan of applicable resources. |
| 52 | * |
| 53 | * ### Checking the capabilities of the filters is not possible because that |
| 54 | * requires a new construct in the filter. |
| 55 | * |
| 56 | * The filter expression can assert any of the main headers of the resource. |
| 57 | * The attributes that can be checked are: |
| 58 | * |
| 59 | * <ol> |
| 60 | * <li>name</li> |
| 61 | * <li>version (uses filter matching rules)</li> |
| 62 | * <li>description</li> |
| 63 | * <li>category</li> |
| 64 | * <li>copyright</li> |
| 65 | * <li>license</li> |
| 66 | * <li>source</li> |
| 67 | * </ol> |
| 68 | * |
| 69 | * @param filterExpr |
| 70 | * A standard OSGi filter |
| 71 | * @return List of resources matching the filters. |
| 72 | */ |
| 73 | Resource[] discoverResources(String filterExpr); |
| 74 | |
| 75 | /** |
| 76 | * Create a resolver. |
| 77 | * |
| 78 | * @param resource |
| 79 | * @return |
| 80 | */ |
| 81 | Resolver resolver(); |
| 82 | |
| 83 | /** |
| 84 | * Add a new repository to the federation. |
| 85 | * |
| 86 | * The url must point to a repository XML file. |
| 87 | * |
| 88 | * @param repository |
| 89 | * @return |
| 90 | * @throws Exception |
| 91 | */ |
| 92 | Repository addRepository(URL repository) throws Exception; |
| 93 | |
| 94 | boolean removeRepository(URL repository); |
| 95 | |
| 96 | /** |
| 97 | * List all the repositories. |
| 98 | * |
| 99 | * @return |
| 100 | */ |
| 101 | Repository[] listRepositories(); |
| 102 | |
| 103 | Resource getResource(String respositoryId); |
| 104 | } |