Can a dependent bundle trigger activation of a bundle it depends on? [message #98602] |
Fri, 28 September 2007 09:35 |
Missing name Mising name Messages: 18 Registered: July 2009 |
Junior Member |
|
|
------=_Part_5724_871638462.1190972202376
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Problem Brief:
--------------
Is there any way in which a dependent bundle can trigger activation of a bundle it depends on?
Description:
------------
i am using org.eclipse.equinox.ds_1.0.0.v20070226.jar and developing using Eclipse RCP 3.3.
i have 2 bundles A and B. Bundle A has an interface class A and an implementation class AImpl. Bundle B has an interface class B and an implementation class BImpl. BImpl has an object of AImpl as an attribute. OSGi declarative services are being used (sample XML files attached).
A client invokes a method (say doSomething()) on interface B. Call goes to BImpl. This method uses the service provided by Bundle A. Bundle A is not activated. Is there any way in which bundle A can be automatically activated when Bundle B needs it? Bundle A is not to be activated on startup of the app, only when Bundle B needs it. i think not (as this would go against the whiteboard pattern), but any pointers are greatly appreciated.
Please refer to the attached DS XML files...
Java class in Bundle B:
-----------------------
public class BImpl implements B {
private A a;
// bind method declared in DS XML
protected void setA(A obj) {
this.a = obj;
}
.....
.....
public void doSomething() {
a.someMethod();
}
.....
.....
}
TIA,
Kind Regards,
-abhi
------=_Part_5724_871638462.1190972202376
Content-Type: application/octet-stream; name=a.xml
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=a.xml
<?xml version="1.0"?>
<component name="A">
<implementation class="a.impl.AImpl"/>
<service>
<provide interface="a.A"/>
</service>
</component>
------=_Part_5724_871638462.1190972202376
Content-Type: application/octet-stream; name=b.xml
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=b.xml
<?xml version="1.0"?>
<component name="B">
<implementation class="b.impl.BImpl"/>
<service>
<provide interface="b.B"/>
</service>
<reference name="ADependency"
interface="a.A"
bind="setA"
cardinality="0..1"
policy="dynamic"/>
</component>
------=_Part_5724_871638462.1190972202376--
|
|
|
Powered by
FUDForum. Page generated in 0.02798 seconds