Hi,
Are you trying to get a self reference to this composite-scoped service? If so,
you can do the following:
@Scope("COMPOSITE")
@Service(MySevice.class)
public class MyServiceImpl {
@Context
protected ComponentContext componentContext;
...
ServiceReference<MyService> ref =
componentContext.createSelfReference(MyService.class);
To get the service reference in another component, you can do:
@Reference
protected ServiceReference<MyService> myService; // It will be injected by
Tuscany if it's wired to MyService component.
Thanks,
Raymond
From: Blue Diamond
Sent: Wednesday, February 24, 2010 9:49 PM
To: [email protected]
Subject: object reference to a service
Hi,
I have a @scope(composite) annotated component (service). This is a singleton
for me (correct me if I am wrong) and no matter how many clients call the
service operations, its the same service instance that's going to handle them.
SCA API provides a way to obtain service reference to this component through
say SCANode.getServiceReference().
But is there a way I can obtain the object reference to this instantiated
service instance? I understand that SCA has boundaries, but is there any way by
which this can be done?
SCA creates a component, I want to obtain its object reference (I want to
inject some other non-SCA created object into it). Is this doable?
Thanks,
Anil