You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Scott Kurz <sc...@gmail.com> on 2008/04/04 21:35:04 UTC

How can I get wireTarget operation from service-side binding impl?

This question is especially for Raymond,

In trying to invoke the mediator from a service-side binding impl, I have a
need to get the wireTarget operation (to pass to the mediator).

I was wondering what the downside would be of caching the operation from the
service contract which I'd get in the same way we get
the wireTarget contract on the service side:

        // FIXME: [rfeng] We might need a better way to get the impl
interface contract
        Service targetService = service.getService();
        if (targetService == null) {
            targetService = service;
        }
        InterfaceContract targetContract =
targetService.getInterfaceContract().makeUnidirectional(false);

Now... we do the analogous thing on the reference side to build the
wireSource contract.   Is there some significant difference that
makes this more complicated on the service side, or does one just happen to
have a FIXME on it but not the other.

Just curious if anyone knew that maybe there is some gotcha or issue lurking
here....

I do recognize the asymmetry in the fact that, on the reference side, you
start in your binding with a binding invoker mapped onto from the key of the
wireSource
operation, whereas on the service side you can start in your binding with
any old Operation with the right name, and the InterfaceContractMapper will
allow you
to match the right one on the wire..... but I'm not sure that matters.

On a separate but related note, I was also wondering if we do actually have
any cases where we have a component service or reference but the
componentType/impl
service or reference is null.   The code I've been referring to typically
allows for this situation.  Though it seems problematic to me, I can vaguely
imagine what that would look like,
and was wondering if we have any examples of that today.


Thanks,
Scott

Re: How can I get wireTarget operation from service-side binding impl?

Posted by Raymond Feng <en...@gmail.com>.
Please see my comments inline.

Thanks,
Raymond
--------------------------------------------------
From: "Scott Kurz" <sc...@gmail.com>
Sent: Friday, April 04, 2008 12:35 PM
To: <tu...@ws.apache.org>
Subject: How can I get wireTarget operation from service-side binding impl?

> This question is especially for Raymond,
>
> In trying to invoke the mediator from a service-side binding impl, I have 
> a
> need to get the wireTarget operation (to pass to the mediator).

Is the code in your implementation class of ServiceBindingProvider? If so, I 
assume the binding should have the logic to tell which operation
the request is made. For example, you might have the java method or 
operation name. Then the binding provider is responsible to find the 
corresponding target operation for the component/service. You can match 
against the 
componentService.getInterfaceContract().getInterface().getOperations().

>
> I was wondering what the downside would be of caching the operation from 
> the
> service contract which I'd get in the same way we get
> the wireTarget contract on the service side:
>
>        // FIXME: [rfeng] We might need a better way to get the impl
> interface contract
>        Service targetService = service.getService();
>        if (targetService == null) {
>            targetService = service;
>        }
>        InterfaceContract targetContract =
> targetService.getInterfaceContract().makeUnidirectional(false);
>
> Now... we do the analogous thing on the reference side to build the
> wireSource contract.   Is there some significant difference that
> makes this more complicated on the service side, or does one just happen 
> to
> have a FIXME on it but not the other.
>

Maybe I just had a FIXME here, not on the reference side. :-)

> Just curious if anyone knew that maybe there is some gotcha or issue 
> lurking
> here....
>
> I do recognize the asymmetry in the fact that, on the reference side, you
> start in your binding with a binding invoker mapped onto from the key of 
> the
> wireSource
> operation, whereas on the service side you can start in your binding with
> any old Operation with the right name, and the InterfaceContractMapper 
> will
> allow you
> to match the right one on the wire..... but I'm not sure that matters.
>
> On a separate but related note, I was also wondering if we do actually 
> have
> any cases where we have a component service or reference but the
> componentType/impl
> service or reference is null.   The code I've been referring to typically
> allows for this situation.  Though it seems problematic to me, I can 
> vaguely
> imagine what that would look like,
> and was wondering if we have any examples of that today.

We issue warnings for the case that a component reference or service doesn't 
have the definitions in the componentType. As shown below, it's a user 
error.

<component name="...">
    <reference name="myRef" .../>
</component>

But in the component impl, there is no reference "myRef" is defined.

There is a debate recently on what actions the runtime should take (warning, 
exception ...) on the ML.

>
>
> Thanks,
> Scott
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org