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/Resolver.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 | public interface Resolver |
| 25 | { |
| 26 | |
Guillaume Nodet | cd87ae5 | 2010-02-21 14:08:56 +0000 | [diff] [blame] | 27 | /** |
| 28 | * Add the following resource to the resolution. |
| 29 | * |
| 30 | * The resource will be part of the output and all its requirements |
| 31 | * will be satisfied. |
| 32 | * |
| 33 | * It has the same effect has adding a requirement that will match |
| 34 | * this resource by symbolicname and version. |
| 35 | * |
| 36 | * The current resolution will be lost after adding a resource. |
| 37 | * |
| 38 | * @param resource the resource to add |
| 39 | */ |
Richard S. Hall | a2dc451 | 2006-04-04 13:17:11 +0000 | [diff] [blame] | 40 | void add(Resource resource); |
| 41 | |
Guillaume Nodet | cd87ae5 | 2010-02-21 14:08:56 +0000 | [diff] [blame] | 42 | /** |
| 43 | * Returns the list of resources that have been added to the resolution |
| 44 | * @return |
| 45 | */ |
| 46 | Resource[] getAddedResources(); |
| 47 | |
| 48 | /** |
| 49 | * Add the following requirement to the resolution |
| 50 | * |
| 51 | * The current resolution will be lost after adding a requirement. |
| 52 | * |
| 53 | * @param requirement the requirement to add |
| 54 | */ |
| 55 | void add(Requirement requirement); |
| 56 | |
| 57 | /** |
| 58 | * Returns the list of requirements that have been added to the resolution |
| 59 | * @return |
| 60 | */ |
| 61 | Requirement[] getAddedRequirements(); |
| 62 | |
Richard S. Hall | a2dc451 | 2006-04-04 13:17:11 +0000 | [diff] [blame] | 63 | Requirement[] getUnsatisfiedRequirements(); |
| 64 | |
| 65 | Resource[] getOptionalResources(); |
| 66 | |
| 67 | Requirement[] getReason(Resource resource); |
| 68 | |
| 69 | Resource[] getResources(Requirement requirement); |
| 70 | |
| 71 | Resource[] getRequiredResources(); |
| 72 | |
Guillaume Nodet | a6f375e | 2010-02-22 12:48:42 +0000 | [diff] [blame] | 73 | /** |
| 74 | * Start the resolution process and return whether the constraints have |
| 75 | * been successfully met or not. |
| 76 | * The resolution can be interrupted by a call to Thread.interrupt() at any |
| 77 | * time. The result will be to stop the resolver and throw an InterruptedException. |
| 78 | * |
| 79 | * @return <code>true</code> if the resolution has succeeded else <code>false</code> |
Richard S. Hall | 9c28c1d | 2010-02-23 05:03:47 +0000 | [diff] [blame] | 80 | * @throws InterruptedResolutionException if the resolution has been interrupted |
Guillaume Nodet | a6f375e | 2010-02-22 12:48:42 +0000 | [diff] [blame] | 81 | */ |
Richard S. Hall | a2dc451 | 2006-04-04 13:17:11 +0000 | [diff] [blame] | 82 | boolean resolve(); |
| 83 | |
| 84 | void deploy(boolean start); |
| 85 | } |