blob: da6e212c420b6b23c65b512e3abd1d86955cc9c4 [file] [log] [blame]
Pierre De Ropddce5862009-12-04 22:16:48 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional information
4 * regarding copyright ownership. The ASF licenses this file to you under the Apache License,
5 * Version 2.0 (the "License"); you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
7 * required by applicable law or agreed to in writing, software distributed under the License is
8 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
9 * or implied. See the License for the specific language governing permissions and limitations
10 * under the License.
11 */
12package org.apache.felix.dm.dependencies;
13
Pierre De Ropddce5862009-12-04 22:16:48 +000014import org.apache.felix.dm.management.ServiceComponentDependency;
Pierre De Ropddce5862009-12-04 22:16:48 +000015
16/**
17 * Configuration dependency that can track the availability of a (valid) configuration. To use
18 * it, specify a PID for the configuration. The dependency is always required, because if it is
19 * not, it does not make sense to use the dependency manager. In that scenario, simply register
20 * your service as a <code>ManagedService(Factory)</code> and handle everything yourself. Also,
21 * only managed services are supported, not factories. There are a couple of things you need to
22 * be aware of when implementing the <code>updated(Dictionary)</code> method:
23 * <ul>
24 * <li>Make sure it throws a <code>ConfigurationException</code> when you get a configuration
25 * that is invalid. In this case, the dependency will not change: if it was not available, it
26 * will still not be. If it was available, it will remain available and implicitly assume you
27 * keep working with your old configuration.</li>
28 * <li>This method will be called before all required dependencies are available. Make sure you
29 * do not depend on these to parse your settings.</li>
30 * </ul>
31 *
32 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
33 */
34public interface ConfigurationDependency extends Dependency, ServiceComponentDependency
35{
36 ConfigurationDependency setCallback(String callback);
37
38 /**
39 * Sets the <code>service.pid</code> of the configuration you are depending on.
40 */
41 ConfigurationDependency setPid(String pid);
42
43 /**
44 * Sets propagation of the configuration properties to the service properties. Any additional
45 * service properties specified directly are merged with these.
46 */
47 ConfigurationDependency setPropagate(boolean propagate);
Pierre De Ropa0204f52010-03-06 22:23:57 +000048
49 /**
50 * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
51 * @return The label used to display the tab name where the properties are displayed (may be localized)
52 */
53 ConfigurationDependency setHeading(String heading);
54
55 /**
Pierre De Rop379ba3e2010-03-07 00:03:26 +000056 * A human readable description of the PID this configuration is associated with. Example: "Configuration for the PrinterService bundle".
57 * @return A human readable description of the PID this configuration is associated with (may be localized)
Pierre De Ropa0204f52010-03-06 22:23:57 +000058 */
59 ConfigurationDependency setDescription(String description);
60
61 /**
62 * Points to the basename of the Properties file that can localize the Meta Type informations.
Pierre De Ropa0204f52010-03-06 22:23:57 +000063 * The default localization base name for the properties is OSGI-INF/l10n/bundle, but can
64 * be overridden by the manifest Bundle-Localization header (see core specification, in section Localization on page 68).
Pierre De Rop379ba3e2010-03-07 00:03:26 +000065 * You can specify a specific localization basename file using this method (e.g. <code>setLocalization("person")</code>
66 * will match person_du_NL.properties in the root bundle directory.
Pierre De Ropa0204f52010-03-06 22:23:57 +000067 */
68 ConfigurationDependency setLocalization(String path);
69
70 /**
Pierre De Rop379ba3e2010-03-07 00:03:26 +000071 * Adds a MetaData regarding a given configuration property.
Pierre De Ropa0204f52010-03-06 22:23:57 +000072 */
73 ConfigurationDependency add(PropertyMetaData properties);
Marcel Offermans61a81142010-04-02 15:16:50 +000074
75 ConfigurationDependency setInstanceBound(boolean isInstanceBound);
76
Pierre De Ropddce5862009-12-04 22:16:48 +000077}