Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Can a dependent bundle trigger activation of a bundle it depends on?
Can a dependent bundle trigger activation of a bundle it depends on? [message #98602] Fri, 28 September 2007 09:35
Missing name Mising name is currently offline Missing name Mising nameFriend
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--
Previous Topic:Classloading differences between eclipse and standalone Equinox
Next Topic:Can't start application with Eclipse 3.3
Goto Forum:
  


Current Time: Fri Apr 26 11:59:04 GMT 2024

Powered by FUDForum. Page generated in 0.03369 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top