Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 1 | /* |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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 |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 17 | * under the License. |
| 18 | */ |
Marcel Offermans | 8b93efa | 2010-07-02 18:27:21 +0000 | [diff] [blame] | 19 | package org.apache.felix.dm; |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 20 | |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 21 | import org.osgi.framework.Bundle; |
| 22 | |
Marcel Offermans | 5be5f14 | 2011-04-26 10:47:12 +0000 | [diff] [blame] | 23 | /** |
| 24 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 25 | */ |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 37 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 49 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 61 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 74 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 83 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 91 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 99 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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 |
| 106 | */ |
| 107 | public BundleDependency setFilter(String filter) throws IllegalArgumentException; |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 108 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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); |
Marcel Offermans | 61a8114 | 2010-04-02 15:16:50 +0000 | [diff] [blame] | 117 | |
Marcel Offermans | db641a2 | 2010-10-07 11:24:04 +0000 | [diff] [blame] | 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 the dependency to be bound to this instance. An instance bound dependency means the component is |
| 129 | * kept alive even if the dependency goes away, which internally means you can keep your state until you |
| 130 | * get activated again. This is mainly used when declaring additional dependencies from within the |
| 131 | * <code>init</code> life cycle method of a component. |
| 132 | * |
| 133 | * @param isInstanceBound <code>true</code> if this dependency is instance bound |
| 134 | * @return the bundle dependency |
| 135 | */ |
| 136 | public BundleDependency setInstanceBound(boolean isInstanceBound); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 137 | } |