Dynamic PAR extension [message #1405417] |
Thu, 07 August 2014 05:55  |
Eclipse User |
|
|
|
Hi,
I'm new to Virgo and I would like to know if it's possible to dynamically (in production) extend a Plan ?
The idea is to have a "core" application and provide a plugin like mechanism where plugins can be added from the "core" application at runtime (like we can do in Confluence product)
Thanks for any feedback
|
|
|
Re: Dynamic PAR extension [message #1405425 is a reply to message #1405417] |
Thu, 07 August 2014 06:25   |
Eclipse User |
|
|
|
Hello,
the message is a bit confusing as the title refers to a PAR, but the body speaks about a PLAN.
In any case, assuming that PLAN is fine, unless you declare your PLAN as scoped, its content (exported packages, published OSGi services) will be visible to the whole container and similarly, bundles in the PLAN will be able to use OSGi services deployed by any other bundle included in any other non-scoped plan.
<?xml version="1.0" encoding="UTF-8"?>
<plan name="application.plan" version="1.0.0" scoped="false" atomic="true"
xmlns="http://www.springsource.org/schema/dm-server/plan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springsource.org/schema/dm-server/plan
http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
<artifact type="bundle" name="app.bundle.1"/>
<artifact type="bundle" name="app.bundle.2"/>
....
</plan>
So you could have your main application deployed as a non scoped plan.
When you want to hot-deploy a plug-in, just upload its bundles to a Virgo bundle repository (make sure it is declared as watched, see configuration/org.eclipse.virgo.repository.properties), then drop the plug-in plan in the pickup folder or upload it via the Virgo console and make sure it is not scoped aswell:
<?xml version="1.0" encoding="UTF-8"?>
<plan name="plugin.plan" version="1.0.0" scoped="false" atomic="true"
xmlns="http://www.springsource.org/schema/dm-server/plan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springsource.org/schema/dm-server/plan
http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
<artifact type="bundle" name="plugin.bundle.1"/>
...
</plan>
If your application code uses some dynamic discovery mechanism such as the OSGi Service Registry and ServiceTracker(s), blue-prints or the Equinox Registry, once the plug-in plan is deployed and its bundles activated the application bundles will be able to use the plug-in code.
Giamma.
[Updated on: Thu, 07 August 2014 06:25] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.25603 seconds