My favorites
|
Sign in
kcode
Sample code projects
Project Home
Downloads
Wiki
Issues
Source
Checkout
|
Browse
|
Changes
|
r75
Source path:
svn
/
trunk
/
osgi
/
HelloWorld
/
client
/
src
/
com
/
extensiblejava
/
hello
/
client
/
HelloConsumer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.extensiblejava.hello.client;
import com.extensiblejava.hello.service.HelloService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
public class HelloConsumer implements BundleActivator {
private ServiceTracker helloWorldTracker;
private HelloService helloService;
public void setService(HelloService helloService) {
this.helloService = helloService;
}
public void removeService() {
this.helloService = null;
}
public void start(BundleContext context) throws Exception {
helloWorldTracker = new ServiceTracker(context, HelloService.class.getName(), null);
helloWorldTracker.open();
HelloService hello = (HelloService) helloWorldTracker.getService();
if (hello == null) {
System.out.println("Hello service unavailable on HelloConsumer start");
} else {
System.out.println(hello.sayHello());
}
}
public void stop(BundleContext context) {
HelloService hello = (HelloService) helloWorldTracker.getService();
if (hello == null) {
System.out.println("Hello service unavailable on HelloConsumer stop");
} else {
System.out.println(hello.sayGoodbye());
}
helloWorldTracker.close();
}
}
Show details
Hide details
Change log
r11
by pragkirk on Mar 18, 2008
Diff
Initial checkin.
Go to:
/trunk/osgi/HelloWorld/build.xml
/trunk/osgi/HelloWorld/cache
...osgi/HelloWorld/cache/HelloWorld
...loWorld/cache/HelloWorld/bundle1
...che/HelloWorld/bundle1/bundle.id
...orld/bundle1/bundle.lastmodified
...lloWorld/bundle1/bundle.location
...oWorld/bundle1/bundle.startlevel
.../HelloWorld/bundle1/bundle.state
...he/HelloWorld/bundle1/version0.0
...ld/bundle1/version0.0/bundle.jar
...orld/bundle1/version0.0/embedded
...elloWorld/bundle1/version0.0/lib
...le1/version0.0/revision.location
...oWorld/cache/HelloWorld/bundle11
...he/HelloWorld/bundle11/bundle.id
...rld/bundle11/bundle.lastmodified
...loWorld/bundle11/bundle.location
...World/bundle11/bundle.startlevel
...HelloWorld/bundle11/bundle.state
...loWorld/bundle11/refresh.counter
...e/HelloWorld/bundle11/version3.0
...d/bundle11/version3.0/bundle.jar
...rld/bundle11/version3.0/embedded
...lloWorld/bundle11/version3.0/lib
...e11/version3.0/revision.location
...oWorld/cache/HelloWorld/bundle12
...he/HelloWorld/bundle12/bundle.id
...rld/bundle12/bundle.lastmodified
...loWorld/bundle12/bundle.location
...World/bundle12/bundle.startlevel
...HelloWorld/bundle12/bundle.state
...loWorld/bundle12/refresh.counter
...e/HelloWorld/bundle12/version3.0
...d/bundle12/version3.0/bundle.jar
...rld/bundle12/version3.0/embedded
...lloWorld/bundle12/version3.0/lib
...e12/version3.0/revision.location
...loWorld/cache/HelloWorld/bundle2
...che/HelloWorld/bundle2/bundle.id
...orld/bundle2/bundle.lastmodified
...lloWorld/bundle2/bundle.location
...oWorld/bundle2/bundle.startlevel
.../HelloWorld/bundle2/bundle.state
...he/HelloWorld/bundle2/version0.0
...ld/bundle2/version0.0/bundle.jar
...orld/bundle2/version0.0/embedded
...elloWorld/bundle2/version0.0/lib
...le2/version0.0/revision.location
...loWorld/cache/HelloWorld/bundle3
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1322 bytes, 46 lines
View raw file
File properties
svn:executable
Hosted by