You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Rohan Sahgal <ro...@gmail.com> on 2009/02/09 02:40:20 UTC

Tool for composite file validation

Hi,
I was wondering if any tool exists that can validate composite files.
I cannot see any such tool linked from the "Tools" link on the Tuscany
SCA Java webpage.

Right now, I am just dependent on runtime errors to find out mistakes
in my composite files, which is quite time consuming.

It would really ease development if such a tool existed.

Thanks,
Rohan

Re: Tool for composite file validation

Posted by Dan Becker <da...@gmail.com>.
Thanks Vincent for your more in-depth and detailed explanation of the 
Eclipe-STP validations. It obviously goes much deeper into the semantics 
of the composite that I had been aware of.

Vincent Zurczak wrote:
> Hi (again). :)
> My comments below.
> 
> 
> Dan Becker a écrit :
>> Vincent Zurczak wrote:
>>> Luciano Resende a écrit :
>>>> As you mentioned, the Tuscany runtime will validate the composites
>>>> when processing the contribution. I don' t recall of a specific tool
>>>> that would just parse and validate the composite, but a tool like this
>>>> should be very simple to do, or  you could try Eclipse STP SCA Tools
>>>> and see if they have something like this.
>>>>   
>>> There is indeed something in progress about validation in the SCA Tools project.
>>>
>>> The validation relies on the SCA meta-model (which was recently updated to 
>>> support Tuscany 1.4 - see [0]) and extra-validation rules.
>>>
>>> It works like the Java validation in Eclipse.
>>> Every time a composite file is changed in an SCA project, it goes through a 
>>> validation step. When errors are found, error markers are added on the file 
>>> and described in the "problem" view.
>>>
>>> There is still work to do on it, mainly to link error markers with editors.
>>> And we are also working to run validation when SCA annotated java code is 
>>> modified.
>>>
>>> For the moment, I did not find time to write documentation about this 
>>> mechanism in the wiki [1].
>>> It's only available in the trunk and in the recent builds for Eclipse 
>>> Galileo, but if you want to test it, I can help you. It's quite simple.
>>> And if you want to help, you're welcome. :)
>>>
>>
>> Hello Vincent,
>>
>> Be aware that the validation done in the Eclipse STP tools is based on the 
>> Tuscany SCA schemas. It validates according to the rules defined in the 
>> schema. Additionally, there is also model information behind the syntax that 
>> can be validated.
> Actually, in STP, the validation is made according to the SCA meta-model.
> The Tuscany SCA schemas only define the meta-model extension for Tuscany 
> elements (mainly implementations, bindings and interfaces).
> The SCA core elements are part of the basis of the meta-model.
> 
>> Simon mentions 3 steps to loading a composite. Each one of these steps is a 
>> candidate for validation:
>>
>> >> - Read the composite xml - create a internal model of the XML from the 
>> composite file
>>
>> This is the step where schema validation is important. Are there the correct 
>> number of attributes and elements? Are they in the correct order? Are 
>> restricted fields populated with valid alternatives?
> The SCA meta-model is based on the SCA specifications and implemented with EMF. 
> It deals with all of the things you mentionned.
> This meta-model is used in the SCA Composite designer (the graphical composite 
> editor from STP).
> Besides, the SCA meta-model defines additional constraints which are listed 
> here. [0]
> 
> Among these constraints, the following ones are already implemented in the 
> plug-in "org.eclipse.stp.sca.validation":
> 
>     * The component name must be unique across all the components in the composite
>     * The name of a composite reference must be unique across all the composite
>       references in the composite
>     * The name of a composite service must be unique across all the composite
>       services in the composite
>     * It &apos;s forbidden to wire a component reference with a component
>       service of the same component.
> 
> The others should soon follow.
> Besides, the SCA meta-model can be used inside Eclipse but also in standalone 
> (it is made up of 2 or 3 jars).
> See in the plug-in "org.eclipse.stp.sca.tests" for an example (class 
> "org.eclipse.stp.sca.tests.ScaExample").
> 
> About the validator I mentionned in my first mail, it mainly relies on this 
> model for the validation.
> 
>> >> - resolve the composite - find all the things that the composite refers to 
>> such as Java component implementation files and WSDL interface definitions.
>>
>> In this step some of the model information can be validated. Does the 
>> component implementation exist and do the methods match in name, parameters, 
>> and return values? Does the WSDL interface match the composite service 
>> interfaces?
> Completing the model instance with resources (implementation, interfaces) is in 
> progress.
> Although we only deal with Java implementations and interfaces for the moment.
> We have a new component in STP to introspect Java code and complete model instances.
> 
> And I am working on WSDL support (e.g. be able in the tools to have java 
> implementations and reference any web service - simply starting from its WSDL).
> 
>> >> - build the composite - fix up the internal model to ensure that it is 
>> valid and ready to be activated as an SCA composite application.
>>
>> Has everything been loaded? Are all pieces of the composite available.
> Once the SCA model is loaded, it is very easy to validate it using EMF mechanisms.
> It takes care of structural constraints (e.g. as described in XML schemas) but 
> also of extra-constraints defined on the meta-model (typically, things you can't 
> describe in XSDs, unless using annotations and programs like Schematron).
>  >From the description and validation points of view, EMF is very powerful.
-- 
Thanks, Dan Becker

Re: Tool for composite file validation

Posted by Dan Becker <da...@gmail.com>.
Vincent Zurczak wrote:
> Luciano Resende a écrit :
>> As you mentioned, the Tuscany runtime will validate the composites
>> when processing the contribution. I don' t recall of a specific tool
>> that would just parse and validate the composite, but a tool like this
>> should be very simple to do, or  you could try Eclipse STP SCA Tools
>> and see if they have something like this.
>>   
> There is indeed something in progress about validation in the SCA Tools 
> project.
> 
> The validation relies on the SCA meta-model (which was recently updated 
> to support Tuscany 1.4 - see [0]) and extra-validation rules.
> 
> It works like the Java validation in Eclipse.
> Every time a composite file is changed in an SCA project, it goes 
> through a validation step. When errors are found, error markers are 
> added on the file and described in the "problem" view.
> 
> There is still work to do on it, mainly to link error markers with editors.
> And we are also working to run validation when SCA annotated java code 
> is modified.
> 
> For the moment, I did not find time to write documentation about this 
> mechanism in the wiki [1].
> It's only available in the trunk and in the recent builds for Eclipse 
> Galileo, but if you want to test it, I can help you. It's quite simple.
> And if you want to help, you're welcome. :)
> 

Hello Vincent,

Be aware that the validation done in the Eclipse STP tools is based on 
the Tuscany SCA schemas. It validates according to the rules defined in 
the schema. Additionally, there is also model information behind the 
syntax that can be validated.

Simon mentions 3 steps to loading a composite. Each one of these steps 
is a candidate for validation:

 >> - Read the composite xml - create a internal model of the XML from 
the composite file

This is the step where schema validation is important. Are there the 
correct number of attributes and elements? Are they in the correct 
order? Are restricted fields populated with valid alternatives?

 >> - resolve the composite - find all the things that the composite 
refers to such as Java component implementation files and WSDL interface 
definitions.

In this step some of the model information can be validated. Does the 
component implementation exist and do the methods match in name, 
parameters, and return values? Does the WSDL interface match the 
composite service interfaces?

 >> - build the composite - fix up the internal model to ensure that it 
is valid and ready to be activated as an SCA composite application.

Has everything been loaded? Are all pieces of the composite available.

As Simon states, the assembly-xml module is a good place to see the read 
and resolve validations. The NodeImpl module is a good starting place to 
see all of the read/resolve/build validation. You might find that a 
stand alone validation tool can make use of NodeImpl to validate.

-- 
Thanks, Dan Becker

Re: Tool for composite file validation

Posted by Vincent Zurczak <vi...@ebmwebsourcing.com>.
Hi.

Luciano Resende a écrit :
> As you mentioned, the Tuscany runtime will validate the composites
> when processing the contribution. I don' t recall of a specific tool
> that would just parse and validate the composite, but a tool like this
> should be very simple to do, or  you could try Eclipse STP SCA Tools
> and see if they have something like this.
>   
There is indeed something in progress about validation in the SCA Tools 
project.

The validation relies on the SCA meta-model (which was recently updated 
to support Tuscany 1.4 - see [0]) and extra-validation rules.

It works like the Java validation in Eclipse.
Every time a composite file is changed in an SCA project, it goes 
through a validation step. When errors are found, error markers are 
added on the file and described in the "problem" view.

There is still work to do on it, mainly to link error markers with editors.
And we are also working to run validation when SCA annotated java code 
is modified.

For the moment, I did not find time to write documentation about this 
mechanism in the wiki [1].
It's only available in the trunk and in the recent builds for Eclipse 
Galileo, but if you want to test it, I can help you. It's quite simple.
And if you want to help, you're welcome. :)


Regards,

                Vincent Zurczak.



[ 0 ] : https://bugs.eclipse.org/bugs/show_bug.cgi?id=261222
[ 1 ] : http://wiki.eclipse.org/STP/SCA_Component


> On Sun, Feb 8, 2009 at 5:40 PM, Rohan Sahgal <ro...@gmail.com> wrote:
>   
>> Hi,
>> I was wondering if any tool exists that can validate composite files.
>> I cannot see any such tool linked from the "Tools" link on the Tuscany
>> SCA Java webpage.
>>
>> Right now, I am just dependent on runtime errors to find out mistakes
>> in my composite files, which is quite time consuming.
>>
>> It would really ease development if such a tool existed.
>>
>> Thanks,
>> Rohan

-- 
Vincent Zurczak
EBM WebSourcing
+33 (0) 4 38 12 16 77


Re: Tool for composite file validation

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Feb 9, 2009 at 6:41 AM, Rohan Sahgal <ro...@gmail.com> wrote:

> I would like to write such a tool.
>
> Can you point me to the correct place in the Tuscany source code from
> where I could reuse the functionality.
>
> Thanks,
> Rohan
>
snip...

Hi Rohan

If you want to get your hands dirty an knock up a tool to do composite
validation then the code is fairly easy to find. Which bits you use depends
on how much validation you want to use. There are a number of steps the code
goes through.

- Read the composite xml - create a internal model of the XML from the
composite file
- resolve the composite - find all the things that the composite refers to
such as Java component implementation files and WSDL interface defintions
- build the composite - fix up the internal model to ensure that it is valid
and ready to be activated as an SCA composite application

In each of these stages validation errors can be raised. Our code uses a
"monitor" where errors are lodged. After each stage the monitor is asked to
report any errors that have been found.

The code is all kicked off from the NodeImpl class [1]. Take a look at the
initRuntime() method to see how the runtime is set up. The configureNode()
method controls the various read(), resolve() and build stages().

The read() and resolve() stages rely on the various Tuscany specific  XML
processors you will see in out code base, for example, the ones that
read/resolve the assembly model can be found here [2]. Take a look at the
unit  tests in the assembly-xml module [3] to get a feel for how the
processors are used.

Let us know when you need more info.

Regards

Simon

[1]
http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
[2]
http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/modules/assembly-xml/
[3]
http://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/

Re: Tool for composite file validation

Posted by Rohan Sahgal <ro...@gmail.com>.
I would like to write such a tool.

Can you point me to the correct place in the Tuscany source code from
where I could reuse the functionality.

Thanks,
Rohan

On Sun, Feb 8, 2009 at 5:51 PM, Luciano Resende <lu...@gmail.com> wrote:
> As you mentioned, the Tuscany runtime will validate the composites
> when processing the contribution. I don' t recall of a specific tool
> that would just parse and validate the composite, but a tool like this
> should be very simple to do, or  you could try Eclipse STP SCA Tools
> and see if they have something like this.
>
> On Sun, Feb 8, 2009 at 5:40 PM, Rohan Sahgal <ro...@gmail.com> wrote:
>> Hi,
>> I was wondering if any tool exists that can validate composite files.
>> I cannot see any such tool linked from the "Tools" link on the Tuscany
>> SCA Java webpage.
>>
>> Right now, I am just dependent on runtime errors to find out mistakes
>> in my composite files, which is quite time consuming.
>>
>> It would really ease development if such a tool existed.
>>
>> Thanks,
>> Rohan
>>
>
>
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>

Re: Tool for composite file validation

Posted by Luciano Resende <lu...@gmail.com>.
As you mentioned, the Tuscany runtime will validate the composites
when processing the contribution. I don' t recall of a specific tool
that would just parse and validate the composite, but a tool like this
should be very simple to do, or  you could try Eclipse STP SCA Tools
and see if they have something like this.

On Sun, Feb 8, 2009 at 5:40 PM, Rohan Sahgal <ro...@gmail.com> wrote:
> Hi,
> I was wondering if any tool exists that can validate composite files.
> I cannot see any such tool linked from the "Tools" link on the Tuscany
> SCA Java webpage.
>
> Right now, I am just dependent on runtime errors to find out mistakes
> in my composite files, which is quite time consuming.
>
> It would really ease development if such a tool existed.
>
> Thanks,
> Rohan
>



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