tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svkr...@apache.org
Subject svn commit: r522885 [1/4] - in /incubator/tuscany/branches/sca-java-integration: samples/sca/calculator/src/main/resources/ samples/sca/composite-impl/src/main/resources/ samples/sca/echo-binding/src/main/java/echo/ samples/sca/echo-binding/src/test/re...
Date Tue, 27 Mar 2007 12:18:58 GMT
Author: svkrish
Date: Tue Mar 27 05:18:53 2007
New Revision: 522885

URL: http://svn.apache.org/viewvc?view=rev&rev=522885
Log:
updated reference defn to specs 1.0 level and modified composite defns in iTest and samples

Added:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java
      - copied, changed from r518530, incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/references/
Removed:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java
Modified:
    incubator/tuscany/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java
    incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite
    incubator/tuscany/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite
    incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite Tue Mar 27 05:18:53 2007
@@ -27,10 +27,10 @@
 
     <component name="CalculatorServiceComponent">
 		<implementation.java class="calculator.CalculatorServiceImpl"/>
-        <reference name="addService">AddServiceComponent</reference>
-        <reference name="subtractService">SubtractServiceComponent</reference>
-        <reference name="multiplyService">MultiplyServiceComponent</reference>
-        <reference name="divideService">DivideServiceComponent</reference>
+        <reference name="addService" target="AddServiceComponent"></reference>
+        <reference name="subtractService" target="SubtractServiceComponent"></reference>
+        <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+        <reference name="divideService" target="DivideServiceComponent"></reference>
     </component>
 
     <component name="AddServiceComponent">

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite Tue Mar 27 05:18:53 2007
@@ -27,16 +27,16 @@
        
     <component name="InnerSourceComponent">
 		<implementation.java class="composite.SourceImpl"/>
-        <reference name="targetReference">TargetComponentRef</reference>
-        <reference name="targetReference2">TargetComponentRef2</reference>
+        <!--reference name="targetReference">TargetComponentRef</reference>
+        <reference name="targetReference2">TargetComponentRef2</reference-->
     </component>
 	    
-    <reference name="TargetComponentRef">
+    <reference name="TargetComponentRef" promote="InnerSourceComponent/targetReference">
         <interface.java interface="composite.Target"
                         callbackInterface="composite.SourceCallback"/>
     </reference>
     
-    <reference name="TargetComponentRef2">
+    <reference name="TargetComponentRef2" promote="InnerSourceComponent/targetReference2">
         <interface.java interface="composite.Target"
                         callbackInterface="composite.SourceCallback"/>
     </reference>

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite Tue Mar 27 05:18:53 2007
@@ -22,8 +22,8 @@
 
     <component name="SourceComponent">
         <implementation.composite name="InnerComposite" scdlLocation="InnerComposite.composite"/>
-        <reference name="TargetComponentRef">TargetComponent</reference>
-        <reference name="TargetComponentRef2">TargetComponent2/InnerTargetService</reference>
+        <reference name="TargetComponentRef" target="TargetComponent"></reference>
+        <reference name="TargetComponentRef2" target="TargetComponent2/InnerTargetService"></reference>
     </component>
 
     <component name="TargetComponent">

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java Tue Mar 27 05:18:53 2007
@@ -24,5 +24,8 @@
  * @version $Rev$ $Date$
  */
 public class EchoBinding extends BindingDefinition {
+    public Object clone() {
+        return this;
+    }
 
 }

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java Tue Mar 27 05:18:53 2007
@@ -24,7 +24,7 @@
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
@@ -40,7 +40,7 @@
     }
 
     public ReferenceBinding build(CompositeComponent parent,
-                                  ReferenceDefinition boundReferenceDefinition,
+                                  AbstractReferenceDefinition boundReferenceDefinition,
                                   EchoBinding bindingDefinition,
                                   DeploymentContext deploymentContext) throws BuilderException {
         return new EchoReference(boundReferenceDefinition.getName(), parent);

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite Tue Mar 27 05:18:53 2007
@@ -27,10 +27,9 @@
 
     <component name="Client">
         <implementation.java class="echo.ClientImpl"/>
-        <reference name="echoReference">EchoReference</reference>
     </component>
     
-    <reference name="EchoReference">
+    <reference name="EchoReference" promote="Client">
         <interface.java interface="echo.Echo"/>
         <binding.echo/>
     </reference>

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java Tue Mar 27 05:18:53 2007
@@ -25,4 +25,8 @@
  */
 public class EchoBinding extends BindingDefinition {
 
+    public Object clone() {
+        return this;
+    }
+
 }

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java Tue Mar 27 05:18:53 2007
@@ -24,7 +24,7 @@
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
@@ -40,7 +40,7 @@
     }
 
     public ReferenceBinding build(CompositeComponent parent,
-                                  ReferenceDefinition boundReferenceDefinition,
+                                  AbstractReferenceDefinition boundReferenceDefinition,
                                   EchoBinding bindingDefinition,
                                   DeploymentContext deploymentContext) throws BuilderException {
         return new EchoReference(boundReferenceDefinition.getName(), parent);

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite Tue Mar 27 05:18:53 2007
@@ -30,7 +30,7 @@
 
     <component name="ComponentA">
         <implementation.java class="echo.ComponentAImpl" />
-        <reference name="componentBReference">ComponentB</reference>
+        <reference name="componentBReference" target="ComponentB"></reference>
         <property name="prefix">ABC</property>
         <property name="prefix1" source="$messagePrefix"></property>
         <property name="bar" source="$complexProperty/*[local-name()='foo']/*[local-name()='bar']"></property>
@@ -39,10 +39,9 @@
 
     <component name="ComponentB">
         <implementation.java class="echo.ComponentBImpl" />
-        <reference name="echoReference">EchoReference</reference>
     </component>
 
-    <reference name="EchoReference">
+    <reference name="EchoReference" promote="ComponentB/echoReference">
         <!-- 
             <interface.java interface="echo.Echo"/>
         -->

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite Tue Mar 27 05:18:53 2007
@@ -21,7 +21,7 @@
 
     <component name="LoanClientComponent">
         <implementation.java class="loanapplication.LoanClientImpl"/>
-        <reference name="loanService">LoanServiceComponent</reference>
+        <reference name="loanService" target="LoanServiceComponent"></reference>
     </component>
     
     <component name="LoanServiceComponent">

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite Tue Mar 27 05:18:53 2007
@@ -34,7 +34,7 @@
 
     <component name="AccountServiceComponent">
         <implementation.java class="bigbank.account.AccountServiceImpl"/>
-        <reference name="accountDataService">AccountDataServiceComponent</reference>
+        <reference name="accountDataService" target="AccountDataServiceComponent"></reference>
     </component>
 
     <component name="AccountDataServiceComponent">

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite Tue Mar 27 05:18:53 2007
@@ -21,7 +21,7 @@
 
     <component name="MyClientComponent">
         <implementation.java class="simplecallback.MyClientImpl"/>
-        <reference name="myService">MyServiceComponent</reference>
+        <reference name="myService" target="MyServiceComponent"></reference>
     </component>
     
     <component name="MyServiceComponent">

Modified: incubator/tuscany/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite Tue Mar 27 05:18:53 2007
@@ -21,22 +21,22 @@
 
     <component name="CustomerComponent">
         <implementation.java class="supplychain.CustomerComponentImpl" />
-        <reference name="retailer">RetailerComponent</reference>
+        <reference name="retailer" target="RetailerComponent"></reference>
     </component>
 
     <component name="RetailerComponent">
         <implementation.java class="supplychain.RetailerComponentImpl" />
-        <reference name="warehouse">WarehouseComponent</reference>
+        <reference name="warehouse" target="WarehouseComponent"></reference>
     </component>
 
     <component name="WarehouseComponent">
         <implementation.java class="supplychain.WarehouseComponentImpl" />
-        <reference name="shipper">ShipperComponent</reference>
+        <reference name="shipper" target="ShipperComponent"></reference>
     </component>
 
     <component name="ShipperComponent">
         <implementation.java class="supplychain.ShipperComponentImpl" />
-        <reference name="customer">CustomerComponent</reference>
+        <reference name="customer" target="CustomerComponent"></reference>
     </component>
 
 </composite>

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Tue Mar 27 05:18:53 2007
@@ -40,7 +40,7 @@
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
 import org.apache.tuscany.spi.host.ServletHost;
 import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
@@ -169,7 +169,7 @@
     @SuppressWarnings("unchecked")
     public ReferenceBinding build(
         CompositeComponent parent,
-        ReferenceDefinition boundReferenceDefinition,
+        AbstractReferenceDefinition boundReferenceDefinition,
         WebServiceBindingDefinition wsBinding,
         DeploymentContext deploymentContext) {
 

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java Tue Mar 27 05:18:53 2007
@@ -39,7 +39,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class WebServiceBindingDefinition extends BindingDefinition {
+public class WebServiceBindingDefinition extends BindingDefinition { 
     public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS,"conversationID");
     private Definition definition;
     private Port port;
@@ -194,5 +194,17 @@
 
     public void setActualURI(URI actualURI) {
         this.actualURI = actualURI;
+    }
+    
+    public Object clone() {
+        WebServiceBindingDefinition clone = 
+            new WebServiceBindingDefinition(this.namespace,
+                                            this.definition,
+                                            this.serviceName,
+                                            this.portName,
+                                            this.bindingName,
+                                            this.uri);
+                                            
+        return clone;
     }
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite Tue Mar 27 05:18:53 2007
@@ -23,10 +23,10 @@
 
     <component name="HelloWorldServiceComponent">
       <implementation.java class="helloworld.om.HelloWorldServiceComponent"/>
-      <reference name="helloWorldService">HelloWorldService</reference>
+      <reference name="helloWorldService"></reference>
     </component>
 
-    <reference name="HelloWorldService">
+    <reference name="HelloWorldService" promote="HelloWorldServiceComponent">
         <interface.java interface="helloworld.om.HelloWorldService"/>
         <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)" wsdlLocation="http://helloworld-om wsdl/helloworld-om.wsdl" />
     </reference>

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite Tue Mar 27 05:18:53 2007
@@ -23,10 +23,10 @@
     
     <component name="HelloWorldServiceComponent">
       <implementation.java class="helloworld.HelloWorldServiceComponent"/>
-      <reference name="helloWorldService">HelloWorldService</reference>
+      <reference name="helloWorldService"></reference>
     </component>
 
-    <reference name="HelloWorldService">
+    <reference name="HelloWorldService" promote="HelloWorldServiceComponent">
         <interface.java class="helloworld.HelloWorldService" />
         <!-- interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" 
             interface="http://helloworld#wsdl.interface(HelloWorld)" 

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java Tue Mar 27 05:18:53 2007
@@ -25,7 +25,7 @@
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 import org.apache.tuscany.spi.model.ServiceContract;
 
@@ -75,7 +75,7 @@
     }
 
     public JMSReferenceBinding build(CompositeComponent parent,
-                                     ReferenceDefinition referenceDefinition,
+                                     AbstractReferenceDefinition referenceDefinition,
                                      JMSBindingDefinition jmsBinding,
                                      DeploymentContext deploymentContext) {
 

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java Tue Mar 27 05:18:53 2007
@@ -254,4 +254,21 @@
         this.xmlFormat = b;
     }
 
+    public Object clone() {
+                
+        JMSBindingDefinition clone = new JMSBindingDefinition();
+        clone.destinationType = this.destinationType;
+        clone.destinationType = this.destinationType;
+        clone.connectionFactoryName = this.connectionFactoryName;
+        clone.activationSpecName = this.activationSpecName;
+        clone.initialContextFactoryName = this.initialContextFactoryName;
+        clone.jNDIProviderURL = this.jNDIProviderURL;
+        clone.deliveryMode = this.deliveryMode;
+        clone.timeToLive = this.timeToLive;
+        clone.priority = this.priority;
+        clone.replyTo = this.replyTo;
+
+        return clone();
+    }
+
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java Tue Mar 27 05:18:53 2007
@@ -24,7 +24,7 @@
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
@@ -48,7 +48,7 @@
 
 
     public ReferenceBinding build(CompositeComponent parent,
-                                  ReferenceDefinition referenceDefinition,
+                                  AbstractReferenceDefinition referenceDefinition,
                                   LocalBindingDefinition bindingDefinition,
                                   DeploymentContext deploymentContext) throws BuilderException {
         return new LocalReferenceBinding(referenceDefinition.getName(), parent);

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java Tue Mar 27 05:18:53 2007
@@ -28,12 +28,18 @@
  *
  * @version $Rev$ $Date$
  */
-public class LocalBindingDefinition extends BindingDefinition {
+public class LocalBindingDefinition extends BindingDefinition implements Cloneable {
 
     public LocalBindingDefinition() {
     }
 
     public LocalBindingDefinition(URI targetUri) {
         super(targetUri);
+    }
+    
+    public Object clone() {
+        LocalBindingDefinition clone = new LocalBindingDefinition();
+        clone.setTargetUri(URI.create(getTargetUri().toString()));
+        return clone;
     }
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java Tue Mar 27 05:18:53 2007
@@ -48,10 +48,11 @@
 import org.apache.tuscany.spi.model.BindingDefinition;
 import org.apache.tuscany.spi.model.ComponentDefinition;
 import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
 import org.apache.tuscany.spi.model.Implementation;
 import org.apache.tuscany.spi.model.InteractionScope;
 import org.apache.tuscany.spi.model.ModelObject;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.Scope;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.model.ServiceDefinition;
@@ -98,7 +99,8 @@
     public <I extends Implementation<?>> Component build(CompositeComponent parent,
                                                          ComponentDefinition<I> componentDefinition,
                                                          DeploymentContext context) throws BuilderException {
-        Class<?> implClass = componentDefinition.getImplementation().getClass();
+        
+       Class<?> implClass = componentDefinition.getImplementation().getClass();
         // noinspection SuspiciousMethodCalls
         ComponentBuilder<I> componentBuilder = (ComponentBuilder<I>)componentBuilders.get(implClass);
         try {
@@ -106,7 +108,7 @@
                 String name = implClass.getName();
                 throw new NoRegisteredBuilderException("No builder registered for implementation", name);
             }
-
+            
             Component component = componentBuilder.build(parent, componentDefinition, context);
             if (component != null) {
                 component.setDefaultPropertyValues(componentDefinition.getPropertyValues());
@@ -117,7 +119,7 @@
                     // Check for conversational contract if conversational scope
                     if (scope == Scope.CONVERSATION) {
                         boolean hasConversationalContract = false;
-                        ComponentType<ServiceDefinition, ReferenceDefinition, ?> componentType =
+                        ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, ?> componentType =
                             componentDefinition.getImplementation().getComponentType();
                         Map<String, ServiceDefinition> services = componentType.getServices();
                         for (ServiceDefinition serviceDef : services.values()) {
@@ -128,8 +130,8 @@
                             }
                         }
                         if (!hasConversationalContract) {
-                            Map<String, ReferenceDefinition> references = componentType.getReferences();
-                            for (ReferenceDefinition refDef : references.values()) {
+                            Map<String, ComponentTypeReferenceDefinition> references = componentType.getReferences();
+                            for (AbstractReferenceDefinition refDef : references.values()) {
                                 // TODO check for a conversational callback
                                 // contract
                                 // refDef.getServiceContract() ...
@@ -210,7 +212,7 @@
 
     @SuppressWarnings("unchecked")
     public Reference build(CompositeComponent parent, 
-                           ReferenceDefinition referenceDefinition, 
+                           AbstractReferenceDefinition referenceDefinition, 
                            DeploymentContext context)
         throws BuilderException {
         String name = referenceDefinition.getName();

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java Tue Mar 27 05:18:53 2007
@@ -12,9 +12,10 @@
 import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
 import org.apache.tuscany.spi.model.ComponentDefinition;
 import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
 import org.apache.tuscany.spi.model.Implementation;
 import org.apache.tuscany.spi.model.ModelObject;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
@@ -46,7 +47,7 @@
                 throw new BuilderInstantiationException("Error registering service", e);
             }
         }
-        for (ReferenceDefinition definition : componentType.getReferences().values()) {
+        for (CompositeReferenceDefinition definition : componentType.getReferences().values()) {
             try {
                 Reference child = builderRegistry.build(component, definition, deploymentContext);
                 component.register(child);

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java Tue Mar 27 05:18:53 2007
@@ -18,18 +18,21 @@
  */
 package org.apache.tuscany.core.implementation.composite;
 
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.osoa.sca.Constants.SCA_NS;
+
 import java.net.URI;
 import java.net.URL;
 import java.util.List;
 import java.util.Map;
+
 import javax.xml.namespace.QName;
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import static org.osoa.sca.Constants.SCA_NS;
-
+import org.apache.tuscany.core.property.PropertyHelper;
+import org.apache.tuscany.core.util.ReferenceLoaderHelper;
 import org.apache.tuscany.spi.QualifiedName;
 import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.component.CompositeComponent;
@@ -39,18 +42,24 @@
 import org.apache.tuscany.spi.idl.InvalidServiceContractException;
 import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
 import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.loader.InvalidPromotedReferenceException;
 import org.apache.tuscany.spi.loader.InvalidServiceException;
 import org.apache.tuscany.spi.loader.InvalidWireException;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityOverridingException;
+import org.apache.tuscany.spi.model.BindingDefinition;
 import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
 import org.apache.tuscany.spi.model.ComponentType;
 import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
 import org.apache.tuscany.spi.model.Implementation;
 import org.apache.tuscany.spi.model.Include;
 import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Multiplicity;
 import org.apache.tuscany.spi.model.Property;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
 import org.apache.tuscany.spi.model.ReferenceTarget;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.model.ServiceDefinition;
@@ -58,11 +67,9 @@
 import org.apache.tuscany.spi.services.artifact.Artifact;
 import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
 
-import org.apache.tuscany.core.property.PropertyHelper;
-
 /**
  * Loads a composite component definition from an XML-based assembly file
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class CompositeLoader extends LoaderExtension<CompositeComponentType> {
@@ -74,7 +81,9 @@
 
     private final ArtifactRepository artifactRepository;
 
-    public CompositeLoader(@Autowire LoaderRegistry registry, @Autowire ArtifactRepository artifactRepository) {
+    public CompositeLoader(@Autowire
+    LoaderRegistry registry, @Autowire
+    ArtifactRepository artifactRepository) {
         super(registry);
         this.artifactRepository = artifactRepository;
     }
@@ -86,9 +95,10 @@
     public CompositeComponentType load(CompositeComponent parent,
                                        ModelObject object,
                                        XMLStreamReader reader,
-                                       DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
-        CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite =
-            new CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();
+                                       DeploymentContext deploymentContext) throws XMLStreamException,
+                                                                           LoaderException {
+        CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite =
+            new CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>>();
         composite.setName(reader.getAttributeValue(null, "name"));
         boolean done = false;
         while (!done) {
@@ -96,17 +106,17 @@
                 case START_ELEMENT:
                     ModelObject o = registry.load(parent, composite, reader, deploymentContext);
                     if (o instanceof ServiceDefinition) {
-                        composite.add((ServiceDefinition) o);
-                    } else if (o instanceof ReferenceDefinition) {
-                        composite.add((ReferenceDefinition) o);
+                        composite.add((ServiceDefinition)o);
+                    } else if (o instanceof CompositeReferenceDefinition) {
+                        composite.add((CompositeReferenceDefinition)o);
                     } else if (o instanceof Property<?>) {
-                        composite.add((Property<?>) o);
+                        composite.add((Property<?>)o);
                     } else if (o instanceof ComponentDefinition<?>) {
-                        composite.add((ComponentDefinition<?>) o);
+                        composite.add((ComponentDefinition<?>)o);
                     } else if (o instanceof Include) {
-                        composite.add((Include) o);
+                        composite.add((Include)o);
                     } else if (o instanceof Dependency) {
-                        Artifact artifact = ((Dependency) o).getArtifact();
+                        Artifact artifact = ((Dependency)o).getArtifact();
                         if (artifactRepository != null) {
                             // default to jar type if not specified
                             if (artifact.getType() == null) {
@@ -117,14 +127,14 @@
                         if (artifact.getUrl() != null) {
                             ClassLoader classLoader = deploymentContext.getClassLoader();
                             if (classLoader instanceof CompositeClassLoader) {
-                                CompositeClassLoader ccl = (CompositeClassLoader) classLoader;
+                                CompositeClassLoader ccl = (CompositeClassLoader)classLoader;
                                 for (URL dep : artifact.getUrls()) {
                                     ccl.addURL(dep);
                                 }
                             }
                         }
                     } else if (o instanceof WireDefinition) {
-                        composite.add((WireDefinition) o);
+                        composite.add((WireDefinition)o);
                     } else {
                         // add as an unknown model extension
                         if (o != null) {
@@ -135,22 +145,25 @@
                     break;
                 case END_ELEMENT:
                     if (COMPOSITE.equals(reader.getName())) {
-                        // if there are wire defintions then link them up to the relevant components
+                        // if there are wire defintions then link them up to the
+                        // relevant components
                         resolveWires(composite);
-                        verifyCompositeCompleteness(composite);
+                        validateCompositeDefintion(composite);
+                        //verifyCompositeCompleteness(composite);
                         done = true;
                         break;
                     }
             }
         }
         processJavaInterfaces(composite);
-        for (ComponentDefinition<? extends Implementation<?>> c : composite.getComponents().values()) {
+        for (ComponentDefinition<? extends Implementation<?>> c : composite.getComponents()
+            .values()) {
             processJavaInterfaces(c.getImplementation().getComponentType());
             PropertyHelper.processProperties(composite, c, deploymentContext);
         }
         return composite;
     }
-    
+
     protected void processJavaInterfaces(ComponentType componentType) throws LoaderException {
         if (processorRegistry == null) {
             return;
@@ -160,16 +173,18 @@
                 ServiceContract<?> contract = ((ServiceDefinition)s).getServiceContract();
                 if (JavaServiceContract.class.isInstance(contract)) {
                     contract =
-                        processorRegistry.introspect(contract.getInterfaceClass(), contract.getCallbackClass(), true);
+                        processorRegistry.introspect(contract.getInterfaceClass(), contract
+                            .getCallbackClass(), true);
                     ((ServiceDefinition)s).setServiceContract(contract);
                 }
             }
             for (Object r : componentType.getReferences().values()) {
-                ServiceContract<?> contract = ((ReferenceDefinition)r).getServiceContract();
+                ServiceContract<?> contract = ((AbstractReferenceDefinition)r).getServiceContract();
                 if (JavaServiceContract.class.isInstance(contract)) {
                     contract =
-                        processorRegistry.introspect(contract.getInterfaceClass(), contract.getCallbackClass(), true);
-                    ((ReferenceDefinition)r).setServiceContract(contract);
+                        processorRegistry.introspect(contract.getInterfaceClass(), contract
+                            .getCallbackClass(), true);
+                    ((AbstractReferenceDefinition)r).setServiceContract(contract);
                 }
             }
         } catch (InvalidServiceContractException e) {
@@ -178,8 +193,8 @@
 
     }
 
-    protected void resolveWires(CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite)
-        throws InvalidWireException {
+    protected void resolveWires(CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws InvalidWireException,
+                                                                                                                               InvalidPromotedReferenceException {
         QualifiedName sourceName;
         ComponentDefinition componentDefinition;
         ServiceDefinition serviceDefinition;
@@ -194,58 +209,200 @@
             if (serviceDefinition != null) {
                 serviceDefinition.setTarget(wire.getTarget());
             } else {
-                componentDefinition = composite.getDeclaredComponents().get(sourceName.getPartName());
+                componentDefinition =
+                    composite.getDeclaredComponents().get(sourceName.getPartName());
                 if (componentDefinition != null) {
-                    ReferenceTarget referenceTarget = createReferenceTarget(sourceName.getPortName(),
-                        targetUri,
-                        componentDefinition);
-                    componentDefinition.add(referenceTarget);
+                    if (sourceName.getPortName() == null || sourceName.getPortName().length() == 0) {
+                        if (componentDefinition.getReferences().size() > 1 || componentDefinition
+                            .getReferences().isEmpty()) {
+                            throw new InvalidWireException("Unable to determine unique source reference");
+                        } else {
+                            ComponentReferenceDefinition ref =
+                                (ComponentReferenceDefinition)componentDefinition.getReferences()
+                                    .values().iterator().next();
+                            ref.addTarget(targetUri);
+                        }
+                    } else {
+                        ((ComponentReferenceDefinition)componentDefinition.getReferences()
+                            .get(sourceName.getPortName())).addTarget(targetUri);
+                    }
+
                 } else {
                     throw new InvalidWireException("Source not found", sourceName.toString());
                 }
             }
         }
-    }
 
-    private ReferenceTarget createReferenceTarget(String componentReferenceName,
-                                                  URI target,
-                                                  ComponentDefinition componentDefn) throws InvalidWireException {
-        ComponentType componentType = componentDefn.getImplementation().getComponentType();
-        if (componentReferenceName == null) {
-            // if there is ambiguity in determining the source of the wire or there is no reference to be wired
-            if (componentType.getReferences().size() > 1 || componentType.getReferences().isEmpty()) {
-                throw new InvalidWireException("Unable to determine unique source reference");
-            } else {
-                Map references = componentType.getReferences();
-                ReferenceDefinition definition = (ReferenceDefinition) references.values().iterator().next();
-                componentReferenceName = definition.getName();
+        QualifiedName targetName = null;
+        ComponentReferenceDefinition promotedComponentRef = null;
+        for (CompositeReferenceDefinition compositeRefDef : composite.getDeclaredReferences()
+            .values()) {
+            for (URI promotedComponentRefUri : compositeRefDef.getPromotedReferences()) {
+                targetName = new QualifiedName(promotedComponentRefUri.toString());
+                componentDefinition = composite.getComponents().get(targetName.getPartName());
+                if (componentDefinition != null) {
+                    if (targetName.getPortName() != null) {
+                        promotedComponentRef =
+                            (ComponentReferenceDefinition)componentDefinition.getReferences()
+                                .get(targetName.getPortName());
+                    } else {
+                        promotedComponentRef =
+                            (ComponentReferenceDefinition)componentDefinition.getReferences()
+                                .values().iterator().next();
+                    }
+                    if (promotedComponentRef != null) {
+                        promotedComponentRef.addTarget(URI.create(compositeRefDef.getName()));
+                    } else {
+                        throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+                                                                    targetName.toString());
+                    }
+                } else {
+                    throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+                                                                targetName.toString());
+                }
+
             }
         }
+    }
 
-        ReferenceTarget referenceTarget = new ReferenceTarget();
-        referenceTarget.setReferenceName(componentReferenceName);
-        referenceTarget.addTarget(target);
-        return referenceTarget;
+    protected void validateCompositeDefintion(
+        CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) 
+            throws LoaderException {
+        verifyCompositeCompleteness(composite);
+        validateCompositeReferenceDefinition(composite);
     }
 
     protected void verifyCompositeCompleteness(
-        CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite)
-        throws InvalidServiceException {
+        CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) 
+            throws InvalidServiceException {
         // check if all of the composite services have been wired
         for (ServiceDefinition svcDefn : composite.getDeclaredServices().values()) {
             if (svcDefn.getTarget() == null) {
-                throw new InvalidServiceException("Composite service not wired to a target", svcDefn.getName());
+                throw new InvalidServiceException("Composite service not wired to a target",
+                                                  svcDefn.getName());
+            }
+        }
+    }
+    
+    protected void verifyReferenceInterfaceCompatibility(CompositeReferenceDefinition compositeRefDefn, 
+                                                ComponentReferenceDefinition componentRefDefn) 
+                                                throws LoaderException {
+        if (compositeRefDefn.getServiceContract() != null) {
+            //TODO : Since the JavaInterfaceProcessorRegistryImpl does not do a deep introspection
+            //this comparison is not possible.  This will be uncommented once that is fixed.
+            /*ReferenceLoaderHelper.checkInterfaceCompatibility(componentRefDefn.getServiceContract(),
+                                                              compositeRefDefn.getServiceContract(),
+                                                              false);*/
+        } else {
+            //FIXME : the wireservice needs a service contract in the composite ref. def
+            //so filling up with one of the promoted component ref. defn's service contract
+            compositeRefDefn.setServiceContract(componentRefDefn.getServiceContract());
+        }
+    }
+    
+    protected Multiplicity deriveReferenceMultiplicity(CompositeReferenceDefinition compositeRefDefn, 
+                                                       ComponentReferenceDefinition componentRefDefn,
+                                                       Multiplicity leastMultiplicity) 
+                                                            throws LoaderException
+    {
+        if (compositeRefDefn.getMultiplicity() != null) {
+            if (!ReferenceLoaderHelper.
+                isValidMultiplicityOverride(componentRefDefn.getMultiplicity(), 
+                                            compositeRefDefn.getMultiplicity())) {
+               throw new ReferenceMultiplicityOverridingException(compositeRefDefn.getName(), 
+                                                                  componentRefDefn.getMultiplicity(),
+                                                                  compositeRefDefn.getMultiplicity());
+           } 
+        } else {
+            if (leastMultiplicity != null) {
+                if (!ReferenceLoaderHelper.isCompatibleMultiplicity(componentRefDefn.getMultiplicity(),
+                                                                    leastMultiplicity)) {
+                    throw new ReferenceMultiplicityOverridingException(compositeRefDefn.getName(), 
+                                                                       componentRefDefn.getMultiplicity(),
+                                                                       leastMultiplicity);
+                } else {
+                    if (!ReferenceLoaderHelper.
+                        isValidMultiplicityOverride(componentRefDefn.getMultiplicity(), 
+                                                    leastMultiplicity)) {
+                        leastMultiplicity = componentRefDefn.getMultiplicity();
+                    }
+                }
             }
+            else {
+                leastMultiplicity = componentRefDefn.getMultiplicity();
+            }
+        }
+        return leastMultiplicity;
+    }
+    
+    protected void validateCompositeReferenceDefinition(CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws LoaderException {
+        QualifiedName promotedName = null;
+        ComponentDefinition promotedComponentDefinition = null;
+        ComponentReferenceDefinition promotedComponentReference = null;
+
+        for (CompositeReferenceDefinition compositeRefDefn : composite.getDeclaredReferences().values()) {
+            // ensure if there is a service contract defined, then it is
+            // compatible with all
+            // promoted component reference interfaces
+            Multiplicity leastMultiplicity = null;
+            boolean bindingsOverriden = compositeRefDefn.getBindings().size() > 0;
+            for (URI promotedRef : compositeRefDefn.getPromotedReferences()) {
+                // check for valid promotions
+                promotedName = new QualifiedName(promotedRef.toString());
+                promotedComponentDefinition =
+                    composite.getComponents().get(promotedName.getPartName());
+                if (promotedComponentDefinition != null) {
+                    if (promotedName.getPortName() != null) {
+                        promotedComponentReference =
+                            (ComponentReferenceDefinition)promotedComponentDefinition
+                                .getReferences().get(promotedName.getPortName());
+                    } else {
+                        promotedComponentReference =
+                            (ComponentReferenceDefinition)promotedComponentDefinition
+                                .getReferences().values().iterator().next();
+                    }
+                    // check for service contract compatibility
+                    if (promotedComponentReference != null) {
+                        verifyReferenceInterfaceCompatibility(compositeRefDefn,
+                                                              promotedComponentReference);
+                        leastMultiplicity =
+                            deriveReferenceMultiplicity(compositeRefDefn,
+                                                        promotedComponentReference,
+                                                        leastMultiplicity);
+
+                        // if bindings have not been overridden int the composite then copy them
+                        // over for convenience so that when accessed, traversing of all promoted
+                        // references can be avoided
+                        if (!bindingsOverriden) {
+                            for (BindingDefinition refBinding : promotedComponentReference
+                                .getBindings()) {
+                                compositeRefDefn.addBinding((BindingDefinition)refBinding.clone());
+                            }
+                        }
+                    } else {
+                        throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+                                                                    promotedRef.toString());
+                    }
+                } else {
+                    throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+                                                                promotedRef.toString());
+                }
+
+            }
+            if (compositeRefDefn.getMultiplicity() == null) {
+                compositeRefDefn.setMultiplicity(leastMultiplicity);
+            }
+
         }
     }
 
     private void validateTarget(URI target,
-                                CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite)
-        throws InvalidWireException {
+                                CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws InvalidWireException {
         QualifiedName targetName = new QualifiedName(target.getPath());
         // if target is not a reference of the composite
         if (composite.getReferences().get(targetName.getPartName()) == null) {
-            ComponentDefinition<?> targetDefinition = composite.getDeclaredComponents().get(targetName.getPartName());
+            ComponentDefinition<?> targetDefinition =
+                composite.getDeclaredComponents().get(targetName.getPartName());
             // if a target component exists in this composite
             if (targetDefinition != null) {
                 Implementation<?> implementation = targetDefinition.getImplementation();
@@ -257,7 +414,8 @@
                     }
                 } else {
                     if (services.get(targetName.getPortName()) == null) {
-                        throw new InvalidWireException("Invalid target service", targetName.toString());
+                        throw new InvalidWireException("Invalid target service", targetName
+                            .toString());
                     }
                 }
             } else {

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java Tue Mar 27 05:18:53 2007
@@ -58,7 +58,7 @@
         this.host = host;
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("unchecked") 
     public AtomicComponent build(CompositeComponent parent,
                                  ComponentDefinition<JavaImplementation> definition,
                                  DeploymentContext deployment) throws BuilderConfigException {
@@ -97,12 +97,17 @@
         }
 
         // setup reference injection sites
+        try {
+            
         for (JavaMappedReference reference : componentType.getReferences().values()) {
             Member member = reference.getMember();
             if (member != null) {
                 // could be null if the reference is mapped to a constructor
                 configuration.addReferenceSite(reference.getName(), member);
             }
+        }
+        } catch ( Exception e ) {
+            e.printStackTrace();
         }
 
         for (Resource resource : componentType.getResources().values()) {

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java Tue Mar 27 05:18:53 2007
@@ -18,6 +18,9 @@
  */
 package org.apache.tuscany.core.implementation.java;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.net.URI;
 import java.net.URL;
 import java.util.Iterator;
 
@@ -38,6 +41,8 @@
 import org.apache.tuscany.spi.implementation.java.ProcessingException;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 import org.osoa.sca.annotations.Constructor;
@@ -67,11 +72,11 @@
     public void load(CompositeComponent parent, JavaImplementation implementation, DeploymentContext deploymentContext)
         throws LoaderException {
         Class<?> implClass = implementation.getImplementationClass();
-        PojoComponentType componentType = loadByIntrospection(parent, implementation, deploymentContext);
+        PojoComponentType<JavaMappedService, ComponentTypeReferenceDefinition, JavaMappedProperty<?>> componentType = loadByIntrospection(parent, implementation, deploymentContext);
         URL resource = implClass.getResource(JavaIntrospectionHelper.getBaseName(implClass) + ".componentType");
         if (resource != null) {
             // TODO: TUSCANY-1111, How to merge the component type loaded from the file into the PojoComponentType
-            PojoComponentType sideFileCT = loadFromSidefile(parent, resource, deploymentContext);
+            PojoComponentType<?, ComponentTypeReferenceDefinition, ?> sideFileCT = loadFromSidefile(parent, resource, deploymentContext);
 
             // TODO: TUSCANY-1111, hack to get the sidefile defined WSDLServiceContract used
             // only works with a single service
@@ -98,6 +103,20 @@
                 newServiceContract.setInterfaceClass(contract.getInterfaceClass());
                 newServiceContract.setDataBinding(contract.getDataBinding());
                 actualSD.setServiceContract(newServiceContract);
+            }
+            
+            //TODO: if introspection has not yeilded any info, then atleast pick up things in the sidefile
+            //[svkrish] needed this for references overriding verification
+            ComponentTypeReferenceDefinition ctRefSideFile = null;
+            for (ComponentTypeReferenceDefinition ctRefIntrospection : componentType.getReferences().values()) {
+                if(ctRefIntrospection.getTargets() == null | ctRefIntrospection.getTargets().size() == 0) {
+                    ctRefSideFile = sideFileCT.getReferences().get(ctRefIntrospection.getName());
+                    if (ctRefSideFile != null) {
+                        for(URI uri : ctRefSideFile.getTargets()) {
+                            ctRefIntrospection.addTarget(uri);
+                        }
+                    }
+                }
             }
         }
         implementation.setComponentType(componentType);

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java Tue Mar 27 05:18:53 2007
@@ -150,7 +150,7 @@
         JavaMappedReference reference = new JavaMappedReference();
         reference.setName(name);
         reference.setMember(member);
-        reference.setRequired(false);
+        //reference.setRequired(false);
         ServiceContract contract;
         try {
             contract = registry.introspect(paramType, false);
@@ -239,7 +239,7 @@
         }
         reference.setName(name);
         boolean required = autowireAnnot.required();
-        reference.setRequired(required);
+        //reference.setRequired(required);
         try {
             Class<?> rawType = param;
             if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
@@ -369,7 +369,7 @@
         }
         reference.setName(name);
         boolean required = refAnnotation.required();
-        reference.setRequired(required);
+        //reference.setRequired(required);
         try {
             Class<?> rawType = param;
             if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java?view=diff&rev=522885&r1=522884&r2=522885
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java Tue Mar 27 05:18:53 2007
@@ -94,7 +94,7 @@
         JavaMappedReference reference = new JavaMappedReference();
         reference.setMember(method);
         reference.setAutowire(isAutowire);
-        reference.setRequired(required);
+        //reference.setRequired(required);
         reference.setName(name);
         ServiceContract contract;
         try {
@@ -146,7 +146,7 @@
         }
         JavaMappedReference reference = new JavaMappedReference();
         reference.setMember(field);
-        reference.setRequired(required);
+        //reference.setRequired(required);
         reference.setAutowire(autowire);
         reference.setName(name);
         ServiceContract contract;



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message