blob: 0d7945a970cc7a1faab4c0a0c14847dc6635f527 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
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.
-->
<head>
<title>Apache Felix - Configuration Handler</title>
<link rel="icon" href="/res/favicon.ico">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="The most powerful component model for OSGi">
<link href="/ipojo/web/bootstrap/css/bootstrap-cerulean.css" rel="stylesheet">
<link href="/ipojo/web/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link href="/ipojo/web/bootstrap/css/font-awesome.min.css" rel="stylesheet">
<link href="/ipojo/web/style.css" rel="stylesheet">
<!-- Overide alert's colors -->
<link href="/ipojo/web/bootstrap/css/alert.css" rel="stylesheet">
<link rel="stylesheet" href="/ipojo/web/github.css" type="text/css" media="all">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/ipojo/web/bootstrap/js/bootstrap.min.js"></script>
</head>
<body data-spy="scroll" data-target=".subnav">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="/documentation/subprojects/apache-felix-ipojo.html">Apache Felix iPOJO</a>
<div class="nav-collapse" id="main-menu">
<ul class="nav" id="main-menu-left">
<li><a href="/documentation/subprojects/apache-felix-ipojo/ipojo-news.html">News</a></li>
<li><a href="http://felix.apache.org/downloads.cgi">Downloads</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Tutorials <b class="caret"></b></a>
<ul class="dropdown-menu" id="tutorials-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-why-choose-ipojo.html">Why choose iPOJO</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-successstories.html">Success stories</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-feature-overview.html">Features</a></li>
<li class="divider"></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-in-10-minutes.html">iPOJO in 10 minutes</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/how-to-use-ipojo-annotations.html">Using Annotations</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-hello-word-maven-based-tutorial.html">Maven tutorial</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-advanced-tutorial.html">Advanced tutorial</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/apache-felix-ipojo-dosgi.html">Using Distributed OSGi</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html">Application Composition</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Documentation <b class="caret"></b></a>
<ul class="dropdown-menu" id="user-guide-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/service-requirement-handler.html">Requiring a service</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/providing-osgi-services.html">Providing a service</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.html">Lifecycle management</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.html">Configuration</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/architecture-handler.html">Introspection</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.html">Impacting the lifecycle</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/injecting-bundle-context.html">Accessing the Bundle Context</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/apache-felix-ipojo-instances.html">Creating instances</a></li>
<li class="divider"></li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">External <em>handlers</em></a>
<ul class="dropdown-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html">Asynchronous communication</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ipojo-jmx-handler.html">JMX management</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/extender-pattern-handler.html">Extender pattern</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/white-board-pattern-handler.html">Whiteboard pattern</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/temporal-service-dependency.html">Temporal dependencies</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">Configuration Admin &amp; Factories</a>
<ul class="dropdown-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/combining-ipojo-and-configuration-admin.html">iPOJO and config admin</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/ipojo-factory-service.html">Using the iPOJO Factory service</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/how-to-use-ipojo-factories.html">Factories and Instances</a></li>
</ul>
</li>
<li class="divider"></li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">Advanced topics</a>
<ul class="dropdown-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/instance-vs-service-controller.html">Instance vs. Service Controllers</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/service-binding-interceptors.html">Service Binding Interceptors</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/using-xml-schemas.html">XML Schemas</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/apache-felix-ipojo-api.html">Using the iPOJO API</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/constructing-pojo-objects-with-factory-methods.html">Constructing service objects with factory methods</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/using-ipojo-introspection-api.html">Using the introspection API</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-testing-components.html">Testing components</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/using-stereotypes.html">Using @Stereotypes</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-eclipse-integration.html">Eclipse Integration</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/ipojo-extender-configuration.html">Configuring iPOJO's Extender</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-faq.html">FAQ</a></li>
<li class="divider"></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/how-to-write-your-own-handler.html">Handler development</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/how-to-use-ipojo-manipulation-metadata.html">Manipulation Metadata </a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.html">Dive into the iPOJO Manipulation depths</a></li>
<li><a href="http://felix.apache.org/ipojo/api/1.12.1">Javadoc</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown" id="tools-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Tools <b class="caret"></b></a>
<ul class="dropdown-menu" id="swatch-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-ant-task.html">Ant Task</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-maven-plug-in.html">Maven Plugin</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html">Architecture commands</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/apache-felix-ipojo-online-manipulator.html">Online Manipulator</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-webconsole-plugin.html">Webconsole plugin</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-karaf-feature.html">Apache Karaf Features</a></li>
</ul>
</li>
<li class="dropdown" id="community-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Community <b class="caret"></b></a>
<ul class="dropdown-menu" id="swatch-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/ipojo-support.html">Support</a></li>
<li><a href="http://www.apache.org/">ASF</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Sponsors</a></li>
</ul>
</li>
<li class="dropdown" id="misc-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Misc <b class="caret"></b></a>
<ul class="dropdown-menu" id="swatch-menu">
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-supportedvms.html">Supported JVMs</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-supportedosgi.html">Supported OSGi Implementations</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/articles-and-presentations.html">Article & Presentations</a></li>
<li><a href="/documentation/subprojects/apache-felix-ipojo/developing-camel-mediators-with-ipojo.html">Developping Camel mediators with iPOJO</a></li>
</ul>
</li>
</ul>
<ul class="nav pull-right" id="main-menu-right">
<li><a rel="tooltip" target="_blank" href="http://felix.apache.org">Apache Felix <i class="icon-share-alt"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="content">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<h1 id="configuration-handler">Configuration Handler<a class="headerlink" href="#configuration-handler" title="Permanent link">&para;</a></h1>
<p><em>This page presents how to configure component instances. This is managed by the configuration handler. This handler allows the configuration and dynamic reconfiguration of instances. A configuration is basically a set of couple (name, value). The name can be a field name or a property name associated to a field or/and a method. iPOJO also supports complex properties composed by maps, dictionaries, lists and arrays.</em></p>
<div class="toc">
<ul>
<li><a href="#configuration-handler">Configuration Handler</a><ul>
<li><a href="#configurable-properties">Configurable Properties</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#exposing-a-managed-service">Exposing a Managed Service</a></li>
<li><a href="#dynamic-reconfiguration-using-factories-or-managedservicefactories">Dynamic Reconfiguration using Factories or ManagedServiceFactories</a></li>
<li><a href="#being-notified-when-a-reconfiguration-is-completed">Being notified when a reconfiguration is completed</a></li>
</ul>
</li>
</ul>
</div>
<h2 id="configurable-properties">Configurable Properties<a class="headerlink" href="#configurable-properties" title="Permanent link">&para;</a></h2>
<p>To support configuration, the component type needs to declare which properties are configurable. These properties are not necessarily service properties but can be internal component properties.</p>
<h2 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">&para;</a></h2>
<p>The following code depicts a simple configurable component. The 'm_foo' field will be injected using the 'foo' property, and will also be exposed as a service property. The <code>updateArray</code> method is a 'setter' method where the 'array' property will be injected. Properties injected into field are available in the constructor, setter method are available only after the constructor.</p>
<div class="codehilite"><pre><span class="nd">@Component</span>
<span class="nd">@Provides</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyComponent</span> <span class="kd">implements</span> <span class="n">MyService</span> <span class="o">{</span>
<span class="nd">@Property</span><span class="o">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;.foo&quot;</span><span class="o">)</span>
<span class="kd">private</span> <span class="n">String</span> <span class="n">m_foo</span><span class="o">;</span>
<span class="kd">public</span> <span class="nf">MyComponent</span><span class="o">(</span><span class="nd">@Property</span> <span class="n">String</span> <span class="n">message</span><span class="o">)</span> <span class="o">{</span>
<span class="c1">//...</span>
<span class="o">}</span>
<span class="nd">@Property</span><span class="o">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;array&quot;</span><span class="o">)</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">updateArray</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">array</span><span class="o">)</span> <span class="o">{</span>
<span class="c1">//...</span>
<span class="o">}</span>
<span class="o">}</span>
</pre></div>
<p>The previous component can also be described using XML:</p>
<div class="codehilite"><pre><span class="nt">&lt;component</span> <span class="na">classname=</span><span class="s">&quot;...MyComponent&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;properties</span> <span class="na">propagation=</span><span class="s">&quot;false&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;.foo&quot;</span> <span class="na">field=</span><span class="s">&quot;m_foo&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;array&quot;</span> <span class="na">method=</span><span class="s">&quot;updateArray&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;message&quot;</span> <span class="na">constructor-index=</span><span class="s">&quot;1&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/properties&gt;</span>
<span class="nt">&lt;/component&gt;</span>
</pre></div>
<p>The instance contains the configuration:</p>
<div class="codehilite"><pre><span class="nt">&lt;instance</span> <span class="na">component=</span><span class="s">&quot;...MyComponent&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;foo&quot;</span> <span class="na">value=</span><span class="s">&quot;bar&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;array&quot;</span> <span class="na">value=</span><span class="s">&quot;{1, 2, 3}&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;message&quot;</span> <span class="na">value=</span><span class="s">&quot;hello&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/instance&gt;</span>
</pre></div>
<p>In the previous snippet, you can see three configurable properties. The first is a configurable property attached to the field 'foo' that is a service property too. The second is an array property attached to a method (updatArray). These three properties are configured by the instance configuration.</p>
<p>By default all properties that do not start with the <code>.</code> (such as <code>.foo</code>) are <em>propagated</em>. Thus, properties are propagated to the service registration. It means that at each time that the configuration of the instance is updated; all properties contained in the configuration are propagated to the service registrations. For example, in the previous example, not only <code>foo</code> will be published but <code>array</code> are also published. To disable propagation use:</p>
<div class="codehilite"><pre><span class="nd">@Component</span><span class="o">(</span><span class="n">propagation</span><span class="o">=</span><span class="kc">false</span><span class="o">)</span>
</pre></div>
<p>If a property has a method, this method is invoked each time that the property value changes (the method is called to push the initial value just after the constructor). The method receives one argument of the type of the property (an integer array in the example).</p>
<p>When an instance is reconfigured, an updated callback can also be called:</p>
<div class="codehilite"><pre><span class="nd">@Updated</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">updated</span><span class="o">()</span> <span class="o">{</span>
<span class="c1">// The instance was reconfigured</span>
<span class="o">}</span>
<span class="c1">// OR</span>
<span class="nd">@Updated</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">updated</span><span class="o">(</span><span class="n">Dictionary</span> <span class="n">conf</span><span class="o">)</span> <span class="o">{</span>
<span class="c1">// The instance was reconfigured, conf is the new configuration.</span>
<span class="o">}</span>
</pre></div>
<h2 id="exposing-a-managed-service">Exposing a Managed Service<a class="headerlink" href="#exposing-a-managed-service" title="Permanent link">&para;</a></h2>
<p>The ManagedService is a service specified in the OSGi Compendium. It allows reconfiguring an instance with the Configuration Admin. There is two way for an iPOJO instance to expose a Managed Service.</p>
<ul>
<li>In the <code>@Component</code> annotation the <code>managedservice</code> attribute defines the managed service PID. In XML this is done using the <code>pid</code> attribute in the properties element (XML)</li>
<li>In the instance configuration by configuring the <code>managed.service.pid</code> property</li>
</ul>
<p>So, using annotation, you should use the <code>managedservice</code> attribute as follow:</p>
<div class="codehilite"><pre><span class="nd">@Component</span><span class="o">(</span><span class="n">managedservice</span><span class="o">=</span><span class="s">&quot;my.pid&quot;</span><span class="o">)</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyComponent</span> <span class="o">{</span>
<span class="o">}</span>
</pre></div>
<p>In XML, the <code>pid</code> attribute of the <code>properties</code> element does the same job.</p>
<div class="codehilite"><pre><span class="nt">&lt;component</span> <span class="na">classname=</span><span class="s">&quot;...MyComponent&quot;</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- ... --&gt;</span>
<span class="nt">&lt;properties</span> <span class="na">pid=</span><span class="s">&quot;my.pid&quot;</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- ... --&gt;</span>
<span class="nt">&lt;/properties&gt;</span>
<span class="nt">&lt;/component&gt;</span>
</pre></div>
<p>Finally, instance may configure the managed service using the <code>managed.service.pid</code> configuration property:</p>
<div class="codehilite"><pre><span class="nt">&lt;instance</span> <span class="na">component=</span><span class="s">&quot;...MyComponent&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;managed.service.pid&quot;</span> <span class="na">value=</span><span class="s">&quot;my.pid.2&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/instance&gt;</span>
</pre></div>
<div class="alert alert-sucess" markdown="1">
<strong>Type vs. Instance configuration</strong>
<p>If the managed service pid is specified both in the component type and in the instance configuration, the instance configuration is used.</p>
</div>
<p>The managed service pid is the identifier used by the Configuration Admin to attach configuration to Managed Services. First this pid must be unique (as any pid in OSGi). Moreover, this pid cannot be the same one that the pid used in the Managed Service Factory to create the instance (if you use this way to create your instance).</p>
<p>When an instance is reconfigured with the Managed Service, the configuration is propagated if the propagation is enabled.</p>
<h2 id="dynamic-reconfiguration-using-factories-or-managedservicefactories">Dynamic Reconfiguration using Factories or ManagedServiceFactories<a class="headerlink" href="#dynamic-reconfiguration-using-factories-or-managedservicefactories" title="Permanent link">&para;</a></h2>
<p>iPOJO instances support dynamic reconfiguration. To reconfigure an instance you can use both iPOJO <code>Factory</code> and the <code>ManagedServiceFactory</code> services exposed by the factory of the targeted instance. By calling the method <em>reconfigure</em> or <em>update</em> (according of the service you use), the handler receive the new configuration and apply it. If the propagation is activated, the service registrations are updated too. If there is an <code>updated</code> callback, the callback is invoked.</p>
<h2 id="being-notified-when-a-reconfiguration-is-completed">Being notified when a reconfiguration is completed<a class="headerlink" href="#being-notified-when-a-reconfiguration-is-completed" title="Permanent link">&para;</a></h2>
<p>Sometimes you need to be notified when a reconfiguration is done (all setter method called). This can be done thanks to the <code>updated</code> attribute. This attribute specifies a method claeed when a configuration/reconfiguration is completed. This method receives a <code>Dictionary</code> containing the properties (pair <key,value>). Properties with no value are not in the received configuration.</p>
<p>Updated callback are declared as follow using annotations:</p>
<div class="codehilite"><pre><span class="nd">@Updated</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">updated</span><span class="o">()</span> <span class="o">{</span>
<span class="c1">// The instance was reconfigured</span>
<span class="o">}</span>
<span class="c1">// OR</span>
<span class="nd">@Updated</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">updated</span><span class="o">(</span><span class="n">Dictionary</span> <span class="n">conf</span><span class="o">)</span> <span class="o">{</span>
<span class="c1">// The instance was reconfigured, conf is the new configuration.</span>
<span class="o">}</span>
</pre></div>
<p>In XML, the method name is given as an attribute of the element.</p>
<div class="codehilite"><pre><span class="nt">&lt;component</span> <span class="na">className=</span><span class="s">&quot;...MyComponent&quot;</span><span class="nt">&gt;</span>
<span class="c">&lt;!-- ... --&gt;</span>
<span class="nt">&lt;properties</span> <span class="na">updated=</span><span class="s">&quot;updated&quot;</span><span class="nt">/&gt;</span>
<span class="c">&lt;!-- ... --&gt;</span>
<span class="nt">&lt;/properties&gt;</span>
<span class="nt">&lt;/Component&gt;</span>
</pre></div>
<p>The callback is called <em>AFTER</em> the successful application of the reconfiguration.</p>
</div>
</div>
<hr/>
<div class="container">
<footer id="footer">
<div class="row">
<div class="trademarkFooter span7">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project
logo are trademarks of The Apache Software Foundation. All other marks mentioned
may be trademarks or registered trademarks of their respective owners.
</div>
<div class="timestamp span3 offset2">
Rev. 1700393 by cziegeler on Tue, 1 Sep 2015 06:04:06 +0000
</div>
</div>
</footer>
</div>
</body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-1518442-4");
pageTracker._trackPageview();
} catch(err) {}
</script>
</html>