diff options
3 files changed, 22 insertions, 3 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java index 8a28efb461..2969e257d6 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java @@ -46,7 +46,7 @@ import org.apache.tuscany.sca.monitor.Monitor; * @version $Rev$ $Date$ */ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<Composite> { - private XMLInputFactory inputFactory; + private ValidatingXMLInputFactory inputFactory; /** @@ -94,6 +94,11 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements monitor.setArtifactName(uri.toString()); } //end if + // set the monitor on the input factory as the standard XMLInputFactory + // methods used for creating readers don't allow for the context to + // be passed in + inputFactory.setMonitor(context.getMonitor()); + XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream); reader.nextTag(); diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java index f1ef36d0f9..a6e7e8b6e3 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java @@ -93,8 +93,6 @@ public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory this.inputFactory = factoryExtensionPoint.getFactory(XMLInputFactory.class); this.documentBuilderFactory = factoryExtensionPoint.getFactory(DocumentBuilderFactory.class); this.schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class); - this.monitor = - registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(MonitorFactory.class).createMonitor(); this.helper = StAXHelper.getInstance(registry); } @@ -109,6 +107,11 @@ public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory this.schemas = schemas; this.monitor = monitor; } + + @Override + public void setMonitor(Monitor monitor) { + this.monitor = monitor; + } /** * Report a exception. diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java index c0eef5a7a8..2446862e07 100644 --- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java +++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java @@ -21,10 +21,21 @@ package org.apache.tuscany.sca.contribution.processor; import javax.xml.stream.XMLInputFactory; +import org.apache.tuscany.sca.monitor.Monitor; + /** * Base marker class for validating XML input factories. * * @version $Rev$ $Date$ */ public abstract class ValidatingXMLInputFactory extends XMLInputFactory { + + /** + * Allows the monitor to be set in lieu of the context being passed + * into the create methods. The base definitions of the create methods + * don't allow for this. + * + * @param monitor the current monitor object + */ + public abstract void setMonitor(Monitor monitor); } |