tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r660340 [1/4] - in /incubator/tuscany/java/sca: itest/databindings/common/src/main/resources/xsd/ itest/wsdlless/src/main/java/bigbank/account/services/accountdata/ modules/ modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly...
Date Tue, 27 May 2008 00:09:11 GMT
Author: nash
Date: Mon May 26 17:08:32 2008
New Revision: 660340

URL: http://svn.apache.org/viewvc?rev=660340&view=rev
Log:
Add SDO support and some fixes to the new Java2WSDL generator, and enable it by default

Added:
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java
    incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/JAXBTypeHelper.java
    incubator/tuscany/java/sca/modules/xsd/
    incubator/tuscany/java/sca/modules/xsd-xml/
    incubator/tuscany/java/sca/modules/xsd-xml/pom.xml
    incubator/tuscany/java/sca/modules/xsd-xml/src/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/resources/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/resources/META-INF/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/resources/META-INF/services/
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
    incubator/tuscany/java/sca/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessorTestCase.java
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/resources/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/resources/xsd/
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/resources/xsd/greeting.xsd
    incubator/tuscany/java/sca/modules/xsd-xml/src/test/resources/xsd/name.xsd
    incubator/tuscany/java/sca/modules/xsd/pom.xml
    incubator/tuscany/java/sca/modules/xsd/src/
    incubator/tuscany/java/sca/modules/xsd/src/main/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/DefaultXSDFactory.java
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDFactory.java
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDefinition.java
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDFactoryImpl.java
    incubator/tuscany/java/sca/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDefinitionImpl.java
    incubator/tuscany/java/sca/modules/xsd/src/main/resources/
    incubator/tuscany/java/sca/modules/xsd/src/main/resources/META-INF/
    incubator/tuscany/java/sca/modules/xsd/src/main/resources/META-INF/services/
    incubator/tuscany/java/sca/modules/xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.xsd.XSDFactory
Removed:
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelper.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessorTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java
Modified:
    incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
    incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
    incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
    incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
    incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
    incubator/tuscany/java/sca/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java
    incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
    incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
    incubator/tuscany/java/sca/modules/databinding/pom.xml
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
    incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/pom.xml
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl/pom.xml
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
    incubator/tuscany/java/sca/modules/pom.xml

Modified: incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd (original)
+++ incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd Mon May 26 17:08:32 2008
@@ -32,5 +32,5 @@
     </sequence>
   </complexType>
 
-  <element name="SimpleTypeWithExtendedInstanceClass" type="SimpleTypeWithExtendedInstanceClassComplexType">
+  <element name="SimpleTypeWithExtendedInstanceClass" type="SimpleTypeWithExtendedInstanceClassComplexType"/>
 </schema>

Modified: incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd (original)
+++ incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd Mon May 26 17:08:32 2008
@@ -33,5 +33,5 @@
     </sequence>
   </complexType>
 
-  <element name="SimpleTypeWithInstanceClass" type="SimpleTypeWithInstanceClassComplexType">
+  <element name="SimpleTypeWithInstanceClass" type="SimpleTypeWithInstanceClassComplexType"/>
 </schema>

Modified: incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd (original)
+++ incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd Mon May 26 17:08:32 2008
@@ -33,5 +33,5 @@
     </sequence>
   </complexType>
 
-  <element name="SimpleTypeWithList" type="SimpleTypeWithListComplexType">
+  <element name="SimpleTypeWithList" type="SimpleTypeWithListComplexType"/>
 </schema>

Modified: incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd (original)
+++ incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd Mon May 26 17:08:32 2008
@@ -42,5 +42,5 @@
     </sequence>
   </complexType>
 
-  <element name="SimpleTypeWithUnion" type="SimpleTypeWithUnionComplexType">
+  <element name="SimpleTypeWithUnion" type="SimpleTypeWithUnionComplexType"/>
 </schema>

Modified: incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd (original)
+++ incubator/tuscany/java/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd Mon May 26 17:08:32 2008
@@ -34,5 +34,5 @@
     </sequence>
   </complexType>
 
-  <element name="SimpleTypeWithoutName" type="SimpleTypeWithoutNameComplexType">
+  <element name="SimpleTypeWithoutName" type="SimpleTypeWithoutNameComplexType"/>
 </schema>

Modified: incubator/tuscany/java/sca/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java (original)
+++ incubator/tuscany/java/sca/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java Mon May 26 17:08:32 2008
@@ -18,11 +18,13 @@
  */
 package bigbank.account.services.accountdata;
 
+import javax.jws.WebService;
 import org.osoa.sca.annotations.AllowsPassByReference;
 import org.osoa.sca.annotations.Remotable;
 
 @Remotable
 @AllowsPassByReference
+@WebService(targetNamespace="http://www.bigbank.com/account")
 public interface AccountDataService {
 
     /**

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java Mon May 26 17:08:32 2008
@@ -60,6 +60,7 @@
 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.resolver.ResolverExtension;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
@@ -912,6 +913,20 @@
                 }
             
             }
+
+            //add model resolver to component
+            if (component instanceof ResolverExtension) {
+                ((ResolverExtension)component).setModelResolver(resolver);
+            }
+        }
+
+        // Add model resolver to promoted components
+        for (Service service : composite.getServices()) {
+            CompositeService compositeService = (CompositeService)service;
+            Component promotedComponent = compositeService.getPromotedComponent();
+            if (promotedComponent instanceof ResolverExtension) {
+                ((ResolverExtension)promotedComponent).setModelResolver(resolver);
+            }
         }
     }
     

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java Mon May 26 17:08:32 2008
@@ -1,78 +1,81 @@
-/*
- * 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.binding.sca.axis2.impl;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.node.spi.NodeFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The factory for the Axis2 based implementation of the distributed sca binding
- * 
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
-    
-    private MessageFactory messageFactory;
-    private ServletHost servletHost;
-    private NodeFactory nodeFactory = null;
-    private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
-
-
-    public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
-        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
-        this.servletHost = servletHosts.getServletHosts().get(0);
-        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-        this.messageFactory = modelFactories.getFactory(MessageFactory.class);
-        nodeFactory = modelFactories.getFactory(NodeFactory.class);
-        policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
-    }    
-
-    public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
-                                                                   RuntimeComponentReference reference,
-                                                                   DistributedSCABinding binding) {
-        return new Axis2SCAReferenceBindingProvider(nodeFactory, component, reference, binding, servletHost, messageFactory, policyHandlerClassnames);
-    }
-
-    public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
-                                                               RuntimeComponentService service,
-                                                               DistributedSCABinding binding) {
-        return new Axis2SCAServiceBindingProvider(nodeFactory, component, service, binding, servletHost, messageFactory, policyHandlerClassnames);
-    }
-
-    public Class<DistributedSCABinding> getModelType() {
-        return DistributedSCABinding.class;
-    }  
-}
+/*
+ * 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.binding.sca.axis2.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.node.spi.NodeFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The factory for the Axis2 based implementation of the distributed sca binding
+ * 
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
+    
+    private ModelFactoryExtensionPoint modelFactories;
+    private ServletHost servletHost;
+    private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+    private DataBindingExtensionPoint dataBindings;
+
+    public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+        servletHost = servletHosts.getServletHosts().get(0);
+        modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+        dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+    }    
+
+    public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+                                                                   RuntimeComponentReference reference,
+                                                                   DistributedSCABinding binding) {
+        return new Axis2SCAReferenceBindingProvider(component, reference, binding,
+                                                    servletHost, modelFactories,
+                                                    policyHandlerClassnames, dataBindings);
+    }
+
+    public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+                                                               RuntimeComponentService service,
+                                                               DistributedSCABinding binding) {
+        return new Axis2SCAServiceBindingProvider(component, service, binding,
+                                                  servletHost, modelFactories,
+                                                  policyHandlerClassnames, dataBindings);
+    }
+
+    public Class<DistributedSCABinding> getModelType() {
+        return DistributedSCABinding.class;
+    }  
+}

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java Mon May 26 17:08:32 2008
@@ -28,14 +28,19 @@
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
 import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -45,6 +50,7 @@
 import org.apache.tuscany.sca.runtime.EndpointReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.xsd.XSDFactory;
 
 /**
  * The reference binding provider for the remote sca binding implementation. Relies on the 
@@ -67,24 +73,30 @@
     private EndpointReference serviceEPR = null;
     private EndpointReference callbackEPR = null;
 
-    public Axis2SCAReferenceBindingProvider(NodeFactory nodeFactory,
-    		                            RuntimeComponent component,
+    public Axis2SCAReferenceBindingProvider(RuntimeComponent component,
                                             RuntimeComponentReference reference,
                                             DistributedSCABinding binding,
                                             ServletHost servletHost,
-                                            MessageFactory messageFactory,
-                                            Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
-    	this.nodeFactory = nodeFactory;
+                                            ModelFactoryExtensionPoint modelFactories,
+                                            Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames,
+                                            DataBindingExtensionPoint dataBindings) {
+
+        WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
+
+        this.nodeFactory = modelFactories.getFactory(NodeFactory.class);
         this.component = component;
         this.reference = reference;
         this.binding = binding.getSCABinding();
-        //FIXME fix that hack, shouldn't create a new instance of the binding factory here 
-        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+        wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
        
         // Turn the java interface contract into a WSDL interface contract
         InterfaceContract contract = reference.getInterfaceContract();
         if ((contract instanceof JavaInterfaceContract)) {
-            contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+            ModelResolver resolver = component instanceof ResolverExtension ?
+                                         ((ResolverExtension)component).getModelResolver() : null;
+            contract = Java2WSDLHelper.createWSDLInterfaceContract(
+                           (JavaInterfaceContract)contract, resolver, dataBindings, wsdlFactory, xsdFactory);
         }
         
         // Set to use the Axiom data binding
@@ -97,8 +109,9 @@
                                                                          reference,
                                                                          wsBinding,
                                                                          servletHost,
-                                                                         messageFactory,
-                                                                         policyHandlerClassnames);
+                                                                         modelFactories,
+                                                                         policyHandlerClassnames,
+                                                                         dataBindings);
     }
 
     public InterfaceContract getBindingInterfaceContract() {

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java Mon May 26 17:08:32 2008
@@ -26,12 +26,17 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.node.spi.NodeFactory;
@@ -39,6 +44,7 @@
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.xsd.XSDFactory;
 
 /**
  * The service binding provider for the remote sca binding implementation. Relies on the 
@@ -58,22 +64,29 @@
     private boolean started = false;
 
 
-    public Axis2SCAServiceBindingProvider(NodeFactory nodeFactory,
-    		                          RuntimeComponent component,
+    public Axis2SCAServiceBindingProvider(RuntimeComponent component,
                                           RuntimeComponentService service,
                                           DistributedSCABinding binding,
                                           ServletHost servletHost,
-                                          MessageFactory messageFactory,
-                                          Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
-     	this.nodeFactory = nodeFactory;
+                                          ModelFactoryExtensionPoint modelFactories,
+                                          Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames,
+                                          DataBindingExtensionPoint dataBindings) {
+
+        MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); 
+        WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
+
+        this.nodeFactory = modelFactories.getFactory(NodeFactory.class);
         this.binding = binding.getSCABinding();
-        //FIXME fix that hack, shouldn't create a new instance of the binding factory here 
-        wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+        wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
         
         // Turn the java interface contract into a WSDL interface contract
         InterfaceContract contract = service.getInterfaceContract();
         if ((contract instanceof JavaInterfaceContract)) {
-            contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+            ModelResolver resolver = component instanceof ResolverExtension ?
+                                         ((ResolverExtension)component).getModelResolver() : null;
+            contract = Java2WSDLHelper.createWSDLInterfaceContract(
+                           (JavaInterfaceContract)contract, resolver, dataBindings, wsdlFactory, xsdFactory);
         }
         
         // Set to use the Axiom data binding

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java Mon May 26 17:08:32 2008
@@ -24,6 +24,7 @@
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -45,9 +46,10 @@
 
 public class Axis2BindingProviderFactory implements BindingProviderFactory<WebServiceBinding> {
 
-    private MessageFactory messageFactory;
+    private ModelFactoryExtensionPoint modelFactories;
     private ServletHost servletHost;
     private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+    private DataBindingExtensionPoint dataBindings;
 
     public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) {
         ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
@@ -57,17 +59,25 @@
         } else {
             this.servletHost = hosts.get(0);
         }
-        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-        this.messageFactory = modelFactories.getFactory(MessageFactory.class); 
+        modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+        dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
     }
 
-    public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, WebServiceBinding binding) {
-        return new Axis2ReferenceBindingProvider(component, reference, binding, servletHost, messageFactory, policyHandlerClassnames);
+    public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+                                                                   RuntimeComponentReference reference,
+                                                                   WebServiceBinding binding) {
+        return new Axis2ReferenceBindingProvider(component, reference, binding,
+                                                 servletHost, modelFactories,
+                                                 policyHandlerClassnames, dataBindings);
     }
 
-    public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, WebServiceBinding binding) {
-        return new Axis2ServiceBindingProvider(component, service, binding, servletHost, messageFactory, policyHandlerClassnames);
+    public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+                                                               RuntimeComponentService service,
+                                                               WebServiceBinding binding) {
+        return new Axis2ServiceBindingProvider(component, service, binding,
+                                               servletHost, modelFactories,
+                                               policyHandlerClassnames, dataBindings);
     }
     
     public Class<WebServiceBinding> getModelType() {

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java Mon May 26 17:08:32 2008
@@ -23,10 +23,15 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
 import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -34,6 +39,7 @@
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.xsd.XSDFactory;
 
 public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
 
@@ -44,16 +50,28 @@
                                          RuntimeComponentReference reference,
                                          WebServiceBinding wsBinding,
                                          ServletHost servletHost,
-                                         MessageFactory messageFactory,
-                                         Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
-
+                                         ModelFactoryExtensionPoint modelFactories,
+                                         Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames,
+                                         DataBindingExtensionPoint dataBindings) {
+
+        MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); 
+        WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
         this.wsBinding = wsBinding;
 
         InterfaceContract contract = wsBinding.getBindingInterfaceContract();
         if (contract == null) {
             contract = reference.getInterfaceContract().makeUnidirectional(false);
-            if ((contract instanceof JavaInterfaceContract)) {
-                contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, Axis2ServiceBindingProvider.requiresSOAP12(wsBinding));
+            if (contract instanceof JavaInterfaceContract) {
+                ModelResolver resolver = component instanceof ResolverExtension ?
+                                             ((ResolverExtension)component).getModelResolver() : null;
+                contract = Java2WSDLHelper.createWSDLInterfaceContract(
+                                   (JavaInterfaceContract)contract,
+                                   Axis2ServiceBindingProvider.requiresSOAP12(wsBinding),
+                                   resolver,
+                                   dataBindings,
+                                   wsdlFactory,
+                                   xsdFactory);
             }
             wsBinding.setBindingInterfaceContract(contract);
         }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java Mon May 26 17:08:32 2008
@@ -25,10 +25,15 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
 import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.Intent;
@@ -37,6 +42,7 @@
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.xsd.XSDFactory;
 
 public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
 
@@ -47,16 +53,28 @@
                                        RuntimeComponentService service,
                                        WebServiceBinding wsBinding,
                                        ServletHost servletHost,
-                                       MessageFactory messageFactory,
-                                       Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
-
+                                       ModelFactoryExtensionPoint modelFactories,
+                                       Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames,
+                                       DataBindingExtensionPoint dataBindings) {
+
+        MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class); 
+        WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
         this.wsBinding = wsBinding;
 
         InterfaceContract contract = wsBinding.getBindingInterfaceContract();
         if (contract == null) {
             contract = service.getInterfaceContract().makeUnidirectional(false);
-            if ((contract instanceof JavaInterfaceContract)) {
-                contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, requiresSOAP12(wsBinding));
+            if (contract instanceof JavaInterfaceContract) {
+                ModelResolver resolver = component instanceof ResolverExtension ?
+                                             ((ResolverExtension)component).getModelResolver() : null;
+                contract = Java2WSDLHelper.createWSDLInterfaceContract(
+                                   (JavaInterfaceContract)contract,
+                                   requiresSOAP12(wsBinding),
+                                   resolver,
+                                   dataBindings,
+                                   wsdlFactory,
+                                   xsdFactory);
             } else {
                 try {
                     //TUSCANY-2316 Cloning the Interface Contract to avoid overriding data biding information 

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java Mon May 26 17:08:32 2008
@@ -76,7 +76,6 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.interface2wsdl.WSDLDefinitionGenerator;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
@@ -86,6 +85,7 @@
 import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
 import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper;
 import org.apache.ws.commons.schema.resolver.URIResolver;
 import org.osoa.sca.ServiceRuntimeException;
 

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java Mon May 26 17:08:32 2008
@@ -41,6 +41,7 @@
  */
 public class QuestionMarkWSDLTestCase extends TestCase {
 
+    private static boolean newGenerator = true;
     private SCADomain domain;
 
     /**
@@ -71,8 +72,10 @@
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
-        Port port = service.getPort("HelloWorldSOAP11port_http");
+        Service service = definition.getService(new QName(
+                              "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
+                              newGenerator ? "HelloWorldService" : "HelloWorld"));
+        Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
 
         String endpoint = getEndpoint(port);
         String ip = HttpUtils.getIpAddress();

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java Mon May 26 17:08:32 2008
@@ -42,6 +42,7 @@
  */
 public class QuestionMarkWSDLTestCase extends TestCase {
 
+    private static boolean newGenerator = true;
     private SCADomain domain;
 
     /**
@@ -54,10 +55,12 @@
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep1?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
-        Port port = service.getPort("HelloWorldSOAP11port_http");
+        Service service = definition.getService(new QName(
+                              "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
+                              newGenerator ? "HelloWorldService" : "HelloWorld"));
+        Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
 
-        String endpoint = getEndpoint(port);
+        String endpoint = getSOAP11Endpoint(port);
         String ip = HttpUtils.getIpAddress();
         assertEquals("http://" + ip + ":8085/ep1", endpoint);
     }
@@ -72,10 +75,12 @@
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep2?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
-        Port port = service.getPort("HelloWorldSOAP11port_http");
+        Service service = definition.getService(new QName(
+                              "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
+                              newGenerator ? "HelloWorldService" : "HelloWorld"));
+        Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
 
-        String endpoint = getEndpoint(port);
+        String endpoint = getSOAP11Endpoint(port);
         String ip = HttpUtils.getIpAddress();
         assertEquals("http://" + ip + ":8085/ep2", endpoint);
     }
@@ -90,20 +95,30 @@
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep3?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
-        Port port = service.getPort("HelloWorldSOAP12port_http");
+        Service service = definition.getService(new QName(
+                              "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
+                              newGenerator ? "HelloWorldService" : "HelloWorld"));
+        Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP12port_http");
 
-        String endpoint = getEndpoint(port);
+        String endpoint = getSOAP12Endpoint(port);
         String ip = HttpUtils.getIpAddress();
         assertEquals("http://" + ip + ":8085/ep3", endpoint);
     }
 
-    protected String getEndpoint(Port port) {
+    protected String getSOAP11Endpoint(Port port) {
         List wsdlPortExtensions = port.getExtensibilityElements();
         for (final Object extension : wsdlPortExtensions) {
             if (extension instanceof SOAPAddress) {
                 return ((SOAPAddress) extension).getLocationURI();
-            } else if (extension instanceof SOAP12Address) {
+            }
+        }
+        throw new RuntimeException("no SOAPAddress");
+    }
+
+    protected String getSOAP12Endpoint(Port port) {
+        List wsdlPortExtensions = port.getExtensibilityElements();
+        for (final Object extension : wsdlPortExtensions) {
+            if (extension instanceof SOAP12Address) {
                 return ((SOAP12Address) extension).getLocationURI();
             }
         }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java Mon May 26 17:08:32 2008
@@ -258,6 +258,11 @@
                                 processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
                             processor = constructor.newInstance(modelFactories, monitor);
                         } catch (NoSuchMethodException e) {
+                          try {
+                              Constructor<StAXArtifactProcessor> constructor =
+                                  processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
+                              processor = constructor.newInstance(extensionPoints, monitor);
+                          } catch (NoSuchMethodException e1) {
                             try {
                                 Constructor<StAXArtifactProcessor> constructor =
                                     processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
@@ -273,6 +278,11 @@
                                             processorClass.getConstructor(ModelFactoryExtensionPoint.class);
                                         processor = constructor.newInstance(modelFactories);
                                     } catch (NoSuchMethodException e4) {
+                                      try {
+                                          Constructor<StAXArtifactProcessor> constructor =
+                                              processorClass.getConstructor(ExtensionPointRegistry.class);
+                                          processor = constructor.newInstance(extensionPoints);
+                                      } catch (NoSuchMethodException e4a) {
                                         try {
                                             Constructor<StAXArtifactProcessor> constructor =
                                                 processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
@@ -282,9 +292,11 @@
                                                 processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
                                             processor = constructor.newInstance(extensionPoints, extensionProcessor);
                                         }
+                                      }
                                     }
                                 }
                             }
+                          }
                         }
                     } catch (Exception e) {
                         throw new IllegalStateException(e);

Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java?rev=660340&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java Mon May 26 17:08:32 2008
@@ -0,0 +1,45 @@
+/*
+ * 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.contribution.resolver;
+
+/**
+ * Extension to assembly model implementations to provide a model resolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResolverExtension {
+
+    /**
+     * Returns the model resolver for the models representing the artifacts
+     * visible in the scope of this contribution.
+     * 
+     * @return The model resolver
+     */
+    ModelResolver getModelResolver();
+    
+    /**
+     * Sets the model resolver for the models representing the artifacts
+     * visible in the scope of this contribution.
+     * 
+     * @param modelResolver The model resolver
+     */
+    void setModelResolver(ModelResolver modelResolver);
+    
+}
\ No newline at end of file

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java Mon May 26 17:08:32 2008
@@ -23,6 +23,8 @@
 import java.util.List;
 
 import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
 import org.apache.tuscany.sca.core.scope.ScopeContainer;
 import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
@@ -33,12 +35,14 @@
 /**
  * @version $Rev$ $Date$
  */
-public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent, ScopedRuntimeComponent {
+public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent,
+                                              ScopedRuntimeComponent, ResolverExtension {
     protected RuntimeComponentContext componentContext;
     protected ImplementationProvider implementationProvider;
     protected List<PolicyProvider> policyProviders = new ArrayList<PolicyProvider>();
     protected ScopeContainer scopeContainer;
     protected boolean started;
+    protected ModelResolver modelResolver;
 
     /**
      */
@@ -91,4 +95,12 @@
     public List<PolicyProvider> getPolicyProviders() {
         return policyProviders;
     }
+
+    public ModelResolver getModelResolver() {
+        return modelResolver;
+    }
+    
+    public void setModelResolver(ModelResolver modelResolver) {
+        this.modelResolver = modelResolver;
+    }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java Mon May 26 17:08:32 2008
@@ -359,7 +359,11 @@
                         javaInterface.setJavaClass(classLoader.loadClass(javaInterface.getName()));
                         currentActivator.getJavaInterfaceFactory().createJavaInterface(javaInterface,
                                                                                        javaInterface.getJavaClass());
-                    }
+                        //FIXME: If the interface needs XSDs to be loaded (e.g., for static SDO),
+                        // this needs to be done here.  We usually search for XSDs in the current
+                        // contribution at resolve time.  Is it possible to locate the current
+                        // contribution at runtime?
+                        }
                     this.businessInterface = (Class<B>)javaInterface.getJavaClass();
                 }
                 this.proxyFactory = currentActivator.getProxyFactory();

Modified: incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java Mon May 26 17:08:32 2008
@@ -109,6 +109,11 @@
     }
 
     @Override
+    public Class getXMLTypeHelperClass() {
+        return SDOTypeHelper.class;
+    }
+
+    @Override
     public Object copy(Object arg) {
         HelperContext context = HelperProvider.getDefaultContext();
         CopyHelper copyHelper = context.getCopyHelper();

Added: incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java?rev=660340&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java (added)
+++ incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java Mon May 26 17:08:32 2008
@@ -0,0 +1,154 @@
+/*
+ * 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.databinding.sdo;
+
+import java.beans.Introspector;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.namespace.QName;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
+import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.tuscany.sca.xsd.XSDFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+
+public class SDOTypeHelper implements XMLTypeHelper {
+    private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+
+    private TypeHelper typeHelper;
+    private XSDHelper xsdHelper;
+    private Map<String, List<Type>> xsdTypesMap = new HashMap<String, List<Type>>();
+    private Map<String, List<Type>> typesMap = new HashMap<String, List<Type>>();
+    
+    public SDOTypeHelper() {
+        super();
+        typeHelper = SDOContextHelper.getDefaultHelperContext().getTypeHelper();
+        xsdHelper = SDOContextHelper.getDefaultHelperContext().getXSDHelper();
+    }
+
+    public TypeInfo getTypeInfo(Class javaType, Object logical) {
+        QName xmlType = JavaXMLMapper.getXMLType(javaType);
+        if (xmlType != null) {
+            return new TypeInfo(xmlType, true, null);
+        } else {
+            Type type = typeHelper.getType(javaType);
+            if (xsdHelper.isXSD(type)) {
+                List<Type> xsdTypes = xsdTypesMap.get(type.getURI());
+                if (xsdTypes == null) {
+                    xsdTypes = new ArrayList<Type>();
+                    xsdTypesMap.put(type.getURI(), xsdTypes);
+                }
+                if (!xsdTypes.contains(type)) {
+                    xsdTypes.add(type);
+                }
+            } else {
+                List<Type> types = typesMap.get(type.getURI());
+                if (types == null) {
+                    types = new ArrayList<Type>();
+                    typesMap.put(type.getURI(), types);
+                }
+                if (!types.contains(type)) {
+                    types.add(type);
+                }
+            }
+            if (logical instanceof XMLType) {
+                xmlType = ((XMLType)logical).getTypeName();
+            }
+            if (xmlType == null) {
+                xmlType = new QName(JavaXMLMapper.getNamespace(javaType),
+                                    Introspector.decapitalize(javaType.getSimpleName()));
+            }
+            return new TypeInfo(xmlType, false, null);
+        }
+    }
+
+    public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver) {
+        List<XSDefinition> definitions = new ArrayList<XSDefinition>();
+        generateSDOSchemas(definitions, factory);
+        addResolvedXSDs(definitions, factory, resolver);
+        return definitions;
+    }
+
+    private void generateSDOSchemas(List<XSDefinition> definitions, XSDFactory factory) {
+        for (Map.Entry<String, List<Type>> entry: typesMap.entrySet()) {
+            String schema = xsdHelper.generate(entry.getValue());
+            DOMImplementationRegistry registry = null;
+            try {
+                registry = DOMImplementationRegistry.newInstance();
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            DOMImplementation impl = registry.getDOMImplementation("XML 3.0");
+            DOMImplementationLS ls = (DOMImplementationLS)impl.getFeature("LS", "3.0");
+            LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, SCHEMA_NS);
+            LSInput input = ls.createLSInput();
+            input.setCharacterStream(new StringReader(schema));
+            Document document = parser.parse(input);
+            XSDefinition definition = factory.createXSDefinition();
+            definition.setUnresolved(true);
+            definition.setDocument(document);
+            definition.setNamespace(entry.getKey());
+            definitions.add(definition);
+        }
+    }
+
+    private void addResolvedXSDs(List<XSDefinition> definitions, XSDFactory factory, ModelResolver resolver) {
+        for (Map.Entry<String, List<Type>> entry: xsdTypesMap.entrySet()) {
+            XSDefinition definition = factory.createXSDefinition();
+            definition.setUnresolved(true);
+            definition.setNamespace(entry.getKey());
+            //FIXME: set location URI
+            XSDefinition resolved = resolver.resolveModel(XSDefinition.class, definition);
+            if (resolved.getSchema() == null) {
+                //FIXME: create a checked exception and propagate it back up to the activator
+                throw new RuntimeException("No XSD found for namespace " + entry.getKey());
+            }
+            // make sure all the required types are defined in the resolved schema
+            for (Type type: entry.getValue()) {
+                QName typeName = new QName(type.getURI(), type.getName());
+                if (resolved.getXmlSchemaType(typeName) == null) {
+                    //FIXME: create a checked exception and propagate it back up to the activator
+                    throw new RuntimeException("No XSD found for " + typeName.toString());
+                }
+            }
+            definitions.add(resolved);
+        }
+    }
+
+}

Modified: incubator/tuscany/java/sca/modules/databinding/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/pom.xml?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/databinding/pom.xml Mon May 26 17:08:32 2008
@@ -46,6 +46,12 @@
 			<artifactId>tuscany-contribution</artifactId>
 			<version>2.0-incubating-SNAPSHOT</version>
 		</dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-xsd</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>
 		
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
@@ -59,6 +65,12 @@
 			<version>1.0.1</version>
 		</dependency>
 
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>2.1</version>
+        </dependency>
+
 		<dependency>
 			<groupId>org.codehaus.woodstox</groupId>
 			<artifactId>wstx-asl</artifactId>

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java Mon May 26 17:08:32 2008
@@ -91,4 +91,11 @@
      * @return The databinding-specific simple type mapper
      */
     SimpleTypeMapper getSimpleTypeMapper();
+    
+    /**
+     * Get the XML type helper for Java types
+     * @return The databinding-specific XML type helper class
+     */
+    Class getXMLTypeHelperClass();
+
 }

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java Mon May 26 17:08:32 2008
@@ -183,6 +183,10 @@
             return getDataBinding().getSimpleTypeMapper();
         }
 
+        public Class getXMLTypeHelperClass() {
+            return getDataBinding().getXMLTypeHelperClass();
+        }
+
         public WrapperHandler getWrapperHandler() {
             return getDataBinding().getWrapperHandler();
         }

Added: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java?rev=660340&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java (added)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java Mon May 26 17:08:32 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.databinding;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.tuscany.sca.xsd.XSDFactory;
+
+/**
+ * XML and schema helper for Java types
+ */
+public interface XMLTypeHelper {
+
+    /**
+     * Convert a Java type into XML type information 
+     * @param javaType the physical Java class
+     * @param logical the logical type information
+     * @return the XML type information
+     */
+    TypeInfo getTypeInfo(Class javaType, Object logical);
+
+    /**
+     * Get schema definitions for the Java types known to this helper
+     * @return A list of schema definitions
+     */
+    List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver);
+
+}

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java?rev=660340&r1=660339&r2=660340&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java Mon May 26 17:08:32 2008
@@ -121,6 +121,10 @@
         return new SimpleTypeMapperImpl();
     }
 
+    public Class getXMLTypeHelperClass() {
+        return JAXBTypeHelper.class;
+    }
+
     public String[] getAliases() {
         return aliases;
     }



Mime
View raw message