You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2007/02/15 17:35:42 UTC

Re: svn commit: r507898 - /incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java

Hi, Ant.

I think there's a problem in your algorithm. The order of elements in the 
Map cannot be guaranteed. If you have more than one services for the 
component, then you might see different sequences of services from the 
introspection against the ones from the componentType file. For example, 
[s1, s2] vs. [s2, s1], then it ends up to set the interfaceClass from wrong 
services. I assume we should match services by name.

Thanks,
Raymond

----- Original Message ----- 
From: <an...@apache.org>
To: <tu...@ws.apache.org>
Sent: Thursday, February 15, 2007 3:38 AM
Subject: svn commit: r507898 - 
/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java


> Author: antelder
> Date: Thu Feb 15 03:38:36 2007
> New Revision: 507898
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=507898
> Log:
> Fix the fix so side file defined service info is actually used
>
> Modified:
> 
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
>
> Modified: 
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
> URL: 
> http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java?view=diff&rev=507898&r1=507897&r2=507898
> ==============================================================================
> ---  
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java 
> (original)
> +++ 
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java 
> Thu Feb 15 03:38:36 2007
> @@ -19,6 +19,7 @@
> package org.apache.tuscany.core.implementation.java;
>
> import java.net.URL;
> +import java.util.Iterator;
>
> import org.apache.tuscany.core.util.JavaIntrospectionHelper;
> import org.apache.tuscany.spi.annotation.Autowire;
> @@ -34,6 +35,7 @@
> import org.apache.tuscany.spi.implementation.java.ProcessingException;
> import org.apache.tuscany.spi.loader.LoaderException;
> import org.apache.tuscany.spi.loader.LoaderRegistry;
> +import org.apache.tuscany.spi.model.ServiceContract;
> import org.apache.tuscany.spi.model.ServiceDefinition;
> import org.osoa.sca.annotations.Constructor;
>
> @@ -63,14 +65,18 @@
>         URL resource = 
> implClass.getResource(JavaIntrospectionHelper.getBaseName(implClass) + 
> ".componentType");
>         if (resource != null) {
>             // TODO: TUSCANY-1111, How to merge the component type loaded 
> from the file into the PojoComponentType
> -            PojoComponentType type = loadFromSidefile(parent, resource, 
> deploymentContext);
> -
> -            for (Object o : type.getServices().values()) {
> -                ServiceDefinition sd = (ServiceDefinition) o;
> -                ServiceDefinition javaService = (ServiceDefinition) 
> componentType.getServices().get(sd.getName());
> -                if(javaService!=null) {
> - 
> javaService.setServiceContract(sd.getServiceContract());
> -                }
> +            PojoComponentType sideFileCT = loadFromSidefile(parent, 
> resource, deploymentContext);
> +
> +            // TODO: TUSCANY-1111, hack to get the sidefile defined 
> WSDLServiceContract used
> +            // only works with a single service
> +            Iterator it = 
> componentType.getServices().values().iterator();
> +            for (Object o : sideFileCT.getServices().values()) {
> +                ServiceDefinition sideFileSD = (ServiceDefinition) o;
> +                ServiceDefinition actualSD = 
> (ServiceDefinition)it.next();
> +                ServiceContract<?> newServiceContract = 
> sideFileSD.getServiceContract();
> +                // TODO: TUSCANY-1111, runtime requires interfaceClass 
> but currently there's no way of gen'ing that from WSDL
> + 
> newServiceContract.setInterfaceClass(actualSD.getServiceContract().getInterfaceClass());
> +                actualSD.setServiceContract(newServiceContract);
>             }
>         }
>         implementation.setComponentType(componentType);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
> 


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


Re: svn commit: r507898 - /incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java

Posted by ant elder <an...@gmail.com>.
Working as designed :) See the TODO comment "...only works with a single
service".

Its actually not trivial to fix this properly, and as there's an existing
work item to be done in the future to fix using side files properly i think
the fix can wait till then.

    ...ant

On 2/15/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi, Ant.
>
> I think there's a problem in your algorithm. The order of elements in the
> Map cannot be guaranteed. If you have more than one services for the
> component, then you might see different sequences of services from the
> introspection against the ones from the componentType file. For example,
> [s1, s2] vs. [s2, s1], then it ends up to set the interfaceClass from
> wrong
> services. I assume we should match services by name.
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: <an...@apache.org>
> To: <tu...@ws.apache.org>
> Sent: Thursday, February 15, 2007 3:38 AM
> Subject: svn commit: r507898 -
>
> /incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
>
>
> > Author: antelder
> > Date: Thu Feb 15 03:38:36 2007
> > New Revision: 507898
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=507898
> > Log:
> > Fix the fix so side file defined service info is actually used
> >
> > Modified:
> >
> >
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
> >
> > Modified:
> >
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
> > URL:
> >
> http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java?view=diff&rev=507898&r1=507897&r2=507898
> >
> ==============================================================================
> > ---
> >
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
> > (original)
> > +++
> >
> incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
> > Thu Feb 15 03:38:36 2007
> > @@ -19,6 +19,7 @@
> > package org.apache.tuscany.core.implementation.java;
> >
> > import java.net.URL;
> > +import java.util.Iterator;
> >
> > import org.apache.tuscany.core.util.JavaIntrospectionHelper;
> > import org.apache.tuscany.spi.annotation.Autowire;
> > @@ -34,6 +35,7 @@
> > import org.apache.tuscany.spi.implementation.java.ProcessingException;
> > import org.apache.tuscany.spi.loader.LoaderException;
> > import org.apache.tuscany.spi.loader.LoaderRegistry;
> > +import org.apache.tuscany.spi.model.ServiceContract;
> > import org.apache.tuscany.spi.model.ServiceDefinition;
> > import org.osoa.sca.annotations.Constructor;
> >
> > @@ -63,14 +65,18 @@
> >         URL resource =
> > implClass.getResource(JavaIntrospectionHelper.getBaseName(implClass) +
> > ".componentType");
> >         if (resource != null) {
> >             // TODO: TUSCANY-1111, How to merge the component type
> loaded
> > from the file into the PojoComponentType
> > -            PojoComponentType type = loadFromSidefile(parent, resource,
> > deploymentContext);
> > -
> > -            for (Object o : type.getServices().values()) {
> > -                ServiceDefinition sd = (ServiceDefinition) o;
> > -                ServiceDefinition javaService = (ServiceDefinition)
> > componentType.getServices().get(sd.getName());
> > -                if(javaService!=null) {
> > -
> > javaService.setServiceContract(sd.getServiceContract());
> > -                }
> > +            PojoComponentType sideFileCT = loadFromSidefile(parent,
> > resource, deploymentContext);
> > +
> > +            // TODO: TUSCANY-1111, hack to get the sidefile defined
> > WSDLServiceContract used
> > +            // only works with a single service
> > +            Iterator it =
> > componentType.getServices().values().iterator();
> > +            for (Object o : sideFileCT.getServices().values()) {
> > +                ServiceDefinition sideFileSD = (ServiceDefinition) o;
> > +                ServiceDefinition actualSD =
> > (ServiceDefinition)it.next();
> > +                ServiceContract<?> newServiceContract =
> > sideFileSD.getServiceContract();
> > +                // TODO: TUSCANY-1111, runtime requires interfaceClass
> > but currently there's no way of gen'ing that from WSDL
> > +
> > newServiceContract.setInterfaceClass(actualSD.getServiceContract
> ().getInterfaceClass());
> > +                actualSD.setServiceContract(newServiceContract);
> >             }
> >         }
> >         implementation.setComponentType(componentType);
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-commits-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>