This Play! module intent to bring the power and the dynamism of OSGi into Play! applications.
The OSGi framework is embedded inside the Play OSGi module and is started/stopped with the framework. The OSGi framework used is Apache Felix.
Once started, the OSGi framework provides a shell services to interact with it. This shell is available via telnet protocole. Just type in a terminal :
telnet localhost 6666
and you will be able to interact with the OSGi framework. Type 'help' to know the availbale commands.
The Play OSGi module provide a way to autodeploy bundles. Once you application is started, just drop OSGi bundle in the 'autodeploy' folder at the root of your application.
An OSGi admin web console is available in the app using the Play OSGi module. It's available at : http://localhost:9000/osgi/admin
You can access the current bundle context with the following method :
BundleContext context = OSGi.bundleContext();
You can lookup OSGi services with the following methods :
MyService service = OSGi.service(MyService.class);
Iterable<MyService> services = OSGi.services(MyService.class, "(lang=*)");
You can lookup OSGi services with built-in dependency injection :
@Inject @OSGiService private MyService service;
@Inject @OSGiService("(lang=*)") private Iterable<MyService> services;