blob: aeb5e3e2d6e67f84e98c9166db70d9b4256fd721 [file] [log] [blame]
Marcel Offermansa962bc92009-11-21 17:59:33 +00001/*
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 */
Pierre De Ropae4a5db2009-12-04 22:08:05 +000019package org.apache.felix.dm;
Marcel Offermansa962bc92009-11-21 17:59:33 +000020
21import java.util.ArrayList;
22import java.util.Collections;
Marcel Offermans80eeafe2009-12-01 22:12:26 +000023import java.util.Dictionary;
Pierre De Ropef94c882010-04-17 18:23:35 +000024import java.util.Hashtable;
Marcel Offermansa962bc92009-11-21 17:59:33 +000025import java.util.List;
26
Pierre De Ropae4a5db2009-12-04 22:08:05 +000027import org.apache.felix.dm.dependencies.BundleDependency;
28import org.apache.felix.dm.dependencies.ConfigurationDependency;
Pierre De Ropa0204f52010-03-06 22:23:57 +000029import org.apache.felix.dm.dependencies.PropertyMetaData;
Pierre De Ropae4a5db2009-12-04 22:08:05 +000030import org.apache.felix.dm.dependencies.ResourceDependency;
31import org.apache.felix.dm.dependencies.ServiceDependency;
32import org.apache.felix.dm.dependencies.TemporalServiceDependency;
Marcel Offermans001db052009-12-08 08:58:40 +000033import org.apache.felix.dm.impl.AdapterImpl;
Pierre De Rop19476fe2010-05-23 08:13:58 +000034import org.apache.felix.dm.impl.AspectServiceImpl;
Marcel Offermans001db052009-12-08 08:58:40 +000035import org.apache.felix.dm.impl.BundleAdapterImpl;
Marcel Offermansa6ffb992010-05-19 11:56:44 +000036import org.apache.felix.dm.impl.FactoryConfigurationAdapterImpl;
Pierre De Rop9a8ebfd2010-04-25 22:25:34 +000037import org.apache.felix.dm.impl.FactoryConfigurationAdapterMetaTypeImpl;
Pierre De Ropae4a5db2009-12-04 22:08:05 +000038import org.apache.felix.dm.impl.Logger;
Marcel Offermans001db052009-12-08 08:58:40 +000039import org.apache.felix.dm.impl.ResourceAdapterImpl;
Pierre De Ropae4a5db2009-12-04 22:08:05 +000040import org.apache.felix.dm.impl.ServiceImpl;
41import org.apache.felix.dm.impl.dependencies.BundleDependencyImpl;
42import org.apache.felix.dm.impl.dependencies.ConfigurationDependencyImpl;
43import org.apache.felix.dm.impl.dependencies.ResourceDependencyImpl;
44import org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl;
45import org.apache.felix.dm.impl.dependencies.TemporalServiceDependencyImpl;
Pierre De Ropa0204f52010-03-06 22:23:57 +000046import org.apache.felix.dm.impl.metatype.PropertyMetaDataImpl;
Marcel Offermans4fd903f2009-12-29 09:18:05 +000047import org.apache.felix.dm.resources.Resource;
Pierre De Ropae4a5db2009-12-04 22:08:05 +000048import org.apache.felix.dm.service.Service;
Marcel Offermansb8405a52009-12-22 19:01:31 +000049import org.osgi.framework.BundleContext;
Pierre De Ropef94c882010-04-17 18:23:35 +000050import org.osgi.framework.Constants;
51import org.osgi.service.cm.ManagedServiceFactory;
Marcel Offermansa962bc92009-11-21 17:59:33 +000052
53/**
Marcel Offermans4fd903f2009-12-29 09:18:05 +000054 * The dependency manager manages all services and their dependencies. Using
55 * this API you can declare all services and their dependencies. Under normal
56 * circumstances, you get passed an instance of this class through the
57 * <code>DependencyActivatorBase</code> subclass you use as your
58 * <code>BundleActivator</code>, but it is also possible to create your
59 * own instance.
Marcel Offermansa962bc92009-11-21 17:59:33 +000060 *
61 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
62 */
63public class DependencyManager {
Marcel Offermansad760672010-03-03 15:30:01 +000064 public static final String ASPECT = "org.apache.felix.dependencymanager.aspect";
Marcel Offermansa962bc92009-11-21 17:59:33 +000065 private final BundleContext m_context;
66 private final Logger m_logger;
67 private List m_services = Collections.synchronizedList(new ArrayList());
68
69 /**
Marcel Offermans4fd903f2009-12-29 09:18:05 +000070 * Creates a new dependency manager. You need to supply the
71 * <code>BundleContext</code> to be used by the dependency
72 * manager to register services and communicate with the
73 * framework.
Marcel Offermansa962bc92009-11-21 17:59:33 +000074 *
75 * @param context the bundle context
Marcel Offermansa962bc92009-11-21 17:59:33 +000076 */
Pierre De Ropae4a5db2009-12-04 22:08:05 +000077 public DependencyManager(BundleContext context) {
78 this(context, new Logger(context));
79 }
80
Marcel Offermans4fd903f2009-12-29 09:18:05 +000081 DependencyManager(BundleContext context, Logger logger) {
Marcel Offermansa962bc92009-11-21 17:59:33 +000082 m_context = context;
83 m_logger = logger;
84 }
Pierre De Ropae4a5db2009-12-04 22:08:05 +000085
Marcel Offermansa962bc92009-11-21 17:59:33 +000086 /**
87 * Adds a new service to the dependency manager. After the service was added
88 * it will be started immediately.
89 *
90 * @param service the service to add
91 */
92 public void add(Service service) {
93 m_services.add(service);
94 service.start();
95 }
96
97 /**
98 * Removes a service from the dependency manager. Before the service is removed
99 * it is stopped first.
100 *
101 * @param service the service to remove
102 */
103 public void remove(Service service) {
104 service.stop();
105 m_services.remove(service);
106 }
107
108 /**
109 * Creates a new service.
110 *
111 * @return the new service
112 */
113 public Service createService() {
114 return new ServiceImpl(m_context, this, m_logger);
115 }
116
117 /**
118 * Creates a new service dependency.
119 *
120 * @return the service dependency
121 */
122 public ServiceDependency createServiceDependency() {
Pierre De Ropae4a5db2009-12-04 22:08:05 +0000123 return new ServiceDependencyImpl(m_context, m_logger);
Marcel Offermansa962bc92009-11-21 17:59:33 +0000124 }
125
Marcel Offermans74363c32009-11-23 19:56:08 +0000126 /**
127 * Creates a new temporal service dependency.
128 *
129 * @param timeout the max number of milliseconds to wait for a service availability.
130 * @return the service dependency
131 */
132 public TemporalServiceDependency createTemporalServiceDependency() {
Pierre De Ropae4a5db2009-12-04 22:08:05 +0000133 return new TemporalServiceDependencyImpl(m_context, m_logger);
Marcel Offermans74363c32009-11-23 19:56:08 +0000134 }
Marcel Offermans2925f172009-12-02 13:03:39 +0000135
136 /**
137 * Creates a new configuration dependency.
138 *
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000139 * @return the configuration dependency
Marcel Offermans2925f172009-12-02 13:03:39 +0000140 */
Marcel Offermansa962bc92009-11-21 17:59:33 +0000141 public ConfigurationDependency createConfigurationDependency() {
Pierre De Ropae4a5db2009-12-04 22:08:05 +0000142 return new ConfigurationDependencyImpl(m_context, m_logger);
Marcel Offermansa962bc92009-11-21 17:59:33 +0000143 }
144
Marcel Offermans2925f172009-12-02 13:03:39 +0000145 /**
Pierre De Ropa0204f52010-03-06 22:23:57 +0000146 * Creates a new configuration property MetaData.
147 * @return a new Configuration property MetaData.
148 */
149 public PropertyMetaData createPropertyMetaData() {
150 return new PropertyMetaDataImpl();
151 }
152
153 /**
Marcel Offermans2925f172009-12-02 13:03:39 +0000154 * Creates a new bundle dependency.
155 *
156 * @return
157 */
Marcel Offermansd66c5ce2009-11-26 09:58:44 +0000158 public BundleDependency createBundleDependency() {
Pierre De Ropae4a5db2009-12-04 22:08:05 +0000159 return new BundleDependencyImpl(m_context, m_logger);
Marcel Offermansd66c5ce2009-11-26 09:58:44 +0000160 }
Marcel Offermans2925f172009-12-02 13:03:39 +0000161
162 /**
163 * Creates a new resource dependency.
164 *
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000165 * @return the resource dependency
Marcel Offermans2925f172009-12-02 13:03:39 +0000166 */
167 public ResourceDependency createResourceDependency() {
Pierre De Ropae4a5db2009-12-04 22:08:05 +0000168 return new ResourceDependencyImpl(m_context, m_logger);
Marcel Offermans2925f172009-12-02 13:03:39 +0000169 }
Marcel Offermans80eeafe2009-12-01 22:12:26 +0000170
Marcel Offermans2925f172009-12-02 13:03:39 +0000171 /**
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000172 * Creates a new aspect. The aspect will be applied to any service that
173 * matches the specified interface and filter. For each matching service
174 * an aspect will be created based on the aspect implementation class.
175 * The aspect will be registered with the same interface and properties
176 * as the original service, plus any extra properties you supply here.
177 * It will also inherit all dependencies, and if you declare the original
178 * service as a member it will be injected.
Marcel Offermans2925f172009-12-02 13:03:39 +0000179 *
Pierre De Rop19476fe2010-05-23 08:13:58 +0000180 * <h3>Usage Example</h3>
181 *
182 * <blockquote>
183 * manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "m_aspect")
184 * .setImplementation(ExistingServiceAspect.class)
185 * .setServiceProperties(new Hashtable() {{ put("additional", "properties"); }})
186 * .setComposition("getComposition")
187 * .setCallbacks(new Handler(), null, "mystart", "mystop", null);
188 * <pre>
189 * </pre>
190 * </blockquote>
191 *
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000192 * @param serviceInterface the service interface to apply the aspect to
193 * @param serviceFilter the filter condition to use with the service interface
Pierre De Rop19476fe2010-05-23 08:13:58 +0000194 * @param ranking the level used to organize the aspect chain ordering
195 * @param attributeName, the aspect implementation field name where to inject original service.
196 * If null, any field matching the original service will be injected.
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000197 * @return a service that acts as a factory for generating aspects
Marcel Offermans2925f172009-12-02 13:03:39 +0000198 */
Pierre De Rop19476fe2010-05-23 08:13:58 +0000199 public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, String attributeName) {
200 return new AspectServiceImpl(this, serviceInterface, serviceFilter, ranking, attributeName);
Marcel Offermans80eeafe2009-12-01 22:12:26 +0000201 }
Pierre De Rop19476fe2010-05-23 08:13:58 +0000202
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000203 /**
204 * Creates a new adapter. The adapter will be applied to any service that
205 * matches the specified interface and filter. For each matching service
206 * an adapter will be created based on the adapter implementation class.
207 * The adapter will be registered with the specified interface and existing properties
208 * from the original service plus any extra properties you supply here.
209 * It will also inherit all dependencies, and if you declare the original
210 * service as a member it will be injected.
211 *
Marcel Offermansd665eaf2010-02-16 15:56:35 +0000212 * @param serviceInterface the service interface to apply the adapter to
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000213 * @param serviceFilter the filter condition to use with the service interface
214 * @param adapterInterface the interface to use when registering adapters
215 * @param adapterImplementation the implementation of the adapter
216 * @param adapterProperties additional properties to use with the adapter service registration
217 * @return a service that acts as a factory for generating adapters
218 */
Marcel Offermans61a81142010-04-02 15:16:50 +0000219 public Service createAdapterService(Class serviceInterface, String serviceFilter, String adapterInterface, Object adapterImplementation, Dictionary adapterProperties) {
Marcel Offermans001db052009-12-08 08:58:40 +0000220 return createService()
Marcel Offermans61a81142010-04-02 15:16:50 +0000221 .setImplementation(new AdapterImpl(serviceInterface, serviceFilter, adapterImplementation, adapterInterface, adapterProperties))
222 .add(createServiceDependency()
223 .setService(serviceInterface)
224 .setAutoConfig(false)
225 .setCallbacks("added", "removed")
226 );
227 }
228
229 public Service createAdapterService(Class serviceInterface, String serviceFilter, String[] adapterInterface, Object adapterImplementation, Dictionary adapterProperties) {
230 return createService()
231 .setImplementation(new AdapterImpl(serviceInterface, serviceFilter, adapterImplementation, adapterInterface, adapterProperties))
Marcel Offermans001db052009-12-08 08:58:40 +0000232 .add(createServiceDependency()
Marcel Offermans3e1998c2009-12-16 20:47:25 +0000233 .setService(serviceInterface)
Marcel Offermans001db052009-12-08 08:58:40 +0000234 .setAutoConfig(false)
235 .setCallbacks("added", "removed")
Marcel Offermans626260c2009-12-22 17:06:46 +0000236 );
Marcel Offermans001db052009-12-08 08:58:40 +0000237 }
238
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000239 /**
240 * Creates a new resource adapter. The adapter will be applied to any resource that
241 * matches the specified filter condition. For each matching resource
242 * an adapter will be created based on the adapter implementation class.
243 * The adapter will be registered with the specified interface and existing properties
244 * from the original resource plus any extra properties you supply here.
245 * It will also inherit all dependencies, and if you declare the original
246 * service as a member it will be injected.
247 *
248 * @param resourceFilter the filter condition to use with the resource
Marcel Offermans5eb38b82010-04-06 15:17:57 +0000249 * @param adapterHandler a handler to invoke life cycle methods on for the adapter instance, or <code>null</code>
250 * if you want to invoke these methods on the instance
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000251 * @param adapterInterface the interface to use when registering adapters
252 * @param adapterProperties additional properties to use with the adapter service registration
253 * @param adapterImplementation the implementation of the adapter
254 * @param propagate <code>true</code> if properties from the resource should be propagated to the service
255 * @return a service that acts as a factory for generating resource adapters
256 * @see Resource
257 */
Marcel Offermans5eb38b82010-04-06 15:17:57 +0000258 public Service createResourceAdapterService(String resourceFilter, Object adapterHandler, String adapterInterface, Dictionary adapterProperties, Object adapterImplementation, boolean propagate) {
Marcel Offermans001db052009-12-08 08:58:40 +0000259 return createService()
Marcel Offermans5eb38b82010-04-06 15:17:57 +0000260 .setImplementation(new ResourceAdapterImpl(resourceFilter, adapterHandler, adapterImplementation, adapterInterface, adapterProperties, propagate))
Marcel Offermans61a81142010-04-02 15:16:50 +0000261 .add(createResourceDependency()
262 .setFilter(resourceFilter)
263 .setAutoConfig(false)
264 .setCallbacks("added", "removed")
265 );
266 }
Marcel Offermans5eb38b82010-04-06 15:17:57 +0000267 public Service createResourceAdapterService(String resourceFilter, Object adapterHandler, String[] adapterInterface, Dictionary adapterProperties, Object adapterImplementation, boolean propagate) {
Marcel Offermans61a81142010-04-02 15:16:50 +0000268 return createService()
Marcel Offermans5eb38b82010-04-06 15:17:57 +0000269 .setImplementation(new ResourceAdapterImpl(resourceFilter, adapterHandler, adapterImplementation, adapterInterface, adapterProperties, propagate))
Marcel Offermans001db052009-12-08 08:58:40 +0000270 .add(createResourceDependency()
271 .setFilter(resourceFilter)
272 .setAutoConfig(false)
273 .setCallbacks("added", "removed")
Marcel Offermans626260c2009-12-22 17:06:46 +0000274 );
Marcel Offermans001db052009-12-08 08:58:40 +0000275 }
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000276
277 /**
278 * Creates a new bundle adapter. The adapter will be applied to any bundle that
279 * matches the specified bundle state mask and filter condition. For each matching
280 * bundle an adapter will be created based on the adapter implementation class.
281 * The adapter will be registered with the specified interface
282 *
283 * TODO and existing properties from the original resource plus any extra properties you supply here.
284 * It will also inherit all dependencies, and if you declare the original
285 * service as a member it will be injected.
286 *
287 * @param bundleStateMask the bundle state mask to apply
288 * @param bundleFilter the filter to apply to the bundle manifest
289 * @param adapterImplementation the implementation of the adapter
290 * @param adapterInterface the interface to use when registering adapters
Marcel Offermansd665eaf2010-02-16 15:56:35 +0000291 * @param adapterProperties additional properties to use with the service registration
292 * @param propagate <code>true</code> if properties from the bundle should be propagated to the service
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000293 * @return a service that acts as a factory for generating bundle adapters
294 */
Marcel Offermansd665eaf2010-02-16 15:56:35 +0000295 public Service createBundleAdapterService(int bundleStateMask, String bundleFilter, Object adapterImplementation, String adapterInterface, Dictionary adapterProperties, boolean propagate) {
Marcel Offermans001db052009-12-08 08:58:40 +0000296 return createService()
Marcel Offermansd665eaf2010-02-16 15:56:35 +0000297 .setImplementation(new BundleAdapterImpl(bundleStateMask, bundleFilter, adapterImplementation, adapterInterface, adapterProperties, propagate))
Marcel Offermans001db052009-12-08 08:58:40 +0000298 .add(createBundleDependency()
Marcel Offermans4fd903f2009-12-29 09:18:05 +0000299 .setFilter(bundleFilter)
300 .setStateMask(bundleStateMask)
Marcel Offermans001db052009-12-08 08:58:40 +0000301 .setCallbacks("added", "removed")
Marcel Offermans626260c2009-12-22 17:06:46 +0000302 );
Marcel Offermans001db052009-12-08 08:58:40 +0000303 }
Marcel Offermans61a81142010-04-02 15:16:50 +0000304 public Service createBundleAdapterService(int bundleStateMask, String bundleFilter, Object adapterImplementation, String[] adapterInterface, Dictionary adapterProperties, boolean propagate) {
305 return createService()
306 .setImplementation(new BundleAdapterImpl(bundleStateMask, bundleFilter, adapterImplementation, adapterInterface, adapterProperties, propagate))
307 .add(createBundleDependency()
308 .setFilter(bundleFilter)
309 .setStateMask(bundleStateMask)
310 .setCallbacks("added", "removed")
311 );
312 }
Marcel Offermans80eeafe2009-12-01 22:12:26 +0000313
Marcel Offermansa962bc92009-11-21 17:59:33 +0000314 /**
Pierre De Ropef94c882010-04-17 18:23:35 +0000315 * Creates a new Managed Service Factory Configuration Adapter. For each new Config Admin factory configuration matching
316 * the factoryPid, an adapter will be created based on the adapter implementation class.
317 * The adapter will be registered with the specified interface, and with the specified adapter service properties.
318 * Depending on the <code>propagate</code> parameter, every public factory configuration properties
319 * (which don't start with ".") will be propagated along with the adapter service properties.
320 * It will also inherit all dependencies.
321 *
322 * @param factoryPid the pid matching the factory configuration
323 * @param update the adapter method name that will be notified when the factory configuration is created/updated.
324 * @param adapterInterface the interface to use when registering adapters (can be either a String, String array)
325 * @param adapterImplementation the implementation of the adapter (can be a Class or an Object instance)
326 * @param adapterProperties additional properties to use with the service registration
327 * @param propagate true if public factory configuration should be propagated to the adapter service properties
328 * @return a service that acts as a factory for generating the managed service factory configuration adapter
329 */
330 public Service createFactoryConfigurationAdapterService(String factoryPid, String update, Object adapterImplementation, String adapterInterface, Dictionary adapterProperties, boolean propagate) {
331 Hashtable props = new Hashtable();
332 props.put(Constants.SERVICE_PID, factoryPid);
333 return createService()
334 .setInterface(ManagedServiceFactory.class.getName(), props)
335 .setImplementation(new FactoryConfigurationAdapterImpl(factoryPid, update, adapterImplementation, adapterInterface, adapterProperties, propagate));
336 }
337
338 /**
339 * Creates a new Managed Service Factory Configuration Adapter. For each new Config Admin factory configuration matching
340 * the factoryPid, an adapter will be created based on the adapter implementation class.
341 * The adapter will be registered with the specified interface, and with the specified adapter service properties.
342 * Depending on the <code>propagate</code> parameter, every public factory configuration properties
343 * (which don't start with ".") will be propagated along with the adapter service properties.
344 * It will also inherit all dependencies.
345 *
346 * @param factoryPid the pid matching the factory configuration
347 * @param update the adapter method name that will be notified when the factory configuration is created/updated.
348 * @param adapterInterfaces the interfaces to use when registering adapters (can be either a String, String array)
349 * @param adapterImplementation the implementation of the adapter (can be a Class or an Object instance)
350 * @param adapterProperties additional properties to use with the service registration
351 * @param propagate true if public factory configuration should be propagated to the adapter service properties
352 * @return a service that acts as a factory for generating the managed service factory configuration adapter
353 */
354 public Service createFactoryConfigurationAdapterService(String factoryPid, String update, Object adapterImplementation, String[] adapterInterfaces, Dictionary adapterProperties, boolean propagate) {
355 Hashtable props = new Hashtable();
356 props.put(Constants.SERVICE_PID, factoryPid);
357 return createService()
358 .setInterface(ManagedServiceFactory.class.getName(), props)
359 .setImplementation(new FactoryConfigurationAdapterImpl(factoryPid, update, adapterImplementation, adapterInterfaces, adapterProperties, propagate));
360 }
361
362 /**
Pierre De Rop9a8ebfd2010-04-25 22:25:34 +0000363 * Creates a new Managed Service Factory Configuration Adapter with meta type support. For each new Config Admin factory configuration matching
364 * the factoryPid, an adapter will be created based on the adapter implementation class.
365 * The adapter will be registered with the specified interface, and with the specified adapter service properties.
366 * Depending on the <code>propagate</code> parameter, every public factory configuration properties
367 * (which don't start with ".") will be propagated along with the adapter service properties.
368 * It will also inherit all dependencies.
369 *
370 * @param factoryPid the pid matching the factory configuration
371 * @param update the adapter method name that will be notified when the factory configuration is created/updated.
372 * @param adapterInterfaces the interfaces to use when registering adapters (can be either a String, String array)
373 * @param adapterImplementation the implementation of the adapter (can be a Class or an Object instance)
374 * @param adapterProperties additional properties to use with the service registration
375 * @param propagate true if public factory configuration should be propagated to the adapter service properties
376 * @param heading The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service"
377 * @param desc A human readable description of the factory PID this configuration is associated with. Example: "Configuration for the PrinterService bundle"
378 * @param localization Points to the basename of the Properties file that can localize the Meta Type informations.
379 * The default localization base name for the properties is OSGI-INF/l10n/bundle, but can
380 * be overridden by the manifest Bundle-Localization header (see core specification, in section Localization on page 68).
381 * You can specify a specific localization basename file using this parameter (e.g. <code>"person"</code>
382 * will match person_du_NL.properties in the root bundle directory).
383 * @param propertiesMetaData Array of MetaData regarding configuration properties
384 * @return a service that acts as a factory for generating the managed service factory configuration adapter
385 */
386 public Service createFactoryConfigurationAdapterService(String factoryPid, String update, Object adapterImplementation, String[] adapterInterfaces, Dictionary adapterProperties, boolean propagate,
387 String heading, String desc, String localization, PropertyMetaData[] propertiesMetaData)
388 {
389 Hashtable props = new Hashtable();
390 props.put(Constants.SERVICE_PID, factoryPid);
391 FactoryConfigurationAdapterMetaTypeImpl impl =
392 new FactoryConfigurationAdapterMetaTypeImpl(factoryPid, update, adapterImplementation, adapterInterfaces, adapterProperties, propagate,
393 m_context, m_logger, heading, desc, localization, propertiesMetaData);
394 return createService()
395 .setInterface(ManagedServiceFactory.class.getName(), props)
396 .setImplementation(impl);
397 }
398
399 /**
Marcel Offermansa962bc92009-11-21 17:59:33 +0000400 * Returns a list of services.
401 *
402 * @return a list of services
403 */
404 public List getServices() {
405 return Collections.unmodifiableList(m_services);
406 }
Marcel Offermansa962bc92009-11-21 17:59:33 +0000407}