You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/09/17 01:37:53 UTC

svn commit: r576211 [3/5] - in /incubator/tuscany/branches/sca-java-1.0: itest/ itest/osgi-contribution/ itest/osgi-contribution/contribution-classes-v2/ itest/osgi-contribution/contribution-classes-v2/src/ itest/osgi-contribution/contribution-classes-...

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java Sun Sep 16 16:37:32 2007
@@ -25,7 +25,7 @@
 public class DSFactoryTestCase extends FactoryTestCase {
 
     public DSFactoryTestCase() {
-        super("sca/factory-ds-test.composite");
+        super("factory/factory-ds-test.composite");
     }
     
     

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class FactoryTestCase extends SupplyChainTestCase {
 
     public FactoryTestCase() {
-        super("sca/factory-test.composite");
+        super("factory/factory-test.composite");
     }
     
     protected FactoryTestCase(String compositeName) {

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java Sun Sep 16 16:37:32 2007
@@ -23,10 +23,10 @@
 /**
  * OSGi test program - declarative with components exposing multiple services with multiple interfaces
  */
-public class DSInterfacesTestCase extends SupplyChainTestCase {
+public abstract class DSInterfacesTestCase extends SupplyChainTestCase {
 
     public DSInterfacesTestCase() {
-        super("sca/interfaces-ds-test.composite");
+        super("interfaces/interfaces-ds-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java Sun Sep 16 16:37:32 2007
@@ -23,10 +23,10 @@
 /**
  * OSGi test program - procedural with components exposing multiple services with multiple interfaces
  */
-public class InterfacesTestCase extends SupplyChainTestCase {
+public abstract class InterfacesTestCase extends SupplyChainTestCase {
 
     public InterfacesTestCase() {
-        super("sca/interfaces-test.composite");
+        super("interfaces/interfaces-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java Sun Sep 16 16:37:32 2007
@@ -25,7 +25,7 @@
 public class DSProperties2TestCase extends Properties2TestCase {
 
     public DSProperties2TestCase() {
-        super("sca/properties2-ds-test.composite");
+        super("properties/properties2-ds-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java Sun Sep 16 16:37:32 2007
@@ -25,7 +25,7 @@
 public class DSPropertiesTestCase extends PropertiesTestCase {
 
     public DSPropertiesTestCase() {
-        super("sca/properties-ds-test.composite");
+        super("properties/properties-ds-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java Sun Sep 16 16:37:32 2007
@@ -38,7 +38,7 @@
     
     public Properties2TestCase() {
         super();
-        compositeName = "sca/properties2-test.composite";
+        compositeName = "properties/properties2-test.composite";
     }
     
     protected Properties2TestCase(String compositeName) {
@@ -48,7 +48,7 @@
 
     protected void setUp() throws Exception {
         
-        OSGiTestUtil.setUpOSGiTestRutime();
+        OSGiTestUtil.setUpOSGiTestRuntime();
         
         scaDomain = SCADomain.newInstance(compositeName);
         stockQuoteServiceUSD = scaDomain.getService(StockQuote.class, "USDStockQuoteComponent");

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java Sun Sep 16 16:37:32 2007
@@ -37,7 +37,7 @@
     
     public PropertiesTestCase() {
         super();
-        compositeName = "sca/properties-test.composite";
+        compositeName = "properties/properties-test.composite";
     }
     
     protected PropertiesTestCase(String compositeName) {
@@ -47,7 +47,7 @@
 
     protected void setUp() throws Exception {
         
-        OSGiTestUtil.setUpOSGiTestRutime();
+        OSGiTestUtil.setUpOSGiTestRuntime();
         
         scaDomain = SCADomain.newInstance(compositeName);
         stockQuoteService = scaDomain.getService(StockQuote.class, "StockQuoteComponent");

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class DSServicesTestCase extends SupplyChainTestCase {
 
     public DSServicesTestCase() {
-        super("sca/services-ds-test.composite");
+        super("services/services-ds-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class ServicesTestCase extends SupplyChainTestCase {
 
     public ServicesTestCase() {
-        super("sca/services-test.composite");
+        super("services/services-test.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class DSVersionTestCase extends VersionedSupplyChainTestCase {
     
     public DSVersionTestCase() {
-        super("sca/version-ds-test.composite");
+        super("version/version-ds-test.composite");
     }
     
     

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public  class VersionTestCase extends VersionedSupplyChainTestCase {
     
     public VersionTestCase() {
-        super("sca/version-test.composite");
+        super("version/version-test.composite");
     }
     
     

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class DSWiring1TestCase extends SupplyChainTestCase {
 
     public DSWiring1TestCase() {
-        super("sca/wiring-ds-test1.composite");
+        super("wiring/wiring-ds-test1.composite");
     }
     
     

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class DSWiring2TestCase extends SupplyChainTestCase {
 
     public DSWiring2TestCase() {
-        super("sca/wiring-ds-test2.composite");
+        super("wiring/wiring-ds-test2.composite");
     }
     
     

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class Wiring1TestCase extends SupplyChainTestCase {
 
     public Wiring1TestCase() {
-        super("sca/wiring-test1.composite");
+        super("wiring/wiring-test1.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java Sun Sep 16 16:37:32 2007
@@ -26,7 +26,7 @@
 public class Wiring2TestCase extends SupplyChainTestCase {
 
     public Wiring2TestCase() {
-        super("sca/wiring-test2.composite");
+        super("wiring/wiring-test2.composite");
     }
    
 }

Modified: incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java Sun Sep 16 16:37:32 2007
@@ -18,7 +18,7 @@
  */
 package util;
 
-import org.apache.tuscany.sca.implementation.osgi.runtime.OSGiRuntime;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
 
 
 /**
@@ -26,13 +26,13 @@
  */
 public  class OSGiTestUtil  {
     
-    public static void setUpOSGiTestRutime() throws Exception {
+    public static void setUpOSGiTestRuntime() throws Exception {
 
-        setUpFelixTestRutime();
+        setUpFelixTestRuntime();
     }
     
     
-    private static void setUpFelixTestRutime() throws Exception {
+    private static void setUpFelixTestRuntime() throws Exception {
 
         String felixConfigFileName = "file:target/test-classes/osgi/felix/felix.config.properties";
         

Modified: incubator/tuscany/branches/sca-java-1.0/itest/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/pom.xml?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/itest/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0/itest/pom.xml Sun Sep 16 16:37:32 2007
@@ -61,6 +61,7 @@
                 <module>large-sdo-ws</module>
                 <module>operation-overloading</module>
                 <module>osgi-implementation</module>
+                <module>osgi-contribution</module>
                 <module>properties</module>
                 <module>recursive</module>
                 <module>references</module>

Modified: incubator/tuscany/branches/sca-java-1.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java Sun Sep 16 16:37:32 2007
@@ -46,8 +46,6 @@
 
 public class CompositeConfigurationBuilderImpl {
 
-    private String CALLBACK_PREFIX = "$callback$.";
-
     private AssemblyFactory assemblyFactory;
     private SCABindingFactory scaBindingFactory;
     private CompositeBuilderMonitor monitor;
@@ -309,7 +307,7 @@
                 if (componentReference.getCallback() != null) {
                     for (Binding binding : componentReference.getCallback().getBindings()) {
                         if (binding.getName() == null) {
-                            binding.setName(CALLBACK_PREFIX + componentReference.getName());
+                            binding.setName(componentReference.getName());
                         }
                     }
                 }
@@ -726,7 +724,7 @@
                                                             // unit tests
             reference.getInterfaceContract().getCallbackInterface() != null) {
                 ComponentService service =
-                    componentServices.get(CALLBACK_PREFIX + reference.getName());
+                    componentServices.get(reference.getName());
                 if (service == null) {
                     service = createCallbackService(component, reference);
                 }
@@ -749,7 +747,7 @@
     private ComponentService createCallbackService(Component component, ComponentReference reference) {
         ComponentService componentService = assemblyFactory.createComponentService();
         componentService.setIsCallback(true);
-        componentService.setName(CALLBACK_PREFIX + reference.getName());
+        componentService.setName(reference.getName());
         try {
             InterfaceContract contract =
                 (InterfaceContract)reference.getInterfaceContract().clone();
@@ -762,7 +760,7 @@
         Reference implReference = reference.getReference();
         if (implReference != null) {
             Service implService = assemblyFactory.createService();
-            implService.setName(CALLBACK_PREFIX + implReference.getName());
+            implService.setName(implReference.getName());
             try {
                 InterfaceContract implContract =
                     (InterfaceContract)implReference.getInterfaceContract().clone();
@@ -791,7 +789,7 @@
                                                             // unit tests
             service.getInterfaceContract().getCallbackInterface() != null) {
                 ComponentReference reference =
-                    componentReferences.get(CALLBACK_PREFIX + service.getName());
+                    componentReferences.get(service.getName());
                 if (reference == null) {
                     reference = createCallbackReference(component, service);
                 }
@@ -814,7 +812,7 @@
     private ComponentReference createCallbackReference(Component component, ComponentService service) {
         ComponentReference componentReference = assemblyFactory.createComponentReference();
         componentReference.setIsCallback(true);
-        componentReference.setName(CALLBACK_PREFIX + service.getName());
+        componentReference.setName(service.getName());
         try {
             InterfaceContract contract = (InterfaceContract)service.getInterfaceContract().clone();
             contract.setInterface(contract.getCallbackInterface());
@@ -826,7 +824,7 @@
         Service implService = service.getService();
         if (implService != null) {
             Reference implReference = assemblyFactory.createReference();
-            implReference.setName(CALLBACK_PREFIX + implService.getName());
+            implReference.setName(implService.getName());
             try {
                 InterfaceContract implContract =
                     (InterfaceContract)implService.getInterfaceContract().clone();

Copied: incubator/tuscany/branches/sca-java-1.0/modules/binding-osgi/pom.xml (from r576207, incubator/tuscany/java/sca/modules/binding-osgi/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/binding-osgi/pom.xml?p2=incubator/tuscany/branches/sca-java-1.0/modules/binding-osgi/pom.xml&p1=incubator/tuscany/java/sca/modules/binding-osgi/pom.xml&r1=576207&r2=576211&rev=576211&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-osgi/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/binding-osgi/pom.xml Sun Sep 16 16:37:32 2007
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.tuscany.sca</groupId>
         <artifactId>tuscany-modules</artifactId>
-        <version>1.1-incubating-SNAPSHOT</version>
+        <version>1.0-incubating-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-host-embedded</artifactId>
-            <version>1.1-incubating-SNAPSHOT</version>
+            <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>

Modified: incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java Sun Sep 16 16:37:32 2007
@@ -69,34 +69,38 @@
 
         // make sure that the epr of the target service is set in the TO
         // field of the message
-        EndpointReference ep = msg.getTo();
+        EndpointReference to = msg.getTo();
 
         // check to see if we either don't have an endpoint set or if the uri 
         // is dynamic or the target service is marked as unresolved
-        if ((ep == null) || (ep.getURI().equals("/") || (ep.getContract() == null) || (ep.getContract().isUnresolved()))) {
+        if ((to == null) || (to.getURI().equals("/") || (to.getContract() == null) || (to.getContract().isUnresolved()))) {
 
-            EndpointReference serviceEPR = provider.getServiceEndpoint();
+            EndpointReference eprTo = provider.getServiceEndpoint();
 
-            if (serviceEPR == null) {
+            if (eprTo == null) {
                 throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
                     + " can't be found for component: "
                     + provider.getComponent().getName()
                     + " reference: "
                     + provider.getComponentReference().getName());
             }
-            msg.setTo(serviceEPR);
+            if (to != null) {
+                to.mergeEndpoint(eprTo);
+            } else {
+                msg.setTo(eprTo);
+            }
         }
 
         // make sure that the epr of the callback service (if there is one) is set
-        // in the from/callback field of the message. 
-        ep = msg.getFrom();
+        // in the callbackReference field of the message. 
+        EndpointReference callbackEPR = msg.getTo().getReferenceParameters().getCallbackReference();
 
-        if ((ep == null) || (ep.getURI().equals("/"))) {
+        if ((callbackEPR == null) || (callbackEPR.getURI().equals("/"))) {
 
-            EndpointReference callbackEPR = provider.getCallbackEndpoint();
+            callbackEPR = provider.getCallbackEndpoint();
 
             if (callbackEPR != null) {
-                ep.setCallbackEndpoint(callbackEPR);
+                msg.getTo().getReferenceParameters().setCallbackReference(callbackEPR);
             }
         }
 
@@ -107,7 +111,7 @@
             
             returnMessage = axis2Invoker.invoke(msg);
             
-            if ( returnMessage.getBody().getClass() == AxisFault.class){
+            if ( AxisFault.class.isInstance(returnMessage.getBody())){
                 
                 AxisFault axisFault =  returnMessage.getBody();  
                 

Modified: incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java Sun Sep 16 16:37:32 2007
@@ -58,6 +58,7 @@
     public static final QName QNAME_WSA_TO =
         new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO);
 
+    public static final QName CALLBACK_REFERENCE_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackReference");
     public static final QName CALLBACK_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackID");
     public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "ConversationID");
 
@@ -147,6 +148,10 @@
         }
 
         // set callback endpoint and callback ID for WS-Addressing header
+        if (parameters.getCallbackReference() != null) {
+            toEPR.addReferenceParameter(CALLBACK_REFERENCE_REFPARM_QN,
+                                        parameters.getCallbackReference().getBinding().getURI());
+        }
         if (parameters.getCallbackID() != null) {
             //FIXME: serialize callback ID to XML in case it is not a string
             toEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, parameters.getCallbackID().toString());
@@ -160,35 +165,18 @@
             toEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
         }
 
-        EndpointReference fromEPR = null;
-        if (msg.getFrom().getCallbackEndpoint() != null) {
-            fromEPR = new EndpointReference(msg.getFrom().getCallbackEndpoint().getBinding().getURI());
-        }
-
         // add WS-Addressing header
         //FIXME: is there any way to use the Axis2 addressing support for this?
-        if (toEPR != null || fromEPR != null) {
+        if (toEPR != null) {
             SOAPEnvelope sev = requestMC.getEnvelope();
             SOAPHeader sh = sev.getHeader();
-            if (toEPR != null) {
-                OMElement epr =
-                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
-                                                 toEPR,
-                                                 QNAME_WSA_TO,
-                                                 AddressingConstants.Final.WSA_NAMESPACE);
-                sh.addChild(epr);
-                requestMC.setTo(toEPR);
-            }
-            if (fromEPR != null) {
-                OMElement epr =
-                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
-                                                 fromEPR,
-                                                 QNAME_WSA_FROM,
-                                                 AddressingConstants.Final.WSA_NAMESPACE);
-                sh.addChild(epr);
-                requestMC.setFrom(fromEPR);
-            }
-
+            OMElement epr =
+                EndpointReferenceHelper.toOM(sev.getOMFactory(),
+                                             toEPR,
+                                             QNAME_WSA_TO,
+                                             AddressingConstants.Final.WSA_NAMESPACE);
+            sh.addChild(epr);
+            requestMC.setTo(toEPR);
         }
 
         operationClient.addMessageContext(requestMC);

Modified: incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Sun Sep 16 16:37:32 2007
@@ -71,6 +71,7 @@
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
@@ -399,6 +400,13 @@
                             conversationID = convIDElement.getText();
                         }
                     }
+                    OMElement callbackAddrElement =
+                        params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_REFERENCE_REFPARM_QN);
+                    if (callbackAddrElement != null) {
+                        if (contract.getInterfaceContract().getCallbackInterface() != null) {
+                            callbackAddress = callbackAddrElement.getText();
+                        }
+                    }
                     OMElement callbackIDElement =
                         params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
                     if (callbackIDElement != null) {
@@ -408,36 +416,35 @@
                     }
                 }
             }
-
-            OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
-            if (from != null) {
-                OMElement addrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
-                if (addrElement != null && contract.getInterfaceContract().getCallbackInterface() != null) {
-                    callbackAddress = addrElement.getText();
-                }
-            }
         }
 
-        RuntimeWire wire = null;
-        try {
-            wire = (RuntimeWire)(((RuntimeComponentService)contract).getRuntimeWire(getBinding())).clone();
-        } catch (CloneNotSupportedException e) {
-            // Should not happen
+        // create a message object and set the args as its body
+        Message msg = messageFactory.createMessage();
+        msg.setBody(args);
+
+        // if reference parameters are needed, create a new "To" EPR to hold them
+        EndpointReference to = null;
+        if (callbackAddress != null ||
+            callbackID != null ||
+            conversationID != null) {
+            to = new EndpointReferenceImpl(null);
+            msg.setTo(to);
         }
-        EndpointReference source = wire.getSource();
+
+        // set the reference parameters into the "To" EPR
         if (callbackAddress != null) {
-            source.setCallbackEndpoint(new EndpointReferenceImpl(callbackAddress));
+            to.getReferenceParameters().setCallbackReference(new EndpointReferenceImpl(callbackAddress));
         }
-
-        EndpointReference to = wire.getTarget();
         if (callbackID != null) {
             to.getReferenceParameters().setCallbackID(callbackID);
         }
         if (conversationID != null) {
             to.getReferenceParameters().setConversationID(conversationID);
         }
-        return wire.invoke(op, args);
 
+        // find the runtime wire and invoke it with the message
+        RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
+        return wire.invoke(op, msg);
     }
 
     public boolean isConversational() {

Modified: incubator/tuscany/branches/sca-java-1.0/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java Sun Sep 16 16:37:32 2007
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.contribution.java.impl;
 
 import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -40,10 +41,21 @@
     protected WeakReference<ClassLoader> classLoader;
     private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
     
+    private ModelResolver osgiResolver;
+    
     public ClassReferenceModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
         this.contribution = contribution;
         //FIXME The classloader should be passed in
         this.classLoader = new WeakReference<ClassLoader>(Thread.currentThread().getContextClassLoader());
+        
+        try {
+            Class osgiResolverClass = Class.forName("org.apache.tuscany.sca.contribution.osgi.impl.OSGiClassReferenceModelResolver");
+            if (osgiResolverClass != null) {
+                Constructor constructor = osgiResolverClass.getConstructor(Contribution.class, ModelFactoryExtensionPoint.class);
+                this.osgiResolver = (ModelResolver)constructor.newInstance(contribution, modelFactories);
+            }
+        } catch (Exception e) {
+        }
     }
 
     public void addModel(Object resolved) {
@@ -89,11 +101,19 @@
         
         //Load a class on demand
         Class clazz = null;
-        try {
-            clazz = Class.forName(((ClassReference)unresolved).getClassName(), true, classLoader.get());
-        } catch (ClassNotFoundException e) {
-            //we will later try to delegate to imported model resolvers
+        
+        if (osgiResolver != null)
+            resolved = osgiResolver.resolveModel(modelClass, unresolved);
+        
+        if (unresolved == resolved || resolved == null) {
+            try {
+                clazz = Class.forName(((ClassReference)unresolved).getClassName(), true, classLoader.get());
+            } catch (ClassNotFoundException e) {
+                //we will later try to delegate to imported model resolvers
+            }
         }
+        else
+            clazz = ((ClassReference)resolved).getJavaClass();
 
 
         if (clazz != null) {

Propchange: incubator/tuscany/branches/sca-java-1.0/modules/contribution-osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Sep 16 16:37:32 2007
@@ -0,0 +1,18 @@
+dojo
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+derby.log
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+.felix
+.externalToolBuilders
+maven-eclipse.xml

Copied: incubator/tuscany/branches/sca-java-1.0/modules/contribution-osgi/pom.xml (from r575799, incubator/tuscany/java/sca/modules/contribution-osgi/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/contribution-osgi/pom.xml?p2=incubator/tuscany/branches/sca-java-1.0/modules/contribution-osgi/pom.xml&p1=incubator/tuscany/java/sca/modules/contribution-osgi/pom.xml&r1=575799&r2=576211&rev=576211&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-osgi/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/contribution-osgi/pom.xml Sun Sep 16 16:37:32 2007
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.tuscany.sca</groupId>
         <artifactId>tuscany-modules</artifactId>
-        <version>1.1-incubating-SNAPSHOT</version>
+        <version>1.0-incubating-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>tuscany-contribution-osgi</artifactId>
@@ -32,19 +32,19 @@
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-contribution</artifactId>
-            <version>1.1-incubating-SNAPSHOT</version>
+            <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-osgi-runtime</artifactId>
-            <version>1.1-incubating-SNAPSHOT</version>
+            <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-core-spi</artifactId>
-            <version>1.1-incubating-SNAPSHOT</version>
+            <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
 
         <dependency>

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java Sun Sep 16 16:37:32 2007
@@ -87,5 +87,7 @@
     
     void setReferenceParameters(ReferenceParameters parameters);
     ReferenceParameters getReferenceParameters();
+
+    void mergeEndpoint(EndpointReference epr);
     
 }

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java Sun Sep 16 16:37:32 2007
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
 
 /**
  * The runtime wire interface that connects a component reference to a 
@@ -76,12 +77,21 @@
     
     /**
      * Invoke an operation with given arguments
-     * @param operation
+     * @param operation The operation
      * @param args The arguments
      * @return The result
      * @throws InvocationTargetException
      */
     Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
+
+    /**
+     * Invoke an operation with a context message
+     * @param operation The operation
+     * @param msg The message
+     * @return The result
+     * @throws InvocationTargetException
+     */
+    Object invoke(Operation operation, Message msg) throws InvocationTargetException;
 
     /**
      * @return a clone of the runtime wire

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java Sun Sep 16 16:37:32 2007
@@ -69,7 +69,6 @@
  */
 public class CompositeActivatorImpl implements CompositeActivator {
     private final static Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName());
-    private final static String CALLBACK_PREFIX = "$callback$.";
 
     private final AssemblyFactory assemblyFactory;
     private final MessageFactory messageFactory;
@@ -336,8 +335,7 @@
             Binding callbackBinding = null;
             for (Binding binding : callbackService.getBindings()) {
                 // first look for a callback binding whose name matches the reference binding name
-                if (binding.getName().equals(refBinding.getName()) || binding.getName()
-                    .equals(CALLBACK_PREFIX + refBinding.getName())) {
+                if (binding.getName().equals(refBinding.getName())) {
                     callbackBinding = binding;
                     break;
                 }

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java Sun Sep 16 16:37:32 2007
@@ -171,4 +171,14 @@
     public void setReferenceParameters(ReferenceParameters parameters) {
         this.parameters = parameters;
     }
+
+    public void mergeEndpoint(EndpointReference epr) {
+        this.component = epr.getComponent();
+        this.contract = epr.getContract();
+        this.binding = epr.getBinding();
+        this.interfaceContract = epr.getInterfaceContract();
+        this.uri = epr.getURI();
+        this.callbackEndpoint = epr.getCallbackEndpoint();
+    }
+   
 }

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java Sun Sep 16 16:37:32 2007
@@ -37,6 +37,7 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
@@ -117,7 +118,14 @@
     }
 
     public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
-        return invoker.invoke(operation, args);
+        Message msg = messageFactory.createMessage();
+        msg.setBody(args);
+        msg.setTo(wireTarget);
+        return invoker.invoke(operation, msg);
+    }
+
+    public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+        return invoker.invoke(operation, msg);
     }
 
     /**

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java Sun Sep 16 16:37:32 2007
@@ -72,8 +72,8 @@
     }
 
     public RuntimeWire selectCallbackWire(Message msgContext) {
-        EndpointReference from = msgContext.getFrom();
-        if (from == null) {
+        EndpointReference callbackEPR = getCallbackEndpoint(msgContext);
+        if (callbackEPR == null) {
             return null;
         }
 
@@ -82,7 +82,7 @@
 
         // first choice is wire with matching destination endpoint
         for (RuntimeWire wire : wires) {
-            if (from.getURI().equals(wire.getTarget().getURI())) {
+            if (callbackEPR.getURI().equals(wire.getTarget().getURI())) {
                 try {
                     return (RuntimeWire)wire.clone();
                 } catch (CloneNotSupportedException e) {

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java Sun Sep 16 16:37:32 2007
@@ -28,6 +28,7 @@
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 import org.osoa.sca.NoRegisteredCallbackException;
@@ -93,7 +94,8 @@
         callbackID = msgContext.getTo().getReferenceParameters().getCallbackID();
         ((CallbackWireObjectFactory)callableReference).attachCallbackID(callbackID);
 
-        setEndpoint(msgContext.getFrom().getCallbackEndpoint());
+        EndpointReference epr = msgContext.getTo().getReferenceParameters().getCallbackReference();
+        setEndpoint(epr);
 
         // need to set the endpoint on the binding also so that when the chains are created next
         // the sca binding can decide whether to provide local or remote invokers. 
@@ -101,7 +103,7 @@
         //        binding that may possibly be trying to point at two things in the multi threaded 
         //        case. Need to confirm the general model here and how the clone and bind part
         //        is intended to work
-        wire.getSource().getBinding().setURI(msgContext.getFrom().getCallbackEndpoint().getURI());
+        wire.getSource().getBinding().setURI(epr.getURI());
 
         // also need to set the target contract as it varies for the sca binding depending on 
         // whether it is local or remote

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java Sun Sep 16 16:37:32 2007
@@ -278,7 +278,6 @@
                 EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                 parameters.setCallbackReference(callbackRef);
             } else {
-                parameters.setCallbackReference(wire.getSource().getCallbackEndpoint());
                 if (interfaze != null) {
                     if (!interfaze.isConversational()) {
                         throw new IllegalArgumentException(

Modified: incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java Sun Sep 16 16:37:32 2007
@@ -79,29 +79,33 @@
         }
     }
 
-    public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
-        return invoke(wire, operation, args);
+    public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+        return invoke(wire, operation, msg);
     }
 
-    public Object invoke(RuntimeWire wire, Operation operation, Object[] args) throws InvocationTargetException {
+    public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
         RuntimeWire runtimeWire = wire == null ? this.wire : wire;
         InvocationChain chain = runtimeWire.getInvocationChain(operation);
-        return invoke(chain, args, runtimeWire);
+        return invoke(chain, msg, runtimeWire);
     }
 
-    protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire) throws InvocationTargetException {
+    protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
 
-        Message msg = messageFactory.createMessage();
         msg.setFrom(wire.getSource());
+        EndpointReference epTo = null;
         if (endpoint != null) {
-            msg.setTo(endpoint);
+            epTo = endpoint;
         } else {
-            msg.setTo(wire.getTarget());
+            epTo = wire.getTarget();
+        }
+        if (msg.getTo() != null) {
+            msg.getTo().mergeEndpoint(epTo);
+        } else {
+            msg.setTo(epTo);
         }
         Invoker headInvoker = chain.getHeadInvoker();
         Operation operation = chain.getTargetOperation();
         msg.setOperation(operation);
-        msg.setBody(args);
 
         Message msgContext = ThreadMessageContext.getMessageContext();
         Object currentConversationID = msgContext.getTo().getReferenceParameters().getConversationID();
@@ -176,7 +180,6 @@
                 EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                 parameters.setCallbackReference(callbackRef);
             } else {
-                parameters.setCallbackReference(wire.getSource().getCallbackEndpoint());
                 if (interfaze != null) {
                     if (!interfaze.isConversational()) {
                         throw new IllegalArgumentException(

Modified: incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/pom.xml?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/pom.xml (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/pom.xml Sun Sep 16 16:37:32 2007
@@ -77,6 +77,24 @@
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-xml</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-assembly-xml</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
@@ -88,9 +106,21 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution-osgi</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-osgi-runtime</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>3.8.1</version>
+            <version>4.2</version>
             <scope>test</scope>
         </dependency>
 

Modified: incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java Sun Sep 16 16:37:32 2007
@@ -23,7 +23,6 @@
 import org.apache.tuscany.sca.assembly.ComponentProperty;
 import org.apache.tuscany.sca.assembly.Extensible;
 import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.scope.Scope;
 
 /**
  * 
@@ -32,13 +31,11 @@
  */
 public interface OSGiImplementationInterface extends Implementation, Extensible {
     
-    public String getBundleName();
+    public String getBundleSymbolicName();
     
-    public String getBundleLocation();
+    public String getBundleVersion();
     
     public String[] getImports();
-    
-    public Scope getScope();
     
     public List<ComponentProperty> getReferenceProperties(String referenceName);
     

Modified: incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java Sun Sep 16 16:37:32 2007
@@ -18,14 +18,10 @@
  */
 package org.apache.tuscany.sca.implementation.osgi.invocation;
 
-
-import java.beans.Introspector;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.HashSet;
@@ -44,21 +40,29 @@
 import org.apache.tuscany.sca.assembly.Property;
 import org.apache.tuscany.sca.assembly.Reference;
 import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.RequestContextFactory;
 import org.apache.tuscany.sca.core.context.InstanceWrapper;
 import org.apache.tuscany.sca.core.factory.ObjectCreationException;
 import org.apache.tuscany.sca.core.factory.ObjectFactory;
 import org.apache.tuscany.sca.core.invocation.JDKProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
 import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
 import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
 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.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
-import org.apache.tuscany.sca.implementation.osgi.context.OSGiPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.osgi.runtime.OSGiRuntime;
+import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
 import org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementation;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -66,7 +70,9 @@
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
 import org.osgi.framework.Constants;
 import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.FrameworkListener;
@@ -80,11 +86,14 @@
  * The runtime instantiation of OSGi component implementations
  * 
  */
-public class OSGiImplementationProvider  implements ScopedImplementationProvider, FrameworkListener {
+public class OSGiImplementationProvider  implements ScopedImplementationProvider, 
+                                                    FrameworkListener,
+                                                    BundleListener {
     
     private static final String COMPONENT_SERVICE_NAME = "component.service.name";
   
     private OSGiImplementation implementation;
+    private OSGiAnnotations osgiAnnotations;
     private BundleContext bundleContext;
     
     private Hashtable<RuntimeWire, Reference> referenceWires = new Hashtable<RuntimeWire,Reference>();
@@ -92,7 +101,12 @@
                        = new Hashtable<RuntimeWire,ComponentReference>();
     private HashSet<RuntimeWire> resolvedWires = new HashSet<RuntimeWire>();   
     private boolean wiresResolved;
-    private OSGiPropertyValueObjectFactory propertyValueFactory = new OSGiPropertyValueObjectFactory();
+    
+    private boolean bundleStarted;
+    
+    private boolean processedResolvedBundle, processingResolvedBundle;
+    
+    private JavaPropertyValueObjectFactory propertyValueFactory;
     
 
     private Hashtable<String, Object> componentProperties = new Hashtable<String, Object>();
@@ -105,7 +119,7 @@
     
     private OSGiRuntime osgiRuntime;
     
-    
+    private ScopeRegistry scopeRegistry;
     private DataBindingExtensionPoint dataBindingRegistry;
     
     private boolean packagesRefreshed;
@@ -113,15 +127,25 @@
 
     public OSGiImplementationProvider(RuntimeComponent definition,
             OSGiImplementationInterface impl,
-            DataBindingExtensionPoint dataBindingRegistry) throws BundleException {
+            DataBindingExtensionPoint dataBindingRegistry,
+            JavaPropertyValueObjectFactory propertyValueFactory,
+            ProxyFactory proxyFactory,
+            ScopeRegistry scopeRegistry,
+            RequestContextFactory requestContextFactory) throws BundleException {
         
         
         this.implementation = (OSGiImplementation)impl;
         this.runtimeComponent = definition;
         this.dataBindingRegistry = dataBindingRegistry;
-
+        this.propertyValueFactory = propertyValueFactory;
+        this.scopeRegistry = scopeRegistry;
+        
+        
         bundleContext = getBundleContext();
-        osgiBundle = installBundle();
+        osgiBundle = (Bundle)implementation.getOSGiBundle();
+        bundleContext.addBundleListener(this);
+        osgiServiceListener = new OSGiServiceListener(osgiBundle);        
+        bundleContext.addServiceListener(osgiServiceListener);    
         
         // Install and start all dependent  bundles
         String[] imports = implementation.getImports();
@@ -133,6 +157,17 @@
             }                
         }
         
+
+        this.osgiAnnotations = new OSGiAnnotations(
+                implementation.getModelFactories(),
+                implementation.getClassList(),
+                runtimeComponent,
+                propertyValueFactory,
+                proxyFactory,
+                requestContextFactory,
+                osgiBundle,
+                dependentBundles);
+
         
         // PackageAdmin is used to resolve bundles 
         org.osgi.framework.ServiceReference packageAdminReference = 
@@ -162,8 +197,9 @@
             for (Object p : props) {
              
                 Property prop = (Property)p;
-                ObjectFactory<?> objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue());
-                Object value = objFactory.getInstance();           
+                Class javaType = SimpleTypeMapperImpl.getJavaType(prop.getXSDType());
+                ObjectFactory<?> objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue(), javaType);
+                Object value = objFactory.getInstance();          
 
                 propsTable.put(prop.getName(), value);
             }
@@ -173,50 +209,21 @@
    
     private BundleContext getBundleContext() throws BundleException {
 
-        if (bundleContext == null) {
-            osgiRuntime = OSGiRuntime.getRuntime();
-            bundleContext = osgiRuntime .getBundleContext();       
+        try {
+            if (bundleContext == null) {
+                osgiRuntime = OSGiRuntime.getRuntime();
+                bundleContext = osgiRuntime .getBundleContext();       
+            }
+        } catch (BundleException e) {
+           throw e;
+        } catch (Exception e) {
+            throw new BundleException("Could not start OSGi runtime", e);
         }
         
-        return bundleContext;
-    }
-    
-    private Bundle getBundle() throws Exception {
         
-        Bundle[] bundles = bundleContext.getBundles();
-        for (Bundle b : bundles) {
-            if (b.getLocation().equals(implementation.getBundleName())) {
-                return b;
-            }
-        }
-        return null;
+        return bundleContext;
     }
-
     
-    // Install the bundle corresponding to this component.
-    private Bundle installBundle() throws ObjectCreationException {
-        try {
-            
-            Bundle bundle = null;
-            
-            if ((bundle = getBundle()) == null) {
-               
-                String bundleName = implementation.getBundleLocation();
-                                
-                bundle = bundleContext.installBundle(bundleName);
-                
-            }          
-
-            osgiServiceListener = new OSGiServiceListener(bundle);
-            
-            bundleContext.addServiceListener(osgiServiceListener);    
-
-            return bundle;
-            
-        } catch (Exception e) {
-            throw new ObjectCreationException(e);
-        }
-    }
     
     private String getOSGiFilter(Hashtable<String, Object> props) {
         
@@ -318,13 +325,18 @@
     protected Bundle startBundle() throws ObjectCreationException {
 
         try {
-    
-            if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) {
-        
+            
+            if (!bundleStarted) {
+                
+                bundleStarted = true;
+                
                 configurePropertiesUsingConfigAdmin();
-        
+                
                 resolveBundle();
                 
+                processAnnotations();
+                
+                
                 for (Bundle bundle : dependentBundles) {
                     try {
                         if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
@@ -335,8 +347,11 @@
                             throw e;
                     }
                 }
-            
-                if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) {
+                
+            }
+    
+            if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) {
+        
 
                     int retry = 0;
                 
@@ -353,8 +368,7 @@
                             throw e;
                         }
                     }
-                }                   
-            }
+                }     
    
         } catch (Exception e) {
             throw new ObjectCreationException(e);
@@ -363,11 +377,17 @@
     }
     
     
+    // This method is called by OSGiInstanceWrapper.getInstance to obtain the OSGI service reference
+    // corresponding to the specified service. The properties used to filter the service should
+    // be chosen based on whether this is a normal service or a callback.
     protected org.osgi.framework.ServiceReference getOSGiServiceReference(ComponentService service) 
             throws ObjectCreationException {
          
         Hashtable<String, Object> props = new Hashtable<String, Object>();
-        processProperties(implementation.getServiceProperties(service.getName()), props);
+        if (!service.isCallback())
+            processProperties(implementation.getServiceProperties(service.getName()), props);
+        else
+            processProperties(implementation.getServiceCallbackProperties(service.getName()), props);
         
         String filter = getOSGiFilter(props);
         Interface serviceInterface = service.getInterfaceContract().getInterface();
@@ -643,7 +663,7 @@
     
     public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
         
-        return new OSGiInstanceWrapper<Object>(this, bundleContext);
+        return new OSGiInstanceWrapper<Object>(this, osgiAnnotations, bundleContext);
     }
     
    
@@ -689,7 +709,12 @@
     private boolean resolveWireResolveReferences(Bundle bundle, Class interfaceClass, RuntimeWire wire,
             boolean isOSGiToOSGiWire) throws Exception {
         
-        boolean createProxy = false;
+
+        // FIXME: At the moment injection of values into instances require an instance to be obtained
+        // throught the instance wrapper, and hence requires a proxy. When we do this processing here,
+        // we dont yet know whether the target requires any property or callback injection. So it is
+        // safer to create a proxy all the time. 
+        boolean createProxy = true; 
        
         ComponentReference scaRef = componentReferenceWires.get(wire);
         Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
@@ -810,6 +835,11 @@
             
             if (!wiresResolved) {
                 wiresResolved = true;
+                
+                if (!setReferencesAndProperties()) {
+                    wiresResolved = false;
+                    return;
+                }
                     
                 int refPlusServices = referenceWires.size() + runtimeComponent.getServices().size();
                 boolean[] createProxyService = new boolean[refPlusServices];
@@ -892,7 +922,7 @@
     }
     
    
-    
+    @SuppressWarnings("unchecked")
     private void configurePropertiesUsingConfigAdmin() {
                
         try {
@@ -925,7 +955,8 @@
                     if (serviceProps != null) {
                         for (ComponentProperty prop : serviceProps) {
                             if (prop.getName().equals("service.pid")) {
-                                ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue());
+                                ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, 
+                                        prop.getValue(), String.class);
                                 pid = (String)objFactory.getInstance();
                             }
                         }
@@ -958,152 +989,32 @@
 
     }
     
-    protected void injectProperties(Object instance)  {
-        
-        if (!implementation.needsPropertyInjection())
-            return;
-        
-        Class implClass = instance.getClass();
-        List<ComponentProperty> compProps = runtimeComponent.getProperties();
-        
-        for (ComponentProperty prop : compProps) {
-            
-            boolean hasSetProp = false;
-            String propName = prop.getName();
-            ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue());
-            
-            try {
-                Field field = implClass.getDeclaredField(propName);
-                org.osoa.sca.annotations.Property propAnn;
-                
-                if ((propAnn = field.getAnnotation(org.osoa.sca.annotations.Property.class)) != null
-                        || Modifier.isPublic(field.getModifiers())) {
-                    
-                    try {
-                        if (!field.isAccessible())
-                            field.setAccessible(true);
-                            
-                        field.set(instance, objFactory.getInstance());
-                        hasSetProp = true;
-                    } catch (IllegalAccessException e) {
-                        if (propAnn.required())
-                            throw new RuntimeException(e);
-                    }
-                    
-                }
-            } catch (NoSuchFieldException e) {
-                // Ignore exception
-            }
-
-            if (!hasSetProp) {
-                Method[] methods = implClass.getDeclaredMethods();
-                org.osoa.sca.annotations.Property propAnn = null;
-
-                for (Method method : methods) {
-
-                    if (!method.getName().startsWith("set"))
-                        continue;
-                    if ((propAnn = method.getAnnotation(org.osoa.sca.annotations.Property.class)) != null
-                            || Modifier.isPublic(method.getModifiers())) {
-                        
-                        String methodPropName = Introspector.decapitalize(method.getName().substring(3));
-                        if (!propName.equals(methodPropName))
-                            continue;
-                    }
-                    try {
-                        if (!method.isAccessible())
-                            method.setAccessible(true);
-
-                        method.invoke(instance, objFactory.getInstance());
-                        hasSetProp = true;
-                    } catch (Exception e) {
-                        if (propAnn != null && propAnn.required())
-                            throw new RuntimeException(e);
-                    }
-                }
-            }
-
-        }
-        
-    }
     
-    protected void injectPropertiesWithoutAnnotations(Object instance)  {
-        
-        if (!implementation.needsPropertyInjection())
-            return;
-        
-        Class implClass = instance.getClass();
-        List<ComponentProperty> compProps = runtimeComponent.getProperties();
-        
-        for (ComponentProperty prop : compProps) {
-            
-            boolean hasSetProp = false;
-            String propName = prop.getName();
-            ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue());
-            
-            try {
-                Field field = implClass.getDeclaredField(propName);
-                
-                if (Modifier.isPublic(field.getModifiers())) {
-                   
-                    try {
-                        field.set(instance, objFactory.getInstance());
-                        hasSetProp = true;
-                    
-                    } catch (Exception e) {
-                        // Ignore
-                    }
-                }
-            } catch (NoSuchFieldException e) {
-                // Ignore exception
-            }
-
-            if (!hasSetProp) {
-                Method[] methods = implClass.getDeclaredMethods();
-                for (Method method : methods) {
-
-                    if (!method.getName().startsWith("set"))
-                        continue;
-                    if (Modifier.isPublic(method.getModifiers())) {
-                        
-                        String methodPropName = Introspector.decapitalize(method.getName().substring(3));
-                        if (!propName.equals(methodPropName))
-                            continue;
-                    }
-                    try {
-                        method.invoke(instance, objFactory.getInstance());
-                    } catch (Exception e) {
-                       // Ignore
-                    }
-                }
-            }
-
-        }
-        
-    }
-
-
     
     public boolean isOptimizable() {
         return false;
     }
     
     public Scope getScope() {
-        return implementation.getScope();
+        return osgiAnnotations.getScope();
     }
 
     public boolean isEagerInit() {
-        return implementation.isEagerInit();
+        return osgiAnnotations.isEagerInit();
     }
 
     public long getMaxAge() {
-        return implementation.getMaxAge();
+        return osgiAnnotations.getMaxAge();
     }
 
     public long getMaxIdleTime() {
-        return implementation.getMaxIdleTime();
+        return osgiAnnotations.getMaxIdleTime();
     }
     
+    protected ScopeContainer<?> getScopeContainer() {
+        startBundle();
+        return ((ScopedRuntimeComponent)runtimeComponent).getScopeContainer();
+    }
     
     public Invoker createTargetInvoker(RuntimeComponentService service, Operation operation)  {
        
@@ -1112,9 +1023,9 @@
         boolean isRemotable = serviceInterface.isRemotable();
 
 
-        Invoker invoker = new OSGiTargetInvoker(operation, runtimeComponent, service);
+        Invoker invoker = new OSGiTargetInvoker(operation, this, service);
         if (isRemotable) {
-            return new OSGiRemotableInvoker(implementation, dataBindingRegistry, operation, runtimeComponent, service);
+            return new OSGiRemotableInvoker(osgiAnnotations, dataBindingRegistry, operation, this, service);
         } else {
             return invoker;
         }
@@ -1131,14 +1042,16 @@
         return createTargetInvoker(service, operation);
     }
 
-    public void start() {
-                
+    private boolean setReferencesAndProperties() {
+       
         for (Reference ref: implementation.getReferences()) {
             List<RuntimeWire> wireList = null;
             ComponentReference compRef = null;
             for (ComponentReference cRef : runtimeComponent.getReferences()) {
                 if (cRef.getName().equals(ref.getName())) {
+                    
                     wireList = ((RuntimeComponentReference)cRef).getRuntimeWires();
+                    
                     compRef = cRef;
                     break;
                 }
@@ -1166,12 +1079,71 @@
         
         processProperties(runtimeComponent.getProperties(), componentProperties);
         
+        return true;
+        
     }
     
+    public void start() {
+        setReferencesAndProperties();
+    }
+        
+    public void processAnnotations() throws IntrospectionException {
+        
+        synchronized (this) {       
+            if (processedResolvedBundle || processingResolvedBundle)
+                return;
+            processingResolvedBundle = true;
+        }
+        
+        osgiAnnotations.processAnnotations();
+        
+        Scope scope = osgiAnnotations.getScope();
+        if (scope.equals(Scope.SYSTEM) || scope.equals(Scope.COMPOSITE)) {
+            // Nothing
+        } else {
+
+            if (runtimeComponent instanceof ScopedRuntimeComponent) {
+
+                ScopedRuntimeComponent component = (ScopedRuntimeComponent) runtimeComponent;
+
+                ScopeContainer oldScopeContainer = component.getScopeContainer();
+                component.setScopeContainer(null);
+                ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
+
+                if (oldScopeContainer.getLifecycleState() == ScopeContainer.RUNNING)
+                    scopeContainer.start();
+                
+                component.setScopeContainer(scopeContainer);
+            }
+
+            // Check for conversational contract if conversational scope
+//            if (scope.equals(Scope.CONVERSATION)) {
+//                boolean hasConversationalContract = false;
+//                for (Service serviceDef : implementation.getServices()) {
+//                    if (serviceDef.getInterfaceContract().getInterface()
+//                            .isConversational()) {
+//                        hasConversationalContract = true;
+//                        break;
+//                    }
+//                }
+//                if (!hasConversationalContract) {
+//                    Exception e = new NoConversationalContractException(
+//                            runtimeComponent.getName() + ":" + osgiBundle);
+//                    throw new RuntimeException(e);
+//                }
+//            }
+        }
+            
+        synchronized (this) {                
+            processedResolvedBundle = true;
+            this.notifyAll();
+        }  
+    }
     
     public void stop() {
 
-        bundleContext.removeServiceListener(osgiServiceListener);
+        if (osgiServiceListener != null)
+            bundleContext.removeServiceListener(osgiServiceListener);
     }
 
     
@@ -1185,8 +1157,16 @@
         }
         
     }
-
-
+    
+    public void bundleChanged(BundleEvent event) {
+        if (event.getType() == BundleEvent.RESOLVED && event.getBundle() == osgiBundle) {
+            try {
+                processAnnotations();
+            } catch (Throwable e) {
+                e.printStackTrace();
+            }             
+        }
+    }
 
     private class OSGiServiceListener implements ServiceListener {
         

Modified: incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java?rev=576211&r1=576210&r2=576211&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java (original)
+++ incubator/tuscany/branches/sca-java-1.0/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java Sun Sep 16 16:37:32 2007
@@ -19,8 +19,16 @@
 package org.apache.tuscany.sca.implementation.osgi.invocation;
 
 
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
@@ -34,17 +42,30 @@
  */
 public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementationInterface> {
     
-    DataBindingExtensionPoint dataBindings;
+    private DataBindingExtensionPoint dataBindings;
+    private JavaPropertyValueObjectFactory propertyFactory;
+    private ProxyFactory proxyFactory;
+    private ScopeRegistry scopeRegistry;
     
-    public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+    private RequestContextFactory requestContextFactory;
+    
+    public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints ) {
         
         dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
-        //FIXME transformers is never used
-        //TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
-        //FIXME mediator is never used
-        //MediatorImpl mediator =new MediatorImpl(dataBindings, transformers);
-        //FIXME factory is never used
-        //OSGiPropertyValueObjectFactory factory = new OSGiPropertyValueObjectFactory(mediator);
+        proxyFactory = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+        ContextFactoryExtensionPoint contextFactories = extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class);
+        requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
+        
+
+        // FIXME: Scope registry is not an extension point, and this usage is specific
+        // to implementation.osgi since it needs to change scope after the component is
+        // created. Do we need to find a better way?
+        scopeRegistry = extensionPoints.getExtensionPoint(ScopeRegistry.class);
+        
+        TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
+        MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+        propertyFactory = new JavaPropertyValueObjectFactory(mediator);
+        
     }
 
     public ImplementationProvider createImplementationProvider(RuntimeComponent component,
@@ -52,7 +73,14 @@
                 
         try {
                 
-            return new OSGiImplementationProvider(component, implementation, dataBindings);
+            return new OSGiImplementationProvider(component, 
+                    implementation, 
+                    dataBindings,
+                    propertyFactory,
+                    proxyFactory,
+                    scopeRegistry,
+                    requestContextFactory
+                    );
                 
         } catch (BundleException e) {
             throw new RuntimeException(e);



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