You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Luciano Resende <lu...@gmail.com> on 2007/01/21 21:03:24 UTC

Patch for Tuscany-914, was Re: Help on handling duplicated components via include files.

I have attached a patch for Tuscany-914 issue :
http://issues.apache.org/jira/browse/TUSCANY-914

Please, someone more familiar with the kernel area, take a quick look before
I check it in.

-- 
Luciano Resende
http://people.apache.org/~lresende

On 1/19/07, Luciano Resende <lu...@gmail.com> wrote:
>
> Hi All
>
>    Issue TUSCANY-914 is about handling duplicated component defined using
> include SCDL files. The current behavior is that, the latest overrides
> previous defined components, and this cause some side effects like
> overriding properties values, etc. The JIRA suggests that an exception is
> thrown. Looking at the Assembly spec 0.96, looks like the duplication
> should be consider as an error, so please correct me if I'm wrong (and if
> I'm wrong, disregard the rest of this e-mail :)   )
>
>    I'm trying to find the right place to handle these duplicated
> components, so far, I have tried compositeLoader.load and
> compositeComponentType.add(componentDefinition), this last one was the
> more promissor one, but looks like when loading the SCDL from my application
> (the one that has the duplicated components) the compositeComponentType does
> not find a previous component with the same name, even navigating trough all
> the includes...
>
>    Here is a debug code I was adding to the add method, to transverse all
> the components :
>
>     public void add(ComponentDefinition<? extends Implementation<?>>
> componentDefinition) {
>         //lresende - check for duplicated components
>         System.out.println("=====================");
>         System.out.println("Include : ");
>
>         for (Include i : includes.values()) {
>             System.out.println("   - " + i.getName());
>
>             Iterator itComponents = i.getIncluded
> ().getComponents().values().iterator();
>             while(itComponents.hasNext()){
>                 ComponentDefinition<? extends Implementation<?>> component
> = (ComponentDefinition<? extends Implementation<?>>) itComponents.next();
>                 System.out.println("   -   - " + component.getName());
>             }
>         }
>
>         System.out.println("Adding component : " +
> componentDefinition.getName ());
>         if(components.containsKey(componentDefinition.getName()))
>             System.out.println("Duplicated component : " +
> componentDefinition.getName());
>
>         if(componentNameList.containsKey (componentDefinition.getName()))
>             System.out.println("Duplicated component : " +
> componentDefinition.getName());
>
>         components.put(componentDefinition.getName(),
> componentDefinition);
>     }
>
>
>    As a result, i was getting something like :
>
> Adding component : localBindingLoader
> =====================
> Include :
>    - org.apache.tuscany.core.JavaImplementation
>    -   - java.componentBuilder
>    -   - java.implementationLoader
>    -   - java.componentTypeLoader
>    - org.apache.tuscany.core.InterfaceJava
>    -   - interfaceJava.loader
>    ...........
> Adding component : localBindingBuilder
> =====================
> Include :
> Adding component : HelloComponent
> =====================
> Include :
> Adding component : HelloComponent
> Hello2
>
>
>    Would you guys help me understand this load phase little better, and
> where would be a better place for me to try to handle these duplicated
> components ?
>
> --
> Luciano Resende
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>

Re: Patch for Tuscany-914, was Re: Help on handling duplicated components via include files.

Posted by Luciano Resende <lu...@gmail.com>.
Thanks Raymond, Jim also took a first look and sent some suggested changes
that I'm about to attach on a second patch. Please wait for the second patch
if you are also going to take a look at it.

-- 
Luciano Resende
http://people.apache.org/~lresende

On 1/21/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi, Luciano.
>
> I'll review it.
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Luciano Resende" <lu...@gmail.com>
> To: "tuscany-dev" <tu...@ws.apache.org>
> Sent: Sunday, January 21, 2007 12:03 PM
> Subject: Patch for Tuscany-914, was Re: Help on handling duplicated
> components via include files.
>
>
> >I have attached a patch for Tuscany-914 issue :
> > http://issues.apache.org/jira/browse/TUSCANY-914
> >
> > Please, someone more familiar with the kernel area, take a quick look
> > before
> > I check it in.
> >
> > --
> > Luciano Resende
> > http://people.apache.org/~lresende
> >
> > On 1/19/07, Luciano Resende <lu...@gmail.com> wrote:
> >>
> >> Hi All
> >>
> >>    Issue TUSCANY-914 is about handling duplicated component defined
> using
> >> include SCDL files. The current behavior is that, the latest overrides
> >> previous defined components, and this cause some side effects like
> >> overriding properties values, etc. The JIRA suggests that an exception
> is
> >> thrown. Looking at the Assembly spec 0.96, looks like the duplication
> >> should be consider as an error, so please correct me if I'm wrong (and
> if
> >> I'm wrong, disregard the rest of this e-mail :)   )
> >>
> >>    I'm trying to find the right place to handle these duplicated
> >> components, so far, I have tried compositeLoader.load and
> >> compositeComponentType.add(componentDefinition), this last one was the
> >> more promissor one, but looks like when loading the SCDL from my
> >> application
> >> (the one that has the duplicated components) the compositeComponentType
> >> does
> >> not find a previous component with the same name, even navigating
> trough
> >> all
> >> the includes...
> >>
> >>    Here is a debug code I was adding to the add method, to transverse
> all
> >> the components :
> >>
> >>     public void add(ComponentDefinition<? extends Implementation<?>>
> >> componentDefinition) {
> >>         //lresende - check for duplicated components
> >>         System.out.println("=====================");
> >>         System.out.println("Include : ");
> >>
> >>         for (Include i : includes.values()) {
> >>             System.out.println("   - " + i.getName());
> >>
> >>             Iterator itComponents = i.getIncluded
> >> ().getComponents().values().iterator();
> >>             while(itComponents.hasNext()){
> >>                 ComponentDefinition<? extends Implementation<?>>
> >> component
> >> = (ComponentDefinition<? extends Implementation<?>>) itComponents.next
> ();
> >>                 System.out.println("   -   - " + component.getName());
> >>             }
> >>         }
> >>
> >>         System.out.println("Adding component : " +
> >> componentDefinition.getName ());
> >>         if(components.containsKey(componentDefinition.getName()))
> >>             System.out.println("Duplicated component : " +
> >> componentDefinition.getName());
> >>
> >>         if(componentNameList.containsKey (componentDefinition.getName
> ()))
> >>             System.out.println("Duplicated component : " +
> >> componentDefinition.getName());
> >>
> >>         components.put(componentDefinition.getName(),
> >> componentDefinition);
> >>     }
> >>
> >>
> >>    As a result, i was getting something like :
> >>
> >> Adding component : localBindingLoader
> >> =====================
> >> Include :
> >>    - org.apache.tuscany.core.JavaImplementation
> >>    -   - java.componentBuilder
> >>    -   - java.implementationLoader
> >>    -   - java.componentTypeLoader
> >>    - org.apache.tuscany.core.InterfaceJava
> >>    -   - interfaceJava.loader
> >>    ...........
> >> Adding component : localBindingBuilder
> >> =====================
> >> Include :
> >> Adding component : HelloComponent
> >> =====================
> >> Include :
> >> Adding component : HelloComponent
> >> Hello2
> >>
> >>
> >>    Would you guys help me understand this load phase little better, and
> >> where would be a better place for me to try to handle these duplicated
> >> components ?
> >>
> >> --
> >> Luciano Resende
> >> http://people.apache.org/~lresende <
> http://people.apache.org/%7Elresende>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Patch for Tuscany-914, was Re: Help on handling duplicated components via include files.

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

I'll review it.

Thanks,
Raymond

----- Original Message ----- 
From: "Luciano Resende" <lu...@gmail.com>
To: "tuscany-dev" <tu...@ws.apache.org>
Sent: Sunday, January 21, 2007 12:03 PM
Subject: Patch for Tuscany-914, was Re: Help on handling duplicated 
components via include files.


>I have attached a patch for Tuscany-914 issue :
> http://issues.apache.org/jira/browse/TUSCANY-914
>
> Please, someone more familiar with the kernel area, take a quick look 
> before
> I check it in.
>
> -- 
> Luciano Resende
> http://people.apache.org/~lresende
>
> On 1/19/07, Luciano Resende <lu...@gmail.com> wrote:
>>
>> Hi All
>>
>>    Issue TUSCANY-914 is about handling duplicated component defined using
>> include SCDL files. The current behavior is that, the latest overrides
>> previous defined components, and this cause some side effects like
>> overriding properties values, etc. The JIRA suggests that an exception is
>> thrown. Looking at the Assembly spec 0.96, looks like the duplication
>> should be consider as an error, so please correct me if I'm wrong (and if
>> I'm wrong, disregard the rest of this e-mail :)   )
>>
>>    I'm trying to find the right place to handle these duplicated
>> components, so far, I have tried compositeLoader.load and
>> compositeComponentType.add(componentDefinition), this last one was the
>> more promissor one, but looks like when loading the SCDL from my 
>> application
>> (the one that has the duplicated components) the compositeComponentType 
>> does
>> not find a previous component with the same name, even navigating trough 
>> all
>> the includes...
>>
>>    Here is a debug code I was adding to the add method, to transverse all
>> the components :
>>
>>     public void add(ComponentDefinition<? extends Implementation<?>>
>> componentDefinition) {
>>         //lresende - check for duplicated components
>>         System.out.println("=====================");
>>         System.out.println("Include : ");
>>
>>         for (Include i : includes.values()) {
>>             System.out.println("   - " + i.getName());
>>
>>             Iterator itComponents = i.getIncluded
>> ().getComponents().values().iterator();
>>             while(itComponents.hasNext()){
>>                 ComponentDefinition<? extends Implementation<?>> 
>> component
>> = (ComponentDefinition<? extends Implementation<?>>) itComponents.next();
>>                 System.out.println("   -   - " + component.getName());
>>             }
>>         }
>>
>>         System.out.println("Adding component : " +
>> componentDefinition.getName ());
>>         if(components.containsKey(componentDefinition.getName()))
>>             System.out.println("Duplicated component : " +
>> componentDefinition.getName());
>>
>>         if(componentNameList.containsKey (componentDefinition.getName()))
>>             System.out.println("Duplicated component : " +
>> componentDefinition.getName());
>>
>>         components.put(componentDefinition.getName(),
>> componentDefinition);
>>     }
>>
>>
>>    As a result, i was getting something like :
>>
>> Adding component : localBindingLoader
>> =====================
>> Include :
>>    - org.apache.tuscany.core.JavaImplementation
>>    -   - java.componentBuilder
>>    -   - java.implementationLoader
>>    -   - java.componentTypeLoader
>>    - org.apache.tuscany.core.InterfaceJava
>>    -   - interfaceJava.loader
>>    ...........
>> Adding component : localBindingBuilder
>> =====================
>> Include :
>> Adding component : HelloComponent
>> =====================
>> Include :
>> Adding component : HelloComponent
>> Hello2
>>
>>
>>    Would you guys help me understand this load phase little better, and
>> where would be a better place for me to try to handle these duplicated
>> components ?
>>
>> --
>> Luciano Resende
>> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> 


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