blob: f2ef85716673edcbc92331cd4488eb08da9ea1b6 (
plain)
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
|
package sample.client;
import org.osoa.sca.ComponentContext;
import sample.HelloService;
/**
* @version $Rev$ $Date$
*/
public class ReallyBasicClient {
/**
* <composite name="impl2">
* <component name="comp2a">
* <implementation.unmanaged/>
* <reference name="helloService" target="hello"/>
* </component>
*
* <component name="hello">
* <implementation.java class="sample.HelloServiceImpl"/>
* </component>
* </composite>
*/
public static void main(String[] args) {
ComponentContext context = getComponentContext();
// access a service through its reference
HelloService helloService = context.getService(HelloService.class, "helloService");
helloService.hello("World");
}
public static ComponentContext getComponentContext() {
// implementation defined mechanism to retrieve appropriate ComponentContext
throw new UnsupportedOperationException();
}
}
|