blob: d00dcf0594e041cd79df8767b8138939a9f72979 [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 */
Marcel Offermans8b93efa2010-07-02 18:27:21 +000012package org.apache.felix.dm;
Pierre De Ropddce5862009-12-04 22:16:48 +000013
Pierre De Ropddce5862009-12-04 22:16:48 +000014/**
15 * Configuration dependency that can track the availability of a (valid) configuration. To use
16 * it, specify a PID for the configuration. The dependency is always required, because if it is
17 * not, it does not make sense to use the dependency manager. In that scenario, simply register
Marcel Offermansfaaed472010-09-08 10:07:32 +000018 * your component as a <code>ManagedService(Factory)</code> and handle everything yourself. Also,
Pierre De Ropddce5862009-12-04 22:16:48 +000019 * only managed services are supported, not factories. There are a couple of things you need to
20 * be aware of when implementing the <code>updated(Dictionary)</code> method:
21 * <ul>
22 * <li>Make sure it throws a <code>ConfigurationException</code> when you get a configuration
23 * that is invalid. In this case, the dependency will not change: if it was not available, it
24 * will still not be. If it was available, it will remain available and implicitly assume you
25 * keep working with your old configuration.</li>
26 * <li>This method will be called before all required dependencies are available. Make sure you
27 * do not depend on these to parse your settings.</li>
28 * </ul>
29 *
30 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
31 */
Marcel Offermansfaaed472010-09-08 10:07:32 +000032public interface ConfigurationDependency extends Dependency, ComponentDependencyDeclaration
Pierre De Ropddce5862009-12-04 22:16:48 +000033{
34 ConfigurationDependency setCallback(String callback);
35
36 /**
37 * Sets the <code>service.pid</code> of the configuration you are depending on.
38 */
39 ConfigurationDependency setPid(String pid);
40
41 /**
42 * Sets propagation of the configuration properties to the service properties. Any additional
43 * service properties specified directly are merged with these.
44 */
45 ConfigurationDependency setPropagate(boolean propagate);
Pierre De Ropa0204f52010-03-06 22:23:57 +000046
47 /**
48 * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
49 * @return The label used to display the tab name where the properties are displayed (may be localized)
50 */
51 ConfigurationDependency setHeading(String heading);
52
53 /**
Pierre De Rop379ba3e2010-03-07 00:03:26 +000054 * A human readable description of the PID this configuration is associated with. Example: "Configuration for the PrinterService bundle".
55 * @return A human readable description of the PID this configuration is associated with (may be localized)
Pierre De Ropa0204f52010-03-06 22:23:57 +000056 */
57 ConfigurationDependency setDescription(String description);
58
59 /**
60 * Points to the basename of the Properties file that can localize the Meta Type informations.
Pierre De Ropa0204f52010-03-06 22:23:57 +000061 * The default localization base name for the properties is OSGI-INF/l10n/bundle, but can
62 * 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 +000063 * You can specify a specific localization basename file using this method (e.g. <code>setLocalization("person")</code>
64 * will match person_du_NL.properties in the root bundle directory.
Pierre De Ropa0204f52010-03-06 22:23:57 +000065 */
66 ConfigurationDependency setLocalization(String path);
67
68 /**
Pierre De Rop379ba3e2010-03-07 00:03:26 +000069 * Adds a MetaData regarding a given configuration property.
Pierre De Ropa0204f52010-03-06 22:23:57 +000070 */
71 ConfigurationDependency add(PropertyMetaData properties);
Marcel Offermans61a81142010-04-02 15:16:50 +000072
73 ConfigurationDependency setInstanceBound(boolean isInstanceBound);
Pierre De Ropddce5862009-12-04 22:16:48 +000074}