tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r828119 - in /tuscany/java/sca/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ contr...
Date Wed, 21 Oct 2009 18:00:08 GMT
Author: rfeng
Date: Wed Oct 21 18:00:07 2009
New Revision: 828119

URL: http://svn.apache.org/viewvc?rev=828119&view=rev
Log:
Set the monitor to ValidatingXMLStreamReader

Modified:
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefinitionsDocumentProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
    tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
    tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
    tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
    tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
    tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
    tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java
    tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/DefaultMonitorFactory.java
    tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
Wed Oct 21 18:00:07 2009
@@ -24,7 +24,6 @@
 import java.net.URI;
 import java.net.URL;
 
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
@@ -46,7 +45,7 @@
  * @version $Rev$ $Date$
  */
 public class ComponentTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ComponentType>
{
-    private XMLInputFactory inputFactory;
+    private ValidatingXMLInputFactory inputFactory;
     
     /**
      * Constructs a new componentType processor.
@@ -67,6 +66,7 @@
             // Create a stream reader
             urlStream = IOHelper.openStream(url);
             XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+            ValidatingXMLInputFactory.setMonitor(reader, monitor);
             reader.nextTag();
             
             // Reader the componentType model 

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
Wed Oct 21 18:00:07 2009
@@ -24,7 +24,6 @@
 import java.net.URI;
 import java.net.URL;
 
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
@@ -94,12 +93,11 @@
             	monitor.setArtifactName(uri.toString());
             } //end if
             
+            XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
             // 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);
+            ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
             
             reader.nextTag();
             

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefinitionsDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefinitionsDocumentProcessor.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefinitionsDocumentProcessor.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefinitionsDocumentProcessor.java
Wed Oct 21 18:00:07 2009
@@ -113,7 +113,7 @@
 
             //urlStream = createInputStream(url);
             XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
-
+            ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
             Definitions definitions = definitionsFactory.createDefinitions();
             int event = reader.getEventType();
             while (reader.hasNext()) {

Modified: tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
Wed Oct 21 18:00:07 2009
@@ -47,6 +47,7 @@
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.core.DefaultFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.xml.sax.InputSource;
@@ -129,7 +130,7 @@
 
         ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
         schemas.addSchema(getClass().getClassLoader().getResource(TUSCANY_11_XSD).toString());
-        XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory,
schemas, null);
+        XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory,
schemas);
         DefaultFactoryExtensionPoint factories = new DefaultFactoryExtensionPoint(new DefaultExtensionPointRegistry());
         factories.addFactory(validatingInputFactory);
 
@@ -155,10 +156,11 @@
     @Test
     public void testReadBinding() throws Exception {
 
+        ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
         ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
         schemas.addSchema(getClass().getClassLoader().getResource(TUSCANY_11_XSD).toString());
-        XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory,
schemas, null);
-        DefaultFactoryExtensionPoint factories = new DefaultFactoryExtensionPoint(new DefaultExtensionPointRegistry());
+        XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory,
schemas);
+        DefaultFactoryExtensionPoint factories = new DefaultFactoryExtensionPoint(registry);
         factories.addFactory(validatingInputFactory);
         CompositeDocumentProcessor compositeDocumentProcessor =
             new CompositeDocumentProcessor(factories, staxProcessor);

Modified: tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
Wed Oct 21 18:00:07 2009
@@ -24,7 +24,6 @@
 import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
 
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
@@ -74,7 +73,7 @@
         "</composite>";
     
     
-    private XMLInputFactory inputFactory;
+    private ValidatingXMLInputFactory inputFactory;
     private ExtensibleStAXArtifactProcessor staxProcessor;
     private ProcessorContext context;
 
@@ -97,6 +96,7 @@
     @Test
     public void testReadWriteExtendedRecursiveElement() throws Exception {
         XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_RECURSIVE_EXTENDED_ELEMENT));
+        ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
         Composite composite = (Composite)staxProcessor.read(reader, context);
         assertNotNull(composite);
         reader.close();

Modified: tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
(original)
+++ tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
Wed Oct 21 18:00:07 2009
@@ -61,8 +61,6 @@
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSInput;
@@ -82,7 +80,7 @@
     private DocumentBuilderFactory documentBuilderFactory;
     private DOMImplementationLS ls;
     private ValidationSchemaExtensionPoint schemas;
-    private Monitor monitor;
+    private MonitorFactory monitorFactory;
     private boolean initialized;
     private boolean hasSchemas;
     private Schema aggregatedSchema;
@@ -93,6 +91,8 @@
         this.inputFactory = factoryExtensionPoint.getFactory(XMLInputFactory.class);
         this.documentBuilderFactory = factoryExtensionPoint.getFactory(DocumentBuilderFactory.class);
         this.schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
+        this.monitorFactory =
+            registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(MonitorFactory.class);
         this.helper = StAXHelper.getInstance(registry);
     }
 
@@ -102,16 +102,11 @@
      * @param inputFactory
      * @param schemas
      */
-    public DefaultValidatingXMLInputFactory(XMLInputFactory inputFactory, ValidationSchemaExtensionPoint
schemas, Monitor monitor) {
+    public DefaultValidatingXMLInputFactory(XMLInputFactory inputFactory, ValidationSchemaExtensionPoint
schemas) {
         this.inputFactory = inputFactory;
         this.schemas = schemas;
-        this.monitor = monitor;
     }
     
-    @Override
-    public void setMonitor(Monitor monitor) {
-        this.monitor = monitor;
-    }
 
     /**
      * Report a exception.
@@ -120,30 +115,12 @@
      * @param message
      * @param model
      */
-    private void error(String message, Object model, Throwable ex) {
-        if (monitor != null) {
-            Problem problem =
-                monitor.createProblem(this.getClass().getName(),
-                                      "contribution-validation-messages",
-                                      Severity.ERROR,
-                                      model,
-                                      message,
-                                      ex);
-            monitor.problem(problem);
-        }
+    private void error(Monitor monitor, String message, Object model, Throwable ex) {
+        Monitor.error(monitor, this, "contribution-validation-messages", message, ex);
     }
 
-    private void warn(String message, Object model, Throwable ex) {
-        if (monitor != null) {
-            Problem problem =
-                monitor.createProblem(this.getClass().getName(),
-                                      "contribution-validation-messages",
-                                      Severity.WARNING,
-                                      model,
-                                      message,
-                                      ex);
-            monitor.problem(problem);
-        }
+    private void warn(Monitor monitor, String message, Object model, Throwable ex) {
+        Monitor.warning(monitor, this, "contribution-validation-messages", message, ex);
     }
     
     public static final QName XSD = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
@@ -187,8 +164,9 @@
     /**
      * Initialize the registered schemas and create an aggregated schema for
      * validation.
+     * @param monitor TODO
      */
-    private synchronized void initializeSchemas() {
+    private synchronized void initializeSchemas(Monitor monitor) {
         if (initialized) {
             return;
         }
@@ -231,7 +209,7 @@
                     }
                 });
             } catch (PrivilegedActionException e) {
-            	warn("PrivilegedActionException", schemaFactory, (SAXException)e.getException());
+            	warn(monitor, "PrivilegedActionException", schemaFactory, (SAXException)e.getException());
             	hasSchemas = false;
                 throw (SAXException)e.getException();
             }
@@ -242,7 +220,7 @@
 //            throw ie;
         } catch (Throwable e) {
             //FIXME Log this, some old JDKs don't support XMLSchema validation
-            warn(e.getMessage(), schemas, e);
+            warn(monitor, e.getMessage(), schemas, e);
             hasSchemas = false;
         }
     }
@@ -294,7 +272,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(InputStream arg0, String arg1) throws XMLStreamException
{
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0,
arg1), aggregatedSchema, monitor);
         }else {
@@ -304,7 +283,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(InputStream arg0) throws XMLStreamException
{
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0),
aggregatedSchema, monitor);
         } else {
@@ -314,7 +294,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(Reader arg0) throws XMLStreamException {
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0),
aggregatedSchema, monitor);
         } else {
@@ -324,7 +305,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(Source arg0) throws XMLStreamException {
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0),
aggregatedSchema, monitor);
         } else {
@@ -334,7 +316,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(String arg0, InputStream arg1) throws XMLStreamException
{
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0,
arg1), aggregatedSchema, monitor);
         } else {
@@ -344,7 +327,8 @@
 
     @Override
     public XMLStreamReader createXMLStreamReader(String arg0, Reader arg1) throws XMLStreamException
{
-        initializeSchemas();
+        Monitor monitor = monitorFactory.getContextMonitor();
+        initializeSchemas(monitor);
         if (hasSchemas) {
             return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0,
arg1), aggregatedSchema, monitor);
         } else {

Modified: tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
(original)
+++ tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
Wed Oct 21 18:00:07 2009
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.contribution.processor;
 
 import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.monitor.Monitor;
 
@@ -35,7 +36,12 @@
      * into the create methods. The base definitions of the create methods 
      * don't allow for this. 
      * 
+     * @param reader the XMLStreamReader instance
      * @param monitor the current monitor object
      */
-    public abstract void setMonitor(Monitor monitor);
+    public static void setMonitor(XMLStreamReader reader, Monitor monitor) {
+        if (reader instanceof ValidatingXMLStreamReader) {
+            ((ValidatingXMLStreamReader)reader).setMonitor(monitor);
+        }
+    }
 }

Modified: tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
(original)
+++ tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
Wed Oct 21 18:00:07 2009
@@ -51,7 +51,8 @@
     private static final Logger logger = Logger.getLogger(ValidatingXMLStreamReader.class.getName());
     
     private ValidatorHandler handler;
-    private final Monitor monitor;
+    private Schema schema;
+    private Monitor monitor;
     
     /**
      * Constructs a new ValidatingXMLStreamReader.
@@ -63,10 +64,16 @@
     ValidatingXMLStreamReader(XMLStreamReader reader, Schema schema, Monitor monitor) throws
XMLStreamException {
         super(reader);
         this.monitor = monitor;
-        if (schema == null) {
-            return;
+    }
+    
+    void setMonitor(Monitor monitor) {
+        this.monitor = monitor;
+    }
+
+    private synchronized ValidatorHandler getHandler() throws XMLStreamException {
+        if (schema == null || handler!=null) {
+            return handler;
         }
-        
         handler = schema.newValidatorHandler();
         handler.setDocumentLocator(new LocatorAdapter());
         try {
@@ -117,6 +124,7 @@
             	return artifactName;
             }
         });
+        return handler;
     }
     
     /**
@@ -149,7 +157,7 @@
 
     @Override
     public int next() throws XMLStreamException {
-        if (handler == null) {
+        if (getHandler() == null) {
             return super.next();
         }
 
@@ -197,7 +205,7 @@
     
     @Override
     public int nextTag() throws XMLStreamException {
-        if (handler == null) {
+        if (getHandler() == null) {
             return super.nextTag();
         }
         while (true) {
@@ -232,7 +240,7 @@
     
     @Override
     public String getElementText() throws XMLStreamException {
-        if (handler == null) {
+        if (getHandler() == null) {
             return super.getElementText();
         }
 

Modified: tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
(original)
+++ tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
Wed Oct 21 18:00:07 2009
@@ -77,6 +77,8 @@
             // Create a stream reader
             urlStream = IOHelper.openStream(url);
             XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+            ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
+
             reader.nextTag();
 
             // Read the contribution model

Modified: tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java
(original)
+++ tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java
Wed Oct 21 18:00:07 2009
@@ -70,6 +70,7 @@
         }
         try {
             XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+            ValidatingXMLInputFactory.setMonitor(reader, context.getMonitor());
             Object result = extensionProcessor.read(reader, context);
             return (ServiceDescriptions)result;
         } catch (XMLStreamException e) {

Modified: tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/DefaultMonitorFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/DefaultMonitorFactory.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/DefaultMonitorFactory.java
(original)
+++ tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/DefaultMonitorFactory.java
Wed Oct 21 18:00:07 2009
@@ -46,11 +46,15 @@
         return monitor;
     }
 
-    public void removeContextMonitor() {
+    public Monitor removeContextMonitor() {
+        Monitor old = contextMonitor.get();
         contextMonitor.remove();
+        return old;
     }
 
-    public void setContextMonitor(Monitor value) {
+    public Monitor setContextMonitor(Monitor value) {
+        Monitor old = contextMonitor.get();
         contextMonitor.set(value);
+        return old;
     }
 }

Modified: tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
(original)
+++ tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
Wed Oct 21 18:00:07 2009
@@ -48,12 +48,14 @@
 
     /**
      * Remove the monitor on the thread
+     * @return The existing instance
      */
-    void removeContextMonitor();
+    Monitor removeContextMonitor();
 
     /**
      * Set the monitor onto the thread
-     * @param value
+     * @param value The new instance
+     * @return The old instance
      */
-    void setContextMonitor(Monitor monitor);
+    Monitor setContextMonitor(Monitor monitor);
 }

Modified: tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=828119&r1=828118&r2=828119&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
(original)
+++ tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Wed Oct 21 18:00:07 2009
@@ -124,16 +124,22 @@
         this.compositeActivator = utilities.getUtility(CompositeActivator.class);
         try {
             Monitor monitor = manager.monitorFactory.createMonitor();
-            monitor.reset();
-            
             ProcessorContext context = new ProcessorContext(monitor);
             
-            if (contributions == null) {
-                contributions = manager.loadContributions(configuration, context);
+            // Set up the thead context monitor
+            Monitor tcm = manager.monitorFactory.setContextMonitor(monitor);
+            try {
+                if (contributions == null) {
+                    contributions = manager.loadContributions(configuration, context);
+                }
+                domainComposite = manager.configureNode(configuration, contributions, context);
+
+                this.compositeContext =
+                    new CompositeContextImpl(manager.extensionPoints, endpointRegistry, domainComposite);
+            } finally {
+                // Reset the thread context monitor
+                manager.monitorFactory.setContextMonitor(tcm);
             }
-            domainComposite = manager.configureNode(configuration, contributions, context);
-            
-            this.compositeContext = new CompositeContextImpl(manager.extensionPoints, endpointRegistry,
domainComposite);
             
             // Activate the composite
             compositeActivator.activate(compositeContext, domainComposite);



Mime
View raw message