Wiki source code of Architecture 2.0

Last modified by Vincent Massol on 2024/11/19 16:12

Show last authors
1 {{toc start='2'/}}
2
3 == Executive Summary ==
4
5 {{error}}
6 Update 2009-08-21: Documented at:
7 * http://platform.xwiki.org/xwiki/bin/view/DevGuide/Architecture
8 * http://code.xwiki.org/xwiki/bin/view/Modules/ComponentModule
9 {{/error}}
10
11 Move to a component-oriented architecture.
12
13 == Rationale ==
14
15 Moving to a component-oriented architecture will yield the following benefits:
16
17 * Ability to decouple the different pieces of XWiki and make it more modular. This is good for extending XWiki. Right now it has reached a point where it's hard to extend without breaking something
18 * Make it easier to contribute to XWiki. With components, contributors do not have to understand the whole thing. They can focus on modifying the component of their choice without knowing the rest. It's also easier to extend the platform.
19 * Improve our tests. Component-orientation brings IOC and thus the ability to write unit tests more easily as the objects acted upon are passed to the component and thus can be easily mocked.
20 * Ability to create different distributions of XWiki easily: for example for mobile devices, for the P2P XWiki, etc. In the same topic, ability to embed XWiki in other software becomes possible
21 * Ability to dynamically load XWiki extensions (java classes, external jars, etc) without restarting XWiki. This feature is brought by the component managers.
22
23 == Proposal ==
24
25 {{html clean="false" wiki="true"}}
26 * Component-oriented architecture using a Component Manager
27 * Each component group (set of components for implementing a concept) is separated in its own build module and generates a JAR
28 * Make the component 100% independent of the Component Manager used
29 * Register the Component Manager using a Servlet Context Listener
30 * Question: Should we use existing components from the Component Manager implementation? If so the question is whether it'll work with other Component Managers?
31 * Packages:
32 ** com.xpn.xwiki.<component domain> (which BTW I'd like to change to org.xwiki.<component domain>). For example: com.xpn.xwiki.rendering, com.xpn.xwiki.logging, com.xpn.xwiki.storage, etc
33 ** A special com.xpn.xwiki.component package for storing classes/interfaces required by the component manager and for users. For example: Loggable, Configurable, etc + possibly component manager abstraction (in case for example we need to do lookups that'll work in Plexus, OSGi, etc).
34 ** Internal APIs go in com.xpn.xwiki.&lt;component domain&gt;.internal.*
35 *** Note: We can provide a Velocity Uberspector to prevent using internal packages if we want
36 * For components that have several implementations (for example renderers), separate the rendering component in one JAR and the various implementations in another JAR (one JAR per implementation). In Maven this means different build modules for each.
37
38 === Implementation Details ===
39
40 * Use Plexus as the Component Manager (each component JAR has a META-INF/components.xml file that configures Plexus). The reason for choosing Plexus:
41 ** Plexus supports full decoupling, i.e. it's possible not to have any plexus import in our component code. It's thus possible to switch to another component manager easily if need be
42 ** Plexus is a mature component manager
43 ** Jason Van Zyl (Plexus author) is willing to help XWiki migrate
44 ** Plexus is compatible with several other component managers (through its Personality feature), and an OSGi bridge is being developed too.
45 * Future: Make the components OSGi-compliant (each component JAR has a META-INF/Manifest with OSGi configuration in there)
46 * Start creating a branch in XWiki (xwiki/xwiki/branches/XWIKI_2_0) for working on this.
47 * Idea: It would be nice to merge back the work progressively (if possible) on the trunk. It might be possible as we have a public API which we could keep and only change the underlying implementation for now, thus preserving backward compatibility (except possibly for plugin writers but that's less of an issue IMO).
48
49 === List of Components Required ===
50
51 * Rendering and Renderers
52 * URL Management (Portlet, Servlet, XMLRPC, etc)
53 * Storage + Query/Search (JCR, DB/Hibernate, Subversion, etc)
54 * Authorization (JAAS, DB, etc)
55 * Authentication (JAAS, DB, LDAP, etc)
56 * User/Groups Services
57 * Document Services
58 * Configuration Services (dynamic configs in DB for example)
59 * Remote Calls Services (XMLRPC, SOAP, Email, etc)
60 * Attachment Services
61 * Statistics Services
62 * Cache Services
63 * Logging
64 * Wiki Services (like getWikis() for a farm, etc)
65 * Container Services (adaptation layer for Servlet, Portlet, etc)
66 * I18N Services
67 * Notifier Services (SMTP, IRC, SMS, etc)
68 * Scriptable API (the context/vcontext should be automatically populated)
69 <p/>
70 Lots of these services should offer extension points so that it's possible to write extensions against them. The idea is to remove the need for a Plugin interface that would list all the possible extension points. Instead it should be each component offering those extension points. Alternatively the extension would completely replace or wrap an existing component.
71 <p/>
72 [[image:xwiki-platform-components.png]]
73
74 === Todos ===
75
76 * Create Architecture diagram listing all components required
77 * Define the interface for each component
78 * Idea: Start with the Rendering component and the Renderers (Velocity, Radeox, Doxia, etc). Note: We need ordering as a page is going to be rendered in sequence by all the renderers (unless a renderer says not to continue the chaining)
79
80 == Links ==
81
82 * [[Plexus>>http://plexus.codehaus.org/]]
83 * [[Plexus five minute tutorial>>http://plexus.codehaus.org/guides/quick-start/getting-started.html]]
84 * Plexus Javadocs
85 * [[Plexus and Java annotations>>http://archive.plexus.codehaus.org/dev/45A29E89.7040109%2540j-hohwiller.de]]
86 * [[Plexus - Why use components>>http://plexus.codehaus.org/ref/why-use-components.html]]
87 * [[Brett Porter on Plexus and Maven dependency model versus OSGi's>>http://blogs.maven.org/brett/2006/07/02/1151822691026.html]]
88 * [[Introduction to IOC>>http://today.java.net/pub/a/today/2004/02/10/ioc.html]]
89 * [[IOC by Martin Fowler>>http://www.martinfowler.com/articles/injection.html]]
90 * Component life-cycle management - Plexus versus OSGi: http://www.mail-archive.com/[email protected]/msg10441.html http://www.mail-archive.com/[email protected]/msg06460.html
91 * [[OSGi>>http://www.osgi.org]]
92 <p/>
93
94 {{/html}}

Get Connected