Blue Diamond wrote:
Thanks Guys!. My requirement is to inject a non-SCA object into a
singleton SCA service composite. So, as Simon explained, if a
setMyObject(my_non_sca_object) works on an SCA service reference, then
that does my job!
It should work as local as the interface containing setMyObject() is
a local interface (i.e., does't have the @Remotable annotation).
This restricts the methods of the interface to being called from
within the same JVM, which is exactly what you need.
Simon
Thanks & Regards,
Anil
On Thu, Feb 25, 2010 at 11:38 AM, Raymond Feng <enjoyj...@gmail.com
<mailto:enjoyj...@gmail.com>> wrote:
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 <mailto:gvnan...@gmail.com>
*Sent:* Wednesday, February 24, 2010 9:49 PM
*To:* user@tuscany.apache.org <mailto:user@tuscany.apache.org>
*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