You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/04/15 09:43:52 UTC

svn commit: r1467884 - /felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/

Author: clement
Date: Mon Apr 15 07:43:52 2013
New Revision: 1467884

URL: http://svn.apache.org/r1467884
Log:
migrate the lifecycle handler documentation to the new CMS system

Added:
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/Callback.jpeg   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ComponentLifecycle.png   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callback.png   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callbackOnTransition.png   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/constructor.png   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/immediate.png   (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle.png   (with props)
Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.mdtext

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/Callback.jpeg
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/Callback.jpeg?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/Callback.jpeg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ComponentLifecycle.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ComponentLifecycle.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ComponentLifecycle.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callback.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callback.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callback.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callbackOnTransition.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callbackOnTransition.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/callbackOnTransition.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/constructor.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/constructor.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/constructor.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/immediate.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/immediate.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/immediate.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.mdtext?rev=1467884&r1=1467883&r2=1467884&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle-callback-handler.mdtext Mon Apr 15 07:43:52 2013
@@ -7,9 +7,7 @@ Title: Lifecycle Callback Handler
 
 *It is often necessary to create a POJO object as soon the instance becomes valid (i.e. required services are available). It is also often needed to be able to stop it nicely. This pages presents the iPOJO capabilities to achieve such actions. iPOJO allows you to invoke methods (callbacks) on the POJO object when instance's state changed. For example, it allows invoking a `start` method when the instance becomes valid and a `stop` method when the instance becomes invalid. It allows the creation of `immediate` component. This page presents how to use this handler.*
 
-{div:class=toc}
 [TOC]
-{div}
 
 ## Instance Lifecycle
 
@@ -17,18 +15,19 @@ iPOJO instances have a very simple lifec
 
 An instance starts and stops in the invalid state.
 
-!lifecycle.png|width=50%!
+<img src="lifecycle.png" width="25%">
 
 ## Lifecycle callback
 
 This handler supports two kinds of callback. The INVALID=>VALID callback are invoked when the instance becomes valid (at starting or when an event allows the instance to become valid). The VALID=>INVALID callback are invoked when the instance becomes invalid (at stopping or when an event invalids the instance).
 
-!callback.png!
+<img src="callback.png" width="10%">
 
 ## An example
 
 Let's take an example. The following class requires a FooService and has two lifecycle callbacks: start and stop.
 
+    :::java
     @Component
     @Instantiate
     public class Foo {
@@ -52,6 +51,7 @@ Let's take an example. The following cla
 
 You can also remove the annotations to use the XML format:
 
+    :::xml
     <component className="...Foo">
            <requires field="fs"/>
            <callback transition="validate" method="start"/>
@@ -67,6 +67,7 @@ The invoked methods have no argument, bu
 
 One usage of lifecycle callback is when the instance needs to create threads. Indeed, the thread can be created in the validate callback, and stopped in the invalidate method. The next class shows an example of a class handling a thread by using lifecycle callbacks.
 
+    :::java
     @Component
     @Instantiate
     public class HelloRequesterImpl implements Runnable {
@@ -107,6 +108,7 @@ One usage of lifecycle callback is when 
 ## Invalidate callbacks and services
 The invalidate callback has to be developed defensively. Indeed, inside this callback, it might be possible that a service is no more there (the departure of this service has thrown the instance invalidation, which calls the callback). So, you must check that the service is not `null` before using it:
 
+    :::java
     @Invalidate
     public void stop() {
       if (myservice != null) {
@@ -121,10 +123,11 @@ Thanks to the iPOJO synchronization mode
 
 An instance of an `immediate` component type is instantiated as soon it becomes valid. It means that, when the instance becomes valid, the constructor of the implementation class is called. This can replace the validate callback. However, it stills a difference between the immediate and the validate callback. The constructor is call only once time. The validate callback is re-called each time the instance becomes valid. Components that do not provide services are automatically set as immediate.
 
-!constructor.png!
+<img src="constructor.png">
 
 To set a component as immediate you must add the `immediate` attribute to `component`:
 
+    :::java
     @Component(immediate=true)
     @Instantiate
     public class MyComponent implements MyService {

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle.png?rev=1467884&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/lifecycle.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream