Pierre De Rop | 3a00a21 | 2015-03-01 09:27:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. 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, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.apache.felix.dm; |
| 20 | |
| 21 | import org.osgi.framework.Bundle; |
| 22 | |
| 23 | /** |
| 24 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 25 | */ |
| 26 | public interface BundleDependency extends Dependency, ComponentDependencyDeclaration { |
| 27 | /** |
| 28 | * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. |
| 29 | * When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't |
| 30 | * need it in this case. |
| 31 | * |
| 32 | * @param added the method to call when a bundle was added |
| 33 | * @param removed the method to call when a bundle was removed |
| 34 | * @return the bundle dependency |
| 35 | */ |
| 36 | public BundleDependency setCallbacks(String added, String removed); |
| 37 | |
| 38 | /** |
| 39 | * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or |
| 40 | * removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming |
| 41 | * you don't need it in this case. |
| 42 | * |
| 43 | * @param added the method to call when a bundle was added |
| 44 | * @param changed the method to call when a bundle was changed |
| 45 | * @param removed the method to call when a bundle was removed |
| 46 | * @return the bundle dependency |
| 47 | */ |
| 48 | public BundleDependency setCallbacks(String added, String changed, String removed); |
| 49 | |
| 50 | /** |
| 51 | * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. |
| 52 | * They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically |
| 53 | * turned off, because we're assuming you don't need it in this case. |
| 54 | * |
| 55 | * @param instance the instance to call the callbacks on |
| 56 | * @param added the method to call when a bundle was added |
| 57 | * @param removed the method to call when a bundle was removed |
| 58 | * @return the bundle dependency |
| 59 | */ |
| 60 | public BundleDependency setCallbacks(Object instance, String added, String removed); |
| 61 | |
| 62 | /** |
| 63 | * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or |
| 64 | * removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is |
| 65 | * automatically turned off, because we're assuming you don't need it in this case. |
| 66 | * |
| 67 | * @param instance the instance to call the callbacks on |
| 68 | * @param added the method to call when a bundle was added |
| 69 | * @param changed the method to call when a bundle was changed |
| 70 | * @param removed the method to call when a bundle was removed |
| 71 | * @return the bundle dependency |
| 72 | */ |
| 73 | public BundleDependency setCallbacks(Object instance, String added, String changed, String removed); |
| 74 | |
| 75 | /** |
| 76 | * Enables auto configuration for this dependency. This means the component implementation (composition) will be |
| 77 | * injected with this bundle dependency automatically. |
| 78 | * |
| 79 | * @param autoConfig <code>true</code> to enable auto configuration |
| 80 | * @return the bundle dependency |
| 81 | */ |
| 82 | public BundleDependency setAutoConfig(boolean autoConfig); |
| 83 | |
| 84 | /** |
| 85 | * Sets the dependency to be required. |
| 86 | * |
| 87 | * @param required <code>true</code> if this bundle dependency is required |
| 88 | * @return the bundle dependency |
| 89 | */ |
| 90 | public BundleDependency setRequired(boolean required); |
| 91 | |
| 92 | /** |
| 93 | * Sets the bundle to depend on directly. |
| 94 | * |
| 95 | * @param bundle the bundle to depend on |
| 96 | * @return the bundle dependency |
| 97 | */ |
| 98 | public BundleDependency setBundle(Bundle bundle); |
| 99 | |
| 100 | /** |
| 101 | * Sets the filter condition to depend on. Filters are matched against the full manifest of a bundle. |
| 102 | * |
| 103 | * @param filter the filter condition |
| 104 | * @return the bundle dependency |
| 105 | * @throws IllegalArgumentException if the filter is invalid |
| 106 | */ |
| 107 | public BundleDependency setFilter(String filter) throws IllegalArgumentException; |
| 108 | |
| 109 | /** |
| 110 | * Sets the bundle state mask to depend on. The OSGi BundleTracker explains this mask in more detail, but |
| 111 | * it is basically a mask with flags for each potential state a bundle can be in. |
| 112 | * |
| 113 | * @param mask the mask to use |
| 114 | * @return the bundle dependency |
| 115 | */ |
| 116 | public BundleDependency setStateMask(int mask); |
| 117 | |
| 118 | /** |
| 119 | * Sets property propagation. If set to <code>true</code> any bundle manifest properties will be added |
| 120 | * to the service properties of the component that has this dependency (if it registers as a service). |
| 121 | * |
| 122 | * @param propagate <code>true</code> to propagate the bundle manifest properties |
| 123 | * @return the bundle dependency |
| 124 | */ |
| 125 | public BundleDependency setPropagate(boolean propagate); |
| 126 | |
| 127 | /** |
| 128 | * Sets an Object instance and a callback method used to propagate some properties to the provided service properties. |
| 129 | * The method will be invoked on the specified object instance and must have one of the following signatures: |
| 130 | * <ul><li>Dictionary callback(ServiceReference, Object service) |
| 131 | * <li>Dictionary callback(ServiceReference) |
| 132 | * </ul> |
| 133 | * @param instance the Object instance which is used to retrieve propagated service properties |
| 134 | * @param method the method to invoke for retrieving the properties to be propagated to the service properties. |
| 135 | * @return this service dependency. |
| 136 | */ |
| 137 | public BundleDependency setPropagate(Object instance, String method); |
| 138 | } |