summaryrefslogtreecommitdiffstats
path: root/java/sca/distribution
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/distribution')
-rw-r--r--java/sca/distribution/all/pom.xml230
-rw-r--r--java/sca/distribution/all/src/main/assembly/bin.xml72
-rw-r--r--java/sca/distribution/all/src/main/assembly/src.xml90
-rw-r--r--java/sca/distribution/all/src/main/components/bin-common.xml86
-rw-r--r--java/sca/distribution/all/src/main/components/bin-launcher.xml82
-rw-r--r--java/sca/distribution/all/src/main/components/bin-modules.xml66
-rw-r--r--java/sca/distribution/all/src/main/components/bin-samples.xml160
-rw-r--r--java/sca/distribution/tomcat/pom.xml78
-rw-r--r--java/sca/distribution/tomcat/testing/download-tomcat/pom.xml126
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-client-webapp/pom.xml94
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java54
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite60
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml62
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-service-contribution/pom.xml90
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java72
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java50
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml44
-rw-r--r--java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite56
-rw-r--r--java/sca/distribution/tomcat/testing/legal-checks/pom.xml84
-rw-r--r--java/sca/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java294
-rw-r--r--java/sca/distribution/tomcat/testing/pom.xml76
-rw-r--r--java/sca/distribution/tomcat/tomcat-hook/pom.xml140
-rw-r--r--java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyAnnotationsProcessor.java170
-rw-r--r--java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java340
-rw-r--r--java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java370
-rw-r--r--java/sca/distribution/tomcat/tomcat-servlet/pom.xml126
-rw-r--r--java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/tomcat/foo/TuscanyTomcatNode.java148
-rw-r--r--java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java636
-rw-r--r--java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/InstallerServlet.java140
-rw-r--r--java/sca/distribution/tomcat/tomcat-war/pom.xml172
-rw-r--r--java/sca/distribution/tomcat/tomcat-war/src/main/assembly/war.xml188
-rw-r--r--java/sca/distribution/tomcat/tomcat-war/src/main/webapp/WEB-INF/web.xml80
32 files changed, 2268 insertions, 2268 deletions
diff --git a/java/sca/distribution/all/pom.xml b/java/sca/distribution/all/pom.xml
index ef7ab6d0a8..4b489dd4ef 100644
--- a/java/sca/distribution/all/pom.xml
+++ b/java/sca/distribution/all/pom.xml
@@ -1,115 +1,115 @@
-<?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-distribution</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-distribution-all</artifactId>
- <name>Apache Tuscany SCA All-in-one Distribution</name>
- <packaging>pom</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-all</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.maven.plugins</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- <executions>
- <execution>
- <id>distribution-modules</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>generate-modules</goal>
- </goals>
- <configuration>
- <targetDirectory>target/modules</targetDirectory>
- <useDistributionName>false</useDistributionName>
- <generateManifestJar>true</generateManifestJar>
- <artifactManifests>
- <artifactManifest>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <manifestFile>${basedir}/manifests/axiom-api-1.2.7.MF</manifestFile>
- </artifactManifest>
- <artifactManifest>
- <groupId>org.apache.woden</groupId>
- <artifactId>woden-impl-dom</artifactId>
- <version>1.0M8</version>
- <manifestFile>${basedir}/manifests/woden-impl-dom-1.0M8.MF</manifestFile>
- </artifactManifest>
- <artifactManifest>
- <groupId>org.apache.axis2</groupId>
- <artifactId>*</artifactId>
- <version>*</version>
- </artifactManifest>
- </artifactManifests>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.eclipse</groupId>
- <artifactId>osgi</artifactId>
- <version>3.3.0-v20070530</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- <descriptor>src/main/assembly/src.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- <finalName>apache-tuscany-sca-all-${version}</finalName>
- <appendAssemblyId>true</appendAssemblyId>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
+<?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-distribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution-all</artifactId>
+ <name>Apache Tuscany SCA All-in-one Distribution</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-feature-all</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.maven.plugins</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>distribution-modules</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>generate-modules</goal>
+ </goals>
+ <configuration>
+ <targetDirectory>target/modules</targetDirectory>
+ <useDistributionName>false</useDistributionName>
+ <generateManifestJar>true</generateManifestJar>
+ <artifactManifests>
+ <artifactManifest>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.7</version>
+ <manifestFile>${basedir}/manifests/axiom-api-1.2.7.MF</manifestFile>
+ </artifactManifest>
+ <artifactManifest>
+ <groupId>org.apache.woden</groupId>
+ <artifactId>woden-impl-dom</artifactId>
+ <version>1.0M8</version>
+ <manifestFile>${basedir}/manifests/woden-impl-dom-1.0M8.MF</manifestFile>
+ </artifactManifest>
+ <artifactManifest>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>*</artifactId>
+ <version>*</version>
+ </artifactManifest>
+ </artifactManifests>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.3.0-v20070530</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-all-${version}</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/sca/distribution/all/src/main/assembly/bin.xml b/java/sca/distribution/all/src/main/assembly/bin.xml
index fa3a5632ef..51033a5e1d 100644
--- a/java/sca/distribution/all/src/main/assembly/bin.xml
+++ b/java/sca/distribution/all/src/main/assembly/bin.xml
@@ -1,36 +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.
--->
-<assembly>
- <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
- <id></id>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>tuscany-sca-${version}</baseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <componentDescriptors>
- <componentDescriptor>src/main/components/bin-common.xml</componentDescriptor>
- <componentDescriptor>src/main/components/bin-modules.xml</componentDescriptor>
- <componentDescriptor>src/main/components/bin-samples.xml</componentDescriptor>
- <componentDescriptor>src/main/components/bin-launcher.xml</componentDescriptor>
- </componentDescriptors>
-</assembly>
+<?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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>tuscany-sca-${version}</baseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <componentDescriptors>
+ <componentDescriptor>src/main/components/bin-common.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/bin-modules.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/bin-samples.xml</componentDescriptor>
+ <componentDescriptor>src/main/components/bin-launcher.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/java/sca/distribution/all/src/main/assembly/src.xml b/java/sca/distribution/all/src/main/assembly/src.xml
index a3df72925a..0bb6503560 100644
--- a/java/sca/distribution/all/src/main/assembly/src.xml
+++ b/java/sca/distribution/all/src/main/assembly/src.xml
@@ -1,45 +1,45 @@
-<?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.
--->
-<assembly>
- <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
- <id>src</id>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>tuscany-sca-${version}-src</baseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <fileSets>
- <fileSet>
- <directory>../..</directory>
- <outputDirectory></outputDirectory>
- <excludes>
- <exclude>**/.*</exclude>
- <exclude>**/.*/**</exclude>
- <exclude>**/*.log</exclude>
- <exclude>**/target</exclude>
- <exclude>**/target/**/*</exclude>
- <exclude>**/maven-eclipse.xml</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-
-</assembly>
+<?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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>src</id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>tuscany-sca-${version}-src</baseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>../..</directory>
+ <outputDirectory></outputDirectory>
+ <excludes>
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ <exclude>**/maven-eclipse.xml</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/java/sca/distribution/all/src/main/components/bin-common.xml b/java/sca/distribution/all/src/main/components/bin-common.xml
index 983b6addff..b5b7111096 100644
--- a/java/sca/distribution/all/src/main/components/bin-common.xml
+++ b/java/sca/distribution/all/src/main/components/bin-common.xml
@@ -1,43 +1,43 @@
-<!--
- * 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.
--->
-<component>
- <fileSets>
-
- <!-- Add the text files to the top-level directroy -->
- <fileSet>
- <directory>../..</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>CHANGES</include>
- <include>README</include>
- <include>RELEASE_NOTES</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/release/bin</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>INSTALL</include>
- <include>LICENSE</include>
- <include>NOTICE</include>
- </includes>
- </fileSet>
- </fileSets>
-
-</component>
+<!--
+ * 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.
+-->
+<component>
+ <fileSets>
+
+ <!-- Add the text files to the top-level directroy -->
+ <fileSet>
+ <directory>../..</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>CHANGES</include>
+ <include>README</include>
+ <include>RELEASE_NOTES</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/bin</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>INSTALL</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+</component>
diff --git a/java/sca/distribution/all/src/main/components/bin-launcher.xml b/java/sca/distribution/all/src/main/components/bin-launcher.xml
index ae7aba79ca..018e041d38 100644
--- a/java/sca/distribution/all/src/main/components/bin-launcher.xml
+++ b/java/sca/distribution/all/src/main/components/bin-launcher.xml
@@ -1,41 +1,41 @@
-<!--
- * 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.
--->
-<component>
- <fileSets>
- <fileSet>
- <directory>src/main/release/launcher</directory>
- <outputDirectory>bin</outputDirectory>
- <includes>
- </includes>
- </fileSet>
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>bin</outputDirectory>
- <unpack>false</unpack>
- <includes>
- <include>org.apache.tuscany.sca:tuscany-launcher</include>
- </includes>
- <outputFileNameMapping>launcher.jar</outputFileNameMapping>
- </dependencySet>
-
- </dependencySets>
-
-</component>
+<!--
+ * 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.
+-->
+<component>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/release/launcher</directory>
+ <outputDirectory>bin</outputDirectory>
+ <includes>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>bin</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:tuscany-launcher</include>
+ </includes>
+ <outputFileNameMapping>launcher.jar</outputFileNameMapping>
+ </dependencySet>
+
+ </dependencySets>
+
+</component>
diff --git a/java/sca/distribution/all/src/main/components/bin-modules.xml b/java/sca/distribution/all/src/main/components/bin-modules.xml
index 69ec47740a..89de329d86 100644
--- a/java/sca/distribution/all/src/main/components/bin-modules.xml
+++ b/java/sca/distribution/all/src/main/components/bin-modules.xml
@@ -1,33 +1,33 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<component>
- <fileSets>
-
- <fileSet>
- <directory>target</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>modules/**/*</include>
- <include>features/**/*</include>
- </includes>
- </fileSet>
-
- </fileSets>
-
-</component>
+<!--
+ * 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.
+-->
+<component>
+ <fileSets>
+
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>modules/**/*</include>
+ <include>features/**/*</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+
+</component>
diff --git a/java/sca/distribution/all/src/main/components/bin-samples.xml b/java/sca/distribution/all/src/main/components/bin-samples.xml
index 1cdfb142ec..ebbc5c748f 100644
--- a/java/sca/distribution/all/src/main/components/bin-samples.xml
+++ b/java/sca/distribution/all/src/main/components/bin-samples.xml
@@ -1,80 +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.
--->
-<component>
- <fileSets>
- <!-- Add top level samples files -->
- <fileSet>
- <directory>../../samples</directory>
- <outputDirectory>samples</outputDirectory>
- <includes>
- <include>README</include>
- <include>logging.properties</include>
- <include>build-common.xml</include>
- <include>binding-ws-calculator/**/*</include>
- <include>calculator/**/*</include>
- <include>calculator-equinox/**/*</include>
- <include>calculator-osgi/**/*</include>
- <include>calculator-rmi-reference/**/*</include>
- <include>calculator-rmi-service/**/*</include>
- <include>implementation-java-calculator/**/*</include>
- <include>dosgi-calculator/**/*</include>
- <include>dosgi-calculator-operations/**/*</include>
- <include>webapps/helloworld/**/*</include>
- <include>webapps/helloworld-bpel/**/*</include>
- <include>webapps/helloworld-jsf/**/*</include>
- <include>webapps/helloworld-jsp/**/*</include>
- <include>webapps/helloworld-stripes/**/*</include>
- </includes>
- <excludes>
- <!-- General file/folders to exclude -->
- <exclude>**/.*</exclude>
- <exclude>**/.*/**</exclude>
- <exclude>**/*.log</exclude>
- <exclude>**/*.svg</exclude>
- <exclude>**/maven-eclipse.xml</exclude>
-
- <!-- Sample specific files/folders to exclude -->
- <exclude>pom.xml</exclude>
- <!-- exclude>**/target</exclude -->
- <!-- exclude>**/target/**/*</exclude -->
- <exclude>*/target/mvn-eclipse-cache.properties</exclude>
- <exclude>*/target/pom-transformed.xml</exclude>
- <exclude>*/target/classes</exclude>
- <exclude>*/target/classes/**/*</exclude>
- <exclude>*/target/dependency-maven-plugin-markers</exclude>
- <exclude>*/target/dependency-maven-plugin-markers/**/*</exclude>
- <exclude>*/target/.felix</exclude>
- <exclude>*/target/.felix/**/*</exclude>
- <exclude>*/target/maven-archiver</exclude>
- <exclude>*/target/maven-archiver/**/*</exclude>
- <exclude>*/target/test-classes</exclude>
- <exclude>*/target/test-classes/**/*</exclude>
- <exclude>*/target/surefire-reports</exclude>
- <exclude>*/target/surefire-reports/**/*</exclude>
- <exclude>*/target/surefire-osgi-reports</exclude>
- <exclude>*/target/surefire-osgi-reports/**/*</exclude>
- <exclude>webapps/helloworld/target/**/*</exclude>
- <exclude>webapps/helloworld-bpel/target/**/*</exclude>
- <exclude>webapps/helloworld-jsf/target/**/*</exclude>
- <exclude>webapps/helloworld-jsp/target/**/*</exclude>
- <exclude>webapps/helloworld-stripes/target/**/*</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-</component>
+<!--
+ * 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.
+-->
+<component>
+ <fileSets>
+ <!-- Add top level samples files -->
+ <fileSet>
+ <directory>../../samples</directory>
+ <outputDirectory>samples</outputDirectory>
+ <includes>
+ <include>README</include>
+ <include>logging.properties</include>
+ <include>build-common.xml</include>
+ <include>binding-ws-calculator/**/*</include>
+ <include>calculator/**/*</include>
+ <include>calculator-equinox/**/*</include>
+ <include>calculator-osgi/**/*</include>
+ <include>calculator-rmi-reference/**/*</include>
+ <include>calculator-rmi-service/**/*</include>
+ <include>implementation-java-calculator/**/*</include>
+ <include>dosgi-calculator/**/*</include>
+ <include>dosgi-calculator-operations/**/*</include>
+ <include>webapps/helloworld/**/*</include>
+ <include>webapps/helloworld-bpel/**/*</include>
+ <include>webapps/helloworld-jsf/**/*</include>
+ <include>webapps/helloworld-jsp/**/*</include>
+ <include>webapps/helloworld-stripes/**/*</include>
+ </includes>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>**/.*</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>**/*.log</exclude>
+ <exclude>**/*.svg</exclude>
+ <exclude>**/maven-eclipse.xml</exclude>
+
+ <!-- Sample specific files/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <!-- exclude>**/target</exclude -->
+ <!-- exclude>**/target/**/*</exclude -->
+ <exclude>*/target/mvn-eclipse-cache.properties</exclude>
+ <exclude>*/target/pom-transformed.xml</exclude>
+ <exclude>*/target/classes</exclude>
+ <exclude>*/target/classes/**/*</exclude>
+ <exclude>*/target/dependency-maven-plugin-markers</exclude>
+ <exclude>*/target/dependency-maven-plugin-markers/**/*</exclude>
+ <exclude>*/target/.felix</exclude>
+ <exclude>*/target/.felix/**/*</exclude>
+ <exclude>*/target/maven-archiver</exclude>
+ <exclude>*/target/maven-archiver/**/*</exclude>
+ <exclude>*/target/test-classes</exclude>
+ <exclude>*/target/test-classes/**/*</exclude>
+ <exclude>*/target/surefire-reports</exclude>
+ <exclude>*/target/surefire-reports/**/*</exclude>
+ <exclude>*/target/surefire-osgi-reports</exclude>
+ <exclude>*/target/surefire-osgi-reports/**/*</exclude>
+ <exclude>webapps/helloworld/target/**/*</exclude>
+ <exclude>webapps/helloworld-bpel/target/**/*</exclude>
+ <exclude>webapps/helloworld-jsf/target/**/*</exclude>
+ <exclude>webapps/helloworld-jsp/target/**/*</exclude>
+ <exclude>webapps/helloworld-stripes/target/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</component>
diff --git a/java/sca/distribution/tomcat/pom.xml b/java/sca/distribution/tomcat/pom.xml
index 3a0c9dc36f..b06a0aea79 100644
--- a/java/sca/distribution/tomcat/pom.xml
+++ b/java/sca/distribution/tomcat/pom.xml
@@ -1,39 +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.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca</artifactId>
- <relativePath>../pom.xml</relativePath>
- <version>2.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-distribution-tomcat</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Distribution Tomcat</name>
-
- <modules>
- <module>tomcat-hook</module>
- <module>tomcat-servlet</module>
- <module>tomcat-war</module>
- </modules>
-
-</project>
+<?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>
+ <relativePath>../pom.xml</relativePath>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-tomcat</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Distribution Tomcat</name>
+
+ <modules>
+ <module>tomcat-hook</module>
+ <module>tomcat-servlet</module>
+ <module>tomcat-war</module>
+ </modules>
+
+</project>
diff --git a/java/sca/distribution/tomcat/testing/download-tomcat/pom.xml b/java/sca/distribution/tomcat/testing/download-tomcat/pom.xml
index 827877bc1a..c4ca568746 100644
--- a/java/sca/distribution/tomcat/testing/download-tomcat/pom.xml
+++ b/java/sca/distribution/tomcat/testing/download-tomcat/pom.xml
@@ -1,63 +1,63 @@
-<?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-distribution-tomcat-testing</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>download-tomcat</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Tomcat Integration Testing Download Tomcat</name>
-
- <properties>
- <tomcat.version>6.0.18</tomcat.version>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>wagon-maven-plugin</artifactId>
- <version>1.0-beta-1</version>
- <executions>
- <execution>
- <id>download-tomcat</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>download-single</goal>
- </goals>
- <configuration>
- <!-- Note: the url should be "archive.apache.org" but that is truncating the file at 4808k,
- no idea why but it sounds like an infra problem - https://issues.apache.org/jira/browse/INFRA-1910 -->
- <url>http://www.eu.apache.org</url>
- <fromFile>dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</fromFile>
- <toDir>download</toDir>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
+<?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-distribution-tomcat-testing</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>download-tomcat</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Download Tomcat</name>
+
+ <properties>
+ <tomcat.version>6.0.18</tomcat.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>wagon-maven-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <executions>
+ <execution>
+ <id>download-tomcat</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>download-single</goal>
+ </goals>
+ <configuration>
+ <!-- Note: the url should be "archive.apache.org" but that is truncating the file at 4808k,
+ no idea why but it sounds like an infra problem - https://issues.apache.org/jira/browse/INFRA-1910 -->
+ <url>http://www.eu.apache.org</url>
+ <fromFile>dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</fromFile>
+ <toDir>download</toDir>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/pom.xml b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/pom.xml
index f5057b08f7..27816ddb00 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/pom.xml
+++ b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/pom.xml
@@ -1,47 +1,47 @@
-<?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-distribution-tomcat-testing</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>helloworld-client-webapp</artifactId>
- <packaging>war</packaging>
- <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Client Webapp</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- </build>
-
-</project>
-
+<?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-distribution-tomcat-testing</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>helloworld-client-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Client Webapp</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
+
diff --git a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java
index 5815274774..8c67e05aa7 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java
+++ b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java
@@ -1,27 +1,27 @@
-/*
- * 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 testing;
-
-// TODO: should the webapp need to include the service interface?
-
-public interface HelloworldService {
-
- String sayHello(String name);
-
-}
+/*
+ * 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 testing;
+
+// TODO: should the webapp need to include the service interface?
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite
index f8c7f026b2..c03a70c58a 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite
+++ b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite
@@ -1,30 +1,30 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- targetNamespace="http://testing"
- name="jsp-client-webapp">
-
- <!-- TODO: should the component name be unique in the domain? i guess so -->
- <component name="WebComponent">
- <implementation.web web-uri=""/>
- <reference name="service" target="HelloworldComponent"/>
- </component>
-
-</composite>
+<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
+ targetNamespace="http://testing"
+ name="jsp-client-webapp">
+
+ <!-- TODO: should the component name be unique in the domain? i guess so -->
+ <component name="WebComponent">
+ <implementation.web web-uri=""/>
+ <reference name="service" target="HelloworldComponent"/>
+ </component>
+
+</composite>
diff --git a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml
index f2e3441d5e..411d8a3146 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/java/sca/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml
@@ -1,31 +1,31 @@
-<?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 version="2.4"
- xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
-
- <display-name>jsp-client-webapp</display-name>
-
- <welcome-file-list id="WelcomeFileList">
- <welcome-file>hello.jsp</welcome-file>
- </welcome-file-list>
-
-</web-app>
+<?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 version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>jsp-client-webapp</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>hello.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/pom.xml b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/pom.xml
index 21f5fecfd7..3b43a4fa59 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/pom.xml
+++ b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/pom.xml
@@ -1,45 +1,45 @@
-<?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-distribution-tomcat-testing</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>helloworld-service-contribution</artifactId>
- <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Service Contribution</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- </build>
-</project>
+<?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-distribution-tomcat-testing</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>helloworld-service-contribution</artifactId>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Service Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java
index f59c31f481..c9c6ff66d6 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java
+++ b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java
@@ -1,36 +1,36 @@
-/*
- * 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 testing;
-
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-import org.oasisopen.sca.annotation.EagerInit;
-
-@Scope("COMPOSITE") @EagerInit
-public class HelloworldImpl implements HelloworldService {
-
- public String sayHello(String name) {
- return "Hello " + name;
- }
-
- @Init
- public void init() {
- System.out.println("HelloworldImpl eager init: " + sayHello("world"));
- }
-}
+/*
+ * 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 testing;
+
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.EagerInit;
+
+@Scope("COMPOSITE") @EagerInit
+public class HelloworldImpl implements HelloworldService {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+ @Init
+ public void init() {
+ System.out.println("HelloworldImpl eager init: " + sayHello("world"));
+ }
+}
diff --git a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java
index be529d36e7..65e95f275c 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java
+++ b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java
@@ -1,25 +1,25 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package testing;
-
-public interface HelloworldService {
-
- String sayHello(String name);
-
-}
+/*
+ * 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 testing;
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml
index f39e321376..9bdfd4e58b 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml
+++ b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -1,23 +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://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:testing="http://org.apache.tuscany.tomcat.testing">
- <deployable composite="testing:helloworld-service-contribution"/>
+<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns:testing="http://org.apache.tuscany.tomcat.testing">
+ <deployable composite="testing:helloworld-service-contribution"/>
</contribution> \ No newline at end of file
diff --git a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite
index 5b4279d9cc..2d6ce9419b 100644
--- a/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite
+++ b/java/sca/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite
@@ -1,28 +1,28 @@
-<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
- targetNamespace="http://org.apache.tuscany.tomcat.testing"
- name="helloworld-service-contribution">
-
- <component name="HelloworldComponent">
- <implementation.java class="testing.HelloworldImpl"/>
- </component>
-
-</composite>
+<?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://docs.oasis-open.org/ns/opencsa/sca/200903"
+ targetNamespace="http://org.apache.tuscany.tomcat.testing"
+ name="helloworld-service-contribution">
+
+ <component name="HelloworldComponent">
+ <implementation.java class="testing.HelloworldImpl"/>
+ </component>
+
+</composite>
diff --git a/java/sca/distribution/tomcat/testing/legal-checks/pom.xml b/java/sca/distribution/tomcat/testing/legal-checks/pom.xml
index 077561a7f9..ce9acd6902 100644
--- a/java/sca/distribution/tomcat/testing/legal-checks/pom.xml
+++ b/java/sca/distribution/tomcat/testing/legal-checks/pom.xml
@@ -1,42 +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.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>itest-distribution</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>war-legal-checks</artifactId>
- <name>Apache Tuscany SCA WAR Distribution Legal Checks</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>itest-bin-distro-unzip</artifactId>
- <type>pom</type>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- </build>
-</project>
+<?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>itest-distribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>war-legal-checks</artifactId>
+ <name>Apache Tuscany SCA WAR Distribution Legal Checks</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-bin-distro-unzip</artifactId>
+ <type>pom</type>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ </build>
+</project>
diff --git a/java/sca/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java b/java/sca/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java
index f574188532..05f16f603d 100644
--- a/java/sca/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java
+++ b/java/sca/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java
@@ -1,147 +1,147 @@
-/*
- * 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 itest;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.junit.Test;
-
-/**
- * Checks that all jar files included in the distribution are mentioned in the LICENSE file
- * and that all jars mentioned in the LICENSE are in the distribution.
- */
-public class JarsInLICENSETestCase {
-
- @Test
- public void testJars() throws Exception {
- File distroRoot = getUnzipedDistroRoot();
-
- File licenseFile = new File(distroRoot, "LICENSE");
- if (!licenseFile.exists()) {
- throw new IllegalStateException("can't find LICENSE file at: " + licenseFile.getAbsoluteFile().toString());
- }
-
- File libDirectory = distroRoot;
- if (!libDirectory.exists()) {
- throw new IllegalStateException("can't find modules folder at: " + libDirectory.getAbsoluteFile().toString());
- }
-
- List<String> jars = getJarsInDistro(libDirectory);
-
- List<String> bad2 = getLICENSEJarsNotInDistro(licenseFile, jars);
- if (bad2.size() > 0) {
- System.err.println("Jars in LICENSE but not in Distribution: " + bad2);
- }
-
- List<String> bad1 = getJarsNotInLICENSE(jars, licenseFile);
- if (bad1.size() > 0) {
- System.err.println("Jars in distribution but not in LICENSE: " + bad1);
- }
-
- if (bad1.size() > 0 || bad2.size() > 0) {
- throw new IllegalStateException("LICENSE problems, check log");
- }
- }
-
- private List<String> getLICENSEJarsNotInDistro(File licenseFile, List<String> jars) throws IOException {
- List<String> badJars = new ArrayList<String>();
- BufferedReader reader = new BufferedReader(new FileReader(licenseFile));
- String line = null;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.contains(".jar")) {
- StringTokenizer st = new StringTokenizer(line);
- while (st.hasMoreTokens()) {
- String s = st.nextToken();
- if (s.contains(".jar")) {
- if (s.startsWith("(")) {
- s = s.substring(1);
- }
- if (s.endsWith(",") || s.endsWith(":")) {
- s = s.substring(0, s.length()-1);
- }
- if (s.endsWith(")")) {
- s = s.substring(0, s.length()-1);
- }
- if (!jars.contains(s) && !s.startsWith("tuscany-")) {
- badJars.add(s);
- }
- }
- }
- }
- }
- return badJars;
- }
-
- private List<String> getJarsNotInLICENSE(List<String> jars, File licenseFile) throws IOException {
- List<String> badJars = new ArrayList<String>();
- String licenseText = readLICENSE(licenseFile);
- for (String jar : jars) {
- if (!licenseText.contains(jar)) {
- if (jar.startsWith("tuscany-")) {
- // ignore tuscany jars as they're not mentioned in the LICENSE file
- } else {
- badJars.add(jar);
- }
- }
- }
- return badJars;
- }
-
- private List<String> getJarsInDistro(File directory) {
- List<String> jars = new ArrayList<String>();
- for (String fn : directory.list()){
- if (fn.endsWith(".jar")) {
- jars.add(fn);
- } else {
- File f = new File(directory, fn);
- if (f.isDirectory()) {
- jars.addAll(getJarsInDistro(f));
- }
- }
- }
- return jars;
- }
-
- private File getUnzipedDistroRoot() {
- return new File("../../tomcat-war/target/tuscany.dir");
- }
-
- private static String readLICENSE(File licenseFile) throws java.io.IOException {
- StringBuffer fileData = new StringBuffer();
- BufferedReader reader = new BufferedReader(new FileReader(licenseFile));
- char[] buf = new char[1024];
- int numRead = 0;
- while ((numRead = reader.read(buf)) != -1) {
- String readData = String.valueOf(buf, 0, numRead);
- fileData.append(readData);
- buf = new char[1024];
- }
- reader.close();
- return fileData.toString();
- }
-
-}
+/*
+ * 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 itest;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.junit.Test;
+
+/**
+ * Checks that all jar files included in the distribution are mentioned in the LICENSE file
+ * and that all jars mentioned in the LICENSE are in the distribution.
+ */
+public class JarsInLICENSETestCase {
+
+ @Test
+ public void testJars() throws Exception {
+ File distroRoot = getUnzipedDistroRoot();
+
+ File licenseFile = new File(distroRoot, "LICENSE");
+ if (!licenseFile.exists()) {
+ throw new IllegalStateException("can't find LICENSE file at: " + licenseFile.getAbsoluteFile().toString());
+ }
+
+ File libDirectory = distroRoot;
+ if (!libDirectory.exists()) {
+ throw new IllegalStateException("can't find modules folder at: " + libDirectory.getAbsoluteFile().toString());
+ }
+
+ List<String> jars = getJarsInDistro(libDirectory);
+
+ List<String> bad2 = getLICENSEJarsNotInDistro(licenseFile, jars);
+ if (bad2.size() > 0) {
+ System.err.println("Jars in LICENSE but not in Distribution: " + bad2);
+ }
+
+ List<String> bad1 = getJarsNotInLICENSE(jars, licenseFile);
+ if (bad1.size() > 0) {
+ System.err.println("Jars in distribution but not in LICENSE: " + bad1);
+ }
+
+ if (bad1.size() > 0 || bad2.size() > 0) {
+ throw new IllegalStateException("LICENSE problems, check log");
+ }
+ }
+
+ private List<String> getLICENSEJarsNotInDistro(File licenseFile, List<String> jars) throws IOException {
+ List<String> badJars = new ArrayList<String>();
+ BufferedReader reader = new BufferedReader(new FileReader(licenseFile));
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.contains(".jar")) {
+ StringTokenizer st = new StringTokenizer(line);
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken();
+ if (s.contains(".jar")) {
+ if (s.startsWith("(")) {
+ s = s.substring(1);
+ }
+ if (s.endsWith(",") || s.endsWith(":")) {
+ s = s.substring(0, s.length()-1);
+ }
+ if (s.endsWith(")")) {
+ s = s.substring(0, s.length()-1);
+ }
+ if (!jars.contains(s) && !s.startsWith("tuscany-")) {
+ badJars.add(s);
+ }
+ }
+ }
+ }
+ }
+ return badJars;
+ }
+
+ private List<String> getJarsNotInLICENSE(List<String> jars, File licenseFile) throws IOException {
+ List<String> badJars = new ArrayList<String>();
+ String licenseText = readLICENSE(licenseFile);
+ for (String jar : jars) {
+ if (!licenseText.contains(jar)) {
+ if (jar.startsWith("tuscany-")) {
+ // ignore tuscany jars as they're not mentioned in the LICENSE file
+ } else {
+ badJars.add(jar);
+ }
+ }
+ }
+ return badJars;
+ }
+
+ private List<String> getJarsInDistro(File directory) {
+ List<String> jars = new ArrayList<String>();
+ for (String fn : directory.list()){
+ if (fn.endsWith(".jar")) {
+ jars.add(fn);
+ } else {
+ File f = new File(directory, fn);
+ if (f.isDirectory()) {
+ jars.addAll(getJarsInDistro(f));
+ }
+ }
+ }
+ return jars;
+ }
+
+ private File getUnzipedDistroRoot() {
+ return new File("../../tomcat-war/target/tuscany.dir");
+ }
+
+ private static String readLICENSE(File licenseFile) throws java.io.IOException {
+ StringBuffer fileData = new StringBuffer();
+ BufferedReader reader = new BufferedReader(new FileReader(licenseFile));
+ char[] buf = new char[1024];
+ int numRead = 0;
+ while ((numRead = reader.read(buf)) != -1) {
+ String readData = String.valueOf(buf, 0, numRead);
+ fileData.append(readData);
+ buf = new char[1024];
+ }
+ reader.close();
+ return fileData.toString();
+ }
+
+}
diff --git a/java/sca/distribution/tomcat/testing/pom.xml b/java/sca/distribution/tomcat/testing/pom.xml
index c2e4ac197f..732e7c292d 100644
--- a/java/sca/distribution/tomcat/testing/pom.xml
+++ b/java/sca/distribution/tomcat/testing/pom.xml
@@ -1,38 +1,38 @@
-<?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-distribution-tomcat</artifactId>
- <relativePath>../pom.xml</relativePath>
- <version>2.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-distribution-tomcat-testing</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Distribution Tomcat Testing</name>
-
- <modules>
- <module>helloworld-service-contribution</module>
- <module>helloworld-client-webapp</module>
- </modules>
-
-</project>
+<?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-distribution-tomcat</artifactId>
+ <relativePath>../pom.xml</relativePath>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-tomcat-testing</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Distribution Tomcat Testing</name>
+
+ <modules>
+ <module>helloworld-service-contribution</module>
+ <module>helloworld-client-webapp</module>
+ </modules>
+
+</project>
diff --git a/java/sca/distribution/tomcat/tomcat-hook/pom.xml b/java/sca/distribution/tomcat/tomcat-hook/pom.xml
index 6bb5adad0f..8b792960ad 100644
--- a/java/sca/distribution/tomcat/tomcat-hook/pom.xml
+++ b/java/sca/distribution/tomcat/tomcat-hook/pom.xml
@@ -1,70 +1,70 @@
-<?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-modules</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-tomcat-hook</artifactId>
- <name>Apache Tuscany SCA Tomcat Hook</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>catalina</artifactId>
- <version>6.0.18</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>coyote</artifactId>
- <version>6.0.18</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.swizzle</groupId>
- <artifactId>swizzle-stream</artifactId>
- <version>1.0.2</version>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
-</project>
+<?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-modules</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-tomcat-hook</artifactId>
+ <name>Apache Tuscany SCA Tomcat Hook</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.18</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <version>6.0.18</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ <version>1.0.2</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyAnnotationsProcessor.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyAnnotationsProcessor.java
index 8dfd8175e4..54947d6492 100644
--- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyAnnotationsProcessor.java
+++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyAnnotationsProcessor.java
@@ -1,85 +1,85 @@
-/*
- * 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 org.apache.tuscany.sca.tomcat;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.naming.NamingException;
-import javax.servlet.ServletContext;
-
-import org.apache.AnnotationProcessor;
-import org.apache.catalina.util.DefaultAnnotationProcessor;
-
-public class TuscanyAnnotationsProcessor implements AnnotationProcessor {
-
- private TuscanyStandardContext tuscanyStandardContext;
- private AnnotationProcessor tomcatAnnotationProcessor;
- private Method tuscanyInjectMethod;
-
- public TuscanyAnnotationsProcessor(TuscanyStandardContext tuscanyStandardContext, javax.naming.Context context) {
- this.tuscanyStandardContext = tuscanyStandardContext;
- this.tomcatAnnotationProcessor = new DefaultAnnotationProcessor(context);
- initInjectMethod(tuscanyStandardContext);
- }
-
- private void initInjectMethod(TuscanyStandardContext tuscanyStandardContext) {
-
- // this needs to use reflection as the tuscany-hook module can't have any
- // dependencies on the tuscany runtime modules as they're not
- // in the server classpath
- // TODO: is there a nicer way ?
-
- ClassLoader cl = tuscanyStandardContext.getParentClassLoader();
- try {
- Class<?> c = Class.forName("org.apache.tuscany.sca.implementation.web.runtime.utils.ContextHelper", true, cl);
- if (c != null) {
- this.tuscanyInjectMethod = c.getMethod("inject", new Class[]{Object.class, ServletContext.class});
- }
- } catch (Exception e){
- // ignore
- }
- }
-
- public void postConstruct(Object instance) throws IllegalAccessException, InvocationTargetException {
- tomcatAnnotationProcessor.postConstruct(instance);
- }
-
- public void preDestroy(Object instance) throws IllegalAccessException, InvocationTargetException {
- tomcatAnnotationProcessor.preDestroy(instance);
- }
-
- public void processAnnotations(Object instance) throws IllegalAccessException, InvocationTargetException, NamingException {
- if (tuscanyInjectMethod != null) {
- ServletContext sc = tuscanyStandardContext.getServletContext();
- if (sc != null) {
- Object rc = sc.getAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent");
- if (rc != null) {
- try {
- tuscanyInjectMethod.invoke(null, instance, sc);
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }
- tomcatAnnotationProcessor.processAnnotations(instance);
- }
-}
+/*
+ * 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 org.apache.tuscany.sca.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.naming.NamingException;
+import javax.servlet.ServletContext;
+
+import org.apache.AnnotationProcessor;
+import org.apache.catalina.util.DefaultAnnotationProcessor;
+
+public class TuscanyAnnotationsProcessor implements AnnotationProcessor {
+
+ private TuscanyStandardContext tuscanyStandardContext;
+ private AnnotationProcessor tomcatAnnotationProcessor;
+ private Method tuscanyInjectMethod;
+
+ public TuscanyAnnotationsProcessor(TuscanyStandardContext tuscanyStandardContext, javax.naming.Context context) {
+ this.tuscanyStandardContext = tuscanyStandardContext;
+ this.tomcatAnnotationProcessor = new DefaultAnnotationProcessor(context);
+ initInjectMethod(tuscanyStandardContext);
+ }
+
+ private void initInjectMethod(TuscanyStandardContext tuscanyStandardContext) {
+
+ // this needs to use reflection as the tuscany-hook module can't have any
+ // dependencies on the tuscany runtime modules as they're not
+ // in the server classpath
+ // TODO: is there a nicer way ?
+
+ ClassLoader cl = tuscanyStandardContext.getParentClassLoader();
+ try {
+ Class<?> c = Class.forName("org.apache.tuscany.sca.implementation.web.runtime.utils.ContextHelper", true, cl);
+ if (c != null) {
+ this.tuscanyInjectMethod = c.getMethod("inject", new Class[]{Object.class, ServletContext.class});
+ }
+ } catch (Exception e){
+ // ignore
+ }
+ }
+
+ public void postConstruct(Object instance) throws IllegalAccessException, InvocationTargetException {
+ tomcatAnnotationProcessor.postConstruct(instance);
+ }
+
+ public void preDestroy(Object instance) throws IllegalAccessException, InvocationTargetException {
+ tomcatAnnotationProcessor.preDestroy(instance);
+ }
+
+ public void processAnnotations(Object instance) throws IllegalAccessException, InvocationTargetException, NamingException {
+ if (tuscanyInjectMethod != null) {
+ ServletContext sc = tuscanyStandardContext.getServletContext();
+ if (sc != null) {
+ Object rc = sc.getAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent");
+ if (rc != null) {
+ try {
+ tuscanyInjectMethod.invoke(null, instance, sc);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ }
+ }
+ tomcatAnnotationProcessor.processAnnotations(instance);
+ }
+}
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java
index ab96376020..75f925fec5 100644
--- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java
+++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyLifecycleListener.java
@@ -1,170 +1,170 @@
-/*
- * 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 org.apache.tuscany.sca.tomcat;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import org.apache.catalina.Container;
-import org.apache.catalina.LifecycleEvent;
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.ServerFactory;
-import org.apache.catalina.Service;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.core.StandardEngine;
-import org.apache.catalina.core.StandardHost;
-import org.apache.catalina.core.StandardServer;
-import org.apache.catalina.core.StandardService;
-import org.apache.catalina.startup.HostConfig;
-
-/**
- * A Tomcat LifecycleListener that initilizes the Tuscany Tomcat integration.
- * It sets a System property with the location of the Tuscany runtime .war
- * and configures each Tomcat Connector to use the TuscanyStandardContext.
- *
- * To configure Tomcat to use this add the following to the Tomcat conf/server.xml
- * <Listener className="org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener"/>
- */
-public class TuscanyLifecycleListener implements LifecycleListener {
- private static final Logger log = Logger.getLogger(TuscanyLifecycleListener.class.getName());
-
- public static final String TUSCANY_WAR_PROP = "org.apache.tuscany.sca.tomcat.war";
-
- private static boolean running;
-
- public static boolean isRunning() {
- return running;
- }
-
- static final String TUSCANY_SHARED_PROP = "org.apache.tuscany.sca.tomcat.shared";
-
- public TuscanyLifecycleListener() {
- running = true;
- log.info("Apache Tuscany initilizing");
- }
-
- public void lifecycleEvent(LifecycleEvent event) {
- if ("init".equals(event.getType()) && (event.getSource() instanceof StandardServer)) {
- File webappDir = findTuscanyWar();
- if (webappDir == null) {
- log.severe("Tuscany disabled as Tuscany webapp not found");
- } else {
- System.setProperty(TUSCANY_WAR_PROP, webappDir.getAbsolutePath());
- System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
- File propFile = new File(webappDir, "tuscany.properties");
- if (propFile.isFile()) {
- try {
- FileInputStream is = new FileInputStream(propFile);
- Properties props = new Properties();
- props.load(is);
- is.close();
- System.setProperty(TUSCANY_SHARED_PROP, props.getProperty("singleton", "false"));
- } catch (IOException e) {
- // Ignore
- }
- }
- log.info("Using Tuscany webapp: " + webappDir.getAbsolutePath());
- StandardServer server = (StandardServer)event.getSource();
- StandardService catalina = (StandardService)server.findService("Catalina");
- for (Connector connector : catalina.findConnectors()) {
- for (Container container : connector.getContainer().findChildren()) {
- if (container instanceof StandardHost) {
- for (LifecycleListener listener : ((StandardHost)container).findLifecycleListeners()) {
- if (listener instanceof HostConfig) {
- ((HostConfig)listener)
- .setContextClass("org.apache.tuscany.sca.tomcat.TuscanyStandardContext");
- log.info("Tuscany enabled on connector: " + container.getName()
- + ":"
- + connector.getPort());
- }
- }
- }
- }
- }
- }
- }
- }
-
- private static File findTuscanyWar() {
-
- // in Tomcat 5.5 the Tuscany war is in the server/webapps director
- String catalinaBase = System.getProperty("catalina.base");
- File serverWebapps = new File(catalinaBase, "server/webapps");
- File tuscanyWar = findTuscanyWar(serverWebapps);
- if (tuscanyWar != null) {
- return tuscanyWar;
- }
-
- // in Tomcat 6 the Tuscany war is normally in webapps, but we just scan all hosts directories
- for (Service service : ServerFactory.getServer().findServices()) {
- Container container = service.getContainer();
- if (container instanceof StandardEngine) {
- StandardEngine engine = (StandardEngine)container;
- for (Container child : engine.findChildren()) {
- if (child instanceof StandardHost) {
- StandardHost host = (StandardHost)child;
- String appBase = host.getAppBase();
-
- // determine the host dir (normally webapps)
- File hostDir = new File(appBase);
- if (!hostDir.isAbsolute()) {
- hostDir = new File(catalinaBase, appBase);
- }
-
- tuscanyWar = findTuscanyWar(hostDir);
- if (tuscanyWar != null) {
- return tuscanyWar;
- }
- }
- }
- }
- }
- return null;
- }
-
- private static File findTuscanyWar(File hostDir) {
- if (!hostDir.isDirectory()) {
- return null;
- }
-
- // iterate over the contexts
- for (File contextDir : hostDir.listFiles()) {
- // does this war have a web-inf lib dir
- File hookLib = new File(contextDir, "tomcat-lib");
- if (!hookLib.isDirectory()) {
- continue;
- }
- // iterate over the libs looking for the tuscany-tomcat-*.jar
- for (File file : hookLib.listFiles()) {
- if (file.getName().startsWith("tuscany-tomcat-hook-") && file.getName().endsWith(".jar")) {
- // this should be in the Tuscany war...
- // make sure it has a runtime directory
- if (new File(contextDir, "tuscany-lib").isDirectory()) {
- return contextDir;
- }
- }
- }
- }
- return null;
- }
-}
+/*
+ * 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 org.apache.tuscany.sca.tomcat;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.Service;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.core.StandardService;
+import org.apache.catalina.startup.HostConfig;
+
+/**
+ * A Tomcat LifecycleListener that initilizes the Tuscany Tomcat integration.
+ * It sets a System property with the location of the Tuscany runtime .war
+ * and configures each Tomcat Connector to use the TuscanyStandardContext.
+ *
+ * To configure Tomcat to use this add the following to the Tomcat conf/server.xml
+ * <Listener className="org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener"/>
+ */
+public class TuscanyLifecycleListener implements LifecycleListener {
+ private static final Logger log = Logger.getLogger(TuscanyLifecycleListener.class.getName());
+
+ public static final String TUSCANY_WAR_PROP = "org.apache.tuscany.sca.tomcat.war";
+
+ private static boolean running;
+
+ public static boolean isRunning() {
+ return running;
+ }
+
+ static final String TUSCANY_SHARED_PROP = "org.apache.tuscany.sca.tomcat.shared";
+
+ public TuscanyLifecycleListener() {
+ running = true;
+ log.info("Apache Tuscany initilizing");
+ }
+
+ public void lifecycleEvent(LifecycleEvent event) {
+ if ("init".equals(event.getType()) && (event.getSource() instanceof StandardServer)) {
+ File webappDir = findTuscanyWar();
+ if (webappDir == null) {
+ log.severe("Tuscany disabled as Tuscany webapp not found");
+ } else {
+ System.setProperty(TUSCANY_WAR_PROP, webappDir.getAbsolutePath());
+ System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
+ File propFile = new File(webappDir, "tuscany.properties");
+ if (propFile.isFile()) {
+ try {
+ FileInputStream is = new FileInputStream(propFile);
+ Properties props = new Properties();
+ props.load(is);
+ is.close();
+ System.setProperty(TUSCANY_SHARED_PROP, props.getProperty("singleton", "false"));
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ log.info("Using Tuscany webapp: " + webappDir.getAbsolutePath());
+ StandardServer server = (StandardServer)event.getSource();
+ StandardService catalina = (StandardService)server.findService("Catalina");
+ for (Connector connector : catalina.findConnectors()) {
+ for (Container container : connector.getContainer().findChildren()) {
+ if (container instanceof StandardHost) {
+ for (LifecycleListener listener : ((StandardHost)container).findLifecycleListeners()) {
+ if (listener instanceof HostConfig) {
+ ((HostConfig)listener)
+ .setContextClass("org.apache.tuscany.sca.tomcat.TuscanyStandardContext");
+ log.info("Tuscany enabled on connector: " + container.getName()
+ + ":"
+ + connector.getPort());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static File findTuscanyWar() {
+
+ // in Tomcat 5.5 the Tuscany war is in the server/webapps director
+ String catalinaBase = System.getProperty("catalina.base");
+ File serverWebapps = new File(catalinaBase, "server/webapps");
+ File tuscanyWar = findTuscanyWar(serverWebapps);
+ if (tuscanyWar != null) {
+ return tuscanyWar;
+ }
+
+ // in Tomcat 6 the Tuscany war is normally in webapps, but we just scan all hosts directories
+ for (Service service : ServerFactory.getServer().findServices()) {
+ Container container = service.getContainer();
+ if (container instanceof StandardEngine) {
+ StandardEngine engine = (StandardEngine)container;
+ for (Container child : engine.findChildren()) {
+ if (child instanceof StandardHost) {
+ StandardHost host = (StandardHost)child;
+ String appBase = host.getAppBase();
+
+ // determine the host dir (normally webapps)
+ File hostDir = new File(appBase);
+ if (!hostDir.isAbsolute()) {
+ hostDir = new File(catalinaBase, appBase);
+ }
+
+ tuscanyWar = findTuscanyWar(hostDir);
+ if (tuscanyWar != null) {
+ return tuscanyWar;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private static File findTuscanyWar(File hostDir) {
+ if (!hostDir.isDirectory()) {
+ return null;
+ }
+
+ // iterate over the contexts
+ for (File contextDir : hostDir.listFiles()) {
+ // does this war have a web-inf lib dir
+ File hookLib = new File(contextDir, "tomcat-lib");
+ if (!hookLib.isDirectory()) {
+ continue;
+ }
+ // iterate over the libs looking for the tuscany-tomcat-*.jar
+ for (File file : hookLib.listFiles()) {
+ if (file.getName().startsWith("tuscany-tomcat-hook-") && file.getName().endsWith(".jar")) {
+ // this should be in the Tuscany war...
+ // make sure it has a runtime directory
+ if (new File(contextDir, "tuscany-lib").isDirectory()) {
+ return contextDir;
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
index 94b7152610..5e9b5d90e5 100644
--- a/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
+++ b/java/sca/distribution/tomcat/tomcat-hook/src/main/java/org/apache/tuscany/sca/tomcat/TuscanyStandardContext.java
@@ -1,185 +1,185 @@
-/*
- * 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 org.apache.tuscany.sca.tomcat;
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.logging.Logger;
-
-import javax.naming.NameClassPair;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
-import org.apache.catalina.Loader;
-import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.deploy.FilterDef;
-
-/**
- * A Tuscany StandardContext to initilize SCA applications.
- * There is a StandardContext instance for each webapp and its
- * called to handle all start/stop/etc requests. This intercepts
- * the start and inserts any required Tuscany configuration.
- */
-public class TuscanyStandardContext extends StandardContext {
- private static final long serialVersionUID = 1L;
- private static final Logger log = Logger.getLogger(TuscanyStandardContext.class.getName());
-
- protected static final String TUSCANY_FILTER_NAME = "TuscanyFilter";
- protected static final String TUSCANY_SERVLET_FILTER = "org.apache.tuscany.sca.host.webapp.TuscanyServletFilter";
- protected static final String TUSCANY_CONTEXT_LISTENER = "org.apache.tuscany.sca.host.webapp.TuscanyContextListener";
- protected static final String TUSCANY_MANAGER_LISTENER = "org.apache.tuscany.sca.tomcat.foo.TuscanyTomcatNode";
-
- private boolean isSCAApp;
-
- // TODO: this gives an instance per webapp, work out how to have only one per server
- private static URLClassLoader tuscanyClassLoader;
-
- /**
- * Overrides the getLoader method in the Tomcat StandardContext as its a convenient
- * point to insert the Tuscany initilization. This gets called the first time during
- * StandardContext.start after the webapp resources have been created so this can
- * use getResources() to look for the SCA web.composite or sca-contribution.xml files,
- * but its still early enough in start to insert the required Tuscany config.
- */
- @Override
- public Loader getLoader() {
- if (loader != null) {
- return loader;
- }
-
- ClassLoader parent = getParentClassLoader();
- if (isSCAApp = isSCAApplication() || isTuscanyManager()) {
- String sharedProp = System.getProperty(TuscanyLifecycleListener.TUSCANY_SHARED_PROP, "false");
- boolean shared = "true".equalsIgnoreCase(sharedProp);
- if (!shared) {
- setParentClassLoader(copy(getTuscanyClassloader(parent)));
- } else {
- // The default parent classloader is the one for the webapp
- setParentClassLoader(getTuscanyClassloader(parent));
- }
- }
-
- return super.getLoader();
- }
-
- @Override
- public boolean listenerStart() {
- if (isTuscanyManager()) {
- // this isn't great having the manager app config scattered about different modules
- // but is temp until this is all tidied up in a refactor after the basics are working
- addApplicationListener(TUSCANY_MANAGER_LISTENER);
- } else if (isSCAApp) {
- enableTuscany();
- }
- return super.listenerStart();
- }
-
- private void enableTuscany() {
-
- for (String listener : findApplicationListeners()) {
- if (TUSCANY_CONTEXT_LISTENER.equals(listener)) {
- // The web application already has the context listener configured
- return;
- }
- }
-
- for (FilterDef filterDef : findFilterDefs()) {
- if (TUSCANY_SERVLET_FILTER.equals(filterDef.getFilterClass())) {
- // The web application already has the filter configured
- return;
- }
- }
-
- addApplicationListener(TUSCANY_CONTEXT_LISTENER);
-
- FilterDef filterDef = new FilterDef();
- filterDef.setFilterName(TUSCANY_FILTER_NAME);
- filterDef.setFilterClass(TUSCANY_SERVLET_FILTER);
- addFilterDef(filterDef);
-
- if (isUseNaming() && getNamingContextListener() != null) {
- setAnnotationProcessor(new TuscanyAnnotationsProcessor(this, getNamingContextListener().getEnvContext()));
- } else {
- setAnnotationProcessor(new TuscanyAnnotationsProcessor(this, null));
- }
-
- log.info("Tuscany SCA is enabled for: " + this.getName());
- }
-
- private boolean isSCAApplication() {
- Object o = null;
- try {
- o = getResources().lookup("WEB-INF/web.composite");
- } catch (NamingException e) {
- }
- if (o == null) {
- try {
- o = getResources().lookup("META-INF/sca-contribution.xml");
- } catch (NamingException e) {
- }
- }
- if (o == null) {
- return false;
- }
-
- // Try to see if the Tuscany jars are packaged in the webapp
- NamingEnumeration<NameClassPair> enumeration;
- try {
- enumeration = getResources().list("WEB-INF/lib");
- while (enumeration.hasMoreElements()) {
- String jar = enumeration.nextElement().getName();
- if (jar.startsWith("tuscany-")) {
- // Do not alter is
- log.info("Tuscany SCA ignoring webapp with embedded Tuscany runtime: " + this.getName());
- return false;
- }
- }
- } catch (NamingException e) {
- }
- return true;
- }
-
- private boolean isTuscanyManager() {
- return "/tuscany".equals(getName());
- }
-
- private static URLClassLoader copy(URLClassLoader classLoader) {
- return new URLClassLoader(classLoader.getURLs(), classLoader.getParent());
- }
-
- private synchronized URLClassLoader getTuscanyClassloader(ClassLoader parent) {
- if (tuscanyClassLoader == null) {
- File tuscanyWar = new File(System.getProperty(TuscanyLifecycleListener.TUSCANY_WAR_PROP));
- File[] runtimeJars = new File(tuscanyWar, "tuscany-lib").listFiles();
- try {
- URL[] jarURLs = new URL[runtimeJars.length];
- for (int i = 0; i < jarURLs.length; i++) {
- jarURLs[i] = runtimeJars[i].toURI().toURL();
- }
- tuscanyClassLoader = new URLClassLoader(jarURLs, parent);
- return tuscanyClassLoader;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return tuscanyClassLoader;
- }
-}
+/*
+ * 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 org.apache.tuscany.sca.tomcat;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.logging.Logger;
+
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import org.apache.catalina.Loader;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.deploy.FilterDef;
+
+/**
+ * A Tuscany StandardContext to initilize SCA applications.
+ * There is a StandardContext instance for each webapp and its
+ * called to handle all start/stop/etc requests. This intercepts
+ * the start and inserts any required Tuscany configuration.
+ */
+public class TuscanyStandardContext extends StandardContext {
+ private static final long serialVersionUID = 1L;
+ private static final Logger log = Logger.getLogger(TuscanyStandardContext.class.getName());
+
+ protected static final String TUSCANY_FILTER_NAME = "TuscanyFilter";
+ protected static final String TUSCANY_SERVLET_FILTER = "org.apache.tuscany.sca.host.webapp.TuscanyServletFilter";
+ protected static final String TUSCANY_CONTEXT_LISTENER = "org.apache.tuscany.sca.host.webapp.TuscanyContextListener";
+ protected static final String TUSCANY_MANAGER_LISTENER = "org.apache.tuscany.sca.tomcat.foo.TuscanyTomcatNode";
+
+ private boolean isSCAApp;
+
+ // TODO: this gives an instance per webapp, work out how to have only one per server
+ private static URLClassLoader tuscanyClassLoader;
+
+ /**
+ * Overrides the getLoader method in the Tomcat StandardContext as its a convenient
+ * point to insert the Tuscany initilization. This gets called the first time during
+ * StandardContext.start after the webapp resources have been created so this can
+ * use getResources() to look for the SCA web.composite or sca-contribution.xml files,
+ * but its still early enough in start to insert the required Tuscany config.
+ */
+ @Override
+ public Loader getLoader() {
+ if (loader != null) {
+ return loader;
+ }
+
+ ClassLoader parent = getParentClassLoader();
+ if (isSCAApp = isSCAApplication() || isTuscanyManager()) {
+ String sharedProp = System.getProperty(TuscanyLifecycleListener.TUSCANY_SHARED_PROP, "false");
+ boolean shared = "true".equalsIgnoreCase(sharedProp);
+ if (!shared) {
+ setParentClassLoader(copy(getTuscanyClassloader(parent)));
+ } else {
+ // The default parent classloader is the one for the webapp
+ setParentClassLoader(getTuscanyClassloader(parent));
+ }
+ }
+
+ return super.getLoader();
+ }
+
+ @Override
+ public boolean listenerStart() {
+ if (isTuscanyManager()) {
+ // this isn't great having the manager app config scattered about different modules
+ // but is temp until this is all tidied up in a refactor after the basics are working
+ addApplicationListener(TUSCANY_MANAGER_LISTENER);
+ } else if (isSCAApp) {
+ enableTuscany();
+ }
+ return super.listenerStart();
+ }
+
+ private void enableTuscany() {
+
+ for (String listener : findApplicationListeners()) {
+ if (TUSCANY_CONTEXT_LISTENER.equals(listener)) {
+ // The web application already has the context listener configured
+ return;
+ }
+ }
+
+ for (FilterDef filterDef : findFilterDefs()) {
+ if (TUSCANY_SERVLET_FILTER.equals(filterDef.getFilterClass())) {
+ // The web application already has the filter configured
+ return;
+ }
+ }
+
+ addApplicationListener(TUSCANY_CONTEXT_LISTENER);
+
+ FilterDef filterDef = new FilterDef();
+ filterDef.setFilterName(TUSCANY_FILTER_NAME);
+ filterDef.setFilterClass(TUSCANY_SERVLET_FILTER);
+ addFilterDef(filterDef);
+
+ if (isUseNaming() && getNamingContextListener() != null) {
+ setAnnotationProcessor(new TuscanyAnnotationsProcessor(this, getNamingContextListener().getEnvContext()));
+ } else {
+ setAnnotationProcessor(new TuscanyAnnotationsProcessor(this, null));
+ }
+
+ log.info("Tuscany SCA is enabled for: " + this.getName());
+ }
+
+ private boolean isSCAApplication() {
+ Object o = null;
+ try {
+ o = getResources().lookup("WEB-INF/web.composite");
+ } catch (NamingException e) {
+ }
+ if (o == null) {
+ try {
+ o = getResources().lookup("META-INF/sca-contribution.xml");
+ } catch (NamingException e) {
+ }
+ }
+ if (o == null) {
+ return false;
+ }
+
+ // Try to see if the Tuscany jars are packaged in the webapp
+ NamingEnumeration<NameClassPair> enumeration;
+ try {
+ enumeration = getResources().list("WEB-INF/lib");
+ while (enumeration.hasMoreElements()) {
+ String jar = enumeration.nextElement().getName();
+ if (jar.startsWith("tuscany-")) {
+ // Do not alter is
+ log.info("Tuscany SCA ignoring webapp with embedded Tuscany runtime: " + this.getName());
+ return false;
+ }
+ }
+ } catch (NamingException e) {
+ }
+ return true;
+ }
+
+ private boolean isTuscanyManager() {
+ return "/tuscany".equals(getName());
+ }
+
+ private static URLClassLoader copy(URLClassLoader classLoader) {
+ return new URLClassLoader(classLoader.getURLs(), classLoader.getParent());
+ }
+
+ private synchronized URLClassLoader getTuscanyClassloader(ClassLoader parent) {
+ if (tuscanyClassLoader == null) {
+ File tuscanyWar = new File(System.getProperty(TuscanyLifecycleListener.TUSCANY_WAR_PROP));
+ File[] runtimeJars = new File(tuscanyWar, "tuscany-lib").listFiles();
+ try {
+ URL[] jarURLs = new URL[runtimeJars.length];
+ for (int i = 0; i < jarURLs.length; i++) {
+ jarURLs[i] = runtimeJars[i].toURI().toURL();
+ }
+ tuscanyClassLoader = new URLClassLoader(jarURLs, parent);
+ return tuscanyClassLoader;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return tuscanyClassLoader;
+ }
+}
diff --git a/java/sca/distribution/tomcat/tomcat-servlet/pom.xml b/java/sca/distribution/tomcat/tomcat-servlet/pom.xml
index 19c9381f83..83b68dad0c 100644
--- a/java/sca/distribution/tomcat/tomcat-servlet/pom.xml
+++ b/java/sca/distribution/tomcat/tomcat-servlet/pom.xml
@@ -1,63 +1,63 @@
-<?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-modules</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-tomcat-servlet</artifactId>
- <name>Apache Tuscany SCA Tomcat Integration Servlet</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-tomcat-hook</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.swizzle</groupId>
- <artifactId>swizzle-stream</artifactId>
- <version>1.0.2</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
-</project>
+<?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-modules</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-tomcat-servlet</artifactId>
+ <name>Apache Tuscany SCA Tomcat Integration Servlet</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tomcat-hook</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/tomcat/foo/TuscanyTomcatNode.java b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/tomcat/foo/TuscanyTomcatNode.java
index 69b0c77b72..972aafd8b6 100644
--- a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/tomcat/foo/TuscanyTomcatNode.java
+++ b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/tomcat/foo/TuscanyTomcatNode.java
@@ -1,74 +1,74 @@
-/*
- * 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 org.apache.tuscany.sca.tomcat.foo;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.war.Installer;
-
-public class TuscanyTomcatNode implements ServletContextListener {
-
- protected Node tomcatNode;
-
- public void contextInitialized(ServletContextEvent arg0) {
- if (!Installer.isTuscanyHookRunning()) {
- return;
- }
-
- // TODO: this relys on the location of webapp folder, find way to get actual catalina base
- File tomcatBase = new File(arg0.getServletContext().getRealPath("/")).getParentFile().getParentFile();
-
- File contributionDir = new File(tomcatBase, "sca-contributions");
- if (!contributionDir.exists()) {
- return;
- }
- File[] contributionFiles = contributionDir.listFiles();
- if (contributionFiles.length < 1) {
- return;
- }
-
- Contribution[] nodeContributions = new Contribution[contributionFiles.length];
- for (int i = 0; i<contributionFiles.length; i++) {
- try {
- nodeContributions[i] =
- new Contribution(contributionFiles[i].getName(), contributionFiles[i].toURI().toURL().toString());
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
-
- tomcatNode = NodeFactory.newInstance().createNode(nodeContributions);
- tomcatNode.start();
- }
-
- public void contextDestroyed(ServletContextEvent arg0) {
- if (tomcatNode != null) {
- tomcatNode.stop();
- }
- }
-
-}
+/*
+ * 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 org.apache.tuscany.sca.tomcat.foo;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.war.Installer;
+
+public class TuscanyTomcatNode implements ServletContextListener {
+
+ protected Node tomcatNode;
+
+ public void contextInitialized(ServletContextEvent arg0) {
+ if (!Installer.isTuscanyHookRunning()) {
+ return;
+ }
+
+ // TODO: this relys on the location of webapp folder, find way to get actual catalina base
+ File tomcatBase = new File(arg0.getServletContext().getRealPath("/")).getParentFile().getParentFile();
+
+ File contributionDir = new File(tomcatBase, "sca-contributions");
+ if (!contributionDir.exists()) {
+ return;
+ }
+ File[] contributionFiles = contributionDir.listFiles();
+ if (contributionFiles.length < 1) {
+ return;
+ }
+
+ Contribution[] nodeContributions = new Contribution[contributionFiles.length];
+ for (int i = 0; i<contributionFiles.length; i++) {
+ try {
+ nodeContributions[i] =
+ new Contribution(contributionFiles[i].getName(), contributionFiles[i].toURI().toURL().toString());
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ tomcatNode = NodeFactory.newInstance().createNode(nodeContributions);
+ tomcatNode.start();
+ }
+
+ public void contextDestroyed(ServletContextEvent arg0) {
+ if (tomcatNode != null) {
+ tomcatNode.stop();
+ }
+ }
+
+}
diff --git a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java
index 9ad06832e5..2251a2e833 100644
--- a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java
+++ b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java
@@ -1,318 +1,318 @@
-/*
- * 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 org.apache.tuscany.sca.war;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Properties;
-
-import org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener;
-import org.codehaus.swizzle.stream.DelimitedTokenReplacementInputStream;
-import org.codehaus.swizzle.stream.StringTokenHandler;
-
-public class Installer {
-
- private static boolean restartRequired;
- private static boolean tuscanyHookRunning;
- static {
- try {
- tuscanyHookRunning = TuscanyLifecycleListener.isRunning();
- } catch (Throwable e) {
- tuscanyHookRunning = false;
- }
- }
-
- public static boolean isTuscanyHookRunning() {
- return tuscanyHookRunning;
- }
-
- public static boolean isRestartRequired() {
- return restartRequired;
- }
-
- private File tuscanyWAR;
- private File catalinaBase;
- private String status = "";
-
- public Installer(File tuscanyWAR, File catalinaBase) {
- this.tuscanyWAR = tuscanyWAR;
- this.catalinaBase = catalinaBase;
- }
-
- public static boolean isInstalled() {
- return false;
- }
-
- public String getStatus() {
- return status;
- }
-
- public boolean install(boolean singleton) {
- try {
-
- doInstall(singleton);
- status = "Install successful, Tomcat restart required.";
- restartRequired = true;
- return true;
-
- } catch (Throwable e) {
- status = "Exception during install\n";
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter(os);
- e.printStackTrace(pw);
- pw.close();
- status += new String(os.toByteArray());
- return false;
- }
- }
-
- public boolean uninstall() {
- try {
-
- doUnintsall();
- status =
- "Tuscany removed from server.xml, please restart Tomcat and manually remove Tuscany jars from Tomcat lib";
- restartRequired = true;
- return true;
-
- } catch (Throwable e) {
- status = "Exception during install";
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter(os);
- e.printStackTrace(pw);
- status += "/n" + new String(os.toByteArray());
- return false;
- }
- }
-
- private void doUnintsall() {
- File serverXml = new File(catalinaBase, "/conf/server.xml");
- if (!(serverXml.exists())) {
- throw new IllegalStateException("conf/server.xml not found: " + serverXml.getAbsolutePath());
- }
- removeServerXml(serverXml);
- File propFile = new File(tuscanyWAR, "tuscany.properties");
- if (propFile.isFile()) {
- propFile.delete();
- }
-
- }
-
- private boolean doInstall(boolean singleton) {
- // First verify all the file locations are as expected
- if (!tuscanyWAR.exists()) {
- throw new IllegalStateException("Tuscany war missing: " + tuscanyWAR.getAbsolutePath());
- }
- if (!catalinaBase.exists()) {
- throw new IllegalStateException("Catalina base does not exist: " + catalinaBase.getAbsolutePath());
- }
- File serverLib = new File(catalinaBase, "/lib");
- if (!(serverLib.exists())) {
- // try Tomcat 5 server/lib
- if (new File(catalinaBase, "/server").exists()) {
- serverLib = new File(new File(catalinaBase, "/server"), "/lib");
- }
- }
- if (!(serverLib.exists())) {
- throw new IllegalStateException("Tomcat lib not found: " + serverLib.getAbsolutePath());
- }
- File serverXml = new File(catalinaBase, "/conf/server.xml");
- if (!(serverXml.exists())) {
- throw new IllegalStateException("conf/server.xml not found: " + serverXml.getAbsolutePath());
- }
-
- File tuscanyTomcatJar = findTuscanyTomcatJar(tuscanyWAR);
- if (tuscanyTomcatJar == null || !tuscanyTomcatJar.exists()) {
- throw new IllegalStateException("Can't find tuscany-tomcat-*.jar in: " + tuscanyWAR.getAbsolutePath());
- }
-
- // Copy tuscany-tomcat jar from the tuscany webapp web-inf/lib to Tomcat server/lib
- copyFile(tuscanyTomcatJar, new File(serverLib, tuscanyTomcatJar.getName()));
-
- if (singleton) {
- try {
- // Write out a property file
- File propFile = new File(tuscanyWAR, "tuscany.properties");
- FileOutputStream os = new FileOutputStream(propFile);
- Properties props = new Properties();
- props.put("singleton", "true");
- props.store(os, "Apache Tuscany properties for Tomcat");
- os.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- // Add Tuscany LifecycleListener to Tomcat server.xml
- updateServerXml(serverXml);
-
- return true;
- }
-
- private File findTuscanyTomcatJar(File tuscanyWAR) {
- File lib = new File(tuscanyWAR, "/tomcat-lib");
- for (File f : lib.listFiles()) {
- if (f.getName().startsWith("tuscany-tomcat-hook-") && f.getName().endsWith(".jar")) {
- return f;
- }
- }
- return null;
- }
-
- static final String tuscanyListener =
- "\r\n" + " <!-- Tuscany plugin for Tomcat -->\r\n"
- + "<Listener className=\"org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener\" />";
-
- private void updateServerXml(File serverXmlFile) {
- String serverXML = readAll(serverXmlFile);
- if (!serverXML.contains(tuscanyListener)) {
- String newServerXml = replace(serverXML, "<Server", "<Server", ">", ">" + tuscanyListener);
- backup(serverXmlFile);
- writeAll(serverXmlFile, newServerXml);
- }
-
- }
-
- private void removeServerXml(File serverXmlFile) {
- String serverXML = readAll(serverXmlFile);
- if (serverXML.contains(tuscanyListener)) {
- String newServerXml = replace(serverXML, "<Server", "<Server", ">" + tuscanyListener, ">");
- writeAll(serverXmlFile, newServerXml);
- }
-
- }
-
- private String replace(String inputText, String begin, String newBegin, String end, String newEnd) {
- BeginEndTokenHandler tokenHandler = new BeginEndTokenHandler(newBegin, newEnd);
-
- ByteArrayInputStream in = new ByteArrayInputStream(inputText.getBytes());
-
- InputStream replacementStream = new DelimitedTokenReplacementInputStream(in, begin, end, tokenHandler, true);
- String newServerXml = readAll(replacementStream);
- close(replacementStream);
- return newServerXml;
- }
-
- private boolean backup(File source) {
- File backupFile = new File(source.getParent(), source.getName() + ".b4Tuscany");
- if (!backupFile.exists()) {
- copyFile(source, backupFile);
- }
- return true;
- }
-
- private String readAll(File file) {
- FileInputStream in = null;
- try {
- in = new FileInputStream(file);
- String text = readAll(in);
- return text;
- } catch (Exception e) {
- return null;
- } finally {
- close(in);
- }
- }
-
- private String readAll(InputStream in) {
- try {
- // SwizzleStream block read methods are broken so read byte at a time
- StringBuilder sb = new StringBuilder();
- int i = in.read();
- while (i != -1) {
- sb.append((char)i);
- i = in.read();
- }
- return sb.toString();
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private void copyFile(File source, File destination) {
- InputStream in = null;
- OutputStream out = null;
- try {
- in = new FileInputStream(source);
- out = new FileOutputStream(destination);
- writeAll(in, out);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- } finally {
- close(in);
- close(out);
- }
- }
-
- private boolean writeAll(File file, String text) {
- FileOutputStream fileOutputStream = null;
- try {
- fileOutputStream = new FileOutputStream(file);
- writeAll(new ByteArrayInputStream(text.getBytes()), fileOutputStream);
- return true;
- } catch (Exception e) {
- return false;
- } finally {
- close(fileOutputStream);
- }
- }
-
- private void writeAll(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[4096];
- int count;
- while ((count = in.read(buffer)) > 0) {
- out.write(buffer, 0, count);
- }
- out.flush();
- }
-
- private void close(Closeable thing) {
- if (thing != null) {
- try {
- thing.close();
- } catch (Exception ignored) {
- }
- }
- }
-
- private class BeginEndTokenHandler extends StringTokenHandler {
- private final String begin;
- private final String end;
-
- public BeginEndTokenHandler(String begin, String end) {
- this.begin = begin;
- this.end = end;
- }
-
- public String handleToken(String token) throws IOException {
- String result = begin + token + end;
- return result;
- }
- }
-
-}
+/*
+ * 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 org.apache.tuscany.sca.war;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+import org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener;
+import org.codehaus.swizzle.stream.DelimitedTokenReplacementInputStream;
+import org.codehaus.swizzle.stream.StringTokenHandler;
+
+public class Installer {
+
+ private static boolean restartRequired;
+ private static boolean tuscanyHookRunning;
+ static {
+ try {
+ tuscanyHookRunning = TuscanyLifecycleListener.isRunning();
+ } catch (Throwable e) {
+ tuscanyHookRunning = false;
+ }
+ }
+
+ public static boolean isTuscanyHookRunning() {
+ return tuscanyHookRunning;
+ }
+
+ public static boolean isRestartRequired() {
+ return restartRequired;
+ }
+
+ private File tuscanyWAR;
+ private File catalinaBase;
+ private String status = "";
+
+ public Installer(File tuscanyWAR, File catalinaBase) {
+ this.tuscanyWAR = tuscanyWAR;
+ this.catalinaBase = catalinaBase;
+ }
+
+ public static boolean isInstalled() {
+ return false;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public boolean install(boolean singleton) {
+ try {
+
+ doInstall(singleton);
+ status = "Install successful, Tomcat restart required.";
+ restartRequired = true;
+ return true;
+
+ } catch (Throwable e) {
+ status = "Exception during install\n";
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(os);
+ e.printStackTrace(pw);
+ pw.close();
+ status += new String(os.toByteArray());
+ return false;
+ }
+ }
+
+ public boolean uninstall() {
+ try {
+
+ doUnintsall();
+ status =
+ "Tuscany removed from server.xml, please restart Tomcat and manually remove Tuscany jars from Tomcat lib";
+ restartRequired = true;
+ return true;
+
+ } catch (Throwable e) {
+ status = "Exception during install";
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(os);
+ e.printStackTrace(pw);
+ status += "/n" + new String(os.toByteArray());
+ return false;
+ }
+ }
+
+ private void doUnintsall() {
+ File serverXml = new File(catalinaBase, "/conf/server.xml");
+ if (!(serverXml.exists())) {
+ throw new IllegalStateException("conf/server.xml not found: " + serverXml.getAbsolutePath());
+ }
+ removeServerXml(serverXml);
+ File propFile = new File(tuscanyWAR, "tuscany.properties");
+ if (propFile.isFile()) {
+ propFile.delete();
+ }
+
+ }
+
+ private boolean doInstall(boolean singleton) {
+ // First verify all the file locations are as expected
+ if (!tuscanyWAR.exists()) {
+ throw new IllegalStateException("Tuscany war missing: " + tuscanyWAR.getAbsolutePath());
+ }
+ if (!catalinaBase.exists()) {
+ throw new IllegalStateException("Catalina base does not exist: " + catalinaBase.getAbsolutePath());
+ }
+ File serverLib = new File(catalinaBase, "/lib");
+ if (!(serverLib.exists())) {
+ // try Tomcat 5 server/lib
+ if (new File(catalinaBase, "/server").exists()) {
+ serverLib = new File(new File(catalinaBase, "/server"), "/lib");
+ }
+ }
+ if (!(serverLib.exists())) {
+ throw new IllegalStateException("Tomcat lib not found: " + serverLib.getAbsolutePath());
+ }
+ File serverXml = new File(catalinaBase, "/conf/server.xml");
+ if (!(serverXml.exists())) {
+ throw new IllegalStateException("conf/server.xml not found: " + serverXml.getAbsolutePath());
+ }
+
+ File tuscanyTomcatJar = findTuscanyTomcatJar(tuscanyWAR);
+ if (tuscanyTomcatJar == null || !tuscanyTomcatJar.exists()) {
+ throw new IllegalStateException("Can't find tuscany-tomcat-*.jar in: " + tuscanyWAR.getAbsolutePath());
+ }
+
+ // Copy tuscany-tomcat jar from the tuscany webapp web-inf/lib to Tomcat server/lib
+ copyFile(tuscanyTomcatJar, new File(serverLib, tuscanyTomcatJar.getName()));
+
+ if (singleton) {
+ try {
+ // Write out a property file
+ File propFile = new File(tuscanyWAR, "tuscany.properties");
+ FileOutputStream os = new FileOutputStream(propFile);
+ Properties props = new Properties();
+ props.put("singleton", "true");
+ props.store(os, "Apache Tuscany properties for Tomcat");
+ os.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Add Tuscany LifecycleListener to Tomcat server.xml
+ updateServerXml(serverXml);
+
+ return true;
+ }
+
+ private File findTuscanyTomcatJar(File tuscanyWAR) {
+ File lib = new File(tuscanyWAR, "/tomcat-lib");
+ for (File f : lib.listFiles()) {
+ if (f.getName().startsWith("tuscany-tomcat-hook-") && f.getName().endsWith(".jar")) {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ static final String tuscanyListener =
+ "\r\n" + " <!-- Tuscany plugin for Tomcat -->\r\n"
+ + "<Listener className=\"org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener\" />";
+
+ private void updateServerXml(File serverXmlFile) {
+ String serverXML = readAll(serverXmlFile);
+ if (!serverXML.contains(tuscanyListener)) {
+ String newServerXml = replace(serverXML, "<Server", "<Server", ">", ">" + tuscanyListener);
+ backup(serverXmlFile);
+ writeAll(serverXmlFile, newServerXml);
+ }
+
+ }
+
+ private void removeServerXml(File serverXmlFile) {
+ String serverXML = readAll(serverXmlFile);
+ if (serverXML.contains(tuscanyListener)) {
+ String newServerXml = replace(serverXML, "<Server", "<Server", ">" + tuscanyListener, ">");
+ writeAll(serverXmlFile, newServerXml);
+ }
+
+ }
+
+ private String replace(String inputText, String begin, String newBegin, String end, String newEnd) {
+ BeginEndTokenHandler tokenHandler = new BeginEndTokenHandler(newBegin, newEnd);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(inputText.getBytes());
+
+ InputStream replacementStream = new DelimitedTokenReplacementInputStream(in, begin, end, tokenHandler, true);
+ String newServerXml = readAll(replacementStream);
+ close(replacementStream);
+ return newServerXml;
+ }
+
+ private boolean backup(File source) {
+ File backupFile = new File(source.getParent(), source.getName() + ".b4Tuscany");
+ if (!backupFile.exists()) {
+ copyFile(source, backupFile);
+ }
+ return true;
+ }
+
+ private String readAll(File file) {
+ FileInputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ String text = readAll(in);
+ return text;
+ } catch (Exception e) {
+ return null;
+ } finally {
+ close(in);
+ }
+ }
+
+ private String readAll(InputStream in) {
+ try {
+ // SwizzleStream block read methods are broken so read byte at a time
+ StringBuilder sb = new StringBuilder();
+ int i = in.read();
+ while (i != -1) {
+ sb.append((char)i);
+ i = in.read();
+ }
+ return sb.toString();
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private void copyFile(File source, File destination) {
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = new FileInputStream(source);
+ out = new FileOutputStream(destination);
+ writeAll(in, out);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ } finally {
+ close(in);
+ close(out);
+ }
+ }
+
+ private boolean writeAll(File file, String text) {
+ FileOutputStream fileOutputStream = null;
+ try {
+ fileOutputStream = new FileOutputStream(file);
+ writeAll(new ByteArrayInputStream(text.getBytes()), fileOutputStream);
+ return true;
+ } catch (Exception e) {
+ return false;
+ } finally {
+ close(fileOutputStream);
+ }
+ }
+
+ private void writeAll(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[4096];
+ int count;
+ while ((count = in.read(buffer)) > 0) {
+ out.write(buffer, 0, count);
+ }
+ out.flush();
+ }
+
+ private void close(Closeable thing) {
+ if (thing != null) {
+ try {
+ thing.close();
+ } catch (Exception ignored) {
+ }
+ }
+ }
+
+ private class BeginEndTokenHandler extends StringTokenHandler {
+ private final String begin;
+ private final String end;
+
+ public BeginEndTokenHandler(String begin, String end) {
+ this.begin = begin;
+ this.end = end;
+ }
+
+ public String handleToken(String token) throws IOException {
+ String result = begin + token + end;
+ return result;
+ }
+ }
+
+}
diff --git a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/InstallerServlet.java b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/InstallerServlet.java
index 5447bab83d..a7e5c7e3d7 100644
--- a/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/InstallerServlet.java
+++ b/java/sca/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/InstallerServlet.java
@@ -1,70 +1,70 @@
-/*
- * 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 org.apache.tuscany.sca.war;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class InstallerServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- private transient ServletConfig servletConfig;
- private transient Installer installer;
-
- public void init(ServletConfig servletConfig) throws ServletException {
- this.servletConfig = servletConfig;
- String path = servletConfig.getServletContext().getRealPath("/");
- File tuscanyWarDir = null;
- if (path != null) {
- tuscanyWarDir = new File(path);
- }
- File tomcatBase = new File(System.getProperty("catalina.base"));
- installer = new Installer(tuscanyWarDir, tomcatBase);
- }
-
- protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
- doIt(httpServletRequest, httpServletResponse);
- }
-
- protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
- doIt(httpServletRequest, httpServletResponse);
- }
-
- protected void doIt(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
-
- if ("Install".equalsIgnoreCase(req.getParameter("action"))) {
- String singleton = req.getParameter("singleton");
- installer.install(singleton!=null && singleton.equalsIgnoreCase("true"));
- } else if ("Uninstall".equalsIgnoreCase(req.getParameter("action"))) {
- installer.uninstall();
- }
-
- req.setAttribute("installer", installer);
- RequestDispatcher rd = servletConfig.getServletContext().getRequestDispatcher("/installer.jsp");
- rd.forward(req,res);
- }
-
-}
+/*
+ * 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 org.apache.tuscany.sca.war;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class InstallerServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ private transient ServletConfig servletConfig;
+ private transient Installer installer;
+
+ public void init(ServletConfig servletConfig) throws ServletException {
+ this.servletConfig = servletConfig;
+ String path = servletConfig.getServletContext().getRealPath("/");
+ File tuscanyWarDir = null;
+ if (path != null) {
+ tuscanyWarDir = new File(path);
+ }
+ File tomcatBase = new File(System.getProperty("catalina.base"));
+ installer = new Installer(tuscanyWarDir, tomcatBase);
+ }
+
+ protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
+ doIt(httpServletRequest, httpServletResponse);
+ }
+
+ protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
+ doIt(httpServletRequest, httpServletResponse);
+ }
+
+ protected void doIt(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+
+ if ("Install".equalsIgnoreCase(req.getParameter("action"))) {
+ String singleton = req.getParameter("singleton");
+ installer.install(singleton!=null && singleton.equalsIgnoreCase("true"));
+ } else if ("Uninstall".equalsIgnoreCase(req.getParameter("action"))) {
+ installer.uninstall();
+ }
+
+ req.setAttribute("installer", installer);
+ RequestDispatcher rd = servletConfig.getServletContext().getRequestDispatcher("/installer.jsp");
+ rd.forward(req,res);
+ }
+
+}
diff --git a/java/sca/distribution/tomcat/tomcat-war/pom.xml b/java/sca/distribution/tomcat/tomcat-war/pom.xml
index 973e80d67b..fa768b7f54 100644
--- a/java/sca/distribution/tomcat/tomcat-war/pom.xml
+++ b/java/sca/distribution/tomcat/tomcat-war/pom.xml
@@ -1,86 +1,86 @@
-<?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-distribution</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-war</artifactId>
- <name>Apache Tuscany SCA Tomcat Deep Integration WAR</name>
- <packaging>pom</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.swizzle</groupId>
- <artifactId>swizzle-stream</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-tomcat-servlet</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-tomcat-hook</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-web-runtime</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-axis2</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>tuscany</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>war</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>src/main/assembly/war.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+<?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-distribution</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-war</artifactId>
+ <name>Apache Tuscany SCA Tomcat Deep Integration WAR</name>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.swizzle</groupId>
+ <artifactId>swizzle-stream</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tomcat-servlet</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tomcat-hook</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-web-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>tuscany</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/assembly/war.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/sca/distribution/tomcat/tomcat-war/src/main/assembly/war.xml b/java/sca/distribution/tomcat/tomcat-war/src/main/assembly/war.xml
index 67f976459e..695acee3f0 100644
--- a/java/sca/distribution/tomcat/tomcat-war/src/main/assembly/war.xml
+++ b/java/sca/distribution/tomcat/tomcat-war/src/main/assembly/war.xml
@@ -1,94 +1,94 @@
-<?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.
--->
-<assembly>
- <id>war</id>
- <formats>
- <format>war</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <includes>
- <include>README.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target/classes</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>README.txt</include>
- <include>NOTICE.txt</include>
- <include>LICENSE.txt</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/webapp</directory>
- <outputDirectory>/</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target/classes</directory>
- <outputDirectory>/</outputDirectory>
- <excludes>
- <exclude>org/**</exclude>
- <exclude>META-INF/LICENSE</exclude>
- <exclude>META-INF/NOTICE</exclude>
- </excludes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target/classes</directory>
- <outputDirectory>WEB-INF/classes</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${basedir}/target</directory>
- <outputDirectory>lib</outputDirectory>
- <includes>
- <include>tuscany-host*.jar</include>
- </includes>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>tuscany-lib</outputDirectory>
- <scope>runtime</scope>
- <excludes>
- <exclude>org.apache.tomcat:catalina</exclude>
- <exclude>org.apache.tomcat:annotations-api</exclude>
- <exclude>org.apache.tomcat:juli</exclude>
- <exclude>org.apache.tomcat:servlet-api</exclude>
- </excludes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>tomcat-lib</outputDirectory>
- <scope>runtime</scope>
- <includes>
- <include>org.apache.tuscany.sca:tuscany-tomcat-hook</include>
- </includes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>WEB-INF/lib</outputDirectory>
- <scope>runtime</scope>
- <includes>
- <include>org.apache.tuscany.sca:tuscany-tomcat-servlet</include>
- <include>org.codehaus.swizzle:swizzle-stream</include>
- </includes>
- </dependencySet>
- </dependencySets>
-</assembly>
-
+<?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.
+-->
+<assembly>
+ <id>war</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>README.txt</include>
+ <include>NOTICE.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/webapp</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>org/**</exclude>
+ <exclude>META-INF/LICENSE</exclude>
+ <exclude>META-INF/NOTICE</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/classes</directory>
+ <outputDirectory>WEB-INF/classes</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>tuscany-host*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>tuscany-lib</outputDirectory>
+ <scope>runtime</scope>
+ <excludes>
+ <exclude>org.apache.tomcat:catalina</exclude>
+ <exclude>org.apache.tomcat:annotations-api</exclude>
+ <exclude>org.apache.tomcat:juli</exclude>
+ <exclude>org.apache.tomcat:servlet-api</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>tomcat-lib</outputDirectory>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.apache.tuscany.sca:tuscany-tomcat-hook</include>
+ </includes>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.apache.tuscany.sca:tuscany-tomcat-servlet</include>
+ <include>org.codehaus.swizzle:swizzle-stream</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
diff --git a/java/sca/distribution/tomcat/tomcat-war/src/main/webapp/WEB-INF/web.xml b/java/sca/distribution/tomcat/tomcat-war/src/main/webapp/WEB-INF/web.xml
index f416c92c26..e6c3d23e9e 100644
--- a/java/sca/distribution/tomcat/tomcat-war/src/main/webapp/WEB-INF/web.xml
+++ b/java/sca/distribution/tomcat/tomcat-war/src/main/webapp/WEB-INF/web.xml
@@ -1,40 +1,40 @@
-<?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>Tuscany Installer Application</display-name>
-
- <servlet>
- <servlet-name>InstallerServlet</servlet-name>
- <servlet-class>org.apache.tuscany.sca.war.InstallerServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>InstallerServlet</servlet-name>
- <url-pattern>/installer</url-pattern>
- </servlet-mapping>
-
- <welcome-file-list id="WelcomeFileList">
- <welcome-file>installer.jsp</welcome-file>
- </welcome-file-list>
-
-</web-app>
+<?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>Tuscany Installer Application</display-name>
+
+ <servlet>
+ <servlet-name>InstallerServlet</servlet-name>
+ <servlet-class>org.apache.tuscany.sca.war.InstallerServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>InstallerServlet</servlet-name>
+ <url-pattern>/installer</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>installer.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>