summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-25 09:10:29 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-25 09:10:29 +0000
commitda525be4c8a59ff2a5443a28da89f14e8a43bc0e (patch)
treeb77376a1e0a923c1b28732c43229eee08fee7e43
parent6938628a4986ab9ceb87eea9d6313ebad1b214bc (diff)
A sample SCA webapp that can be installed in Tomcat and configured for basic authentication
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@947970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/README12
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/pom.xml103
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddService.java31
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddServiceImpl.java34
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/resources/Calculator.composite56
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/META-INF/sca-contribution.xml23
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml40
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/web.xml65
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/calc.jsp50
-rw-r--r--sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/tomcat-users.xml41
18 files changed, 733 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/README b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/README
new file mode 100644
index 0000000000..78eb513359
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/README
@@ -0,0 +1,12 @@
+This webapp contains the SCA calcualtor application and exposes the
+Add service over the web service binding. The web.xml file is configured
+to enable basic authentication for this application in Tomcat. It ensures
+that all incomming requests are associated with the "tuscany" role
+
+The intention is that you install this application into tomcat and defined
+the "tuscany" role in the conf/tomcat-users.xml file. An example tomcat-users.xml
+file is provided that shows you how to do this.
+
+Once started you can use the calculator-ws-basicauth-reference sample to call this
+service. Its Calcualtor component add reference is configured for basic authentication
+and the samples definitions.xml file contains the correct username and password.
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/pom.xml b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/pom.xml
new file mode 100644
index 0000000000..a0fcc7a363
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/pom.xml
@@ -0,0 +1,103 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-ws-basicauth-service-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Sample Calculator Web Service with basic authentication in a WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddService.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..c3c789e745
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.Remotable;
+
+/**
+ * The interface for the add service
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..a7049729f7
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/AddServiceImpl.java
@@ -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;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the Add service
+ */
+@Service(AddService.class)
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.err.println("Adding " + n1 + " to " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..ad87375529
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorService.java
@@ -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);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..bf3b0303ec
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+/**
+ * An implementation of the Calculator service.
+ */
+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);
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideService.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..835e4fda6d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideService.java
@@ -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 divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/DivideServiceImpl.java
@@ -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 calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyService.java
@@ -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);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/MultiplyServiceImpl.java
@@ -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 calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractService.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..30e4e6a56a
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractService.java
@@ -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 subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1a7f145ad8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/java/calculator/SubtractServiceImpl.java
@@ -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 calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/resources/Calculator.composite b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..6415d5a896
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/resources/Calculator.composite
@@ -0,0 +1,56 @@
+<?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">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" >
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8080/sample-calculator-ws-webapp/AddServiceComponent"/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws/>
+ </service>
+ </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>
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8b60ae590c
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..d2471019d8
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>sample-calculator-ws-webapp</d:artifactId>
+ <d:version>1.7-SNAPSHOT</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+
+ <!-- TUSCANY-2622 -->
+ <d:hidden-classes>
+ <d:filter>org.apache.axiom</d:filter>
+ <d:filter>org.apache.axis2</d:filter>
+ <d:filter>org.apache.commons</d:filter>
+ <d:filter>org.jdom</d:filter>
+ </d:hidden-classes>
+
+ </d:environment>
+</web-app>
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..ebc1fd945a
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * 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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <display-name>Apache Tuscany Calculator Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Entire Application</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>tuscany</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>Application</realm-name>
+ </login-config>
+
+ <security-role>
+ <description>
+ The role that is required to log in to this app
+ </description>
+ <role-name>tuscany</role-name>
+ </security-role>
+
+
+</web-app>
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/calc.jsp b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..4c4366747d
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/src/main/webapp/calc.jsp
@@ -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.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="calculator.CalculatorService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/tomcat-users.xml b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/tomcat-users.xml
new file mode 100644
index 0000000000..6530fa6f95
--- /dev/null
+++ b/sca-java-1.x/trunk/samples/calculator-ws-basicauth-service-webapp/tomcat-users.xml
@@ -0,0 +1,41 @@
+<?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.
+-->
+<tomcat-users>
+<!--
+ NOTE: By default, no user is included in the "manager" role required
+ to operate the "/manager" web application. If you wish to use this app,
+ you must define such a user - the username and password are arbitrary.
+-->
+<!--
+ NOTE: The sample user and role entries below are wrapped in a comment
+ and thus are ignored when reading this file. Do not forget to remove
+ <!.. ..> that surrounds them.
+-->
+<!--
+ <role rolename="tomcat"/>
+ <role rolename="role1"/>
+ <user username="tomcat" password="tomcat" roles="tomcat"/>
+ <user username="both" password="tomcat" roles="tomcat,role1"/>
+ <user username="role1" password="tomcat" roles="role1"/>
+-->
+ <role rolename="manager"/>
+ <role rolename="tuscany"/>
+ <user username="tomcat" password="s3cret" roles="manager"/>
+ <user username="tuscanyuser" password="tuscanypwd" roles="tuscany"/>
+
+</tomcat-users>