You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/10 06:40:07 UTC

svn commit: r527018 - in /incubator/tuscany/java/sca/modules: assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/ implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/ implementation-java-xml/src/test/java/calcu...

Author: jsdelfino
Date: Mon Apr  9 21:40:06 2007
New Revision: 527018

URL: http://svn.apache.org/viewvc?view=rev&rev=527018
Log:
Added lazy resolution of implementations to CompositeProcessor. Load Java implementation class JavaImplementation.resolve().

Added:
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java   (with props)
Modified:
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/CompositeProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/CompositeProcessor.java?view=diff&rev=527018&r1=527017&r2=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/CompositeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/CompositeProcessor.java Mon Apr  9 21:40:06 2007
@@ -477,7 +477,16 @@
 
             Implementation implementation = component.getImplementation();
             implementation = resolver.resolve(Implementation.class, implementation);
-            component.setImplementation(implementation);
+            if (implementation.isUnresolved()) {
+                
+                // TODO we need to find a better way to do this
+                // Lazily resolve the implementation
+                extensionProcessor.resolve(implementation, resolver);
+                implementation.setUnresolved(false);
+                resolver.add(implementation);
+            } else {
+                component.setImplementation(implementation);
+            }
             
             resolveContract(component.getServices(), resolver);
             resolveContract(component.getReferences(), resolver);

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java?view=diff&rev=527018&r1=527017&r2=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java Mon Apr  9 21:40:06 2007
@@ -58,7 +58,7 @@
 
         try {
 
-            // Read an <interface.java>
+            // Read an <implementation.java>
             JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
             javaImplementation.setUnresolved(true);
             javaImplementation.setName(reader.getAttributeValue(null, CLASS));
@@ -90,13 +90,11 @@
         }
     }
 
-    public void resolve(JavaImplementation model, ArtifactResolver resolver) throws ContributionResolveException {
+    public void resolve(JavaImplementation javaImplementation, ArtifactResolver resolver) throws ContributionResolveException {
         try {
-            Class javaClass = Class.forName(model.getName(), true, Thread.currentThread().getContextClassLoader());
-            model.setJavaClass(javaClass);
-            introspectionRegistry.introspect(model.getJavaClass(), (JavaImplementationDefinition)model);
-            model.setUnresolved(false);
-            resolver.add(model);
+            Class javaClass = Class.forName(javaImplementation.getName(), true, Thread.currentThread().getContextClassLoader());
+            javaImplementation.setJavaClass(javaClass);
+            introspectionRegistry.introspect(javaImplementation.getJavaClass(), (JavaImplementationDefinition)javaImplementation);
         } catch (Exception e) {
             throw new ContributionResolveException(e);
         }

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+public interface AddService {
+
+    double add(double n1, double n2);
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class AddServiceImpl implements AddService {
+
+    public double add(double n1, double n2) {
+        return n1 + n2;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+    double add(double n1, double n2);
+
+    double subtract(double n1, double n2);
+
+    double multiply(double n1, double n2);
+
+    double divide(double n1, double n2);
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Scope("COMPOSITE")
+public class CalculatorServiceImpl implements CalculatorService {
+
+    private AddService addService;
+    private SubtractService subtractService;
+    private MultiplyService multiplyService;
+    private DivideService divideService;
+
+    @Reference
+    public void setAddService(AddService addService) {
+        this.addService = addService;
+    }
+
+    @Reference
+    public void setSubtractService(SubtractService subtractService) {
+        this.subtractService = subtractService;
+    }
+
+    @Reference
+    public void setDivideService(DivideService divideService) {
+        this.divideService = divideService;
+    }
+
+    @Reference
+    public void setMultiplyService(MultiplyService multiplyService) {
+        this.multiplyService = multiplyService;
+    }
+
+    public double add(double n1, double n2) {
+        return addService.add(n1, n2);
+    }
+
+    public double subtract(double n1, double n2) {
+        return subtractService.subtract(n1, n2);
+    }
+
+    public double multiply(double n1, double n2) {
+        return multiplyService.multiply(n1, n2);
+    }
+
+    public double divide(double n1, double n2) {
+        return divideService.divide(n1, n2);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+public interface DivideService {
+
+    double divide(double n1, double n2);
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("COMPOSITE")
+public class DivideServiceImpl implements DivideService {
+
+    public double divide(double n1, double n2) {
+        return n1 / n2;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+public interface MultiplyService {
+
+    double multiply(double n1, double n2);
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ */
+@Scope("COMPOSITE")
+public class MultiplyServiceImpl implements MultiplyService {
+
+    public double multiply(double n1, double n2) {
+        return n1 * n2;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+public interface SubtractService {
+
+    double subtract(double n1, double n2);
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java?view=auto&rev=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java Mon Apr  9 21:40:06 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Scope("COMPOSITE")
+public class SubtractServiceImpl implements SubtractService {
+
+    public double subtract(double n1, double n2) {
+        return n1 - n2;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java?view=diff&rev=527018&r1=527017&r2=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/xml/ReadTestCase.java Mon Apr  9 21:40:06 2007
@@ -28,8 +28,9 @@
 
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.util.CompositeUtil;
-import org.apache.tuscany.assembly.util.PrintUtil;
 import org.apache.tuscany.assembly.xml.impl.CompositeProcessor;
+import org.apache.tuscany.services.spi.contribution.ArtifactResolver;
+import org.apache.tuscany.services.spi.contribution.DefaultArtifactResolver;
 import org.apache.tuscany.services.spi.contribution.DefaultStAXArtifactProcessorRegistry;
 
 /**
@@ -45,6 +46,9 @@
     public void setUp() throws Exception {
         inputFactory = XMLInputFactory.newInstance();
         registry = new DefaultStAXArtifactProcessorRegistry();
+        
+        CompositeProcessor compositeProcessor = new CompositeProcessor(registry);
+        registry.addArtifactProcessor(compositeProcessor);
 
         JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor();
         registry.addArtifactProcessor(javaProcessor);
@@ -61,6 +65,21 @@
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
         assertNotNull(composite);
+
+        new CompositeUtil(composite).configure(null);
+
+        //new PrintUtil(System.out).print(composite);
+    }
+
+    public void testReadAndResolveComposite() throws Exception {
+        CompositeProcessor compositeProcessor = new CompositeProcessor(registry);
+        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeProcessor.read(reader);
+        assertNotNull(composite);
+        
+        ArtifactResolver resolver = new DefaultArtifactResolver();
+        registry.resolve(composite, resolver);
 
         new CompositeUtil(composite).configure(null);
 

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java?view=diff&rev=527018&r1=527017&r2=527018
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java Mon Apr  9 21:40:06 2007
@@ -34,8 +34,10 @@
     public String getName() {
         if (isUnresolved()) {
             return className;
-        } else {
+        } else if (javaClass != null) {
             return javaClass.getName();
+        } else {
+            return null;
         }
     }
 



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