1. A Simple Plugin
Architecture for
Wicket
Niels van Kampenhout n.vankampenhout@hippo.nl
Wander Grevink w.grevink@hippo.nl
Wicket Meetup Amsterdam Nov 2007
A Simple Plugin Architecture for Wicket
2. The Intro
• Wicket newbies
• Easy to do cool things with Wicket
• We like feedback!
http://flickr.com/photos/openthreads/234957983/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
3. The Dream
• A pluggable GUI
http://flickr.com/photos/gilest/123760608/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
4. The Use Case
• Hippo CMS
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
5. The Use Case
• Open architecture
• Easily customizable, extendible
• But people want more...!
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
6. The Problem
• Poor customizability on GUI level
• Changing and recompiling core code necessary
http://flickr.com/photos/antware/1749436733/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
7. The Problem
• Many similar but slightly
different applications
• Copy paste
• Forks
http://flickr.com/photos/eqqman/454920412/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
8. The Problem
• Maintenance hell
• Support hell
http://flickr.com/photos/eqqman/54508927/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
9. The Solution
• Generic platform
• Building blocks
http://flickr.com/photos/chris-fritz/2011872018/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
10. The Solution
• Hippo CMS is just one possible configuration of plugins
http://flickr.com/photos/17271969@N00/16402704/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
11. The Solution
• You can adapt the configuration to your needs
http://flickr.com/photos/cryptic/294614661/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
12. The Solution
• Any other configuration of plugins is also possible
http://flickr.com/photos/liquidx/594302659/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
13. The Tool
• Wicket
http://flickr.com/photos/lifeasart/361147812/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
14. The Implementation
• Prototype
http://flickr.com/photos/bootload/439400044/
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
15. A Wicket page
public RootPanel() {
add(“list”, new ListPanel());
add(“tree”, new TreePanel());
add(“custom”, new SimplePanel());
}
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
16. A Wicket page using plugins
public RootPlugin() {
}
Configuration
root:
class = org.example.RootPlugin
children = {list, tree, custom}
list:
class = org.example.listPlugin
children = {}
custom:
class = org.example.simplePlugin
children = {}
tree:
[...]
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
17. Plugin configuration
• Data driven
Any data store, implement simple interface.
•
JCR repository (Jackrabbit)
•
• Static
Initial page setup
•
An application is an assembly of plugins
•
• Dynamic
Change plugin configuration at runtime
•
Can be triggered by any runtime condition
•
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
18. Global picture
• A library of Plugins
Plugins are specialized Panels
•
Plugins are packaged in separate jars
•
• Tiny core
Reads plugin configuration
•
Loads and assembles plugins
•
Manages inter-plugin communication (event based)
•
Core model classes
•
Abstract base classes for common GUI elements
•
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
19. What's next
• Load plugins from configuration data store
Jackrabbit repository classloader
•
Wicket upload plugin plugin
•
Add or change plugins at runtime
•
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007
20. Demo
• Change plugin configuration at runtime
Manually by filling in a form
•
Triggered by a runtime condition (user credentials)
•
A Simple Plugin Architecture for Wicket Wicket Meetup Amsterdam Nov 2007