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/07/23 02:39:29 UTC

Integrating Model Resolver Extensibility with TuscanyExtensionHelper/Implementation-script

I'm in the process of integrating the Model Resolver extensibility to
the DefaultSCADomain, and came across some issues on how the
ExtensionHelper is performing resolution of component types, looks
like it traverse all the models in the ModelResolver to find any
componentTypes [1]. I was trying to use the resolver to actually
resolve the componentType, but looks like there isn't enough
information on the PojoImplementation, as the call to
SCDLProcessor.addSideFileComponentType always get the "name" parameter
as null, and impl.getUri() is also always null.

Can someone more familiar with the
ExtensionHelper/implementation-script give me some hints on what tasks
need to be performed during the resolve phase ? I'll be on IRC, if a
quick chat is easier.

I have made a patch available on the following JIRA[2], in case people
can give some help.

[1] https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java
[2] https://issues.apache.org/jira/browse/TUSCANY-1475


-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

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


Re: Integrating Model Resolver Extensibility with TuscanyExtensionHelper/Implementation-script

Posted by Luciano Resende <lu...@gmail.com>.
Thanks Sebastien, all working now.

On 7/22/07, Jean-Sebastien Delfino <js...@apache.org> wrote:
> Luciano Resende wrote:
> > I'm in the process of integrating the Model Resolver extensibility to
> > the DefaultSCADomain, and came across some issues on how the
> > ExtensionHelper is performing resolution of component types, looks
> > like it traverse all the models in the ModelResolver to find any
> > componentTypes [1]. I was trying to use the resolver to actually
> > resolve the componentType, but looks like there isn't enough
> > information on the PojoImplementation, as the call to
> > SCDLProcessor.addSideFileComponentType always get the "name" parameter
> > as null, and impl.getUri() is also always null.
> >
> > Can someone more familiar with the
> > ExtensionHelper/implementation-script give me some hints on what tasks
> > need to be performed during the resolve phase ? I'll be on IRC, if a
> > quick chat is easier.
> >
> > I have made a patch available on the following JIRA[2], in case people
> > can give some help.
> >
> > [1]
> > https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java
> >
> > [2] https://issues.apache.org/jira/browse/TUSCANY-1475
> >
> >
>
> The logic in getComponentType looks like  it's trying all componentTypes
> against all properties of the bean. I think this needs to be cleaned up
> a little as it'll lead to pretty unpredictable behavior but in the
> meantime, try this:
>
>     private ComponentType getComponentType(ModelResolver resolver,
> Implementation impl) throws IllegalArgumentException,
> IllegalAccessException, InvocationTargetException {
>         for (Method m : getGetters()) {
>             Object io;
>             if (impl instanceof PojoImplementation) {
>                 io = ((PojoImplementation)impl).getUserImpl();
>             } else {
>                 io = impl;
>             }
>             String value = (String) m.invoke(io, new Object[]{});
>             if (value != null) {
>                 value = value.substring(0, value.lastIndexOf('.'));
>                 ComponentType componentType =
> assemblyFactory.createComponentType();
>                 componentType.setUnresolved(true);
>                 componentType.setURI(value + ".componentType");
>                 componentType =
> resolver.resolveModel(ComponentType.class, componentType);
>                 if (!componentType.isUnresolved()) {
>                     return componentType;
>                 }
>             }
>         }
>         return null;
>     }
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>


-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

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


Re: Integrating Model Resolver Extensibility with TuscanyExtensionHelper/Implementation-script

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Luciano Resende wrote:
> I'm in the process of integrating the Model Resolver extensibility to
> the DefaultSCADomain, and came across some issues on how the
> ExtensionHelper is performing resolution of component types, looks
> like it traverse all the models in the ModelResolver to find any
> componentTypes [1]. I was trying to use the resolver to actually
> resolve the componentType, but looks like there isn't enough
> information on the PojoImplementation, as the call to
> SCDLProcessor.addSideFileComponentType always get the "name" parameter
> as null, and impl.getUri() is also always null.
>
> Can someone more familiar with the
> ExtensionHelper/implementation-script give me some hints on what tasks
> need to be performed during the resolve phase ? I'll be on IRC, if a
> quick chat is easier.
>
> I have made a patch available on the following JIRA[2], in case people
> can give some help.
>
> [1] 
> https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/spi/impl/SCDLProcessor.java 
>
> [2] https://issues.apache.org/jira/browse/TUSCANY-1475
>
>

The logic in getComponentType looks like  it's trying all componentTypes 
against all properties of the bean. I think this needs to be cleaned up 
a little as it'll lead to pretty unpredictable behavior but in the 
meantime, try this:

    private ComponentType getComponentType(ModelResolver resolver, 
Implementation impl) throws IllegalArgumentException, 
IllegalAccessException, InvocationTargetException {
        for (Method m : getGetters()) {
            Object io;
            if (impl instanceof PojoImplementation) {
                io = ((PojoImplementation)impl).getUserImpl();
            } else {
                io = impl;
            }
            String value = (String) m.invoke(io, new Object[]{});
            if (value != null) {
                value = value.substring(0, value.lastIndexOf('.'));
                ComponentType componentType = 
assemblyFactory.createComponentType();
                componentType.setUnresolved(true);
                componentType.setURI(value + ".componentType");
                componentType = 
resolver.resolveModel(ComponentType.class, componentType);
                if (!componentType.isUnresolved()) {
                    return componentType;
                }
            }
        }
        return null;
    }

-- 
Jean-Sebastien


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