felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1443561 - in /felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components: configuration-handler.mdtext controller-lifecycle-handler.mdtext
Date Thu, 07 Feb 2013 15:37:02 GMT
Author: clement
Date: Thu Feb  7 15:37:01 2013
New Revision: 1443561

URL: http://svn.apache.org/viewvc?rev=1443561&view=rev
Log:
migrate page to new CMS

Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.mdtext
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.mdtext

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.mdtext?rev=1443561&r1=1443560&r2=1443561&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.mdtext
(original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/configuration-handler.mdtext
Thu Feb  7 15:37:01 2013
@@ -8,9 +8,7 @@ Title: Configuration Handler
 
 *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.*
 
-{div:class=toc}
 [TOC]
-{div}
 
 ## Configurable Properties
 
@@ -19,6 +17,7 @@ To support configuration, the component 
 ## Examples
 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 `updateArray`
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.
 
+    :::java
     @Component
     @Provides
     public class MyComponent implements MyService {
@@ -35,6 +34,7 @@ The following code depicts a simple conf
 
 The previous component can also be described using XML:
 
+    :::xml
     <component classname="...MyComponent">
        <provides>
            <property name="foo" field="m_foo"/>
@@ -49,6 +49,7 @@ The previous component can also be descr
 
 The instance contains the configuration:
 
+    :::xml
     <instance component="...MyComponent">
        <property name="foo" value="bar"/>
        <property name="array" value="{1, 2, 3}"/>
@@ -58,6 +59,7 @@ In the previous snippet, you can see thr
 
 By setting the attribute *propagation* to *"true"*, you allow the property propagation 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 `foo` will be published but `array` are also
published. To enable propagation use:
 
+    :::java
     @Component(propagation=true)
 
 
@@ -65,6 +67,7 @@ If a property has a method, this method 
 
 When an instance is reconfigured, an updated callback can also be called:
 
+    :::java
     @Updated
     public void updated() {
       // The instance was reconfigured
@@ -78,11 +81,13 @@ When an instance is reconfigured, an upd
 
 ## Exposing a Managed Service
 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.
+
 * In the `@Component` annotation the `managedservice` attribute defines the managed service
PID. In XML this is done using the `pid` attribute in the properties element (XML)
 * In the instance configuration by configuring the `managed.service.pid` property
 
 So, using annotation, you should use the `managedservice` attribute as follow:
 
+    :::java
     @Component(managedservice="my.pid")
     public class MyComponent {
     
@@ -91,6 +96,7 @@ So, using annotation, you should use the
 
 In XML, the `pid` attribute of the `properties` element does the same job.
 
+    :::xml
     <component classname="...MyComponent">
        <!-- ... -->
        <properties pid="my.pid"/>
@@ -101,14 +107,15 @@ In XML, the `pid` attribute of the `prop
 
 Finally, instance may configure the managed service using the `managed.service.pid` configuration
property:
 
+    :::xml
     <instance component="...MyComponent">
       <property name="managed.service.pid" value="my.pid.2"/>
     </instance>
 
 
-<div class="info" markdown="1">
-**Type vs. Instance configuration**
-If the managed service pid is specified both in the component type and in the instance configuration,
the instance configuration is used.
+<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>
 
 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).
@@ -123,6 +130,7 @@ Sometimes you need to be notified when a
 
 Updated callback are declared as follow using annotations:
 
+    :::java
     @Updated
     public void updated() {
       // The instance was reconfigured
@@ -134,8 +142,9 @@ Updated callback are declared as follow 
       // The instance was reconfigured, conf is the new configuration.
     }
     
-    In XML, the method name is given as an attribute of the {{properties}} element.
-    {code:xml}
+In XML, the method name is given as an attribute of the {{properties}} element.
+
+    :::xml
     <component className="...MyComponent">
        <!-- ... -->
        <properties updated="updated"/>
@@ -145,6 +154,3 @@ Updated callback are declared as follow 
 
 
 The callback is called *AFTER* the successful application of the reconfiguration.
-
-  
-  

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.mdtext?rev=1443561&r1=1443560&r2=1443561&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.mdtext
(original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/controller-lifecycle-handler.mdtext
Thu Feb  7 15:37:01 2013
@@ -7,9 +7,7 @@ Title: Controller Lifecycle Handler
 
 *The lifecycle controller allows a component implementation to participate to the instance
lifecycle. So, you can immediately decide to stop an instance if the configuration is incorrect
(correct properties, accessible resources...). The licecyel controller impacts the instance
lifecycle, if you want to impact only the registered service, have a look to the service controller
([service providing]({{ refs.felix-providing-osgi-services.path }})).*
 
-{div:class=toc}
 [TOC]
-{div}
 
 ## iPOJO instance lifecycle & Lifecycle controller
 
@@ -21,6 +19,7 @@ The lifecycle controller just monitors a
 
 Imagine the following component :
 
+    :::java
     @Component
     public class LifecycleControllerTest {
     
@@ -41,6 +40,7 @@ Imagine the following component :
 
 If you don't want to use annotations, the following snippet does the same job using XML:
 
+    :::xml
     <component 
        classname="org.apache.felix.ipojo.test.scenarios.component.LifecycleControllerTest">
     		<controller field="m_state"/>
@@ -50,7 +50,7 @@ If you don't want to use annotations, th
     </component>
 
 
-The component requires the `conf` property. iPOJO checks if this property is inside the pushed
configuration, but cannot checks if the configuration is correct according to the component
semantic. When the instance is created, the `setConf` method is called with the given value.
If the given `conf` property is "valid" the `m*state` field (i.e. the controller) is set to
`true`. Else, the `m*state` is set to `false`. It means that the lifecycle controller handler
becomes invalid and as a consequence, the instance becomes invalid.
+The component requires the `conf` property. iPOJO checks if this property is inside the pushed
configuration, but cannot checks if the configuration is correct according to the component
semantic. When the instance is created, the `setConf` method is called with the given value.
If the given `conf` property is "valid" the `m_state` field (i.e. the controller) is set to
`true`. Else, the `m_state` is set to `false`. It means that the lifecycle controller handler
becomes invalid and as a consequence, the instance becomes invalid.
   
   
   



Mime
View raw message