10
Copyright (c) Vincent Massol - 2011 XWiki XWiki’s component architecture September 2011 Wednesday, September 21, 11

XWiki Components Design Choices

Embed Size (px)

DESCRIPTION

A short presentation about XWiki's choices for its component model

Citation preview

Page 1: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

XWikiXWiki’s component architecture

September 2011

Wednesday, September 21, 11

Page 2: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Agenda

• Needs

• Discarded solutions

• Chosen solution

• Lessons learnt

• Future

Wednesday, September 21, 11

Page 3: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

XWiki Platform

... for developing (collaborative) web applications

Wednesday, September 21, 11

Page 4: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Needs (1/2)

• XWiki is a runtime development platform

• Need solution for code reuse

• Need solution to change behaviors

• Ability to install extensions transitively at runtime

• As standard as possible

Wednesday, September 21, 11

Page 5: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Needs (2/2)

• Ability to change implementation without changing existing components

Wednesday, September 21, 11

Page 6: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Discarded Solutions

• Warning: Choice done 2 years ago

• OSGi: too complex

• Resin Pomegranate: not standard enough

• Guice: static binding only

• CDI 1.0: static binding only

Wednesday, September 21, 11

Page 7: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Chosen Solution (1/2)

• XWiki’s own interfaces

• Implemented using Plexus initially

• Custom implementation after Plexus was EOLed

• Using JSR330’s annotations

• First focus: have components for everything

Wednesday, September 21, 11

Page 8: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Chosen Solution (2/2)@ComponentRolepublic interface Macro{    List<Block> execute();}

@Component@Named("message")@Singletonpublic class MessageMacro implements Macro{    @Inject    private Execution execution;

   @Inject    @Named("box")    private Macro boxMacro;

   public List<Block> execute()    {       ...    }}

org.xwiki.rendering.internal.macro.message.MessageMacro

META-INF/components.txt

Wednesday, September 21, 11

Page 9: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Lessons Learnt

• XWiki’s own interfaces have served us well

• Allowed us to switch from Plexus to our own implementation

• But... ready to use a standard as soon as one emerges!

• Would love to have CDI with OSGi classloading separation ;)

Wednesday, September 21, 11

Page 10: XWiki Components Design Choices

Copyright (c) Vincent Massol - 2011

Future

• Several possibilities

• Use CDI 1.1 when it’s out

• If it’s possible to perform dynamic bean registration/unregistration

• Use JDK’s proposed solution (JavaSE 8?)

• We have time...

Wednesday, September 21, 11