Kevin Williams wrote:
I am interested in extending the current locate service capability to
support the location of services that may be running within the same
domain but a separate jvm.  The most straightforward approach  may be
to dynamically create and return a service reference using the same
Tuscany runtime elements that now create service references for
injection in support of the @reference annotation.

Any thoughts or pointers would be appreciated.

Thanks,

--Kevin

This sounds good to me. I guess you're talking about SCADomain.getService(targetComponentName/targetServiceName). We've been flip-flopping between locateService/getService a few times :) ... Here are a few more thoughts.

First here's how SCADomain.getService() currently works:
1. look for the target component model object in the in-memory domain composite kept in SCADomain
2. look for the target service on that component
3. find on that component the self-reference created for that service (these self-references are automatically created by CompositeBuilder for each service provided by a component)
4. create a CallableReference for that self-reference
5. get a proxy to the service from the CallableReference

Some pointers to code:
[1] and [2] -> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getServiceReference() [3] and [4] -> org.apache.tuscany.sca.core.component.ComponentContextImpl.createSelfReference()
[5] -> org.apache.tuscany.sca.core.component.CallableReferenceImpl

Now, when the target component/service runs in a different JVM, you won't have an in-memory model object representing it :( but that's not a big issue :) ... As you suggested you can simply create a local reference and bind it to the target service (assuming you know its binding type and endpoint URI), then proceed to get a CallableReference and a proxy for it as usual.

This gives us the following steps:
1. determine the binding type and endpoint URI of the target component/service you're looking for (I won't get into the details of how to do that here, as I think Simon is covering it in his distributed binding implementation) 2. dynamically create a reference for your target service and configure it with that binding and endpoint URI
3. perform steps [4] and [5] from above.

For step 2, org.apache.tuscany.sca.assembly.builder.impl.CompositeConfigurationBuilderImpl.createSelfReference() shows how to create a reference from a service.

Hope this helps.

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to