Author: berndf
Date: Mon Aug 13 09:18:05 2007
New Revision: 565394
URL: http://svn.apache.org/viewvc?view=rev&rev=565394
Log:
fix broken refactoring + add javadoc
Modified:
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/DefaultServiceManagerFactory.java
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/FileSystemBridge.java
Modified:
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/DefaultServiceManagerFactory.java
URL:
http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/DefaultServiceManagerFactory.java?view=diff&rev=565394&r1=565393&r2=565394
==============================================================================
---
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/DefaultServiceManagerFactory.java
(original)
+++
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/DefaultServiceManagerFactory.java
Mon Aug 13 09:18:05 2007
@@ -115,7 +115,7 @@
}
/**
- *
+ * for replacing services without changing vanilla Avalon
james-assembly.xml
* @param replacements - Map<String, String>, the key indicating the
service reference to be replaced, the value
* indicating the replacement bean
*/
Modified:
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/FileSystemBridge.java
URL:
http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/FileSystemBridge.java?view=diff&rev=565394&r1=565393&r2=565394
==============================================================================
---
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/FileSystemBridge.java
(original)
+++
james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/FileSystemBridge.java
Mon Aug 13 09:18:05 2007
@@ -31,22 +31,22 @@
private static final String FILE_PROTOCOL_AND_CONF = "file://conf/";
public File getBasedir() throws FileNotFoundException {
- return new File(".");
- }
+ return new File(".");
+ }
/**
* loads resources from classpath or file system
*/
public InputStream getResource(String url) throws IOException {
- if (url.startsWith("classpath:")) {
- String resourceName = url.substring("classpath:".length());
- InputStream resourceAsStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
- if (resourceAsStream==null) {
- throw new IOException("Resource '" + resourceName + "'
not found in the classpath!");
- }
- return resourceAsStream;
- }
- return new FileInputStream(getFile(url));
+ if (url.startsWith("classpath:")) {
+ String resourceName = url.substring("classpath:".length());
+ InputStream resourceAsStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
+ if (resourceAsStream==null) {
+ throw new IOException("Resource '" + resourceName + "' not
found in the classpath!");
+ }
+ return resourceAsStream;
+ }
+ return new FileInputStream(getFile(url));
}
/**
@@ -54,11 +54,16 @@
*/
public File getFile(String fileURL) throws FileNotFoundException {
if (fileURL.startsWith(FILE_PROTOCOL)) {
+ File file = null;
if (fileURL.startsWith(FILE_PROTOCOL_AND_CONF)) {
- return new File("./src/main/config/" +
FILE_PROTOCOL_AND_CONF.substring(12));
+ file = new File("./src/main/config/" +
fileURL.substring(FILE_PROTOCOL_AND_CONF.length()));
} else {
- return new File("./" + FILE_PROTOCOL.substring(7));
+ file = new File("./" +
fileURL.substring(FILE_PROTOCOL.length()));
+ }
+ if (!file.exists()) {
+ throw new FileNotFoundException("cannot access file " +
file.toString());
}
+ return file;
} else {
throw new UnsupportedOperationException("getFile: " + fileURL);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]