felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1443046 - in /felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide: dive-into-the-ipojo-manipulation-depths.mdtext injection.png manipulation.png principles.png process.png
Date Wed, 06 Feb 2013 16:27:49 GMT
Author: clement
Date: Wed Feb  6 16:27:48 2013
New Revision: 1443046

URL: http://svn.apache.org/viewvc?rev=1443046&view=rev
Log:
migrate manipulation details to the new CMS system

Added:
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/injection.png
  (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/manipulation.png
  (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/principles.png
  (with props)
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/process.png
  (with props)
Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.mdtext

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.mdtext?rev=1443046&r1=1443045&r2=1443046&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.mdtext
(original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/dive-into-the-ipojo-manipulation-depths.mdtext
Wed Feb  6 16:27:48 2013
@@ -7,22 +7,20 @@ Title: Dive into the iPOJO Manipulation 
 
 iPOJO (primitive) components are managed using byte code manipulation. Don't be afraid, you
don't have to be fluent in byte code to understand components ☺. This page explains how
the manipulation works and how your class file is transformed. This manipulation takes care
to *NOT* change the behavior of the manipulated class.
 
-{div:class=toc}
 [TOC]
-{div}
 
 ## Why manipulate bundle byte code?
 
 The iPOJO byte code manipulation goals are two-fold:
 
-• Preparing classes to be managed at run time and
-• Translating XML or annotation metadata into an internal format to avoid run-time XML
and annotation parsing.
+* Preparing classes to be managed at run time and
+* Translating XML or annotation metadata into an internal format to avoid run-time XML and
annotation parsing.
 
-!process.png!
+<img src="process.png">
 
 iPOJO follows a container approach and more specially employs [inversion of control](http://en.wikipedia.org/wiki/Inversion*of*control)
and [dependency injections|http://en.wikipedia.org/wiki/Dependency_injection]. The iPOJO container
manages component instantiation and injection (service, properties and so on...). To inject
values and supervise the execution inside component implementation class, iPOJO uses an interception
and injection framework. To facilitate this, iPOJO uses class byte code manipulation. 
 
-!injection.png!
+<img src="injection.png">
 
 Besides manipulating byte code, iPOJO translates the XML or annotation metadata to an internal
syntax. This eliminates any run-time dependencies on the particular metadata format. 
 
@@ -30,11 +28,11 @@ Besides manipulating byte code, iPOJO tr
 
 For each class used as a component implementation class, the manipulation process prepares
the class to be managed at run time. This means providing the ability to intercept methods
and field accesses. This manipulation is independent of the component metadata. A component
class will always result in the same final manipulated class, regardless of its metadata.
This means it is possible to use a class as the implementation of several component types.
As illustrated in the following image, the manipulated class instance interacts with an instance
manager that delegates to handlers. The metadata impacts the set of handlers; it does not
impact the manipulated class, nor the instance manager (which is the iPOJO container foundation).
 
-!principles.png!
+<img src="principles.png">
 
 The following image explains what happens during the manipulation.
 
-!manipulation.png!
+<img src="manipulation.png">
 
 First, each manipulated class implements the `POJO` interface. This interface introduces
a method to get a reference to the instance container. So, you can detect whether an object
is managed by iPOJO by checking if the object implements this interface. A special field,
named `\*\*IM` is injected, which contains a reference to the instance container object (`InstanceManager`
at run time. 
 
@@ -48,7 +46,7 @@ Finally, the constructors are also manip
 
 The manipulation has a special behavior when a visible (at run time) method or constructor
annotation is detected. As the methods are replaced by private methods, the annotations are
moved to the iPOJO-generated methods, such as in:
 
-
+    :::java
     public class MyClass {
       @MyAnnotation
       public void myMethod() {
@@ -59,7 +57,7 @@ The manipulation has a special behavior 
 
 is transformed into:
 
-
+    :::java
     public class MyClass {
       @MyAnnotation
       public void myMethod() {
@@ -77,7 +75,8 @@ iPOJO does not use XML or annotations at
 If you want to see how XML or annotation metadata are *tortured*, just open the manifest
file of a manipulated bundle, and look at the `iPOJO-COMPONENTS` entry (and appreciate the
Lisp-like syntax :-))...
 
 ## Extending manipulator
-<div class="warning" markdown="1">
+
+<div class="alert alert-warning">
 This feature is only available in trunk at the moment (version 1.9.0-SNAPSHOT).
 It will be part of the upcoming Manipulator release (version 1.8.8)
 </div>
@@ -94,6 +93,7 @@ The solution is to extend the manipulato
 
 That can be done through the implementation of a `Module`:
 
+    :::java
     import org.apache.felix.ipojo.manipulator.spi.AbsBindingModule;
     import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory;
     import org.apache.felix.ipojo.manipulator.spi.BindingContext;
@@ -122,6 +122,7 @@ In the example case, when the `@Hello` a
 
 Here are the `@Hello` annotation and `HelloVisitor` class for better understanding:
 
+    :::java
     @Target(ElementType.TYPE)
     public @interface Hello {
         String name();
@@ -130,7 +131,7 @@ Here are the `@Hello` annotation and `He
 
 The `@Hello` annotation has a mandatory `name` attribute.
 
-
+    :::java
     public class HelloVisitor extends EmptyVisitor implements AnnotationVisitor {
     
         private Element hello = new Element("hello", "org.apache.felix.ipojo.sample");
@@ -169,6 +170,7 @@ Finally, in `visitEnd()`, we contribute 
 
 Last work to do: declare the new `Module` in a `META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module`
file:
 
+    :::sh
     org.apache.felix.ipojo.sample.SampleBindingModule
 
 
@@ -180,6 +182,7 @@ In ant, It's probably a matter of changi
 
 At the end, all this mechanics will help you to simply your code from:
 
+    :::xml
     <ipojo xmlns:s="org.apache.felix.ipojo.sample">
       <component ...>
         <s:hello name="Guillaume" />
@@ -188,6 +191,7 @@ At the end, all this mechanics will help
 
 with a non-annotated component's class:
 
+    :::java
     public class MyComponent {
         // ...
     }
@@ -195,6 +199,7 @@ with a non-annotated component's class:
 
 to a more elegant (and concise), with no XML:
 
+    :::java
     @Component
     @Hello(name = "Guillaume")
     public class MyComponent {

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/injection.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/injection.png?rev=1443046&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/injection.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/manipulation.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/manipulation.png?rev=1443046&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/manipulation.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/principles.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/principles.png?rev=1443046&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/principles.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/process.png
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/process.png?rev=1443046&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/site/trunk/content/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-devguide/process.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message