blob: 02aed1e32a90de719b3520e6f82b4c2c2132ab0c [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
* required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.dm;
/**
* Configuration dependency that can track the availability of a (valid) configuration. To use
* it, specify a PID for the configuration. The dependency is always required, because if it is
* not, it does not make sense to use the dependency manager. In that scenario, simply register
* your component as a <code>ManagedService(Factory)</code> and handle everything yourself. Also,
* only managed services are supported, not factories. There are a couple of things you need to
* be aware of when implementing the <code>updated(Dictionary)</code> method:
* <ul>
* <li>Make sure it throws a <code>ConfigurationException</code> when you get a configuration
* that is invalid. In this case, the dependency will not change: if it was not available, it
* will still not be. If it was available, it will remain available and implicitly assume you
* keep working with your old configuration.</li>
* <li>This method will be called before all required dependencies are available. Make sure you
* do not depend on these to parse your settings.</li>
* </ul>
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public interface ConfigurationDependency extends Dependency, ComponentDependencyDeclaration {
/**
* Sets the name of the callback method that should be invoked when a configuration
* is available. The contract for this method is identical to that of
* <code>ManagedService.updated(Dictionary) throws ConfigurationException</code>.
*
* @param callback the name of the callback method
*/
ConfigurationDependency setCallback(String callback);
/**
* Sets the <code>service.pid</code> of the configuration you are depending
* on.
*/
ConfigurationDependency setPid(String pid);
/**
* Sets propagation of the configuration properties to the service
* properties. Any additional service properties specified directly are
* merged with these.
*/
ConfigurationDependency setPropagate(boolean propagate);
/**
* The label used to display the tab name (or section) where the properties
* are displayed. Example: "Printer Service".
*
* @return The label used to display the tab name where the properties are
* displayed (may be localized)
*/
ConfigurationDependency setHeading(String heading);
/**
* A human readable description of the PID this configuration is associated
* with. Example: "Configuration for the PrinterService bundle".
*
* @return A human readable description of the PID this configuration is
* associated with (may be localized)
*/
ConfigurationDependency setDescription(String description);
/**
* Points to the basename of the Properties file that can localize the Meta
* Type informations. The default localization base name for the properties
* is OSGI-INF/l10n/bundle, but can be overridden by the manifest
* Bundle-Localization header (see core specification, in section
* Localization on page 68). You can specify a specific localization
* basename file using this method (e.g.
* <code>setLocalization("person")</code> will match person_du_NL.properties
* in the root bundle directory.
*/
ConfigurationDependency setLocalization(String path);
/**
* Adds a MetaData regarding a given configuration property.
*/
ConfigurationDependency add(PropertyMetaData properties);
/**
* Sets this dependency to be instance bound or not.
*
* @param isInstanceBound <code>true</code> if this dependency should be instance bound
*/
ConfigurationDependency setInstanceBound(boolean isInstanceBound);
}