tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r657881 [2/9] - in /incubator/tuscany/java/sca: modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly-xml/src/main/resources/ modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ modules...
Date Mon, 19 May 2008 17:49:08 GMT
Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java Mon May 19 10:49:04 2008
@@ -1,161 +1,161 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-
-package org.apache.tuscany.sca.assembly.xml; 
-
-import java.net.URI;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Test reading SCA XML assembly documents.
- * 
- * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
- */
-public class ResolvePolicyTestCase extends TestCase {
-
-    private URLArtifactProcessor<Object> documentProcessor;
-    private ModelResolver resolver;  
-    private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
-
-    @Override
-    public void setUp() throws Exception {
-        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-        resolver = new DefaultModelResolver();
-        
-        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-        documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
-        policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
-        
-        // Create StAX processors
-        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
-    }
-
-    public void testResolveConstrainingType() throws Exception {
-        
-        URL url = getClass().getResource("CalculatorComponent.constrainingType");
-        URI uri = URI.create("CalculatorComponent.constrainingType");
-        ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
-        assertNotNull(constrainingType);
-        resolver.addModel(constrainingType);
-
-        url = getClass().getResource("TestAllCalculator.composite");
-        uri = URI.create("TestAllCalculator.constrainingType");
-        Composite composite = (Composite)documentProcessor.read(null, uri, url);
-        assertNotNull(composite);
-        
-        url = getClass().getResource("test_definitions.xml");
-        uri = URI.create("test_definitions.xml");
-        SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
-        assertNotNull(scaDefns);
-        
-        preResolvePolicyTests(composite);
-        documentProcessor.resolve(scaDefns, resolver);
-        documentProcessor.resolve(composite, resolver);
-        postResolvePolicyTests(composite);
-        
-        assertEquals(composite.getConstrainingType(), constrainingType);
-        assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
-    }
-    
-    private void preResolvePolicyTests(Composite composite) {
-        assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
-        assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        
-        assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
-        
-        assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        
-        assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
-        assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
-    }
-    
-    private void postResolvePolicyTests(Composite composite) {
-        assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
-        assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        
-        assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        
-        assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        
-        assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
-        assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
-        assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-        
-        
-    }
-
-    public void testResolveComposite() throws Exception {
-        URL url = getClass().getResource("Calculator.composite");
-        URI uri = URI.create("Calculator.composite");
-        Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
-        assertNotNull(nestedComposite);
-        resolver.addModel(nestedComposite);
-
-        url = getClass().getResource("TestAllCalculator.composite");
-        uri = URI.create("TestAllCalculator.composite");
-        Composite composite = (Composite)documentProcessor.read(null, uri, url);
-        
-        documentProcessor.resolve(composite, resolver);
-        
-        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.assembly.xml; 
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Test reading SCA XML assembly documents.
+ * 
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class ResolvePolicyTestCase extends TestCase {
+
+    private URLArtifactProcessor<Object> documentProcessor;
+    private ModelResolver resolver;  
+    private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+
+    @Override
+    public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        resolver = new DefaultModelResolver();
+        
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+        documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
+        policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
+        
+        // Create StAX processors
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+    }
+
+    public void testResolveConstrainingType() throws Exception {
+        
+        URL url = getClass().getResource("CalculatorComponent.constrainingType");
+        URI uri = URI.create("CalculatorComponent.constrainingType");
+        ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+        assertNotNull(constrainingType);
+        resolver.addModel(constrainingType);
+
+        url = getClass().getResource("TestAllCalculator.composite");
+        uri = URI.create("TestAllCalculator.constrainingType");
+        Composite composite = (Composite)documentProcessor.read(null, uri, url);
+        assertNotNull(composite);
+        
+        url = getClass().getResource("test_definitions.xml");
+        uri = URI.create("test_definitions.xml");
+        SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
+        assertNotNull(scaDefns);
+        
+        preResolvePolicyTests(composite);
+        documentProcessor.resolve(scaDefns, resolver);
+        documentProcessor.resolve(composite, resolver);
+        postResolvePolicyTests(composite);
+        
+        assertEquals(composite.getConstrainingType(), constrainingType);
+        assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+    }
+    
+    private void preResolvePolicyTests(Composite composite) {
+        assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+        assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+    }
+    
+    private void postResolvePolicyTests(Composite composite) {
+        assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+        assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        
+    }
+
+    public void testResolveComposite() throws Exception {
+        URL url = getClass().getResource("Calculator.composite");
+        URI uri = URI.create("Calculator.composite");
+        Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+        assertNotNull(nestedComposite);
+        resolver.addModel(nestedComposite);
+
+        url = getClass().getResource("TestAllCalculator.composite");
+        uri = URI.create("TestAllCalculator.composite");
+        Composite composite = (Composite)documentProcessor.read(null, uri, url);
+        
+        documentProcessor.resolve(composite, resolver);
+        
+        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+    }
+
+}

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java Mon May 19 10:49:04 2008
@@ -66,7 +66,7 @@
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
         resolver = new DefaultModelResolver();
         
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java Mon May 19 10:49:04 2008
@@ -70,7 +70,7 @@
         inputFactory = XMLInputFactory.newInstance();
         outputFactory = XMLOutputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
         resolver = new DefaultModelResolver();
         
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);

Modified: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java Mon May 19 10:49:04 2008
@@ -23,6 +23,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.binding.ejb.EJBBinding;
@@ -33,6 +34,9 @@
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
 import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 /**
  * A processor to read the XML that describes the EJB binding...
@@ -57,11 +61,27 @@
 public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl> {
     private PolicyFactory policyFactory;
     private PolicyAttachPointProcessor policyProcessor;
+    private Monitor monitor;
 
-    public EJBBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public EJBBindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+        this.monitor = monitor;
     }
+    
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+     private void error(String message, Object model, Object... messageParameters) {
+    	 if (monitor != null) {
+    		 Problem problem = new ProblemImpl(this.getClass().getName(), "binding-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+    	     monitor.problem(problem);
+    	 }        
+     }
 
     /**
      * {@inheritDoc}
@@ -108,6 +128,7 @@
             } else if (sessionType.equals("stateful")) {
                 ejbBinding.setSessionType(EJBBinding.SessionType.STATEFUL);
             } else {
+            	error("UnknownEJBSessionType", reader, sessionType, name);            	
                 throw new ContributionReadException("Unknown EJB Session Type of " + sessionType + " for " + name);
             }
         }
@@ -119,6 +140,7 @@
             } else if (ejbVersion.equals("EJB3")) {
                 ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB3);
             } else {
+            	error("UnknownEJBVersion", reader, sessionType, name);
                 throw new ContributionReadException("Unknown EJB Version of " + sessionType + " for " + name);
             }
         }

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties?rev=657881&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties Mon May 19 10:49:04 2008
@@ -0,0 +1,23 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+UnknownEJBSessionType = Unknown EJB Session Type of {0} for {1}
+UnknownEJBVersion = Unknown EJB Version of {0} for {1}
+

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java Mon May 19 10:49:04 2008
@@ -29,6 +29,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor;
@@ -40,6 +41,9 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
 /**
@@ -110,11 +114,41 @@
 
     private PolicyFactory policyFactory;
     private PolicyAttachPointProcessor policyProcessor;
+    private Monitor monitor;
 
-    public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+        this.monitor = monitor;
     }
+    
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+     private void warning(String message, Object model, Object... messageParameters) {
+    	 if (monitor != null) {
+    		 Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+    	     monitor.problem(problem);
+    	 }        
+     }
+     
+     /**
+      * Report a error.
+      * 
+      * @param problems
+      * @param message
+      * @param model
+      */
+      private void error(String message, Object model, Object... messageParameters) {
+     	 if (monitor != null) {
+     		 Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+     	     monitor.problem(problem);
+     	 }        
+      }
 
     public QName getArtifactType() {
         return JMSBindingConstants.BINDING_JMS_QNAME;
@@ -148,6 +182,7 @@
             if (JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
                 jmsBinding.setCorrelationScheme(correlationScheme);
             } else {
+            	error("InvalidCorrelationScheme", reader, correlationScheme);
                 throw new JMSBindingException("invalid correlationScheme: " + correlationScheme);
             }
         }
@@ -214,6 +249,7 @@
                     if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
                         endFound = true;
                     } else {
+                    	error("UnexpectedElement", reader, x.toString());
                         throw new RuntimeException("Incomplete binding.jms definition found unexpected element " + x
                             .toString());
                     }
@@ -227,6 +263,7 @@
 
     protected void parseURI(String uri, JMSBinding jmsBinding) {
         if (!uri.startsWith("jms:")) {
+        	error("MustStartWithSchema", jmsBinding, uri);
             throw new JMSBindingException("uri must start with the scheme 'jms:' for uri: " + uri);
         }
         int i = uri.indexOf('?');
@@ -240,6 +277,7 @@
                 if (s.startsWith("connectionFactoryName=")) {
                     jmsBinding.setConnectionFactoryName(s.substring(22));
                 } else {
+                	error("UnknownTokenInURI", jmsBinding, s, uri);
                     throw new JMSBindingException("unknown token '" + s + "' in uri: " + uri);
                 }
             }
@@ -274,7 +312,8 @@
             } else {
                 throw new RuntimeException("invalid destination type: " + type);
             }
-            System.err.println("JMS Binding doesn't process destination type yet");
+            warning("DoesntProcessDestinationType", jmsBinding);
+            //System.err.println("JMS Binding doesn't process destination type yet");
         }
 
         String create = reader.getAttributeValue(null, "create");
@@ -288,6 +327,7 @@
         if (name != null && name.length() > 0) {
             jmsBinding.setConnectionFactoryName(name);
         } else {
+        	error("MissingConnectionFactoryName", reader);
             throw new RuntimeException("missing connectionFactory name");
         }
     }
@@ -296,8 +336,10 @@
         String name = reader.getAttributeValue(null, "name");
         if (name != null && name.length() > 0) {
             jmsBinding.setActivationSpecName(name);
-            System.err.println("JMS Binding doesn't process activationSpec yet");
+            warning("DoesntProcessActivationSpec", jmsBinding);
+            //System.err.println("JMS Binding doesn't process activationSpec yet");
         } else {
+        	error("MissingActivationSpecName", reader);
             throw new RuntimeException("missing ActivationSpec name");
         }
     }
@@ -315,9 +357,11 @@
             } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
                 jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
             } else {
+            	error("InvalidResponseDestinationType", reader, type);
                 throw new RuntimeException("invalid response destination type: " + type);
             }
-            System.err.println("JMS Binding doesn't process response destination type yet");
+            warning("DoesntProcessResponseDestinationType", jmsBinding);
+            //System.err.println("JMS Binding doesn't process response destination type yet");
         }
 
         String create = reader.getAttributeValue(null, "create");
@@ -330,8 +374,10 @@
         String name = reader.getAttributeValue(null, "name");
         if (name != null && name.length() > 0) {
             jmsBinding.setResponseConnectionFactoryName(name);
-            System.err.println("JMS Binding doesn't process response connectionFactory yet");
+            warning("DoesntProcessResponseConnectionFactory", jmsBinding);
+            //System.err.println("JMS Binding doesn't process response connectionFactory yet");
         } else {
+        	error("MissingResponseConnectionFactory", reader);
             throw new RuntimeException("missing response connectionFactory name");
         }
     }
@@ -340,8 +386,10 @@
         String name = reader.getAttributeValue(null, "name");
         if (name != null && name.length() > 0) {
             jmsBinding.setResponseActivationSpecName(name);
-            System.err.println("JMS Binding doesn't process response activationSpec yet");
+            warning("DoesntProcessResponseActivationSpec", jmsBinding);
+            //System.err.println("JMS Binding doesn't process response activationSpec yet");
         } else {
+        	error("MissingResponseActivationSpec", reader);
             throw new RuntimeException("missing response ActivationSpec name");
         }
     }
@@ -366,8 +414,8 @@
                     if (x.getLocalPart().equals("response")) {
                         return;
                     } else {
-                        throw new RuntimeException(
-                                                   "Incomplete binding.jms/response definition found unexpected element " + x
+                    	error("UnexpectedResponseElement", reader, x.toString());
+                        throw new RuntimeException("Incomplete binding.jms/response definition found unexpected element " + x
                                                        .toString());
                     }
             }
@@ -375,15 +423,18 @@
     }
 
     private void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
-        System.err.println("JMS Binding doesn't process resourceAdapter yet");
+    	warning("DoesntProcessResourceAdapter", jmsBinding);
+        //System.err.println("JMS Binding doesn't process resourceAdapter yet");
     }
 
     private void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
-        System.err.println("JMS Binding doesn't process headers yet");
+    	warning("DoesntProcessHeaders", jmsBinding);
+        //System.err.println("JMS Binding doesn't process headers yet");
     }
 
     private void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
-        System.err.println("JMS Binding doesn't process operationProperties yet");
+    	warning("DoesntProcessOperationProperties", jmsBinding);
+        //System.err.println("JMS Binding doesn't process operationProperties yet");
     }
 
 }

Added: incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties?rev=657881&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties (added)
+++ incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties Mon May 19 10:49:04 2008
@@ -0,0 +1,40 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+DoesntProcessOperationProperties = JMS Binding doesn't process operationProperties yet
+DoesntProcessHeaders = JMS Binding doesn't process headers yet
+DoesntProcessResourceAdapter = JMS Binding doesn't process resourceAdapter yet
+DoesntProcessResponseConnectionFactory = JMS Binding doesn't process response connectionFactory yet
+DoesntProcessResponseActivationSpec = JMS Binding doesn't process response activationSpec yet
+DoesntProcessResponseDestinationType = JMS Binding doesn't process response destination type yet
+DoesntProcessActivationSpec = JMS Binding doesn't process activationSpec yet
+DoesntProcessDestinationType = JMS Binding doesn't process destination type yet
+MissingConnectionFactoryName = Missing ConnectionFactory Name
+MissingResponseConnectionFactory = Missing response connectionFactory name
+InvalidResponseDestinationType = Invalid response destination type: {0}
+MissingActivationSpecName = Missing ActivationSpec Name
+MissingResponseActivationSpec = Missing response ActivationSpec name
+UnknownTokenInURI = Unknown token {0} in uri: {1}
+MustStartWithSchema = URI must start with the scheme 'jms:' for uri: {0}
+InvalidCorrelationScheme = Invalid correlationScheme: {0}
+UnexpectedElement = Incomplete binding.jms definition found unexpected element: {0}
+UnexpectedResponseElement = Incomplete binding.jms/response definition found unexpected element: {0}
+
+

Propchange: incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java Mon May 19 10:49:04 2008
@@ -36,6 +36,7 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
@@ -53,15 +54,17 @@
     private SCABindingFactory scaBindingFactory;
     private PolicyAttachPointProcessor policyProcessor;
     private IntentAttachPointTypeFactory  intentAttachPointTypeFactory;
+    private Monitor monitor;
 
     protected static final String BINDING_SCA = "binding.sca";
     protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
 
-    public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
         policyProcessor = new PolicyAttachPointProcessor(policyFactory);
         this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        this.monitor = monitor;
     }
 
     public QName getArtifactType() {

Modified: incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java Mon May 19 10:49:04 2008
@@ -61,7 +61,7 @@
 
         inputFactory = XMLInputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
 
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); 

Modified: incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java Mon May 19 10:49:04 2008
@@ -51,7 +51,7 @@
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         inputFactory = XMLInputFactory.newInstance();
         outputFactory = XMLOutputFactory.newInstance();
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
     }
 
     public void testReadWriteComponentType() throws Exception {

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java Mon May 19 10:49:04 2008
@@ -62,7 +62,7 @@
         inputFactory = XMLInputFactory.newInstance();
 
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
         
         resolver = new CompositeModelResolver(null, null);
         

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java Mon May 19 10:49:04 2008
@@ -37,9 +37,11 @@
 
 import org.apache.tuscany.sca.assembly.ConfiguredOperation;
 import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
@@ -54,6 +56,9 @@
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
@@ -72,14 +77,44 @@
     private PolicyAttachPointProcessor policyProcessor;
     private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
     private ConfiguredOperationProcessor configuredOperationProcessor;
-
-    public WebServiceBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+    private Monitor monitor;
+    
+    public WebServiceBindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
-        this.wsFactory = modelFactories.getFactory(WebServiceBindingFactory.class);
+        this.wsFactory = new DefaultWebServiceBindingFactory();
         this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
         this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-        this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories);
+        this.monitor = monitor;
+        this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
+    }
+    
+    /**
+     * Report a warning.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void warning(String message, Object model, Object... messageParameters) {
+       if (monitor != null) {
+           Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+                                             monitor.problem(problem);
+       }
+    }
+         
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(String message, Object model, Object... messageParameters) {
+        if (monitor != null) {
+            Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+                                              monitor.problem(problem);
+        }        
     }
 
     public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
@@ -114,6 +149,7 @@
         if (wsdlElement != null) {
             int index = wsdlElement.indexOf('#');
             if (index == -1) {
+            	error("InvalidWsdlElementAttr", reader, wsdlElement);
                 throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
             }
             String namespace = wsdlElement.substring(0, index);
@@ -131,8 +167,8 @@
                 localName = localName.substring("wsdl.port(".length(), localName.length() - 1);
                 int s = localName.indexOf('/');
                 if (s == -1) {
-                    throw new ContributionReadException(
-                                                        "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+                	error("InvalidWsdlElementAttr", reader, wsdlElement);
+                    throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
                 }
                 wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
                 wsBinding.setPortName(localName.substring(s + 1));
@@ -143,8 +179,8 @@
                 localName = localName.substring("wsdl.endpoint(".length(), localName.length() - 1);
                 int s = localName.indexOf('/');
                 if (s == -1) {
-                    throw new ContributionReadException(
-                                                        "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+                	error("InvalidWsdlElementAttr", reader, wsdlElement);
+                    throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
                 }
                 wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
                 wsBinding.setEndpointName(localName.substring(s + 1));
@@ -158,6 +194,7 @@
                 wsdlElementIsBinding = true;
 
             } else {
+            	error("InvalidWsdlElementAttr", reader, wsdlElement);
                 throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
             }
         }
@@ -173,8 +210,8 @@
                 case START_ELEMENT: {
                     if (END_POINT_REFERENCE.equals(reader.getName().getLocalPart())) {
                         if (wsdlElement != null && (wsdlElementIsBinding == null || !wsdlElementIsBinding)) {
-                            throw new ContributionReadException(
-                                                                wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
+                        	error("MustUseWsdlBinding", reader, wsdlElement);
+                            throw new ContributionReadException(wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
                         }
                         wsBinding.setEndPointReference(EndPointReferenceHelper.readEndPointReference(reader));
                     } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
@@ -309,6 +346,7 @@
                 try {
                     wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
                 } catch (InvalidInterfaceException e) {
+                	warning("InvalidInterfaceException", wsdlFactory, model.getName());
                     logger.log(Level.WARNING, "Exception creating interface from WSDL for binding: " + model.getName(), e); 
                 }
                 interfaceContract.setInterface(wsdlInterface);

Added: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties?rev=657881&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties Mon May 19 10:49:04 2008
@@ -0,0 +1,24 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+InvalidWsdlElementAttr = Invalid WebService binding wsdlElement attribute: {0}
+MustUseWsdlBinding = {0} must use wsdl.binding when using wsa:EndpointReference
+InvalidInterfaceException = Exception creating interface from WSDL for binding: {0}
+

Propchange: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java Mon May 19 10:49:04 2008
@@ -60,7 +60,7 @@
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
         
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java Mon May 19 10:49:04 2008
@@ -52,7 +52,7 @@
         inputFactory = XMLInputFactory.newInstance();
         outputFactory = XMLOutputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
     }
 
     public void testReadWriteComponentType() throws Exception {

Modified: incubator/tuscany/java/sca/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java Mon May 19 10:49:04 2008
@@ -27,6 +27,7 @@
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.monitor.Monitor;
 
 /**
  * A URLArtifactProcessor for Groovy scripts
@@ -35,7 +36,7 @@
  */
 public class GroovyArtifactProcessor implements URLArtifactProcessor<GroovyArtifact> {
 
-    public GroovyArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public GroovyArtifactProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
     }
 
     public GroovyArtifact read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java Mon May 19 10:49:04 2008
@@ -48,10 +48,14 @@
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.service.ContributionRepository;
 import org.apache.tuscany.sca.contribution.service.util.FileHelper;
 import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 /**
  * The default implementation of ContributionRepository
@@ -69,6 +73,49 @@
 
     private URI domain;
     private XMLInputFactory factory;
+    private Monitor monitor;
+    
+    /**
+     * Marshals warnings into the monitor
+     * 
+     * @param message
+     * @param model
+     * @param messageParameters
+     */
+    protected void warning(String message, Object model, String... messageParameters) {
+        if (monitor != null){
+            Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+            monitor.problem(problem);
+        }
+    }
+    
+    /**
+     * Marshals errors into the monitor
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+    protected void error(String message, Object model, Object... messageParameters) {
+    	if (monitor != null) {
+	        Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+	        monitor.problem(problem);
+    	}
+    }
+    
+    /**
+     * Marshals exceptions into the monitor
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+    protected void error(String message, Object model, Exception ex) {
+    	if (monitor != null) {
+	        Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, ex);
+	        monitor.problem(problem);
+    	}
+    }
 
     /**
      * Constructor with repository root
@@ -76,8 +123,9 @@
      * @param repository
      * @param factory
      */
-    public ContributionRepositoryImpl(final String repository, XMLInputFactory factory) throws IOException {
-        String root = repository;
+    public ContributionRepositoryImpl(final String repository, XMLInputFactory factory, Monitor monitor) throws IOException {
+        this.monitor = monitor;
+    	String root = repository;
         if (repository == null) {
             root = AccessController.doPrivileged(new PrivilegedAction<String>() {
                 public String run() {
@@ -113,6 +161,7 @@
                 }
             });
         } catch (PrivilegedActionException e) {
+        	error("PrivilegedActionException", rootFile, (IOException)e.getException());
             throw (IOException)e.getException();
         }
             
@@ -123,6 +172,7 @@
             }
         });           
         if (notDirectory) {
+        	error("RootNotDirectory", rootFile, repository);
             throw new IOException("The root is not a directory: " + repository);
         }
         this.factory = factory;
@@ -185,6 +235,7 @@
                 }
             });
         } catch (PrivilegedActionException e) {
+        	error("PrivilegedActionException", location, (IOException)e.getException());
             throw (IOException)e.getException();
         }
         saveMap();
@@ -230,6 +281,7 @@
             return new File(rootFile, location).toURL();
         } catch (MalformedURLException e) {
             // Should not happen
+        	error("MalformedURLException", location, new AssertionError(e));
             throw new AssertionError(e);
         }
     }
@@ -261,6 +313,7 @@
         try {
             is = new FileInputStream(domainFile);
         } catch (FileNotFoundException e) {
+        	warning("DomainFileNotFound", domainFile, domainFile.getAbsolutePath());
             return;
         }
         try {
@@ -307,7 +360,9 @@
             writer.println("</domain>");
             writer.flush();
         } catch (IOException e) {
-            throw new IllegalArgumentException(e);
+        	IllegalArgumentException ae = new IllegalArgumentException(e);
+        	error("IllegalArgumentException", os, ae);
+            throw ae;
         } finally {
             IOHelper.closeQuietly(os);
         }

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java Mon May 19 10:49:04 2008
@@ -37,6 +37,7 @@
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
@@ -58,6 +59,9 @@
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 /**
  * Service interface that manages artifacts contributed to a Tuscany runtime.
@@ -125,6 +129,8 @@
 
     private List policyDefinitions; 
     
+    private Monitor monitor;
+    
     private String COMPOSITE_FILE_EXTN = ".composite";    
 
     public ContributionServiceImpl(ContributionRepository repository,
@@ -138,7 +144,8 @@
                                    AssemblyFactory assemblyFactory,
                                    ContributionFactory contributionFactory,
                                    XMLInputFactory xmlFactory,
-                                   List<SCADefinitions> policyDefinitions) {
+                                   List<SCADefinitions> policyDefinitions,
+                                   Monitor monitor) {
         super();
         this.contributionRepository = repository;
         this.packageProcessor = packageProcessor;
@@ -152,14 +159,29 @@
         this.contributionFactory = contributionFactory;
         this.policyDefinitionsResolver = policyDefinitionsResolver;
         this.policyDefinitions = policyDefinitions;
+        this.monitor = monitor;
+    }
+    
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(String message, Object model, Object... messageParameters) {
+        Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+        monitor.problem(problem);
     }
 
     public Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository)
         throws ContributionException, IOException {
         if (contributionURI == null) {
+        	error("ContributionURINull", contributionURI);
             throw new IllegalArgumentException("URI for the contribution is null");
         }
         if (sourceURL == null) {
+        	error("SourceURLNull", sourceURL);
             throw new IllegalArgumentException("Source URL for the contribution is null");
         }
         return addContribution(contributionURI, sourceURL, null, null, storeInRepository);
@@ -170,9 +192,11 @@
                                    ModelResolver modelResolver,
                                    boolean storeInRepository) throws ContributionException, IOException {
         if (contributionURI == null) {
+        	error("ContributionURINull", contributionURI);
             throw new IllegalArgumentException("URI for the contribution is null");
         }
         if (sourceURL == null) {
+        	error("SourceURLNull", sourceURL);
             throw new IllegalArgumentException("Source URL for the contribution is null");
         }
 
@@ -233,7 +257,7 @@
         Contribution contributionMetadata = contributionFactory.createContribution();
 
         ContributionMetadataDocumentProcessor metadataDocumentProcessor =
-            new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor);
+            new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor, monitor);
         
         final URL[] urls = {sourceURL};
         // Allow access to create classloader. Requires RuntimePermission in security policy.
@@ -294,6 +318,7 @@
                                          boolean storeInRepository) throws IOException, ContributionException {
 
         if (contributionStream == null && sourceURL == null) {
+        	error("ContributionContentNull", contributionStream);
             throw new IllegalArgumentException("The content of the contribution is null.");
         }
 

Added: incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties?rev=657881&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties (added)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties Mon May 19 10:49:04 2008
@@ -0,0 +1,28 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+ContributionURINull =URI for the contribution is null
+SourceURLNull = Source URL for the contribution is null
+ContributionContentNull = The content of the contribution is null
+PrivilegedActionException = Exception occured due to FilePermissions in security policy file
+RootNotDirectory = The root is not a directory {0}
+IllegalArgumentException = IllegalArgumentException occured due to :
+DomainFileNotFound = Domain file "sca-domain.xml" not found ({0})
+MalformedURLException = MalformedURLException occured due to : 
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java Mon May 19 10:49:04 2008
@@ -36,7 +36,7 @@
     @Override
     protected void setUp() throws Exception {
         // create repository (this should re-create the root directory)
-        this.repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance());
+        this.repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance(), null);
         repository.init();
     }
 

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java Mon May 19 10:49:04 2008
@@ -27,6 +27,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.java.JavaExport;
 import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
@@ -35,6 +36,9 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 /**
  * Artifact processor for Java Export
@@ -49,11 +53,27 @@
     private static final String PACKAGE = "package";
     
     private final JavaImportExportFactory factory;
+    private final Monitor monitor;
     
-    public JavaExportProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public JavaExportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         super();
         this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+        this.monitor = monitor;
     }
+    
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+     private void error(String message, Object model, Object... messageParameters) {
+    	 if (monitor != null) {
+	        Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+	        monitor.problem(problem);
+    	 }
+     }
 
     public QName getArtifactType() {
         return EXPORT_JAVA;
@@ -80,6 +100,7 @@
                     if (EXPORT_JAVA.equals(element)) {
                         String packageName = reader.getAttributeValue(null, PACKAGE);
                         if (packageName == null) {
+                        	error("AttributePackageMissing", reader);
                             throw new ContributionReadException("Attribute 'package' is missing");
                         }
                         

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java Mon May 19 10:49:04 2008
@@ -27,6 +27,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.java.JavaImport;
 import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
@@ -35,6 +36,9 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 
 /**
  * Artifact Processor for Java Imports
@@ -50,12 +54,28 @@
     private static final String LOCATION = "location";
     
     private final JavaImportExportFactory factory;
+    private final Monitor monitor;
     
-    public JavaImportProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public JavaImportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         super();
         this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+        this.monitor = monitor;
     }
     
+    /**
+     * Report a error.
+     * 
+     * @param problems
+     * @param message
+     * @param model
+     */
+     private void error(String message, Object model, Object... messageParameters) {
+    	 if (monitor != null) {
+	        Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+	        monitor.problem(problem);
+    	 }
+     }
+    
     public QName getArtifactType() {
         return IMPORT_JAVA;
     }
@@ -81,6 +101,7 @@
                     if (IMPORT_JAVA.equals(element)) {
                         String packageName = reader.getAttributeValue(null, PACKAGE);
                         if (packageName == null) {
+                        	error("AttributePackageMissing", reader);
                             throw new ContributionReadException("Attribute 'package' is missing");
                         }
                         

Added: incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties?rev=657881&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties (added)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties Mon May 19 10:49:04 2008
@@ -0,0 +1,22 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+AttributePackageMissing = Attribute 'package' is missing
+

Propchange: incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java Mon May 19 10:49:04 2008
@@ -57,7 +57,7 @@
         ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
     }
 
     /**

Modified: incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java?rev=657881&r1=657880&r2=657881&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java Mon May 19 10:49:04 2008
@@ -57,7 +57,7 @@
         ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
     }
 
     /**



Mime
View raw message