Hi Ivan, could you raise a JIRA for this and if possible attach to it the sca contribution you're trying to get to work, and I or someone else will try to get it fixed for you.
...ant On Thu, Dec 17, 2009 at 5:40 PM, Raymond Feng <enjoyj...@gmail.com> wrote: > The property compatibility check we have in Tuscany seems to be too > restrictive. In your case, the componentType property is declared in java > and no XSD element can be inferred. > > The SCA assembly spec says: > > 1109 Two property types are compatible if they have the same XSD type (where > declared as XSD types) or the > 1110 same XSD global element (where declared as XSD global elements). For > cases where the type of a > 1111 property is declared using a different type system (eg Java), then the > type of the property is mapped to > 1112 XSD using the mapping rules defined by the appropriate implementation > type specification > > If the mapped XSD type for the java property (componentType property) is the > same as the one behind the XSD global element for the component property, we > should take them as compatible. > > Thanks, > Raymond > -------------------------------------------------- > From: "keinmensch" <keinmen...@mailhaven.com> > Sent: Thursday, December 17, 2009 6:46 AM > To: <user@tuscany.apache.org> > Subject: Re: Non-Simple Property Injected with XML Fails with NPE > >> Hi again! >> So, I have become desperate :-) and started poking around in the Tuscany >> source code. >> The NullPointerException that I experienced earlier is caused by a >> component type property having a null XSD element. I modified the code, >> as below, to avoid the NullPointerException. >> [code] >> ... >> // check that the types specified in the component type and >> component property match >> if (componentProperty.getXSDElement() != null >> && !componentProperty.getXSDElement().equals( >> componentTypeProperty.getXSDElement())) >> { >> // MY MODIFICATION HERE. >> String theCompTypePropXSDElem = "[not available]"; >> if (componentTypeProperty >> .getXSDElement() != null) >> { >> theCompTypePropXSDElem = >> componentTypeProperty.getXSDElement().toString(); >> } >> Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, >> "PropertXSDElementsDontMatch", component.getName(), >> componentProperty.getName(), componentProperty >> .getXSDElement().toString(), >> theCompTypePropXSDElem); >> } >> ... >> [/code] >> >> With this modification in place, I now receive the following messages in >> the log: >> >> Dec 17, 2009 10:28:54 PM >> org.apache.tuscany.sca.builder.impl.ComponentBuilderImpl [Composite: >> {http://docs.oasis-open.org/ns/opencsa/sca/200 >> 903}, Component: ServiceComponent1] (PropertXSDElementsDontMatch) >> SEVERE: [ASM_5036] The property component ServiceComponent1 property >> myComplexProp has XSD element {http://foo.com}fooElement while its comp >> onent type property has the XSD element [not available] >> java.lang.IllegalStateException: >> org.oasisopen.sca.ServiceRuntimeException: [Composite: >> {http://docs.oasis-open.org/ns/opencsa/sca/200903}, >> Component: ServiceComponent1] - [ASM_5036] The property component >> ServiceComponent1 property myComplexProp has XSD element {http://foo.com}f >> ooElement while its component type property has the XSD element [not >> available] >> at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:176) >> at >> >> com.ivan.SmallPropertyTestMain.doStuffTuscany2(SmallPropertyTestMain.java:58) >> at com.ivan.SmallPropertyTestMain.main(SmallPropertyTestMain.java:29) >> Caused by: org.oasisopen.sca.ServiceRuntimeException: [Composite: >> {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: ServiceComp >> onent1] - [ASM_5036] The property component ServiceComponent1 property >> myComplexProp has XSD element {http://foo.com}fooElement while its co >> mponent type property has the XSD element [not available] >> at >> >> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.analyzeProblems(NodeFactoryImpl.java:174) >> at >> >> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.configureNode(NodeFactoryImpl.java:275) >> at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:135) >> ... 2 more >> Exception in thread "main" java.lang.NullPointerException >> at com.ivan.SmallPropertyTestMain.main(SmallPropertyTestMain.java:31) >> >> The question is: Why is the component type property null? >> Isn't the property type supposed to be inferred from the field annotated >> by the @Property annotation or have I misunderstood? >> Best wishes, >> Ivan > >