On Thu, Dec 8, 2011 at 4:22 PM, ant elder <ant.el...@gmail.com> wrote:
> On Thu, Dec 8, 2011 at 10:57 AM, Simon Nash <n...@apache.org> wrote:
>> ant elder wrote:
>>>
>>> This is good and i will have a go in 2.x to see if a similar approach
>>> works there. But i can't help thinking its a slightly convoluted
>>> approach and as we have more flexibility in 2.x to add more APIs I
>>> wonder if we should just add a more direct API method to set the URIs
>>> with extra methods on Node, or also perhaps something like being able
>>> to do: ((TuscanyServiceReference)serviceReference).setURI(uri)?
>>>
>> +1 for providing a more convenient solution in 2.x.
>>
>> A setURI() method would only work for certain binding types.  Perhaps
>> this could be generalized to use some kind of notion of endpoint.
>>
>> There's also the mysterious wiredByImpl notion from the SCA spec.
>> It might be good to use that as the base concept for this capability.
>>
>
> Ok i had a quick stab at this in r1211944 and 1211945 which enables
> setting the binding URI of a ServiceReference by casting it to
> org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl and
> calling setBindingURI. Eg
>
>        ServiceReference<Helloworld> sr =
> componentContext.getServiceReference(Helloworld.class,
> "helloworldService");
>        
> ((ServiceReferenceImpl)sr).setBindingURI("http://localhost:8080/HelloworldService/Helloworld";);
>        return "client: " + sr.getService().sayHello(name);
>
> Obviously its not ideal to be casting to a that impl class and it
> should rather have an API/SPI interface to cast to. I haven't done a
> whole lot of testing but that that seems to work ok, can anyone see
> any obvious issues?
>
>   ...ant

Ant

I like the idea of being able to prod things into the service
reference. I have two immediate thoughts that are not well formed....

- Could we remove the cast by providing a Tuscany specific
ComponentContext for wireByImp impls. We already have the Tuscany
RuntimeComponentContext.
- Are there binding specific things we will want to do. Nothing comes
to mind just yet although policy configuration might be a possibility.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to