diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-16 05:42:26 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-16 05:42:26 +0000 |
commit | 4ae4002366ded3f4b19cd96f403d8b418fcf00a1 (patch) | |
tree | 9179891f11c9add734a777713cabf7e39a980908 /java/sca/modules/binding-ejb/src | |
parent | d4cc9a0bdd43477858b8ac67b69a4cdd615ec741 (diff) |
This is to change the Monitor to be request scoped for most of the cases:
Refactor the ArtifactProcessor/ModelResolver to take a ProcessorContext that holds context such as Monitor, Contribution for the contribution/artifact processing methods
Refactor the Builder to take a BuilderContext that holds context such as Monitor, Definitions, Base binding mapping for the building methods
Change the processor/resolver/builder implementation classes to not cache the Monitor
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825773 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-ejb/src')
-rw-r--r-- | java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java index 1c678a05d1..af0eb8ea08 100644 --- a/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java +++ b/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java @@ -30,6 +30,7 @@ import org.apache.tuscany.sca.binding.ejb.EJBBindingFactory; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -59,14 +60,13 @@ import org.apache.tuscany.sca.policy.PolicyFactory; public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { private PolicyFactory policyFactory; private PolicySubjectProcessor policyProcessor; - private Monitor monitor; + private EJBBindingFactory ejbBindingFactory; - public EJBBindingProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { + public EJBBindingProcessor(FactoryExtensionPoint modelFactories) { this.policyFactory = modelFactories.getFactory(PolicyFactory.class); this.ejbBindingFactory = modelFactories.getFactory(EJBBindingFactory.class); this.policyProcessor = new PolicySubjectProcessor(policyFactory); - this.monitor = monitor; } /** @@ -76,7 +76,7 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { * @param message * @param model */ - private void error(String message, Object model, Object... messageParameters) { + private void error(Monitor monitor, String message, Object model, Object... messageParameters) { if (monitor != null) { Problem problem = monitor.createProblem(this.getClass().getName(), "binding-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); monitor.problem(problem); @@ -93,7 +93,7 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { /** * {@inheritDoc} */ - public EJBBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + public EJBBinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { EJBBinding ejbBinding = ejbBindingFactory.createEJBBinding(); // Read the policies @@ -128,7 +128,7 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { } else if (ejbVersion.equals("EJB3")) { ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB3); } else { - error("UnknownEJBVersion", reader, ejbVersion, name); + error(context.getMonitor(), "UnknownEJBVersion", reader, ejbVersion, name); } } @@ -141,7 +141,7 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { return ejbBinding; } - public void write(EJBBinding ejbBinding, XMLStreamWriter writer) throws ContributionWriteException, + public void write(EJBBinding ejbBinding, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { // Write a <binding.ejb> writer.writeStartElement(Constants.SCA11_NS, EJBBinding.BINDING_EJB); @@ -162,6 +162,6 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBinding> { return EJBBinding.class; } - public void resolve(EJBBinding ejbBinding, ModelResolver modelResolver) throws ContributionResolveException { + public void resolve(EJBBinding ejbBinding, ModelResolver modelResolver, ProcessorContext context) throws ContributionResolveException { } } |