package sample.client; import org.osoa.sca.ComponentContext; import org.osoa.sca.ServiceReference; import sample.HelloService; /** * @version $Rev$ $Date$ */ public class BasicClient { private ComponentContext context; public void useComponentDirectly() { HelloService helloService = context.getService(HelloService.class, "helloService"); helloService.hello("World"); } public void useComponentViaReference() { ServiceReference ref = context.getServiceReference(HelloService.class, "helloService"); HelloService helloService = ref.getService(); helloService.hello("World"); ServiceReference ref2 = context.cast(helloService); } public void useReferenceDirectly() { HelloService helloService = context.getService(HelloService.class, "helloReference"); helloService.hello("World"); } public void useReferenceViaReference() { ServiceReference ref = context.getServiceReference(HelloService.class, "helloReference"); HelloService helloService = ref.getService(); helloService.hello("World"); ServiceReference ref2 = context.cast(helloService); } }