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

Reply via email to