You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Nirmal Fernando <ni...@gmail.com> on 2011/07/26 11:26:19 UTC

Question on a child element of a component

Hi All,

If a <service> element present for a component, could I neglect 'class'
attribute value of <implementation.java> element, for the composite diagram
purposes?

____________________________________________________________________________________
eg:

*
<component name="SubtractServiceComponent">
        <implementation.java class="calculator.SubtractServiceImpl"/>
 </component>

For this, I'll add a service to "SubtractServiceComponent", since there are
no 'service' elements.

*
<component name="Catalog">
        <implementation.java class="services.FruitsCatalogImpl"/>
        <property name="currencyCode">USD</property>
        <service name="Catalog">
            <t:binding.jsonrpc/>
           </service>
        <reference name="currencyConverter" target="CurrencyConverter"/>
    </component>

For this "Catalog" component "Catalog" is the only service, that I'll be
added.

_________________________________________________________________________

Highly appreciate your thoughts!

Thanks.

-- 
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.

Blog: http://nirmalfdo.blogspot.com/

Re: Question on a child element of a component

Posted by Jean-Sebastien Delfino <js...@apache.org>.
On Fri, Jul 29, 2011 at 7:18 AM, Nirmal Fernando <ni...@gmail.com> wrote:
...
> So, what you say on following reasoning?
>
> eg:
>
> *
> <component name="
> SubtractServiceComponent">
>         <implementation.java class="calculator.SubtractServiceImpl"/>
>  </component>
>
> For this, I'll add a service to "SubtractServiceComponent", since there are
> no 'service' elements.
>
> *
> <component name="Catalog">
>         <implementation.java class="services.FruitsCatalogImpl"/>
>         <property name="currencyCode">USD</property>
>         <service name="Catalog">
>             <t:binding.jsonrpc/>
>            </service>
>         <reference name="currencyConverter" target="CurrencyConverter"/>
>     </component>
>
> For this "Catalog" component "Catalog" is the only service, that I'll be
> added.
>

Hi Nirmal,

Here are a few approaches for you to think about:

(a) If you want to show in the diagram all the services and
references, including the ones that are unwired, the only way to do
that is to introspect the component implementation, as the composite
document only contains optional configuration of (potentially a subset
of) the component implementation services and references.

(b) If you only want the diagram to show the services and references
that are wired or have their endpoints configured then it's much
easier, just follow the wires and show the services they're targeting
(which may not appear in the composite but you know they should be
shown as they're targets of wires), plus the service and references
elements that are actually configured in the composite.

(c) You could also make a simplifying assumption (as a step stone for
now) and only show one service per component. After all if a component
A is wired to component B to call some function in B's implementation,
it's not that important that it's wired to B's service foo, bar or
blah. Showing that A is wired to B is already pretty nice.

(d) Write a separate tool that introspects a component implementation
and generates a .componentType document declaring its services and
references (see the SCA assembly spec for what a .componentType
document looks like). Then in your diagram generator use that
.componentType document to know the shape of the component
implementation (its services and references) without having to dig
into the implementation itself.

Disclaimer: option (d) is probably not going to be very popular with
other people in the Tuscany project or the SCA spec group... as it
looks like both groups are slowly 'burying / not promoting' component
types but IMHO that would still be the best one. I'll be happy to
elaborate as to why I think that if you're interested in that
approach... but perhaps think about the other approaches first, in
particular (b) and (c) which are simpler.

Hope this helps.
-- 
Jean-Sebastien

Re: Question on a child element of a component

Posted by Nirmal Fernando <ni...@gmail.com>.
On Tue, Jul 26, 2011 at 10:32 PM, Raymond Feng <en...@gmail.com> wrote:

> Hi,
>
> It's the implementation class that dictates all the services it provide.
> The <service> element is used in the composite to further configure the
> service and the @name has to match what's introspected from the impl (in SCA
> term, the componentType). If no further configuration is needed, you don't
> have the list the service in the composite.
>

Thanks for your reply!

So, what you say on following reasoning?

eg:

*
<component name="
SubtractServiceComponent">
        <implementation.java class="calculator.SubtractServiceImpl"/>
 </component>

For this, I'll add a service to "SubtractServiceComponent", since there are
no 'service' elements.

*
<component name="Catalog">
        <implementation.java class="services.FruitsCatalogImpl"/>
        <property name="currencyCode">USD</property>
        <service name="Catalog">
            <t:binding.jsonrpc/>
           </service>
        <reference name="currencyConverter" target="CurrencyConverter"/>
    </component>

For this "Catalog" component "Catalog" is the only service, that I'll be
added.

Thanks.


>
> Thanks,
> Raymond
> *________________________________________________________________
> Raymond Feng
> rfeng@apache.org
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> ________________________________________________________________*
>
> On Jul 26, 2011, at 2:26 AM, Nirmal Fernando wrote:
>
> Hi All,
>
> If a <service> element present for a component, could I neglect 'class'
> attribute value of <implementation.java> element, for the composite diagram
> purposes?
>
>
> ____________________________________________________________________________________
> eg:
>
> *
> <component name="SubtractServiceComponent">
>         <implementation.java class="calculator.SubtractServiceImpl"/>
>  </component>
>
> For this, I'll add a service to "SubtractServiceComponent", since there are
> no 'service' elements.
>
> *
> <component name="Catalog">
>         <implementation.java class="services.FruitsCatalogImpl"/>
>         <property name="currencyCode">USD</property>
>         <service name="Catalog">
>             <t:binding.jsonrpc/>
>            </service>
>         <reference name="currencyConverter" target="CurrencyConverter"/>
>
>     </component>
>
> For this "Catalog" component "Catalog" is the only service, that I'll be
> added.
>
> _________________________________________________________________________
>
> Highly appreciate your thoughts!
>
> Thanks.
>
> --
> Best Regards,
> Nirmal
>
> C.S.Nirmal J. Fernando
> Department of Computer Science & Engineering,
> Faculty of Engineering,
> University of Moratuwa,
> Sri Lanka.
>
> Blog: http://nirmalfdo.blogspot.com/
>
>
>


-- 
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.

Blog: http://nirmalfdo.blogspot.com/

Re: Question on a child element of a component

Posted by Raymond Feng <en...@gmail.com>.
Hi,

It's the implementation class that dictates all the services it provide. The <service> element is used in the composite to further configure the service and the @name has to match what's introspected from the impl (in SCA term, the componentType). If no further configuration is needed, you don't have the list the service in the composite.

Thanks,
Raymond
________________________________________________________________ 
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________

On Jul 26, 2011, at 2:26 AM, Nirmal Fernando wrote:

> Hi All,
> 
> If a <service> element present for a component, could I neglect 'class' attribute value of <implementation.java> element, for the composite diagram purposes?
> 
> ____________________________________________________________________________________
> eg:
> 
> * 
> <component name="SubtractServiceComponent">
>         <implementation.java class="calculator.SubtractServiceImpl"/>
>  </component>
> 
> For this, I'll add a service to "SubtractServiceComponent", since there are no 'service' elements.
> 
> *
> <component name="Catalog">
>         <implementation.java class="services.FruitsCatalogImpl"/> 
>         <property name="currencyCode">USD</property>
>         <service name="Catalog">
>             <t:binding.jsonrpc/>
>            </service>
>         <reference name="currencyConverter" target="CurrencyConverter"/>    
>     </component> 
> 
> For this "Catalog" component "Catalog" is the only service, that I'll be added.
> 
> _________________________________________________________________________
> 
> Highly appreciate your thoughts!
> 
> Thanks.
> 
> -- 
> Best Regards,
> Nirmal
> 
> C.S.Nirmal J. Fernando
> Department of Computer Science & Engineering,
> Faculty of Engineering,
> University of Moratuwa,
> Sri Lanka.
> 
> Blog: http://nirmalfdo.blogspot.com/
>