Author: ramkumar
Date: Fri Nov 21 04:00:42 2008
New Revision: 719564
URL: http://svn.apache.org/viewvc?rev=719564&view=rev
Log:
Fixes for TUSCANY-2683 and TUSCANY-2685
Removed:
tuscany/branches/sca-java-1.x/modules/implementation-das/README
tuscany/branches/sca-java-1.x/modules/implementation-das/build.xml
tuscany/branches/sca-java-1.x/modules/implementation-data-xml/README
tuscany/branches/sca-java-1.x/modules/implementation-data-xml/build.xml
Modified:
tuscany/branches/sca-java-1.x/modules/implementation-spring/pom.xml
tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
Modified: tuscany/branches/sca-java-1.x/modules/implementation-spring/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/pom.xml?rev=719564&r1=719563&r2=719564&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/modules/implementation-spring/pom.xml
(original)
+++ tuscany/branches/sca-java-1.x/modules/implementation-spring/pom.xml Fri Nov
21 04:00:42 2008
@@ -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>
Modified:
tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
URL:
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java?rev=719564&r1=719563&r2=719564&view=diff
==============================================================================
---
tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
(original)
+++
tuscany/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
Fri Nov 21 04:00:42 2008
@@ -527,7 +527,7 @@
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 @@
} 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 @@
}
}
}
- 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: "