tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r810726 - in /tuscany/branches/sca-java-1.x: itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ modules/binding-sca-xml/src/main/java/org/...
Date Wed, 02 Sep 2009 22:45:56 GMT
Author: rfeng
Date: Wed Sep  2 22:45:54 2009
New Revision: 810726

URL: http://svn.apache.org/viewvc?rev=810726&view=rev
Log:
Merge from 1.5.1:
1) Fix for TUSCANY-3238
2) Remove calls to XMLStreamWriter.setPrefix() as writeNamespace() invokes it internally (TUSCANY-3212)

Modified:
    tuscany/branches/sca-java-1.x/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java
    tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
    tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
    tuscany/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
    tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
    tuscany/branches/sca-java-1.x/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
    tuscany/branches/sca-java-1.x/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
    tuscany/branches/sca-java-1.x/modules/databinding-jaxb/pom.xml
    tuscany/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
    tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
    tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
    tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
    tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
    tuscany/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
    tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
    tuscany/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
    tuscany/branches/sca-java-1.x/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
    tuscany/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java

Modified: tuscany/branches/sca-java-1.x/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/itest/workspace-manager/src/main/java/org/apache/tuscany/sca/implementation/xyz/ImplementationXYZProcessor.java Wed Sep  2 22:45:54 2009
@@ -28,16 +28,13 @@
 import org.apache.tuscany.sca.artifact.xyz.XYZ;
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Service;
 import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
 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.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
@@ -149,7 +146,6 @@
     public void write(ImplementationXYZ implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
         
         // Write <implementation.xyz> element
-        policyProcessor.writePolicyPrefixes(implementation, writer);
         writer.writeStartElement(IMPLEMENTATION_XYZ.getNamespaceURI(), IMPLEMENTATION_XYZ.getLocalPart());
         policyProcessor.writePolicyAttributes(implementation, writer);
         

Modified: tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.assembly.xml;
@@ -34,8 +34,8 @@
 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.policy.PolicyFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
 
 /**
  * Processor for dealing with  'operation' elements from composite definitions
@@ -43,27 +43,27 @@
  * @version $Rev$ $Date$
  */
 public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
-    
+
     private AssemblyFactory assemblyFactory;
     private PolicyAttachPointProcessor policyProcessor;
     private PolicyFactory policyFactory;
     private Monitor monitor;
-    
+
     public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
         this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
         this.monitor = monitor;
     }
-    
+
     public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         ConfiguredOperation  configuredOp = assemblyFactory.createConfiguredOperation();
-        
+
         //Read an <operation>
         configuredOp.setName(reader.getAttributeValue(null, NAME));
         configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
         configuredOp.setUnresolved(true);
-        
+
         // Read policies
         policyProcessor.readPolicies(configuredOp, reader);
 
@@ -73,15 +73,14 @@
                 break;
             }
         }
-        
+
         return configuredOp;
     }
-    
+
     public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer)
         throws ContributionWriteException, XMLStreamException {
 
         // Write an <operation>
-        policyProcessor.writePolicyPrefixes(configuredOperation, writer);
         writer.writeStartElement(Constants.SCA10_NS, OPERATION);
         policyProcessor.writePolicyAttributes(configuredOperation, writer);
 
@@ -91,15 +90,15 @@
         }
         writer.writeEndElement();
     }
-    
+
     public void resolve(ConfiguredOperation configuredOperation, ModelResolver resolver)
         throws ContributionResolveException {
     }
-    
+
     public QName getArtifactType() {
         return OPERATION_QNAME;
     }
-    
+
     public Class<ConfiguredOperation> getModelType() {
         return ConfiguredOperation.class;
     }

Modified: tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.assembly.xml;
@@ -43,9 +43,9 @@
  * @version $Rev$ $Date$
  */
 public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants {
-    
+
     private PolicyFactory policyFactory;
-    
+
     public PolicyAttachPointProcessor(PolicyFactory policyFactory) {
         this.policyFactory = policyFactory;
     }
@@ -123,7 +123,7 @@
                 policySets.add(policySet);
             }
         }
-        
+
         value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
         if (value != null) {
             List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
@@ -140,7 +140,7 @@
             }
         }
     }
-    
+
     /**
      * Write policies
      * @param attachPoint
@@ -160,15 +160,6 @@
     }
 
     /**
-     * Write policies
-     * @param attachPoint
-     * @return
-     */
-    public void writePolicyPrefixes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
-        writePolicyPrefixes(attachPoint, (Operation)null, writer);
-    }
-
-    /**
      * Write policies associated with an operation
      * @param attachPoint
      * @param operation
@@ -234,14 +225,14 @@
         }
         return new XAttr(Constants.POLICY_SETS, qnames);
     }
-    
+
     public void resolvePolicies(Object attachPoint, ModelResolver resolver) {
         if ( attachPoint instanceof PolicySetAttachPoint ) {
             PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
-            
+
             List<Intent> requiredIntents = new ArrayList<Intent>();
             Intent resolvedIntent = null;
-            
+
             if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) {
                 for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
                     resolvedIntent = resolver.resolveModel(Intent.class, intent);
@@ -250,7 +241,7 @@
                 policySetAttachPoint.getRequiredIntents().clear();
                 policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
             }
-            
+
             if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) {
                 List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
                 PolicySet resolvedPolicySet = null;

Modified: tuscany/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.binding.sca.xml;
@@ -52,21 +52,21 @@
  */
 
 public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
-    
+
     private SCABindingFactory scaBindingFactory;
     private ExtensionFactory extensionFactory;
     private PolicyFactory policyFactory;
     private IntentAttachPointTypeFactory  intentAttachPointTypeFactory;
 
-    private PolicyAttachPointProcessor policyProcessor;    
+    private PolicyAttachPointProcessor policyProcessor;
     private StAXAttributeProcessor<Object> extensionAttributeProcessor;
-    
+
     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,
                                StAXArtifactProcessor extensionProcessor,
                                StAXAttributeProcessor extensionAttributeProcessor,
                                Monitor monitor) {
@@ -74,9 +74,9 @@
         this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-        
+
         this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
-        this.extensionAttributeProcessor = extensionAttributeProcessor;        
+        this.extensionAttributeProcessor = extensionAttributeProcessor;
 
         this.monitor = monitor;
     }
@@ -95,10 +95,10 @@
         bindingType.setName(getArtifactType());
         bindingType.setUnresolved(true);
         ((PolicySetAttachPoint)scaBinding).setType(bindingType);
-        
+
         // Read policies
         policyProcessor.readPolicies(scaBinding, reader);
-        
+
         // Read binding name
         String name = reader.getAttributeValue(null, NAME);
         if (name != null) {
@@ -110,12 +110,12 @@
         if (uri != null) {
             scaBinding.setURI(uri);
         }
-        
+
         // Handle extended attributes
         for (int a = 0; a < reader.getAttributeCount(); a++) {
             QName attributeName = reader.getAttributeName(a);
             if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
-                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && 
+                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
                     (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
                     Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
                     Extension attributeExtension;
@@ -127,7 +127,7 @@
                     scaBinding.getAttributeExtensions().add(attributeExtension);
                 }
             }
-        }        
+        }
 
         // Skip to end element
         while (reader.hasNext()) {
@@ -137,15 +137,14 @@
         }
         return scaBinding;
     }
-    
+
     public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException {
         policyProcessor.resolvePolicies(model, resolver);
-    }    
+    }
 
     public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
 
         // Write <binding.sca>
-        policyProcessor.writePolicyPrefixes(scaBinding, writer);
         writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA);
         policyProcessor.writePolicyAttributes(scaBinding, writer);
 
@@ -153,20 +152,20 @@
         if (scaBinding.getName() != null) {
             writer.writeAttribute(NAME, scaBinding.getName());
         }
-        
+
         // Write binding URI
         if (scaBinding.getURI() != null) {
             writer.writeAttribute(URI, scaBinding.getURI());
         }
-        
+
         // Write extended attributes
         for(Extension extension : scaBinding.getAttributeExtensions()) {
             if(extension.isAttribute()) {
                 extensionAttributeProcessor.write(extension, writer);
             }
-        }         
-        
+        }
+
         writer.writeEndElement();
     }
-    
+
 }

Modified: tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java Wed Sep  2 22:45:54 2009
@@ -43,6 +43,7 @@
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.factory.WSDLFactory;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -55,6 +56,7 @@
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
@@ -246,8 +248,38 @@
                 addDataType(dataTypes, dt4, helpers);
             }
         }
+        // Adding classes referenced by @XmlSeeAlso in the java interface
+        if (intf instanceof JavaInterface) {
+            JavaInterface javaInterface = (JavaInterface)intf;
+            Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN);
+                    addDataType(dataTypes, dt, helpers);
+                }
+            }
+            seeAlso = getSeeAlso(javaInterface.getCallbackClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN);
+                    addDataType(dataTypes, dt, helpers);
+                }
+            }
+        }
         return dataTypes;
     }
+    
+    private static Class<?>[] getSeeAlso(Class<?> interfaze) {
+        if (interfaze == null) {
+            return null;
+        }
+        XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
+        if (seeAlso == null) {
+            return null;
+        } else {
+            return seeAlso.value();
+        }
+    }
 
 
     public Definition generate(Interface interfaze, WSDLDefinition wsdlDefinition) throws WSDLException {

Modified: tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.binding.ws.xml;
@@ -89,9 +89,9 @@
     private ConfiguredOperationProcessor configuredOperationProcessor;
     private StAXAttributeProcessor<Object> extensionAttributeProcessor;
     private Monitor monitor;
-    
+
     public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
-        
+
         this.extensionPoints = extensionPoints;
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
@@ -102,16 +102,16 @@
         this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
         this.monitor = monitor;
         this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
-        
+
         XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
         XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
         StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
         this.extensionAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
     }
-    
+
     /**
      * Report a warning.
-     * 
+     *
      * @param problem
      * @param model
      * @param message data
@@ -122,10 +122,10 @@
            monitor.problem(problem);
        }
     }
-         
+
     /**
      * Report an error.
-     * 
+     *
      * @param problem
      * @param model
      * @param message data
@@ -134,12 +134,12 @@
         if (monitor != null) {
             Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
             monitor.problem(problem);
-        }        
+        }
     }
 
    /**
     * Report an exception.
-    * 
+    *
     * @param problem
     * @param model
     * @param exception
@@ -148,7 +148,7 @@
         if (monitor != null) {
             Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, ex);
             monitor.problem(problem);
-        }        
+        }
     }
 
     public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
@@ -237,12 +237,12 @@
 
         // Read wsdlLocation
         wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
-        
+
         // Handle extended attributes
         for (int a = 0; a < reader.getAttributeCount(); a++) {
             QName attributeName = reader.getAttributeName(a);
             if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI() != WSDLI_NS && attributeName.getNamespaceURI().length() > 0) {
-                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && 
+                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
                     (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
                     Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
                     Extension attributeExtension;
@@ -294,7 +294,6 @@
         XMLStreamException {
 
         // Write a <binding.ws>
-        policyProcessor.writePolicyPrefixes(wsBinding, writer);
         writer.writeStartElement(Constants.SCA10_NS, BINDING_WS);
         policyProcessor.writePolicyAttributes(wsBinding, writer);
 
@@ -361,7 +360,7 @@
                 extensionAttributeProcessor.write(extension, writer);
             }
         }
-        
+
         if (wsBinding.getEndPointReference() != null) {
             EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer);
         }
@@ -370,10 +369,10 @@
     }
 
     public void resolve(WebServiceBinding model, ModelResolver resolver) throws ContributionResolveException {
-        
+
     	if (model == null || !model.isUnresolved())
     		return;
-    		
+
     	WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
         wsdlDefinition.setUnresolved(true);
         wsdlDefinition.setNamespace(model.getNamespace());
@@ -384,7 +383,7 @@
             ContributionResolveException ce = new ContributionResolveException(e.getCause());
             error("ContributionResolveException", wsdlDefinition, ce);
             //throw ce;
-        }                        
+        }
 
         if (resolved != null && !resolved.isUnresolved()) {
             wsdlDefinition.setDefinition(resolved.getDefinition());
@@ -435,8 +434,8 @@
             			ContributionResolveException ce = new ContributionResolveException("WSDL binding operation output name " + operation.getOutput().getName() + " does not match with PortType Definition");
                         error("ContributionResolveException", wsdlDefinition, ce);
             		}
-            	}            	
-            	
+            	}
+
                 WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
                 WSDLInterface wsdlInterface = null;
                 try {
@@ -444,7 +443,7 @@
                     interfaceContract.setInterface(wsdlInterface);
                     model.setBindingInterfaceContract(interfaceContract);
                 } catch (InvalidInterfaceException e) {
-                	warning("InvalidInterfaceException", wsdlFactory, model.getName()); 
+                	warning("InvalidInterfaceException", wsdlFactory, model.getName());
                 }
             }
         }

Modified: tuscany/branches/sca-java-1.x/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java (original)
+++ tuscany/branches/sca-java-1.x/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.contribution.processor.xml;
@@ -60,7 +60,7 @@
         }
 
         this.realReader = realReader;
-        
+
         if (realReader instanceof XMLFragmentStreamReader) {
             ((XMLFragmentStreamReader)realReader).init();
         }
@@ -142,7 +142,11 @@
     }
 
     public String getCharacterEncodingScheme() {
+        if (isDelegating()) {
         return realReader.getCharacterEncodingScheme();
+        } else {
+            return "UTF-8";
+        }
     }
 
     public String getElementText() throws XMLStreamException {
@@ -412,7 +416,7 @@
                     state = STATE_COMPLETED;
                 } else if (!realReader.hasNext()) {
                     state = STATE_COMPLETE_AT_NEXT;
-                } 
+                }
                 if (fragment && returnEvent == END_ELEMENT) {
                     level--;
                     if (level == -1) {

Modified: tuscany/branches/sca-java-1.x/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java Wed Sep  2 22:45:54 2009
@@ -208,7 +208,7 @@
                     break;
                 }
             }
-            writer.setPrefix(prefix, uri);
+            // writer.setPrefix(prefix, uri);
             return prefix;
         }
 
@@ -484,7 +484,7 @@
                             break;
                         }
                     }
-                    writer.setPrefix(prefix, uri);
+                    // writer.setPrefix(prefix, uri);
                     writer.writeNamespace(prefix, uri);
                     return prefix + ":" + qname.getLocalPart();
                 }
@@ -516,7 +516,7 @@
                             break;
                         }
                     }
-                    writer.setPrefix(prefix, uri);
+                    // writer.setPrefix(prefix, uri);
                     writer.writeNamespace(prefix, uri);
                 }
             }

Modified: tuscany/branches/sca-java-1.x/modules/databinding-jaxb/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/databinding-jaxb/pom.xml?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/databinding-jaxb/pom.xml (original)
+++ tuscany/branches/sca-java-1.x/modules/databinding-jaxb/pom.xml Wed Sep  2 22:45:54 2009
@@ -39,13 +39,11 @@
             <artifactId>tuscany-databinding</artifactId>
             <version>1.6-SNAPSHOT</version>
         </dependency>
-        <!-- 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-interface-java-xml</artifactId>
+            <artifactId>tuscany-interface-java</artifactId>
             <version>1.6-SNAPSHOT</version>
         </dependency>
-         -->
         <dependency>
             <groupId>javax.xml.bind</groupId>
             <artifactId>jaxb-api</artifactId>

Modified: tuscany/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java (original)
+++ tuscany/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java Wed Sep  2 22:45:54 2009
@@ -37,6 +37,7 @@
 import javax.xml.bind.annotation.XmlEnum;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.namespace.QName;
 
@@ -47,6 +48,8 @@
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
 
@@ -98,6 +101,18 @@
         return createJAXBContext(dataType);
 
     }
+    
+    private static Class<?>[] getSeeAlso(Class<?> interfaze) {
+        if (interfaze == null) {
+            return null;
+        }
+        XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
+        if (seeAlso == null) {
+            return null;
+        } else {
+            return seeAlso.value();
+        }
+    }
 
     public static JAXBContext createJAXBContext(DataType dataType) throws JAXBException {
         return createJAXBContext(findClasses(dataType));
@@ -298,6 +313,23 @@
     private static List<DataType> getDataTypes(Operation op, boolean useWrapper) {
         List<DataType> dataTypes = new ArrayList<DataType>();
         getDataTypes(dataTypes, op, useWrapper);
+        // Adding classes referenced by @XmlSeeAlso in the java interface
+        Interface interface1 = op.getInterface();
+        if (interface1 instanceof JavaInterface) {
+            JavaInterface javaInterface = (JavaInterface)interface1;
+            Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN));
+                }
+            }
+            seeAlso = getSeeAlso(javaInterface.getCallbackClass());
+            if (seeAlso != null) {
+                for (Class<?> cls : seeAlso) {
+                    dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN));
+                }
+            }
+        }
         return dataTypes;
     }
 

Modified: tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.extension.helper.impl;
@@ -45,7 +45,7 @@
 /**
  * An SCDL ArtifactProcessor which uses the Binding class getters/setters
  * to define the SCDL attributes.
- * 
+ *
  * TODO: merge this with SCDLProcessor
  *
  * @version $Rev$ $Date$
@@ -126,7 +126,7 @@
         //FIXME: none of the attributes of Binding seem to be working with PojoBinding
         // For now at least read the binding URI
         String uri = reader.getAttributeValue(null, "uri");
-        
+
         if (elementTextSetter != null) {
             try {
                 String value = reader.getElementText();
@@ -144,7 +144,7 @@
 
         if (!(impl instanceof Binding)) {
             impl = new PojoBinding(impl);
-            
+
             //FIXME: none of the attributes of Binding seem to be working with PojoBinding
             // For now at least read the binding URI
             if (uri != null) {
@@ -161,8 +161,8 @@
 
         //FIXME: none of the attributes of Binding seem to be working with PojoBinding
         // For now at least write the binding URI
-        
-        // Find a namespace prefix and write the element 
+
+        // Find a namespace prefix and write the element
         String prefix = writer.getPrefix(scdlQName.getNamespaceURI());
         if (prefix == null) {
             NamespaceContext nsc = writer.getNamespaceContext();
@@ -172,9 +172,10 @@
                     break;
                 }
             }
-            writer.setPrefix(prefix, scdlQName.getNamespaceURI());
+            // writer.setPrefix(prefix, scdlQName.getNamespaceURI());
         }
         writer.writeStartElement(scdlQName.getNamespaceURI(), scdlQName.getLocalPart());
+        writer.writeNamespace(prefix, scdlQName.getNamespaceURI());
 
         // Write the binding URI attribute
         String uri;
@@ -186,7 +187,7 @@
         if (uri != null) {
             writer.writeAttribute("uri", uri);
         }
-        
+
         writer.writeEndElement();
 
     }

Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.implementation.java.xml;
@@ -98,10 +98,10 @@
         this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
         this.extensionAttributeProcessor = extensionAttributeProcessor;
     }
-    
+
     /**
      * Report a error.
-     * 
+     *
      * @param problems
      * @param message
      * @param model
@@ -110,12 +110,12 @@
     	 if (monitor != null) {
     		 Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
     	     monitor.problem(problem);
-    	 }        
+    	 }
      }
-     
+
      /**
       * Report a exception.
-      * 
+      *
       * @param problems
       * @param message
       * @param model
@@ -124,32 +124,32 @@
      	 if (monitor != null) {
      		 Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message, ex);
      	     monitor.problem(problem);
-     	 }        
+     	 }
       }
 
     public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
 
         // Read an <implementation.java>
         JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
-        
+
         /*if ( javaImplementation instanceof PolicySetAttachPoint ) {
             IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
             implType.setName(getArtifactType());
             implType.setUnresolved(true);
             ((PolicySetAttachPoint)javaImplementation).setType(implType);
         }*/
-        
+
         javaImplementation.setUnresolved(true);
         javaImplementation.setName(reader.getAttributeValue(null, CLASS));
 
         // Read policies
         policyProcessor.readPolicies(javaImplementation, reader);
-        
+
         // Handle extended attributes
         for (int a = 0; a < reader.getAttributeCount(); a++) {
             QName attributeName = reader.getAttributeName(a);
             if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
-                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && 
+                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
                     (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
                     Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
                     Extension attributeExtension;
@@ -163,7 +163,7 @@
             }
         }
 
-        
+
 
         // read operation elements if exists or skip unto end element
         int event;
@@ -193,7 +193,6 @@
         XMLStreamException {
 
         // Write an <implementation.java>
-        policyProcessor.writePolicyPrefixes(javaImplementation, writer);
         writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
         policyProcessor.writePolicyAttributes(javaImplementation, writer);
 
@@ -207,7 +206,7 @@
                 extensionAttributeProcessor.write(extension, writer);
             }
         }
-        
+
         writer.writeEndElement();
     }
 
@@ -222,8 +221,8 @@
             //throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
         	return;
         }
-        
-        javaImplementation.setJavaClass(javaClass);        
+
+        javaImplementation.setJavaClass(javaClass);
 
         try {
             javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
@@ -233,7 +232,7 @@
             //throw ce;
         	return;
         }
-        
+
         javaImplementation.setUnresolved(false);
         mergeComponentType(resolver, javaImplementation);
 

Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.implementation.java.xml;
@@ -35,7 +35,7 @@
 
 /**
  * Test writing Java implementations.
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class WriteTestCase extends TestCase {
@@ -43,22 +43,24 @@
     private StAXArtifactProcessor<Object> staxProcessor;
     private XMLInputFactory inputFactory;
     private XMLOutputFactory outputFactory;
-    
+
     @Override
     public void setUp() throws Exception {
         DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
         outputFactory = XMLOutputFactory.newInstance();
+        // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
     }
 
     public void testReadWriteComposite() throws Exception {
-        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        InputStream is = getClass().getResourceAsStream("default.composite");
         Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+        System.out.println(new String(bos.toByteArray()));
     }
 
 }

Modified: tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite Wed Sep  2 22:45:54 2009
@@ -7,21 +7,21 @@
  * 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.    
+ * under the License.
 -->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
 	xmlns:calc="http://sample.calculator"
 	requires="cns:tuscanyIntent_1"
 	targetNamespace="http://sample.calculator"
-	xmlns:cns="http://test" 
+	xmlns:cns="http://test"
 	name="Calculator">
 
     <service name="CalculatorService" promote="CalculatorServiceComponent">
@@ -51,16 +51,16 @@
     <component name="DivideServiceComponent">
         <implementation.java class="calculator.DivideServiceImpl"/>
     </component>
-    
+
     <component name="AnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
 		<implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_5">
 			<operation name="add"  requires="cns:tuscanyIntent_6"/>
-		</implementation.java>	
+		</implementation.java>
     </component>
-    
+
     <component name="YetAnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
 		<implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_6.qualified1">
 			<operation name="add"  requires="cns:tuscanyIntent_6.qualified2" policySets="cns:tuscanyPolicySet_4"/>
-		</implementation.java>	
+		</implementation.java>
     </component>
 </composite>

Modified: tuscany/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java Wed Sep  2 22:45:54 2009
@@ -304,7 +304,6 @@
     public void write(JEEImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
         
         // Write <implementation.jee>
-        policyProcessor.writePolicyPrefixes(implementation, writer);
         writeStart(writer, IMPLEMENTATION_JEE.getNamespaceURI(), IMPLEMENTATION_JEE.getLocalPart(),
                    new XAttr("archive", implementation.getArchive()));
         

Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java Wed Sep  2 22:45:54 2009
@@ -1,234 +1,233 @@
-/*
- * 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.implementation.spring.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-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.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
+/*
+ * 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.implementation.spring.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+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.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
+import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+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.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
- * element in an SCA SCDL file.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
-
-    private static final String LOCATION = "location";
-    private static final String IMPLEMENTATION_SPRING = "implementation.spring";
-    private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
-    private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
-
-    private AssemblyFactory assemblyFactory;
-    private JavaInterfaceFactory javaFactory;
-    private PolicyFactory policyFactory;
-    private PolicyAttachPointProcessor policyProcessor;
-    private Monitor monitor;
-
-    private ModelFactoryExtensionPoint factories;
-
-    public SpringImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
-        this.factories = modelFactories;
-        this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
-        this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
-        this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
-        this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
-        this.monitor = monitor;
-    }
-
-    /**
-     * Report a exception.
-     *
-     * @param problems
-     * @param message
-     * @param model
-     */
-    private void error(String message, Object model, Exception ex) {
-    	 if (monitor != null) {
-	        Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
-	        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(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
-	        monitor.problem(problem);
-    	 }
-    }
-
-    /*
-     * Read the XML and parse out the attributes.
-     *
-     * <implementation.spring.../> has a single required attribute:
-     * "location" - which is the target URI of of an archive file or a directory that contains the Spring
-     * application context files.
-     * If the resource identified by the location attribute is an archive file, then the file
-     * META-INF/MANIFEST.MF is read from the archive.
-     * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
-     * underneath that directory.
-     * If the manifest file contains a header "Spring-Context" of the format:
-     *    Spring-Context ::= path ( ';' path )*
-     *
-     * Where path is a relative path with respect to the location URI, then the set of paths
-     * specified in the header identify the context configuration files.
-     * If there is no MANIFEST.MF file or no Spring-Context header within that file,
-     * then the default behaviour is to build an application context using all the *.xml files
-     * in the METAINF/spring directory.
-     */
-    public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
-        // Create the Spring implementation
-        SpringImplementation springImplementation = null;
-
-        // Read the location attribute for the spring implementation
-        String springLocation = reader.getAttributeValue(null, LOCATION);
-        if (springLocation != null) {
-        	springImplementation = new SpringImplementation();
-        	springImplementation.setLocation(springLocation);
-        	springImplementation.setUnresolved(true);
-            processComponentType(springImplementation);
-        } else {
-        	error("LocationAttributeMissing", reader);
-            //throw new ContributionReadException(MSG_LOCATION_MISSING);
-        }
-
-        // Read policies
-        policyProcessor.readPolicies(springImplementation, reader);
-
-        // Skip to end element
-        while (reader.hasNext()) {
-            if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
-                break;
-            }
-        } // end while
-
-        return springImplementation;
-    } // end read
-
-    /*
-     * Handles the component type for the Spring implementation
-     * @param springImplementation - a Spring implementation.  The component type information
-     * is created for this implementation
-     *
-     */
-    private void processComponentType(SpringImplementation springImplementation) {
-
-        // Create a ComponentType and mark it unresolved
-        ComponentType componentType = assemblyFactory.createComponentType();
-        componentType.setUnresolved(true);
-        springImplementation.setComponentType(componentType);
-    } // end processComponentType
-
-    /*
-     * Write out the XML representation of the Spring implementation
-     * <implementation.spring location="..." />
-     */
-    public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
-        // Write <implementation.spring>
-        policyProcessor.writePolicyPrefixes(springImplementation, writer);
-        writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
-        policyProcessor.writePolicyAttributes(springImplementation, writer);
-
-        if (springImplementation.getLocation() != null) {
-            writer.writeAttribute(LOCATION, springImplementation.getLocation());
-        }
-
-        writer.writeEndElement();
-
-    } // end write
-
-    /**
-     * Resolves the Spring implementation - loads the Spring application-context XML and
-     * derives the spring implementation componentType from it
-     */
-    public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
-        throws ContributionResolveException {
-
-    	if (springImplementation == null)
-    		return;
-
-        /* Load the Spring component type by reading the Spring application context */
-        SpringXMLComponentTypeLoader springLoader =
-            new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory);
-        try {
-            // Load the Spring Implementation information from its application context file...
-            springLoader.load(springImplementation, resolver);
-        } catch (ContributionReadException e) {
-        	ContributionResolveException ce = new ContributionResolveException(e);
-        	error("ContributionResolveException", resolver, ce);
-            throw ce;
-        }
-
-        ComponentType ct = springImplementation.getComponentType();
-        if (ct.isUnresolved()) {
-            // If the introspection fails to resolve, try to find a side file...
-            ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
-            if (componentType.isUnresolved()) {
-            	error("UnableToResolveComponentType", resolver);
-                //throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
-            } else {
-                springImplementation.setComponentType(componentType);
-                springImplementation.setUnresolved(false);
-           }
-
-        } // end if
-
-    } // end method resolve
-
-    public QName getArtifactType() {
-        return IMPLEMENTATION_SPRING_QNAME;
-    }
-
-    public Class<SpringImplementation> getModelType() {
-        return SpringImplementation.class;
-    }
-
-} // end class SpringArtifactProcessor
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
+ * element in an SCA SCDL file.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
+
+    private static final String LOCATION = "location";
+    private static final String IMPLEMENTATION_SPRING = "implementation.spring";
+    private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+    private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
+
+    private AssemblyFactory assemblyFactory;
+    private JavaInterfaceFactory javaFactory;
+    private PolicyFactory policyFactory;
+    private PolicyAttachPointProcessor policyProcessor;
+    private Monitor monitor;
+
+    private ModelFactoryExtensionPoint factories;
+
+    public SpringImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+        this.factories = modelFactories;
+        this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+        this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+        this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+        this.monitor = monitor;
+    }
+
+    /**
+     * Report a exception.
+     *
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(String message, Object model, Exception ex) {
+    	 if (monitor != null) {
+	        Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
+	        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(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+	        monitor.problem(problem);
+    	 }
+    }
+
+    /*
+     * Read the XML and parse out the attributes.
+     *
+     * <implementation.spring.../> has a single required attribute:
+     * "location" - which is the target URI of of an archive file or a directory that contains the Spring
+     * application context files.
+     * If the resource identified by the location attribute is an archive file, then the file
+     * META-INF/MANIFEST.MF is read from the archive.
+     * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
+     * underneath that directory.
+     * If the manifest file contains a header "Spring-Context" of the format:
+     *    Spring-Context ::= path ( ';' path )*
+     *
+     * Where path is a relative path with respect to the location URI, then the set of paths
+     * specified in the header identify the context configuration files.
+     * If there is no MANIFEST.MF file or no Spring-Context header within that file,
+     * then the default behaviour is to build an application context using all the *.xml files
+     * in the METAINF/spring directory.
+     */
+    public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+        // Create the Spring implementation
+        SpringImplementation springImplementation = null;
+
+        // Read the location attribute for the spring implementation
+        String springLocation = reader.getAttributeValue(null, LOCATION);
+        if (springLocation != null) {
+        	springImplementation = new SpringImplementation();
+        	springImplementation.setLocation(springLocation);
+        	springImplementation.setUnresolved(true);
+            processComponentType(springImplementation);
+        } else {
+        	error("LocationAttributeMissing", reader);
+            //throw new ContributionReadException(MSG_LOCATION_MISSING);
+        }
+
+        // Read policies
+        policyProcessor.readPolicies(springImplementation, reader);
+
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
+                break;
+            }
+        } // end while
+
+        return springImplementation;
+    } // end read
+
+    /*
+     * Handles the component type for the Spring implementation
+     * @param springImplementation - a Spring implementation.  The component type information
+     * is created for this implementation
+     *
+     */
+    private void processComponentType(SpringImplementation springImplementation) {
+
+        // Create a ComponentType and mark it unresolved
+        ComponentType componentType = assemblyFactory.createComponentType();
+        componentType.setUnresolved(true);
+        springImplementation.setComponentType(componentType);
+    } // end processComponentType
+
+    /*
+     * Write out the XML representation of the Spring implementation
+     * <implementation.spring location="..." />
+     */
+    public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+        // Write <implementation.spring>
+        writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+        policyProcessor.writePolicyAttributes(springImplementation, writer);
+
+        if (springImplementation.getLocation() != null) {
+            writer.writeAttribute(LOCATION, springImplementation.getLocation());
+        }
+
+        writer.writeEndElement();
+
+    } // end write
+
+    /**
+     * Resolves the Spring implementation - loads the Spring application-context XML and
+     * derives the spring implementation componentType from it
+     */
+    public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
+        throws ContributionResolveException {
+
+    	if (springImplementation == null)
+    		return;
+
+        /* Load the Spring component type by reading the Spring application context */
+        SpringXMLComponentTypeLoader springLoader =
+            new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory);
+        try {
+            // Load the Spring Implementation information from its application context file...
+            springLoader.load(springImplementation, resolver);
+        } catch (ContributionReadException e) {
+        	ContributionResolveException ce = new ContributionResolveException(e);
+        	error("ContributionResolveException", resolver, ce);
+            throw ce;
+        }
+
+        ComponentType ct = springImplementation.getComponentType();
+        if (ct.isUnresolved()) {
+            // If the introspection fails to resolve, try to find a side file...
+            ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
+            if (componentType.isUnresolved()) {
+            	error("UnableToResolveComponentType", resolver);
+                //throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
+            } else {
+                springImplementation.setComponentType(componentType);
+                springImplementation.setUnresolved(false);
+           }
+
+        } // end if
+
+    } // end method resolve
+
+    public QName getArtifactType() {
+        return IMPLEMENTATION_SPRING_QNAME;
+    }
+
+    public Class<SpringImplementation> getModelType() {
+        return SpringImplementation.class;
+    }
+
+} // end class SpringArtifactProcessor

Modified: tuscany/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 package org.apache.tuscany.sca.implementation.widget;
 
@@ -43,54 +43,54 @@
 import org.apache.tuscany.sca.monitor.Problem.Severity;
 import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
 
-
 /**
+ *
  * Implements a StAX artifact processor for Widget implementations.
  *
  * @version $Rev$ $Date$
  */
 public class WidgetImplementationProcessor implements StAXArtifactProcessor<WidgetImplementation> {
     private static final QName IMPLEMENTATION_WIDGET = new QName(Constants.SCA10_TUSCANY_NS, "implementation.widget");
-        
+
     private AssemblyFactory assemblyFactory;
     private ContributionFactory contributionFactory;
     private WidgetImplementationFactory implementationFactory;
     private Monitor monitor;
-    
+
     public WidgetImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
     	assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-        implementationFactory = new WidgetImplementationFactory(modelFactories); 
+        implementationFactory = new WidgetImplementationFactory(modelFactories);
         this.monitor = monitor;
     }
-    
+
     /**
      * Report a exception.
-     * 
+     *
      * @param problems
      * @param message
      * @param model
      */
     private void error(String message, Object model, Exception ex) {
     	 if (monitor != null) {
-	        Problem problem = new ProblemImpl(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, ex);
+	        Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, ex);
 	        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(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+            Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
             monitor.problem(problem);
         }
-    }    
+    }
 
     public QName getArtifactType() {
         // Returns the QName of the XML element processed by this processor
@@ -111,7 +111,7 @@
 
         // Read the location attribute specifying the location of the resources
         String location = reader.getAttributeValue(null, "location");
-        if (location != null) {                
+        if (location != null) {
             implementation = implementationFactory.createWidgetImplementation();
             implementation.setLocation(location);
             implementation.setUnresolved(true);
@@ -131,7 +131,7 @@
     }
 
     public void resolve(WidgetImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-        
+
     	if (implementation != null) {
     		// Resolve the resource directory location
             Artifact artifact = contributionFactory.createArtifact();
@@ -139,13 +139,13 @@
             Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
             if (resolved.getLocation() != null) {
                 try {
-                    implementation.setLocationURL(new URL(resolved.getLocation()));                 
-                    
+                    implementation.setLocationURL(new URL(resolved.getLocation()));
+
                     //introspect implementation
-                    WidgetImplementationIntrospector widgetIntrospector = 
+                    WidgetImplementationIntrospector widgetIntrospector =
                     	new WidgetImplementationIntrospector(assemblyFactory, implementation);
                     widgetIntrospector.introspectImplementation();
-                    
+
                     implementation.setUnresolved(false);
                 } catch (IOException e) {
                 	ContributionResolveException ce = new ContributionResolveException(e);
@@ -154,23 +154,22 @@
                 }
             } else {
                 error("CouldNotResolveLocation", resolver, implementation.getLocation());
-                //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());            
+                //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
             }
     	}
     }
 
     public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-        
+
         // Write <implementation.widget>
-        writer.setPrefix("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
         writer.writeStartElement(IMPLEMENTATION_WIDGET.getNamespaceURI(), IMPLEMENTATION_WIDGET.getLocalPart());
         writer.writeNamespace("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
-      
-        
+
+
         if (implementation.getLocation() != null) {
             writer.writeAttribute("location", implementation.getLocation());
         }
-        
+
         writer.writeEndElement();
     }
 }

Modified: tuscany/branches/sca-java-1.x/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 
 package echo.impl;
@@ -91,7 +91,6 @@
     public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException,
         XMLStreamException {
 
-        policyProcessor.writePolicyPrefixes(echoBinding, writer);
         writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart());
         policyProcessor.writePolicyAttributes(echoBinding, writer);
 

Modified: tuscany/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java?rev=810726&r1=810725&r2=810726&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java (original)
+++ tuscany/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java Wed Sep  2 22:45:54 2009
@@ -6,15 +6,15 @@
  * 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.    
+ * under the License.
  */
 package pojo.impl;
 
@@ -48,25 +48,25 @@
 
 /**
  * Implements a STAX based artifact processor for POJO implementations.
- * 
+ *
  * The artifact processor is responsible for processing <implementation.pojo>
  * elements in SCA assembly XML composite files and populating the POJO
  * implementation model, resolving its references to other artifacts in the SCA
- * contribution, and optionally write the model back to SCA assembly XML. 
+ * contribution, and optionally write the model back to SCA assembly XML.
  */
 public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOImplementation> {
     private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo");
-    
+
     private AssemblyFactory assemblyFactory;
     private JavaInterfaceFactory javaFactory;
     private POJOImplementationFactory pojoImplementationFactory;
     private PolicyFactory policyFactory;
     private PolicyAttachPointProcessor policyProcessor;
-    
+
     public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
-        
+
         // Get the assembly and Java interface factories as we'll need them to
-        // create model objects 
+        // create model objects
         assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
         policyFactory = modelFactories.getFactory(PolicyFactory.class);
@@ -85,36 +85,36 @@
     }
 
     public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-    
+
         // Read an <implementation.pojo> element
         POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation();
-        
+
         // Read policies
         policyProcessor.readPolicies(implementation, reader);
-        
+
         // Read the POJO class attribute.
         String className = reader.getAttributeValue(null, "class");
         implementation.setPOJOName(className);
-        
+
         // Mark the POJO model unresolved to track the fact that it's not
         // completely initialized, its class is not loaded yet and services
         // and references not initialized either
         implementation.setUnresolved(true);
-        
+
         // Skip to end element
         while (reader.hasNext()) {
             if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) {
                 break;
             }
         }
-        
+
         return implementation;
     }
 
     public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-        
+
         // Resolve the POJO implementation
-        
+
         // First resolve its class
         ClassReference classReference = new ClassReference(implementation.getPOJOName());
         classReference = resolver.resolveModel(ClassReference.class, classReference);
@@ -123,21 +123,21 @@
             throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
         }
         implementation.setPOJOClass(pojoClass);
-        
+
         // Check to see if we have a .componentType file describing the POJO class
         ComponentType componentType = assemblyFactory.createComponentType();
         componentType.setUnresolved(true);
         componentType.setURI(implementation.getURI() + ".componentType");
         componentType = resolver.resolveModel(ComponentType.class, componentType);
         if (!componentType.isUnresolved()) {
-            
+
             // We have a component type description, merge it into the POJO model
             implementation.getServices().addAll(componentType.getServices());
             implementation.getReferences().addAll(componentType.getReferences());
             implementation.getProperties().addAll(componentType.getProperties());
-            
+
         } else {
-            
+
             // We have no component type description, simply introspect the POJO and
             // create a single Service for it
             Service service = assemblyFactory.createService();
@@ -153,22 +153,21 @@
             service.setInterfaceContract(interfaceContract);
             implementation.getServices().add(service);
         }
-        
+
         // Mark the implementation resolved now
         implementation.setUnresolved(false);
     }
 
     public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-        
+
         // Write <implementation.pojo> element
-        policyProcessor.writePolicyPrefixes(implementation, writer);
         writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart());
         policyProcessor.writePolicyAttributes(implementation, writer);
-        
+
         if (implementation.getPOJOName() != null) {
             writer.writeAttribute("class", implementation.getPOJOName());
         }
-        
+
         writer.writeEndElement();
     }
 }



Mime
View raw message