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/04/07 17:33:00 UTC

How do you plug in validation monitoring?

Currently, i see that we have various places where we can plug in validation
monitoring. Some of the ones that i found are in the
ReallySmallRuntimeBuilder as shown below:

    public static CompositeBuilder createCompositeBuilder(AssemblyFactory
assemblyFactory,
                                                          SCABindingFactory
scaBindingFactory,

IntentAttachPointTypeFactory intentAttachPointTypeFactory,

InterfaceContractMapper interfaceContractMapper,
                                                          List<PolicySet>
domainPolicySets) {
        return new CompositeBuilderImpl(assemblyFactory, scaBindingFactory,
intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
null);
    }

    public static DomainBuilder createDomainBuilder(AssemblyFactory
assemblyFactory,
            SCABindingFactory scaBindingFactory,
            IntentAttachPointTypeFactory intentAttachPointTypeFactory,
            InterfaceContractMapper interfaceContractMapper,
            List<PolicySet> domainPolicySets) {
        return new DomainWireBuilderImpl(assemblyFactory, scaBindingFactory,
intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
null);
    }

Instead of passing null, we can pass in our own CompositeBuildMonitor. Are
these the only places where we need to do this? or are there other places as
well?

Hasan

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Tue, May 13, 2008 at 8:43 AM, Ramkumar R <ra...@gmail.com> wrote:

> Hi Simon,
> Noticed an issue, while we do itest to test the exception messages raised
> by
> the monitor during the validation, since we are still throwing all kind
> of exceptions from the code, for any kind of exception that's thrown the
> domain creation is stopped and hence we end-up in returning null for the
> domain.
>
> Since we have the domain as null, it would not be possible for us to catch
> hold of the monitor and check if we have got the required message.
>
> I believe we need changes in the code, by either ways:
> 1. To create a monitor and ask the domain to make use of the same, so that
> we have a control over the monitor. OR
> 2. Allow the domain creation to complete, irrespective of any user-errors
> that are encountered during validation.
>
> Like to know your thoughts on this. Thanks.
>
>
> On 5/13/08, Ramkumar R <ra...@gmail.com> wrote:
> >
> > Patches for TUSCANY-2277 are now available with the following changes:
> >
> > - The monitors now have access to all of the errors and warnings that
> are
> > raised during validation in the read, resolve and build phase of an SCA
> > composite.
> > - The code still throws all kind of exceptions as it was doing earlier,
> to
> > avoid a null pointer exception in furthur processing.
> > - All the exception/warning messages are customized using specified
> > resource bundle. Each module has its own resource bundle.
> >
> > Here are few work items that are currently in progress:
> > - itest for the validation errors.
> > - Identify which exceptions are safe to ignore, so that we allow the
> > processing to proceed furthur. This way we could catch hold of max
> possible
> > user-errors in one go.
> >
> >
> > On 5/6/08, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > On Mon, May 5, 2008 at 5:54 PM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> > >
> > > > So if plugins want to create their own monitor, what will happen in
> > > this
> > > > case? Now, the way plugins have control is, by looking at the
> > > messageID of
> > > > the problem, they can decide whether they want to change the
> behaviour
> > > > from
> > > > a warning to error, etc.
> > > >
> > > > regard
> > > > Hasan
> > > >
> > > > On Fri, May 2, 2008 at 11:23 AM, Jean-Sebastien Delfino <
> > > > jsdelfino@apache.org> wrote:
> > > >
> > > > > Simon Laws wrote:
> > > > >
> > > > > >
> > > > > > Depending where you actually catch the exception you should be
> > > able to
> > > > > > continue on and process the next artifact.
> > > > > >
> > > > > >
> > > > > Hmmm, the idea with monitors is to allow the processing code to
> > > report
> > > > > warnings and continue or multiple errors per artifact for example.
> > > > >
> > > > > Not sure about how it'll work with exceptions?
> > > > > --
> > > > > Jean-Sebastien
> > > > >
> > > >
> > >
> > > The suggestion is still that monitors get access to all the
> > > errors/warnings
> > > that the system generates for display to the user so you will be able
> to
> > > take the same approach.
> > >
> > > Simon
> > >
> >
> >
> >
> > --
> > Thanks & Regards,
> > Ramkumar Ramalingam
>
>
>
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Hi Ram

I think the problem we have here is that we choose to use the node as part
of the validation testing. I view the node as a standalone piece of code
whose function is to run composites. It's not designed to have an external
interface that provides the detailed results of validation failures other
than through throwing an exception. We will actually have to update the node
to do some analysis of the contents of the monitor in order to throw an
exception containing suitable information.

I think what we need to do in our validation testing is use some of the more
detailed runtime apis so that we have more control of the monitor. I.e. do
what we likely have to do it we were to write a tool that was focused on
contribution processing and reporting of validation errors.

So what I suggest is that we look at samples/domain-management and we can
probably use the code there to get a runtime up for contribution processing
that allows us the access we need to the monitor.

Simon

Re: How do you plug in validation monitoring?

Posted by Ramkumar R <ra...@gmail.com>.
Hi Simon,
Noticed an issue, while we do itest to test the exception messages raised by
the monitor during the validation, since we are still throwing all kind
of exceptions from the code, for any kind of exception that's thrown the
domain creation is stopped and hence we end-up in returning null for the
domain.

Since we have the domain as null, it would not be possible for us to catch
hold of the monitor and check if we have got the required message.

I believe we need changes in the code, by either ways:
1. To create a monitor and ask the domain to make use of the same, so that
we have a control over the monitor. OR
2. Allow the domain creation to complete, irrespective of any user-errors
that are encountered during validation.

Like to know your thoughts on this. Thanks.


On 5/13/08, Ramkumar R <ra...@gmail.com> wrote:
>
> Patches for TUSCANY-2277 are now available with the following changes:
>
> - The monitors now have access to all of the errors and warnings that are
> raised during validation in the read, resolve and build phase of an SCA
> composite.
> - The code still throws all kind of exceptions as it was doing earlier, to
> avoid a null pointer exception in furthur processing.
> - All the exception/warning messages are customized using specified
> resource bundle. Each module has its own resource bundle.
>
> Here are few work items that are currently in progress:
> - itest for the validation errors.
> - Identify which exceptions are safe to ignore, so that we allow the
> processing to proceed furthur. This way we could catch hold of max possible
> user-errors in one go.
>
>
> On 5/6/08, Simon Laws <si...@googlemail.com> wrote:
> >
> > On Mon, May 5, 2008 at 5:54 PM, Hasan Muhammad <ap...@gmail.com> wrote:
> >
> > > So if plugins want to create their own monitor, what will happen in
> > this
> > > case? Now, the way plugins have control is, by looking at the
> > messageID of
> > > the problem, they can decide whether they want to change the behaviour
> > > from
> > > a warning to error, etc.
> > >
> > > regard
> > > Hasan
> > >
> > > On Fri, May 2, 2008 at 11:23 AM, Jean-Sebastien Delfino <
> > > jsdelfino@apache.org> wrote:
> > >
> > > > Simon Laws wrote:
> > > >
> > > > >
> > > > > Depending where you actually catch the exception you should be
> > able to
> > > > > continue on and process the next artifact.
> > > > >
> > > > >
> > > > Hmmm, the idea with monitors is to allow the processing code to
> > report
> > > > warnings and continue or multiple errors per artifact for example.
> > > >
> > > > Not sure about how it'll work with exceptions?
> > > > --
> > > > Jean-Sebastien
> > > >
> > >
> >
> > The suggestion is still that monitors get access to all the
> > errors/warnings
> > that the system generates for display to the user so you will be able to
> > take the same approach.
> >
> > Simon
> >
>
>
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam




-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: How do you plug in validation monitoring?

Posted by Ramkumar R <ra...@gmail.com>.
Patches for TUSCANY-2277 are now available with the following changes:

- The monitors now have access to all of the errors and warnings that are
raised during validation in the read, resolve and build phase of an SCA
composite.
- The code still throws all kind of exceptions as it was doing earlier, to
avoid a null pointer exception in furthur processing.
- All the exception/warning messages are customized using specified resource
bundle. Each module has its own resource bundle.

Here are few work items that are currently in progress:
- itest for the validation errors.
- Identify which exceptions are safe to ignore, so that we allow the
processing to proceed furthur. This way we could catch hold of max possible
user-errors in one go.


On 5/6/08, Simon Laws <si...@googlemail.com> wrote:
>
> On Mon, May 5, 2008 at 5:54 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > So if plugins want to create their own monitor, what will happen in this
> > case? Now, the way plugins have control is, by looking at the messageID
> of
> > the problem, they can decide whether they want to change the behaviour
> > from
> > a warning to error, etc.
> >
> > regard
> > Hasan
> >
> > On Fri, May 2, 2008 at 11:23 AM, Jean-Sebastien Delfino <
> > jsdelfino@apache.org> wrote:
> >
> > > Simon Laws wrote:
> > >
> > > >
> > > > Depending where you actually catch the exception you should be able
> to
> > > > continue on and process the next artifact.
> > > >
> > > >
> > > Hmmm, the idea with monitors is to allow the processing code to report
> > > warnings and continue or multiple errors per artifact for example.
> > >
> > > Not sure about how it'll work with exceptions?
> > > --
> > > Jean-Sebastien
> > >
> >
>
> The suggestion is still that monitors get access to all the
> errors/warnings
> that the system generates for display to the user so you will be able to
> take the same approach.
>
> Simon
>



-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Mon, May 5, 2008 at 5:54 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> So if plugins want to create their own monitor, what will happen in this
> case? Now, the way plugins have control is, by looking at the messageID of
> the problem, they can decide whether they want to change the behaviour
> from
> a warning to error, etc.
>
> regard
> Hasan
>
> On Fri, May 2, 2008 at 11:23 AM, Jean-Sebastien Delfino <
> jsdelfino@apache.org> wrote:
>
> > Simon Laws wrote:
> >
> > >
> > > Depending where you actually catch the exception you should be able to
> > > continue on and process the next artifact.
> > >
> > >
> > Hmmm, the idea with monitors is to allow the processing code to report
> > warnings and continue or multiple errors per artifact for example.
> >
> > Not sure about how it'll work with exceptions?
> > --
> > Jean-Sebastien
> >
>

The suggestion is still that monitors get access to all the errors/warnings
that the system generates for display to the user so you will be able to
take the same approach.

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
So if plugins want to create their own monitor, what will happen in this
case? Now, the way plugins have control is, by looking at the messageID of
the problem, they can decide whether they want to change the behaviour from
a warning to error, etc.

regard
Hasan

On Fri, May 2, 2008 at 11:23 AM, Jean-Sebastien Delfino <
jsdelfino@apache.org> wrote:

> Simon Laws wrote:
>
> >
> > Depending where you actually catch the exception you should be able to
> > continue on and process the next artifact.
> >
> >
> Hmmm, the idea with monitors is to allow the processing code to report
> warnings and continue or multiple errors per artifact for example.
>
> Not sure about how it'll work with exceptions?
> --
> Jean-Sebastien
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Fri, May 2, 2008 at 4:23 PM, Jean-Sebastien Delfino <js...@apache.org>
wrote:

> Simon Laws wrote:
>
> >
> > Depending where you actually catch the exception you should be able to
> > continue on and process the next artifact.
> >
> >
> Hmmm, the idea with monitors is to allow the processing code to report
> warnings and continue or multiple errors per artifact for example.
>
> Not sure about how it'll work with exceptions?
> --
> Jean-Sebastien
>

Ok,  well we could push the problem generation right down into the
processors. There are quite a lot of specific exceptions down there. Does
anything depend on these or can we just remove them.

Simon

Re: How do you plug in validation monitoring?

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Simon Laws wrote:
> 
> Depending where you actually catch the exception you should be able to
> continue on and process the next artifact.
> 

Hmmm, the idea with monitors is to allow the processing code to report 
warnings and continue or multiple errors per artifact for example.

Not sure about how it'll work with exceptions?
-- 
Jean-Sebastien

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Fri, May 2, 2008 at 11:46 AM, Ramkumar R <ra...@gmail.com> wrote:

> Hi Simon,
> While converting the error/warning messages over to the monitor using
> TUSCANY-2277, i realized that it would be a tedious/not a practical job to
> include monitor in all parts of the code.
>
> For example, for converting the messages from all the ArtifactProcessor
> (for
> which we have 74 instances), I feel it would not be a good idea to pass on
> the monitor to each constructor and use them accordingly. Instead what we
> can try is to catch the exception thrown by ArtifactProcessor and log them
> into the monitor from the calling classes like ContributionServiceImpl
> OR CompositeBuilderImpl
> OR CompositeActivatorImpl.
>
> Hope this would help. Please let me know your thoughts. Thanks.
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>
> On 4/29/08, Ramkumar R <ra...@gmail.com> wrote:
> >
> > Hi Simon,
> > Thanks for your detailed comments, that gives a clear picture. I have
> now
> > opened a JIRA (TUSCANY-2277) to address this issue. By this defect we
> > will standardize the way messages are logged into the monitor.
> >
> > Will keep things posted in this thread for any complicated situations
> and
> > if i am not sure about any exceptions that are thrown.
> >
> > --
> > Thanks & Regards,
> > Ramkumar Ramalingam
> >
> >  On 4/29/08, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > On Mon, Apr 28, 2008 at 1:42 PM, Ramkumar R <ra...@gmail.com>
> > > wrote:
> > >
> > > > On 4/25/08, Simon Laws <si...@googlemail.com> wrote:
> > > > >
> > > > > On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <
> appaos@gmail.com>
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I opened JIRA 2260 and attached a second batch of validation
> > > test
> > > > > cases.
> > > > > > >
> > > > > > > regards
> > > > > > > Hasan
> > > > > > >
> > > > > > > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon
> > > > > > > >
> > > > > > > > I opened JIRA 2255 and attached a patch for the new
> testcases.
> > > > > > > >
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > We should have an api for plugins to provide a
> resource
> > > > bundle.
> > > > > > > This
> > > > > > > > > api
> > > > > > > > > > > probably needs to be on the monitor or somewhere, i am
> > > not
> > > > > sure.
> > > > > > > But
> > > > > > > > > the
> > > > > > > > > > > scenario occurs when plugins want to use the default
> > > Monitor
> > > > > but
> > > > > > > > > still
> > > > > > > > > > > want
> > > > > > > > > > > to use their own resource bundle for messageIDs.
> > > > > > > > > > >
> > > > > > > > > > > regards
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > I looked at the new Monitor and Problem interfaces.
> > > What
> > > > do
> > > > > > > > > > > getMessageId()
> > > > > > > > > > > > and getMessageParams() actually return? is MessageId
> a
> > > way
> > > > to
> > > > > > > > > > > categorize the
> > > > > > > > > > > > error message?
> > > > > > > > > > > >
> > > > > > > > > > > > regards
> > > > > > > > > > > > Hasan
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > > > > > > appaos@gmail.com
> > > > > > > > > >
> > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > >
> > > > > > > > > > > > > I was wondering if i can cook up some validation
> > > test
> > > > cases
> > > > > > > if
> > > > > > > > > they
> > > > > > > > > > > do
> > > > > > > > > > > > > not exist. Or should we wait until the monitor
> issue
> > > is
> > > > > > > resolved
> > > > > > > > > ?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I dont think using an underlying tuscany jdk
> > > logger
> > > > would
> > > > > > > be
> > > > > > > > > > > useful to
> > > > > > > > > > > > > > plugins as they may not want to log, rather show
> > > it
> > > > > > > somewhere
> > > > > > > > > else
> > > > > > > > > > > such as
> > > > > > > > > > > > > > console etc. Tuscany can use an underlying
> logger
> > > in
> > > > it's
> > > > > > > own
> > > > > > > > > > > monitor ( as
> > > > > > > > > > > > > > it uses today). But i think the first approach
> of
> > > > using a
> > > > > > > > > monitor
> > > > > > > > > > > is better
> > > > > > > > > > > > > > along with the condition that it be made more
> > > usable
> > > > by
> > > > > > > the
> > > > > > > > > > > plugins by
> > > > > > > > > > > > > > giving them greater control.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Another point is that tuscany should use
> > > > ResourceBundle
> > > > > > > for
> > > > > > > > > > > validation
> > > > > > > > > > > > > > messages as well. I dont think this is being
> done
> > > > today.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan
> > > Muhammad <
> > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I am on revision 634808. The
> > > > > ContributionServiceImpl
> > > > > > > has
> > > > > > > > > > > changed
> > > > > > > > > > > > > > > since
> > > > > > > > > > > > > > > > > then,
> > > > > > > > > > > > > > > > > and with the one that i have, it would
> lead
> > > > through
> > > > > > > the
> > > > > > > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > > > > > > instead of the CompositeDocumentProcessor.
> > > Hence
> > > > > the
> > > > > > > > > > > difference
> > > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > exceptions..
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Also, dont you think that with the error
> > > that
> > > > you
> > > > > > > got
> > > > > > > > > should
> > > > > > > > > > > > > > > throw an
> > > > > > > > > > > > > > > > > exception with schema validation, rather
> > > than
> > > > just
> > > > > a
> > > > > > > > > > > warning?
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws
> <
> > > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan
> > > Muhammad
> > > > <
> > > > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Thank you for the good information.
> > > First up
> > > > i
> > > > > > > am
> > > > > > > > > trying
> > > > > > > > > > > to
> > > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > > > whether
> > > > > > > > > > > > > > > > > > > the schema validation works when we
> > > point to
> > > > > our
> > > > > > > > > > > schemas.
> > > > > > > > > > > > > > > Can you
> > > > > > > > > > > > > > > > > let me
> > > > > > > > > > > > > > > > > > > know what is a simple error that i can
> > > > > introduce
> > > > > > > so
> > > > > > > > > that
> > > > > > > > > > > i
> > > > > > > > > > > > > > > can
> > > > > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > > > > > > I tried doing this to my composite
> file
> > > (In
> > > > > > > block
> > > > > > > > > red):
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >  <component
> > > name="MyServiceComponentNew">
> > > > > > > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > > > > > >
> > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > > > > > > >    <property name="location"
> > > > > > > source="$newLocation"/>
> > > > > > > > > > > > > > > > > > >    <property name="year"
> > > source="$newYear"/>
> > > > > > > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > This resulted in the following
> > > exception,
> > > > but i
> > > > > > > > > think
> > > > > > > > > > > this
> > > > > > > > > > > > > > > is part
> > > > > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > > validation done by artifact processor
> > > and
> > > > would
> > > > > > > > > result
> > > > > > > > > > > even
> > > > > > > > > > > > > > > if we
> > > > > > > > > > > > > > > > > > comment
> > > > > > > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > > > > > > Unexpected <binding> element found. It
> > > > should
> > > > > > > appear
> > > > > > > > > > > inside
> > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > <service>
> > > > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon
> > > Laws <
> > > > > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM,
> Hasan
> > > > > Muhammad
> > > > > > > <
> > > > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > Currently, i see that we have
> > > various
> > > > > places
> > > > > > > > > where
> > > > > > > > > > > we
> > > > > > > > > > > > > > > can plug
> > > > > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > > > > > > monitoring. Some of the ones that
> i
> > > > found
> > > > > > > are in
> > > > > > > > > the
> > > > > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown
> > > > below:
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > InterfaceContractMapper
> > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > > > >            SCABindingFactory
> > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > >
> > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > > >            List<PolicySet>
> > > > > domainPolicySets)
> > > > > > > {
> > > > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > Instead of passing null, we can
> pass
> > > in
> > > > our
> > > > > > > own
> > > > > > > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > > > > > > these the only places where we
> need
> > > to
> > > > do
> > > > > > > this?
> > > > > > > > > or
> > > > > > > > > > > are
> > > > > > > > > > > > > > > there
> > > > > > > > > > > > > > > > > other
> > > > > > > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > There are a few places that
> logically
> > > we
> > > > need
> > > > > > > to
> > > > > > > > > be
> > > > > > > > > > > able
> > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > validate
> > > > > > > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > > > > > > and hence add monitors. The story is
> > > > changing
> > > > > > > a
> > > > > > > > > little
> > > > > > > > > > > as
> > > > > > > > > > > > > > > we are
> > > > > > > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > > > > > > toward the new "workspace"  code for
> > > > managing
> > > > > > > > > > > > > > > contributions but
> > > > > > > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > > > > > > would expect to be running
> validating
> > > on
> > > > at
> > > > > > > least
> > > > > > > > > the
> > > > > > > > > > > > > > > following
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > > > > > > >   - dependency (imports/exports)
> > > analysis
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > > > > > > need
> > > > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > > > look at this in context of
> workspace]
> > > > > > > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > >
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > > > > > > >   - extension availability [General
> > > > artifact
> > > > > > > > > processor
> > > > > > > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > > > > > > >   - ensure that artifacts required
> by
> > > the
> > > > > > > > > composite
> > > > > > > > > > > are
> > > > > > > > > > > > > > > available
> > > > > > > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > > > > > > >   - ensure that the composite is
> valid
> > > and
> > > > > > > > > consistent,
> > > > > > > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > > > > > > component names, valid reference
> > > targets
> > > > etc.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > I've noted in the square brackets
> > > where
> > > > this
> > > > > > > > > function
> > > > > > > > > > > > > > > currently
> > > > > > > > > > > > > > > > > is.
> > > > > > > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > > > > > > also that I'm making no comment here
> > > about
> > > > > > > whether
> > > > > > > > > the
> > > > > > > > > > > > > > > > > construction of
> > > > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > > > in-memory composite model is for use
> > > > purely
> > > > > > > for
> > > > > > > > > > > > > > > contribution
> > > > > > > > > > > > > > > > > > processing
> > > > > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > > > > is going to activated and started in
> a
> > > > > > > runtime.
> > > > > > > > > This
> > > > > > > > > > > > > > > validation is
> > > > > > > > > > > > > > > > > > > > appropriate in both cases although
> you
> > > may
> > > > > > > choose
> > > > > > > > > to
> > > > > > > > > > > use
> > > > > > > > > > > > > > > different
> > > > > > > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > So what I suggest as a first step is
> > > that
> > > > you
> > > > > > > go
> > > > > > > > > ahead
> > > > > > > > > > > and
> > > > > > > > > > > > > > > change
> > > > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a
> > > > monitor
> > > > > > > into
> > > > > > > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > > > > > > how it works. We can work here to
> > > build a
> > > > > > > > > consistent
> > > > > > > > > > > view
> > > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > - all the places a monitor is
> required
> > > > > > > > > > > > > > > > > > > > - what should the plugin model for
> > > > monitors
> > > > > be
> > > > > > > > > > > > > > > > > > > > - the flow of control (monitors vs
> > > > > exceptions)
> > > > > > > > > > > > > > > > > > > > - what extra features may be
> required,
> > > > I18N
> > > > > > > etc.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > I'm going to try a few experiments
> too
> > > to
> > > > > > > > > familiarize
> > > > > > > > > > > > > > > myself with
> > > > > > > > > > > > > > > > > this
> > > > > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > The change you suggest should cause a
> > > schema
> > > > > > > > > validation
> > > > > > > > > > > error.
> > > > > > > > > > > > > > > I made
> > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > change locally in samples/calculator and
> > > see
> > > > the
> > > > > > > > > following
> > > > > > > > > > > > > > > output in
> > > > > > > > > > > > > > > > > > stdout
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > > > > > > error
> > > > > > > > > > > > > > > > > > WARNING: XMLSchema validation problem
> in:
> > > > null,
> > > > > > > line:
> > > > > > > > > 28,
> > > > > > > > > > > > > > > column: 5
> > > > > > > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content
> > > was
> > > > found
> > > > > > > > > starting
> > > > > > > > > > > > > > > with
> > > > > > > > > > > > > > > > > element '
> > > > > > > > > > > > > > > > > > binding.ws'. One of '{"
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > > > > > > ":include,
> > > > > > > > > > > > > > > "
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> ":service,
> > > "
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> ":property,
> > > "
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > ":component,
> > > > "
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > ":reference,
> > > > "
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > > > > > > WC[##other:"
> > > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is
> > > > > expected.
> > > > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > > > > > > read
> > > > > > > > > > > > > > > > > > WARNING: Element {
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <
> > > > > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > > <
> http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > > > > <
> > > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > > > > > > >cannot
> > > > > > > > > be
> > > > > > > > > > > > > > > > > > processed. ([row,col {unknown-source}]:
> > > > [28,5])
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Ok, thanks for that Hasan. I see the change
> > > you
> > > > are
> > > > > > > > > > > referencing.
> > > > > > > > > > > > > > > I'm not
> > > > > > > > > > > > > > > > sure why the exception is no longer thrown.
> > > The
> > > > code
> > > > > > > is
> > > > > > > > > still
> > > > > > > > > > > in
> > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > CompositeProcessor to trap the case but
> maybe
> > > the
> > > > > > > > > offending
> > > > > > > > > > > > > > > element is
> > > > > > > > > > > > > > > > removed from the stream because of the
> > > validation
> > > > > > > warning.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I would argue that we shouldn't mandate that
> > > an
> > > > > > > exception
> > > > > > > > > is
> > > > > > > > > > > > > > > thrown in
> > > > > > > > > > > > > > > > this case but that the validation mechanism
> is
> > > > opened
> > > > > > > up
> > > > > > > > > to
> > > > > > > > > > > the
> > > > > > > > > > > > > > > monitor API
> > > > > > > > > > > > > > > > so that a monitor can be attached and those
> > > who
> > > > are
> > > > > > > > > embedding
> > > > > > > > > > > > > > > tuscany can
> > > > > > > > > > > > > > > > decide how they want to deal with errors
> like
> > > > this.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hi
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I've just been through the original list again
> > > > looking
> > > > > > > at
> > > > > > > > > what
> > > > > > > > > > > > > > > happens with
> > > > > > > > > > > > > > > validation types errors (by which I mean a
> > > workspace
> > > > > > > type
> > > > > > > > > admin
> > > > > > > > > > > > > > > console
> > > > > > > > > > > > > > > would reasonably want to display based on user
> > > > > > > > > input/changes).
> > > > > > > > > > > This
> > > > > > > > > > > > > > > is what
> > > > > > > > > > > > > > > I found.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > > > > > > >      uses a
> ContributionDependencyBuilderMonitor
> > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > > > > > > >    - policy intent matching
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > > >    - extension availability
> > > > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > > >   - SCA compliance, e.g. annotation
> correctness
> > > > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > > > >     Throws exceptions
> > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > >   - ensure that artifacts required by the
> > > composite
> > > > are
> > > > > > > > > > > available
> > > > > > > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > > consistent,
> > > > > > > e.g.
> > > > > > > > > > > unique
> > > > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I would like to look for a more consistent
> > > approach
> > > > > > > across
> > > > > > > > > these
> > > > > > > > > > > > > > > various
> > > > > > > > > > > > > > > elements of validation. The aim being to make
> it
> > > > more
> > > > > > > > > obvious
> > > > > > > > > > > how to
> > > > > > > > > > > > > > > recognize validation type errors and act
> > > > accordingly.
> > > > > > > There
> > > > > > > > > has
> > > > > > > > > > > been
> > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > relatively lengthy debate about how to group
> and
> > > > report
> > > > > > > > > errors
> > > > > > > > > > > in
> > > > > > > > > > > > > > > [1] which
> > > > > > > > > > > > > > > is worth a read. The scenarios I have in mind
> > > are
> > > > > > > workspace
> > > > > > > > > > > > > > > administration
> > > > > > > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Add a contribution and be notified that
> > > > contributions
> > > > > > > that
> > > > > > > > > it
> > > > > > > > > > > > > > > depends on are
> > > > > > > > > > > > > > > not available
> > > > > > > > > > > > > > > Look at a composite and be notified that there
> > > are
> > > > XML
> > > > > > > > > and/or
> > > > > > > > > > > SCA
> > > > > > > > > > > > > > > errors
> > > > > > > > > > > > > > > etc.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > From [1] we want to capture as many errors as
> > > > possible
> > > > > > > > > before
> > > > > > > > > > > > > > > reporting back
> > > > > > > > > > > > > > > to the user. Two things come immediately to
> > > mind.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > 1 - Pull up the Monitor API and make it more
> > > generic
> > > > > > > (and
> > > > > > > > > from
> > > > > > > > > > > > > > > previous
> > > > > > > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and
> > > remove
> > > > > the
> > > > > > > > > monitor
> > > > > > > > > > > (or
> > > > > > > > > > > > > > > at
> > > > > > > > > > > > > > > least don't extend it further).
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I'm going to think some more about these
> > > options.
> > > > Any
> > > > > > > > > thoughts
> > > > > > > > > > > or
> > > > > > > > > > > > > > > more
> > > > > > > > > > > > > > > options?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > [1]
> > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Hi Hasan
> > > > > > > > > >
> > > > > > > > > > What do you mean in your question by "plugin". If you
> mean
> > > an
> > > > > > > Tuscany
> > > > > > > > > > extension then I think we have that covered as each
> > > extension
> > > > > will
> > > > > > > > > ship with
> > > > > > > > > > any bundles that it needs and stll the default monitor
> can
> > > be
> > > > > > > used.
> > > > > > > > > >
> > > > > > > > > > Here is the model I have in my head of this.
> > > > > > > > > >
> > > > > > > > > > runtime
> > > > > > > > > >   monitor
> > > > > > > > > >   module (there are many of these in the runtime)
> > > > > > > > > >     resource bundle
> > > > > > > > > >     raises problems - each problem references the name
> of
> > > a
> > > > > > > resource
> > > > > > > > > > bundle for the modules in question (I don't believe I
> can
> > > get
> > > > the
> > > > > > > name
> > > > > > > > > of
> > > > > > > > > > the module automatically)
> > > > > > > > > >
> > > > > > > > > > So I'm anticipating that the runtime will create a
> single
> > > > monitor
> > > > > > > but
> > > > > > > > > this
> > > > > > > > > > is not a hard and fast rule.
> > > > > > > > > >
> > > > > > > > > > Each module/extension raises problems referencing the
> > > resource
> > > > > > > bundle
> > > > > > > > > that
> > > > > > > > > > it contains. Hence the module provides messages
> > > appropriate to
> > > > > > > errors
> > > > > > > > > that
> > > > > > > > > > it will raise. The resource bundle reference is by root
> > > name
> > > > so
> > > > > > > there
> > > > > > > > > is not
> > > > > > > > > > reason why the resource bundle couldn't be put somewhere
> > > else.
> > > > > > > > > >
> > > > > > > > > > If you want to change the default messages that are
> > > provided,
> > > > as
> > > > > > > > > opposed
> > > > > > > > > > to create a new extension with new messages, there are a
> > > > number
> > > > > of
> > > > > > > > > options.
> > > > > > > > > >
> > > > > > > > > > - The source code approach - i.e. change the
> > > bundles  provided
> > > > > > > > > > - Provide new bundles first on the classpath - I think
> > > they
> > > > will
> > > > > > > get
> > > > > > > > > > picked up in preference to the default ones but I would
> > > have
> > > > to
> > > > > > > test
> > > > > > > > > it to
> > > > > > > > > > see
> > > > > > > > > > - We could reorganize the bundles so they are in their
> in
> > > > their
> > > > > > > own
> > > > > > > > > > separate jars. Then you would provide a replacement jar.
> > > > > > > > > > - Add an API to the monitor to allow a bundle mapping to
> > > be
> > > > > > > specified.
> > > > > > > > > In
> > > > > > > > > > this case though it seems easier to provide a new
> monitor
> > > > > > > > > implementation
> > > > > > > > > > rather than providing a new API.
> > > > > > > > > >
> > > > > > > > > > There are probably more options so any thoughts are
> > > welcome.
> > > > I'm
> > > > > > > > > currently
> > > > > > > > > > working on getting the new monitor integrated into the
> > > > existing
> > > > > > > > > modules
> > > > > > > > > > (primarily assembly) so we will have something to try
> out.
> > > We
> > > > can
> > > > > > > take
> > > > > > > > > a
> > > > > > > > > > look at these options for real when I'm done.
> > > > > > > > > >
> > > > > > > > > > Simon
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi
> > > > > > > > >
> > > > > > > > > I've just checked in the changes to do the basic
> integration
> > > of
> > > > the
> > > > > > > > > monitor
> > > > > > > > > extension with the rest of the code base. Its a light
> touch
> > > end
> > > > to
> > > > > > > end
> > > > > > > > > integration at the moment. Here are some of the TODOs
> > > > > > > > >
> > > > > > > > > - Move messages into resource bundles.
> > > > > > > > > - Local monitors are still created in some places.
> > > > > > > > > - If a monitor implementation is not found then a warning
> is
> > > > raised
> > > > > > > but
> > > > > > > > > execution continues so that I don't have to change the
> > > > dependencies
> > > > > > > of
> > > > > > > > > the
> > > > > > > > > many tests that now don't pull in a monitor but also don't
> > > raise
> > > > > any
> > > > > > > > > warnings. May want to address this but It's OK for the
> time
> > > > being.
> > > > > > > > >
> > > > > > > > > Hopefully now the validation itests make more sense now.
> The
> > > > test
> > > > > to
> > > > > > > > > look at
> > > > > > > > > is the duplicate component name test. This is the only
> > > message
> > > > I've
> > > > > > > > > moved
> > > > > > > > > out into a resource bundle at the moment. Now I have the
> > > basics
> > > > in
> > > > > > > I'll
> > > > > > > > > move
> > > > > > > > > all the messages and do the tidying up.
> > > > > > > > >
> > > > > > > > >  Also I've switched to using node instead of domain in the
> > > > tests. I
> > > > > > > > > notice
> > > > > > > > > we need to do some work on the constructor for this type
> of
> > > use.
> > > > > > > I'll
> > > > > > > > > work
> > > > > > > > > on this too.
> > > > > > > > >
> > > > > > > > > Regards
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > Hi Hasan
> > > > > >
> > > > > > have been running some of the validation code today and I notice
> > > that
> > > > > > quite a few of the reported error messages have their parameters
> > > > > > miss-aligned. I.e. I often see an unexpanded {1}. This is down
> the
> > > the
> > > > > > builder warning() method being called with too few parameters.
> It
> > > > takes
> > > > > >
> > > > > >  warning(String message, Object model, String...
> > > messageParameters)
> > > > > >
> > > > > > So if i had a {0} and a {1} in the message I would use something
> > > like
> > > > > >
> > > > > > warning("ReferenceIncompatibleInterface", composite,
> > > > > > componentReference.getName(), componentService.getName());
> > > > > >
> > > > > > Where the two parameters are passed in at the end.
> > > > > >
> > > > > > Easy enough for me to go and fix the ones I find but thought I
> > > would
> > > > > raise
> > > > > > it in case you are doing some more and spot mistakes.
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > > Simon
> > > > > >
> > > > > Hi
> > > > >
> > > > > Actually I went through the places where warning is called and
> they
> > > are
> > > > all
> > > > > pretty much perfect so I must have just hit the one bad one that
> > > have a
> > > > > missing parameter. As far as I know they are all good now.
> > > > >
> > > > > Simon
> > > > >
> > > >
> > > > Hi Simon,
> > > > I had a chance to look at the monitors that are being hooked up with
> > > > different parts of the code and found some inconsistency interms of
> > > > raising
> > > > warning & errors. In some places we throw exceptions and in other
> > > places
> > > > we
> > > > raise a warning. I also believe there are instances where we need to
> > > do
> > > > both, the below examples might give us some clue.....
> > > >
> > > > Here are some examples for the inconsistency.......
> > > >
> > > > BaseConfigurationBuilderImpl.java
> > > > Here we raise only a warning for URISyntaxException, should we not
> > > throw
> > > > an
> > > > exception too?
> > > >
> > > > BaseWireBuilderImpl.java
> > > > Here we throw exceptions for IncompatibleInterfaceContractException,
> > > don't
> > > > you think we also need to register this message in our monitor?
> > > > In the same class, we raise a warning message for the PolicyRelated
> > > > Exceptions, should we also throw an exception here?
> > > >
> > > > CompositeProcessor.java
> > > > There are instances where we throw new ContributionReadException, i
> > > > believe
> > > > registering this msg with a monitor is also required as this is
> caused
> > > by
> > > > incorrect user input.
> > > >
> > > > Like to know your views on this... so that we can consider a
> standard
> > > way
> > > > of
> > > > raising warning/errors using the monitor.
> > > >
> > > > --
> > > > Thanks & Regards,
> > > > Ramkumar Ramalingam
> > > >
> > >
> > > Hi Ram
> > >
> > > Good analysis. Looks like we've some work to do. I've just posted to
> an
> > > oldish thread [1] about the implications of raising errors and
> warnings.
> > > I
> > > think from what you say we have to.
> > >
> > > 1. Make sure we are raising errors/warnings on the monitor rather than
> > > throwing exceptions in code that is processing user input. I.e. we
> want
> > > all
> > > processing to complete as far as possible through each phase.
> > > 2. Make those errors/exception available from the monitor. We need a
> > > resettable cache
> > > 3. Allow problems to be retrieved from the monitor and analyzed
> (printed
> > > out
> > > to the console in our case)
> > >
> > > Regards
> > >
> > > Simon
> > >
> > > [1]
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29766.html
> > >
> >
>

Hi Ram

Sounds like the right approach, certainly for now. The "problem" interface
allow problems to be created based on exceptions so rather than throwing the
exception right up we can create a problem and lodge it with the monitor and
continue from there.

Depending where you actually catch the exception you should be able to
continue on and process the next artifact.

Regards

Simon

Re: How do you plug in validation monitoring?

Posted by Ramkumar R <ra...@gmail.com>.
Hi Simon,
While converting the error/warning messages over to the monitor using
TUSCANY-2277, i realized that it would be a tedious/not a practical job to
include monitor in all parts of the code.

For example, for converting the messages from all the ArtifactProcessor (for
which we have 74 instances), I feel it would not be a good idea to pass on
the monitor to each constructor and use them accordingly. Instead what we
can try is to catch the exception thrown by ArtifactProcessor and log them
into the monitor from the calling classes like ContributionServiceImpl
OR CompositeBuilderImpl
OR CompositeActivatorImpl.

Hope this would help. Please let me know your thoughts. Thanks.

-- 
Thanks & Regards,
Ramkumar Ramalingam

On 4/29/08, Ramkumar R <ra...@gmail.com> wrote:
>
> Hi Simon,
> Thanks for your detailed comments, that gives a clear picture. I have now
> opened a JIRA (TUSCANY-2277) to address this issue. By this defect we
> will standardize the way messages are logged into the monitor.
>
> Will keep things posted in this thread for any complicated situations and
> if i am not sure about any exceptions that are thrown.
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>
>  On 4/29/08, Simon Laws <si...@googlemail.com> wrote:
> >
> > On Mon, Apr 28, 2008 at 1:42 PM, Ramkumar R <ra...@gmail.com>
> > wrote:
> >
> > > On 4/25/08, Simon Laws <si...@googlemail.com> wrote:
> > > >
> > > > On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <
> > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I opened JIRA 2260 and attached a second batch of validation
> > test
> > > > cases.
> > > > > >
> > > > > > regards
> > > > > > Hasan
> > > > > >
> > > > > > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Simon
> > > > > > >
> > > > > > > I opened JIRA 2255 and attached a patch for the new testcases.
> > > > > > >
> > > > > > > Hasan
> > > > > > >
> > > > > > >
> > > > > > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > We should have an api for plugins to provide a resource
> > > bundle.
> > > > > > This
> > > > > > > > api
> > > > > > > > > > probably needs to be on the monitor or somewhere, i am
> > not
> > > > sure.
> > > > > > But
> > > > > > > > the
> > > > > > > > > > scenario occurs when plugins want to use the default
> > Monitor
> > > > but
> > > > > > > > still
> > > > > > > > > > want
> > > > > > > > > > to use their own resource bundle for messageIDs.
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > I looked at the new Monitor and Problem interfaces.
> > What
> > > do
> > > > > > > > > > getMessageId()
> > > > > > > > > > > and getMessageParams() actually return? is MessageId a
> > way
> > > to
> > > > > > > > > > categorize the
> > > > > > > > > > > error message?
> > > > > > > > > > >
> > > > > > > > > > > regards
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > > > > > appaos@gmail.com
> > > > > > > > >
> > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > I was wondering if i can cook up some validation
> > test
> > > cases
> > > > > > if
> > > > > > > > they
> > > > > > > > > > do
> > > > > > > > > > > > not exist. Or should we wait until the monitor issue
> > is
> > > > > > resolved
> > > > > > > > ?
> > > > > > > > > > > >
> > > > > > > > > > > > Hasan
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > >
> > > > > > > > > > > > > I dont think using an underlying tuscany jdk
> > logger
> > > would
> > > > > > be
> > > > > > > > > > useful to
> > > > > > > > > > > > > plugins as they may not want to log, rather show
> > it
> > > > > > somewhere
> > > > > > > > else
> > > > > > > > > > such as
> > > > > > > > > > > > > console etc. Tuscany can use an underlying logger
> > in
> > > it's
> > > > > > own
> > > > > > > > > > monitor ( as
> > > > > > > > > > > > > it uses today). But i think the first approach of
> > > using a
> > > > > > > > monitor
> > > > > > > > > > is better
> > > > > > > > > > > > > along with the condition that it be made more
> > usable
> > > by
> > > > > > the
> > > > > > > > > > plugins by
> > > > > > > > > > > > > giving them greater control.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Another point is that tuscany should use
> > > ResourceBundle
> > > > > > for
> > > > > > > > > > validation
> > > > > > > > > > > > > messages as well. I dont think this is being done
> > > today.
> > > > > > > > > > > > >
> > > > > > > > > > > > > regards
> > > > > > > > > > > > > Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan
> > Muhammad <
> > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I am on revision 634808. The
> > > > ContributionServiceImpl
> > > > > > has
> > > > > > > > > > changed
> > > > > > > > > > > > > > since
> > > > > > > > > > > > > > > > then,
> > > > > > > > > > > > > > > > and with the one that i have, it would lead
> > > through
> > > > > > the
> > > > > > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > > > > > instead of the CompositeDocumentProcessor.
> > Hence
> > > > the
> > > > > > > > > > difference
> > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > exceptions..
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Also, dont you think that with the error
> > that
> > > you
> > > > > > got
> > > > > > > > should
> > > > > > > > > > > > > > throw an
> > > > > > > > > > > > > > > > exception with schema validation, rather
> > than
> > > just
> > > > a
> > > > > > > > > > warning?
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan
> > Muhammad
> > > <
> > > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Thank you for the good information.
> > First up
> > > i
> > > > > > am
> > > > > > > > trying
> > > > > > > > > > to
> > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > > whether
> > > > > > > > > > > > > > > > > > the schema validation works when we
> > point to
> > > > our
> > > > > > > > > > schemas.
> > > > > > > > > > > > > > Can you
> > > > > > > > > > > > > > > > let me
> > > > > > > > > > > > > > > > > > know what is a simple error that i can
> > > > introduce
> > > > > > so
> > > > > > > > that
> > > > > > > > > > i
> > > > > > > > > > > > > > can
> > > > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > > > > > I tried doing this to my composite file
> > (In
> > > > > > block
> > > > > > > > red):
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >  <component
> > name="MyServiceComponentNew">
> > > > > > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > > > > >
> > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > > > > > >    <property name="location"
> > > > > > source="$newLocation"/>
> > > > > > > > > > > > > > > > > >    <property name="year"
> > source="$newYear"/>
> > > > > > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > This resulted in the following
> > exception,
> > > but i
> > > > > > > > think
> > > > > > > > > > this
> > > > > > > > > > > > > > is part
> > > > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > validation done by artifact processor
> > and
> > > would
> > > > > > > > result
> > > > > > > > > > even
> > > > > > > > > > > > > > if we
> > > > > > > > > > > > > > > > > comment
> > > > > > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > > > > > Unexpected <binding> element found. It
> > > should
> > > > > > appear
> > > > > > > > > > inside
> > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > <service>
> > > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon
> > Laws <
> > > > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan
> > > > Muhammad
> > > > > > <
> > > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Currently, i see that we have
> > various
> > > > places
> > > > > > > > where
> > > > > > > > > > we
> > > > > > > > > > > > > > can plug
> > > > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > > > > > monitoring. Some of the ones that i
> > > found
> > > > > > are in
> > > > > > > > the
> > > > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown
> > > below:
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > InterfaceContractMapper
> > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > > >            SCABindingFactory
> > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > >
> > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > > >            List<PolicySet>
> > > > domainPolicySets)
> > > > > > {
> > > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Instead of passing null, we can pass
> > in
> > > our
> > > > > > own
> > > > > > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > > > > > these the only places where we need
> > to
> > > do
> > > > > > this?
> > > > > > > > or
> > > > > > > > > > are
> > > > > > > > > > > > > > there
> > > > > > > > > > > > > > > > other
> > > > > > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > There are a few places that logically
> > we
> > > need
> > > > > > to
> > > > > > > > be
> > > > > > > > > > able
> > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > validate
> > > > > > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > > > > > and hence add monitors. The story is
> > > changing
> > > > > > a
> > > > > > > > little
> > > > > > > > > > as
> > > > > > > > > > > > > > we are
> > > > > > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > > > > > toward the new "workspace"  code for
> > > managing
> > > > > > > > > > > > > > contributions but
> > > > > > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > > > > > would expect to be running validating
> > on
> > > at
> > > > > > least
> > > > > > > > the
> > > > > > > > > > > > > > following
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > > > > > >   - dependency (imports/exports)
> > analysis
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > > > > > need
> > > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > >
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > > > > > >   - extension availability [General
> > > artifact
> > > > > > > > processor
> > > > > > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > > > > > >   - ensure that artifacts required by
> > the
> > > > > > > > composite
> > > > > > > > > > are
> > > > > > > > > > > > > > available
> > > > > > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > > > > > >   - ensure that the composite is valid
> > and
> > > > > > > > consistent,
> > > > > > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > > > > > component names, valid reference
> > targets
> > > etc.
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > I've noted in the square brackets
> > where
> > > this
> > > > > > > > function
> > > > > > > > > > > > > > currently
> > > > > > > > > > > > > > > > is.
> > > > > > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > > > > > also that I'm making no comment here
> > about
> > > > > > whether
> > > > > > > > the
> > > > > > > > > > > > > > > > construction of
> > > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > > in-memory composite model is for use
> > > purely
> > > > > > for
> > > > > > > > > > > > > > contribution
> > > > > > > > > > > > > > > > > processing
> > > > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > > > is going to activated and started in a
> > > > > > runtime.
> > > > > > > > This
> > > > > > > > > > > > > > validation is
> > > > > > > > > > > > > > > > > > > appropriate in both cases although you
> > may
> > > > > > choose
> > > > > > > > to
> > > > > > > > > > use
> > > > > > > > > > > > > > different
> > > > > > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > So what I suggest as a first step is
> > that
> > > you
> > > > > > go
> > > > > > > > ahead
> > > > > > > > > > and
> > > > > > > > > > > > > > change
> > > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a
> > > monitor
> > > > > > into
> > > > > > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > > > > > how it works. We can work here to
> > build a
> > > > > > > > consistent
> > > > > > > > > > view
> > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > > > > > > - what should the plugin model for
> > > monitors
> > > > be
> > > > > > > > > > > > > > > > > > > - the flow of control (monitors vs
> > > > exceptions)
> > > > > > > > > > > > > > > > > > > - what extra features may be required,
> > > I18N
> > > > > > etc.
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > I'm going to try a few experiments too
> > to
> > > > > > > > familiarize
> > > > > > > > > > > > > > myself with
> > > > > > > > > > > > > > > > this
> > > > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > The change you suggest should cause a
> > schema
> > > > > > > > validation
> > > > > > > > > > error.
> > > > > > > > > > > > > > I made
> > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > change locally in samples/calculator and
> > see
> > > the
> > > > > > > > following
> > > > > > > > > > > > > > output in
> > > > > > > > > > > > > > > > > stdout
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > > > > > error
> > > > > > > > > > > > > > > > > WARNING: XMLSchema validation problem in:
> > > null,
> > > > > > line:
> > > > > > > > 28,
> > > > > > > > > > > > > > column: 5
> > > > > > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content
> > was
> > > found
> > > > > > > > starting
> > > > > > > > > > > > > > with
> > > > > > > > > > > > > > > > element '
> > > > > > > > > > > > > > > > > binding.ws'. One of '{"
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > > > > > ":include,
> > > > > > > > > > > > > > "
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service,
> > "
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property,
> > "
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > ":component,
> > > "
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > ":reference,
> > > "
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > > > > > WC[##other:"
> > > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is
> > > > expected.
> > > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > > > > > read
> > > > > > > > > > > > > > > > > WARNING: Element {
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <
> > > > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > > > <
> > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > > > > > >cannot
> > > > > > > > be
> > > > > > > > > > > > > > > > > processed. ([row,col {unknown-source}]:
> > > [28,5])
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Ok, thanks for that Hasan. I see the change
> > you
> > > are
> > > > > > > > > > referencing.
> > > > > > > > > > > > > > I'm not
> > > > > > > > > > > > > > > sure why the exception is no longer thrown.
> > The
> > > code
> > > > > > is
> > > > > > > > still
> > > > > > > > > > in
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > CompositeProcessor to trap the case but maybe
> > the
> > > > > > > > offending
> > > > > > > > > > > > > > element is
> > > > > > > > > > > > > > > removed from the stream because of the
> > validation
> > > > > > warning.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I would argue that we shouldn't mandate that
> > an
> > > > > > exception
> > > > > > > > is
> > > > > > > > > > > > > > thrown in
> > > > > > > > > > > > > > > this case but that the validation mechanism is
> > > opened
> > > > > > up
> > > > > > > > to
> > > > > > > > > > the
> > > > > > > > > > > > > > monitor API
> > > > > > > > > > > > > > > so that a monitor can be attached and those
> > who
> > > are
> > > > > > > > embedding
> > > > > > > > > > > > > > tuscany can
> > > > > > > > > > > > > > > decide how they want to deal with errors like
> > > this.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I've just been through the original list again
> > > looking
> > > > > > at
> > > > > > > > what
> > > > > > > > > > > > > > happens with
> > > > > > > > > > > > > > validation types errors (by which I mean a
> > workspace
> > > > > > type
> > > > > > > > admin
> > > > > > > > > > > > > > console
> > > > > > > > > > > > > > would reasonably want to display based on user
> > > > > > > > input/changes).
> > > > > > > > > > This
> > > > > > > > > > > > > > is what
> > > > > > > > > > > > > > I found.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > > > > > >    - policy intent matching
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > >    - extension availability
> > > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > > >     Throws exceptions
> > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > >   - ensure that artifacts required by the
> > composite
> > > are
> > > > > > > > > > available
> > > > > > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > consistent,
> > > > > > e.g.
> > > > > > > > > > unique
> > > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I would like to look for a more consistent
> > approach
> > > > > > across
> > > > > > > > these
> > > > > > > > > > > > > > various
> > > > > > > > > > > > > > elements of validation. The aim being to make it
> > > more
> > > > > > > > obvious
> > > > > > > > > > how to
> > > > > > > > > > > > > > recognize validation type errors and act
> > > accordingly.
> > > > > > There
> > > > > > > > has
> > > > > > > > > > been
> > > > > > > > > > > > > > a
> > > > > > > > > > > > > > relatively lengthy debate about how to group and
> > > report
> > > > > > > > errors
> > > > > > > > > > in
> > > > > > > > > > > > > > [1] which
> > > > > > > > > > > > > > is worth a read. The scenarios I have in mind
> > are
> > > > > > workspace
> > > > > > > > > > > > > > administration
> > > > > > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Add a contribution and be notified that
> > > contributions
> > > > > > that
> > > > > > > > it
> > > > > > > > > > > > > > depends on are
> > > > > > > > > > > > > > not available
> > > > > > > > > > > > > > Look at a composite and be notified that there
> > are
> > > XML
> > > > > > > > and/or
> > > > > > > > > > SCA
> > > > > > > > > > > > > > errors
> > > > > > > > > > > > > > etc.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > From [1] we want to capture as many errors as
> > > possible
> > > > > > > > before
> > > > > > > > > > > > > > reporting back
> > > > > > > > > > > > > > to the user. Two things come immediately to
> > mind.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 1 - Pull up the Monitor API and make it more
> > generic
> > > > > > (and
> > > > > > > > from
> > > > > > > > > > > > > > previous
> > > > > > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and
> > remove
> > > > the
> > > > > > > > monitor
> > > > > > > > > > (or
> > > > > > > > > > > > > > at
> > > > > > > > > > > > > > least don't extend it further).
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I'm going to think some more about these
> > options.
> > > Any
> > > > > > > > thoughts
> > > > > > > > > > or
> > > > > > > > > > > > > > more
> > > > > > > > > > > > > > options?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > [1]
> > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi Hasan
> > > > > > > > >
> > > > > > > > > What do you mean in your question by "plugin". If you mean
> > an
> > > > > > Tuscany
> > > > > > > > > extension then I think we have that covered as each
> > extension
> > > > will
> > > > > > > > ship with
> > > > > > > > > any bundles that it needs and stll the default monitor can
> > be
> > > > > > used.
> > > > > > > > >
> > > > > > > > > Here is the model I have in my head of this.
> > > > > > > > >
> > > > > > > > > runtime
> > > > > > > > >   monitor
> > > > > > > > >   module (there are many of these in the runtime)
> > > > > > > > >     resource bundle
> > > > > > > > >     raises problems - each problem references the name of
> > a
> > > > > > resource
> > > > > > > > > bundle for the modules in question (I don't believe I can
> > get
> > > the
> > > > > > name
> > > > > > > > of
> > > > > > > > > the module automatically)
> > > > > > > > >
> > > > > > > > > So I'm anticipating that the runtime will create a single
> > > monitor
> > > > > > but
> > > > > > > > this
> > > > > > > > > is not a hard and fast rule.
> > > > > > > > >
> > > > > > > > > Each module/extension raises problems referencing the
> > resource
> > > > > > bundle
> > > > > > > > that
> > > > > > > > > it contains. Hence the module provides messages
> > appropriate to
> > > > > > errors
> > > > > > > > that
> > > > > > > > > it will raise. The resource bundle reference is by root
> > name
> > > so
> > > > > > there
> > > > > > > > is not
> > > > > > > > > reason why the resource bundle couldn't be put somewhere
> > else.
> > > > > > > > >
> > > > > > > > > If you want to change the default messages that are
> > provided,
> > > as
> > > > > > > > opposed
> > > > > > > > > to create a new extension with new messages, there are a
> > > number
> > > > of
> > > > > > > > options.
> > > > > > > > >
> > > > > > > > > - The source code approach - i.e. change the
> > bundles  provided
> > > > > > > > > - Provide new bundles first on the classpath - I think
> > they
> > > will
> > > > > > get
> > > > > > > > > picked up in preference to the default ones but I would
> > have
> > > to
> > > > > > test
> > > > > > > > it to
> > > > > > > > > see
> > > > > > > > > - We could reorganize the bundles so they are in their in
> > > their
> > > > > > own
> > > > > > > > > separate jars. Then you would provide a replacement jar.
> > > > > > > > > - Add an API to the monitor to allow a bundle mapping to
> > be
> > > > > > specified.
> > > > > > > > In
> > > > > > > > > this case though it seems easier to provide a new monitor
> > > > > > > > implementation
> > > > > > > > > rather than providing a new API.
> > > > > > > > >
> > > > > > > > > There are probably more options so any thoughts are
> > welcome.
> > > I'm
> > > > > > > > currently
> > > > > > > > > working on getting the new monitor integrated into the
> > > existing
> > > > > > > > modules
> > > > > > > > > (primarily assembly) so we will have something to try out.
> > We
> > > can
> > > > > > take
> > > > > > > > a
> > > > > > > > > look at these options for real when I'm done.
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I've just checked in the changes to do the basic integration
> > of
> > > the
> > > > > > > > monitor
> > > > > > > > extension with the rest of the code base. Its a light touch
> > end
> > > to
> > > > > > end
> > > > > > > > integration at the moment. Here are some of the TODOs
> > > > > > > >
> > > > > > > > - Move messages into resource bundles.
> > > > > > > > - Local monitors are still created in some places.
> > > > > > > > - If a monitor implementation is not found then a warning is
> > > raised
> > > > > > but
> > > > > > > > execution continues so that I don't have to change the
> > > dependencies
> > > > > > of
> > > > > > > > the
> > > > > > > > many tests that now don't pull in a monitor but also don't
> > raise
> > > > any
> > > > > > > > warnings. May want to address this but It's OK for the time
> > > being.
> > > > > > > >
> > > > > > > > Hopefully now the validation itests make more sense now. The
> > > test
> > > > to
> > > > > > > > look at
> > > > > > > > is the duplicate component name test. This is the only
> > message
> > > I've
> > > > > > > > moved
> > > > > > > > out into a resource bundle at the moment. Now I have the
> > basics
> > > in
> > > > > > I'll
> > > > > > > > move
> > > > > > > > all the messages and do the tidying up.
> > > > > > > >
> > > > > > > >  Also I've switched to using node instead of domain in the
> > > tests. I
> > > > > > > > notice
> > > > > > > > we need to do some work on the constructor for this type of
> > use.
> > > > > > I'll
> > > > > > > > work
> > > > > > > > on this too.
> > > > > > > >
> > > > > > > > Regards
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > Hi Hasan
> > > > >
> > > > > have been running some of the validation code today and I notice
> > that
> > > > > quite a few of the reported error messages have their parameters
> > > > > miss-aligned. I.e. I often see an unexpanded {1}. This is down the
> > the
> > > > > builder warning() method being called with too few parameters. It
> > > takes
> > > > >
> > > > >  warning(String message, Object model, String...
> > messageParameters)
> > > > >
> > > > > So if i had a {0} and a {1} in the message I would use something
> > like
> > > > >
> > > > > warning("ReferenceIncompatibleInterface", composite,
> > > > > componentReference.getName(), componentService.getName());
> > > > >
> > > > > Where the two parameters are passed in at the end.
> > > > >
> > > > > Easy enough for me to go and fix the ones I find but thought I
> > would
> > > > raise
> > > > > it in case you are doing some more and spot mistakes.
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > > Hi
> > > >
> > > > Actually I went through the places where warning is called and they
> > are
> > > all
> > > > pretty much perfect so I must have just hit the one bad one that
> > have a
> > > > missing parameter. As far as I know they are all good now.
> > > >
> > > > Simon
> > > >
> > >
> > > Hi Simon,
> > > I had a chance to look at the monitors that are being hooked up with
> > > different parts of the code and found some inconsistency interms of
> > > raising
> > > warning & errors. In some places we throw exceptions and in other
> > places
> > > we
> > > raise a warning. I also believe there are instances where we need to
> > do
> > > both, the below examples might give us some clue.....
> > >
> > > Here are some examples for the inconsistency.......
> > >
> > > BaseConfigurationBuilderImpl.java
> > > Here we raise only a warning for URISyntaxException, should we not
> > throw
> > > an
> > > exception too?
> > >
> > > BaseWireBuilderImpl.java
> > > Here we throw exceptions for IncompatibleInterfaceContractException,
> > don't
> > > you think we also need to register this message in our monitor?
> > > In the same class, we raise a warning message for the PolicyRelated
> > > Exceptions, should we also throw an exception here?
> > >
> > > CompositeProcessor.java
> > > There are instances where we throw new ContributionReadException, i
> > > believe
> > > registering this msg with a monitor is also required as this is caused
> > by
> > > incorrect user input.
> > >
> > > Like to know your views on this... so that we can consider a standard
> > way
> > > of
> > > raising warning/errors using the monitor.
> > >
> > > --
> > > Thanks & Regards,
> > > Ramkumar Ramalingam
> > >
> >
> > Hi Ram
> >
> > Good analysis. Looks like we've some work to do. I've just posted to an
> > oldish thread [1] about the implications of raising errors and warnings.
> > I
> > think from what you say we have to.
> >
> > 1. Make sure we are raising errors/warnings on the monitor rather than
> > throwing exceptions in code that is processing user input. I.e. we want
> > all
> > processing to complete as far as possible through each phase.
> > 2. Make those errors/exception available from the monitor. We need a
> > resettable cache
> > 3. Allow problems to be retrieved from the monitor and analyzed (printed
> > out
> > to the console in our case)
> >
> > Regards
> >
> > Simon
> >
> > [1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29766.html
> >
>

Re: How do you plug in validation monitoring?

Posted by Ramkumar R <ra...@gmail.com>.
Hi Simon,
Thanks for your detailed comments, that gives a clear picture. I have now
opened a JIRA (TUSCANY-2277) to address this issue. By this defect we
will standardize the way messages are logged into the monitor.

Will keep things posted in this thread for any complicated situations and if
i am not sure about any exceptions that are thrown.

-- 
Thanks & Regards,
Ramkumar Ramalingam

On 4/29/08, Simon Laws <si...@googlemail.com> wrote:
>
> On Mon, Apr 28, 2008 at 1:42 PM, Ramkumar R <ra...@gmail.com> wrote:
>
> > On 4/25/08, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <simonslaws@googlemail.com
> >
> > > wrote:
> > >
> > > >
> > > >
> > > > On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I opened JIRA 2260 and attached a second batch of validation test
> > > cases.
> > > > >
> > > > > regards
> > > > > Hasan
> > > > >
> > > > > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi Simon
> > > > > >
> > > > > > I opened JIRA 2255 and attached a patch for the new testcases.
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > > >
> > > > > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > We should have an api for plugins to provide a resource
> > bundle.
> > > > > This
> > > > > > > api
> > > > > > > > > probably needs to be on the monitor or somewhere, i am not
> > > sure.
> > > > > But
> > > > > > > the
> > > > > > > > > scenario occurs when plugins want to use the default
> Monitor
> > > but
> > > > > > > still
> > > > > > > > > want
> > > > > > > > > to use their own resource bundle for messageIDs.
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > I looked at the new Monitor and Problem interfaces. What
> > do
> > > > > > > > > getMessageId()
> > > > > > > > > > and getMessageParams() actually return? is MessageId a
> way
> > to
> > > > > > > > > categorize the
> > > > > > > > > > error message?
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > > > > appaos@gmail.com
> > > > > > > >
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > I was wondering if i can cook up some validation test
> > cases
> > > > > if
> > > > > > > they
> > > > > > > > > do
> > > > > > > > > > > not exist. Or should we wait until the monitor issue
> is
> > > > > resolved
> > > > > > > ?
> > > > > > > > > > >
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > I dont think using an underlying tuscany jdk logger
> > would
> > > > > be
> > > > > > > > > useful to
> > > > > > > > > > > > plugins as they may not want to log, rather show it
> > > > > somewhere
> > > > > > > else
> > > > > > > > > such as
> > > > > > > > > > > > console etc. Tuscany can use an underlying logger in
> > it's
> > > > > own
> > > > > > > > > monitor ( as
> > > > > > > > > > > > it uses today). But i think the first approach of
> > using a
> > > > > > > monitor
> > > > > > > > > is better
> > > > > > > > > > > > along with the condition that it be made more usable
> > by
> > > > > the
> > > > > > > > > plugins by
> > > > > > > > > > > > giving them greater control.
> > > > > > > > > > > >
> > > > > > > > > > > > Another point is that tuscany should use
> > ResourceBundle
> > > > > for
> > > > > > > > > validation
> > > > > > > > > > > > messages as well. I dont think this is being done
> > today.
> > > > > > > > > > > >
> > > > > > > > > > > > regards
> > > > > > > > > > > > Hasan
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad
> <
> > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I am on revision 634808. The
> > > ContributionServiceImpl
> > > > > has
> > > > > > > > > changed
> > > > > > > > > > > > > since
> > > > > > > > > > > > > > > then,
> > > > > > > > > > > > > > > and with the one that i have, it would lead
> > through
> > > > > the
> > > > > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > > > > instead of the CompositeDocumentProcessor.
> Hence
> > > the
> > > > > > > > > difference
> > > > > > > > > > > > > in
> > > > > > > > > > > > > > > exceptions..
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Also, dont you think that with the error that
> > you
> > > > > got
> > > > > > > should
> > > > > > > > > > > > > throw an
> > > > > > > > > > > > > > > exception with schema validation, rather than
> > just
> > > a
> > > > > > > > > warning?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan
> Muhammad
> > <
> > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Thank you for the good information. First
> up
> > i
> > > > > am
> > > > > > > trying
> > > > > > > > > to
> > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > whether
> > > > > > > > > > > > > > > > > the schema validation works when we point
> to
> > > our
> > > > > > > > > schemas.
> > > > > > > > > > > > > Can you
> > > > > > > > > > > > > > > let me
> > > > > > > > > > > > > > > > > know what is a simple error that i can
> > > introduce
> > > > > so
> > > > > > > that
> > > > > > > > > i
> > > > > > > > > > > > > can
> > > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > > > > I tried doing this to my composite file
> (In
> > > > > block
> > > > > > > red):
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > > > >
> > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > > > > >    <property name="location"
> > > > > source="$newLocation"/>
> > > > > > > > > > > > > > > > >    <property name="year"
> source="$newYear"/>
> > > > > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > This resulted in the following exception,
> > but i
> > > > > > > think
> > > > > > > > > this
> > > > > > > > > > > > > is part
> > > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > validation done by artifact processor and
> > would
> > > > > > > result
> > > > > > > > > even
> > > > > > > > > > > > > if we
> > > > > > > > > > > > > > > > comment
> > > > > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > > > > Unexpected <binding> element found. It
> > should
> > > > > appear
> > > > > > > > > inside
> > > > > > > > > > > > > a
> > > > > > > > > > > > > > > <service>
> > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws
> <
> > > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan
> > > Muhammad
> > > > > <
> > > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Currently, i see that we have various
> > > places
> > > > > > > where
> > > > > > > > > we
> > > > > > > > > > > > > can plug
> > > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > > > > monitoring. Some of the ones that i
> > found
> > > > > are in
> > > > > > > the
> > > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown
> > below:
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > InterfaceContractMapper
> > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > > >            SCABindingFactory
> > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > >
> >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > > >            List<PolicySet>
> > > domainPolicySets)
> > > > > {
> > > > > > > > > > > > > > > > > > >        return new
> > > > > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Instead of passing null, we can pass
> in
> > our
> > > > > own
> > > > > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > > > > these the only places where we need to
> > do
> > > > > this?
> > > > > > > or
> > > > > > > > > are
> > > > > > > > > > > > > there
> > > > > > > > > > > > > > > other
> > > > > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > There are a few places that logically we
> > need
> > > > > to
> > > > > > > be
> > > > > > > > > able
> > > > > > > > > > > > > to
> > > > > > > > > > > > > > > validate
> > > > > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > > > > and hence add monitors. The story is
> > changing
> > > > > a
> > > > > > > little
> > > > > > > > > as
> > > > > > > > > > > > > we are
> > > > > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > > > > toward the new "workspace"  code for
> > managing
> > > > > > > > > > > > > contributions but
> > > > > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > > > > would expect to be running validating on
> > at
> > > > > least
> > > > > > > the
> > > > > > > > > > > > > following
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > > > > >   - dependency (imports/exports)
> analysis
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > > > > need
> > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > >
> [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > > > > >   - extension availability [General
> > artifact
> > > > > > > processor
> > > > > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > > > > >   - ensure that artifacts required by
> the
> > > > > > > composite
> > > > > > > > > are
> > > > > > > > > > > > > available
> > > > > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > > > > >   - ensure that the composite is valid
> and
> > > > > > > consistent,
> > > > > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > > > > component names, valid reference targets
> > etc.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > >
> [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > I've noted in the square brackets where
> > this
> > > > > > > function
> > > > > > > > > > > > > currently
> > > > > > > > > > > > > > > is.
> > > > > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > > > > also that I'm making no comment here
> about
> > > > > whether
> > > > > > > the
> > > > > > > > > > > > > > > construction of
> > > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > > in-memory composite model is for use
> > purely
> > > > > for
> > > > > > > > > > > > > contribution
> > > > > > > > > > > > > > > > processing
> > > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > > is going to activated and started in a
> > > > > runtime.
> > > > > > > This
> > > > > > > > > > > > > validation is
> > > > > > > > > > > > > > > > > > appropriate in both cases although you
> may
> > > > > choose
> > > > > > > to
> > > > > > > > > use
> > > > > > > > > > > > > different
> > > > > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > So what I suggest as a first step is
> that
> > you
> > > > > go
> > > > > > > ahead
> > > > > > > > > and
> > > > > > > > > > > > > change
> > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a
> > monitor
> > > > > into
> > > > > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > > > > how it works. We can work here to build
> a
> > > > > > > consistent
> > > > > > > > > view
> > > > > > > > > > > > > of
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > > > > > - what should the plugin model for
> > monitors
> > > be
> > > > > > > > > > > > > > > > > > - the flow of control (monitors vs
> > > exceptions)
> > > > > > > > > > > > > > > > > > - what extra features may be required,
> > I18N
> > > > > etc.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > I'm going to try a few experiments too
> to
> > > > > > > familiarize
> > > > > > > > > > > > > myself with
> > > > > > > > > > > > > > > this
> > > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > The change you suggest should cause a schema
> > > > > > > validation
> > > > > > > > > error.
> > > > > > > > > > > > > I made
> > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > change locally in samples/calculator and see
> > the
> > > > > > > following
> > > > > > > > > > > > > output in
> > > > > > > > > > > > > > > > stdout
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > > > > error
> > > > > > > > > > > > > > > > WARNING: XMLSchema validation problem in:
> > null,
> > > > > line:
> > > > > > > 28,
> > > > > > > > > > > > > column: 5
> > > > > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was
> > found
> > > > > > > starting
> > > > > > > > > > > > > with
> > > > > > > > > > > > > > > element '
> > > > > > > > > > > > > > > > binding.ws'. One of '{"
> > > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > > > > ":include,
> > > > > > > > > > > > > "
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service,
> "
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property,
> "
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> ":component,
> > "
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0
> ":reference,
> > "
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > > > > WC[##other:"
> > > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is
> > > expected.
> > > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > > > > read
> > > > > > > > > > > > > > > > WARNING: Element {
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<
> http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <
> > > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > > <
> http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > > > > >cannot
> > > > > > > be
> > > > > > > > > > > > > > > > processed. ([row,col {unknown-source}]:
> > [28,5])
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Ok, thanks for that Hasan. I see the change you
> > are
> > > > > > > > > referencing.
> > > > > > > > > > > > > I'm not
> > > > > > > > > > > > > > sure why the exception is no longer thrown. The
> > code
> > > > > is
> > > > > > > still
> > > > > > > > > in
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > CompositeProcessor to trap the case but maybe
> the
> > > > > > > offending
> > > > > > > > > > > > > element is
> > > > > > > > > > > > > > removed from the stream because of the
> validation
> > > > > warning.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I would argue that we shouldn't mandate that an
> > > > > exception
> > > > > > > is
> > > > > > > > > > > > > thrown in
> > > > > > > > > > > > > > this case but that the validation mechanism is
> > opened
> > > > > up
> > > > > > > to
> > > > > > > > > the
> > > > > > > > > > > > > monitor API
> > > > > > > > > > > > > > so that a monitor can be attached and those who
> > are
> > > > > > > embedding
> > > > > > > > > > > > > tuscany can
> > > > > > > > > > > > > > decide how they want to deal with errors like
> > this.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > Hi
> > > > > > > > > > > > >
> > > > > > > > > > > > > I've just been through the original list again
> > looking
> > > > > at
> > > > > > > what
> > > > > > > > > > > > > happens with
> > > > > > > > > > > > > validation types errors (by which I mean a
> workspace
> > > > > type
> > > > > > > admin
> > > > > > > > > > > > > console
> > > > > > > > > > > > > would reasonably want to display based on user
> > > > > > > input/changes).
> > > > > > > > > This
> > > > > > > > > > > > > is what
> > > > > > > > > > > > > I found.
> > > > > > > > > > > > >
> > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > > > > >    - policy intent matching
> > > > > > > > > > > > >
> > > > > > > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > >    - extension availability
> > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > > >     Throws exceptions
> > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > >   - ensure that artifacts required by the
> composite
> > are
> > > > > > > > > available
> > > > > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > >   - ensure that the composite is valid and
> > consistent,
> > > > > e.g.
> > > > > > > > > unique
> > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > >
> > > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > > > > >
> > > > > > > > > > > > > I would like to look for a more consistent
> approach
> > > > > across
> > > > > > > these
> > > > > > > > > > > > > various
> > > > > > > > > > > > > elements of validation. The aim being to make it
> > more
> > > > > > > obvious
> > > > > > > > > how to
> > > > > > > > > > > > > recognize validation type errors and act
> > accordingly.
> > > > > There
> > > > > > > has
> > > > > > > > > been
> > > > > > > > > > > > > a
> > > > > > > > > > > > > relatively lengthy debate about how to group and
> > report
> > > > > > > errors
> > > > > > > > > in
> > > > > > > > > > > > > [1] which
> > > > > > > > > > > > > is worth a read. The scenarios I have in mind are
> > > > > workspace
> > > > > > > > > > > > > administration
> > > > > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > > > > >
> > > > > > > > > > > > > Add a contribution and be notified that
> > contributions
> > > > > that
> > > > > > > it
> > > > > > > > > > > > > depends on are
> > > > > > > > > > > > > not available
> > > > > > > > > > > > > Look at a composite and be notified that there are
> > XML
> > > > > > > and/or
> > > > > > > > > SCA
> > > > > > > > > > > > > errors
> > > > > > > > > > > > > etc.
> > > > > > > > > > > > >
> > > > > > > > > > > > > From [1] we want to capture as many errors as
> > possible
> > > > > > > before
> > > > > > > > > > > > > reporting back
> > > > > > > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > > > > > > >
> > > > > > > > > > > > > 1 - Pull up the Monitor API and make it more
> generic
> > > > > (and
> > > > > > > from
> > > > > > > > > > > > > previous
> > > > > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and
> remove
> > > the
> > > > > > > monitor
> > > > > > > > > (or
> > > > > > > > > > > > > at
> > > > > > > > > > > > > least don't extend it further).
> > > > > > > > > > > > >
> > > > > > > > > > > > > I'm going to think some more about these options.
> > Any
> > > > > > > thoughts
> > > > > > > > > or
> > > > > > > > > > > > > more
> > > > > > > > > > > > > options?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Simon
> > > > > > > > > > > > >
> > > > > > > > > > > > > [1]
> > > > > > > > > > > > >
> > > > > > > > >
> > > > >
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > Hi Hasan
> > > > > > > >
> > > > > > > > What do you mean in your question by "plugin". If you mean
> an
> > > > > Tuscany
> > > > > > > > extension then I think we have that covered as each
> extension
> > > will
> > > > > > > ship with
> > > > > > > > any bundles that it needs and stll the default monitor can
> be
> > > > > used.
> > > > > > > >
> > > > > > > > Here is the model I have in my head of this.
> > > > > > > >
> > > > > > > > runtime
> > > > > > > >   monitor
> > > > > > > >   module (there are many of these in the runtime)
> > > > > > > >     resource bundle
> > > > > > > >     raises problems - each problem references the name of a
> > > > > resource
> > > > > > > > bundle for the modules in question (I don't believe I can
> get
> > the
> > > > > name
> > > > > > > of
> > > > > > > > the module automatically)
> > > > > > > >
> > > > > > > > So I'm anticipating that the runtime will create a single
> > monitor
> > > > > but
> > > > > > > this
> > > > > > > > is not a hard and fast rule.
> > > > > > > >
> > > > > > > > Each module/extension raises problems referencing the
> resource
> > > > > bundle
> > > > > > > that
> > > > > > > > it contains. Hence the module provides messages appropriate
> to
> > > > > errors
> > > > > > > that
> > > > > > > > it will raise. The resource bundle reference is by root name
> > so
> > > > > there
> > > > > > > is not
> > > > > > > > reason why the resource bundle couldn't be put somewhere
> else.
> > > > > > > >
> > > > > > > > If you want to change the default messages that are
> provided,
> > as
> > > > > > > opposed
> > > > > > > > to create a new extension with new messages, there are a
> > number
> > > of
> > > > > > > options.
> > > > > > > >
> > > > > > > > - The source code approach - i.e. change the
> bundles  provided
> > > > > > > > - Provide new bundles first on the classpath - I think they
> > will
> > > > > get
> > > > > > > > picked up in preference to the default ones but I would have
> > to
> > > > > test
> > > > > > > it to
> > > > > > > > see
> > > > > > > > - We could reorganize the bundles so they are in their in
> > their
> > > > > own
> > > > > > > > separate jars. Then you would provide a replacement jar.
> > > > > > > > - Add an API to the monitor to allow a bundle mapping to be
> > > > > specified.
> > > > > > > In
> > > > > > > > this case though it seems easier to provide a new monitor
> > > > > > > implementation
> > > > > > > > rather than providing a new API.
> > > > > > > >
> > > > > > > > There are probably more options so any thoughts are welcome.
> > I'm
> > > > > > > currently
> > > > > > > > working on getting the new monitor integrated into the
> > existing
> > > > > > > modules
> > > > > > > > (primarily assembly) so we will have something to try out.
> We
> > can
> > > > > take
> > > > > > > a
> > > > > > > > look at these options for real when I'm done.
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > >
> > > > > > > Hi
> > > > > > >
> > > > > > > I've just checked in the changes to do the basic integration
> of
> > the
> > > > > > > monitor
> > > > > > > extension with the rest of the code base. Its a light touch
> end
> > to
> > > > > end
> > > > > > > integration at the moment. Here are some of the TODOs
> > > > > > >
> > > > > > > - Move messages into resource bundles.
> > > > > > > - Local monitors are still created in some places.
> > > > > > > - If a monitor implementation is not found then a warning is
> > raised
> > > > > but
> > > > > > > execution continues so that I don't have to change the
> > dependencies
> > > > > of
> > > > > > > the
> > > > > > > many tests that now don't pull in a monitor but also don't
> raise
> > > any
> > > > > > > warnings. May want to address this but It's OK for the time
> > being.
> > > > > > >
> > > > > > > Hopefully now the validation itests make more sense now. The
> > test
> > > to
> > > > > > > look at
> > > > > > > is the duplicate component name test. This is the only message
> > I've
> > > > > > > moved
> > > > > > > out into a resource bundle at the moment. Now I have the
> basics
> > in
> > > > > I'll
> > > > > > > move
> > > > > > > all the messages and do the tidying up.
> > > > > > >
> > > > > > >  Also I've switched to using node instead of domain in the
> > tests. I
> > > > > > > notice
> > > > > > > we need to do some work on the constructor for this type of
> use.
> > > > > I'll
> > > > > > > work
> > > > > > > on this too.
> > > > > > >
> > > > > > > Regards
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > Hi Hasan
> > > >
> > > > have been running some of the validation code today and I notice
> that
> > > > quite a few of the reported error messages have their parameters
> > > > miss-aligned. I.e. I often see an unexpanded {1}. This is down the
> the
> > > > builder warning() method being called with too few parameters. It
> > takes
> > > >
> > > >  warning(String message, Object model, String... messageParameters)
> > > >
> > > > So if i had a {0} and a {1} in the message I would use something
> like
> > > >
> > > > warning("ReferenceIncompatibleInterface", composite,
> > > > componentReference.getName(), componentService.getName());
> > > >
> > > > Where the two parameters are passed in at the end.
> > > >
> > > > Easy enough for me to go and fix the ones I find but thought I would
> > > raise
> > > > it in case you are doing some more and spot mistakes.
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > > Hi
> > >
> > > Actually I went through the places where warning is called and they
> are
> > all
> > > pretty much perfect so I must have just hit the one bad one that have
> a
> > > missing parameter. As far as I know they are all good now.
> > >
> > > Simon
> > >
> >
> > Hi Simon,
> > I had a chance to look at the monitors that are being hooked up with
> > different parts of the code and found some inconsistency interms of
> > raising
> > warning & errors. In some places we throw exceptions and in other places
> > we
> > raise a warning. I also believe there are instances where we need to do
> > both, the below examples might give us some clue.....
> >
> > Here are some examples for the inconsistency.......
> >
> > BaseConfigurationBuilderImpl.java
> > Here we raise only a warning for URISyntaxException, should we not throw
> > an
> > exception too?
> >
> > BaseWireBuilderImpl.java
> > Here we throw exceptions for IncompatibleInterfaceContractException,
> don't
> > you think we also need to register this message in our monitor?
> > In the same class, we raise a warning message for the PolicyRelated
> > Exceptions, should we also throw an exception here?
> >
> > CompositeProcessor.java
> > There are instances where we throw new ContributionReadException, i
> > believe
> > registering this msg with a monitor is also required as this is caused
> by
> > incorrect user input.
> >
> > Like to know your views on this... so that we can consider a standard
> way
> > of
> > raising warning/errors using the monitor.
> >
> > --
> > Thanks & Regards,
> > Ramkumar Ramalingam
> >
>
> Hi Ram
>
> Good analysis. Looks like we've some work to do. I've just posted to an
> oldish thread [1] about the implications of raising errors and warnings. I
> think from what you say we have to.
>
> 1. Make sure we are raising errors/warnings on the monitor rather than
> throwing exceptions in code that is processing user input. I.e. we want
> all
> processing to complete as far as possible through each phase.
> 2. Make those errors/exception available from the monitor. We need a
> resettable cache
> 3. Allow problems to be retrieved from the monitor and analyzed (printed
> out
> to the console in our case)
>
> Regards
>
> Simon
>
> [1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29766.html
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Apr 28, 2008 at 1:42 PM, Ramkumar R <ra...@gmail.com> wrote:

> On 4/25/08, Simon Laws <si...@googlemail.com> wrote:
> >
> > On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > >
> > >
> > > On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > I opened JIRA 2260 and attached a second batch of validation test
> > cases.
> > > >
> > > > regards
> > > > Hasan
> > > >
> > > > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Simon
> > > > >
> > > > > I opened JIRA 2255 and attached a patch for the new testcases.
> > > > >
> > > > > Hasan
> > > > >
> > > > >
> > > > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > We should have an api for plugins to provide a resource
> bundle.
> > > > This
> > > > > > api
> > > > > > > > probably needs to be on the monitor or somewhere, i am not
> > sure.
> > > > But
> > > > > > the
> > > > > > > > scenario occurs when plugins want to use the default Monitor
> > but
> > > > > > still
> > > > > > > > want
> > > > > > > > to use their own resource bundle for messageIDs.
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > I looked at the new Monitor and Problem interfaces. What
> do
> > > > > > > > getMessageId()
> > > > > > > > > and getMessageParams() actually return? is MessageId a way
> to
> > > > > > > > categorize the
> > > > > > > > > error message?
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > > > appaos@gmail.com
> > > > > > >
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > I was wondering if i can cook up some validation test
> cases
> > > > if
> > > > > > they
> > > > > > > > do
> > > > > > > > > > not exist. Or should we wait until the monitor issue is
> > > > resolved
> > > > > > ?
> > > > > > > > > >
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > I dont think using an underlying tuscany jdk logger
> would
> > > > be
> > > > > > > > useful to
> > > > > > > > > > > plugins as they may not want to log, rather show it
> > > > somewhere
> > > > > > else
> > > > > > > > such as
> > > > > > > > > > > console etc. Tuscany can use an underlying logger in
> it's
> > > > own
> > > > > > > > monitor ( as
> > > > > > > > > > > it uses today). But i think the first approach of
> using a
> > > > > > monitor
> > > > > > > > is better
> > > > > > > > > > > along with the condition that it be made more usable
> by
> > > > the
> > > > > > > > plugins by
> > > > > > > > > > > giving them greater control.
> > > > > > > > > > >
> > > > > > > > > > > Another point is that tuscany should use
> ResourceBundle
> > > > for
> > > > > > > > validation
> > > > > > > > > > > messages as well. I dont think this is being done
> today.
> > > > > > > > > > >
> > > > > > > > > > > regards
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I am on revision 634808. The
> > ContributionServiceImpl
> > > > has
> > > > > > > > changed
> > > > > > > > > > > > since
> > > > > > > > > > > > > > then,
> > > > > > > > > > > > > > and with the one that i have, it would lead
> through
> > > > the
> > > > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > > > instead of the CompositeDocumentProcessor. Hence
> > the
> > > > > > > > difference
> > > > > > > > > > > > in
> > > > > > > > > > > > > > exceptions..
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Also, dont you think that with the error that
> you
> > > > got
> > > > > > should
> > > > > > > > > > > > throw an
> > > > > > > > > > > > > > exception with schema validation, rather than
> just
> > a
> > > > > > > > warning?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad
> <
> > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Thank you for the good information. First up
> i
> > > > am
> > > > > > trying
> > > > > > > > to
> > > > > > > > > > > > verify
> > > > > > > > > > > > > > > whether
> > > > > > > > > > > > > > > > the schema validation works when we point to
> > our
> > > > > > > > schemas.
> > > > > > > > > > > > Can you
> > > > > > > > > > > > > > let me
> > > > > > > > > > > > > > > > know what is a simple error that i can
> > introduce
> > > > so
> > > > > > that
> > > > > > > > i
> > > > > > > > > > > > can
> > > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > > > I tried doing this to my composite file (In
> > > > block
> > > > > > red):
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > > >
> class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > > > >    <property name="location"
> > > > source="$newLocation"/>
> > > > > > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > This resulted in the following exception,
> but i
> > > > > > think
> > > > > > > > this
> > > > > > > > > > > > is part
> > > > > > > > > > > > > > of
> > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > validation done by artifact processor and
> would
> > > > > > result
> > > > > > > > even
> > > > > > > > > > > > if we
> > > > > > > > > > > > > > > comment
> > > > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > > > Unexpected <binding> element found. It
> should
> > > > appear
> > > > > > > > inside
> > > > > > > > > > > > a
> > > > > > > > > > > > > > <service>
> > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan
> > Muhammad
> > > > <
> > > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Currently, i see that we have various
> > places
> > > > > > where
> > > > > > > > we
> > > > > > > > > > > > can plug
> > > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > > > monitoring. Some of the ones that i
> found
> > > > are in
> > > > > > the
> > > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown
> below:
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > InterfaceContractMapper
> > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > > > >        return new
> > > > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > > >            SCABindingFactory
> > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > > >            List<PolicySet>
> > domainPolicySets)
> > > > {
> > > > > > > > > > > > > > > > > >        return new
> > > > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Instead of passing null, we can pass in
> our
> > > > own
> > > > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > > > these the only places where we need to
> do
> > > > this?
> > > > > > or
> > > > > > > > are
> > > > > > > > > > > > there
> > > > > > > > > > > > > > other
> > > > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > There are a few places that logically we
> need
> > > > to
> > > > > > be
> > > > > > > > able
> > > > > > > > > > > > to
> > > > > > > > > > > > > > validate
> > > > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > > > and hence add monitors. The story is
> changing
> > > > a
> > > > > > little
> > > > > > > > as
> > > > > > > > > > > > we are
> > > > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > > > toward the new "workspace"  code for
> managing
> > > > > > > > > > > > contributions but
> > > > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > > > would expect to be running validating on
> at
> > > > least
> > > > > > the
> > > > > > > > > > > > following
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > > > need
> > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > > > >   - extension availability [General
> artifact
> > > > > > processor
> > > > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > > > >   - ensure that artifacts required by the
> > > > > > composite
> > > > > > > > are
> > > > > > > > > > > > available
> > > > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > > > > consistent,
> > > > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > > > component names, valid reference targets
> etc.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I've noted in the square brackets where
> this
> > > > > > function
> > > > > > > > > > > > currently
> > > > > > > > > > > > > > is.
> > > > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > > > also that I'm making no comment here about
> > > > whether
> > > > > > the
> > > > > > > > > > > > > > construction of
> > > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > > in-memory composite model is for use
> purely
> > > > for
> > > > > > > > > > > > contribution
> > > > > > > > > > > > > > > processing
> > > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > > is going to activated and started in a
> > > > runtime.
> > > > > > This
> > > > > > > > > > > > validation is
> > > > > > > > > > > > > > > > > appropriate in both cases although you may
> > > > choose
> > > > > > to
> > > > > > > > use
> > > > > > > > > > > > different
> > > > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > So what I suggest as a first step is that
> you
> > > > go
> > > > > > ahead
> > > > > > > > and
> > > > > > > > > > > > change
> > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a
> monitor
> > > > into
> > > > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > > > how it works. We can work here to build a
> > > > > > consistent
> > > > > > > > view
> > > > > > > > > > > > of
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > > > > - what should the plugin model for
> monitors
> > be
> > > > > > > > > > > > > > > > > - the flow of control (monitors vs
> > exceptions)
> > > > > > > > > > > > > > > > > - what extra features may be required,
> I18N
> > > > etc.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > I'm going to try a few experiments too to
> > > > > > familiarize
> > > > > > > > > > > > myself with
> > > > > > > > > > > > > > this
> > > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > The change you suggest should cause a schema
> > > > > > validation
> > > > > > > > error.
> > > > > > > > > > > > I made
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > change locally in samples/calculator and see
> the
> > > > > > following
> > > > > > > > > > > > output in
> > > > > > > > > > > > > > > stdout
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > > > error
> > > > > > > > > > > > > > > WARNING: XMLSchema validation problem in:
> null,
> > > > line:
> > > > > > 28,
> > > > > > > > > > > > column: 5
> > > > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was
> found
> > > > > > starting
> > > > > > > > > > > > with
> > > > > > > > > > > > > > element '
> > > > > > > > > > > > > > > binding.ws'. One of '{"
> > > > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > > > ":include,
> > > > > > > > > > > > "
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component,
> "
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference,
> "
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > > > WC[##other:"
> > > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is
> > expected.
> > > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > > > read
> > > > > > > > > > > > > > > WARNING: Element {
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <
> > http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > > > >cannot
> > > > > > be
> > > > > > > > > > > > > > > processed. ([row,col {unknown-source}]:
> [28,5])
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Ok, thanks for that Hasan. I see the change you
> are
> > > > > > > > referencing.
> > > > > > > > > > > > I'm not
> > > > > > > > > > > > > sure why the exception is no longer thrown. The
> code
> > > > is
> > > > > > still
> > > > > > > > in
> > > > > > > > > > > > the
> > > > > > > > > > > > > CompositeProcessor to trap the case but maybe the
> > > > > > offending
> > > > > > > > > > > > element is
> > > > > > > > > > > > > removed from the stream because of the validation
> > > > warning.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I would argue that we shouldn't mandate that an
> > > > exception
> > > > > > is
> > > > > > > > > > > > thrown in
> > > > > > > > > > > > > this case but that the validation mechanism is
> opened
> > > > up
> > > > > > to
> > > > > > > > the
> > > > > > > > > > > > monitor API
> > > > > > > > > > > > > so that a monitor can be attached and those who
> are
> > > > > > embedding
> > > > > > > > > > > > tuscany can
> > > > > > > > > > > > > decide how they want to deal with errors like
> this.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Simon
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > Hi
> > > > > > > > > > > >
> > > > > > > > > > > > I've just been through the original list again
> looking
> > > > at
> > > > > > what
> > > > > > > > > > > > happens with
> > > > > > > > > > > > validation types errors (by which I mean a workspace
> > > > type
> > > > > > admin
> > > > > > > > > > > > console
> > > > > > > > > > > > would reasonably want to display based on user
> > > > > > input/changes).
> > > > > > > > This
> > > > > > > > > > > > is what
> > > > > > > > > > > > I found.
> > > > > > > > > > > >
> > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > > > > - Composite read
> > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > > > >    - policy intent matching
> > > > > > > > > > > >
> > > > > > > >
> org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > >    - extension availability
> > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > > >     Throws exceptions
> > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > >   - ensure that artifacts required by the composite
> are
> > > > > > > > available
> > > > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > > - Composite build
> > > > > > > > > > > >   - ensure that the composite is valid and
> consistent,
> > > > e.g.
> > > > > > > > unique
> > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > >
> > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > > > >
> > > > > > > > > > > > I would like to look for a more consistent approach
> > > > across
> > > > > > these
> > > > > > > > > > > > various
> > > > > > > > > > > > elements of validation. The aim being to make it
> more
> > > > > > obvious
> > > > > > > > how to
> > > > > > > > > > > > recognize validation type errors and act
> accordingly.
> > > > There
> > > > > > has
> > > > > > > > been
> > > > > > > > > > > > a
> > > > > > > > > > > > relatively lengthy debate about how to group and
> report
> > > > > > errors
> > > > > > > > in
> > > > > > > > > > > > [1] which
> > > > > > > > > > > > is worth a read. The scenarios I have in mind are
> > > > workspace
> > > > > > > > > > > > administration
> > > > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > > > >
> > > > > > > > > > > > Add a contribution and be notified that
> contributions
> > > > that
> > > > > > it
> > > > > > > > > > > > depends on are
> > > > > > > > > > > > not available
> > > > > > > > > > > > Look at a composite and be notified that there are
> XML
> > > > > > and/or
> > > > > > > > SCA
> > > > > > > > > > > > errors
> > > > > > > > > > > > etc.
> > > > > > > > > > > >
> > > > > > > > > > > > From [1] we want to capture as many errors as
> possible
> > > > > > before
> > > > > > > > > > > > reporting back
> > > > > > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > > > > > >
> > > > > > > > > > > > 1 - Pull up the Monitor API and make it more generic
> > > > (and
> > > > > > from
> > > > > > > > > > > > previous
> > > > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove
> > the
> > > > > > monitor
> > > > > > > > (or
> > > > > > > > > > > > at
> > > > > > > > > > > > least don't extend it further).
> > > > > > > > > > > >
> > > > > > > > > > > > I'm going to think some more about these options.
> Any
> > > > > > thoughts
> > > > > > > > or
> > > > > > > > > > > > more
> > > > > > > > > > > > options?
> > > > > > > > > > > >
> > > > > > > > > > > > Simon
> > > > > > > > > > > >
> > > > > > > > > > > > [1]
> > > > > > > > > > > >
> > > > > > > >
> > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > Hi Hasan
> > > > > > >
> > > > > > > What do you mean in your question by "plugin". If you mean an
> > > > Tuscany
> > > > > > > extension then I think we have that covered as each extension
> > will
> > > > > > ship with
> > > > > > > any bundles that it needs and stll the default monitor can be
> > > > used.
> > > > > > >
> > > > > > > Here is the model I have in my head of this.
> > > > > > >
> > > > > > > runtime
> > > > > > >   monitor
> > > > > > >   module (there are many of these in the runtime)
> > > > > > >     resource bundle
> > > > > > >     raises problems - each problem references the name of a
> > > > resource
> > > > > > > bundle for the modules in question (I don't believe I can get
> the
> > > > name
> > > > > > of
> > > > > > > the module automatically)
> > > > > > >
> > > > > > > So I'm anticipating that the runtime will create a single
> monitor
> > > > but
> > > > > > this
> > > > > > > is not a hard and fast rule.
> > > > > > >
> > > > > > > Each module/extension raises problems referencing the resource
> > > > bundle
> > > > > > that
> > > > > > > it contains. Hence the module provides messages appropriate to
> > > > errors
> > > > > > that
> > > > > > > it will raise. The resource bundle reference is by root name
> so
> > > > there
> > > > > > is not
> > > > > > > reason why the resource bundle couldn't be put somewhere else.
> > > > > > >
> > > > > > > If you want to change the default messages that are provided,
> as
> > > > > > opposed
> > > > > > > to create a new extension with new messages, there are a
> number
> > of
> > > > > > options.
> > > > > > >
> > > > > > > - The source code approach - i.e. change the bundles  provided
> > > > > > > - Provide new bundles first on the classpath - I think they
> will
> > > > get
> > > > > > > picked up in preference to the default ones but I would have
> to
> > > > test
> > > > > > it to
> > > > > > > see
> > > > > > > - We could reorganize the bundles so they are in their in
> their
> > > > own
> > > > > > > separate jars. Then you would provide a replacement jar.
> > > > > > > - Add an API to the monitor to allow a bundle mapping to be
> > > > specified.
> > > > > > In
> > > > > > > this case though it seems easier to provide a new monitor
> > > > > > implementation
> > > > > > > rather than providing a new API.
> > > > > > >
> > > > > > > There are probably more options so any thoughts are welcome.
> I'm
> > > > > > currently
> > > > > > > working on getting the new monitor integrated into the
> existing
> > > > > > modules
> > > > > > > (primarily assembly) so we will have something to try out. We
> can
> > > > take
> > > > > > a
> > > > > > > look at these options for real when I'm done.
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > >
> > > > > > Hi
> > > > > >
> > > > > > I've just checked in the changes to do the basic integration of
> the
> > > > > > monitor
> > > > > > extension with the rest of the code base. Its a light touch end
> to
> > > > end
> > > > > > integration at the moment. Here are some of the TODOs
> > > > > >
> > > > > > - Move messages into resource bundles.
> > > > > > - Local monitors are still created in some places.
> > > > > > - If a monitor implementation is not found then a warning is
> raised
> > > > but
> > > > > > execution continues so that I don't have to change the
> dependencies
> > > > of
> > > > > > the
> > > > > > many tests that now don't pull in a monitor but also don't raise
> > any
> > > > > > warnings. May want to address this but It's OK for the time
> being.
> > > > > >
> > > > > > Hopefully now the validation itests make more sense now. The
> test
> > to
> > > > > > look at
> > > > > > is the duplicate component name test. This is the only message
> I've
> > > > > > moved
> > > > > > out into a resource bundle at the moment. Now I have the basics
> in
> > > > I'll
> > > > > > move
> > > > > > all the messages and do the tidying up.
> > > > > >
> > > > > >  Also I've switched to using node instead of domain in the
> tests. I
> > > > > > notice
> > > > > > we need to do some work on the constructor for this type of use.
> > > > I'll
> > > > > > work
> > > > > > on this too.
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > > Simon
> > > > > >
> > > > >
> > > > >
> > > >
> > > Hi Hasan
> > >
> > > have been running some of the validation code today and I notice that
> > > quite a few of the reported error messages have their parameters
> > > miss-aligned. I.e. I often see an unexpanded {1}. This is down the the
> > > builder warning() method being called with too few parameters. It
> takes
> > >
> > >  warning(String message, Object model, String... messageParameters)
> > >
> > > So if i had a {0} and a {1} in the message I would use something like
> > >
> > > warning("ReferenceIncompatibleInterface", composite,
> > > componentReference.getName(), componentService.getName());
> > >
> > > Where the two parameters are passed in at the end.
> > >
> > > Easy enough for me to go and fix the ones I find but thought I would
> > raise
> > > it in case you are doing some more and spot mistakes.
> > >
> > > Regards
> > >
> > > Simon
> > >
> > Hi
> >
> > Actually I went through the places where warning is called and they are
> all
> > pretty much perfect so I must have just hit the one bad one that have a
> > missing parameter. As far as I know they are all good now.
> >
> > Simon
> >
>
> Hi Simon,
> I had a chance to look at the monitors that are being hooked up with
> different parts of the code and found some inconsistency interms of
> raising
> warning & errors. In some places we throw exceptions and in other places
> we
> raise a warning. I also believe there are instances where we need to do
> both, the below examples might give us some clue.....
>
> Here are some examples for the inconsistency.......
>
> BaseConfigurationBuilderImpl.java
> Here we raise only a warning for URISyntaxException, should we not throw
> an
> exception too?
>
> BaseWireBuilderImpl.java
> Here we throw exceptions for IncompatibleInterfaceContractException, don't
> you think we also need to register this message in our monitor?
> In the same class, we raise a warning message for the PolicyRelated
> Exceptions, should we also throw an exception here?
>
> CompositeProcessor.java
> There are instances where we throw new ContributionReadException, i
> believe
> registering this msg with a monitor is also required as this is caused by
> incorrect user input.
>
> Like to know your views on this... so that we can consider a standard way
> of
> raising warning/errors using the monitor.
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Hi Ram

Good analysis. Looks like we've some work to do. I've just posted to an
oldish thread [1] about the implications of raising errors and warnings. I
think from what you say we have to.

1. Make sure we are raising errors/warnings on the monitor rather than
throwing exceptions in code that is processing user input. I.e. we want all
processing to complete as far as possible through each phase.
2. Make those errors/exception available from the monitor. We need a
resettable cache
3. Allow problems to be retrieved from the monitor and analyzed (printed out
to the console in our case)

Regards

Simon

[1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29766.html

Re: How do you plug in validation monitoring?

Posted by Ramkumar R <ra...@gmail.com>.
On 4/25/08, Simon Laws <si...@googlemail.com> wrote:
>
> On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> >
> >
> > On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> >
> > > Hi Simon,
> > >
> > > I opened JIRA 2260 and attached a second batch of validation test
> cases.
> > >
> > > regards
> > > Hasan
> > >
> > > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > >
> > > > Hi Simon
> > > >
> > > > I opened JIRA 2255 and attached a patch for the new testcases.
> > > >
> > > > Hasan
> > > >
> > > >
> > > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <
> appaos@gmail.com>
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > We should have an api for plugins to provide a resource bundle.
> > > This
> > > > > api
> > > > > > > probably needs to be on the monitor or somewhere, i am not
> sure.
> > > But
> > > > > the
> > > > > > > scenario occurs when plugins want to use the default Monitor
> but
> > > > > still
> > > > > > > want
> > > > > > > to use their own resource bundle for messageIDs.
> > > > > > >
> > > > > > > regards
> > > > > > > Hasan
> > > > > > >
> > > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > I looked at the new Monitor and Problem interfaces. What do
> > > > > > > getMessageId()
> > > > > > > > and getMessageParams() actually return? is MessageId a way to
> > > > > > > categorize the
> > > > > > > > error message?
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > >
> > > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > > appaos@gmail.com
> > > > > >
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > I was wondering if i can cook up some validation test cases
> > > if
> > > > > they
> > > > > > > do
> > > > > > > > > not exist. Or should we wait until the monitor issue is
> > > resolved
> > > > > ?
> > > > > > > > >
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > I dont think using an underlying tuscany jdk logger would
> > > be
> > > > > > > useful to
> > > > > > > > > > plugins as they may not want to log, rather show it
> > > somewhere
> > > > > else
> > > > > > > such as
> > > > > > > > > > console etc. Tuscany can use an underlying logger in it's
> > > own
> > > > > > > monitor ( as
> > > > > > > > > > it uses today). But i think the first approach of using a
> > > > > monitor
> > > > > > > is better
> > > > > > > > > > along with the condition that it be made more usable by
> > > the
> > > > > > > plugins by
> > > > > > > > > > giving them greater control.
> > > > > > > > > >
> > > > > > > > > > Another point is that tuscany should use ResourceBundle
> > > for
> > > > > > > validation
> > > > > > > > > > messages as well. I dont think this is being done today.
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > >
> > > > > > > > > > > > > I am on revision 634808. The
> ContributionServiceImpl
> > > has
> > > > > > > changed
> > > > > > > > > > > since
> > > > > > > > > > > > > then,
> > > > > > > > > > > > > and with the one that i have, it would lead through
> > > the
> > > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > > instead of the CompositeDocumentProcessor. Hence
> the
> > > > > > > difference
> > > > > > > > > > > in
> > > > > > > > > > > > > exceptions..
> > > > > > > > > > > > >
> > > > > > > > > > > > > Also, dont you think that with the error that you
> > > got
> > > > > should
> > > > > > > > > > > throw an
> > > > > > > > > > > > > exception with schema validation, rather than just
> a
> > > > > > > warning?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Thank you for the good information. First up i
> > > am
> > > > > trying
> > > > > > > to
> > > > > > > > > > > verify
> > > > > > > > > > > > > > whether
> > > > > > > > > > > > > > > the schema validation works when we point to
> our
> > > > > > > schemas.
> > > > > > > > > > > Can you
> > > > > > > > > > > > > let me
> > > > > > > > > > > > > > > know what is a simple error that i can
> introduce
> > > so
> > > > > that
> > > > > > > i
> > > > > > > > > > > can
> > > > > > > > > > > > > verify
> > > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > > I tried doing this to my composite file (In
> > > block
> > > > > red):
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > > >    <property name="location"
> > > source="$newLocation"/>
> > > > > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > This resulted in the following exception, but i
> > > > > think
> > > > > > > this
> > > > > > > > > > > is part
> > > > > > > > > > > > > of
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > validation done by artifact processor and would
> > > > > result
> > > > > > > even
> > > > > > > > > > > if we
> > > > > > > > > > > > > > comment
> > > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > > Unexpected <binding> element found. It should
> > > appear
> > > > > > > inside
> > > > > > > > > > > a
> > > > > > > > > > > > > <service>
> > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > > >    at
> > > > > > > > > > >
> > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > regards
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan
> Muhammad
> > > <
> > > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Currently, i see that we have various
> places
> > > > > where
> > > > > > > we
> > > > > > > > > > > can plug
> > > > > > > > > > > > > in
> > > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > > monitoring. Some of the ones that i found
> > > are in
> > > > > the
> > > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > InterfaceContractMapper
> > > interfaceContractMapper,
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > > >        return new
> > > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > > >            SCABindingFactory
> > > scaBindingFactory,
> > > > > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > > >            List<PolicySet>
> domainPolicySets)
> > > {
> > > > > > > > > > > > > > > > >        return new
> > > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Instead of passing null, we can pass in our
> > > own
> > > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > > these the only places where we need to do
> > > this?
> > > > > or
> > > > > > > are
> > > > > > > > > > > there
> > > > > > > > > > > > > other
> > > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > There are a few places that logically we need
> > > to
> > > > > be
> > > > > > > able
> > > > > > > > > > > to
> > > > > > > > > > > > > validate
> > > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > > and hence add monitors. The story is changing
> > > a
> > > > > little
> > > > > > > as
> > > > > > > > > > > we are
> > > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > > > > > contributions but
> > > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > > would expect to be running validating on at
> > > least
> > > > > the
> > > > > > > > > > > following
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > > need
> > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > > >   - extension availability [General artifact
> > > > > processor
> > > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > > >   - ensure that artifacts required by the
> > > > > composite
> > > > > > > are
> > > > > > > > > > > available
> > > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > > > consistent,
> > > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I've noted in the square brackets where this
> > > > > function
> > > > > > > > > > > currently
> > > > > > > > > > > > > is.
> > > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > > also that I'm making no comment here about
> > > whether
> > > > > the
> > > > > > > > > > > > > construction of
> > > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > > in-memory composite model is for use purely
> > > for
> > > > > > > > > > > contribution
> > > > > > > > > > > > > > processing
> > > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > > is going to activated and started in a
> > > runtime.
> > > > > This
> > > > > > > > > > > validation is
> > > > > > > > > > > > > > > > appropriate in both cases although you may
> > > choose
> > > > > to
> > > > > > > use
> > > > > > > > > > > different
> > > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > So what I suggest as a first step is that you
> > > go
> > > > > ahead
> > > > > > > and
> > > > > > > > > > > change
> > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor
> > > into
> > > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > > to
> > > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > > how it works. We can work here to build a
> > > > > consistent
> > > > > > > view
> > > > > > > > > > > of
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > > > - what should the plugin model for monitors
> be
> > > > > > > > > > > > > > > > - the flow of control (monitors vs
> exceptions)
> > > > > > > > > > > > > > > > - what extra features may be required, I18N
> > > etc.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > I'm going to try a few experiments too to
> > > > > familiarize
> > > > > > > > > > > myself with
> > > > > > > > > > > > > this
> > > > > > > > > > > > > > a
> > > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > The change you suggest should cause a schema
> > > > > validation
> > > > > > > error.
> > > > > > > > > > > I made
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > change locally in samples/calculator and see the
> > > > > following
> > > > > > > > > > > output in
> > > > > > > > > > > > > > stdout
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > > error
> > > > > > > > > > > > > > WARNING: XMLSchema validation problem in: null,
> > > line:
> > > > > 28,
> > > > > > > > > > > column: 5
> > > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> > > > > starting
> > > > > > > > > > > with
> > > > > > > > > > > > > element '
> > > > > > > > > > > > > > binding.ws'. One of '{"
> > > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > > ":include,
> > > > > > > > > > > "
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > > WC[##other:"
> > > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is
> expected.
> > > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > > read
> > > > > > > > > > > > > > WARNING: Element {
> > > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<
> http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > > >cannot
> > > > > be
> > > > > > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > > > > > referencing.
> > > > > > > > > > > I'm not
> > > > > > > > > > > > sure why the exception is no longer thrown. The code
> > > is
> > > > > still
> > > > > > > in
> > > > > > > > > > > the
> > > > > > > > > > > > CompositeProcessor to trap the case but maybe the
> > > > > offending
> > > > > > > > > > > element is
> > > > > > > > > > > > removed from the stream because of the validation
> > > warning.
> > > > > > > > > > > >
> > > > > > > > > > > > I would argue that we shouldn't mandate that an
> > > exception
> > > > > is
> > > > > > > > > > > thrown in
> > > > > > > > > > > > this case but that the validation mechanism is opened
> > > up
> > > > > to
> > > > > > > the
> > > > > > > > > > > monitor API
> > > > > > > > > > > > so that a monitor can be attached and those who are
> > > > > embedding
> > > > > > > > > > > tuscany can
> > > > > > > > > > > > decide how they want to deal with errors like this.
> > > > > > > > > > > >
> > > > > > > > > > > > Simon
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > Hi
> > > > > > > > > > >
> > > > > > > > > > > I've just been through the original list again looking
> > > at
> > > > > what
> > > > > > > > > > > happens with
> > > > > > > > > > > validation types errors (by which I mean a workspace
> > > type
> > > > > admin
> > > > > > > > > > > console
> > > > > > > > > > > would reasonably want to display based on user
> > > > > input/changes).
> > > > > > > This
> > > > > > > > > > > is what
> > > > > > > > > > > I found.
> > > > > > > > > > >
> > > > > > > > > > > - Contribution processing
> > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > > > - Composite read
> > > > > > > > > > >   - schema compliance
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > > >    - policy intent matching
> > > > > > > > > > >
> > > > > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > > >      Throws exceptions
> > > > > > > > > > >    - extension availability
> > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > >      Throws exceptions
> > > > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > > >     Throws exceptions
> > > > > > > > > > > - Composite resolve
> > > > > > > > > > >   - ensure that artifacts required by the composite are
> > > > > > > available
> > > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > > >      Throws exceptions
> > > > > > > > > > > - Composite build
> > > > > > > > > > >   - ensure that the composite is valid and consistent,
> > > e.g.
> > > > > > > unique
> > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > > >
> > > > > > > > > > > I would like to look for a more consistent approach
> > > across
> > > > > these
> > > > > > > > > > > various
> > > > > > > > > > > elements of validation. The aim being to make it more
> > > > > obvious
> > > > > > > how to
> > > > > > > > > > > recognize validation type errors and act accordingly.
> > > There
> > > > > has
> > > > > > > been
> > > > > > > > > > > a
> > > > > > > > > > > relatively lengthy debate about how to group and report
> > > > > errors
> > > > > > > in
> > > > > > > > > > > [1] which
> > > > > > > > > > > is worth a read. The scenarios I have in mind are
> > > workspace
> > > > > > > > > > > administration
> > > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > > >
> > > > > > > > > > > Add a contribution and be notified that contributions
> > > that
> > > > > it
> > > > > > > > > > > depends on are
> > > > > > > > > > > not available
> > > > > > > > > > > Look at a composite and be notified that there are XML
> > > > > and/or
> > > > > > > SCA
> > > > > > > > > > > errors
> > > > > > > > > > > etc.
> > > > > > > > > > >
> > > > > > > > > > > From [1] we want to capture as many errors as possible
> > > > > before
> > > > > > > > > > > reporting back
> > > > > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > > > > >
> > > > > > > > > > > 1 - Pull up the Monitor API and make it more generic
> > > (and
> > > > > from
> > > > > > > > > > > previous
> > > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove
> the
> > > > > monitor
> > > > > > > (or
> > > > > > > > > > > at
> > > > > > > > > > > least don't extend it further).
> > > > > > > > > > >
> > > > > > > > > > > I'm going to think some more about these options. Any
> > > > > thoughts
> > > > > > > or
> > > > > > > > > > > more
> > > > > > > > > > > options?
> > > > > > > > > > >
> > > > > > > > > > > Simon
> > > > > > > > > > >
> > > > > > > > > > > [1]
> > > > > > > > > > >
> > > > > > >
> > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > > Hi Hasan
> > > > > >
> > > > > > What do you mean in your question by "plugin". If you mean an
> > > Tuscany
> > > > > > extension then I think we have that covered as each extension
> will
> > > > > ship with
> > > > > > any bundles that it needs and stll the default monitor can be
> > > used.
> > > > > >
> > > > > > Here is the model I have in my head of this.
> > > > > >
> > > > > > runtime
> > > > > >   monitor
> > > > > >   module (there are many of these in the runtime)
> > > > > >     resource bundle
> > > > > >     raises problems - each problem references the name of a
> > > resource
> > > > > > bundle for the modules in question (I don't believe I can get the
> > > name
> > > > > of
> > > > > > the module automatically)
> > > > > >
> > > > > > So I'm anticipating that the runtime will create a single monitor
> > > but
> > > > > this
> > > > > > is not a hard and fast rule.
> > > > > >
> > > > > > Each module/extension raises problems referencing the resource
> > > bundle
> > > > > that
> > > > > > it contains. Hence the module provides messages appropriate to
> > > errors
> > > > > that
> > > > > > it will raise. The resource bundle reference is by root name so
> > > there
> > > > > is not
> > > > > > reason why the resource bundle couldn't be put somewhere else.
> > > > > >
> > > > > > If you want to change the default messages that are provided, as
> > > > > opposed
> > > > > > to create a new extension with new messages, there are a number
> of
> > > > > options.
> > > > > >
> > > > > > - The source code approach - i.e. change the bundles  provided
> > > > > > - Provide new bundles first on the classpath - I think they will
> > > get
> > > > > > picked up in preference to the default ones but I would have to
> > > test
> > > > > it to
> > > > > > see
> > > > > > - We could reorganize the bundles so they are in their in their
> > > own
> > > > > > separate jars. Then you would provide a replacement jar.
> > > > > > - Add an API to the monitor to allow a bundle mapping to be
> > > specified.
> > > > > In
> > > > > > this case though it seems easier to provide a new monitor
> > > > > implementation
> > > > > > rather than providing a new API.
> > > > > >
> > > > > > There are probably more options so any thoughts are welcome. I'm
> > > > > currently
> > > > > > working on getting the new monitor integrated into the existing
> > > > > modules
> > > > > > (primarily assembly) so we will have something to try out. We can
> > > take
> > > > > a
> > > > > > look at these options for real when I'm done.
> > > > > >
> > > > > > Simon
> > > > > >
> > > > >
> > > > > Hi
> > > > >
> > > > > I've just checked in the changes to do the basic integration of the
> > > > > monitor
> > > > > extension with the rest of the code base. Its a light touch end to
> > > end
> > > > > integration at the moment. Here are some of the TODOs
> > > > >
> > > > > - Move messages into resource bundles.
> > > > > - Local monitors are still created in some places.
> > > > > - If a monitor implementation is not found then a warning is raised
> > > but
> > > > > execution continues so that I don't have to change the dependencies
> > > of
> > > > > the
> > > > > many tests that now don't pull in a monitor but also don't raise
> any
> > > > > warnings. May want to address this but It's OK for the time being.
> > > > >
> > > > > Hopefully now the validation itests make more sense now. The test
> to
> > > > > look at
> > > > > is the duplicate component name test. This is the only message I've
> > > > > moved
> > > > > out into a resource bundle at the moment. Now I have the basics in
> > > I'll
> > > > > move
> > > > > all the messages and do the tidying up.
> > > > >
> > > > >  Also I've switched to using node instead of domain in the tests. I
> > > > > notice
> > > > > we need to do some work on the constructor for this type of use.
> > > I'll
> > > > > work
> > > > > on this too.
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > >
> > > >
> > >
> > Hi Hasan
> >
> > have been running some of the validation code today and I notice that
> > quite a few of the reported error messages have their parameters
> > miss-aligned. I.e. I often see an unexpanded {1}. This is down the the
> > builder warning() method being called with too few parameters. It takes
> >
> >  warning(String message, Object model, String... messageParameters)
> >
> > So if i had a {0} and a {1} in the message I would use something like
> >
> > warning("ReferenceIncompatibleInterface", composite,
> > componentReference.getName(), componentService.getName());
> >
> > Where the two parameters are passed in at the end.
> >
> > Easy enough for me to go and fix the ones I find but thought I would
> raise
> > it in case you are doing some more and spot mistakes.
> >
> > Regards
> >
> > Simon
> >
> Hi
>
> Actually I went through the places where warning is called and they are all
> pretty much perfect so I must have just hit the one bad one that have a
> missing parameter. As far as I know they are all good now.
>
> Simon
>

Hi Simon,
I had a chance to look at the monitors that are being hooked up with
different parts of the code and found some inconsistency interms of raising
warning & errors. In some places we throw exceptions and in other places we
raise a warning. I also believe there are instances where we need to do
both, the below examples might give us some clue.....

Here are some examples for the inconsistency.......

BaseConfigurationBuilderImpl.java
Here we raise only a warning for URISyntaxException, should we not throw an
exception too?

BaseWireBuilderImpl.java
Here we throw exceptions for IncompatibleInterfaceContractException, don't
you think we also need to register this message in our monitor?
In the same class, we raise a warning message for the PolicyRelated
Exceptions, should we also throw an exception here?

CompositeProcessor.java
There are instances where we throw new ContributionReadException, i believe
registering this msg with a monitor is also required as this is caused by
incorrect user input.

Like to know your views on this... so that we can consider a standard way of
raising warning/errors using the monitor.

-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Apr 24, 2008 at 5:36 PM, Simon Laws <si...@googlemail.com>
wrote:

>
>
> On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I opened JIRA 2260 and attached a second batch of validation test cases.
> >
> > regards
> > Hasan
> >
> > On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> >
> > > Hi Simon
> > >
> > > I opened JIRA 2255 and attached a patch for the new testcases.
> > >
> > > Hasan
> > >
> > >
> > > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <
> > simonslaws@googlemail.com>
> > > wrote:
> > >
> > > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <
> > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > We should have an api for plugins to provide a resource bundle.
> > This
> > > > api
> > > > > > probably needs to be on the monitor or somewhere, i am not sure.
> > But
> > > > the
> > > > > > scenario occurs when plugins want to use the default Monitor but
> > > > still
> > > > > > want
> > > > > > to use their own resource bundle for messageIDs.
> > > > > >
> > > > > > regards
> > > > > > Hasan
> > > > > >
> > > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I looked at the new Monitor and Problem interfaces. What do
> > > > > > getMessageId()
> > > > > > > and getMessageParams() actually return? is MessageId a way to
> > > > > > categorize the
> > > > > > > error message?
> > > > > > >
> > > > > > > regards
> > > > > > > Hasan
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> > appaos@gmail.com
> > > > >
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > I was wondering if i can cook up some validation test cases
> > if
> > > > they
> > > > > > do
> > > > > > > > not exist. Or should we wait until the monitor issue is
> > resolved
> > > > ?
> > > > > > > >
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > >
> > > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > I dont think using an underlying tuscany jdk logger would
> > be
> > > > > > useful to
> > > > > > > > > plugins as they may not want to log, rather show it
> > somewhere
> > > > else
> > > > > > such as
> > > > > > > > > console etc. Tuscany can use an underlying logger in it's
> > own
> > > > > > monitor ( as
> > > > > > > > > it uses today). But i think the first approach of using a
> > > > monitor
> > > > > > is better
> > > > > > > > > along with the condition that it be made more usable by
> > the
> > > > > > plugins by
> > > > > > > > > giving them greater control.
> > > > > > > > >
> > > > > > > > > Another point is that tuscany should use ResourceBundle
> > for
> > > > > > validation
> > > > > > > > > messages as well. I dont think this is being done today.
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > I am on revision 634808. The ContributionServiceImpl
> > has
> > > > > > changed
> > > > > > > > > > since
> > > > > > > > > > > > then,
> > > > > > > > > > > > and with the one that i have, it would lead through
> > the
> > > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > > > > > difference
> > > > > > > > > > in
> > > > > > > > > > > > exceptions..
> > > > > > > > > > > >
> > > > > > > > > > > > Also, dont you think that with the error that you
> > got
> > > > should
> > > > > > > > > > throw an
> > > > > > > > > > > > exception with schema validation, rather than just a
> > > > > > warning?
> > > > > > > > > > > >
> > > > > > > > > > > > Hasan
> > > > > > > > > > > >
> > > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Thank you for the good information. First up i
> > am
> > > > trying
> > > > > > to
> > > > > > > > > > verify
> > > > > > > > > > > > > whether
> > > > > > > > > > > > > > the schema validation works when we point to our
> > > > > > schemas.
> > > > > > > > > > Can you
> > > > > > > > > > > > let me
> > > > > > > > > > > > > > know what is a simple error that i can introduce
> > so
> > > > that
> > > > > > i
> > > > > > > > > > can
> > > > > > > > > > > > verify
> > > > > > > > > > > > > > this?
> > > > > > > > > > > > > > I tried doing this to my composite file (In
> > block
> > > > red):
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > > >    <property name="location"
> > source="$newLocation"/>
> > > > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > > > >  </component>
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > This resulted in the following exception, but i
> > > > think
> > > > > > this
> > > > > > > > > > is part
> > > > > > > > > > > > of
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > validation done by artifact processor and would
> > > > result
> > > > > > even
> > > > > > > > > > if we
> > > > > > > > > > > > > comment
> > > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > > Unexpected <binding> element found. It should
> > appear
> > > > > > inside
> > > > > > > > > > a
> > > > > > > > > > > > <service>
> > > > > > > > > > > > > or
> > > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > > >    at
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > > >    at
> > > > > > > > > >
> > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > regards
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad
> > <
> > > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Currently, i see that we have various places
> > > > where
> > > > > > we
> > > > > > > > > > can plug
> > > > > > > > > > > > in
> > > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > > monitoring. Some of the ones that i found
> > are in
> > > > the
> > > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > InterfaceContractMapper
> > interfaceContractMapper,
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > > >        return new
> > > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > > >            SCABindingFactory
> > scaBindingFactory,
> > > > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > > >            List<PolicySet> domainPolicySets)
> > {
> > > > > > > > > > > > > > > >        return new
> > > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Instead of passing null, we can pass in our
> > own
> > > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > > these the only places where we need to do
> > this?
> > > > or
> > > > > > are
> > > > > > > > > > there
> > > > > > > > > > > > other
> > > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > There are a few places that logically we need
> > to
> > > > be
> > > > > > able
> > > > > > > > > > to
> > > > > > > > > > > > validate
> > > > > > > > > > > > > > input
> > > > > > > > > > > > > > > and hence add monitors. The story is changing
> > a
> > > > little
> > > > > > as
> > > > > > > > > > we are
> > > > > > > > > > > > > moving
> > > > > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > > > > contributions but
> > > > > > > > > > > > > > logically
> > > > > > > > > > > > > > > I
> > > > > > > > > > > > > > > would expect to be running validating on at
> > least
> > > > the
> > > > > > > > > > following
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > > need
> > > > > > > > > > > > > to
> > > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > > >
> > > > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > > >   - extension availability [General artifact
> > > > processor
> > > > > > > > > > hierarchy]
> > > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > > >   - ensure that artifacts required by the
> > > > composite
> > > > > > are
> > > > > > > > > > available
> > > > > > > > > > > > > > [General
> > > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > > consistent,
> > > > > > > > > > e.g. unique
> > > > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I've noted in the square brackets where this
> > > > function
> > > > > > > > > > currently
> > > > > > > > > > > > is.
> > > > > > > > > > > > > Note
> > > > > > > > > > > > > > > also that I'm making no comment here about
> > whether
> > > > the
> > > > > > > > > > > > construction of
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > > in-memory composite model is for use purely
> > for
> > > > > > > > > > contribution
> > > > > > > > > > > > > processing
> > > > > > > > > > > > > > or
> > > > > > > > > > > > > > > is going to activated and started in a
> > runtime.
> > > > This
> > > > > > > > > > validation is
> > > > > > > > > > > > > > > appropriate in both cases although you may
> > choose
> > > > to
> > > > > > use
> > > > > > > > > > different
> > > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > So what I suggest as a first step is that you
> > go
> > > > ahead
> > > > > > and
> > > > > > > > > > change
> > > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor
> > into
> > > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > > to
> > > > > > > > > > > > > > > see
> > > > > > > > > > > > > > > how it works. We can work here to build a
> > > > consistent
> > > > > > view
> > > > > > > > > > of
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > > > > > - what extra features may be required, I18N
> > etc.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > I'm going to try a few experiments too to
> > > > familiarize
> > > > > > > > > > myself with
> > > > > > > > > > > > this
> > > > > > > > > > > > > a
> > > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > > more.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > > The change you suggest should cause a schema
> > > > validation
> > > > > > error.
> > > > > > > > > > I made
> > > > > > > > > > > > the
> > > > > > > > > > > > > change locally in samples/calculator and see the
> > > > following
> > > > > > > > > > output in
> > > > > > > > > > > > > stdout
> > > > > > > > > > > > >
> > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > > error
> > > > > > > > > > > > > WARNING: XMLSchema validation problem in: null,
> > line:
> > > > 28,
> > > > > > > > > > column: 5
> > > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> > > > starting
> > > > > > > > > > with
> > > > > > > > > > > > element '
> > > > > > > > > > > > > binding.ws'. One of '{"
> > > > http://www.osoa.org/xmlns/sca/1.0
> > > > > > ":include,
> > > > > > > > > > "
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> > WC[##other:"
> > > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > > read
> > > > > > > > > > > > > WARNING: Element {
> > > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws
> > >cannot
> > > > be
> > > > > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > > > > >
> > > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Simon
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > > > > referencing.
> > > > > > > > > > I'm not
> > > > > > > > > > > sure why the exception is no longer thrown. The code
> > is
> > > > still
> > > > > > in
> > > > > > > > > > the
> > > > > > > > > > > CompositeProcessor to trap the case but maybe the
> > > > offending
> > > > > > > > > > element is
> > > > > > > > > > > removed from the stream because of the validation
> > warning.
> > > > > > > > > > >
> > > > > > > > > > > I would argue that we shouldn't mandate that an
> > exception
> > > > is
> > > > > > > > > > thrown in
> > > > > > > > > > > this case but that the validation mechanism is opened
> > up
> > > > to
> > > > > > the
> > > > > > > > > > monitor API
> > > > > > > > > > > so that a monitor can be attached and those who are
> > > > embedding
> > > > > > > > > > tuscany can
> > > > > > > > > > > decide how they want to deal with errors like this.
> > > > > > > > > > >
> > > > > > > > > > > Simon
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > Hi
> > > > > > > > > >
> > > > > > > > > > I've just been through the original list again looking
> > at
> > > > what
> > > > > > > > > > happens with
> > > > > > > > > > validation types errors (by which I mean a workspace
> > type
> > > > admin
> > > > > > > > > > console
> > > > > > > > > > would reasonably want to display based on user
> > > > input/changes).
> > > > > > This
> > > > > > > > > > is what
> > > > > > > > > > I found.
> > > > > > > > > >
> > > > > > > > > > - Contribution processing
> > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > > - Composite read
> > > > > > > > > >   - schema compliance
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > > >    - policy intent matching
> > > > > > > > > >
> > > > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > > >      Throws exceptions
> > > > > > > > > >    - extension availability
> > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > >      Throws exceptions
> > > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > > >     General artifact processor hierarchy
> > > > > > > > > >     Throws exceptions
> > > > > > > > > > - Composite resolve
> > > > > > > > > >   - ensure that artifacts required by the composite are
> > > > > > available
> > > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > > >      Throws exceptions
> > > > > > > > > > - Composite build
> > > > > > > > > >   - ensure that the composite is valid and consistent,
> > e.g.
> > > > > > unique
> > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > >
> > > > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > > >
> > > > > > > > > > I would like to look for a more consistent approach
> > across
> > > > these
> > > > > > > > > > various
> > > > > > > > > > elements of validation. The aim being to make it more
> > > > obvious
> > > > > > how to
> > > > > > > > > > recognize validation type errors and act accordingly.
> > There
> > > > has
> > > > > > been
> > > > > > > > > > a
> > > > > > > > > > relatively lengthy debate about how to group and report
> > > > errors
> > > > > > in
> > > > > > > > > > [1] which
> > > > > > > > > > is worth a read. The scenarios I have in mind are
> > workspace
> > > > > > > > > > administration
> > > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > > >
> > > > > > > > > > Add a contribution and be notified that contributions
> > that
> > > > it
> > > > > > > > > > depends on are
> > > > > > > > > > not available
> > > > > > > > > > Look at a composite and be notified that there are XML
> > > > and/or
> > > > > > SCA
> > > > > > > > > > errors
> > > > > > > > > > etc.
> > > > > > > > > >
> > > > > > > > > > From [1] we want to capture as many errors as possible
> > > > before
> > > > > > > > > > reporting back
> > > > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > > > >
> > > > > > > > > > 1 - Pull up the Monitor API and make it more generic
> > (and
> > > > from
> > > > > > > > > > previous
> > > > > > > > > > comments here make it an extension point)
> > > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the
> > > > monitor
> > > > > > (or
> > > > > > > > > > at
> > > > > > > > > > least don't extend it further).
> > > > > > > > > >
> > > > > > > > > > I'm going to think some more about these options. Any
> > > > thoughts
> > > > > > or
> > > > > > > > > > more
> > > > > > > > > > options?
> > > > > > > > > >
> > > > > > > > > > Simon
> > > > > > > > > >
> > > > > > > > > > [1]
> > > > > > > > > >
> > > > > >
> > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > > Hi Hasan
> > > > >
> > > > > What do you mean in your question by "plugin". If you mean an
> > Tuscany
> > > > > extension then I think we have that covered as each extension will
> > > > ship with
> > > > > any bundles that it needs and stll the default monitor can be
> > used.
> > > > >
> > > > > Here is the model I have in my head of this.
> > > > >
> > > > > runtime
> > > > >   monitor
> > > > >   module (there are many of these in the runtime)
> > > > >     resource bundle
> > > > >     raises problems - each problem references the name of a
> > resource
> > > > > bundle for the modules in question (I don't believe I can get the
> > name
> > > > of
> > > > > the module automatically)
> > > > >
> > > > > So I'm anticipating that the runtime will create a single monitor
> > but
> > > > this
> > > > > is not a hard and fast rule.
> > > > >
> > > > > Each module/extension raises problems referencing the resource
> > bundle
> > > > that
> > > > > it contains. Hence the module provides messages appropriate to
> > errors
> > > > that
> > > > > it will raise. The resource bundle reference is by root name so
> > there
> > > > is not
> > > > > reason why the resource bundle couldn't be put somewhere else.
> > > > >
> > > > > If you want to change the default messages that are provided, as
> > > > opposed
> > > > > to create a new extension with new messages, there are a number of
> > > > options.
> > > > >
> > > > > - The source code approach - i.e. change the bundles  provided
> > > > > - Provide new bundles first on the classpath - I think they will
> > get
> > > > > picked up in preference to the default ones but I would have to
> > test
> > > > it to
> > > > > see
> > > > > - We could reorganize the bundles so they are in their in their
> > own
> > > > > separate jars. Then you would provide a replacement jar.
> > > > > - Add an API to the monitor to allow a bundle mapping to be
> > specified.
> > > > In
> > > > > this case though it seems easier to provide a new monitor
> > > > implementation
> > > > > rather than providing a new API.
> > > > >
> > > > > There are probably more options so any thoughts are welcome. I'm
> > > > currently
> > > > > working on getting the new monitor integrated into the existing
> > > > modules
> > > > > (primarily assembly) so we will have something to try out. We can
> > take
> > > > a
> > > > > look at these options for real when I'm done.
> > > > >
> > > > > Simon
> > > > >
> > > >
> > > > Hi
> > > >
> > > > I've just checked in the changes to do the basic integration of the
> > > > monitor
> > > > extension with the rest of the code base. Its a light touch end to
> > end
> > > > integration at the moment. Here are some of the TODOs
> > > >
> > > > - Move messages into resource bundles.
> > > > - Local monitors are still created in some places.
> > > > - If a monitor implementation is not found then a warning is raised
> > but
> > > > execution continues so that I don't have to change the dependencies
> > of
> > > > the
> > > > many tests that now don't pull in a monitor but also don't raise any
> > > > warnings. May want to address this but It's OK for the time being.
> > > >
> > > > Hopefully now the validation itests make more sense now. The test to
> > > > look at
> > > > is the duplicate component name test. This is the only message I've
> > > > moved
> > > > out into a resource bundle at the moment. Now I have the basics in
> > I'll
> > > > move
> > > > all the messages and do the tidying up.
> > > >
> > > >  Also I've switched to using node instead of domain in the tests. I
> > > > notice
> > > > we need to do some work on the constructor for this type of use.
> > I'll
> > > > work
> > > > on this too.
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > >
> > >
> >
> Hi Hasan
>
> have been running some of the validation code today and I notice that
> quite a few of the reported error messages have their parameters
> miss-aligned. I.e. I often see an unexpanded {1}. This is down the the
> builder warning() method being called with too few parameters. It takes
>
>  warning(String message, Object model, String... messageParameters)
>
> So if i had a {0} and a {1} in the message I would use something like
>
> warning("ReferenceIncompatibleInterface", composite,
> componentReference.getName(), componentService.getName());
>
> Where the two parameters are passed in at the end.
>
> Easy enough for me to go and fix the ones I find but thought I would raise
> it in case you are doing some more and spot mistakes.
>
> Regards
>
> Simon
>
Hi

Actually I went through the places where warning is called and they are all
pretty much perfect so I must have just hit the one bad one that have a
missing parameter. As far as I know they are all good now.

Simon

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Apr 23, 2008 at 5:39 AM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I opened JIRA 2260 and attached a second batch of validation test cases.
>
> regards
> Hasan
>
> On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon
> >
> > I opened JIRA 2255 and attached a patch for the new testcases.
> >
> > Hasan
> >
> >
> > On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <simonslaws@googlemail.com
> >
> > > wrote:
> > >
> > > >
> > > >
> > > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > We should have an api for plugins to provide a resource bundle.
> This
> > > api
> > > > > probably needs to be on the monitor or somewhere, i am not sure.
> But
> > > the
> > > > > scenario occurs when plugins want to use the default Monitor but
> > > still
> > > > > want
> > > > > to use their own resource bundle for messageIDs.
> > > > >
> > > > > regards
> > > > > Hasan
> > > > >
> > > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I looked at the new Monitor and Problem interfaces. What do
> > > > > getMessageId()
> > > > > > and getMessageParams() actually return? is MessageId a way to
> > > > > categorize the
> > > > > > error message?
> > > > > >
> > > > > > regards
> > > > > > Hasan
> > > > > >
> > > > > >
> > > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <
> appaos@gmail.com
> > > >
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I was wondering if i can cook up some validation test cases if
> > > they
> > > > > do
> > > > > > > not exist. Or should we wait until the monitor issue is
> resolved
> > > ?
> > > > > > >
> > > > > > > Hasan
> > > > > > >
> > > > > > >
> > > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > I dont think using an underlying tuscany jdk logger would be
> > > > > useful to
> > > > > > > > plugins as they may not want to log, rather show it somewhere
> > > else
> > > > > such as
> > > > > > > > console etc. Tuscany can use an underlying logger in it's own
> > > > > monitor ( as
> > > > > > > > it uses today). But i think the first approach of using a
> > > monitor
> > > > > is better
> > > > > > > > along with the condition that it be made more usable by the
> > > > > plugins by
> > > > > > > > giving them greater control.
> > > > > > > >
> > > > > > > > Another point is that tuscany should use ResourceBundle for
> > > > > validation
> > > > > > > > messages as well. I dont think this is being done today.
> > > > > > > >
> > > > > > > > regards
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > >
> > > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > I am on revision 634808. The ContributionServiceImpl
> has
> > > > > changed
> > > > > > > > > since
> > > > > > > > > > > then,
> > > > > > > > > > > and with the one that i have, it would lead through the
> > > > > > > > > > > CompositeProcessor
> > > > > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > > > > difference
> > > > > > > > > in
> > > > > > > > > > > exceptions..
> > > > > > > > > > >
> > > > > > > > > > > Also, dont you think that with the error that you got
> > > should
> > > > > > > > > throw an
> > > > > > > > > > > exception with schema validation, rather than just a
> > > > > warning?
> > > > > > > > > > >
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thank you for the good information. First up i am
> > > trying
> > > > > to
> > > > > > > > > verify
> > > > > > > > > > > > whether
> > > > > > > > > > > > > the schema validation works when we point to our
> > > > > schemas.
> > > > > > > > > Can you
> > > > > > > > > > > let me
> > > > > > > > > > > > > know what is a simple error that i can introduce so
> > > that
> > > > > i
> > > > > > > > > can
> > > > > > > > > > > verify
> > > > > > > > > > > > > this?
> > > > > > > > > > > > > I tried doing this to my composite file (In block
> > > red):
> > > > > > > > > > > > >
> > > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > > >    <property name="location"
> source="$newLocation"/>
> > > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > > >  </component>
> > > > > > > > > > > > >
> > > > > > > > > > > > > This resulted in the following exception, but i
> > > think
> > > > > this
> > > > > > > > > is part
> > > > > > > > > > > of
> > > > > > > > > > > > the
> > > > > > > > > > > > > validation done by artifact processor and would
> > > result
> > > > > even
> > > > > > > > > if we
> > > > > > > > > > > > comment
> > > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > > Unexpected <binding> element found. It should
> appear
> > > > > inside
> > > > > > > > > a
> > > > > > > > > > > <service>
> > > > > > > > > > > > or
> > > > > > > > > > > > > <reference> element
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > > >    at
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > > >    at
> > > > > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > regards
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > > > > > appaos@gmail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Currently, i see that we have various places
> > > where
> > > > > we
> > > > > > > > > can plug
> > > > > > > > > > > in
> > > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > > monitoring. Some of the ones that i found are
> in
> > > the
> > > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > InterfaceContractMapper
> interfaceContractMapper,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > > >        return new
> > > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > interfaceContractMapper,
> > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > > > > > >        return new
> > > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > interfaceContractMapper,
> > > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > > null);
> > > > > > > > > > > > > > >    }
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > > Are
> > > > > > > > > > > > > > > these the only places where we need to do this?
> > > or
> > > > > are
> > > > > > > > > there
> > > > > > > > > > > other
> > > > > > > > > > > > > > places
> > > > > > > > > > > > > > > as
> > > > > > > > > > > > > > > well?
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > There are a few places that logically we need to
> > > be
> > > > > able
> > > > > > > > > to
> > > > > > > > > > > validate
> > > > > > > > > > > > > input
> > > > > > > > > > > > > > and hence add monitors. The story is changing a
> > > little
> > > > > as
> > > > > > > > > we are
> > > > > > > > > > > > moving
> > > > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > > > contributions but
> > > > > > > > > > > > > logically
> > > > > > > > > > > > > > I
> > > > > > > > > > > > > > would expect to be running validating on at least
> > > the
> > > > > > > > > following
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > > need
> > > > > > > > > > > > to
> > > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > > >
> > > > > > > > >
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > > >   - extension availability [General artifact
> > > processor
> > > > > > > > > hierarchy]
> > > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > > >   - ensure that artifacts required by the
> > > composite
> > > > > are
> > > > > > > > > available
> > > > > > > > > > > > > [General
> > > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > > >   - ensure that the composite is valid and
> > > consistent,
> > > > > > > > > e.g. unique
> > > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I've noted in the square brackets where this
> > > function
> > > > > > > > > currently
> > > > > > > > > > > is.
> > > > > > > > > > > > Note
> > > > > > > > > > > > > > also that I'm making no comment here about
> whether
> > > the
> > > > > > > > > > > construction of
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > in-memory composite model is for use purely for
> > > > > > > > > contribution
> > > > > > > > > > > > processing
> > > > > > > > > > > > > or
> > > > > > > > > > > > > > is going to activated and started in a runtime.
> > > This
> > > > > > > > > validation is
> > > > > > > > > > > > > > appropriate in both cases although you may choose
> > > to
> > > > > use
> > > > > > > > > different
> > > > > > > > > > > > > > monitors
> > > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > So what I suggest as a first step is that you go
> > > ahead
> > > > > and
> > > > > > > > > change
> > > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > > to
> > > > > > > > > > > > > > see
> > > > > > > > > > > > > > how it works. We can work here to build a
> > > consistent
> > > > > view
> > > > > > > > > of
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I'm going to try a few experiments too to
> > > familiarize
> > > > > > > > > myself with
> > > > > > > > > > > this
> > > > > > > > > > > > a
> > > > > > > > > > > > > > bit
> > > > > > > > > > > > > > more.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Regards
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Simon
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > >
> > > > > > > > > > > > The change you suggest should cause a schema
> > > validation
> > > > > error.
> > > > > > > > > I made
> > > > > > > > > > > the
> > > > > > > > > > > > change locally in samples/calculator and see the
> > > following
> > > > > > > > > output in
> > > > > > > > > > > > stdout
> > > > > > > > > > > >
> > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > > error
> > > > > > > > > > > > WARNING: XMLSchema validation problem in: null, line:
> > > 28,
> > > > > > > > > column: 5
> > > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> > > starting
> > > > > > > > > with
> > > > > > > > > > > element '
> > > > > > > > > > > > binding.ws'. One of '{"
> > > http://www.osoa.org/xmlns/sca/1.0
> > > > > ":include,
> > > > > > > > > "
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire,
> WC[##other:"
> > > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > > read
> > > > > > > > > > > > WARNING: Element {
> > > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot
> > > be
> > > > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > > > >
> > > > > > > > > > > > No exception is raised though.
> > > > > > > > > > > >
> > > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > > >
> > > > > > > > > > > > Simon
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > > > referencing.
> > > > > > > > > I'm not
> > > > > > > > > > sure why the exception is no longer thrown. The code is
> > > still
> > > > > in
> > > > > > > > > the
> > > > > > > > > > CompositeProcessor to trap the case but maybe the
> > > offending
> > > > > > > > > element is
> > > > > > > > > > removed from the stream because of the validation
> warning.
> > > > > > > > > >
> > > > > > > > > > I would argue that we shouldn't mandate that an exception
> > > is
> > > > > > > > > thrown in
> > > > > > > > > > this case but that the validation mechanism is opened up
> > > to
> > > > > the
> > > > > > > > > monitor API
> > > > > > > > > > so that a monitor can be attached and those who are
> > > embedding
> > > > > > > > > tuscany can
> > > > > > > > > > decide how they want to deal with errors like this.
> > > > > > > > > >
> > > > > > > > > > Simon
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > Hi
> > > > > > > > >
> > > > > > > > > I've just been through the original list again looking at
> > > what
> > > > > > > > > happens with
> > > > > > > > > validation types errors (by which I mean a workspace type
> > > admin
> > > > > > > > > console
> > > > > > > > > would reasonably want to display based on user
> > > input/changes).
> > > > > This
> > > > > > > > > is what
> > > > > > > > > I found.
> > > > > > > > >
> > > > > > > > > - Contribution processing
> > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > > - Composite read
> > > > > > > > >   - schema compliance
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > >      Uses writes to local JDK Logger
> > > > > > > > >    - policy intent matching
> > > > > > > > >
> > > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > > >      Throws exceptions
> > > > > > > > >    - extension availability
> > > > > > > > >     General artifact processor hierarchy
> > > > > > > > >      Throws exceptions
> > > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > > >     General artifact processor hierarchy
> > > > > > > > >     Throws exceptions
> > > > > > > > > - Composite resolve
> > > > > > > > >   - ensure that artifacts required by the composite are
> > > > > available
> > > > > > > > >     General artifact resolver hierarchy
> > > > > > > > >      Throws exceptions
> > > > > > > > > - Composite build
> > > > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > > > unique
> > > > > > > > > component names, valid reference targets etc.
> > > > > > > > >
> > > > > > > > >
> > > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > > >
> > > > > > > > > I would like to look for a more consistent approach across
> > > these
> > > > > > > > > various
> > > > > > > > > elements of validation. The aim being to make it more
> > > obvious
> > > > > how to
> > > > > > > > > recognize validation type errors and act accordingly. There
> > > has
> > > > > been
> > > > > > > > > a
> > > > > > > > > relatively lengthy debate about how to group and report
> > > errors
> > > > > in
> > > > > > > > > [1] which
> > > > > > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > > > > > administration
> > > > > > > > > type scenarios where, for example,  A user may
> > > > > > > > >
> > > > > > > > > Add a contribution and be notified that contributions that
> > > it
> > > > > > > > > depends on are
> > > > > > > > > not available
> > > > > > > > > Look at a composite and be notified that there are XML
> > > and/or
> > > > > SCA
> > > > > > > > > errors
> > > > > > > > > etc.
> > > > > > > > >
> > > > > > > > > From [1] we want to capture as many errors as possible
> > > before
> > > > > > > > > reporting back
> > > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > > >
> > > > > > > > > 1 - Pull up the Monitor API and make it more generic (and
> > > from
> > > > > > > > > previous
> > > > > > > > > comments here make it an extension point)
> > > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the
> > > monitor
> > > > > (or
> > > > > > > > > at
> > > > > > > > > least don't extend it further).
> > > > > > > > >
> > > > > > > > > I'm going to think some more about these options. Any
> > > thoughts
> > > > > or
> > > > > > > > > more
> > > > > > > > > options?
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > > > [1]
> > > > > > > > >
> > > > >
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > > Hi Hasan
> > > >
> > > > What do you mean in your question by "plugin". If you mean an Tuscany
> > > > extension then I think we have that covered as each extension will
> > > ship with
> > > > any bundles that it needs and stll the default monitor can be used.
> > > >
> > > > Here is the model I have in my head of this.
> > > >
> > > > runtime
> > > >   monitor
> > > >   module (there are many of these in the runtime)
> > > >     resource bundle
> > > >     raises problems - each problem references the name of a resource
> > > > bundle for the modules in question (I don't believe I can get the
> name
> > > of
> > > > the module automatically)
> > > >
> > > > So I'm anticipating that the runtime will create a single monitor but
> > > this
> > > > is not a hard and fast rule.
> > > >
> > > > Each module/extension raises problems referencing the resource bundle
> > > that
> > > > it contains. Hence the module provides messages appropriate to errors
> > > that
> > > > it will raise. The resource bundle reference is by root name so there
> > > is not
> > > > reason why the resource bundle couldn't be put somewhere else.
> > > >
> > > > If you want to change the default messages that are provided, as
> > > opposed
> > > > to create a new extension with new messages, there are a number of
> > > options.
> > > >
> > > > - The source code approach - i.e. change the bundles  provided
> > > > - Provide new bundles first on the classpath - I think they will get
> > > > picked up in preference to the default ones but I would have to test
> > > it to
> > > > see
> > > > - We could reorganize the bundles so they are in their in their own
> > > > separate jars. Then you would provide a replacement jar.
> > > > - Add an API to the monitor to allow a bundle mapping to be
> specified.
> > > In
> > > > this case though it seems easier to provide a new monitor
> > > implementation
> > > > rather than providing a new API.
> > > >
> > > > There are probably more options so any thoughts are welcome. I'm
> > > currently
> > > > working on getting the new monitor integrated into the existing
> > > modules
> > > > (primarily assembly) so we will have something to try out. We can
> take
> > > a
> > > > look at these options for real when I'm done.
> > > >
> > > > Simon
> > > >
> > >
> > > Hi
> > >
> > > I've just checked in the changes to do the basic integration of the
> > > monitor
> > > extension with the rest of the code base. Its a light touch end to end
> > > integration at the moment. Here are some of the TODOs
> > >
> > > - Move messages into resource bundles.
> > > - Local monitors are still created in some places.
> > > - If a monitor implementation is not found then a warning is raised but
> > > execution continues so that I don't have to change the dependencies of
> > > the
> > > many tests that now don't pull in a monitor but also don't raise any
> > > warnings. May want to address this but It's OK for the time being.
> > >
> > > Hopefully now the validation itests make more sense now. The test to
> > > look at
> > > is the duplicate component name test. This is the only message I've
> > > moved
> > > out into a resource bundle at the moment. Now I have the basics in I'll
> > > move
> > > all the messages and do the tidying up.
> > >
> > >  Also I've switched to using node instead of domain in the tests. I
> > > notice
> > > we need to do some work on the constructor for this type of use. I'll
> > > work
> > > on this too.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
> >
>
Hi Hasan

have been running some of the validation code today and I notice that quite
a few of the reported error messages have their parameters miss-aligned.
I.e. I often see an unexpanded {1}. This is down the the builder warning()
method being called with too few parameters. It takes

 warning(String message, Object model, String... messageParameters)

So if i had a {0} and a {1} in the message I would use something like

warning("ReferenceIncompatibleInterface", composite,
componentReference.getName(), componentService.getName());

Where the two parameters are passed in at the end.

Easy enough for me to go and fix the ones I find but thought I would raise
it in case you are doing some more and spot mistakes.

Regards

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

I opened JIRA 2260 and attached a second batch of validation test cases.

regards
Hasan

On Tue, Apr 22, 2008 at 8:16 AM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon
>
> I opened JIRA 2255 and attached a patch for the new testcases.
>
> Hasan
>
>
> On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > >
> > >
> > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > We should have an api for plugins to provide a resource bundle. This
> > api
> > > > probably needs to be on the monitor or somewhere, i am not sure. But
> > the
> > > > scenario occurs when plugins want to use the default Monitor but
> > still
> > > > want
> > > > to use their own resource bundle for messageIDs.
> > > >
> > > > regards
> > > > Hasan
> > > >
> > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I looked at the new Monitor and Problem interfaces. What do
> > > > getMessageId()
> > > > > and getMessageParams() actually return? is MessageId a way to
> > > > categorize the
> > > > > error message?
> > > > >
> > > > > regards
> > > > > Hasan
> > > > >
> > > > >
> > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <appaos@gmail.com
> > >
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I was wondering if i can cook up some validation test cases if
> > they
> > > > do
> > > > > > not exist. Or should we wait until the monitor issue is resolved
> > ?
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > > >
> > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I dont think using an underlying tuscany jdk logger would be
> > > > useful to
> > > > > > > plugins as they may not want to log, rather show it somewhere
> > else
> > > > such as
> > > > > > > console etc. Tuscany can use an underlying logger in it's own
> > > > monitor ( as
> > > > > > > it uses today). But i think the first approach of using a
> > monitor
> > > > is better
> > > > > > > along with the condition that it be made more usable by the
> > > > plugins by
> > > > > > > giving them greater control.
> > > > > > >
> > > > > > > Another point is that tuscany should use ResourceBundle for
> > > > validation
> > > > > > > messages as well. I dont think this is being done today.
> > > > > > >
> > > > > > > regards
> > > > > > > Hasan
> > > > > > >
> > > > > > >
> > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > I am on revision 634808. The ContributionServiceImpl has
> > > > changed
> > > > > > > > since
> > > > > > > > > > then,
> > > > > > > > > > and with the one that i have, it would lead through the
> > > > > > > > > > CompositeProcessor
> > > > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > > > difference
> > > > > > > > in
> > > > > > > > > > exceptions..
> > > > > > > > > >
> > > > > > > > > > Also, dont you think that with the error that you got
> > should
> > > > > > > > throw an
> > > > > > > > > > exception with schema validation, rather than just a
> > > > warning?
> > > > > > > > > >
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > Thank you for the good information. First up i am
> > trying
> > > > to
> > > > > > > > verify
> > > > > > > > > > > whether
> > > > > > > > > > > > the schema validation works when we point to our
> > > > schemas.
> > > > > > > > Can you
> > > > > > > > > > let me
> > > > > > > > > > > > know what is a simple error that i can introduce so
> > that
> > > > i
> > > > > > > > can
> > > > > > > > > > verify
> > > > > > > > > > > > this?
> > > > > > > > > > > > I tried doing this to my composite file (In block
> > red):
> > > > > > > > > > > >
> > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > >  </component>
> > > > > > > > > > > >
> > > > > > > > > > > > This resulted in the following exception, but i
> > think
> > > > this
> > > > > > > > is part
> > > > > > > > > > of
> > > > > > > > > > > the
> > > > > > > > > > > > validation done by artifact processor and would
> > result
> > > > even
> > > > > > > > if we
> > > > > > > > > > > comment
> > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > Unexpected <binding> element found. It should appear
> > > > inside
> > > > > > > > a
> > > > > > > > > > <service>
> > > > > > > > > > > or
> > > > > > > > > > > > <reference> element
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > >    at
> > > > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > regards
> > > > > > > > > > > >
> > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Currently, i see that we have various places
> > where
> > > > we
> > > > > > > > can plug
> > > > > > > > > > in
> > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > monitoring. Some of the ones that i found are in
> > the
> > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > > > > > >
> > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > >        return new
> > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > interfaceContractMapper,
> > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > null);
> > > > > > > > > > > > > >    }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > > > > >        return new
> > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > interfaceContractMapper,
> > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > null);
> > > > > > > > > > > > > >    }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > Are
> > > > > > > > > > > > > > these the only places where we need to do this?
> > or
> > > > are
> > > > > > > > there
> > > > > > > > > > other
> > > > > > > > > > > > > places
> > > > > > > > > > > > > > as
> > > > > > > > > > > > > > well?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > > There are a few places that logically we need to
> > be
> > > > able
> > > > > > > > to
> > > > > > > > > > validate
> > > > > > > > > > > > input
> > > > > > > > > > > > > and hence add monitors. The story is changing a
> > little
> > > > as
> > > > > > > > we are
> > > > > > > > > > > moving
> > > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > > contributions but
> > > > > > > > > > > > logically
> > > > > > > > > > > > > I
> > > > > > > > > > > > > would expect to be running validating on at least
> > the
> > > > > > > > following
> > > > > > > > > > > > >
> > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > need
> > > > > > > > > > > to
> > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > >
> > > > > > > >
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > >   - extension availability [General artifact
> > processor
> > > > > > > > hierarchy]
> > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > >   - ensure that artifacts required by the
> > composite
> > > > are
> > > > > > > > available
> > > > > > > > > > > > [General
> > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > >   - ensure that the composite is valid and
> > consistent,
> > > > > > > > e.g. unique
> > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > >
> > > > > > > > > > > > > I've noted in the square brackets where this
> > function
> > > > > > > > currently
> > > > > > > > > > is.
> > > > > > > > > > > Note
> > > > > > > > > > > > > also that I'm making no comment here about whether
> > the
> > > > > > > > > > construction of
> > > > > > > > > > > > the
> > > > > > > > > > > > > in-memory composite model is for use purely for
> > > > > > > > contribution
> > > > > > > > > > > processing
> > > > > > > > > > > > or
> > > > > > > > > > > > > is going to activated and started in a runtime.
> > This
> > > > > > > > validation is
> > > > > > > > > > > > > appropriate in both cases although you may choose
> > to
> > > > use
> > > > > > > > different
> > > > > > > > > > > > > monitors
> > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > >
> > > > > > > > > > > > > So what I suggest as a first step is that you go
> > ahead
> > > > and
> > > > > > > > change
> > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > to
> > > > > > > > > > > > > see
> > > > > > > > > > > > > how it works. We can work here to build a
> > consistent
> > > > view
> > > > > > > > of
> > > > > > > > > > > > >
> > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I'm going to try a few experiments too to
> > familiarize
> > > > > > > > myself with
> > > > > > > > > > this
> > > > > > > > > > > a
> > > > > > > > > > > > > bit
> > > > > > > > > > > > > more.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Regards
> > > > > > > > > > > > >
> > > > > > > > > > > > > Simon
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Hi Hasan
> > > > > > > > > > >
> > > > > > > > > > > The change you suggest should cause a schema
> > validation
> > > > error.
> > > > > > > > I made
> > > > > > > > > > the
> > > > > > > > > > > change locally in samples/calculator and see the
> > following
> > > > > > > > output in
> > > > > > > > > > > stdout
> > > > > > > > > > >
> > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > error
> > > > > > > > > > > WARNING: XMLSchema validation problem in: null, line:
> > 28,
> > > > > > > > column: 5
> > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> > starting
> > > > > > > > with
> > > > > > > > > > element '
> > > > > > > > > > > binding.ws'. One of '{"
> > http://www.osoa.org/xmlns/sca/1.0
> > > > ":include,
> > > > > > > > "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > read
> > > > > > > > > > > WARNING: Element {
> > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot
> > be
> > > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > > >
> > > > > > > > > > > No exception is raised though.
> > > > > > > > > > >
> > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > >
> > > > > > > > > > > Simon
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > > referencing.
> > > > > > > > I'm not
> > > > > > > > > sure why the exception is no longer thrown. The code is
> > still
> > > > in
> > > > > > > > the
> > > > > > > > > CompositeProcessor to trap the case but maybe the
> > offending
> > > > > > > > element is
> > > > > > > > > removed from the stream because of the validation warning.
> > > > > > > > >
> > > > > > > > > I would argue that we shouldn't mandate that an exception
> > is
> > > > > > > > thrown in
> > > > > > > > > this case but that the validation mechanism is opened up
> > to
> > > > the
> > > > > > > > monitor API
> > > > > > > > > so that a monitor can be attached and those who are
> > embedding
> > > > > > > > tuscany can
> > > > > > > > > decide how they want to deal with errors like this.
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I've just been through the original list again looking at
> > what
> > > > > > > > happens with
> > > > > > > > validation types errors (by which I mean a workspace type
> > admin
> > > > > > > > console
> > > > > > > > would reasonably want to display based on user
> > input/changes).
> > > > This
> > > > > > > > is what
> > > > > > > > I found.
> > > > > > > >
> > > > > > > > - Contribution processing
> > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > - Composite read
> > > > > > > >   - schema compliance
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > >      Uses writes to local JDK Logger
> > > > > > > >    - policy intent matching
> > > > > > > >
> > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > >      Throws exceptions
> > > > > > > >    - extension availability
> > > > > > > >     General artifact processor hierarchy
> > > > > > > >      Throws exceptions
> > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > >     General artifact processor hierarchy
> > > > > > > >     Throws exceptions
> > > > > > > > - Composite resolve
> > > > > > > >   - ensure that artifacts required by the composite are
> > > > available
> > > > > > > >     General artifact resolver hierarchy
> > > > > > > >      Throws exceptions
> > > > > > > > - Composite build
> > > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > > unique
> > > > > > > > component names, valid reference targets etc.
> > > > > > > >
> > > > > > > >
> > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > >
> > > > > > > > I would like to look for a more consistent approach across
> > these
> > > > > > > > various
> > > > > > > > elements of validation. The aim being to make it more
> > obvious
> > > > how to
> > > > > > > > recognize validation type errors and act accordingly. There
> > has
> > > > been
> > > > > > > > a
> > > > > > > > relatively lengthy debate about how to group and report
> > errors
> > > > in
> > > > > > > > [1] which
> > > > > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > > > > administration
> > > > > > > > type scenarios where, for example,  A user may
> > > > > > > >
> > > > > > > > Add a contribution and be notified that contributions that
> > it
> > > > > > > > depends on are
> > > > > > > > not available
> > > > > > > > Look at a composite and be notified that there are XML
> > and/or
> > > > SCA
> > > > > > > > errors
> > > > > > > > etc.
> > > > > > > >
> > > > > > > > From [1] we want to capture as many errors as possible
> > before
> > > > > > > > reporting back
> > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > >
> > > > > > > > 1 - Pull up the Monitor API and make it more generic (and
> > from
> > > > > > > > previous
> > > > > > > > comments here make it an extension point)
> > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the
> > monitor
> > > > (or
> > > > > > > > at
> > > > > > > > least don't extend it further).
> > > > > > > >
> > > > > > > > I'm going to think some more about these options. Any
> > thoughts
> > > > or
> > > > > > > > more
> > > > > > > > options?
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > > > [1]
> > > > > > > >
> > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > > Hi Hasan
> > >
> > > What do you mean in your question by "plugin". If you mean an Tuscany
> > > extension then I think we have that covered as each extension will
> > ship with
> > > any bundles that it needs and stll the default monitor can be used.
> > >
> > > Here is the model I have in my head of this.
> > >
> > > runtime
> > >   monitor
> > >   module (there are many of these in the runtime)
> > >     resource bundle
> > >     raises problems - each problem references the name of a resource
> > > bundle for the modules in question (I don't believe I can get the name
> > of
> > > the module automatically)
> > >
> > > So I'm anticipating that the runtime will create a single monitor but
> > this
> > > is not a hard and fast rule.
> > >
> > > Each module/extension raises problems referencing the resource bundle
> > that
> > > it contains. Hence the module provides messages appropriate to errors
> > that
> > > it will raise. The resource bundle reference is by root name so there
> > is not
> > > reason why the resource bundle couldn't be put somewhere else.
> > >
> > > If you want to change the default messages that are provided, as
> > opposed
> > > to create a new extension with new messages, there are a number of
> > options.
> > >
> > > - The source code approach - i.e. change the bundles  provided
> > > - Provide new bundles first on the classpath - I think they will get
> > > picked up in preference to the default ones but I would have to test
> > it to
> > > see
> > > - We could reorganize the bundles so they are in their in their own
> > > separate jars. Then you would provide a replacement jar.
> > > - Add an API to the monitor to allow a bundle mapping to be specified.
> > In
> > > this case though it seems easier to provide a new monitor
> > implementation
> > > rather than providing a new API.
> > >
> > > There are probably more options so any thoughts are welcome. I'm
> > currently
> > > working on getting the new monitor integrated into the existing
> > modules
> > > (primarily assembly) so we will have something to try out. We can take
> > a
> > > look at these options for real when I'm done.
> > >
> > > Simon
> > >
> >
> > Hi
> >
> > I've just checked in the changes to do the basic integration of the
> > monitor
> > extension with the rest of the code base. Its a light touch end to end
> > integration at the moment. Here are some of the TODOs
> >
> > - Move messages into resource bundles.
> > - Local monitors are still created in some places.
> > - If a monitor implementation is not found then a warning is raised but
> > execution continues so that I don't have to change the dependencies of
> > the
> > many tests that now don't pull in a monitor but also don't raise any
> > warnings. May want to address this but It's OK for the time being.
> >
> > Hopefully now the validation itests make more sense now. The test to
> > look at
> > is the duplicate component name test. This is the only message I've
> > moved
> > out into a resource bundle at the moment. Now I have the basics in I'll
> > move
> > all the messages and do the tidying up.
> >
> >  Also I've switched to using node instead of domain in the tests. I
> > notice
> > we need to do some work on the constructor for this type of use. I'll
> > work
> > on this too.
> >
> > Regards
> >
> > Simon
> >
>
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Tue, Apr 22, 2008 at 1:16 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon
>
> I opened JIRA 2255 and attached a patch for the new testcases.
>
> Hasan
>
> On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > >
> > >
> > > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > We should have an api for plugins to provide a resource bundle. This
> > api
> > > > probably needs to be on the monitor or somewhere, i am not sure. But
> > the
> > > > scenario occurs when plugins want to use the default Monitor but
> still
> > > > want
> > > > to use their own resource bundle for messageIDs.
> > > >
> > > > regards
> > > > Hasan
> > > >
> > > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I looked at the new Monitor and Problem interfaces. What do
> > > > getMessageId()
> > > > > and getMessageParams() actually return? is MessageId a way to
> > > > categorize the
> > > > > error message?
> > > > >
> > > > > regards
> > > > > Hasan
> > > > >
> > > > >
> > > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <appaos@gmail.com
> >
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I was wondering if i can cook up some validation test cases if
> > they
> > > > do
> > > > > > not exist. Or should we wait until the monitor issue is resolved
> ?
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > > >
> > > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <
> appaos@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I dont think using an underlying tuscany jdk logger would be
> > > > useful to
> > > > > > > plugins as they may not want to log, rather show it somewhere
> > else
> > > > such as
> > > > > > > console etc. Tuscany can use an underlying logger in it's own
> > > > monitor ( as
> > > > > > > it uses today). But i think the first approach of using a
> > monitor
> > > > is better
> > > > > > > along with the condition that it be made more usable by the
> > > > plugins by
> > > > > > > giving them greater control.
> > > > > > >
> > > > > > > Another point is that tuscany should use ResourceBundle for
> > > > validation
> > > > > > > messages as well. I dont think this is being done today.
> > > > > > >
> > > > > > > regards
> > > > > > > Hasan
> > > > > > >
> > > > > > >
> > > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > I am on revision 634808. The ContributionServiceImpl has
> > > > changed
> > > > > > > > since
> > > > > > > > > > then,
> > > > > > > > > > and with the one that i have, it would lead through the
> > > > > > > > > > CompositeProcessor
> > > > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > > > difference
> > > > > > > > in
> > > > > > > > > > exceptions..
> > > > > > > > > >
> > > > > > > > > > Also, dont you think that with the error that you got
> > should
> > > > > > > > throw an
> > > > > > > > > > exception with schema validation, rather than just a
> > > > warning?
> > > > > > > > > >
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Hi Simon,
> > > > > > > > > > > >
> > > > > > > > > > > > Thank you for the good information. First up i am
> > trying
> > > > to
> > > > > > > > verify
> > > > > > > > > > > whether
> > > > > > > > > > > > the schema validation works when we point to our
> > > > schemas.
> > > > > > > > Can you
> > > > > > > > > > let me
> > > > > > > > > > > > know what is a simple error that i can introduce so
> > that
> > > > i
> > > > > > > > can
> > > > > > > > > > verify
> > > > > > > > > > > > this?
> > > > > > > > > > > > I tried doing this to my composite file (In block
> > red):
> > > > > > > > > > > >
> > > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > > >    <implementation.java
> > > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > > >  </component>
> > > > > > > > > > > >
> > > > > > > > > > > > This resulted in the following exception, but i
> think
> > > > this
> > > > > > > > is part
> > > > > > > > > > of
> > > > > > > > > > > the
> > > > > > > > > > > > validation done by artifact processor and would
> result
> > > > even
> > > > > > > > if we
> > > > > > > > > > > comment
> > > > > > > > > > > > out the schema validation.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > > Unexpected <binding> element found. It should appear
> > > > inside
> > > > > > > > a
> > > > > > > > > > <service>
> > > > > > > > > > > or
> > > > > > > > > > > > <reference> element
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > > >    at
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > > >    at
> > > > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > regards
> > > > > > > > > > > >
> > > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > > > > appaos@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Currently, i see that we have various places
> where
> > > > we
> > > > > > > > can plug
> > > > > > > > > > in
> > > > > > > > > > > > > > validation
> > > > > > > > > > > > > > monitoring. Some of the ones that i found are in
> > the
> > > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > > > > > >
> > > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > > >        return new
> > > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > interfaceContractMapper,
> > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > null);
> > > > > > > > > > > > > >    }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > > interfaceContractMapper,
> > > > > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > > > > >        return new
> > > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > > interfaceContractMapper,
> > > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > > null);
> > > > > > > > > > > > > >    }
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > > Are
> > > > > > > > > > > > > > these the only places where we need to do this?
> or
> > > > are
> > > > > > > > there
> > > > > > > > > > other
> > > > > > > > > > > > > places
> > > > > > > > > > > > > > as
> > > > > > > > > > > > > > well?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Hasan
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > > > There are a few places that logically we need to
> be
> > > > able
> > > > > > > > to
> > > > > > > > > > validate
> > > > > > > > > > > > input
> > > > > > > > > > > > > and hence add monitors. The story is changing a
> > little
> > > > as
> > > > > > > > we are
> > > > > > > > > > > moving
> > > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > > contributions but
> > > > > > > > > > > > logically
> > > > > > > > > > > > > I
> > > > > > > > > > > > > would expect to be running validating on at least
> > the
> > > > > > > > following
> > > > > > > > > > > > >
> > > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > > - Composite read
> > > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > > - only appears to be initialized in
> > > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > > need
> > > > > > > > > > > to
> > > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > > >
> > > > > > > >
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > > >   - extension availability [General artifact
> > processor
> > > > > > > > hierarchy]
> > > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > > >   - ensure that artifacts required by the
> composite
> > > > are
> > > > > > > > available
> > > > > > > > > > > > [General
> > > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > > - Composite build
> > > > > > > > > > > > >   - ensure that the composite is valid and
> > consistent,
> > > > > > > > e.g. unique
> > > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > > >
> > > > > > > > > > > > > I've noted in the square brackets where this
> > function
> > > > > > > > currently
> > > > > > > > > > is.
> > > > > > > > > > > Note
> > > > > > > > > > > > > also that I'm making no comment here about whether
> > the
> > > > > > > > > > construction of
> > > > > > > > > > > > the
> > > > > > > > > > > > > in-memory composite model is for use purely for
> > > > > > > > contribution
> > > > > > > > > > > processing
> > > > > > > > > > > > or
> > > > > > > > > > > > > is going to activated and started in a runtime.
> This
> > > > > > > > validation is
> > > > > > > > > > > > > appropriate in both cases although you may choose
> to
> > > > use
> > > > > > > > different
> > > > > > > > > > > > > monitors
> > > > > > > > > > > > > in the two cases.
> > > > > > > > > > > > >
> > > > > > > > > > > > > So what I suggest as a first step is that you go
> > ahead
> > > > and
> > > > > > > > change
> > > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > > to
> > > > > > > > > > > > > see
> > > > > > > > > > > > > how it works. We can work here to build a
> consistent
> > > > view
> > > > > > > > of
> > > > > > > > > > > > >
> > > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > > > > >
> > > > > > > > > > > > > I'm going to try a few experiments too to
> > familiarize
> > > > > > > > myself with
> > > > > > > > > > this
> > > > > > > > > > > a
> > > > > > > > > > > > > bit
> > > > > > > > > > > > > more.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Regards
> > > > > > > > > > > > >
> > > > > > > > > > > > > Simon
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Hi Hasan
> > > > > > > > > > >
> > > > > > > > > > > The change you suggest should cause a schema
> validation
> > > > error.
> > > > > > > > I made
> > > > > > > > > > the
> > > > > > > > > > > change locally in samples/calculator and see the
> > following
> > > > > > > > output in
> > > > > > > > > > > stdout
> > > > > > > > > > >
> > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > > error
> > > > > > > > > > > WARNING: XMLSchema validation problem in: null, line:
> > 28,
> > > > > > > > column: 5
> > > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> > starting
> > > > > > > > with
> > > > > > > > > > element '
> > > > > > > > > > > binding.ws'. One of '{"
> http://www.osoa.org/xmlns/sca/1.0
> > > > ":include,
> > > > > > > > "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > > read
> > > > > > > > > > > WARNING: Element {
> > > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot
> be
> > > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > > >
> > > > > > > > > > > No exception is raised though.
> > > > > > > > > > >
> > > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > > >
> > > > > > > > > > > Simon
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > > referencing.
> > > > > > > > I'm not
> > > > > > > > > sure why the exception is no longer thrown. The code is
> > still
> > > > in
> > > > > > > > the
> > > > > > > > > CompositeProcessor to trap the case but maybe the
> offending
> > > > > > > > element is
> > > > > > > > > removed from the stream because of the validation warning.
> > > > > > > > >
> > > > > > > > > I would argue that we shouldn't mandate that an exception
> is
> > > > > > > > thrown in
> > > > > > > > > this case but that the validation mechanism is opened up
> to
> > > > the
> > > > > > > > monitor API
> > > > > > > > > so that a monitor can be attached and those who are
> > embedding
> > > > > > > > tuscany can
> > > > > > > > > decide how they want to deal with errors like this.
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I've just been through the original list again looking at
> what
> > > > > > > > happens with
> > > > > > > > validation types errors (by which I mean a workspace type
> > admin
> > > > > > > > console
> > > > > > > > would reasonably want to display based on user
> input/changes).
> > > > This
> > > > > > > > is what
> > > > > > > > I found.
> > > > > > > >
> > > > > > > > - Contribution processing
> > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > > - Composite read
> > > > > > > >   - schema compliance
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > >
> >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > >      Uses writes to local JDK Logger
> > > > > > > >    - policy intent matching
> > > > > > > >
> > > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > > >      Throws exceptions
> > > > > > > >    - extension availability
> > > > > > > >     General artifact processor hierarchy
> > > > > > > >      Throws exceptions
> > > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > > >     General artifact processor hierarchy
> > > > > > > >     Throws exceptions
> > > > > > > > - Composite resolve
> > > > > > > >   - ensure that artifacts required by the composite are
> > > > available
> > > > > > > >     General artifact resolver hierarchy
> > > > > > > >      Throws exceptions
> > > > > > > > - Composite build
> > > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > > unique
> > > > > > > > component names, valid reference targets etc.
> > > > > > > >
> > > > > > > >
> > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > > >      uses a CompositeBuilderMonitor
> > > > > > > >
> > > > > > > > I would like to look for a more consistent approach across
> > these
> > > > > > > > various
> > > > > > > > elements of validation. The aim being to make it more
> obvious
> > > > how to
> > > > > > > > recognize validation type errors and act accordingly. There
> > has
> > > > been
> > > > > > > > a
> > > > > > > > relatively lengthy debate about how to group and report
> errors
> > > > in
> > > > > > > > [1] which
> > > > > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > > > > administration
> > > > > > > > type scenarios where, for example,  A user may
> > > > > > > >
> > > > > > > > Add a contribution and be notified that contributions that
> it
> > > > > > > > depends on are
> > > > > > > > not available
> > > > > > > > Look at a composite and be notified that there are XML
> and/or
> > > > SCA
> > > > > > > > errors
> > > > > > > > etc.
> > > > > > > >
> > > > > > > > From [1] we want to capture as many errors as possible
> before
> > > > > > > > reporting back
> > > > > > > > to the user. Two things come immediately to mind.
> > > > > > > >
> > > > > > > > 1 - Pull up the Monitor API and make it more generic (and
> from
> > > > > > > > previous
> > > > > > > > comments here make it an extension point)
> > > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the
> > monitor
> > > > (or
> > > > > > > > at
> > > > > > > > least don't extend it further).
> > > > > > > >
> > > > > > > > I'm going to think some more about these options. Any
> thoughts
> > > > or
> > > > > > > > more
> > > > > > > > options?
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > > > [1]
> > > > > > > >
> > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > > Hi Hasan
> > >
> > > What do you mean in your question by "plugin". If you mean an Tuscany
> > > extension then I think we have that covered as each extension will
> ship
> > with
> > > any bundles that it needs and stll the default monitor can be used.
> > >
> > > Here is the model I have in my head of this.
> > >
> > > runtime
> > >   monitor
> > >   module (there are many of these in the runtime)
> > >     resource bundle
> > >     raises problems - each problem references the name of a resource
> > > bundle for the modules in question (I don't believe I can get the name
> > of
> > > the module automatically)
> > >
> > > So I'm anticipating that the runtime will create a single monitor but
> > this
> > > is not a hard and fast rule.
> > >
> > > Each module/extension raises problems referencing the resource bundle
> > that
> > > it contains. Hence the module provides messages appropriate to errors
> > that
> > > it will raise. The resource bundle reference is by root name so there
> is
> > not
> > > reason why the resource bundle couldn't be put somewhere else.
> > >
> > > If you want to change the default messages that are provided, as
> opposed
> > > to create a new extension with new messages, there are a number of
> > options.
> > >
> > > - The source code approach - i.e. change the bundles  provided
> > > - Provide new bundles first on the classpath - I think they will get
> > > picked up in preference to the default ones but I would have to test
> it
> > to
> > > see
> > > - We could reorganize the bundles so they are in their in their own
> > > separate jars. Then you would provide a replacement jar.
> > > - Add an API to the monitor to allow a bundle mapping to be specified.
> > In
> > > this case though it seems easier to provide a new monitor
> implementation
> > > rather than providing a new API.
> > >
> > > There are probably more options so any thoughts are welcome. I'm
> > currently
> > > working on getting the new monitor integrated into the existing
> modules
> > > (primarily assembly) so we will have something to try out. We can take
> a
> > > look at these options for real when I'm done.
> > >
> > > Simon
> > >
> >
> > Hi
> >
> > I've just checked in the changes to do the basic integration of the
> > monitor
> > extension with the rest of the code base. Its a light touch end to end
> > integration at the moment. Here are some of the TODOs
> >
> > - Move messages into resource bundles.
> > - Local monitors are still created in some places.
> > - If a monitor implementation is not found then a warning is raised but
> > execution continues so that I don't have to change the dependencies of
> the
> > many tests that now don't pull in a monitor but also don't raise any
> > warnings. May want to address this but It's OK for the time being.
> >
> > Hopefully now the validation itests make more sense now. The test to
> look
> > at
> > is the duplicate component name test. This is the only message I've
> moved
> > out into a resource bundle at the moment. Now I have the basics in I'll
> > move
> > all the messages and do the tidying up.
> >
> >  Also I've switched to using node instead of domain in the tests. I
> notice
> > we need to do some work on the constructor for this type of use. I'll
> work
> > on this too.
> >
> > Regards
> >
> > Simon
> >
>

Thanks for the patch Hasan. I just applied it.

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon

I opened JIRA 2255 and attached a patch for the new testcases.

Hasan

On Fri, Apr 18, 2008 at 12:58 PM, Simon Laws <si...@googlemail.com>
wrote:

> On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> >
> >
> > On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> >
> > > Hi Simon,
> > >
> > > We should have an api for plugins to provide a resource bundle. This
> api
> > > probably needs to be on the monitor or somewhere, i am not sure. But
> the
> > > scenario occurs when plugins want to use the default Monitor but still
> > > want
> > > to use their own resource bundle for messageIDs.
> > >
> > > regards
> > > Hasan
> > >
> > > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > I looked at the new Monitor and Problem interfaces. What do
> > > getMessageId()
> > > > and getMessageParams() actually return? is MessageId a way to
> > > categorize the
> > > > error message?
> > > >
> > > > regards
> > > > Hasan
> > > >
> > > >
> > > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I was wondering if i can cook up some validation test cases if
> they
> > > do
> > > > > not exist. Or should we wait until the monitor issue is resolved ?
> > > > >
> > > > > Hasan
> > > > >
> > > > >
> > > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I dont think using an underlying tuscany jdk logger would be
> > > useful to
> > > > > > plugins as they may not want to log, rather show it somewhere
> else
> > > such as
> > > > > > console etc. Tuscany can use an underlying logger in it's own
> > > monitor ( as
> > > > > > it uses today). But i think the first approach of using a
> monitor
> > > is better
> > > > > > along with the condition that it be made more usable by the
> > > plugins by
> > > > > > giving them greater control.
> > > > > >
> > > > > > Another point is that tuscany should use ResourceBundle for
> > > validation
> > > > > > messages as well. I dont think this is being done today.
> > > > > >
> > > > > > regards
> > > > > > Hasan
> > > > > >
> > > > > >
> > > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > I am on revision 634808. The ContributionServiceImpl has
> > > changed
> > > > > > > since
> > > > > > > > > then,
> > > > > > > > > and with the one that i have, it would lead through the
> > > > > > > > > CompositeProcessor
> > > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > > difference
> > > > > > > in
> > > > > > > > > exceptions..
> > > > > > > > >
> > > > > > > > > Also, dont you think that with the error that you got
> should
> > > > > > > throw an
> > > > > > > > > exception with schema validation, rather than just a
> > > warning?
> > > > > > > > >
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Hi Simon,
> > > > > > > > > > >
> > > > > > > > > > > Thank you for the good information. First up i am
> trying
> > > to
> > > > > > > verify
> > > > > > > > > > whether
> > > > > > > > > > > the schema validation works when we point to our
> > > schemas.
> > > > > > > Can you
> > > > > > > > > let me
> > > > > > > > > > > know what is a simple error that i can introduce so
> that
> > > i
> > > > > > > can
> > > > > > > > > verify
> > > > > > > > > > > this?
> > > > > > > > > > > I tried doing this to my composite file (In block
> red):
> > > > > > > > > > >
> > > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > > >    <implementation.java
> > > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > > >  </component>
> > > > > > > > > > >
> > > > > > > > > > > This resulted in the following exception, but i think
> > > this
> > > > > > > is part
> > > > > > > > > of
> > > > > > > > > > the
> > > > > > > > > > > validation done by artifact processor and would result
> > > even
> > > > > > > if we
> > > > > > > > > > comment
> > > > > > > > > > > out the schema validation.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > > Unexpected <binding> element found. It should appear
> > > inside
> > > > > > > a
> > > > > > > > > <service>
> > > > > > > > > > or
> > > > > > > > > > > <reference> element
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > > >    at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > > >    at
> > > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > regards
> > > > > > > > > > >
> > > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > > > appaos@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Currently, i see that we have various places where
> > > we
> > > > > > > can plug
> > > > > > > > > in
> > > > > > > > > > > > > validation
> > > > > > > > > > > > > monitoring. Some of the ones that i found are in
> the
> > > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > > >
> > > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > >
> > > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > >
> > > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > >
> > > > > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > > > > >
> > > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > > >        return new
> > > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > interfaceContractMapper,
> > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > null);
> > > > > > > > > > > > >    }
> > > > > > > > > > > > >
> > > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > > >            InterfaceContractMapper
> > > > > > > interfaceContractMapper,
> > > > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > > > >        return new
> > > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > > intentAttachPointTypeFactory,
> > > interfaceContractMapper,
> > > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > > null);
> > > > > > > > > > > > >    }
> > > > > > > > > > > > >
> > > > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > > Are
> > > > > > > > > > > > > these the only places where we need to do this? or
> > > are
> > > > > > > there
> > > > > > > > > other
> > > > > > > > > > > > places
> > > > > > > > > > > > > as
> > > > > > > > > > > > > well?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hasan
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Hi Hasan
> > > > > > > > > > > >
> > > > > > > > > > > > There are a few places that logically we need to be
> > > able
> > > > > > > to
> > > > > > > > > validate
> > > > > > > > > > > input
> > > > > > > > > > > > and hence add monitors. The story is changing a
> little
> > > as
> > > > > > > we are
> > > > > > > > > > moving
> > > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > > contributions but
> > > > > > > > > > > logically
> > > > > > > > > > > > I
> > > > > > > > > > > > would expect to be running validating on at least
> the
> > > > > > > following
> > > > > > > > > > > >
> > > > > > > > > > > > - Contribution processing
> > > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > > - Composite read
> > > > > > > > > > > >   - schema compliance
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > > - only appears to be initialized in
> > > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > > need
> > > > > > > > > > to
> > > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > > >   - policy intent matching
> > > > > > > > > > > >
> > > > > > >
> [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > > >   - extension availability [General artifact
> processor
> > > > > > > hierarchy]
> > > > > > > > > > > > - Composite resolve
> > > > > > > > > > > >   - ensure that artifacts required by the composite
> > > are
> > > > > > > available
> > > > > > > > > > > [General
> > > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > > - Composite build
> > > > > > > > > > > >   - ensure that the composite is valid and
> consistent,
> > > > > > > e.g. unique
> > > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > > >
> > > > > > > > > > > > I've noted in the square brackets where this
> function
> > > > > > > currently
> > > > > > > > > is.
> > > > > > > > > > Note
> > > > > > > > > > > > also that I'm making no comment here about whether
> the
> > > > > > > > > construction of
> > > > > > > > > > > the
> > > > > > > > > > > > in-memory composite model is for use purely for
> > > > > > > contribution
> > > > > > > > > > processing
> > > > > > > > > > > or
> > > > > > > > > > > > is going to activated and started in a runtime. This
> > > > > > > validation is
> > > > > > > > > > > > appropriate in both cases although you may choose to
> > > use
> > > > > > > different
> > > > > > > > > > > > monitors
> > > > > > > > > > > > in the two cases.
> > > > > > > > > > > >
> > > > > > > > > > > > So what I suggest as a first step is that you go
> ahead
> > > and
> > > > > > > change
> > > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > > > CompositeBuilderImpl
> > > > > > > > > > to
> > > > > > > > > > > > see
> > > > > > > > > > > > how it works. We can work here to build a consistent
> > > view
> > > > > > > of
> > > > > > > > > > > >
> > > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > > > >
> > > > > > > > > > > > I'm going to try a few experiments too to
> familiarize
> > > > > > > myself with
> > > > > > > > > this
> > > > > > > > > > a
> > > > > > > > > > > > bit
> > > > > > > > > > > > more.
> > > > > > > > > > > >
> > > > > > > > > > > > Regards
> > > > > > > > > > > >
> > > > > > > > > > > > Simon
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Hi Hasan
> > > > > > > > > >
> > > > > > > > > > The change you suggest should cause a schema validation
> > > error.
> > > > > > > I made
> > > > > > > > > the
> > > > > > > > > > change locally in samples/calculator and see the
> following
> > > > > > > output in
> > > > > > > > > > stdout
> > > > > > > > > >
> > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > > error
> > > > > > > > > > WARNING: XMLSchema validation problem in: null, line:
> 28,
> > > > > > > column: 5
> > > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found
> starting
> > > > > > > with
> > > > > > > > > element '
> > > > > > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0
> > > ":include,
> > > > > > > "
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > > read
> > > > > > > > > > WARNING: Element {
> > > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > > >
> > > > > > > > > > No exception is raised though.
> > > > > > > > > >
> > > > > > > > > > Let me take a look at what has changed.
> > > > > > > > > >
> > > > > > > > > > Simon
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > Ok, thanks for that Hasan. I see the change you are
> > > referencing.
> > > > > > > I'm not
> > > > > > > > sure why the exception is no longer thrown. The code is
> still
> > > in
> > > > > > > the
> > > > > > > > CompositeProcessor to trap the case but maybe the offending
> > > > > > > element is
> > > > > > > > removed from the stream because of the validation warning.
> > > > > > > >
> > > > > > > > I would argue that we shouldn't mandate that an exception is
> > > > > > > thrown in
> > > > > > > > this case but that the validation mechanism is opened up to
> > > the
> > > > > > > monitor API
> > > > > > > > so that a monitor can be attached and those who are
> embedding
> > > > > > > tuscany can
> > > > > > > > decide how they want to deal with errors like this.
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > Hi
> > > > > > >
> > > > > > > I've just been through the original list again looking at what
> > > > > > > happens with
> > > > > > > validation types errors (by which I mean a workspace type
> admin
> > > > > > > console
> > > > > > > would reasonably want to display based on user input/changes).
> > > This
> > > > > > > is what
> > > > > > > I found.
> > > > > > >
> > > > > > > - Contribution processing
> > > > > > >   - dependency (imports/exports) analysis
> > > > > > >
> > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > > - Composite read
> > > > > > >   - schema compliance
> > > > > > >
> > > > > > >
> > > > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > >      Uses writes to local JDK Logger
> > > > > > >    - policy intent matching
> > > > > > >
> > > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > > >      Throws exceptions
> > > > > > >    - extension availability
> > > > > > >     General artifact processor hierarchy
> > > > > > >      Throws exceptions
> > > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > > >     General artifact processor hierarchy
> > > > > > >     Throws exceptions
> > > > > > > - Composite resolve
> > > > > > >   - ensure that artifacts required by the composite are
> > > available
> > > > > > >     General artifact resolver hierarchy
> > > > > > >      Throws exceptions
> > > > > > > - Composite build
> > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > unique
> > > > > > > component names, valid reference targets etc.
> > > > > > >
> > > > > > >
> > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > > >      uses a CompositeBuilderMonitor
> > > > > > >
> > > > > > > I would like to look for a more consistent approach across
> these
> > > > > > > various
> > > > > > > elements of validation. The aim being to make it more obvious
> > > how to
> > > > > > > recognize validation type errors and act accordingly. There
> has
> > > been
> > > > > > > a
> > > > > > > relatively lengthy debate about how to group and report errors
> > > in
> > > > > > > [1] which
> > > > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > > > administration
> > > > > > > type scenarios where, for example,  A user may
> > > > > > >
> > > > > > > Add a contribution and be notified that contributions that it
> > > > > > > depends on are
> > > > > > > not available
> > > > > > > Look at a composite and be notified that there are XML and/or
> > > SCA
> > > > > > > errors
> > > > > > > etc.
> > > > > > >
> > > > > > > From [1] we want to capture as many errors as possible before
> > > > > > > reporting back
> > > > > > > to the user. Two things come immediately to mind.
> > > > > > >
> > > > > > > 1 - Pull up the Monitor API and make it more generic (and from
> > > > > > > previous
> > > > > > > comments here make it an extension point)
> > > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the
> monitor
> > > (or
> > > > > > > at
> > > > > > > least don't extend it further).
> > > > > > >
> > > > > > > I'm going to think some more about these options. Any thoughts
> > > or
> > > > > > > more
> > > > > > > options?
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > > > [1]
> > > > > > >
> > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> > Hi Hasan
> >
> > What do you mean in your question by "plugin". If you mean an Tuscany
> > extension then I think we have that covered as each extension will ship
> with
> > any bundles that it needs and stll the default monitor can be used.
> >
> > Here is the model I have in my head of this.
> >
> > runtime
> >   monitor
> >   module (there are many of these in the runtime)
> >     resource bundle
> >     raises problems - each problem references the name of a resource
> > bundle for the modules in question (I don't believe I can get the name
> of
> > the module automatically)
> >
> > So I'm anticipating that the runtime will create a single monitor but
> this
> > is not a hard and fast rule.
> >
> > Each module/extension raises problems referencing the resource bundle
> that
> > it contains. Hence the module provides messages appropriate to errors
> that
> > it will raise. The resource bundle reference is by root name so there is
> not
> > reason why the resource bundle couldn't be put somewhere else.
> >
> > If you want to change the default messages that are provided, as opposed
> > to create a new extension with new messages, there are a number of
> options.
> >
> > - The source code approach - i.e. change the bundles  provided
> > - Provide new bundles first on the classpath - I think they will get
> > picked up in preference to the default ones but I would have to test it
> to
> > see
> > - We could reorganize the bundles so they are in their in their own
> > separate jars. Then you would provide a replacement jar.
> > - Add an API to the monitor to allow a bundle mapping to be specified.
> In
> > this case though it seems easier to provide a new monitor implementation
> > rather than providing a new API.
> >
> > There are probably more options so any thoughts are welcome. I'm
> currently
> > working on getting the new monitor integrated into the existing modules
> > (primarily assembly) so we will have something to try out. We can take a
> > look at these options for real when I'm done.
> >
> > Simon
> >
>
> Hi
>
> I've just checked in the changes to do the basic integration of the
> monitor
> extension with the rest of the code base. Its a light touch end to end
> integration at the moment. Here are some of the TODOs
>
> - Move messages into resource bundles.
> - Local monitors are still created in some places.
> - If a monitor implementation is not found then a warning is raised but
> execution continues so that I don't have to change the dependencies of the
> many tests that now don't pull in a monitor but also don't raise any
> warnings. May want to address this but It's OK for the time being.
>
> Hopefully now the validation itests make more sense now. The test to look
> at
> is the duplicate component name test. This is the only message I've moved
> out into a resource bundle at the moment. Now I have the basics in I'll
> move
> all the messages and do the tidying up.
>
>  Also I've switched to using node instead of domain in the tests. I notice
> we need to do some work on the constructor for this type of use. I'll work
> on this too.
>
> Regards
>
> Simon
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Apr 17, 2008 at 5:44 PM, Simon Laws <si...@googlemail.com>
wrote:

>
>
> On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > We should have an api for plugins to provide a resource bundle. This api
> > probably needs to be on the monitor or somewhere, i am not sure. But the
> > scenario occurs when plugins want to use the default Monitor but still
> > want
> > to use their own resource bundle for messageIDs.
> >
> > regards
> > Hasan
> >
> > On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> >
> > > Hi Simon,
> > >
> > > I looked at the new Monitor and Problem interfaces. What do
> > getMessageId()
> > > and getMessageParams() actually return? is MessageId a way to
> > categorize the
> > > error message?
> > >
> > > regards
> > > Hasan
> > >
> > >
> > > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > I was wondering if i can cook up some validation test cases if they
> > do
> > > > not exist. Or should we wait until the monitor issue is resolved ?
> > > >
> > > > Hasan
> > > >
> > > >
> > > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I dont think using an underlying tuscany jdk logger would be
> > useful to
> > > > > plugins as they may not want to log, rather show it somewhere else
> > such as
> > > > > console etc. Tuscany can use an underlying logger in it's own
> > monitor ( as
> > > > > it uses today). But i think the first approach of using a monitor
> > is better
> > > > > along with the condition that it be made more usable by the
> > plugins by
> > > > > giving them greater control.
> > > > >
> > > > > Another point is that tuscany should use ResourceBundle for
> > validation
> > > > > messages as well. I dont think this is being done today.
> > > > >
> > > > > regards
> > > > > Hasan
> > > > >
> > > > >
> > > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > I am on revision 634808. The ContributionServiceImpl has
> > changed
> > > > > > since
> > > > > > > > then,
> > > > > > > > and with the one that i have, it would lead through the
> > > > > > > > CompositeProcessor
> > > > > > > > instead of the CompositeDocumentProcessor. Hence the
> > difference
> > > > > > in
> > > > > > > > exceptions..
> > > > > > > >
> > > > > > > > Also, dont you think that with the error that you got should
> > > > > > throw an
> > > > > > > > exception with schema validation, rather than just a
> > warning?
> > > > > > > >
> > > > > > > > Hasan
> > > > > > > >
> > > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Simon,
> > > > > > > > > >
> > > > > > > > > > Thank you for the good information. First up i am trying
> > to
> > > > > > verify
> > > > > > > > > whether
> > > > > > > > > > the schema validation works when we point to our
> > schemas.
> > > > > > Can you
> > > > > > > > let me
> > > > > > > > > > know what is a simple error that i can introduce so that
> > i
> > > > > > can
> > > > > > > > verify
> > > > > > > > > > this?
> > > > > > > > > > I tried doing this to my composite file (In block red):
> > > > > > > > > >
> > > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > > >    <implementation.java
> > > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > > >    *<binding.ws/>*
> > > > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > > >  </component>
> > > > > > > > > >
> > > > > > > > > > This resulted in the following exception, but i think
> > this
> > > > > > is part
> > > > > > > > of
> > > > > > > > > the
> > > > > > > > > > validation done by artifact processor and would result
> > even
> > > > > > if we
> > > > > > > > > comment
> > > > > > > > > > out the schema validation.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > > Unexpected <binding> element found. It should appear
> > inside
> > > > > > a
> > > > > > > > <service>
> > > > > > > > > or
> > > > > > > > > > <reference> element
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > > >    at
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > > >    at
> > > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > regards
> > > > > > > > > >
> > > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > > simonslaws@googlemail.com>
> > > > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > > appaos@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Currently, i see that we have various places where
> > we
> > > > > > can plug
> > > > > > > > in
> > > > > > > > > > > > validation
> > > > > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > > >
> > > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > >
> > > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > >
> > > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > >
> > > > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > > > >
> > > > > > > > > >  List<PolicySet>
> > > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > > >        return new
> > CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > intentAttachPointTypeFactory,
> > interfaceContractMapper,
> > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > null);
> > > > > > > > > > > >    }
> > > > > > > > > > > >
> > > > > > > > > > > >    public static DomainBuilder
> > > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > > assemblyFactory,
> > > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > > >            InterfaceContractMapper
> > > > > > interfaceContractMapper,
> > > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > > >        return new
> > DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > > intentAttachPointTypeFactory,
> > interfaceContractMapper,
> > > > > > > > > > domainPolicySets,
> > > > > > > > > > > > null);
> > > > > > > > > > > >    }
> > > > > > > > > > > >
> > > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > > Are
> > > > > > > > > > > > these the only places where we need to do this? or
> > are
> > > > > > there
> > > > > > > > other
> > > > > > > > > > > places
> > > > > > > > > > > > as
> > > > > > > > > > > > well?
> > > > > > > > > > > >
> > > > > > > > > > > > Hasan
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Hi Hasan
> > > > > > > > > > >
> > > > > > > > > > > There are a few places that logically we need to be
> > able
> > > > > > to
> > > > > > > > validate
> > > > > > > > > > input
> > > > > > > > > > > and hence add monitors. The story is changing a little
> > as
> > > > > > we are
> > > > > > > > > moving
> > > > > > > > > > > toward the new "workspace"  code for managing
> > > > > > contributions but
> > > > > > > > > > logically
> > > > > > > > > > > I
> > > > > > > > > > > would expect to be running validating on at least the
> > > > > > following
> > > > > > > > > > >
> > > > > > > > > > > - Contribution processing
> > > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > > - Composite read
> > > > > > > > > > >   - schema compliance
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > > - only appears to be initialized in
> > > > > > ReallySmallRuntimeBuilder so
> > > > > > > > need
> > > > > > > > > to
> > > > > > > > > > > look at this in context of workspace]
> > > > > > > > > > >   - policy intent matching
> > > > > > > > > > >
> > > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > > >   - extension availability [General artifact processor
> > > > > > hierarchy]
> > > > > > > > > > > - Composite resolve
> > > > > > > > > > >   - ensure that artifacts required by the composite
> > are
> > > > > > available
> > > > > > > > > > [General
> > > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > > - Composite build
> > > > > > > > > > >   - ensure that the composite is valid and consistent,
> > > > > > e.g. unique
> > > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > > >
> > > > > > > >
> > > > > >
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > > >
> > > > > > > > > > > I've noted in the square brackets where this function
> > > > > > currently
> > > > > > > > is.
> > > > > > > > > Note
> > > > > > > > > > > also that I'm making no comment here about whether the
> > > > > > > > construction of
> > > > > > > > > > the
> > > > > > > > > > > in-memory composite model is for use purely for
> > > > > > contribution
> > > > > > > > > processing
> > > > > > > > > > or
> > > > > > > > > > > is going to activated and started in a runtime. This
> > > > > > validation is
> > > > > > > > > > > appropriate in both cases although you may choose to
> > use
> > > > > > different
> > > > > > > > > > > monitors
> > > > > > > > > > > in the two cases.
> > > > > > > > > > >
> > > > > > > > > > > So what I suggest as a first step is that you go ahead
> > and
> > > > > > change
> > > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > > CompositeBuilderImpl
> > > > > > > > > to
> > > > > > > > > > > see
> > > > > > > > > > > how it works. We can work here to build a consistent
> > view
> > > > > > of
> > > > > > > > > > >
> > > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > > >
> > > > > > > > > > > I'm going to try a few experiments too to familiarize
> > > > > > myself with
> > > > > > > > this
> > > > > > > > > a
> > > > > > > > > > > bit
> > > > > > > > > > > more.
> > > > > > > > > > >
> > > > > > > > > > > Regards
> > > > > > > > > > >
> > > > > > > > > > > Simon
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi Hasan
> > > > > > > > >
> > > > > > > > > The change you suggest should cause a schema validation
> > error.
> > > > > > I made
> > > > > > > > the
> > > > > > > > > change locally in samples/calculator and see the following
> > > > > > output in
> > > > > > > > > stdout
> > > > > > > > >
> > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > > error
> > > > > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> > > > > > column: 5
> > > > > > > > > cvc-complex-type.2.4.a: Invalid content was found starting
> > > > > > with
> > > > > > > > element '
> > > > > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0
> > ":include,
> > > > > > "
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > > read
> > > > > > > > > WARNING: Element {
> > http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > > >
> > > > > > > > > No exception is raised though.
> > > > > > > > >
> > > > > > > > > Let me take a look at what has changed.
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > Ok, thanks for that Hasan. I see the change you are
> > referencing.
> > > > > > I'm not
> > > > > > > sure why the exception is no longer thrown. The code is still
> > in
> > > > > > the
> > > > > > > CompositeProcessor to trap the case but maybe the offending
> > > > > > element is
> > > > > > > removed from the stream because of the validation warning.
> > > > > > >
> > > > > > > I would argue that we shouldn't mandate that an exception is
> > > > > > thrown in
> > > > > > > this case but that the validation mechanism is opened up to
> > the
> > > > > > monitor API
> > > > > > > so that a monitor can be attached and those who are embedding
> > > > > > tuscany can
> > > > > > > decide how they want to deal with errors like this.
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > Hi
> > > > > >
> > > > > > I've just been through the original list again looking at what
> > > > > > happens with
> > > > > > validation types errors (by which I mean a workspace type admin
> > > > > > console
> > > > > > would reasonably want to display based on user input/changes).
> > This
> > > > > > is what
> > > > > > I found.
> > > > > >
> > > > > > - Contribution processing
> > > > > >   - dependency (imports/exports) analysis
> > > > > >
> > > > > >
> > > > > >
> > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > > - Composite read
> > > > > >   - schema compliance
> > > > > >
> > > > > >
> > > > > >
> > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > >      Uses writes to local JDK Logger
> > > > > >    - policy intent matching
> > > > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > > >      Throws exceptions
> > > > > >    - extension availability
> > > > > >     General artifact processor hierarchy
> > > > > >      Throws exceptions
> > > > > >   - SCA compliance, e.g. annotation correctness
> > > > > >     General artifact processor hierarchy
> > > > > >     Throws exceptions
> > > > > > - Composite resolve
> > > > > >   - ensure that artifacts required by the composite are
> > available
> > > > > >     General artifact resolver hierarchy
> > > > > >      Throws exceptions
> > > > > > - Composite build
> > > > > >   - ensure that the composite is valid and consistent, e.g.
> > unique
> > > > > > component names, valid reference targets etc.
> > > > > >
> > > > > >
> > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > > >      uses a CompositeBuilderMonitor
> > > > > >
> > > > > > I would like to look for a more consistent approach across these
> > > > > > various
> > > > > > elements of validation. The aim being to make it more obvious
> > how to
> > > > > > recognize validation type errors and act accordingly. There has
> > been
> > > > > > a
> > > > > > relatively lengthy debate about how to group and report errors
> > in
> > > > > > [1] which
> > > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > > administration
> > > > > > type scenarios where, for example,  A user may
> > > > > >
> > > > > > Add a contribution and be notified that contributions that it
> > > > > > depends on are
> > > > > > not available
> > > > > > Look at a composite and be notified that there are XML and/or
> > SCA
> > > > > > errors
> > > > > > etc.
> > > > > >
> > > > > > From [1] we want to capture as many errors as possible before
> > > > > > reporting back
> > > > > > to the user. Two things come immediately to mind.
> > > > > >
> > > > > > 1 - Pull up the Monitor API and make it more generic (and from
> > > > > > previous
> > > > > > comments here make it an extension point)
> > > > > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor
> > (or
> > > > > > at
> > > > > > least don't extend it further).
> > > > > >
> > > > > > I'm going to think some more about these options. Any thoughts
> > or
> > > > > > more
> > > > > > options?
> > > > > >
> > > > > > Simon
> > > > > >
> > > > > > [1]
> > > > > >
> > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
> Hi Hasan
>
> What do you mean in your question by "plugin". If you mean an Tuscany
> extension then I think we have that covered as each extension will ship with
> any bundles that it needs and stll the default monitor can be used.
>
> Here is the model I have in my head of this.
>
> runtime
>   monitor
>   module (there are many of these in the runtime)
>     resource bundle
>     raises problems - each problem references the name of a resource
> bundle for the modules in question (I don't believe I can get the name of
> the module automatically)
>
> So I'm anticipating that the runtime will create a single monitor but this
> is not a hard and fast rule.
>
> Each module/extension raises problems referencing the resource bundle that
> it contains. Hence the module provides messages appropriate to errors that
> it will raise. The resource bundle reference is by root name so there is not
> reason why the resource bundle couldn't be put somewhere else.
>
> If you want to change the default messages that are provided, as opposed
> to create a new extension with new messages, there are a number of options.
>
> - The source code approach - i.e. change the bundles  provided
> - Provide new bundles first on the classpath - I think they will get
> picked up in preference to the default ones but I would have to test it to
> see
> - We could reorganize the bundles so they are in their in their own
> separate jars. Then you would provide a replacement jar.
> - Add an API to the monitor to allow a bundle mapping to be specified. In
> this case though it seems easier to provide a new monitor implementation
> rather than providing a new API.
>
> There are probably more options so any thoughts are welcome. I'm currently
> working on getting the new monitor integrated into the existing modules
> (primarily assembly) so we will have something to try out. We can take a
> look at these options for real when I'm done.
>
> Simon
>

Hi

I've just checked in the changes to do the basic integration of the monitor
extension with the rest of the code base. Its a light touch end to end
integration at the moment. Here are some of the TODOs

- Move messages into resource bundles.
- Local monitors are still created in some places.
- If a monitor implementation is not found then a warning is raised but
execution continues so that I don't have to change the dependencies of the
many tests that now don't pull in a monitor but also don't raise any
warnings. May want to address this but It's OK for the time being.

Hopefully now the validation itests make more sense now. The test to look at
is the duplicate component name test. This is the only message I've moved
out into a resource bundle at the moment. Now I have the basics in I'll move
all the messages and do the tidying up.

 Also I've switched to using node instead of domain in the tests. I notice
we need to do some work on the constructor for this type of use. I'll work
on this too.

Regards

Simon

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Apr 17, 2008 at 5:02 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> We should have an api for plugins to provide a resource bundle. This api
> probably needs to be on the monitor or somewhere, i am not sure. But the
> scenario occurs when plugins want to use the default Monitor but still
> want
> to use their own resource bundle for messageIDs.
>
> regards
> Hasan
>
> On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I looked at the new Monitor and Problem interfaces. What do
> getMessageId()
> > and getMessageParams() actually return? is MessageId a way to categorize
> the
> > error message?
> >
> > regards
> > Hasan
> >
> >
> > On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> >
> > > Hi Simon,
> > >
> > > I was wondering if i can cook up some validation test cases if they do
> > > not exist. Or should we wait until the monitor issue is resolved ?
> > >
> > > Hasan
> > >
> > >
> > > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > I dont think using an underlying tuscany jdk logger would be useful
> to
> > > > plugins as they may not want to log, rather show it somewhere else
> such as
> > > > console etc. Tuscany can use an underlying logger in it's own
> monitor ( as
> > > > it uses today). But i think the first approach of using a monitor is
> better
> > > > along with the condition that it be made more usable by the plugins
> by
> > > > giving them greater control.
> > > >
> > > > Another point is that tuscany should use ResourceBundle for
> validation
> > > > messages as well. I dont think this is being done today.
> > > >
> > > > regards
> > > > Hasan
> > > >
> > > >
> > > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <
> simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <
> appaos@gmail.com>
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > I am on revision 634808. The ContributionServiceImpl has
> changed
> > > > > since
> > > > > > > then,
> > > > > > > and with the one that i have, it would lead through the
> > > > > > > CompositeProcessor
> > > > > > > instead of the CompositeDocumentProcessor. Hence the
> difference
> > > > > in
> > > > > > > exceptions..
> > > > > > >
> > > > > > > Also, dont you think that with the error that you got should
> > > > > throw an
> > > > > > > exception with schema validation, rather than just a warning?
> > > > > > >
> > > > > > > Hasan
> > > > > > >
> > > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Simon,
> > > > > > > > >
> > > > > > > > > Thank you for the good information. First up i am trying
> to
> > > > > verify
> > > > > > > > whether
> > > > > > > > > the schema validation works when we point to our schemas.
> > > > > Can you
> > > > > > > let me
> > > > > > > > > know what is a simple error that i can introduce so that i
> > > > > can
> > > > > > > verify
> > > > > > > > > this?
> > > > > > > > > I tried doing this to my composite file (In block red):
> > > > > > > > >
> > > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > > >    <implementation.java
> > > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > > >    *<binding.ws/>*
> > > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > > >  </component>
> > > > > > > > >
> > > > > > > > > This resulted in the following exception, but i think this
> > > > > is part
> > > > > > > of
> > > > > > > > the
> > > > > > > > > validation done by artifact processor and would result
> even
> > > > > if we
> > > > > > > > comment
> > > > > > > > > out the schema validation.
> > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > > Unexpected <binding> element found. It should appear
> inside
> > > > > a
> > > > > > > <service>
> > > > > > > > or
> > > > > > > > > <reference> element
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > > >    at
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > > >    at
> > > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > regards
> > > > > > > > >
> > > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > > simonslaws@googlemail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > > appaos@gmail.com>
> > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > Currently, i see that we have various places where we
> > > > > can plug
> > > > > > > in
> > > > > > > > > > > validation
> > > > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > > >
> > > > > > > > > > >    public static CompositeBuilder
> > > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > > assemblyFactory,
> > > > > > > > > > >
> > > > > > > > > >  SCABindingFactory
> > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > >
> > > > > > > > > > > IntentAttachPointTypeFactory
> > > > > intentAttachPointTypeFactory,
> > > > > > > > > > >
> > > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > > >
> > > > > > > > >  List<PolicySet>
> > > > > > > > > > > domainPolicySets) {
> > > > > > > > > > >        return new
> CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > > domainPolicySets,
> > > > > > > > > > > null);
> > > > > > > > > > >    }
> > > > > > > > > > >
> > > > > > > > > > >    public static DomainBuilder
> > > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > > assemblyFactory,
> > > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > > >            InterfaceContractMapper
> > > > > interfaceContractMapper,
> > > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > > >        return new
> DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > > scaBindingFactory,
> > > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > > domainPolicySets,
> > > > > > > > > > > null);
> > > > > > > > > > >    }
> > > > > > > > > > >
> > > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > > CompositeBuildMonitor.
> > > > > > > > > > Are
> > > > > > > > > > > these the only places where we need to do this? or are
> > > > > there
> > > > > > > other
> > > > > > > > > > places
> > > > > > > > > > > as
> > > > > > > > > > > well?
> > > > > > > > > > >
> > > > > > > > > > > Hasan
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Hi Hasan
> > > > > > > > > >
> > > > > > > > > > There are a few places that logically we need to be able
> > > > > to
> > > > > > > validate
> > > > > > > > > input
> > > > > > > > > > and hence add monitors. The story is changing a little
> as
> > > > > we are
> > > > > > > > moving
> > > > > > > > > > toward the new "workspace"  code for managing
> > > > > contributions but
> > > > > > > > > logically
> > > > > > > > > > I
> > > > > > > > > > would expect to be running validating on at least the
> > > > > following
> > > > > > > > > >
> > > > > > > > > > - Contribution processing
> > > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > > - Composite read
> > > > > > > > > >   - schema compliance
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > > - only appears to be initialized in
> > > > > ReallySmallRuntimeBuilder so
> > > > > > > need
> > > > > > > > to
> > > > > > > > > > look at this in context of workspace]
> > > > > > > > > >   - policy intent matching
> > > > > > > > > >
> > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > > >   - extension availability [General artifact processor
> > > > > hierarchy]
> > > > > > > > > > - Composite resolve
> > > > > > > > > >   - ensure that artifacts required by the composite are
> > > > > available
> > > > > > > > > [General
> > > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > > - Composite build
> > > > > > > > > >   - ensure that the composite is valid and consistent,
> > > > > e.g. unique
> > > > > > > > > > component names, valid reference targets etc.
> > > > > > > > > >
> > > > > > >
> > > > >
> [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > > >
> > > > > > > > > > I've noted in the square brackets where this function
> > > > > currently
> > > > > > > is.
> > > > > > > > Note
> > > > > > > > > > also that I'm making no comment here about whether the
> > > > > > > construction of
> > > > > > > > > the
> > > > > > > > > > in-memory composite model is for use purely for
> > > > > contribution
> > > > > > > > processing
> > > > > > > > > or
> > > > > > > > > > is going to activated and started in a runtime. This
> > > > > validation is
> > > > > > > > > > appropriate in both cases although you may choose to use
> > > > > different
> > > > > > > > > > monitors
> > > > > > > > > > in the two cases.
> > > > > > > > > >
> > > > > > > > > > So what I suggest as a first step is that you go ahead
> and
> > > > > change
> > > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > > CompositeBuilderImpl
> > > > > > > > to
> > > > > > > > > > see
> > > > > > > > > > how it works. We can work here to build a consistent
> view
> > > > > of
> > > > > > > > > >
> > > > > > > > > > - all the places a monitor is required
> > > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > > >
> > > > > > > > > > I'm going to try a few experiments too to familiarize
> > > > > myself with
> > > > > > > this
> > > > > > > > a
> > > > > > > > > > bit
> > > > > > > > > > more.
> > > > > > > > > >
> > > > > > > > > > Regards
> > > > > > > > > >
> > > > > > > > > > Simon
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > > Hi Hasan
> > > > > > > >
> > > > > > > > The change you suggest should cause a schema validation
> error.
> > > > > I made
> > > > > > > the
> > > > > > > > change locally in samples/calculator and see the following
> > > > > output in
> > > > > > > > stdout
> > > > > > > >
> > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > > error
> > > > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> > > > > column: 5
> > > > > > > > cvc-complex-type.2.4.a: Invalid content was found starting
> > > > > with
> > > > > > > element '
> > > > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0
> ":include,
> > > > > "
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > > 08-Apr-2008 22:41:54
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > > read
> > > > > > > > WARNING: Element {
> http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > > >
> > > > > > > > No exception is raised though.
> > > > > > > >
> > > > > > > > Let me take a look at what has changed.
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > > Ok, thanks for that Hasan. I see the change you are referencing.
> > > > > I'm not
> > > > > > sure why the exception is no longer thrown. The code is still in
> > > > > the
> > > > > > CompositeProcessor to trap the case but maybe the offending
> > > > > element is
> > > > > > removed from the stream because of the validation warning.
> > > > > >
> > > > > > I would argue that we shouldn't mandate that an exception is
> > > > > thrown in
> > > > > > this case but that the validation mechanism is opened up to the
> > > > > monitor API
> > > > > > so that a monitor can be attached and those who are embedding
> > > > > tuscany can
> > > > > > decide how they want to deal with errors like this.
> > > > > >
> > > > > > Simon
> > > > > >
> > > > > >
> > > > > >
> > > > > Hi
> > > > >
> > > > > I've just been through the original list again looking at what
> > > > > happens with
> > > > > validation types errors (by which I mean a workspace type admin
> > > > > console
> > > > > would reasonably want to display based on user input/changes).
> This
> > > > > is what
> > > > > I found.
> > > > >
> > > > > - Contribution processing
> > > > >   - dependency (imports/exports) analysis
> > > > >
> > > > >
> > > > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > > >      uses a ContributionDependencyBuilderMonitor
> > > > > - Composite read
> > > > >   - schema compliance
> > > > >
> > > > >
> > > > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > >      Uses writes to local JDK Logger
> > > > >    - policy intent matching
> > > > >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > > >      Throws exceptions
> > > > >    - extension availability
> > > > >     General artifact processor hierarchy
> > > > >      Throws exceptions
> > > > >   - SCA compliance, e.g. annotation correctness
> > > > >     General artifact processor hierarchy
> > > > >     Throws exceptions
> > > > > - Composite resolve
> > > > >   - ensure that artifacts required by the composite are available
> > > > >     General artifact resolver hierarchy
> > > > >      Throws exceptions
> > > > > - Composite build
> > > > >   - ensure that the composite is valid and consistent, e.g. unique
> > > > > component names, valid reference targets etc.
> > > > >
> > > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > > >      uses a CompositeBuilderMonitor
> > > > >
> > > > > I would like to look for a more consistent approach across these
> > > > > various
> > > > > elements of validation. The aim being to make it more obvious how
> to
> > > > > recognize validation type errors and act accordingly. There has
> been
> > > > > a
> > > > > relatively lengthy debate about how to group and report errors in
> > > > > [1] which
> > > > > is worth a read. The scenarios I have in mind are workspace
> > > > > administration
> > > > > type scenarios where, for example,  A user may
> > > > >
> > > > > Add a contribution and be notified that contributions that it
> > > > > depends on are
> > > > > not available
> > > > > Look at a composite and be notified that there are XML and/or SCA
> > > > > errors
> > > > > etc.
> > > > >
> > > > > From [1] we want to capture as many errors as possible before
> > > > > reporting back
> > > > > to the user. Two things come immediately to mind.
> > > > >
> > > > > 1 - Pull up the Monitor API and make it more generic (and from
> > > > > previous
> > > > > comments here make it an extension point)
> > > > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor
> (or
> > > > > at
> > > > > least don't extend it further).
> > > > >
> > > > > I'm going to think some more about these options. Any thoughts or
> > > > > more
> > > > > options?
> > > > >
> > > > > Simon
> > > > >
> > > > > [1]
> > > > >
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > > >
> > > >
> > > >
> > >
> >
>

Hi Hasan

What do you mean in your question by "plugin". If you mean an Tuscany
extension then I think we have that covered as each extension will ship with
any bundles that it needs and stll the default monitor can be used.

Here is the model I have in my head of this.

runtime
  monitor
  module (there are many of these in the runtime)
    resource bundle
    raises problems - each problem references the name of a resource bundle
for the modules in question (I don't believe I can get the name of the
module automatically)

So I'm anticipating that the runtime will create a single monitor but this
is not a hard and fast rule.

Each module/extension raises problems referencing the resource bundle that
it contains. Hence the module provides messages appropriate to errors that
it will raise. The resource bundle reference is by root name so there is not
reason why the resource bundle couldn't be put somewhere else.

If you want to change the default messages that are provided, as opposed to
create a new extension with new messages, there are a number of options.

- The source code approach - i.e. change the bundles  provided
- Provide new bundles first on the classpath - I think they will get picked
up in preference to the default ones but I would have to test it to see
- We could reorganize the bundles so they are in their in their own separate
jars. Then you would provide a replacement jar.
- Add an API to the monitor to allow a bundle mapping to be specified. In
this case though it seems easier to provide a new monitor implementation
rather than providing a new API.

There are probably more options so any thoughts are welcome. I'm currently
working on getting the new monitor integrated into the existing modules
(primarily assembly) so we will have something to try out. We can take a
look at these options for real when I'm done.

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

We should have an api for plugins to provide a resource bundle. This api
probably needs to be on the monitor or somewhere, i am not sure. But the
scenario occurs when plugins want to use the default Monitor but still want
to use their own resource bundle for messageIDs.

regards
Hasan

On Wed, Apr 16, 2008 at 3:30 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I looked at the new Monitor and Problem interfaces. What do getMessageId()
> and getMessageParams() actually return? is MessageId a way to categorize the
> error message?
>
> regards
> Hasan
>
>
> On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I was wondering if i can cook up some validation test cases if they do
> > not exist. Or should we wait until the monitor issue is resolved ?
> >
> > Hasan
> >
> >
> > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> >
> > > Hi Simon,
> > >
> > > I dont think using an underlying tuscany jdk logger would be useful to
> > > plugins as they may not want to log, rather show it somewhere else such as
> > > console etc. Tuscany can use an underlying logger in it's own monitor ( as
> > > it uses today). But i think the first approach of using a monitor is better
> > > along with the condition that it be made more usable by the plugins by
> > > giving them greater control.
> > >
> > > Another point is that tuscany should use ResourceBundle for validation
> > > messages as well. I dont think this is being done today.
> > >
> > > regards
> > > Hasan
> > >
> > >
> > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
> > > wrote:
> > >
> > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I am on revision 634808. The ContributionServiceImpl has changed
> > > > since
> > > > > > then,
> > > > > > and with the one that i have, it would lead through the
> > > > > > CompositeProcessor
> > > > > > instead of the CompositeDocumentProcessor. Hence the difference
> > > > in
> > > > > > exceptions..
> > > > > >
> > > > > > Also, dont you think that with the error that you got should
> > > > throw an
> > > > > > exception with schema validation, rather than just a warning?
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > Thank you for the good information. First up i am trying to
> > > > verify
> > > > > > > whether
> > > > > > > > the schema validation works when we point to our schemas.
> > > > Can you
> > > > > > let me
> > > > > > > > know what is a simple error that i can introduce so that i
> > > > can
> > > > > > verify
> > > > > > > > this?
> > > > > > > > I tried doing this to my composite file (In block red):
> > > > > > > >
> > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > >    <implementation.java
> > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > >    *<binding.ws/>*
> > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > >  </component>
> > > > > > > >
> > > > > > > > This resulted in the following exception, but i think this
> > > > is part
> > > > > > of
> > > > > > > the
> > > > > > > > validation done by artifact processor and would result even
> > > > if we
> > > > > > > comment
> > > > > > > > out the schema validation.
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > Unexpected <binding> element found. It should appear inside
> > > > a
> > > > > > <service>
> > > > > > > or
> > > > > > > > <reference> element
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > >    at
> > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > >
> > > > > > > >
> > > > > > > > regards
> > > > > > > >
> > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Currently, i see that we have various places where we
> > > > can plug
> > > > > > in
> > > > > > > > > > validation
> > > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > >
> > > > > > > > > >    public static CompositeBuilder
> > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > assemblyFactory,
> > > > > > > > > >
> > > > > > > > >  SCABindingFactory
> > > > > > > > > > scaBindingFactory,
> > > > > > > > > >
> > > > > > > > > > IntentAttachPointTypeFactory
> > > > intentAttachPointTypeFactory,
> > > > > > > > > >
> > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > >
> > > > > > > >  List<PolicySet>
> > > > > > > > > > domainPolicySets) {
> > > > > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > scaBindingFactory,
> > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > domainPolicySets,
> > > > > > > > > > null);
> > > > > > > > > >    }
> > > > > > > > > >
> > > > > > > > > >    public static DomainBuilder
> > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > assemblyFactory,
> > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > >            InterfaceContractMapper
> > > > interfaceContractMapper,
> > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > scaBindingFactory,
> > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > domainPolicySets,
> > > > > > > > > > null);
> > > > > > > > > >    }
> > > > > > > > > >
> > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > CompositeBuildMonitor.
> > > > > > > > > Are
> > > > > > > > > > these the only places where we need to do this? or are
> > > > there
> > > > > > other
> > > > > > > > > places
> > > > > > > > > > as
> > > > > > > > > > well?
> > > > > > > > > >
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi Hasan
> > > > > > > > >
> > > > > > > > > There are a few places that logically we need to be able
> > > > to
> > > > > > validate
> > > > > > > > input
> > > > > > > > > and hence add monitors. The story is changing a little as
> > > > we are
> > > > > > > moving
> > > > > > > > > toward the new "workspace"  code for managing
> > > > contributions but
> > > > > > > > logically
> > > > > > > > > I
> > > > > > > > > would expect to be running validating on at least the
> > > > following
> > > > > > > > >
> > > > > > > > > - Contribution processing
> > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > - Composite read
> > > > > > > > >   - schema compliance
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > - only appears to be initialized in
> > > > ReallySmallRuntimeBuilder so
> > > > > > need
> > > > > > > to
> > > > > > > > > look at this in context of workspace]
> > > > > > > > >   - policy intent matching
> > > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > >   - extension availability [General artifact processor
> > > > hierarchy]
> > > > > > > > > - Composite resolve
> > > > > > > > >   - ensure that artifacts required by the composite are
> > > > available
> > > > > > > > [General
> > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > - Composite build
> > > > > > > > >   - ensure that the composite is valid and consistent,
> > > > e.g. unique
> > > > > > > > > component names, valid reference targets etc.
> > > > > > > > >
> > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > >
> > > > > > > > > I've noted in the square brackets where this function
> > > > currently
> > > > > > is.
> > > > > > > Note
> > > > > > > > > also that I'm making no comment here about whether the
> > > > > > construction of
> > > > > > > > the
> > > > > > > > > in-memory composite model is for use purely for
> > > > contribution
> > > > > > > processing
> > > > > > > > or
> > > > > > > > > is going to activated and started in a runtime. This
> > > > validation is
> > > > > > > > > appropriate in both cases although you may choose to use
> > > > different
> > > > > > > > > monitors
> > > > > > > > > in the two cases.
> > > > > > > > >
> > > > > > > > > So what I suggest as a first step is that you go ahead and
> > > > change
> > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > CompositeBuilderImpl
> > > > > > > to
> > > > > > > > > see
> > > > > > > > > how it works. We can work here to build a consistent view
> > > > of
> > > > > > > > >
> > > > > > > > > - all the places a monitor is required
> > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > >
> > > > > > > > > I'm going to try a few experiments too to familiarize
> > > > myself with
> > > > > > this
> > > > > > > a
> > > > > > > > > bit
> > > > > > > > > more.
> > > > > > > > >
> > > > > > > > > Regards
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > Hi Hasan
> > > > > > >
> > > > > > > The change you suggest should cause a schema validation error.
> > > > I made
> > > > > > the
> > > > > > > change locally in samples/calculator and see the following
> > > > output in
> > > > > > > stdout
> > > > > > >
> > > > > > > 08-Apr-2008 22:41:54
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > error
> > > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> > > > column: 5
> > > > > > > cvc-complex-type.2.4.a: Invalid content was found starting
> > > > with
> > > > > > element '
> > > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include,
> > > > "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > 08-Apr-2008 22:41:54
> > > > > > >
> > > > > > >
> > > > > >
> > > > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > read
> > > > > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > >
> > > > > > > No exception is raised though.
> > > > > > >
> > > > > > > Let me take a look at what has changed.
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > >
> > > > >
> > > > > Ok, thanks for that Hasan. I see the change you are referencing.
> > > > I'm not
> > > > > sure why the exception is no longer thrown. The code is still in
> > > > the
> > > > > CompositeProcessor to trap the case but maybe the offending
> > > > element is
> > > > > removed from the stream because of the validation warning.
> > > > >
> > > > > I would argue that we shouldn't mandate that an exception is
> > > > thrown in
> > > > > this case but that the validation mechanism is opened up to the
> > > > monitor API
> > > > > so that a monitor can be attached and those who are embedding
> > > > tuscany can
> > > > > decide how they want to deal with errors like this.
> > > > >
> > > > > Simon
> > > > >
> > > > >
> > > > >
> > > > Hi
> > > >
> > > > I've just been through the original list again looking at what
> > > > happens with
> > > > validation types errors (by which I mean a workspace type admin
> > > > console
> > > > would reasonably want to display based on user input/changes). This
> > > > is what
> > > > I found.
> > > >
> > > > - Contribution processing
> > > >   - dependency (imports/exports) analysis
> > > >
> > > >
> > > > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > >      uses a ContributionDependencyBuilderMonitor
> > > > - Composite read
> > > >   - schema compliance
> > > >
> > > >
> > > > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > >      Uses writes to local JDK Logger
> > > >    - policy intent matching
> > > >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > >      Throws exceptions
> > > >    - extension availability
> > > >     General artifact processor hierarchy
> > > >      Throws exceptions
> > > >   - SCA compliance, e.g. annotation correctness
> > > >     General artifact processor hierarchy
> > > >     Throws exceptions
> > > > - Composite resolve
> > > >   - ensure that artifacts required by the composite are available
> > > >     General artifact resolver hierarchy
> > > >      Throws exceptions
> > > > - Composite build
> > > >   - ensure that the composite is valid and consistent, e.g. unique
> > > > component names, valid reference targets etc.
> > > >
> > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > >      uses a CompositeBuilderMonitor
> > > >
> > > > I would like to look for a more consistent approach across these
> > > > various
> > > > elements of validation. The aim being to make it more obvious how to
> > > > recognize validation type errors and act accordingly. There has been
> > > > a
> > > > relatively lengthy debate about how to group and report errors in
> > > > [1] which
> > > > is worth a read. The scenarios I have in mind are workspace
> > > > administration
> > > > type scenarios where, for example,  A user may
> > > >
> > > > Add a contribution and be notified that contributions that it
> > > > depends on are
> > > > not available
> > > > Look at a composite and be notified that there are XML and/or SCA
> > > > errors
> > > > etc.
> > > >
> > > > From [1] we want to capture as many errors as possible before
> > > > reporting back
> > > > to the user. Two things come immediately to mind.
> > > >
> > > > 1 - Pull up the Monitor API and make it more generic (and from
> > > > previous
> > > > comments here make it an extension point)
> > > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or
> > > > at
> > > > least don't extend it further).
> > > >
> > > > I'm going to think some more about these options. Any thoughts or
> > > > more
> > > > options?
> > > >
> > > > Simon
> > > >
> > > > [1]
> > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > >
> > >
> > >
> >
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Apr 16, 2008 at 8:30 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I looked at the new Monitor and Problem interfaces. What do getMessageId()
> and getMessageParams() actually return? is MessageId a way to categorize
> the
> error message?
>
> regards
> Hasan
>
> On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I was wondering if i can cook up some validation test cases if they do
> not
> > exist. Or should we wait until the monitor issue is resolved ?
> >
> > Hasan
> >
> >
> > On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> >
> > > Hi Simon,
> > >
> > > I dont think using an underlying tuscany jdk logger would be useful to
> > > plugins as they may not want to log, rather show it somewhere else
> such as
> > > console etc. Tuscany can use an underlying logger in it's own monitor
> ( as
> > > it uses today). But i think the first approach of using a monitor is
> better
> > > along with the condition that it be made more usable by the plugins by
> > > giving them greater control.
> > >
> > > Another point is that tuscany should use ResourceBundle for validation
> > > messages as well. I dont think this is being done today.
> > >
> > > regards
> > > Hasan
> > >
> > >
> > > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
> > > wrote:
> > >
> > > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <
> simonslaws@googlemail.com
> > > > >
> > > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > I am on revision 634808. The ContributionServiceImpl has changed
> > > > since
> > > > > > then,
> > > > > > and with the one that i have, it would lead through the
> > > > > > CompositeProcessor
> > > > > > instead of the CompositeDocumentProcessor. Hence the difference
> in
> > > > > > exceptions..
> > > > > >
> > > > > > Also, dont you think that with the error that you got should
> throw
> > > > an
> > > > > > exception with schema validation, rather than just a warning?
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <
> appaos@gmail.com
> > > > >
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Simon,
> > > > > > > >
> > > > > > > > Thank you for the good information. First up i am trying to
> > > > verify
> > > > > > > whether
> > > > > > > > the schema validation works when we point to our schemas.
> Can
> > > > you
> > > > > > let me
> > > > > > > > know what is a simple error that i can introduce so that i
> can
> > > > > > verify
> > > > > > > > this?
> > > > > > > > I tried doing this to my composite file (In block red):
> > > > > > > >
> > > > > > > >  <component name="MyServiceComponentNew">
> > > > > > > >    <implementation.java
> > > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > > >    *<binding.ws/>*
> > > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > > >    <property name="year" source="$newYear"/>
> > > > > > > >  </component>
> > > > > > > >
> > > > > > > > This resulted in the following exception, but i think this
> is
> > > > part
> > > > > > of
> > > > > > > the
> > > > > > > > validation done by artifact processor and would result even
> if
> > > > we
> > > > > > > comment
> > > > > > > > out the schema validation.
> > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > > Unexpected <binding> element found. It should appear inside
> a
> > > > > > <service>
> > > > > > > or
> > > > > > > > <reference> element
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > > >    at
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > > >    at
> > > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > > >
> > > > > > > >
> > > > > > > > regards
> > > > > > > >
> > > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > > simonslaws@googlemail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > > appaos@gmail.com>
> > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Currently, i see that we have various places where we
> can
> > > > plug
> > > > > > in
> > > > > > > > > > validation
> > > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > > >
> > > > > > > > > >    public static CompositeBuilder
> > > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > > assemblyFactory,
> > > > > > > > > >
> > > > > > > > >  SCABindingFactory
> > > > > > > > > > scaBindingFactory,
> > > > > > > > > >
> > > > > > > > > > IntentAttachPointTypeFactory
> intentAttachPointTypeFactory,
> > > > > > > > > >
> > > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > > >
> > > > > > > >  List<PolicySet>
> > > > > > > > > > domainPolicySets) {
> > > > > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > > > > scaBindingFactory,
> > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > domainPolicySets,
> > > > > > > > > > null);
> > > > > > > > > >    }
> > > > > > > > > >
> > > > > > > > > >    public static DomainBuilder
> > > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > > assemblyFactory,
> > > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > > intentAttachPointTypeFactory,
> > > > > > > > > >            InterfaceContractMapper
> > > > interfaceContractMapper,
> > > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > > scaBindingFactory,
> > > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > > domainPolicySets,
> > > > > > > > > > null);
> > > > > > > > > >    }
> > > > > > > > > >
> > > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > > CompositeBuildMonitor.
> > > > > > > > > Are
> > > > > > > > > > these the only places where we need to do this? or are
> > > > there
> > > > > > other
> > > > > > > > > places
> > > > > > > > > > as
> > > > > > > > > > well?
> > > > > > > > > >
> > > > > > > > > > Hasan
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Hi Hasan
> > > > > > > > >
> > > > > > > > > There are a few places that logically we need to be able
> to
> > > > > > validate
> > > > > > > > input
> > > > > > > > > and hence add monitors. The story is changing a little as
> we
> > > > are
> > > > > > > moving
> > > > > > > > > toward the new "workspace"  code for managing
> contributions
> > > > but
> > > > > > > > logically
> > > > > > > > > I
> > > > > > > > > would expect to be running validating on at least the
> > > > following
> > > > > > > > >
> > > > > > > > > - Contribution processing
> > > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > > - Composite read
> > > > > > > > >   - schema compliance
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > > - only appears to be initialized in
> > > > ReallySmallRuntimeBuilder so
> > > > > > need
> > > > > > > to
> > > > > > > > > look at this in context of workspace]
> > > > > > > > >   - policy intent matching
> > > > > > > > >
> > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > > >   - extension availability [General artifact processor
> > > > hierarchy]
> > > > > > > > > - Composite resolve
> > > > > > > > >   - ensure that artifacts required by the composite are
> > > > available
> > > > > > > > [General
> > > > > > > > > artifact resolver hierarchy]
> > > > > > > > > - Composite build
> > > > > > > > >   - ensure that the composite is valid and consistent,
> e.g.
> > > > unique
> > > > > > > > > component names, valid reference targets etc.
> > > > > > > > >
> > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > > >
> > > > > > > > > I've noted in the square brackets where this function
> > > > currently
> > > > > > is.
> > > > > > > Note
> > > > > > > > > also that I'm making no comment here about whether the
> > > > > > construction of
> > > > > > > > the
> > > > > > > > > in-memory composite model is for use purely for
> contribution
> > > > > > > processing
> > > > > > > > or
> > > > > > > > > is going to activated and started in a runtime. This
> > > > validation is
> > > > > > > > > appropriate in both cases although you may choose to use
> > > > different
> > > > > > > > > monitors
> > > > > > > > > in the two cases.
> > > > > > > > >
> > > > > > > > > So what I suggest as a first step is that you go ahead and
> > > > change
> > > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > > CompositeBuilderImpl
> > > > > > > to
> > > > > > > > > see
> > > > > > > > > how it works. We can work here to build a consistent view
> of
> > > > > > > > >
> > > > > > > > > - all the places a monitor is required
> > > > > > > > > - what should the plugin model for monitors be
> > > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > > >
> > > > > > > > > I'm going to try a few experiments too to familiarize
> myself
> > > > with
> > > > > > this
> > > > > > > a
> > > > > > > > > bit
> > > > > > > > > more.
> > > > > > > > >
> > > > > > > > > Regards
> > > > > > > > >
> > > > > > > > > Simon
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > Hi Hasan
> > > > > > >
> > > > > > > The change you suggest should cause a schema validation error.
> I
> > > > made
> > > > > > the
> > > > > > > change locally in samples/calculator and see the following
> > > > output in
> > > > > > > stdout
> > > > > > >
> > > > > > > 08-Apr-2008 22:41:54
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > > error
> > > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> > > > column: 5
> > > > > > > cvc-complex-type.2.4.a: Invalid content was found starting
> with
> > > > > > element '
> > > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0
> ":include,
> > > > "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > > 08-Apr-2008 22:41:54
> > > > > > >
> > > > > > >
> > > > > >
> > > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > > read
> > > > > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > > >
> > > > > > > No exception is raised though.
> > > > > > >
> > > > > > > Let me take a look at what has changed.
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > >
> > > > >
> > > > > Ok, thanks for that Hasan. I see the change you are referencing.
> I'm
> > > > not
> > > > > sure why the exception is no longer thrown. The code is still in
> the
> > > > > CompositeProcessor to trap the case but maybe the offending
> element
> > > > is
> > > > > removed from the stream because of the validation warning.
> > > > >
> > > > > I would argue that we shouldn't mandate that an exception is
> thrown
> > > > in
> > > > > this case but that the validation mechanism is opened up to the
> > > > monitor API
> > > > > so that a monitor can be attached and those who are embedding
> > > > tuscany can
> > > > > decide how they want to deal with errors like this.
> > > > >
> > > > > Simon
> > > > >
> > > > >
> > > > >
> > > > Hi
> > > >
> > > > I've just been through the original list again looking at what
> happens
> > > > with
> > > > validation types errors (by which I mean a workspace type admin
> > > > console
> > > > would reasonably want to display based on user input/changes). This
> is
> > > > what
> > > > I found.
> > > >
> > > > - Contribution processing
> > > >   - dependency (imports/exports) analysis
> > > >
> > > >
> > > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > > >      uses a ContributionDependencyBuilderMonitor
> > > > - Composite read
> > > >   - schema compliance
> > > >
> > > >
> > > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > >      Uses writes to local JDK Logger
> > > >    - policy intent matching
> > > >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > > >      Throws exceptions
> > > >    - extension availability
> > > >     General artifact processor hierarchy
> > > >      Throws exceptions
> > > >   - SCA compliance, e.g. annotation correctness
> > > >     General artifact processor hierarchy
> > > >     Throws exceptions
> > > > - Composite resolve
> > > >   - ensure that artifacts required by the composite are available
> > > >     General artifact resolver hierarchy
> > > >      Throws exceptions
> > > > - Composite build
> > > >   - ensure that the composite is valid and consistent, e.g. unique
> > > > component names, valid reference targets etc.
> > > >
> org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > > >      uses a CompositeBuilderMonitor
> > > >
> > > > I would like to look for a more consistent approach across these
> > > > various
> > > > elements of validation. The aim being to make it more obvious how to
> > > > recognize validation type errors and act accordingly. There has been
> a
> > > > relatively lengthy debate about how to group and report errors in
> [1]
> > > > which
> > > > is worth a read. The scenarios I have in mind are workspace
> > > > administration
> > > > type scenarios where, for example,  A user may
> > > >
> > > > Add a contribution and be notified that contributions that it
> depends
> > > > on are
> > > > not available
> > > > Look at a composite and be notified that there are XML and/or SCA
> > > > errors
> > > > etc.
> > > >
> > > > From [1] we want to capture as many errors as possible before
> > > > reporting back
> > > > to the user. Two things come immediately to mind.
> > > >
> > > > 1 - Pull up the Monitor API and make it more generic (and from
> > > > previous
> > > > comments here make it an extension point)
> > > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or
> > > > at
> > > > least don't extend it further).
> > > >
> > > > I'm going to think some more about these options. Any thoughts or
> more
> > > > options?
> > > >
> > > > Simon
> > > >
> > > > [1]
> > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > > >
> > >
> > >
> >
>
Hi Hasan

MessageId is the id used to look up a message in the specified resource
bundle.
MessageParams is an array of parameters that is used to populate variables
in the message retrieved from the message bundle

Regards

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

I looked at the new Monitor and Problem interfaces. What do getMessageId()
and getMessageParams() actually return? is MessageId a way to categorize the
error message?

regards
Hasan

On Tue, Apr 15, 2008 at 10:59 AM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I was wondering if i can cook up some validation test cases if they do not
> exist. Or should we wait until the monitor issue is resolved ?
>
> Hasan
>
>
> On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I dont think using an underlying tuscany jdk logger would be useful to
> > plugins as they may not want to log, rather show it somewhere else such as
> > console etc. Tuscany can use an underlying logger in it's own monitor ( as
> > it uses today). But i think the first approach of using a monitor is better
> > along with the condition that it be made more usable by the plugins by
> > giving them greater control.
> >
> > Another point is that tuscany should use ResourceBundle for validation
> > messages as well. I dont think this is being done today.
> >
> > regards
> > Hasan
> >
> >
> > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <simonslaws@googlemail.com
> > > >
> > > wrote:
> > >
> > > >
> > > >
> > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I am on revision 634808. The ContributionServiceImpl has changed
> > > since
> > > > > then,
> > > > > and with the one that i have, it would lead through the
> > > > > CompositeProcessor
> > > > > instead of the CompositeDocumentProcessor. Hence the difference in
> > > > > exceptions..
> > > > >
> > > > > Also, dont you think that with the error that you got should throw
> > > an
> > > > > exception with schema validation, rather than just a warning?
> > > > >
> > > > > Hasan
> > > > >
> > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <appaos@gmail.com
> > > >
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > Thank you for the good information. First up i am trying to
> > > verify
> > > > > > whether
> > > > > > > the schema validation works when we point to our schemas. Can
> > > you
> > > > > let me
> > > > > > > know what is a simple error that i can introduce so that i can
> > > > > verify
> > > > > > > this?
> > > > > > > I tried doing this to my composite file (In block red):
> > > > > > >
> > > > > > >  <component name="MyServiceComponentNew">
> > > > > > >    <implementation.java
> > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > >    *<binding.ws/>*
> > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > >    <property name="year" source="$newYear"/>
> > > > > > >  </component>
> > > > > > >
> > > > > > > This resulted in the following exception, but i think this is
> > > part
> > > > > of
> > > > > > the
> > > > > > > validation done by artifact processor and would result even if
> > > we
> > > > > > comment
> > > > > > > out the schema validation.
> > > > > > >
> > > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > Unexpected <binding> element found. It should appear inside a
> > > > > <service>
> > > > > > or
> > > > > > > <reference> element
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > >    at
> > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > >
> > > > > > >
> > > > > > > regards
> > > > > > >
> > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > wrote:
> > > > > > > >
> > > > > > > > > Currently, i see that we have various places where we can
> > > plug
> > > > > in
> > > > > > > > > validation
> > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > >
> > > > > > > > >    public static CompositeBuilder
> > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > assemblyFactory,
> > > > > > > > >
> > > > > > > >  SCABindingFactory
> > > > > > > > > scaBindingFactory,
> > > > > > > > >
> > > > > > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > > > > > >
> > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > >
> > > > > > >  List<PolicySet>
> > > > > > > > > domainPolicySets) {
> > > > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > > > scaBindingFactory,
> > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > domainPolicySets,
> > > > > > > > > null);
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > > >    public static DomainBuilder
> > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > assemblyFactory,
> > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > intentAttachPointTypeFactory,
> > > > > > > > >            InterfaceContractMapper
> > > interfaceContractMapper,
> > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > scaBindingFactory,
> > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > domainPolicySets,
> > > > > > > > > null);
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > CompositeBuildMonitor.
> > > > > > > > Are
> > > > > > > > > these the only places where we need to do this? or are
> > > there
> > > > > other
> > > > > > > > places
> > > > > > > > > as
> > > > > > > > > well?
> > > > > > > > >
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > >
> > > > > > > > Hi Hasan
> > > > > > > >
> > > > > > > > There are a few places that logically we need to be able to
> > > > > validate
> > > > > > > input
> > > > > > > > and hence add monitors. The story is changing a little as we
> > > are
> > > > > > moving
> > > > > > > > toward the new "workspace"  code for managing contributions
> > > but
> > > > > > > logically
> > > > > > > > I
> > > > > > > > would expect to be running validating on at least the
> > > following
> > > > > > > >
> > > > > > > > - Contribution processing
> > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > - Composite read
> > > > > > > >   - schema compliance
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > - only appears to be initialized in
> > > ReallySmallRuntimeBuilder so
> > > > > need
> > > > > > to
> > > > > > > > look at this in context of workspace]
> > > > > > > >   - policy intent matching
> > > > > > > >
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > >   - extension availability [General artifact processor
> > > hierarchy]
> > > > > > > > - Composite resolve
> > > > > > > >   - ensure that artifacts required by the composite are
> > > available
> > > > > > > [General
> > > > > > > > artifact resolver hierarchy]
> > > > > > > > - Composite build
> > > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > unique
> > > > > > > > component names, valid reference targets etc.
> > > > > > > >
> > > > >
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > >
> > > > > > > > I've noted in the square brackets where this function
> > > currently
> > > > > is.
> > > > > > Note
> > > > > > > > also that I'm making no comment here about whether the
> > > > > construction of
> > > > > > > the
> > > > > > > > in-memory composite model is for use purely for contribution
> > > > > > processing
> > > > > > > or
> > > > > > > > is going to activated and started in a runtime. This
> > > validation is
> > > > > > > > appropriate in both cases although you may choose to use
> > > different
> > > > > > > > monitors
> > > > > > > > in the two cases.
> > > > > > > >
> > > > > > > > So what I suggest as a first step is that you go ahead and
> > > change
> > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > CompositeBuilderImpl
> > > > > > to
> > > > > > > > see
> > > > > > > > how it works. We can work here to build a consistent view of
> > > > > > > >
> > > > > > > > - all the places a monitor is required
> > > > > > > > - what should the plugin model for monitors be
> > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > >
> > > > > > > > I'm going to try a few experiments too to familiarize myself
> > > with
> > > > > this
> > > > > > a
> > > > > > > > bit
> > > > > > > > more.
> > > > > > > >
> > > > > > > > Regards
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > > Hi Hasan
> > > > > >
> > > > > > The change you suggest should cause a schema validation error. I
> > > made
> > > > > the
> > > > > > change locally in samples/calculator and see the following
> > > output in
> > > > > > stdout
> > > > > >
> > > > > > 08-Apr-2008 22:41:54
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > error
> > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> > > column: 5
> > > > > > cvc-complex-type.2.4.a: Invalid content was found starting with
> > > > > element '
> > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include,
> > > "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > 08-Apr-2008 22:41:54
> > > > > >
> > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > read
> > > > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > >
> > > > > > No exception is raised though.
> > > > > >
> > > > > > Let me take a look at what has changed.
> > > > > >
> > > > > > Simon
> > > > > >
> > > > >
> > > >
> > > > Ok, thanks for that Hasan. I see the change you are referencing. I'm
> > > not
> > > > sure why the exception is no longer thrown. The code is still in the
> > > > CompositeProcessor to trap the case but maybe the offending element
> > > is
> > > > removed from the stream because of the validation warning.
> > > >
> > > > I would argue that we shouldn't mandate that an exception is thrown
> > > in
> > > > this case but that the validation mechanism is opened up to the
> > > monitor API
> > > > so that a monitor can be attached and those who are embedding
> > > tuscany can
> > > > decide how they want to deal with errors like this.
> > > >
> > > > Simon
> > > >
> > > >
> > > >
> > > Hi
> > >
> > > I've just been through the original list again looking at what happens
> > > with
> > > validation types errors (by which I mean a workspace type admin
> > > console
> > > would reasonably want to display based on user input/changes). This is
> > > what
> > > I found.
> > >
> > > - Contribution processing
> > >   - dependency (imports/exports) analysis
> > >
> > >
> > > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > >      uses a ContributionDependencyBuilderMonitor
> > > - Composite read
> > >   - schema compliance
> > >
> > >
> > > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > >      Uses writes to local JDK Logger
> > >    - policy intent matching
> > >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > >      Throws exceptions
> > >    - extension availability
> > >     General artifact processor hierarchy
> > >      Throws exceptions
> > >   - SCA compliance, e.g. annotation correctness
> > >     General artifact processor hierarchy
> > >     Throws exceptions
> > > - Composite resolve
> > >   - ensure that artifacts required by the composite are available
> > >     General artifact resolver hierarchy
> > >      Throws exceptions
> > > - Composite build
> > >   - ensure that the composite is valid and consistent, e.g. unique
> > > component names, valid reference targets etc.
> > >     org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > >      uses a CompositeBuilderMonitor
> > >
> > > I would like to look for a more consistent approach across these
> > > various
> > > elements of validation. The aim being to make it more obvious how to
> > > recognize validation type errors and act accordingly. There has been a
> > > relatively lengthy debate about how to group and report errors in [1]
> > > which
> > > is worth a read. The scenarios I have in mind are workspace
> > > administration
> > > type scenarios where, for example,  A user may
> > >
> > > Add a contribution and be notified that contributions that it depends
> > > on are
> > > not available
> > > Look at a composite and be notified that there are XML and/or SCA
> > > errors
> > > etc.
> > >
> > > From [1] we want to capture as many errors as possible before
> > > reporting back
> > > to the user. Two things come immediately to mind.
> > >
> > > 1 - Pull up the Monitor API and make it more generic (and from
> > > previous
> > > comments here make it an extension point)
> > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or
> > > at
> > > least don't extend it further).
> > >
> > > I'm going to think some more about these options. Any thoughts or more
> > > options?
> > >
> > > Simon
> > >
> > > [1]
> > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > >
> >
> >
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Tue, Apr 15, 2008 at 3:59 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I was wondering if i can cook up some validation test cases if they do not
> exist. Or should we wait until the monitor issue is resolved ?
>
> Hasan
>
> On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I dont think using an underlying tuscany jdk logger would be useful to
> > plugins as they may not want to log, rather show it somewhere else such
> as
> > console etc. Tuscany can use an underlying logger in it's own monitor (
> as
> > it uses today). But i think the first approach of using a monitor is
> better
> > along with the condition that it be made more usable by the plugins by
> > giving them greater control.
> >
> > Another point is that tuscany should use ResourceBundle for validation
> > messages as well. I dont think this is being done today.
> >
> > regards
> > Hasan
> >
> >
> > On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <simonslaws@googlemail.com
> >
> > > wrote:
> > >
> > > >
> > > >
> > > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > I am on revision 634808. The ContributionServiceImpl has changed
> > > since
> > > > > then,
> > > > > and with the one that i have, it would lead through the
> > > > > CompositeProcessor
> > > > > instead of the CompositeDocumentProcessor. Hence the difference in
> > > > > exceptions..
> > > > >
> > > > > Also, dont you think that with the error that you got should throw
> > > an
> > > > > exception with schema validation, rather than just a warning?
> > > > >
> > > > > Hasan
> > > > >
> > > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <appaos@gmail.com
> >
> > > > > wrote:
> > > > > >
> > > > > > > Hi Simon,
> > > > > > >
> > > > > > > Thank you for the good information. First up i am trying to
> > > verify
> > > > > > whether
> > > > > > > the schema validation works when we point to our schemas. Can
> > > you
> > > > > let me
> > > > > > > know what is a simple error that i can introduce so that i can
> > > > > verify
> > > > > > > this?
> > > > > > > I tried doing this to my composite file (In block red):
> > > > > > >
> > > > > > >  <component name="MyServiceComponentNew">
> > > > > > >    <implementation.java
> > > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > > >    *<binding.ws/>*
> > > > > > >    <property name="location" source="$newLocation"/>
> > > > > > >    <property name="year" source="$newYear"/>
> > > > > > >  </component>
> > > > > > >
> > > > > > > This resulted in the following exception, but i think this is
> > > part
> > > > > of
> > > > > > the
> > > > > > > validation done by artifact processor and would result even if
> > > we
> > > > > > comment
> > > > > > > out the schema validation.
> > > > > > >
> > > > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > > Unexpected <binding> element found. It should appear inside a
> > > > > <service>
> > > > > > or
> > > > > > > <reference> element
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > > >    at
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > > >    at
> > > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > > >
> > > > > > >
> > > > > > > regards
> > > > > > >
> > > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > > simonslaws@googlemail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > > appaos@gmail.com>
> > > > > > wrote:
> > > > > > > >
> > > > > > > > > Currently, i see that we have various places where we can
> > > plug
> > > > > in
> > > > > > > > > validation
> > > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > > >
> > > > > > > > >    public static CompositeBuilder
> > > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > > assemblyFactory,
> > > > > > > > >
> > > > > > > >  SCABindingFactory
> > > > > > > > > scaBindingFactory,
> > > > > > > > >
> > > > > > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > > > > > >
> > > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > > >
> > > > > > >  List<PolicySet>
> > > > > > > > > domainPolicySets) {
> > > > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > > > scaBindingFactory,
> > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > domainPolicySets,
> > > > > > > > > null);
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > > >    public static DomainBuilder
> > > > > createDomainBuilder(AssemblyFactory
> > > > > > > > > assemblyFactory,
> > > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > > >            IntentAttachPointTypeFactory
> > > > > > intentAttachPointTypeFactory,
> > > > > > > > >            InterfaceContractMapper
> interfaceContractMapper,
> > > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > > scaBindingFactory,
> > > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > > domainPolicySets,
> > > > > > > > > null);
> > > > > > > > >    }
> > > > > > > > >
> > > > > > > > > Instead of passing null, we can pass in our own
> > > > > > CompositeBuildMonitor.
> > > > > > > > Are
> > > > > > > > > these the only places where we need to do this? or are
> there
> > > > > other
> > > > > > > > places
> > > > > > > > > as
> > > > > > > > > well?
> > > > > > > > >
> > > > > > > > > Hasan
> > > > > > > > >
> > > > > > > >
> > > > > > > > Hi Hasan
> > > > > > > >
> > > > > > > > There are a few places that logically we need to be able to
> > > > > validate
> > > > > > > input
> > > > > > > > and hence add monitors. The story is changing a little as we
> > > are
> > > > > > moving
> > > > > > > > toward the new "workspace"  code for managing contributions
> > > but
> > > > > > > logically
> > > > > > > > I
> > > > > > > > would expect to be running validating on at least the
> > > following
> > > > > > > >
> > > > > > > > - Contribution processing
> > > > > > > >   - dependency (imports/exports) analysis
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > > - Composite read
> > > > > > > >   - schema compliance
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > > - only appears to be initialized in
> ReallySmallRuntimeBuilder
> > > so
> > > > > need
> > > > > > to
> > > > > > > > look at this in context of workspace]
> > > > > > > >   - policy intent matching
> > > > > > > >
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > > >   - extension availability [General artifact processor
> > > hierarchy]
> > > > > > > > - Composite resolve
> > > > > > > >   - ensure that artifacts required by the composite are
> > > available
> > > > > > > [General
> > > > > > > > artifact resolver hierarchy]
> > > > > > > > - Composite build
> > > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > > unique
> > > > > > > > component names, valid reference targets etc.
> > > > > > > >
> > > > >
> [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > > >
> > > > > > > > I've noted in the square brackets where this function
> > > currently
> > > > > is.
> > > > > > Note
> > > > > > > > also that I'm making no comment here about whether the
> > > > > construction of
> > > > > > > the
> > > > > > > > in-memory composite model is for use purely for contribution
> > > > > > processing
> > > > > > > or
> > > > > > > > is going to activated and started in a runtime. This
> > > validation is
> > > > > > > > appropriate in both cases although you may choose to use
> > > different
> > > > > > > > monitors
> > > > > > > > in the two cases.
> > > > > > > >
> > > > > > > > So what I suggest as a first step is that you go ahead and
> > > change
> > > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > > CompositeBuilderImpl
> > > > > > to
> > > > > > > > see
> > > > > > > > how it works. We can work here to build a consistent view of
> > > > > > > >
> > > > > > > > - all the places a monitor is required
> > > > > > > > - what should the plugin model for monitors be
> > > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > > - what extra features may be required, I18N etc.
> > > > > > > >
> > > > > > > > I'm going to try a few experiments too to familiarize myself
> > > with
> > > > > this
> > > > > > a
> > > > > > > > bit
> > > > > > > > more.
> > > > > > > >
> > > > > > > > Regards
> > > > > > > >
> > > > > > > > Simon
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > > Hi Hasan
> > > > > >
> > > > > > The change you suggest should cause a schema validation error. I
> > > made
> > > > > the
> > > > > > change locally in samples/calculator and see the following
> output
> > > in
> > > > > > stdout
> > > > > >
> > > > > > 08-Apr-2008 22:41:54
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > > error
> > > > > > WARNING: XMLSchema validation problem in: null, line: 28,
> column:
> > > 5
> > > > > > cvc-complex-type.2.4.a: Invalid content was found starting with
> > > > > element '
> > > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0
> ":include,
> > > "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > > 08-Apr-2008 22:41:54
> > > > > >
> > > > > >
> > > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > > read
> > > > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > > >
> > > > > > No exception is raised though.
> > > > > >
> > > > > > Let me take a look at what has changed.
> > > > > >
> > > > > > Simon
> > > > > >
> > > > >
> > > >
> > > > Ok, thanks for that Hasan. I see the change you are referencing. I'm
> > > not
> > > > sure why the exception is no longer thrown. The code is still in the
> > > > CompositeProcessor to trap the case but maybe the offending element
> is
> > > > removed from the stream because of the validation warning.
> > > >
> > > > I would argue that we shouldn't mandate that an exception is thrown
> in
> > > > this case but that the validation mechanism is opened up to the
> > > monitor API
> > > > so that a monitor can be attached and those who are embedding
> tuscany
> > > can
> > > > decide how they want to deal with errors like this.
> > > >
> > > > Simon
> > > >
> > > >
> > > >
> > > Hi
> > >
> > > I've just been through the original list again looking at what happens
> > > with
> > > validation types errors (by which I mean a workspace type admin
> console
> > > would reasonably want to display based on user input/changes). This is
> > > what
> > > I found.
> > >
> > > - Contribution processing
> > >   - dependency (imports/exports) analysis
> > >
> > >
> > >
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> > >      uses a ContributionDependencyBuilderMonitor
> > > - Composite read
> > >   - schema compliance
> > >
> > >
> > >
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > >      Uses writes to local JDK Logger
> > >    - policy intent matching
> > >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> > >      Throws exceptions
> > >    - extension availability
> > >     General artifact processor hierarchy
> > >      Throws exceptions
> > >   - SCA compliance, e.g. annotation correctness
> > >     General artifact processor hierarchy
> > >     Throws exceptions
> > > - Composite resolve
> > >   - ensure that artifacts required by the composite are available
> > >     General artifact resolver hierarchy
> > >      Throws exceptions
> > > - Composite build
> > >   - ensure that the composite is valid and consistent, e.g. unique
> > > component names, valid reference targets etc.
> > >     org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> > >      uses a CompositeBuilderMonitor
> > >
> > > I would like to look for a more consistent approach across these
> various
> > > elements of validation. The aim being to make it more obvious how to
> > > recognize validation type errors and act accordingly. There has been a
> > > relatively lengthy debate about how to group and report errors in [1]
> > > which
> > > is worth a read. The scenarios I have in mind are workspace
> > > administration
> > > type scenarios where, for example,  A user may
> > >
> > > Add a contribution and be notified that contributions that it depends
> on
> > > are
> > > not available
> > > Look at a composite and be notified that there are XML and/or SCA
> errors
> > > etc.
> > >
> > > From [1] we want to capture as many errors as possible before
> reporting
> > > back
> > > to the user. Two things come immediately to mind.
> > >
> > > 1 - Pull up the Monitor API and make it more generic (and from
> previous
> > > comments here make it an extension point)
> > > 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or
> at
> > > least don't extend it further).
> > >
> > > I'm going to think some more about these options. Any thoughts or more
> > > options?
> > >
> > > Simon
> > >
> > > [1]
> http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> > >
> >
> >
>

Hi Hasan

I checked in a validation itest [1] specifically for the purpose of creating
a space for putting tests. If you create patches with new tests I, or any of
the other committers, can put them in for you. There may be a good case for
moving these into vtests at some point but lets start here and see how we
get on.

>From my previous posts I've separated out the monitor but not yet started to
apply it to the places where validations occur. Giving some time to find If
people see major issues. So I welcome your feedback as to if this suits.

Regards

Simon

[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/validation/

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

I was wondering if i can cook up some validation test cases if they do not
exist. Or should we wait until the monitor issue is resolved ?

Hasan

On Thu, Apr 10, 2008 at 4:34 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I dont think using an underlying tuscany jdk logger would be useful to
> plugins as they may not want to log, rather show it somewhere else such as
> console etc. Tuscany can use an underlying logger in it's own monitor ( as
> it uses today). But i think the first approach of using a monitor is better
> along with the condition that it be made more usable by the plugins by
> giving them greater control.
>
> Another point is that tuscany should use ResourceBundle for validation
> messages as well. I dont think this is being done today.
>
> regards
> Hasan
>
>
> On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > >
> > >
> > > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > I am on revision 634808. The ContributionServiceImpl has changed
> > since
> > > > then,
> > > > and with the one that i have, it would lead through the
> > > > CompositeProcessor
> > > > instead of the CompositeDocumentProcessor. Hence the difference in
> > > > exceptions..
> > > >
> > > > Also, dont you think that with the error that you got should throw
> > an
> > > > exception with schema validation, rather than just a warning?
> > > >
> > > > Hasan
> > > >
> > > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <
> > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi Simon,
> > > > > >
> > > > > > Thank you for the good information. First up i am trying to
> > verify
> > > > > whether
> > > > > > the schema validation works when we point to our schemas. Can
> > you
> > > > let me
> > > > > > know what is a simple error that i can introduce so that i can
> > > > verify
> > > > > > this?
> > > > > > I tried doing this to my composite file (In block red):
> > > > > >
> > > > > >  <component name="MyServiceComponentNew">
> > > > > >    <implementation.java
> > > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > > >    *<binding.ws/>*
> > > > > >    <property name="location" source="$newLocation"/>
> > > > > >    <property name="year" source="$newYear"/>
> > > > > >  </component>
> > > > > >
> > > > > > This resulted in the following exception, but i think this is
> > part
> > > > of
> > > > > the
> > > > > > validation done by artifact processor and would result even if
> > we
> > > > > comment
> > > > > > out the schema validation.
> > > > > >
> > > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > > Unexpected <binding> element found. It should appear inside a
> > > > <service>
> > > > > or
> > > > > > <reference> element
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > > >    at
> > > > > >
> > > > > >
> > > > >
> > > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > > >    at
> > com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > > >
> > > > > >
> > > > > > regards
> > > > > >
> > > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > > simonslaws@googlemail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <
> > appaos@gmail.com>
> > > > > wrote:
> > > > > > >
> > > > > > > > Currently, i see that we have various places where we can
> > plug
> > > > in
> > > > > > > > validation
> > > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > > >
> > > > > > > >    public static CompositeBuilder
> > > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > > assemblyFactory,
> > > > > > > >
> > > > > > >  SCABindingFactory
> > > > > > > > scaBindingFactory,
> > > > > > > >
> > > > > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > > > > >
> > > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > > >
> > > > > >  List<PolicySet>
> > > > > > > > domainPolicySets) {
> > > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > > scaBindingFactory,
> > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > domainPolicySets,
> > > > > > > > null);
> > > > > > > >    }
> > > > > > > >
> > > > > > > >    public static DomainBuilder
> > > > createDomainBuilder(AssemblyFactory
> > > > > > > > assemblyFactory,
> > > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > > >            IntentAttachPointTypeFactory
> > > > > intentAttachPointTypeFactory,
> > > > > > > >            InterfaceContractMapper interfaceContractMapper,
> > > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > > scaBindingFactory,
> > > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > > domainPolicySets,
> > > > > > > > null);
> > > > > > > >    }
> > > > > > > >
> > > > > > > > Instead of passing null, we can pass in our own
> > > > > CompositeBuildMonitor.
> > > > > > > Are
> > > > > > > > these the only places where we need to do this? or are there
> > > > other
> > > > > > > places
> > > > > > > > as
> > > > > > > > well?
> > > > > > > >
> > > > > > > > Hasan
> > > > > > > >
> > > > > > >
> > > > > > > Hi Hasan
> > > > > > >
> > > > > > > There are a few places that logically we need to be able to
> > > > validate
> > > > > > input
> > > > > > > and hence add monitors. The story is changing a little as we
> > are
> > > > > moving
> > > > > > > toward the new "workspace"  code for managing contributions
> > but
> > > > > > logically
> > > > > > > I
> > > > > > > would expect to be running validating on at least the
> > following
> > > > > > >
> > > > > > > - Contribution processing
> > > > > > >   - dependency (imports/exports) analysis
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > > - Composite read
> > > > > > >   - schema compliance
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > > - only appears to be initialized in ReallySmallRuntimeBuilder
> > so
> > > > need
> > > > > to
> > > > > > > look at this in context of workspace]
> > > > > > >   - policy intent matching
> > > > > > >
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > > >   - extension availability [General artifact processor
> > hierarchy]
> > > > > > > - Composite resolve
> > > > > > >   - ensure that artifacts required by the composite are
> > available
> > > > > > [General
> > > > > > > artifact resolver hierarchy]
> > > > > > > - Composite build
> > > > > > >   - ensure that the composite is valid and consistent, e.g.
> > unique
> > > > > > > component names, valid reference targets etc.
> > > > > > >
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > > >
> > > > > > > I've noted in the square brackets where this function
> > currently
> > > > is.
> > > > > Note
> > > > > > > also that I'm making no comment here about whether the
> > > > construction of
> > > > > > the
> > > > > > > in-memory composite model is for use purely for contribution
> > > > > processing
> > > > > > or
> > > > > > > is going to activated and started in a runtime. This
> > validation is
> > > > > > > appropriate in both cases although you may choose to use
> > different
> > > > > > > monitors
> > > > > > > in the two cases.
> > > > > > >
> > > > > > > So what I suggest as a first step is that you go ahead and
> > change
> > > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > > CompositeBuilderImpl
> > > > > to
> > > > > > > see
> > > > > > > how it works. We can work here to build a consistent view of
> > > > > > >
> > > > > > > - all the places a monitor is required
> > > > > > > - what should the plugin model for monitors be
> > > > > > > - the flow of control (monitors vs exceptions)
> > > > > > > - what extra features may be required, I18N etc.
> > > > > > >
> > > > > > > I'm going to try a few experiments too to familiarize myself
> > with
> > > > this
> > > > > a
> > > > > > > bit
> > > > > > > more.
> > > > > > >
> > > > > > > Regards
> > > > > > >
> > > > > > > Simon
> > > > > > >
> > > > > >
> > > > >
> > > > > Hi Hasan
> > > > >
> > > > > The change you suggest should cause a schema validation error. I
> > made
> > > > the
> > > > > change locally in samples/calculator and see the following output
> > in
> > > > > stdout
> > > > >
> > > > > 08-Apr-2008 22:41:54
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > > error
> > > > > WARNING: XMLSchema validation problem in: null, line: 28, column:
> > 5
> > > > > cvc-complex-type.2.4.a: Invalid content was found starting with
> > > > element '
> > > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include,
> > "
> > > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > > 08-Apr-2008 22:41:54
> > > > >
> > > > >
> > > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > > read
> > > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > > processed. ([row,col {unknown-source}]: [28,5])
> > > > >
> > > > > No exception is raised though.
> > > > >
> > > > > Let me take a look at what has changed.
> > > > >
> > > > > Simon
> > > > >
> > > >
> > >
> > > Ok, thanks for that Hasan. I see the change you are referencing. I'm
> > not
> > > sure why the exception is no longer thrown. The code is still in the
> > > CompositeProcessor to trap the case but maybe the offending element is
> > > removed from the stream because of the validation warning.
> > >
> > > I would argue that we shouldn't mandate that an exception is thrown in
> > > this case but that the validation mechanism is opened up to the
> > monitor API
> > > so that a monitor can be attached and those who are embedding tuscany
> > can
> > > decide how they want to deal with errors like this.
> > >
> > > Simon
> > >
> > >
> > >
> > Hi
> >
> > I've just been through the original list again looking at what happens
> > with
> > validation types errors (by which I mean a workspace type admin console
> > would reasonably want to display based on user input/changes). This is
> > what
> > I found.
> >
> > - Contribution processing
> >   - dependency (imports/exports) analysis
> >
> >
> > org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
> >      uses a ContributionDependencyBuilderMonitor
> > - Composite read
> >   - schema compliance
> >
> >
> > org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> >      Uses writes to local JDK Logger
> >    - policy intent matching
> >     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
> >      Throws exceptions
> >    - extension availability
> >     General artifact processor hierarchy
> >      Throws exceptions
> >   - SCA compliance, e.g. annotation correctness
> >     General artifact processor hierarchy
> >     Throws exceptions
> > - Composite resolve
> >   - ensure that artifacts required by the composite are available
> >     General artifact resolver hierarchy
> >      Throws exceptions
> > - Composite build
> >   - ensure that the composite is valid and consistent, e.g. unique
> > component names, valid reference targets etc.
> >     org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
> >      uses a CompositeBuilderMonitor
> >
> > I would like to look for a more consistent approach across these various
> > elements of validation. The aim being to make it more obvious how to
> > recognize validation type errors and act accordingly. There has been a
> > relatively lengthy debate about how to group and report errors in [1]
> > which
> > is worth a read. The scenarios I have in mind are workspace
> > administration
> > type scenarios where, for example,  A user may
> >
> > Add a contribution and be notified that contributions that it depends on
> > are
> > not available
> > Look at a composite and be notified that there are XML and/or SCA errors
> > etc.
> >
> > From [1] we want to capture as many errors as possible before reporting
> > back
> > to the user. Two things come immediately to mind.
> >
> > 1 - Pull up the Monitor API and make it more generic (and from previous
> > comments here make it an extension point)
> > 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or at
> > least don't extend it further).
> >
> > I'm going to think some more about these options. Any thoughts or more
> > options?
> >
> > Simon
> >
> > [1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
> >
>
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Apr 10, 2008 at 10:05 PM, Simon Laws <si...@googlemail.com>
wrote:

> Hi Hasan
>
> On Thu, Apr 10, 2008 at 9:34 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I dont think using an underlying tuscany jdk logger would be useful to
> > plugins as they may not want to log, rather show it somewhere else such
> > as
> > console etc.
> >
>
> Agreed. Thinking about this some more it is also bad as we may not have
> control of the loggers that and embedding system uses.
>
>
> > Tuscany can use an underlying logger in it's own monitor ( as
> > it uses today). But i think the first approach of using a monitor is
> > better
> > along with the condition that it be made more usable by the plugins by
> > giving them greater control.
>
>
> Yep
>
>
> >
> >
> > Another point is that tuscany should use ResourceBundle for validation
> > messages as well. I dont think this is being done today.
>
>
> +1
>
>
> So I'm making a itest for validation cases. I'm starting with the one you
> kicked off with, i.e. the schema validation one. Have you got any other
> scenarios in mind?
>
>
Hi

I've just checked in some code [1][2] that, for now, separates the monitor
interface for the interface in assembly (monitor) and also provides a
pluggable monitor implementation (monitor-impl). I haven't applied it back
into the assembly builder validation but am exposing it here for comment
while I start to look at this.

The intention remains as it currently is, i.e.  to capture all the problems
that occur during the various validation processes that Tuscany undertakes.
As the implementation is pluggable others can introduce a new monitor to
cache problems and deal with them in whatever way is appropriate. The
default implementation continues to log problems to the JDK logger. Now
though messages are expected to be identified by ID and located in resource
bundles.

A specific question. The existing problem class has the notion of resources.
What are resources in this context?

Regards

Simon

[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/monitor/
[2]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/monitor-impl/

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
Hi Hasan

On Thu, Apr 10, 2008 at 9:34 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I dont think using an underlying tuscany jdk logger would be useful to
> plugins as they may not want to log, rather show it somewhere else such as
> console etc.


Agreed. Thinking about this some more it is also bad as we may not have
control of the loggers that and embedding system uses.


> Tuscany can use an underlying logger in it's own monitor ( as
> it uses today). But i think the first approach of using a monitor is
> better
> along with the condition that it be made more usable by the plugins by
> giving them greater control.


Yep


>
>
> Another point is that tuscany should use ResourceBundle for validation
> messages as well. I dont think this is being done today.


+1


So I'm making a itest for validation cases. I'm starting with the one you
kicked off with, i.e. the schema validation one. Have you got any other
scenarios in mind?

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

I dont think using an underlying tuscany jdk logger would be useful to
plugins as they may not want to log, rather show it somewhere else such as
console etc. Tuscany can use an underlying logger in it's own monitor ( as
it uses today). But i think the first approach of using a monitor is better
along with the condition that it be made more usable by the plugins by
giving them greater control.

Another point is that tuscany should use ResourceBundle for validation
messages as well. I dont think this is being done today.

regards
Hasan

On Wed, Apr 9, 2008 at 1:22 PM, Simon Laws <si...@googlemail.com>
wrote:

> On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <si...@googlemail.com>
> wrote:
>
> >
> >
> > On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> >
> > > Hi Simon,
> > >
> > > I am on revision 634808. The ContributionServiceImpl has changed since
> > > then,
> > > and with the one that i have, it would lead through the
> > > CompositeProcessor
> > > instead of the CompositeDocumentProcessor. Hence the difference in
> > > exceptions..
> > >
> > > Also, dont you think that with the error that you got should throw an
> > > exception with schema validation, rather than just a warning?
> > >
> > > Hasan
> > >
> > > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <si...@googlemail.com>
> > > wrote:
> > >
> > > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi Simon,
> > > > >
> > > > > Thank you for the good information. First up i am trying to verify
> > > > whether
> > > > > the schema validation works when we point to our schemas. Can you
> > > let me
> > > > > know what is a simple error that i can introduce so that i can
> > > verify
> > > > > this?
> > > > > I tried doing this to my composite file (In block red):
> > > > >
> > > > >  <component name="MyServiceComponentNew">
> > > > >    <implementation.java
> > > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > > >    *<binding.ws/>*
> > > > >    <property name="location" source="$newLocation"/>
> > > > >    <property name="year" source="$newYear"/>
> > > > >  </component>
> > > > >
> > > > > This resulted in the following exception, but i think this is part
> > > of
> > > > the
> > > > > validation done by artifact processor and would result even if we
> > > > comment
> > > > > out the schema validation.
> > > > >
> > > > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > > Unexpected <binding> element found. It should appear inside a
> > > <service>
> > > > or
> > > > > <reference> element
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > > >    at
> > > > >
> > > > >
> > > >
> > >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > > >    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > > >
> > > > >
> > > > > regards
> > > > >
> > > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > > simonslaws@googlemail.com>
> > > > > wrote:
> > > > >
> > > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <appaos@gmail.com
> >
> > > > wrote:
> > > > > >
> > > > > > > Currently, i see that we have various places where we can plug
> > > in
> > > > > > > validation
> > > > > > > monitoring. Some of the ones that i found are in the
> > > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > > >
> > > > > > >    public static CompositeBuilder
> > > > > createCompositeBuilder(AssemblyFactory
> > > > > > > assemblyFactory,
> > > > > > >
> > > > > >  SCABindingFactory
> > > > > > > scaBindingFactory,
> > > > > > >
> > > > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > > > >
> > > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > > >
> > > > >  List<PolicySet>
> > > > > > > domainPolicySets) {
> > > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > > scaBindingFactory,
> > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > domainPolicySets,
> > > > > > > null);
> > > > > > >    }
> > > > > > >
> > > > > > >    public static DomainBuilder
> > > createDomainBuilder(AssemblyFactory
> > > > > > > assemblyFactory,
> > > > > > >            SCABindingFactory scaBindingFactory,
> > > > > > >            IntentAttachPointTypeFactory
> > > > intentAttachPointTypeFactory,
> > > > > > >            InterfaceContractMapper interfaceContractMapper,
> > > > > > >            List<PolicySet> domainPolicySets) {
> > > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > > scaBindingFactory,
> > > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > > domainPolicySets,
> > > > > > > null);
> > > > > > >    }
> > > > > > >
> > > > > > > Instead of passing null, we can pass in our own
> > > > CompositeBuildMonitor.
> > > > > > Are
> > > > > > > these the only places where we need to do this? or are there
> > > other
> > > > > > places
> > > > > > > as
> > > > > > > well?
> > > > > > >
> > > > > > > Hasan
> > > > > > >
> > > > > >
> > > > > > Hi Hasan
> > > > > >
> > > > > > There are a few places that logically we need to be able to
> > > validate
> > > > > input
> > > > > > and hence add monitors. The story is changing a little as we are
> > > > moving
> > > > > > toward the new "workspace"  code for managing contributions but
> > > > > logically
> > > > > > I
> > > > > > would expect to be running validating on at least the following
> > > > > >
> > > > > > - Contribution processing
> > > > > >   - dependency (imports/exports) analysis
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > > - Composite read
> > > > > >   - schema compliance
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > > - only appears to be initialized in ReallySmallRuntimeBuilder so
> > > need
> > > > to
> > > > > > look at this in context of workspace]
> > > > > >   - policy intent matching
> > > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > > >   - extension availability [General artifact processor
> hierarchy]
> > > > > > - Composite resolve
> > > > > >   - ensure that artifacts required by the composite are
> available
> > > > > [General
> > > > > > artifact resolver hierarchy]
> > > > > > - Composite build
> > > > > >   - ensure that the composite is valid and consistent, e.g.
> unique
> > > > > > component names, valid reference targets etc.
> > > > > >
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > > >
> > > > > > I've noted in the square brackets where this function currently
> > > is.
> > > > Note
> > > > > > also that I'm making no comment here about whether the
> > > construction of
> > > > > the
> > > > > > in-memory composite model is for use purely for contribution
> > > > processing
> > > > > or
> > > > > > is going to activated and started in a runtime. This validation
> is
> > > > > > appropriate in both cases although you may choose to use
> different
> > > > > > monitors
> > > > > > in the two cases.
> > > > > >
> > > > > > So what I suggest as a first step is that you go ahead and
> change
> > > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > > CompositeBuilderImpl
> > > > to
> > > > > > see
> > > > > > how it works. We can work here to build a consistent view of
> > > > > >
> > > > > > - all the places a monitor is required
> > > > > > - what should the plugin model for monitors be
> > > > > > - the flow of control (monitors vs exceptions)
> > > > > > - what extra features may be required, I18N etc.
> > > > > >
> > > > > > I'm going to try a few experiments too to familiarize myself
> with
> > > this
> > > > a
> > > > > > bit
> > > > > > more.
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > > Simon
> > > > > >
> > > > >
> > > >
> > > > Hi Hasan
> > > >
> > > > The change you suggest should cause a schema validation error. I
> made
> > > the
> > > > change locally in samples/calculator and see the following output in
> > > > stdout
> > > >
> > > > 08-Apr-2008 22:41:54
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > > error
> > > > WARNING: XMLSchema validation problem in: null, line: 28, column: 5
> > > > cvc-complex-type.2.4.a: Invalid content was found starting with
> > > element '
> > > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include, "
> > > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > > 08-Apr-2008 22:41:54
> > > >
> > > >
> > >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > > read
> > > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > > processed. ([row,col {unknown-source}]: [28,5])
> > > >
> > > > No exception is raised though.
> > > >
> > > > Let me take a look at what has changed.
> > > >
> > > > Simon
> > > >
> > >
> >
> > Ok, thanks for that Hasan. I see the change you are referencing. I'm not
> > sure why the exception is no longer thrown. The code is still in the
> > CompositeProcessor to trap the case but maybe the offending element is
> > removed from the stream because of the validation warning.
> >
> > I would argue that we shouldn't mandate that an exception is thrown in
> > this case but that the validation mechanism is opened up to the monitor
> API
> > so that a monitor can be attached and those who are embedding tuscany
> can
> > decide how they want to deal with errors like this.
> >
> > Simon
> >
> >
> >
> Hi
>
> I've just been through the original list again looking at what happens
> with
> validation types errors (by which I mean a workspace type admin console
> would reasonably want to display based on user input/changes). This is
> what
> I found.
>
> - Contribution processing
>   - dependency (imports/exports) analysis
>
>
> org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
>      uses a ContributionDependencyBuilderMonitor
> - Composite read
>   - schema compliance
>
>
> org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
>      Uses writes to local JDK Logger
>    - policy intent matching
>     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
>      Throws exceptions
>    - extension availability
>     General artifact processor hierarchy
>      Throws exceptions
>   - SCA compliance, e.g. annotation correctness
>     General artifact processor hierarchy
>     Throws exceptions
> - Composite resolve
>   - ensure that artifacts required by the composite are available
>     General artifact resolver hierarchy
>      Throws exceptions
> - Composite build
>   - ensure that the composite is valid and consistent, e.g. unique
> component names, valid reference targets etc.
>     org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
>      uses a CompositeBuilderMonitor
>
> I would like to look for a more consistent approach across these various
> elements of validation. The aim being to make it more obvious how to
> recognize validation type errors and act accordingly. There has been a
> relatively lengthy debate about how to group and report errors in [1]
> which
> is worth a read. The scenarios I have in mind are workspace administration
> type scenarios where, for example,  A user may
>
> Add a contribution and be notified that contributions that it depends on
> are
> not available
> Look at a composite and be notified that there are XML and/or SCA errors
> etc.
>
> From [1] we want to capture as many errors as possible before reporting
> back
> to the user. Two things come immediately to mind.
>
> 1 - Pull up the Monitor API and make it more generic (and from previous
> comments here make it an extension point)
> 2 - Rely on a Tuscany specific JDK logger and remove the monitor (or at
> least don't extend it further).
>
> I'm going to think some more about these options. Any thoughts or more
> options?
>
> Simon
>
> [1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Apr 9, 2008 at 12:49 PM, Simon Laws <si...@googlemail.com>
wrote:

>
>
> On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > I am on revision 634808. The ContributionServiceImpl has changed since
> > then,
> > and with the one that i have, it would lead through the
> > CompositeProcessor
> > instead of the CompositeDocumentProcessor. Hence the difference in
> > exceptions..
> >
> > Also, dont you think that with the error that you got should throw an
> > exception with schema validation, rather than just a warning?
> >
> > Hasan
> >
> > On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > >
> > > > Hi Simon,
> > > >
> > > > Thank you for the good information. First up i am trying to verify
> > > whether
> > > > the schema validation works when we point to our schemas. Can you
> > let me
> > > > know what is a simple error that i can introduce so that i can
> > verify
> > > > this?
> > > > I tried doing this to my composite file (In block red):
> > > >
> > > >  <component name="MyServiceComponentNew">
> > > >    <implementation.java
> > > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > > >    *<binding.ws/>*
> > > >    <property name="location" source="$newLocation"/>
> > > >    <property name="year" source="$newYear"/>
> > > >  </component>
> > > >
> > > > This resulted in the following exception, but i think this is part
> > of
> > > the
> > > > validation done by artifact processor and would result even if we
> > > comment
> > > > out the schema validation.
> > > >
> > > >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > > Unexpected <binding> element found. It should appear inside a
> > <service>
> > > or
> > > > <reference> element
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > > >    at
> > > >
> > > >
> > >
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > > >    at
> > > >
> > > >
> > >
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > > >    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > > >
> > > >
> > > > regards
> > > >
> > > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <
> > simonslaws@googlemail.com>
> > > > wrote:
> > > >
> > > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > > > >
> > > > > > Currently, i see that we have various places where we can plug
> > in
> > > > > > validation
> > > > > > monitoring. Some of the ones that i found are in the
> > > > > > ReallySmallRuntimeBuilder as shown below:
> > > > > >
> > > > > >    public static CompositeBuilder
> > > > createCompositeBuilder(AssemblyFactory
> > > > > > assemblyFactory,
> > > > > >
> > > > >  SCABindingFactory
> > > > > > scaBindingFactory,
> > > > > >
> > > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > > >
> > > > > > InterfaceContractMapper interfaceContractMapper,
> > > > > >
> > > >  List<PolicySet>
> > > > > > domainPolicySets) {
> > > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > > scaBindingFactory,
> > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > domainPolicySets,
> > > > > > null);
> > > > > >    }
> > > > > >
> > > > > >    public static DomainBuilder
> > createDomainBuilder(AssemblyFactory
> > > > > > assemblyFactory,
> > > > > >            SCABindingFactory scaBindingFactory,
> > > > > >            IntentAttachPointTypeFactory
> > > intentAttachPointTypeFactory,
> > > > > >            InterfaceContractMapper interfaceContractMapper,
> > > > > >            List<PolicySet> domainPolicySets) {
> > > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > > scaBindingFactory,
> > > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > > domainPolicySets,
> > > > > > null);
> > > > > >    }
> > > > > >
> > > > > > Instead of passing null, we can pass in our own
> > > CompositeBuildMonitor.
> > > > > Are
> > > > > > these the only places where we need to do this? or are there
> > other
> > > > > places
> > > > > > as
> > > > > > well?
> > > > > >
> > > > > > Hasan
> > > > > >
> > > > >
> > > > > Hi Hasan
> > > > >
> > > > > There are a few places that logically we need to be able to
> > validate
> > > > input
> > > > > and hence add monitors. The story is changing a little as we are
> > > moving
> > > > > toward the new "workspace"  code for managing contributions but
> > > > logically
> > > > > I
> > > > > would expect to be running validating on at least the following
> > > > >
> > > > > - Contribution processing
> > > > >   - dependency (imports/exports) analysis
> > > > >
> > > > >
> > > >
> > >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > > - Composite read
> > > > >   - schema compliance
> > > > >
> > > > >
> > > >
> > >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > > - only appears to be initialized in ReallySmallRuntimeBuilder so
> > need
> > > to
> > > > > look at this in context of workspace]
> > > > >   - policy intent matching
> > > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > > >   - extension availability [General artifact processor hierarchy]
> > > > > - Composite resolve
> > > > >   - ensure that artifacts required by the composite are available
> > > > [General
> > > > > artifact resolver hierarchy]
> > > > > - Composite build
> > > > >   - ensure that the composite is valid and consistent, e.g. unique
> > > > > component names, valid reference targets etc.
> > > > >
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > > >
> > > > > I've noted in the square brackets where this function currently
> > is.
> > > Note
> > > > > also that I'm making no comment here about whether the
> > construction of
> > > > the
> > > > > in-memory composite model is for use purely for contribution
> > > processing
> > > > or
> > > > > is going to activated and started in a runtime. This validation is
> > > > > appropriate in both cases although you may choose to use different
> > > > > monitors
> > > > > in the two cases.
> > > > >
> > > > > So what I suggest as a first step is that you go ahead and change
> > > > > ReallySmallRuntimeBuilder to plug a monitor into
> > CompositeBuilderImpl
> > > to
> > > > > see
> > > > > how it works. We can work here to build a consistent view of
> > > > >
> > > > > - all the places a monitor is required
> > > > > - what should the plugin model for monitors be
> > > > > - the flow of control (monitors vs exceptions)
> > > > > - what extra features may be required, I18N etc.
> > > > >
> > > > > I'm going to try a few experiments too to familiarize myself with
> > this
> > > a
> > > > > bit
> > > > > more.
> > > > >
> > > > > Regards
> > > > >
> > > > > Simon
> > > > >
> > > >
> > >
> > > Hi Hasan
> > >
> > > The change you suggest should cause a schema validation error. I made
> > the
> > > change locally in samples/calculator and see the following output in
> > > stdout
> > >
> > > 08-Apr-2008 22:41:54
> > >
> > org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > > error
> > > WARNING: XMLSchema validation problem in: null, line: 28, column: 5
> > > cvc-complex-type.2.4.a: Invalid content was found starting with
> > element '
> > > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include, "
> > > http://www.osoa.org/xmlns/sca/1.0":service, "
> > > http://www.osoa.org/xmlns/sca/1.0":property, "
> > > http://www.osoa.org/xmlns/sca/1.0":component, "
> > > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > > 08-Apr-2008 22:41:54
> > >
> > >
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > > read
> > > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> > <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > > processed. ([row,col {unknown-source}]: [28,5])
> > >
> > > No exception is raised though.
> > >
> > > Let me take a look at what has changed.
> > >
> > > Simon
> > >
> >
>
> Ok, thanks for that Hasan. I see the change you are referencing. I'm not
> sure why the exception is no longer thrown. The code is still in the
> CompositeProcessor to trap the case but maybe the offending element is
> removed from the stream because of the validation warning.
>
> I would argue that we shouldn't mandate that an exception is thrown in
> this case but that the validation mechanism is opened up to the monitor API
> so that a monitor can be attached and those who are embedding tuscany can
> decide how they want to deal with errors like this.
>
> Simon
>
>
>
Hi

I've just been through the original list again looking at what happens with
validation types errors (by which I mean a workspace type admin console
would reasonably want to display based on user input/changes). This is what
I found.

- Contribution processing
   - dependency (imports/exports) analysis

org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl
     uses a ContributionDependencyBuilderMonitor
- Composite read
   - schema compliance

org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
     Uses writes to local JDK Logger
   - policy intent matching
     org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor
     Throws exceptions
   - extension availability
     General artifact processor hierarchy
     Throws exceptions
   - SCA compliance, e.g. annotation correctness
     General artifact processor hierarchy
     Throws exceptions
- Composite resolve
   - ensure that artifacts required by the composite are available
     General artifact resolver hierarchy
     Throws exceptions
- Composite build
   - ensure that the composite is valid and consistent, e.g. unique
component names, valid reference targets etc.
     org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl
     uses a CompositeBuilderMonitor

I would like to look for a more consistent approach across these various
elements of validation. The aim being to make it more obvious how to
recognize validation type errors and act accordingly. There has been a
relatively lengthy debate about how to group and report errors in [1] which
is worth a read. The scenarios I have in mind are workspace administration
type scenarios where, for example,  A user may

Add a contribution and be notified that contributions that it depends on are
not available
Look at a composite and be notified that there are XML and/or SCA errors
etc.

>From [1] we want to capture as many errors as possible before reporting back
to the user. Two things come immediately to mind.

1 - Pull up the Monitor API and make it more generic (and from previous
comments here make it an extension point)
2 - Rely on a Tuscany specific JDK logger and remove the monitor (or at
least don't extend it further).

I'm going to think some more about these options. Any thoughts or more
options?

Simon

[1] http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29878.html

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Apr 9, 2008 at 12:00 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> I am on revision 634808. The ContributionServiceImpl has changed since
> then,
> and with the one that i have, it would lead through the CompositeProcessor
> instead of the CompositeDocumentProcessor. Hence the difference in
> exceptions..
>
> Also, dont you think that with the error that you got should throw an
> exception with schema validation, rather than just a warning?
>
> Hasan
>
> On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com> wrote:
> >
> > > Hi Simon,
> > >
> > > Thank you for the good information. First up i am trying to verify
> > whether
> > > the schema validation works when we point to our schemas. Can you let
> me
> > > know what is a simple error that i can introduce so that i can verify
> > > this?
> > > I tried doing this to my composite file (In block red):
> > >
> > >  <component name="MyServiceComponentNew">
> > >    <implementation.java
> > class="mysca.test.myservice.impl.MyServiceImpl"/>
> > >    *<binding.ws/>*
> > >    <property name="location" source="$newLocation"/>
> > >    <property name="year" source="$newYear"/>
> > >  </component>
> > >
> > > This resulted in the following exception, but i think this is part of
> > the
> > > validation done by artifact processor and would result even if we
> > comment
> > > out the schema validation.
> > >
> > > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > > Unexpected <binding> element found. It should appear inside a
> <service>
> > or
> > > <reference> element
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> > >    at
> > >
> > >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> > >    at
> > >
> > >
> >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> > >    at
> > >
> > >
> >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> > >    at
> > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> > >    at
> > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> > >    at
> > >
> > >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> > >    at
> > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> > >    at
> > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> > >    at
> > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> > >    at
> > >
> > >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> > >    at
> > >
> > >
> >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> > >    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> > >
> > >
> > > regards
> > >
> > > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
> > > wrote:
> > >
> > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com>
> > wrote:
> > > >
> > > > > Currently, i see that we have various places where we can plug in
> > > > > validation
> > > > > monitoring. Some of the ones that i found are in the
> > > > > ReallySmallRuntimeBuilder as shown below:
> > > > >
> > > > >    public static CompositeBuilder
> > > createCompositeBuilder(AssemblyFactory
> > > > > assemblyFactory,
> > > > >
> > > >  SCABindingFactory
> > > > > scaBindingFactory,
> > > > >
> > > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > > >
> > > > > InterfaceContractMapper interfaceContractMapper,
> > > > >
> > >  List<PolicySet>
> > > > > domainPolicySets) {
> > > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > > scaBindingFactory,
> > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > domainPolicySets,
> > > > > null);
> > > > >    }
> > > > >
> > > > >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > > > > assemblyFactory,
> > > > >            SCABindingFactory scaBindingFactory,
> > > > >            IntentAttachPointTypeFactory
> > intentAttachPointTypeFactory,
> > > > >            InterfaceContractMapper interfaceContractMapper,
> > > > >            List<PolicySet> domainPolicySets) {
> > > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > > scaBindingFactory,
> > > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > domainPolicySets,
> > > > > null);
> > > > >    }
> > > > >
> > > > > Instead of passing null, we can pass in our own
> > CompositeBuildMonitor.
> > > > Are
> > > > > these the only places where we need to do this? or are there other
> > > > places
> > > > > as
> > > > > well?
> > > > >
> > > > > Hasan
> > > > >
> > > >
> > > > Hi Hasan
> > > >
> > > > There are a few places that logically we need to be able to validate
> > > input
> > > > and hence add monitors. The story is changing a little as we are
> > moving
> > > > toward the new "workspace"  code for managing contributions but
> > > logically
> > > > I
> > > > would expect to be running validating on at least the following
> > > >
> > > > - Contribution processing
> > > >   - dependency (imports/exports) analysis
> > > >
> > > >
> > >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > > - Composite read
> > > >   - schema compliance
> > > >
> > > >
> > >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > > - only appears to be initialized in ReallySmallRuntimeBuilder so
> need
> > to
> > > > look at this in context of workspace]
> > > >   - policy intent matching
> > > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > > >   - extension availability [General artifact processor hierarchy]
> > > > - Composite resolve
> > > >   - ensure that artifacts required by the composite are available
> > > [General
> > > > artifact resolver hierarchy]
> > > > - Composite build
> > > >   - ensure that the composite is valid and consistent, e.g. unique
> > > > component names, valid reference targets etc.
> > > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > > >
> > > > I've noted in the square brackets where this function currently is.
> > Note
> > > > also that I'm making no comment here about whether the construction
> of
> > > the
> > > > in-memory composite model is for use purely for contribution
> > processing
> > > or
> > > > is going to activated and started in a runtime. This validation is
> > > > appropriate in both cases although you may choose to use different
> > > > monitors
> > > > in the two cases.
> > > >
> > > > So what I suggest as a first step is that you go ahead and change
> > > > ReallySmallRuntimeBuilder to plug a monitor into
> CompositeBuilderImpl
> > to
> > > > see
> > > > how it works. We can work here to build a consistent view of
> > > >
> > > > - all the places a monitor is required
> > > > - what should the plugin model for monitors be
> > > > - the flow of control (monitors vs exceptions)
> > > > - what extra features may be required, I18N etc.
> > > >
> > > > I'm going to try a few experiments too to familiarize myself with
> this
> > a
> > > > bit
> > > > more.
> > > >
> > > > Regards
> > > >
> > > > Simon
> > > >
> > >
> >
> > Hi Hasan
> >
> > The change you suggest should cause a schema validation error. I made
> the
> > change locally in samples/calculator and see the following output in
> > stdout
> >
> > 08-Apr-2008 22:41:54
> >
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> > error
> > WARNING: XMLSchema validation problem in: null, line: 28, column: 5
> > cvc-complex-type.2.4.a: Invalid content was found starting with element
> '
> > binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include, "
> > http://www.osoa.org/xmlns/sca/1.0":service, "
> > http://www.osoa.org/xmlns/sca/1.0":property, "
> > http://www.osoa.org/xmlns/sca/1.0":component, "
> > http://www.osoa.org/xmlns/sca/1.0":reference, "
> > http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> > http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> > 08-Apr-2008 22:41:54
> >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> > read
> > WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>
> <http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> > processed. ([row,col {unknown-source}]: [28,5])
> >
> > No exception is raised though.
> >
> > Let me take a look at what has changed.
> >
> > Simon
> >
>

Ok, thanks for that Hasan. I see the change you are referencing. I'm not
sure why the exception is no longer thrown. The code is still in the
CompositeProcessor to trap the case but maybe the offending element is
removed from the stream because of the validation warning.

I would argue that we shouldn't mandate that an exception is thrown in this
case but that the validation mechanism is opened up to the monitor API so
that a monitor can be attached and those who are embedding tuscany can
decide how they want to deal with errors like this.

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

I am on revision 634808. The ContributionServiceImpl has changed since then,
and with the one that i have, it would lead through the CompositeProcessor
instead of the CompositeDocumentProcessor. Hence the difference in
exceptions..

Also, dont you think that with the error that you got should throw an
exception with schema validation, rather than just a warning?

Hasan

On Wed, Apr 9, 2008 at 6:36 AM, Simon Laws <si...@googlemail.com>
wrote:

> On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > Thank you for the good information. First up i am trying to verify
> whether
> > the schema validation works when we point to our schemas. Can you let me
> > know what is a simple error that i can introduce so that i can verify
> > this?
> > I tried doing this to my composite file (In block red):
> >
> >  <component name="MyServiceComponentNew">
> >    <implementation.java
> class="mysca.test.myservice.impl.MyServiceImpl"/>
> >    *<binding.ws/>*
> >    <property name="location" source="$newLocation"/>
> >    <property name="year" source="$newYear"/>
> >  </component>
> >
> > This resulted in the following exception, but i think this is part of
> the
> > validation done by artifact processor and would result even if we
> comment
> > out the schema validation.
> >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > Unexpected <binding> element found. It should appear inside a <service>
> or
> > <reference> element
> >    at
> >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> >    at
> >
> >
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> >    at
> >
> >
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> >    at
> >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> >    at
> >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> >    at
> >
> >
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> >    at
> >
> >
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> >    at
> >
> >
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> >    at
> >
> >
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> >    at
> >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> >    at
> >
> >
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> >    at
> >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> >    at
> >
> >
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> >    at
> >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> >    at
> >
> >
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> >    at
> >
> >
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> >    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> >
> >
> > regards
> >
> > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com>
> wrote:
> > >
> > > > Currently, i see that we have various places where we can plug in
> > > > validation
> > > > monitoring. Some of the ones that i found are in the
> > > > ReallySmallRuntimeBuilder as shown below:
> > > >
> > > >    public static CompositeBuilder
> > createCompositeBuilder(AssemblyFactory
> > > > assemblyFactory,
> > > >
> > >  SCABindingFactory
> > > > scaBindingFactory,
> > > >
> > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > >
> > > > InterfaceContractMapper interfaceContractMapper,
> > > >
> >  List<PolicySet>
> > > > domainPolicySets) {
> > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > scaBindingFactory,
> > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > domainPolicySets,
> > > > null);
> > > >    }
> > > >
> > > >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > > > assemblyFactory,
> > > >            SCABindingFactory scaBindingFactory,
> > > >            IntentAttachPointTypeFactory
> intentAttachPointTypeFactory,
> > > >            InterfaceContractMapper interfaceContractMapper,
> > > >            List<PolicySet> domainPolicySets) {
> > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > scaBindingFactory,
> > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > domainPolicySets,
> > > > null);
> > > >    }
> > > >
> > > > Instead of passing null, we can pass in our own
> CompositeBuildMonitor.
> > > Are
> > > > these the only places where we need to do this? or are there other
> > > places
> > > > as
> > > > well?
> > > >
> > > > Hasan
> > > >
> > >
> > > Hi Hasan
> > >
> > > There are a few places that logically we need to be able to validate
> > input
> > > and hence add monitors. The story is changing a little as we are
> moving
> > > toward the new "workspace"  code for managing contributions but
> > logically
> > > I
> > > would expect to be running validating on at least the following
> > >
> > > - Contribution processing
> > >   - dependency (imports/exports) analysis
> > >
> > >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > - Composite read
> > >   - schema compliance
> > >
> > >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > - only appears to be initialized in ReallySmallRuntimeBuilder so need
> to
> > > look at this in context of workspace]
> > >   - policy intent matching
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > >   - extension availability [General artifact processor hierarchy]
> > > - Composite resolve
> > >   - ensure that artifacts required by the composite are available
> > [General
> > > artifact resolver hierarchy]
> > > - Composite build
> > >   - ensure that the composite is valid and consistent, e.g. unique
> > > component names, valid reference targets etc.
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > >
> > > I've noted in the square brackets where this function currently is.
> Note
> > > also that I'm making no comment here about whether the construction of
> > the
> > > in-memory composite model is for use purely for contribution
> processing
> > or
> > > is going to activated and started in a runtime. This validation is
> > > appropriate in both cases although you may choose to use different
> > > monitors
> > > in the two cases.
> > >
> > > So what I suggest as a first step is that you go ahead and change
> > > ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl
> to
> > > see
> > > how it works. We can work here to build a consistent view of
> > >
> > > - all the places a monitor is required
> > > - what should the plugin model for monitors be
> > > - the flow of control (monitors vs exceptions)
> > > - what extra features may be required, I18N etc.
> > >
> > > I'm going to try a few experiments too to familiarize myself with this
> a
> > > bit
> > > more.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
>
> Hi Hasan
>
> The change you suggest should cause a schema validation error. I made the
> change locally in samples/calculator and see the following output in
> stdout
>
> 08-Apr-2008 22:41:54
> org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
> error
> WARNING: XMLSchema validation problem in: null, line: 28, column: 5
> cvc-complex-type.2.4.a: Invalid content was found starting with element '
> binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include, "
> http://www.osoa.org/xmlns/sca/1.0":service, "
> http://www.osoa.org/xmlns/sca/1.0":property, "
> http://www.osoa.org/xmlns/sca/1.0":component, "
> http://www.osoa.org/xmlns/sca/1.0":reference, "
> http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
> http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
> 08-Apr-2008 22:41:54
>
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
> read
> WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws<http://www.osoa.org/xmlns/sca/1.0%7Dbinding.ws>cannot be
> processed. ([row,col {unknown-source}]: [28,5])
>
> No exception is raised though.
>
> Let me take a look at what has changed.
>
> Simon
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> Thank you for the good information. First up i am trying to verify whether
> the schema validation works when we point to our schemas. Can you let me
> know what is a simple error that i can introduce so that i can verify
> this?
> I tried doing this to my composite file (In block red):
>
>  <component name="MyServiceComponentNew">
>    <implementation.java class="mysca.test.myservice.impl.MyServiceImpl"/>
>    *<binding.ws/>*
>    <property name="location" source="$newLocation"/>
>    <property name="year" source="$newYear"/>
>  </component>
>
> This resulted in the following exception, but i think this is part of the
> validation done by artifact processor and would result even if we comment
> out the schema validation.
>
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> Unexpected <binding> element found. It should appear inside a <service> or
> <reference> element
>    at
>
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
>    at
>
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
>    at
>
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
>    at
>
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
>    at
>
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
>    at
>
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
>    at
>
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
>    at
>
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
>    at
>
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
>    at
>
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
>    at
>
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
>    at
>
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
>    at
>
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
>    at
>
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
>    at
>
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
>    at
>
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
>    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
>
>
> regards
>
> On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com> wrote:
> >
> > > Currently, i see that we have various places where we can plug in
> > > validation
> > > monitoring. Some of the ones that i found are in the
> > > ReallySmallRuntimeBuilder as shown below:
> > >
> > >    public static CompositeBuilder
> createCompositeBuilder(AssemblyFactory
> > > assemblyFactory,
> > >
> >  SCABindingFactory
> > > scaBindingFactory,
> > >
> > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > >
> > > InterfaceContractMapper interfaceContractMapper,
> > >
>  List<PolicySet>
> > > domainPolicySets) {
> > >        return new CompositeBuilderImpl(assemblyFactory,
> > scaBindingFactory,
> > > intentAttachPointTypeFactory, interfaceContractMapper,
> domainPolicySets,
> > > null);
> > >    }
> > >
> > >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > > assemblyFactory,
> > >            SCABindingFactory scaBindingFactory,
> > >            IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > >            InterfaceContractMapper interfaceContractMapper,
> > >            List<PolicySet> domainPolicySets) {
> > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > scaBindingFactory,
> > > intentAttachPointTypeFactory, interfaceContractMapper,
> domainPolicySets,
> > > null);
> > >    }
> > >
> > > Instead of passing null, we can pass in our own CompositeBuildMonitor.
> > Are
> > > these the only places where we need to do this? or are there other
> > places
> > > as
> > > well?
> > >
> > > Hasan
> > >
> >
> > Hi Hasan
> >
> > There are a few places that logically we need to be able to validate
> input
> > and hence add monitors. The story is changing a little as we are moving
> > toward the new "workspace"  code for managing contributions but
> logically
> > I
> > would expect to be running validating on at least the following
> >
> > - Contribution processing
> >   - dependency (imports/exports) analysis
> >
> >
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > - Composite read
> >   - schema compliance
> >
> >
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > - only appears to be initialized in ReallySmallRuntimeBuilder so need to
> > look at this in context of workspace]
> >   - policy intent matching
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> >   - extension availability [General artifact processor hierarchy]
> > - Composite resolve
> >   - ensure that artifacts required by the composite are available
> [General
> > artifact resolver hierarchy]
> > - Composite build
> >   - ensure that the composite is valid and consistent, e.g. unique
> > component names, valid reference targets etc.
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> >
> > I've noted in the square brackets where this function currently is. Note
> > also that I'm making no comment here about whether the construction of
> the
> > in-memory composite model is for use purely for contribution processing
> or
> > is going to activated and started in a runtime. This validation is
> > appropriate in both cases although you may choose to use different
> > monitors
> > in the two cases.
> >
> > So what I suggest as a first step is that you go ahead and change
> > ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl to
> > see
> > how it works. We can work here to build a consistent view of
> >
> > - all the places a monitor is required
> > - what should the plugin model for monitors be
> > - the flow of control (monitors vs exceptions)
> > - what extra features may be required, I18N etc.
> >
> > I'm going to try a few experiments too to familiarize myself with this a
> > bit
> > more.
> >
> > Regards
> >
> > Simon
> >
>

Hi Hasan

The change you suggest should cause a schema validation error. I made the
change locally in samples/calculator and see the following output in stdout

08-Apr-2008 22:41:54
org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1
error
WARNING: XMLSchema validation problem in: null, line: 28, column: 5
cvc-complex-type.2.4.a: Invalid content was found starting with element '
binding.ws'. One of '{"http://www.osoa.org/xmlns/sca/1.0":include, "
http://www.osoa.org/xmlns/sca/1.0":service, "
http://www.osoa.org/xmlns/sca/1.0":property, "
http://www.osoa.org/xmlns/sca/1.0":component, "
http://www.osoa.org/xmlns/sca/1.0":reference, "
http://www.osoa.org/xmlns/sca/1.0":wire, WC[##other:"
http://www.osoa.org/xmlns/sca/1.0"]}' is expected.
08-Apr-2008 22:41:54
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor
read
WARNING: Element {http://www.osoa.org/xmlns/sca/1.0}binding.ws cannot be
processed. ([row,col {unknown-source}]: [28,5])

No exception is raised though.

Let me take a look at what has changed.

Simon

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Simon,

Another interesting thought is that the monitor should have a way for
plugins to tell runtime on whether to fail or not fail at all. I am not sure
i am clear, but as an example, this exception is thrown in
CompositeProcessor.read()

throw new ContributionReadException(

"Unexpected <interface> element found. It should appear inside a <service>
or <reference> element");

In this case, the runtime fails during contributionRead when it finds the
unexpected element in composite file. I think monitor should handle this and
allow the plugins to decide as to what to do. In that case there would be a
clearer distinction between admin and runtime.

regards
Hasan

On Tue, Apr 8, 2008 at 10:39 AM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> One more point is to make the CompositeBuilderMonitor a true plugin or an
> extension point. So that external implementations can define their own and
> use them without modifying tuscany code. As of now the only way i see to
> pass in our own monitor is in places like the code below where instead of
> null, we pass in our monitor. If there is another way, please let me know.
> *
> return new CompositeBuilderImpl(assemblyFactory, scaBindingFactory,
> intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
> null);
>
> *
> regards
>
> Hasan
>
>
> On Tue, Apr 8, 2008 at 9:58 AM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Hi Simon,
> >
> > Thank you for the good information. First up i am trying to verify
> > whether the schema validation works when we point to our schemas. Can you
> > let me know what is a simple error that i can introduce so that i can verify
> > this? I tried doing this to my composite file (In block red):
> >
> >   <component name="MyServiceComponentNew">
> >     <implementation.java
> > class="mysca.test.myservice.impl.MyServiceImpl"/>
> >     *<binding.ws/>*
> >     <property name="location" source="$newLocation"/>
> >     <property name="year" source="$newYear"/>
> >   </component>
> >
> > This resulted in the following exception, but i think this is part of
> > the validation done by artifact processor and would result even if we
> > comment out the schema validation.
> >
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > Unexpected <binding> element found. It should appear inside a <service> or
> > <reference> element
> >     at
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
> >     at
> > org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
> >     at
> > org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
> >     at
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
> >     at
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
> >     at
> > org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
> >     at
> > com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
> >     at
> > com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
> >     at
> > com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
> >     at
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
> >     at
> > com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
> >     at
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
> >     at
> > com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
> >     at
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
> >     at
> > com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
> >     at
> > com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
> >     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
> >
> >
> > regards
> >
> >
> > On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
> > wrote:
> >
> > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com>
> > > wrote:
> > >
> > > > Currently, i see that we have various places where we can plug in
> > > > validation
> > > > monitoring. Some of the ones that i found are in the
> > > > ReallySmallRuntimeBuilder as shown below:
> > > >
> > > >    public static CompositeBuilder
> > > createCompositeBuilder(AssemblyFactory
> > > > assemblyFactory,
> > > >
> > >  SCABindingFactory
> > > > scaBindingFactory,
> > > >
> > > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > > >
> > > > InterfaceContractMapper interfaceContractMapper,
> > > >
> > >  List<PolicySet>
> > > > domainPolicySets) {
> > > >        return new CompositeBuilderImpl(assemblyFactory,
> > > scaBindingFactory,
> > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > domainPolicySets,
> > > > null);
> > > >    }
> > > >
> > > >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > > > assemblyFactory,
> > > >            SCABindingFactory scaBindingFactory,
> > > >            IntentAttachPointTypeFactory
> > > intentAttachPointTypeFactory,
> > > >            InterfaceContractMapper interfaceContractMapper,
> > > >            List<PolicySet> domainPolicySets) {
> > > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > > scaBindingFactory,
> > > > intentAttachPointTypeFactory, interfaceContractMapper,
> > > domainPolicySets,
> > > > null);
> > > >    }
> > > >
> > > > Instead of passing null, we can pass in our own
> > > CompositeBuildMonitor. Are
> > > > these the only places where we need to do this? or are there other
> > > places
> > > > as
> > > > well?
> > > >
> > > > Hasan
> > > >
> > >
> > > Hi Hasan
> > >
> > > There are a few places that logically we need to be able to validate
> > > input
> > > and hence add monitors. The story is changing a little as we are
> > > moving
> > > toward the new "workspace"  code for managing contributions but
> > > logically I
> > > would expect to be running validating on at least the following
> > >
> > > - Contribution processing
> > >   - dependency (imports/exports) analysis
> > >
> > > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > > - Composite read
> > >   - schema compliance
> > >
> > > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > > - only appears to be initialized in ReallySmallRuntimeBuilder so need
> > > to
> > > look at this in context of workspace]
> > >   - policy intent matching
> > > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> > >   - extension availability [General artifact processor hierarchy]
> > > - Composite resolve
> > >   - ensure that artifacts required by the composite are available
> > > [General
> > > artifact resolver hierarchy]
> > > - Composite build
> > >   - ensure that the composite is valid and consistent, e.g. unique
> > > component names, valid reference targets etc.
> > > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> > >
> > > I've noted in the square brackets where this function currently is.
> > > Note
> > > also that I'm making no comment here about whether the construction of
> > > the
> > > in-memory composite model is for use purely for contribution
> > > processing or
> > > is going to activated and started in a runtime. This validation is
> > > appropriate in both cases although you may choose to use different
> > > monitors
> > > in the two cases.
> > >
> > > So what I suggest as a first step is that you go ahead and change
> > > ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl
> > > to see
> > > how it works. We can work here to build a consistent view of
> > >
> > > - all the places a monitor is required
> > > - what should the plugin model for monitors be
> > > - the flow of control (monitors vs exceptions)
> > > - what extra features may be required, I18N etc.
> > >
> > > I'm going to try a few experiments too to familiarize myself with this
> > > a bit
> > > more.
> > >
> > > Regards
> > >
> > > Simon
> > >
> >
> >
>

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

One more point is to make the CompositeBuilderMonitor a true plugin or an
extension point. So that external implementations can define their own and
use them without modifying tuscany code. As of now the only way i see to
pass in our own monitor is in places like the code below where instead of
null, we pass in our monitor. If there is another way, please let me know.
*
return new CompositeBuilderImpl(assemblyFactory, scaBindingFactory,
intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
null);

*regards

Hasan

On Tue, Apr 8, 2008 at 9:58 AM, Hasan Muhammad <ap...@gmail.com> wrote:

> Hi Simon,
>
> Thank you for the good information. First up i am trying to verify whether
> the schema validation works when we point to our schemas. Can you let me
> know what is a simple error that i can introduce so that i can verify this?
> I tried doing this to my composite file (In block red):
>
>   <component name="MyServiceComponentNew">
>     <implementation.java class="mysca.test.myservice.impl.MyServiceImpl"/>
>     *<binding.ws/>*
>     <property name="location" source="$newLocation"/>
>     <property name="year" source="$newYear"/>
>   </component>
>
> This resulted in the following exception, but i think this is part of the
> validation done by artifact processor and would result even if we comment
> out the schema validation.
>
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> Unexpected <binding> element found. It should appear inside a <service> or
> <reference> element
>     at
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
>     at
> org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
>     at
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
>     at
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
>     at
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
>     at
> org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
>     at
> com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
>     at
> com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
>     at
> com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
>     at
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
>     at
> com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
>     at
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
>     at
> com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
>     at
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
>     at
> com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
>     at
> com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
>     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
>
>
> regards
>
>
> On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
> wrote:
>
> > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com> wrote:
> >
> > > Currently, i see that we have various places where we can plug in
> > > validation
> > > monitoring. Some of the ones that i found are in the
> > > ReallySmallRuntimeBuilder as shown below:
> > >
> > >    public static CompositeBuilder
> > createCompositeBuilder(AssemblyFactory
> > > assemblyFactory,
> > >
> >  SCABindingFactory
> > > scaBindingFactory,
> > >
> > > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > >
> > > InterfaceContractMapper interfaceContractMapper,
> > >
> >  List<PolicySet>
> > > domainPolicySets) {
> > >        return new CompositeBuilderImpl(assemblyFactory,
> > scaBindingFactory,
> > > intentAttachPointTypeFactory, interfaceContractMapper,
> > domainPolicySets,
> > > null);
> > >    }
> > >
> > >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > > assemblyFactory,
> > >            SCABindingFactory scaBindingFactory,
> > >            IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> > >            InterfaceContractMapper interfaceContractMapper,
> > >            List<PolicySet> domainPolicySets) {
> > >        return new DomainWireBuilderImpl(assemblyFactory,
> > > scaBindingFactory,
> > > intentAttachPointTypeFactory, interfaceContractMapper,
> > domainPolicySets,
> > > null);
> > >    }
> > >
> > > Instead of passing null, we can pass in our own CompositeBuildMonitor.
> > Are
> > > these the only places where we need to do this? or are there other
> > places
> > > as
> > > well?
> > >
> > > Hasan
> > >
> >
> > Hi Hasan
> >
> > There are a few places that logically we need to be able to validate
> > input
> > and hence add monitors. The story is changing a little as we are moving
> > toward the new "workspace"  code for managing contributions but
> > logically I
> > would expect to be running validating on at least the following
> >
> > - Contribution processing
> >   - dependency (imports/exports) analysis
> >
> > [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> > - Composite read
> >   - schema compliance
> >
> > [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> > - only appears to be initialized in ReallySmallRuntimeBuilder so need to
> > look at this in context of workspace]
> >   - policy intent matching
> > [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
> >   - extension availability [General artifact processor hierarchy]
> > - Composite resolve
> >   - ensure that artifacts required by the composite are available
> > [General
> > artifact resolver hierarchy]
> > - Composite build
> >   - ensure that the composite is valid and consistent, e.g. unique
> > component names, valid reference targets etc.
> > [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
> >
> > I've noted in the square brackets where this function currently is. Note
> > also that I'm making no comment here about whether the construction of
> > the
> > in-memory composite model is for use purely for contribution processing
> > or
> > is going to activated and started in a runtime. This validation is
> > appropriate in both cases although you may choose to use different
> > monitors
> > in the two cases.
> >
> > So what I suggest as a first step is that you go ahead and change
> > ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl to
> > see
> > how it works. We can work here to build a consistent view of
> >
> > - all the places a monitor is required
> > - what should the plugin model for monitors be
> > - the flow of control (monitors vs exceptions)
> > - what extra features may be required, I18N etc.
> >
> > I'm going to try a few experiments too to familiarize myself with this a
> > bit
> > more.
> >
> > Regards
> >
> > Simon
> >
>
>

Re: How do you plug in validation monitoring?

Posted by Hasan Muhammad <ap...@gmail.com>.
Hi Simon,

Thank you for the good information. First up i am trying to verify whether
the schema validation works when we point to our schemas. Can you let me
know what is a simple error that i can introduce so that i can verify this?
I tried doing this to my composite file (In block red):

  <component name="MyServiceComponentNew">
    <implementation.java class="mysca.test.myservice.impl.MyServiceImpl"/>
    *<binding.ws/>*
    <property name="location" source="$newLocation"/>
    <property name="year" source="$newYear"/>
  </component>

This resulted in the following exception, but i think this is part of the
validation done by artifact processor and would result even if we comment
out the schema validation.

org.apache.tuscany.sca.contribution.service.ContributionReadException:
Unexpected <binding> element found. It should appear inside a <service> or
<reference> element
    at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:373)
    at
org.apache.tuscany.sca.assembly.xml.CompositeProcessor.read(CompositeProcessor.java:75)
    at
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.read(ExtensibleStAXArtifactProcessor.java:83)
    at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.processReadPhase(ContributionServiceImpl.java:475)
    at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.addContribution(ContributionServiceImpl.java:383)
    at
org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl.contribute(ContributionServiceImpl.java:202)
    at
com.ibm.ws.soa.sca.runtime.impl.DomainCompositeHelper.addContribution(DomainCompositeHelper.java:75)
    at
com.ibm.ws.soa.sca.runtime.impl.SCAContainerComponentImpl.startComposite(SCAContainerComponentImpl.java:235)
    at
com.ibm.ws.soa.sca.admin.runtime.tuscany.SCATuscanyRuntimeHandlerImpl.startModule(SCATuscanyRuntimeHandlerImpl.java:125)
    at
com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:349)
    at
com.ibm.ws.soa.sca.admin.runtime.impl.SCARuntimeImpl.start(SCARuntimeImpl.java:446)
    at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:331)
    at
com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:126)
    at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:281)
    at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:768)
    at
com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:348)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)


regards

On Tue, Apr 8, 2008 at 5:56 AM, Simon Laws <si...@googlemail.com>
wrote:

> On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com> wrote:
>
> > Currently, i see that we have various places where we can plug in
> > validation
> > monitoring. Some of the ones that i found are in the
> > ReallySmallRuntimeBuilder as shown below:
> >
> >    public static CompositeBuilder createCompositeBuilder(AssemblyFactory
> > assemblyFactory,
> >
>  SCABindingFactory
> > scaBindingFactory,
> >
> > IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> >
> > InterfaceContractMapper interfaceContractMapper,
> >                                                          List<PolicySet>
> > domainPolicySets) {
> >        return new CompositeBuilderImpl(assemblyFactory,
> scaBindingFactory,
> > intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
> > null);
> >    }
> >
> >    public static DomainBuilder createDomainBuilder(AssemblyFactory
> > assemblyFactory,
> >            SCABindingFactory scaBindingFactory,
> >            IntentAttachPointTypeFactory intentAttachPointTypeFactory,
> >            InterfaceContractMapper interfaceContractMapper,
> >            List<PolicySet> domainPolicySets) {
> >        return new DomainWireBuilderImpl(assemblyFactory,
> > scaBindingFactory,
> > intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
> > null);
> >    }
> >
> > Instead of passing null, we can pass in our own CompositeBuildMonitor.
> Are
> > these the only places where we need to do this? or are there other
> places
> > as
> > well?
> >
> > Hasan
> >
>
> Hi Hasan
>
> There are a few places that logically we need to be able to validate input
> and hence add monitors. The story is changing a little as we are moving
> toward the new "workspace"  code for managing contributions but logically
> I
> would expect to be running validating on at least the following
>
> - Contribution processing
>   - dependency (imports/exports) analysis
>
> [org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
> - Composite read
>   - schema compliance
>
> [org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
> - only appears to be initialized in ReallySmallRuntimeBuilder so need to
> look at this in context of workspace]
>   - policy intent matching
> [org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
>   - extension availability [General artifact processor hierarchy]
> - Composite resolve
>   - ensure that artifacts required by the composite are available [General
> artifact resolver hierarchy]
> - Composite build
>   - ensure that the composite is valid and consistent, e.g. unique
> component names, valid reference targets etc.
> [org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]
>
> I've noted in the square brackets where this function currently is. Note
> also that I'm making no comment here about whether the construction of the
> in-memory composite model is for use purely for contribution processing or
> is going to activated and started in a runtime. This validation is
> appropriate in both cases although you may choose to use different
> monitors
> in the two cases.
>
> So what I suggest as a first step is that you go ahead and change
> ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl to
> see
> how it works. We can work here to build a consistent view of
>
> - all the places a monitor is required
> - what should the plugin model for monitors be
> - the flow of control (monitors vs exceptions)
> - what extra features may be required, I18N etc.
>
> I'm going to try a few experiments too to familiarize myself with this a
> bit
> more.
>
> Regards
>
> Simon
>

Re: How do you plug in validation monitoring?

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <ap...@gmail.com> wrote:

> Currently, i see that we have various places where we can plug in
> validation
> monitoring. Some of the ones that i found are in the
> ReallySmallRuntimeBuilder as shown below:
>
>    public static CompositeBuilder createCompositeBuilder(AssemblyFactory
> assemblyFactory,
>                                                          SCABindingFactory
> scaBindingFactory,
>
> IntentAttachPointTypeFactory intentAttachPointTypeFactory,
>
> InterfaceContractMapper interfaceContractMapper,
>                                                          List<PolicySet>
> domainPolicySets) {
>        return new CompositeBuilderImpl(assemblyFactory, scaBindingFactory,
> intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
> null);
>    }
>
>    public static DomainBuilder createDomainBuilder(AssemblyFactory
> assemblyFactory,
>            SCABindingFactory scaBindingFactory,
>            IntentAttachPointTypeFactory intentAttachPointTypeFactory,
>            InterfaceContractMapper interfaceContractMapper,
>            List<PolicySet> domainPolicySets) {
>        return new DomainWireBuilderImpl(assemblyFactory,
> scaBindingFactory,
> intentAttachPointTypeFactory, interfaceContractMapper, domainPolicySets,
> null);
>    }
>
> Instead of passing null, we can pass in our own CompositeBuildMonitor. Are
> these the only places where we need to do this? or are there other places
> as
> well?
>
> Hasan
>

Hi Hasan

There are a few places that logically we need to be able to validate input
and hence add monitors. The story is changing a little as we are moving
toward the new "workspace"  code for managing contributions but logically I
would expect to be running validating on at least the following

- Contribution processing
   - dependency (imports/exports) analysis
[org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl]
- Composite read
   - schema compliance
[org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory
- only appears to be initialized in ReallySmallRuntimeBuilder so need to
look at this in context of workspace]
   - policy intent matching
[org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor]
   - extension availability [General artifact processor hierarchy]
- Composite resolve
   - ensure that artifacts required by the composite are available [General
artifact resolver hierarchy]
- Composite build
   - ensure that the composite is valid and consistent, e.g. unique
component names, valid reference targets etc.
[org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl]

I've noted in the square brackets where this function currently is. Note
also that I'm making no comment here about whether the construction of the
in-memory composite model is for use purely for contribution processing or
is going to activated and started in a runtime. This validation is
appropriate in both cases although you may choose to use different monitors
in the two cases.

So what I suggest as a first step is that you go ahead and change
ReallySmallRuntimeBuilder to plug a monitor into CompositeBuilderImpl to see
how it works. We can work here to build a consistent view of

- all the places a monitor is required
- what should the plugin model for monitors be
- the flow of control (monitors vs exceptions)
- what extra features may be required, I18N etc.

I'm going to try a few experiments too to familiarize myself with this a bit
more.

Regards

Simon