This article discusses how ZK can be used in an OSGi environment with an example demonstrating how you can develop a plug-in based application uisng OSGi bundles as base for plug-ins.
OSGi (Open Services Gateway initiative framework) allows Java applications to be written in a fully modular way - something that is not present in standalone Java environments as of 2011. Basically, OSGi allows the decoupling of each application concern into separate bundles. Bundles run concurrently in different kernels and by default are unaware of other bundles, their kernels and their classpaths.
Bundle services can be shared with other bundles via service registry and which is how bundles interact with each other. Each bundle has it's own classpath. Manifest files are used to define bundle meta-data, which packages from other bundles; determining which particular bundle is able to be used and which packages from this bundle should be exported for other bundles to use. OSGi keywords are: loose-coupling, hot deployment and versioning.
This example comes with three bundles:
- zk-osgi.blueprint - Contains interface which is shared with other 2 bundles
- zk-osgi.host - Host web application bundle
- zk-osgi.test-plugin - Test plug-in bundle
- ZK 5.0.9
- Spring 3.0.5
- Spring DM (Virgo provides)
- Hibernate 3.3.2.GA (with Ehcache as second level cache)