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 <[EMAIL PROTECTED]> 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 <[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 > > > > > > > >