summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
authorramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2008-11-21 12:00:42 +0000
committerramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2008-11-21 12:00:42 +0000
commit6a9b9b7586fd7a377d57b5ce0117c664beebff25 (patch)
tree89b3ba1a641765113f5113501c3347511e58cfaf /branches
parent985a434b60e0722ae583287e0cfecd359bbc517b (diff)
Fixes for TUSCANY-2683 and TUSCANY-2685
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@719564 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.x/modules/implementation-das/README78
-rw-r--r--branches/sca-java-1.x/modules/implementation-das/build.xml51
-rw-r--r--branches/sca-java-1.x/modules/implementation-data-xml/README78
-rw-r--r--branches/sca-java-1.x/modules/implementation-data-xml/build.xml51
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/pom.xml7
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java48
6 files changed, 36 insertions, 277 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-das/README b/branches/sca-java-1.x/modules/implementation-das/README
deleted file mode 100644
index 763daafe46..0000000000
--- a/branches/sca-java-1.x/modules/implementation-das/README
+++ /dev/null
@@ -1,78 +0,0 @@
-Implementation CRUD Sample
-==========================
-This sample demonstrates how new implementation types are constructed for
-Apache Tuscany SCA.
-
-The README in the samples directory (the directory above this) provides
-general instructions about building and running samples. Take a look there
-first.
-
-If you want to try out the crud implementation type that this sample provides
-please see the implementation-crud-client sample that provides the necessary
-client code to bring up an application that uses this implementation-crud
-
-Sample Overview
----------------
-This sample contains a CRUD implementation type as an example of how to create
-new implementation types. Components using this implementation type always
-expose the same Create, Retrieve, Update and Delete interface. This sample
-uses a singleton ResourceManager to perform the CRUD operations but of course
-a real component would provide a real implementation.
-
-implementation-crud/
- src/
- main/
- java/
- crud/ - implementation model interfaces
- crud.backend/ - fake component implementation
- crud.impl/ - implementations of the model interfaces
- crud.module/ - gets the implementation-crud module registered
- with the SCA runtime
- crud.provider/ - runtime implementation
- resources/
- crud.composite - the SCA assembly used during unit testing
-
- build.xml - the Ant build file
- pom.xml - the Maven build file
-
-Building The Sample Extension Using Ant
------------------------------------------
-With the binary distribution the sample extension can be built using Ant as
-follows
-
-cd implementation-crud
-ant compile
-
-See the sample implementation-crud-client to run a sample that uses this
-binding.
-
-Building The Sample Using Maven
--------------------------------------------
-With either the binary or source distributions the sample can be built
-using Maven as follows.
-
-cd implementation-crud
-mvn
-
-Maven will also test that the sample extension built properly. You should see
-the following output from the test phase.
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running crud.CRUDTestCase
-Starting CRUDServiceComponent
-create(ABC) in tmp
-retrieve(0)
-update(0)
-retrieve(0)
-delete(0)
-retrieve(0)
-Stopping CRUDServiceComponent
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-java-1.x/modules/implementation-das/build.xml b/branches/sca-java-1.x/modules/implementation-das/build.xml
deleted file mode 100644
index ab0d93beb0..0000000000
--- a/branches/sca-java-1.x/modules/implementation-das/build.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- * 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 name="implementation-crud" default="compile">
- <property name="test.jar" value="sample-implementation-crud.jar" />
-
- <target name="init">
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5">
- <classpath>
- <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
- </classpath>
- </javac>
- <copy todir="target/classes">
- <fileset dir="src/main/resources"/>
- </copy>
- <jar destfile="target/${test.jar}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${test.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="clean">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- </target>
-</project>
diff --git a/branches/sca-java-1.x/modules/implementation-data-xml/README b/branches/sca-java-1.x/modules/implementation-data-xml/README
deleted file mode 100644
index 763daafe46..0000000000
--- a/branches/sca-java-1.x/modules/implementation-data-xml/README
+++ /dev/null
@@ -1,78 +0,0 @@
-Implementation CRUD Sample
-==========================
-This sample demonstrates how new implementation types are constructed for
-Apache Tuscany SCA.
-
-The README in the samples directory (the directory above this) provides
-general instructions about building and running samples. Take a look there
-first.
-
-If you want to try out the crud implementation type that this sample provides
-please see the implementation-crud-client sample that provides the necessary
-client code to bring up an application that uses this implementation-crud
-
-Sample Overview
----------------
-This sample contains a CRUD implementation type as an example of how to create
-new implementation types. Components using this implementation type always
-expose the same Create, Retrieve, Update and Delete interface. This sample
-uses a singleton ResourceManager to perform the CRUD operations but of course
-a real component would provide a real implementation.
-
-implementation-crud/
- src/
- main/
- java/
- crud/ - implementation model interfaces
- crud.backend/ - fake component implementation
- crud.impl/ - implementations of the model interfaces
- crud.module/ - gets the implementation-crud module registered
- with the SCA runtime
- crud.provider/ - runtime implementation
- resources/
- crud.composite - the SCA assembly used during unit testing
-
- build.xml - the Ant build file
- pom.xml - the Maven build file
-
-Building The Sample Extension Using Ant
------------------------------------------
-With the binary distribution the sample extension can be built using Ant as
-follows
-
-cd implementation-crud
-ant compile
-
-See the sample implementation-crud-client to run a sample that uses this
-binding.
-
-Building The Sample Using Maven
--------------------------------------------
-With either the binary or source distributions the sample can be built
-using Maven as follows.
-
-cd implementation-crud
-mvn
-
-Maven will also test that the sample extension built properly. You should see
-the following output from the test phase.
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running crud.CRUDTestCase
-Starting CRUDServiceComponent
-create(ABC) in tmp
-retrieve(0)
-update(0)
-retrieve(0)
-delete(0)
-retrieve(0)
-Stopping CRUDServiceComponent
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-java-1.x/modules/implementation-data-xml/build.xml b/branches/sca-java-1.x/modules/implementation-data-xml/build.xml
deleted file mode 100644
index ab0d93beb0..0000000000
--- a/branches/sca-java-1.x/modules/implementation-data-xml/build.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- * 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 name="implementation-crud" default="compile">
- <property name="test.jar" value="sample-implementation-crud.jar" />
-
- <target name="init">
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5">
- <classpath>
- <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
- </classpath>
- </javac>
- <copy todir="target/classes">
- <fileset dir="src/main/resources"/>
- </copy>
- <jar destfile="target/${test.jar}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${test.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="clean">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- </target>
-</project>
diff --git a/branches/sca-java-1.x/modules/implementation-spring/pom.xml b/branches/sca-java-1.x/modules/implementation-spring/pom.xml
index 94d2099659..eaaa73a708 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/pom.xml
+++ b/branches/sca-java-1.x/modules/implementation-spring/pom.xml
@@ -76,13 +76,6 @@
<version>1.4-SNAPSHOT</version>
</dependency>
- <!-- Temporarily depend on implementation-script for a set of utility classes -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-script</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
-
<!-- Spring dependencies... -->
<dependency>
<groupId>org.springframework</groupId>
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
index 34f46dacb9..214faf7198 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
@@ -527,7 +527,7 @@ public class SpringXMLComponentTypeLoader {
if (locationFile.isDirectory()) {
try {
- manifestFile = new File(locationFile, "META-INF"+ File.separator +"MANIFEST.MF");
+ manifestFile = new File(locationFile, "META-INF"+ File.separator +"MANIFEST.MF");
if (manifestFile.exists()) {
Manifest mf = new Manifest(new FileInputStream(manifestFile));
Attributes mainAttrs = mf.getMainAttributes();
@@ -548,11 +548,8 @@ public class SpringXMLComponentTypeLoader {
} catch (IOException e) {
throw new ContributionReadException("Error reading manifest " + manifestFile);
}
- } else {
- if (locationFile.isFile() && locationFile.getName().indexOf(".jar") < 0) {
- return new UrlResource(url);
- }
- else {
+ } else {
+ if (locationFile.isFile() && locationFile.getName().endsWith(".jar")) {
try {
JarFile jf = new JarFile(locationFile);
JarEntry je;
@@ -568,19 +565,46 @@ public class SpringXMLComponentTypeLoader {
}
}
}
- je = jf.getJarEntry("META-INF" + File.separator + "spring"
- + File.separator + Constants.APPLICATION_CONTEXT);
+ je = jf.getJarEntry("META-INF" + "/" + "spring" + "/" + Constants.APPLICATION_CONTEXT);
if (je != null) {
return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!/" + Constants.APPLICATION_CONTEXT));
}
} catch (IOException e) {
// bad archive
// TODO: create a more appropriate exception type
- throw new ContributionReadException(
- "SpringXMLLoader getApplicationContextResource: " + " IO exception reading context file.",
- e);
+ throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
+ + " IO exception reading context file.", e);
}
- }
+ }
+ else {
+ if (locationFile.getName().endsWith(".xml")) {
+ return new UrlResource(url);
+ }
+ else {
+ // Deal with the directory inside a jar file, in case the contribution itself is a JAR file.
+ try {
+ if (locationFile.getPath().indexOf(".jar") > 0) {
+ String jarEntry = url.getPath().substring(6, url.getPath().indexOf("!"));
+ JarFile jf = new JarFile(jarEntry);
+ JarEntry je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ + "/" + "META-INF" + "/" + "MANIFEST.MF");
+ if (je != null) {
+ Manifest mf = new Manifest(jf.getInputStream(je));
+ Attributes mainAttrs = mf.getMainAttributes();
+ String appCtxPath = mainAttrs.getValue("Spring-Context");
+ if (appCtxPath != null) {
+ je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" + appCtxPath);
+ if (je != null) {
+ return new UrlResource(new URL("jar:" + url.getPath() + "/" + appCtxPath));
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ throw new ContributionReadException("Error reading manifest " + manifestFile);
+ }
+ }
+ }
}
throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "