Florian Rosenberg wrote:
hi jean sebastien,

Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote on 09/27/2007 10:39:21
PM:
Florian Rosenberg wrote:
hi,

I have my compoent type implementation and provided an XSD to use XML
validation. Are there any specific steps I have to do. I'm currently
using
the version 1.0 binaries and I don't really where to put  my XSD file.
I checked the code and found the tuscany-assembly-xsd project, where I
added my XSD to the tuscany-sca.xsd to check if it is working. All the
validation errors on the console go away, nevertheless it does not
really
report an error if for example a mandatory attribute is missing in my
XML
tags.

Could someone give us a brief description how the resolving works and
how
to enable it if I work with the Tuscany binary distribution and do not
want
to rebuild the tuscany-assembly-xsd to get it to work.

Thanks,
-Florian
The runtime currently loads:
tuscany-assembly-xsd/src/main/resources/tuscany-sca-include.xsd -
defining the SCA namespace http://www.osoa.org/xmlns/sca/1.0
tuscany-assembly-xsd/src/main/resources/tuscany-sca.xsd - defining the
Tuscany namespace http://tuscany.apache.org/xmlns/sca/1.0

If you want to add your extension schema to the
http://tuscany.apache.org/xmlns/sca/1.0 namespace you need to include it
in tuscany-sca.xsd, and rebuild that module. This is not dynamic, but
it's intentional as we need to provide application developers with a
single central XSD file completely defining that namespace anyway... as
this is what most XML schema validation tools and editors out there
expect.

That is exactly what I did but for my case it does not seem to work, there
is no XML validation, at least I don't get any error even if I omit
required attributes etc. have to investigate what could be the reason. Even
though, the validation does not seem to work for me, e.g.:

<service name="AddPostSpliceService"
         promote="AddPostSpliceComponent">
  <interface.java
      interfaceERROR="com.ibm.sca.implementation.splice.SpliceService" />
</service>
<component name="AddPostSpliceComponent">
  <tuscany:implementation.splice flow="tns:AddPost"
      contentType="application/x-www-form-urlencoded" />
</component>

The interface attribute is wrong here but Tuscany throw the following error
instead of giving me a validation error:


org.osoa.sca.ServiceRuntimeException: org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.core.assembly.ActivationException:
java.lang.NullPointerException
      at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance
(SCADomain.java:264)
      at org.apache.tuscany.sca.host.embedded.SCADomain.newInstance
(SCADomain.java:69)
      at com.ibm.sca.implementation.splice.SpliceImplementationTest.setUp
(SpliceImplementationTest.java:34)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod
(BeforeAndAfterRunner.java:74)
      at org.junit.internal.runners.BeforeAndAfterRunner.runBefores
(BeforeAndAfterRunner.java:50)
      at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:33)
      at org.junit.internal.runners.TestMethodRunner.runMethod
(TestMethodRunner.java:75)
      at org.junit.internal.runners.TestMethodRunner.run
(TestMethodRunner.java:45)
      at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod
(TestClassMethodsRunner.java:66)
      at org.junit.internal.runners.TestClassMethodsRunner.run
(TestClassMethodsRunner.java:35)
      at org.junit.internal.runners.TestClassRunner$1.runUnprotected
(TestClassRunner.java:42))
      at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
      at org.junit.internal.runners.TestClassRunner.run
(TestClassRunner.java:52)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
(JUnit4TestReference.java:38)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run
(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:460))
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:673))
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:386):
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)
Caused by: org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.core.assembly.ActivationException:
java.lang.NullPointerException
      at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>
(DefaultSCADomain.java:180)
      at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance
(SCADomain.java:230)
      ... 22 more
Caused by: org.apache.tuscany.sca.core.assembly.ActivationException:
java.lang.NullPointerException
      at
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate
(CompositeActivatorImpl.java:737):
      at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>
(DefaultSCADomain.java:178)
      ... 23 more
Caused by: java.lang.NullPointerException
      at
org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAServiceBindingProvider.<init>
(RuntimeSCAServiceBindingProvider.java:59)
      at
org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingProviderFactory.createServiceBindingProvider
(RuntimeSCABindingProviderFactory.java:65)
      at
org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingProviderFactory.createServiceBindingProvider
(RuntimeSCABindingProviderFactory.java:39)
      at
org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint
$LazyBindingProviderFactory.createServiceBindingProvider
(DefaultProviderFactoryExtensionPoint.java:194)
      at
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.addServiceBindingProvider
(CompositeActivatorImpl.java:397)
      at
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate
(CompositeActivatorImpl.java:671)
      at
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate
(CompositeActivatorImpl.java:729)
      ... 24 more



If you want to define your extension schema in a different namespace,
you can either:

- Try to add the following to your <composite> element:
<composite ...
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="yourNamespace locationOfyourXSDFile">
... not great but it should work.

I use the Tuscany namespace anyway, so I agree, that's not what we want.,

- Or just package the XSD file defining that namespace in your extension
JAR and I'll add a few lines of code to look for and automatically load
extension XSDs in extension JARs. I will post again here when it's ready
for you to try.

that would be very cool. I can help you on this if you give me a pointer
where to add that piece of code.

I made some changes to allow extensions to register their schemas by declaring them in a META-INF/services/org.apache.tuscany.sca.contribution.processor.SchemaValidation file. The runtime will load them and use them for validation.

If you want to review the changes they are in SVN revisions r581132, r581135 and r581136 of the trunk.

An example showing how to register a schema is at:
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema

Could you please try with your extension and let me know if it works for you? Thanks

--
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to