blob: 0299fc963a496d8f67a31d39ac13af69a13fbe60 [file] [log] [blame]
Pierre De Ropddce5862009-12-04 22:16:48 +00001/*
Marcel Offermansdb641a22010-10-07 11:24:04 +00002 * 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 Ropddce5862009-12-04 22:16:48 +000017 * under the License.
18 */
Marcel Offermans8b93efa2010-07-02 18:27:21 +000019package org.apache.felix.dm;
Pierre De Ropddce5862009-12-04 22:16:48 +000020
Pierre De Ropddce5862009-12-04 22:16:48 +000021import org.osgi.framework.Bundle;
22
Marcel Offermansdb641a22010-10-07 11:24:04 +000023public interface BundleDependency extends Dependency, ComponentDependencyDeclaration {
24 /**
25 * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed.
26 * When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't
27 * need it in this case.
28 *
29 * @param added the method to call when a bundle was added
30 * @param removed the method to call when a bundle was removed
31 * @return the bundle dependency
32 */
33 public BundleDependency setCallbacks(String added, String removed);
Pierre De Ropddce5862009-12-04 22:16:48 +000034
Marcel Offermansdb641a22010-10-07 11:24:04 +000035 /**
36 * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or
37 * removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming
38 * you don't need it in this case.
39 *
40 * @param added the method to call when a bundle was added
41 * @param changed the method to call when a bundle was changed
42 * @param removed the method to call when a bundle was removed
43 * @return the bundle dependency
44 */
45 public BundleDependency setCallbacks(String added, String changed, String removed);
Pierre De Ropddce5862009-12-04 22:16:48 +000046
Marcel Offermansdb641a22010-10-07 11:24:04 +000047 /**
48 * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed.
49 * They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically
50 * turned off, because we're assuming you don't need it in this case.
51 *
52 * @param instance the instance to call the callbacks on
53 * @param added the method to call when a bundle was added
54 * @param removed the method to call when a bundle was removed
55 * @return the bundle dependency
56 */
57 public BundleDependency setCallbacks(Object instance, String added, String removed);
Pierre De Ropddce5862009-12-04 22:16:48 +000058
Marcel Offermansdb641a22010-10-07 11:24:04 +000059 /**
60 * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or
61 * removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is
62 * automatically turned off, because we're assuming you don't need it in this case.
63 *
64 * @param instance the instance to call the callbacks on
65 * @param added the method to call when a bundle was added
66 * @param changed the method to call when a bundle was changed
67 * @param removed the method to call when a bundle was removed
68 * @return the bundle dependency
69 */
70 public BundleDependency setCallbacks(Object instance, String added, String changed, String removed);
Pierre De Ropddce5862009-12-04 22:16:48 +000071
Marcel Offermansdb641a22010-10-07 11:24:04 +000072 /**
73 * Enables auto configuration for this dependency. This means the component implementation (composition) will be
74 * injected with this bundle dependency automatically.
75 *
76 * @param autoConfig <code>true</code> to enable auto configuration
77 * @return the bundle dependency
78 */
79 public BundleDependency setAutoConfig(boolean autoConfig);
Pierre De Ropddce5862009-12-04 22:16:48 +000080
Marcel Offermansdb641a22010-10-07 11:24:04 +000081 /**
82 * Sets the dependency to be required.
83 *
84 * @param required <code>true</code> if this bundle dependency is required
85 * @return the bundle dependency
86 */
87 public BundleDependency setRequired(boolean required);
Pierre De Ropddce5862009-12-04 22:16:48 +000088
Marcel Offermansdb641a22010-10-07 11:24:04 +000089 /**
90 * Sets the bundle to depend on directly.
91 *
92 * @param bundle the bundle to depend on
93 * @return the bundle dependency
94 */
95 public BundleDependency setBundle(Bundle bundle);
Pierre De Ropddce5862009-12-04 22:16:48 +000096
Marcel Offermansdb641a22010-10-07 11:24:04 +000097 /**
98 * Sets the filter condition to depend on. Filters are matched against the full manifest of a bundle.
99 *
100 * @param filter the filter condition
101 * @return the bundle dependency
102 * @throws IllegalArgumentException
103 */
104 public BundleDependency setFilter(String filter) throws IllegalArgumentException;
Pierre De Ropddce5862009-12-04 22:16:48 +0000105
Marcel Offermansdb641a22010-10-07 11:24:04 +0000106 /**
107 * Sets the bundle state mask to depend on. The OSGi BundleTracker explains this mask in more detail, but
108 * it is basically a mask with flags for each potential state a bundle can be in.
109 *
110 * @param mask the mask to use
111 * @return the bundle dependency
112 */
113 public BundleDependency setStateMask(int mask);
Marcel Offermans61a81142010-04-02 15:16:50 +0000114
Marcel Offermansdb641a22010-10-07 11:24:04 +0000115 /**
116 * Sets property propagation. If set to <code>true</code> any bundle manifest properties will be added
117 * to the service properties of the component that has this dependency (if it registers as a service).
118 *
119 * @param propagate <code>true</code> to propagate the bundle manifest properties
120 * @return the bundle dependency
121 */
122 public BundleDependency setPropagate(boolean propagate);
123
124 /**
125 * Sets the dependency to be bound to this instance. An instance bound dependency means the component is
126 * kept alive even if the dependency goes away, which internally means you can keep your state until you
127 * get activated again. This is mainly used when declaring additional dependencies from within the
128 * <code>init</code> life cycle method of a component.
129 *
130 * @param isInstanceBound <code>true</code> if this dependency is instance bound
131 * @return the bundle dependency
132 */
133 public BundleDependency setInstanceBound(boolean isInstanceBound);
Pierre De Ropddce5862009-12-04 22:16:48 +0000134}