You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/10/16 10:35:03 UTC

svn commit: r705178 [1/2] - in /tuscany/java/sca: itest/spring/ itest/spring/src/main/java/bigbank/ itest/spring/src/main/java/bigbank/stockquote/ itest/spring/src/main/java/calculator/ itest/spring/src/main/java/calculator/security/ itest/spring/src/m...

Author: antelder
Date: Thu Oct 16 01:35:01 2008
New Revision: 705178

URL: http://svn.apache.org/viewvc?rev=705178&view=rev
Log:
TUSCANY-2600: Apply patches from Ramkumar Ramalingam to Provide ITEST for the recent Spring Implementation changes

Added:
    tuscany/java/sca/itest/spring/src/main/java/bigbank/
    tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/
    tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java
    tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/
    tuscany/java/sca/itest/spring/src/main/java/calculator/AddService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/AddServiceImpl.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorServiceImpl.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/DivideService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/DivideServiceImpl.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyServiceImpl.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractService.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractServiceImpl.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/security/
    tuscany/java/sca/itest/spring/src/main/java/calculator/security/CalculatorCallbackHandler.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/security/JaasLoginModule.java
    tuscany/java/sca/itest/spring/src/main/java/calculator/security/UserPrincipal.java
    tuscany/java/sca/itest/spring/src/main/java/context/
    tuscany/java/sca/itest/spring/src/main/java/context/access/
    tuscany/java/sca/itest/spring/src/main/java/context/access/SCAApplicationContextProvider.java
    tuscany/java/sca/itest/spring/src/main/resources/CalculatorService-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/CalculatorService-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/CalculatorService-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/SpringImport-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/StockQuoteService-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/beanRefContext.xml
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/
    tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/CalculatorService-context.xml
    tuscany/java/sca/itest/spring/src/main/resources/context/
    tuscany/java/sca/itest/spring/src/main/resources/context/access/
    tuscany/java/sca/itest/spring/src/main/resources/context/access/Calculator.composite
    tuscany/java/sca/itest/spring/src/main/resources/context/imports/
    tuscany/java/sca/itest/spring/src/main/resources/context/imports/Calculator.composite
    tuscany/java/sca/itest/spring/src/main/resources/context/multiple/
    tuscany/java/sca/itest/spring/src/main/resources/context/multiple/StockQuote.composite
    tuscany/java/sca/itest/spring/src/main/resources/implementation/
    tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/
    tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/Calculator.composite
    tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorJass.config
    tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties
    tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/definitions.xml
    tuscany/java/sca/itest/spring/src/test/java/context/
    tuscany/java/sca/itest/spring/src/test/java/context/access/
    tuscany/java/sca/itest/spring/src/test/java/context/access/CalculatorClient.java
    tuscany/java/sca/itest/spring/src/test/java/context/imports/
    tuscany/java/sca/itest/spring/src/test/java/context/imports/CalculatorClient.java
    tuscany/java/sca/itest/spring/src/test/java/context/multiple/
    tuscany/java/sca/itest/spring/src/test/java/context/multiple/StockQuoteServer.java
    tuscany/java/sca/itest/spring/src/test/java/implementation/
    tuscany/java/sca/itest/spring/src/test/java/implementation/policies/
    tuscany/java/sca/itest/spring/src/test/java/implementation/policies/CalculatorClient.java
Modified:
    tuscany/java/sca/itest/spring/pom.xml
    tuscany/java/sca/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
    tuscany/java/sca/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml

Modified: tuscany/java/sca/itest/spring/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/pom.xml?rev=705178&r1=705177&r2=705178&view=diff
==============================================================================
--- tuscany/java/sca/itest/spring/pom.xml (original)
+++ tuscany/java/sca/itest/spring/pom.xml Thu Oct 16 01:35:01 2008
@@ -29,16 +29,21 @@
     <name>Apache Tuscany SCA Implementation.spring Integration Tests</name>
 
     <dependencies>
-
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-policy-transaction</artifactId>
+            <artifactId>tuscany-host-embedded</artifactId>
             <version>1.4-SNAPSHOT</version>
         </dependency>
-
+        
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-embedded</artifactId>
+            <artifactId>tuscany-contribution-resource</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>        
+            
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
             <version>1.4-SNAPSHOT</version>
         </dependency>
 
@@ -55,5 +60,46 @@
             <version>1.4-SNAPSHOT</version>
             <scope>runtime</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-logging</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-security</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <!-- Spring dependencies... -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>2.5.5</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>2.5.5</version>
+        </dependency>
     </dependencies>
 </project>

Added: tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,38 @@
+/*
+ * 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 bigbank.stockquote;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the StockQuote service.
+ */
+@Service(StockQuoteService.class)
+public class StockQuoteImpl implements StockQuoteService {
+
+    public double getQuote(String symbol) {
+        double price = 104.0 + Math.random();
+        price = ((int)(price * 100)) / 100.0;
+
+        System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+        return price;
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/bigbank/stockquote/StockQuoteService.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,30 @@
+/*
+ * 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 bigbank.stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+    public double getQuote(String symbol);
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/AddService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/AddService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/AddService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/AddService.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 Add service interface
+ */
+public interface AddService {
+
+    double add(double n1, double n2);
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/AddServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/AddServiceImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/AddServiceImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/AddServiceImpl.java Thu Oct 16 01:35:01 2008
@@ -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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+    public double add(double n1, double n2) {
+        Logger logger = Logger.getLogger("calculator");
+        logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+        return n1 + n2;
+    }
+
+}
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorService.java Thu Oct 16 01:35:01 2008
@@ -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;
+
+
+/**
+ * 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);
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorServiceImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorServiceImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/CalculatorServiceImpl.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+    private AddService addService;
+    private SubtractService subtractService;
+    private MultiplyService multiplyService;
+    private DivideService divideService;
+
+    public void setAddService(AddService addService) {
+        this.addService = addService;
+    }
+    
+    public AddService getAddService() {
+        return addService;
+    }
+
+    public void setSubtractService(SubtractService subtractService) {
+        this.subtractService = subtractService;
+    }
+    
+    public SubtractService getSubtractService() {
+        return subtractService;
+    }
+    
+    public void setDivideService(DivideService divideService) {
+        this.divideService = divideService;
+    }
+    
+    public DivideService getDivideService() {
+        return divideService;
+    }
+    
+    public void setMultiplyService(MultiplyService multiplyService) {
+        this.multiplyService = multiplyService;
+    }
+    
+    public MultiplyService getMultiplyService() {
+        return 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);
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/DivideService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/DivideService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/DivideService.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 divide service interface
+ */
+public interface DivideService {
+
+    double divide(double n1, double n2);
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/DivideServiceImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/DivideServiceImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/DivideServiceImpl.java Thu Oct 16 01:35:01 2008
@@ -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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+    public double divide(double n1, double n2) {
+        Logger logger = Logger.getLogger("calculator");
+        logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+        return n1 / n2;
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyService.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 interface for the multiply service
+ */
+public interface MultiplyService {
+
+    double multiply(double n1, double n2);
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyServiceImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyServiceImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/MultiplyServiceImpl.java Thu Oct 16 01:35:01 2008
@@ -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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+    public double multiply(double n1, double n2) {
+        Logger logger = Logger.getLogger("calculator");
+        logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+        return n1 * n2;
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractService.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractService.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractService.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 interface for the multiply service
+ */
+public interface SubtractService {
+
+    double subtract(double n1, double n2);
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractServiceImpl.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractServiceImpl.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/SubtractServiceImpl.java Thu Oct 16 01:35:01 2008
@@ -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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+    public double subtract(double n1, double n2) {
+        Logger logger = Logger.getLogger("calculator");
+        logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+        return n1 - n2;
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/security/CalculatorCallbackHandler.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/security/CalculatorCallbackHandler.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/security/CalculatorCallbackHandler.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/security/CalculatorCallbackHandler.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CalculatorCallbackHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof NameCallback) {
+                NameCallback nc = (NameCallback)callbacks[i];
+                nc.setName("CalculatorUser");
+            } else if (callbacks[i] instanceof PasswordCallback) {
+                PasswordCallback pc = (PasswordCallback)callbacks[i];
+                pc.setPassword("CalculatorUserPasswd".toCharArray());
+            } else {
+                throw new UnsupportedCallbackException
+                 (callbacks[i], "Unsupported Callback!");
+            }
+          }
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/security/JaasLoginModule.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/security/JaasLoginModule.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/security/JaasLoginModule.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/security/JaasLoginModule.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,178 @@
+/*
+ * 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.security;
+
+import java.security.Principal;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasLoginModule implements LoginModule {
+
+    private CallbackHandler callbackHandler;
+    private Subject subject;
+    private Principal userPrincipal;
+    private String userId;
+    private String password;
+    private boolean succeeded;
+    private boolean commitSucceeded;
+
+    public void initialize(Subject subject,
+                           CallbackHandler callbackHandler,
+                           Map<String, ?> sharedState,
+                           Map<String, ?> options) {
+        this.callbackHandler = callbackHandler;
+        this.subject = subject;
+    }
+
+    public boolean login() throws LoginException {
+        Callback[] callbacks = new Callback[2];
+        callbacks[0] = new NameCallback("UserId:");
+        callbacks[1] = new PasswordCallback("Password:", false);
+
+        try {
+            callbackHandler.handle(callbacks);
+            userId = ((NameCallback)callbacks[0]).getName();
+            password = new String(((PasswordCallback)callbacks[1]).getPassword());
+
+            if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) {
+                System.out.println("Successfully AUTHENTICATED!!");
+                succeeded = true;
+                return true;
+            } else {
+                System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!");
+                return false;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * <p> This method is called if the LoginContext's
+     * overall authentication succeeded
+     * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+     * succeeded).
+     *
+     * <p> If this LoginModule's own authentication attempt
+     * succeeded (checked by retrieving the private state saved by the
+     * <code>login</code> method), then this method associates a
+     * <code>UserPrincipal</code>
+     * with the <code>Subject</code> located in the
+     * <code>LoginModule</code>.  If this LoginModule's own
+     * authentication attempted failed, then this method removes
+     * any state that was originally saved.
+     *
+     * <p>
+     *
+     * @exception LoginException if the commit fails.
+     *
+     * @return true if this LoginModule's own login and commit
+     *          attempts succeeded, or false otherwise.
+     */
+    public boolean commit() throws LoginException {
+        if (succeeded == false) {
+            return false;
+        } else {
+            // add a Principal (authenticated identity) to the Subject
+
+            // assume the user we authenticated is the UserPrincipal
+            userPrincipal = new UserPrincipal(userId);
+            if (!subject.getPrincipals().contains(userPrincipal))
+                subject.getPrincipals().add(userPrincipal);
+
+            // in any case, clean out state
+            userId = null;
+            password = null;
+            commitSucceeded = true;
+            return true;
+        }
+    }
+
+    /**
+     * <p> This method is called if the LoginContext's
+     * overall authentication failed.
+     * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+     * did not succeed).
+     *
+     * <p> If this LoginModule's own authentication attempt
+     * succeeded (checked by retrieving the private state saved by the
+     * <code>login</code> and <code>commit</code> methods),
+     * then this method cleans up any state that was originally saved.
+     *
+     * <p>
+     *
+     * @exception LoginException if the abort fails.
+     *
+     * @return false if this LoginModule's own login and/or commit attempts
+     *          failed, and true otherwise.
+     */
+    public boolean abort() throws LoginException {
+        if (succeeded == false) {
+            return false;
+        } else if (succeeded == true && commitSucceeded == false) {
+            // login succeeded but overall authentication failed
+            succeeded = false;
+            userId = null;
+            password = null;
+            userPrincipal = null;
+        } else {
+            // overall authentication succeeded and commit succeeded,
+            // but someone else's commit failed
+            logout();
+        }
+        return true;
+    }
+
+    /**
+     * Logout the user.
+     *
+     * <p> This method removes the <code>SimplePrincipal</code>
+     * that was added by the <code>commit</code> method.
+     *
+     * <p>
+     *
+     * @exception LoginException if the logout fails.
+     *
+     * @return true in all cases since this <code>LoginModule</code>
+     *          should not be ignored.
+     */
+    public boolean logout() throws LoginException {
+        subject.getPrincipals().remove(userPrincipal);
+        succeeded = false;
+        succeeded = commitSucceeded;
+        userId = null;
+        if (password != null)
+            password = null;
+        userPrincipal = null;
+        return true;
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/main/java/calculator/security/UserPrincipal.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/calculator/security/UserPrincipal.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/calculator/security/UserPrincipal.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/calculator/security/UserPrincipal.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,66 @@
+/**
+ * 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.security;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev: 637276 $ $Date: 2008-03-15 03:05:34 +0530 (Sat, 15 Mar 2008) $
+ */
+public class UserPrincipal implements Principal {
+
+    private final String name;
+
+    public UserPrincipal(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("name cannot be null");
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String toString() {
+        return name;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final UserPrincipal other = (UserPrincipal)obj;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
+    }
+}

Added: tuscany/java/sca/itest/spring/src/main/java/context/access/SCAApplicationContextProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/java/context/access/SCAApplicationContextProvider.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/java/context/access/SCAApplicationContextProvider.java (added)
+++ tuscany/java/sca/itest/spring/src/main/java/context/access/SCAApplicationContextProvider.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,19 @@
+package context.access;
+
+import org.springframework.beans.BeansException;   
+import org.springframework.context.ApplicationContext;   
+import org.springframework.context.ApplicationContextAware;
+
+public class SCAApplicationContextProvider implements ApplicationContextAware {
+    
+    private static ApplicationContext ctx;
+    
+    public void setApplicationContext(ApplicationContext appContext) throws BeansException {
+        // Wiring the ApplicationContext into a static method           
+        ctx = appContext;      
+    }
+    
+    public static ApplicationContext getApplicationContext() {           
+        return ctx;       
+    }
+}

Added: tuscany/java/sca/itest/spring/src/main/resources/CalculatorService-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/CalculatorService-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/CalculatorService-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/CalculatorService-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+    <bean id="CalculatorServiceBean" class="calculator.CalculatorServiceImpl">        
+        <property name="addService" ref="addService"/>
+        <property name="subtractService" ref="subtractService"/>
+        <property name="multiplyService" ref="multiplyService"/>
+        <property name="divideService" ref="divideService"/>
+    </bean>
+
+    <sca:reference name="addService" type="calculator.AddService"/>
+    <sca:reference name="subtractService" type="calculator.SubtractService"/>   
+    <sca:reference name="multiplyService" type="calculator.MultiplyService"/>    
+    <sca:reference name="divideService" type="calculator.DivideService"/>
+
+</beans>

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/CalculatorService-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/CalculatorService-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/CalculatorService-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-access/CalculatorService-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+    <bean id="CalculatorServiceBean" class="calculator.CalculatorServiceImpl">        
+        <property name="addService" ref="addService"/>
+        <property name="subtractService" ref="subtractService"/>
+        <property name="multiplyService" ref="multiplyService"/>
+        <property name="divideService" ref="divideService"/>
+    </bean>
+    
+    <bean id="contextAccess" class="context.access.SCAApplicationContextProvider">
+    </bean>
+    
+    <sca:reference name="addService" type="calculator.AddService"/>
+    <sca:reference name="subtractService" type="calculator.SubtractService"/>   
+    <sca:reference name="multiplyService" type="calculator.MultiplyService"/>    
+    <sca:reference name="divideService" type="calculator.DivideService"/>
+
+</beans>
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/CalculatorService-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/CalculatorService-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/CalculatorService-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/CalculatorService-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+    <bean id="CalculatorServiceBean" class="calculator.CalculatorServiceImpl">        
+        <property name="addService" ref="addService"/>
+        <property name="subtractService" ref="subtractService"/>
+        <property name="multiplyService" ref="multiplyService"/>
+        <property name="divideService" ref="divideService"/>
+    </bean>
+
+    <sca:reference name="addService" type="calculator.AddService"/>
+    <sca:reference name="subtractService" type="calculator.SubtractService"/>   
+    <sca:reference name="multiplyService" type="calculator.MultiplyService"/>    
+    <sca:reference name="divideService" type="calculator.DivideService"/>
+
+</beans>

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/SpringImport-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/SpringImport-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/SpringImport-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-imports/SpringImport-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+       
+    <import resource="CalculatorService-context.xml"/>
+    
+</beans>
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/StockQuoteService-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/StockQuoteService-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/StockQuoteService-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/StockQuoteService-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+       
+    <sca:service name="StockQuoteService"
+        type="bigbank.stockquote.StockQuoteService" target="StockQuoteServiceBean"/>
+
+    <bean id="StockQuoteServiceBean" class="bigbank.stockquote.StockQuoteImpl">
+    </bean>
+    
+    <bean id="applicationContextProvider" class="context.access.SCAApplicationContextProvider">
+    </bean>
+
+</beans>
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/beanRefContext.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/beanRefContext.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/beanRefContext.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/context-multiple/beanRefContext.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+       
+    <bean id="beanRefFactory" class="org.springframework.context.support.ClassPathXmlApplicationContext">
+	   <constructor-arg>
+		  <list>
+			 <value>META-INF/sca/context-multiple/StockQuoteService-context.xml</value>
+		  </list>
+	   </constructor-arg>
+    </bean>
+</beans>
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/CalculatorService-context.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/CalculatorService-context.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/CalculatorService-context.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/implementation-policies/CalculatorService-context.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:sca="http://www.springframework.org/schema/sca"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+    <bean id="CalculatorServiceBean" class="calculator.CalculatorServiceImpl">        
+        <property name="addService" ref="addService"/>
+        <property name="subtractService" ref="subtractService"/>
+        <property name="multiplyService" ref="multiplyService"/>
+        <property name="divideService" ref="divideService"/>
+    </bean>
+
+    <sca:reference name="addService" type="calculator.AddService"/>
+    <sca:reference name="subtractService" type="calculator.SubtractService"/>   
+    <sca:reference name="multiplyService" type="calculator.MultiplyService"/>    
+    <sca:reference name="divideService" type="calculator.DivideService"/>
+
+</beans>

Added: tuscany/java/sca/itest/spring/src/main/resources/context/access/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/context/access/Calculator.composite?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/context/access/Calculator.composite (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/context/access/Calculator.composite Thu Oct 16 01:35:01 2008
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Calculator"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+    <component name="CalculatorServiceComponent">
+        <implementation.spring location="META-INF/sca/context-access/CalculatorService-context.xml"/>
+        <reference name="addService" target="AddServiceComponent" />
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" target="MultiplyServiceComponent" />
+        <reference name="divideService" target="DivideServiceComponent" />
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+</composite>

Added: tuscany/java/sca/itest/spring/src/main/resources/context/imports/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/context/imports/Calculator.composite?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/context/imports/Calculator.composite (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/context/imports/Calculator.composite Thu Oct 16 01:35:01 2008
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Calculator"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+    <component name="CalculatorServiceComponent">
+        <implementation.spring location="META-INF/sca/context-imports/SpringImport-context.xml"/>
+        <reference name="addService" target="AddServiceComponent" />
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" target="MultiplyServiceComponent" />
+        <reference name="divideService" target="DivideServiceComponent" />
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+</composite>

Added: tuscany/java/sca/itest/spring/src/main/resources/context/multiple/StockQuote.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/context/multiple/StockQuote.composite?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/context/multiple/StockQuote.composite (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/context/multiple/StockQuote.composite Thu Oct 16 01:35:01 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://stockquote"
+	xmlns:hw="http://stockquote"
+    name="StockQuote">
+    
+    <service name="StockQuoteService" promote="StockQuoteServiceComponent">
+        <interface.java interface="bigbank.stockquote.StockQuoteService"/>
+        <binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/>
+    </service>
+
+    <component name="StockQuoteServiceComponent">
+        <implementation.spring location="META-INF/sca/context-multiple/StockQuoteService-context.xml"/>
+    </component>
+
+</composite>

Added: tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/Calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/Calculator.composite?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/Calculator.composite (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/Calculator.composite Thu Oct 16 01:35:01 2008
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Calculator"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+    <component name="CalculatorServiceComponent">
+        <implementation.spring location="META-INF/sca/implementation-policies/CalculatorService-context.xml">		
+			<operation name="divide" requires="tuscany:logging"/>
+			<operation name="subtract" requires="tuscany:logging"/>
+		</implementation.spring>
+        <reference name="addService" target="AddServiceComponent" />
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" target="MultiplyServiceComponent" />
+        <reference name="divideService" target="DivideServiceComponent" />
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl" requires="tuscany:jaasAuthentication"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+    
+    <component name="AnotherCalculatorServiceComponent">
+        <implementation.spring location="META-INF/sca/implementation-policies/CalculatorService-context.xml" requires="tuscany:logging"/>		
+        <reference name="addService" target="AddServiceComponent" />
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" target="MultiplyServiceComponent" />
+        <reference name="divideService" target="DivideServiceComponent" />
+    </component>
+
+</composite>

Added: tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorJass.config
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorJass.config?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorJass.config (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorJass.config Thu Oct 16 01:35:01 2008
@@ -0,0 +1,3 @@
+Calculator {
+  calculator.security.JaasLoginModule required debug=true;
+};

Added: tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties Thu Oct 16 01:35:01 2008
@@ -0,0 +1,18 @@
+# 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.    
+CALLING_OPERATION=Inovoking operation {0} with arguments {1}
+OPERATION_RETURNED=Returning from operation {0} with return value {1}
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/definitions.xml?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/definitions.xml (added)
+++ tuscany/java/sca/itest/spring/src/main/resources/implementation/policies/definitions.xml Thu Oct 16 01:35:01 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+    * 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.    
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+    xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+    xmlns:calc="http://calculator">
+
+    <!-- PolicySets -->
+    <policySet name="JaasPolicy" provides="tuscany:jaasAuthentication" appliesTo="sca:implementation.java"
+        xmlns="http://www.osoa.org/xmlns/sca/1.0">
+        <tuscany:jaasAuthentication>
+            <tuscany:configurationName>Calculator</tuscany:configurationName>
+            <tuscany:callbackHandler>calculator.security.CalculatorCallbackHandler</tuscany:callbackHandler>
+        </tuscany:jaasAuthentication>
+    </policySet>
+
+    <!-- PolicySets -->
+    <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.spring"
+        xmlns="http://www.osoa.org/xmlns/sca/1.0">
+        <tuscany:jdkLogger name="calculator">
+            <logLevel>FINER</logLevel>
+        </tuscany:jdkLogger>
+    </policySet>
+</definitions>
\ No newline at end of file

Added: tuscany/java/sca/itest/spring/src/test/java/context/access/CalculatorClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/test/java/context/access/CalculatorClient.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/test/java/context/access/CalculatorClient.java (added)
+++ tuscany/java/sca/itest/spring/src/test/java/context/access/CalculatorClient.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,60 @@
+/*
+ * 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 context.access;
+
+import java.io.File;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.springframework.context.ApplicationContext;
+
+import context.access.SCAApplicationContextProvider;
+import calculator.CalculatorService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {        
+        
+        SCANodeFactory factory = SCANodeFactory.newInstance();
+        SCANode node = factory.createSCANode(new File("src/main/resources/context/access/Calculator.composite").toURL().toString(),
+                new SCAContribution("TestContribution", new File("src/main/resources/context/access/").toURL().toString()));
+        node.start();
+        
+        // Code: To access the Spring Application Context instance
+        ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext();
+        if (ctx.containsBean("CalculatorServiceBean"))
+            System.out.println("CalculatorServiceBean is now available for use...");
+              
+        /*CalculatorService calculatorService = 
+            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+                
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));*/
+
+        node.stop();
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/test/java/context/imports/CalculatorClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/test/java/context/imports/CalculatorClient.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/test/java/context/imports/CalculatorClient.java (added)
+++ tuscany/java/sca/itest/spring/src/test/java/context/imports/CalculatorClient.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,54 @@
+/*
+ * 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 context.imports;
+
+import java.io.File;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.SCAContribution;
+
+import calculator.CalculatorService;
+
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {        
+        
+        SCANodeFactory factory = SCANodeFactory.newInstance();
+        SCANode node = factory.createSCANode(new File("src/main/resources/context/imports/Calculator.composite").toURL().toString(),
+                new SCAContribution("TestContribution", new File("src/main/resources/context/imports/").toURL().toString()));
+        node.start();        
+              
+        CalculatorService calculatorService = 
+            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+        
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+        node.stop();
+    }
+
+}

Added: tuscany/java/sca/itest/spring/src/test/java/context/multiple/StockQuoteServer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/test/java/context/multiple/StockQuoteServer.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/test/java/context/multiple/StockQuoteServer.java (added)
+++ tuscany/java/sca/itest/spring/src/test/java/context/multiple/StockQuoteServer.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,51 @@
+/*
+ * 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 context.multiple;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.springframework.context.ApplicationContext;
+import context.access.SCAApplicationContextProvider;
+
+/**
+ * This server program shows how to bootstrap SCA from a simple J2SE program
+ * and start it which activates the StockQuote Web service endpoint.
+ */
+public class StockQuoteServer {
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println("Starting the Sample SCA StockQuote Service...");
+
+        SCANodeFactory factory = SCANodeFactory.newInstance();
+        SCANode node = factory.createSCANodeFromClassLoader("context/multiple/StockQuote.composite", StockQuoteServer.class.getClassLoader());
+        node.start();
+        
+        // Method 1: To access the Spring Application Context instance
+        ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext();
+        if (ctx.containsBean("StockQuoteServiceBean"))
+            System.out.println("StockQuoteServiceBean is now available for use...");        
+        
+        System.out.println("Press Enter to Exit...");
+        Thread.sleep(1000);
+
+        node.stop();
+        System.out.println("Bye");
+    }
+}

Added: tuscany/java/sca/itest/spring/src/test/java/implementation/policies/CalculatorClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/spring/src/test/java/implementation/policies/CalculatorClient.java?rev=705178&view=auto
==============================================================================
--- tuscany/java/sca/itest/spring/src/test/java/implementation/policies/CalculatorClient.java (added)
+++ tuscany/java/sca/itest/spring/src/test/java/implementation/policies/CalculatorClient.java Thu Oct 16 01:35:01 2008
@@ -0,0 +1,80 @@
+/*
+ * 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 implementation.policies;
+
+import java.io.File;
+
+import javax.security.auth.login.Configuration;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+import calculator.CalculatorService;
+import calculator.CalculatorServiceImpl;
+
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {
+        try {
+            Configuration secConf = Configuration.getConfiguration();
+        } catch (java.lang.SecurityException e) {
+            System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader()
+                .getResource("implementation/policies/CalculatorJass.config").toString());
+        }
+
+        SCANodeFactory factory = SCANodeFactory.newInstance();
+        SCANode node = factory.createSCANodeFromClassLoader("implementation/policies/Calculator.composite", CalculatorServiceImpl.class.getClassLoader());
+        //SCANode node = factory.createSCANode(new File("itest/spring/src/main/resources/implementation/policies/Calculator.composite").toURL().toString(),
+                //new SCAContribution("TestContribution", new File("itest/spring/src/main/resources/implementation/policies").toURL().toString()));
+        node.start();        
+              
+        CalculatorService calculatorService = 
+            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+                "policy for subtract and divide operations...");
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+        
+        calculatorService = 
+            ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+                "for all operations in the implementation...");
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+        node.stop();
+        System.out.println("Bye");
+    }
+
+}