summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation
diff options
context:
space:
mode:
authorramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-07-15 09:27:43 +0000
committerramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-07-15 09:27:43 +0000
commitff5f740f195dbccc18b49365c0226f8da55d232d (patch)
treeca64af6dcc3eef05ddfabd48c0a187a0fb5b1193 /branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation
parentc97dda169b34bbcb4572ab3368d3e876ec8828eb (diff)
Fixes for handling folderNoManifest scenario of spring location attribute
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@794207 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation')
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
index d021d27dfc..6b67ba1eeb 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
@@ -692,12 +692,13 @@ public class SpringXMLComponentTypeLoader {
}
}
}
+ // Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
je = jf.getJarEntry("META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
if (je != null) {
- return new URL("jar:" + locationFile.toURI().toURL() + "!/" + SpringImplementationConstants.APPLICATION_CONTEXT);
+ return new URL("jar:" + locationFile.toURI().toURL() + "!/" +
+ "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.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);
@@ -711,8 +712,8 @@ public class SpringXMLComponentTypeLoader {
// 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);
+ String jarPath = url.getPath().substring(6, url.getPath().indexOf("!"));
+ JarFile jf = new JarFile(jarPath);
JarEntry je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
+ "/" + "META-INF" + "/" + "MANIFEST.MF");
if (je != null) {
@@ -726,6 +727,13 @@ public class SpringXMLComponentTypeLoader {
}
}
}
+ // Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
+ je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" +
+ "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
+ if (je != null) {
+ return new URL("jar:" + url.getPath() + "/" +
+ "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
+ }
}
} catch (IOException e) {
throw new ContributionReadException("Error reading manifest " + manifestFile);