You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Hasan Muhammad <ap...@gmail.com> on 2008/03/25 16:44:42 UTC

Tuscany composite validation

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

Re: Tuscany composite validation

Posted by Simon Laws <si...@googlemail.com>.
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 <
adrianocrestani@apache.org> 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 <ap...@gmail.com> 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: "
+ component
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate component service name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate component reference name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate component property name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("No implementation for component: " + component.getName(),
component);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Component implementation not found: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate property name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate service name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Duplicate reference name: " + component.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("Multiple bindings for service " +
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java:
warning("URLSyntaxException when creating binding URI at component " +
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("No targets for reference: " + componentReference.getName(),
composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Too many targets on reference: " + componentReference.getName(),
composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Promoted component service not found: " + promotedServiceName,
composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Promoted component reference not found: " + componentReferenceName,
composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("No target services found for the component reference to be
autowired: " + componentReference
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Incompatible interfaces on component reference and target: " +
componentReference
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Component reference target not found, it might be a remote service:
" + componentService.getName(), composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Incompatible interfaces on component reference and target: " +
componentReference
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Component reference target from component type not found, it might
be a remote service: " + componentService.getName(), composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Component reference doesn't have a matching binding",
componentReference);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Wire source not found: " + source.getName(), composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Wire target not found: " + source.getName(), composite);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Incompatible interfaces on wire source and target: " +
source.getName()
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Component reference " + promotedReference.getName() + " has more
than one wires",
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java:
warning("Policy related exception: " + e, e);
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java:
// These validation errors are just warnings for us as we want to support
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java:
logger.warning(getMessage(exception));
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java:
logger.warning(getMessage(exception));
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java:
public void warning(SAXParseException exception) throws SAXException {
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java:
logger.warning(getMessage(exception));


> >
> > Here are some kinds of validation we would want to do..
> >
> > 1. Schema validation? Where is this done if at all?
>

This is done when contributions are loaded and the XML for the composites
etc. is read in.


>
> >
> > 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)?
>

If you try and load a composite which references extensions that are not
available on the classpath then currently the runtime reports a read
warning, for example,

26-Mar-2008 12:43:47
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessorread
WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws cannot be
processed. ([row,col {unknown-source}]: [29,10])

Was reported when I removed the ws binding dependency from the
helloworld-ws-service sample. This is a bit cryptic as what it is actually
saying is that it can't find an extension processor to process for, in this
case, binding.ws. I.e. the runtime would be able to process it if you
configured it with the correct set of extensions.

There is no API to determine the extensions that are loaded but the
information could be made available from the internal registry that the
runtime holds by, for example, looking for all the registered
BindingProviderFactories or ImplementationProviderFactories. Why do you need
access to this information?


> >
> > 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?
>

This should be done but if you have specific tests showing holes then we
need to extend our testing.


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

Also should be done but I don't know if there is an explicit test. Do you
have a test case that fails?


>
> >
> > Regards
> > Hasan
> >
>

Re: Tuscany composite validation

Posted by Adriano Crestani <ad...@apache.org>.
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 <ap...@gmail.com> 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
>