Wiki source code of Component Module

Version 3.1 by Vincent Massol on 2009/08/20 22:19

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}{{toc start="2" depth="3"/}}{{/box}}
2
3 = Component Module =
4
5 [[XWiki's Architecture>>platform:DevGuide.Architecture]] is based on [[Component-oriented Development>>http://en.wikipedia.org/wiki/Component-based_software_engineering]] (see also this [[Plexus Component Tutorial>>http://plexus.codehaus.org/ref/why-use-components.html]] to understand the benefits of using Components).
6
7 There are several Component Manager solutions out there for Java. To name a few:
8 * [[Guice>>http://code.google.com/p/google-guice/]]
9 * [[OSGi>>http://www.osgi.org/]]
10 * [[JSR291>>http://jcp.org/en/jsr/detail?id=291]], [[JSR277>>http://jcp.org/en/jsr/detail?id=277]], [[JSR294>>http://jcp.org/en/jsr/detail?id=294]], [[Project Jigsaw>>http://openjdk.java.net/projects/jigsaw/]]
11
12 XWiki has chosen to be independent of all existing Components Managers and instead to define some simple Component interfaces that can then be bound on any existing Component Manager. XWiki is currently implementing its own lightweight Component Manager with the idea to implement a [[Guice>>http://code.google.com/p/google-guice/]] bridge as soon as Guice starts implementing [[JSR299>>http://jcp.org/en/jsr/detail?id=299]]/[[JSR330>>http://jcp.org/en/jsr/detail?id=330]] annotations.
13
14 == Features ==
15
16 The Component Module defines the following features:
17 * Annotations to declare Component interfaces, Component implementations and Component dependencies (a.k.a as Component Requireements). Note that as soon as [[JSR299>>http://jcp.org/en/jsr/detail?id=299]]/[[JSR330>>http://jcp.org/en/jsr/detail?id=330]] become official we'll drop our annotations and use these instead.
18 * Ability to have Singleton Components and Per-lookup Components (a new instance is created when the component is retrieved)
19 * Ability to define a Hint to separate different Components implementations implementing the same Component interface.
20 * Automatic Field-based injection of Component Dependencies.
21 * Ability for Components to perform some initialization when they are instantiated.
22 * Ability for Components to log things.
23 * Component Events to be notified when a new Component is registered/unregistered in the system
24 * [Future] Ability to define Component Realms, i.e. the ability to isolate groups of components.
25
26 == Component Registration ==
27
28 TODO:
29 * annotations
30 * components.txt
31 * components-overrides.txt
32 * programatically using the CM
33
34 == Component Initialization ==
35
36 This is done by implementing the ##org.xwiki.component.phase.Initializable## interface. For example:
37
38 TODO
39
40 == Component Logging ==
41
42 TODO
43
44 == Tutorial ==
45
46 See the [["Writing a XWiki Component" tutorial>>platform:DevGuide.WritingComponents]].

Get Connected