blob: 90787b4bddc4259fe7e74f9138221a4e8ec19bd4 [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 Offermans5be5f142011-04-26 10:47:12 +000023/**
24 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
25 */
Marcel Offermansdb641a22010-10-07 11:24:04 +000026public 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 Ropddce5862009-12-04 22:16:48 +000037
Marcel Offermansdb641a22010-10-07 11:24:04 +000038 /**
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 Ropddce5862009-12-04 22:16:48 +000049
Marcel Offermansdb641a22010-10-07 11:24:04 +000050 /**
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 Ropddce5862009-12-04 22:16:48 +000061
Marcel Offermansdb641a22010-10-07 11:24:04 +000062 /**
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 Ropddce5862009-12-04 22:16:48 +000074
Marcel Offermansdb641a22010-10-07 11:24:04 +000075 /**
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 Ropddce5862009-12-04 22:16:48 +000083
Marcel Offermansdb641a22010-10-07 11:24:04 +000084 /**
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 Ropddce5862009-12-04 22:16:48 +000091
Marcel Offermansdb641a22010-10-07 11:24:04 +000092 /**
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 Ropddce5862009-12-04 22:16:48 +000099
Marcel Offermansdb641a22010-10-07 11:24:04 +0000100 /**
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 Ropddce5862009-12-04 22:16:48 +0000108
Marcel Offermansdb641a22010-10-07 11:24:04 +0000109 /**
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 Offermans61a81142010-04-02 15:16:50 +0000117
Marcel Offermansdb641a22010-10-07 11:24:04 +0000118 /**
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 Ropddce5862009-12-04 22:16:48 +0000137}