On Tue, Apr 8, 2008 at 2:58 PM, Hasan Muhammad <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > wrote: > > > On Mon, Apr 7, 2008 at 4:33 PM, Hasan Muhammad <[EMAIL PROTECTED]> 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