Open main menu

CDOT Wiki β

Changes

Teams Winter 2011/team1/OSGI/Implement the Service Consumer

621 bytes added, 16:13, 16 February 2011
no edit summary
6. You should have three bundles now: <br />
[[Image: Consumer1.jpg | 300px ]]
<br/>7. Open your consumer's '''Activator''' and get the servers's reference in it's start() method: <br/>
<pre>
public void start(BundleContext context) throws Exception {
Activator.context = context;
ServiceReference reference = context
.getServiceReference(Ticketing.class.getName());
if (reference != null) {
tkg = (Ticketing) context.getService(reference);
</pre>
<br/>8. Add code for your GUI and use this service functionalities in it. In order to use it(reference) create a static field in your GUI: <br/>
<code>static Ticketing tkg;</code>
<br/>9.
1
edit