Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 1 | /* |
| 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 Offermans | 8b93efa | 2010-07-02 18:27:21 +0000 | [diff] [blame] | 12 | package org.apache.felix.dm; |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 13 | |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 14 | /** |
| 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 Offermans | faaed47 | 2010-09-08 10:07:32 +0000 | [diff] [blame] | 18 | * your component as a <code>ManagedService(Factory)</code> and handle everything yourself. Also, |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 19 | * 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 Offermans | faaed47 | 2010-09-08 10:07:32 +0000 | [diff] [blame] | 32 | public interface ConfigurationDependency extends Dependency, ComponentDependencyDeclaration |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 33 | { |
| 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 Rop | a0204f5 | 2010-03-06 22:23:57 +0000 | [diff] [blame] | 46 | |
| 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 Rop | 379ba3e | 2010-03-07 00:03:26 +0000 | [diff] [blame] | 54 | * 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 Rop | a0204f5 | 2010-03-06 22:23:57 +0000 | [diff] [blame] | 56 | */ |
| 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 Rop | a0204f5 | 2010-03-06 22:23:57 +0000 | [diff] [blame] | 61 | * 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 Rop | 379ba3e | 2010-03-07 00:03:26 +0000 | [diff] [blame] | 63 | * 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 Rop | a0204f5 | 2010-03-06 22:23:57 +0000 | [diff] [blame] | 65 | */ |
| 66 | ConfigurationDependency setLocalization(String path); |
| 67 | |
| 68 | /** |
Pierre De Rop | 379ba3e | 2010-03-07 00:03:26 +0000 | [diff] [blame] | 69 | * Adds a MetaData regarding a given configuration property. |
Pierre De Rop | a0204f5 | 2010-03-06 22:23:57 +0000 | [diff] [blame] | 70 | */ |
| 71 | ConfigurationDependency add(PropertyMetaData properties); |
Marcel Offermans | 61a8114 | 2010-04-02 15:16:50 +0000 | [diff] [blame] | 72 | |
| 73 | ConfigurationDependency setInstanceBound(boolean isInstanceBound); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 74 | } |