Changes

Jump to: navigation, search

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

988 bytes added, 16:28, 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(get it from repository [https://ecl500_111a11:pmGN9329@zenit.senecac.on.ca/svn/ecl500_111rep1/Lab2/branches/Consumer/] ) 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. Run your consumer. ''Right click -> Run as -> Run Configuration... -> OSGi Framework''. Select all three bundles and click Add Required bundles. Click ''OK''
<br/>10. Now you can test your provider services:<br/>
[[Image: Consumer2.jpg | 500px]]
1
edit

Navigation menu