Re: Tuscany composite validation

2008-03-26 Thread Simon Laws
Hi Hasan

Adriano is correct about the xsd validation. I've made some more comments in
line. Looking at the range of questions you are asking maybe what we could
do is create and itest to cover the range of validation features that
Tuscany should support and we can concentrate there on improving the
usability story and of course on developing the APIs to deliver it.

Regards

Simon

On Tue, Mar 25, 2008 at 4:50 PM, Adriano Crestani 
[EMAIL PROTECTED] wrote:

 Hi Hasan,

 As far as I know, the validation is done by SCA on composite files. It
 uses
 the tuscany-sca.xsd file. You can find it at:

 https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/assembly-xsd/src/main/resources

 Regards,
 Adriano Crestani

 On Tue, Mar 25, 2008 at 8:44 AM, Hasan Muhammad [EMAIL PROTECTED] wrote:

  Hi Simon,
 
  I was wondering whether tuscany does any validation of the composites
 and
  if
  so, to what extent? If not, what is the api (if any exists) that we can
  use
  to do validation ourselves? If not the api, then how can we obtain
  information to do this validation? We would to know this in light of
  Workspace and ContributionManager.


Currently there are two main types of validation that occur on composites.

-  XSD validation - As Adriano points out see the schema in
modules/assembly-xsd. These are applied when contributions are read. If you
look at the ReallySmallRuntimeBuilder you can see how these XSD are loaded
and also what you would have to do to load your own schema for validation
purposes.

- Programatic validation - in the assembly builder it checks that composites
are properly specified as far as possible w.r.t applying rules from the SCA
specification, e.g. missing or duplicate names, reference/service matching
etc. The same builder code is used regardless of how the runtime is being
started. So, for example, in the new workspace code the builder is called
when a configured composite is requested in the
DeployableCompositeCollectionImpl.doGet() method.

In the case of assembly builders you will notice in the builder code that a
CompositeBuilderMonitor is used to capture any validation issues. The
monitor is called through a local warning() method so it looks like this
could do with a bit of a clean up. This is the extent of the API we have for
this at the moment. The Workspace code is not great in this respect and just
logs validation errors to the underlying logger infrastructure. To capture
validation errors this is where you will be plugging into.



 
  Also, can we get a list of all error/warning messages related to the
  particular contribution and the respected category? By category, i mean
  whether the error/warning is for schema validation, or implementation
 type
  error, etc.


We don't maintain message catalogs at the moment so we have to search the
code to find the messages. For example, the output (with a little editing)
of

grep -R --include=*.java warning *

assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Duplicate component name:  + composite.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Property not found for component property:  + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Component property mustSupply attribute incompatible with property:
 + component
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(No value configured on a mustSupply property:  + component.getName
()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Component property many attribute incompatible with property:  +
component
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(No type specified on component property:  + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Reference not found for component reference:  + component.getName
()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Component reference multiplicity incompatible with reference
multiplicity:  + component
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Component reference interface incompatible with reference
interface:  + component
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Service not found for component service:  + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning(Component service interface incompatible with service interface: 

Re: Tuscany composite validation

2008-03-25 Thread Adriano Crestani
Hi Hasan,

As far as I know, the validation is done by SCA on composite files. It uses
the tuscany-sca.xsd file. You can find it at:
https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/assembly-xsd/src/main/resources

Regards,
Adriano Crestani

On Tue, Mar 25, 2008 at 8:44 AM, Hasan Muhammad [EMAIL PROTECTED] wrote:

 Hi Simon,

 I was wondering whether tuscany does any validation of the composites and
 if
 so, to what extent? If not, what is the api (if any exists) that we can
 use
 to do validation ourselves? If not the api, then how can we obtain
 information to do this validation? We would to know this in light of
 Workspace and ContributionManager.

 Also, can we get a list of all error/warning messages related to the
 particular contribution and the respected category? By category, i mean
 whether the error/warning is for schema validation, or implementation type
 error, etc.

 Here are some kinds of validation we would want to do..

 1. Schema validation? Where is this done if at all?

 2. Implementation type and binding type runtime support and validation: If
 no validation is being done, is there any api that can give  us a list of
 implementation types and binding types that are supported while
 bootstrapping (Adding the contribution)?

 3. Component service/reference/property Name matching with what is in the
 component type: Again if not done, is there any api that can provide this
 information?

 4. Composite level service/reference promoting the wrong component
 service/reference:

 Regards
 Hasan