[prev in list] [next in list] [prev in thread] [next in thread]
List: james-dev
Subject: svn commit: r894909 - in
From: norman () apache ! org
Date: 2009-12-31 17:52:36
Message-ID: 20091231175236.319D723889FD () eris ! apache ! org
[Download RAW message or body]
Author: norman
Date: Thu Dec 31 17:52:35 2009
New Revision: 894909
URL: http://svn.apache.org/viewvc?rev=894909&view=rev
Log:
We need to handle the Resource stuff different for James (like bernd did)
Added:
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java
Modified:
james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/Main.java
Added: james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/pure_spring_deployment/s \
pring-deployment/src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java?rev=894909&view=auto
==============================================================================
--- james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java \
(added)
+++ james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/JamesServerApplicationContext.java \
Thu Dec 31 17:52:35 2009 @@ -0,0 +1,59 @@
+/****************************************************************
+ * 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.james.container.spring;
+
+import java.io.File;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+
+public class JamesServerApplicationContext extends ClassPathXmlApplicationContext{
+
+ private static final String FILE_PROTOCOL = "file://";
+ private static final String FILE_PROTOCOL_AND_CONF = "file://conf/";
+ private static final String FILE_PROTOCOL_AND_VAR = "file://var/";
+
+ public JamesServerApplicationContext(String[] configs) {
+ super(configs);
+ }
+
+ public Resource getResource(String fileURL) {
+ Resource r = null;
+ if (fileURL.startsWith("classpath:")) {
+ String resourceName = fileURL.substring("classpath:".length());
+ r = new ClassPathResource(resourceName);
+ } else if (fileURL.startsWith(FILE_PROTOCOL)) {
+ File file = null;
+ if (fileURL.startsWith(FILE_PROTOCOL_AND_CONF)) {
+ file = new File("../conf/" + \
fileURL.substring(FILE_PROTOCOL_AND_CONF.length())); + } else if \
(fileURL.startsWith(FILE_PROTOCOL_AND_VAR)) { + file = new \
File("../var/" + fileURL.substring(FILE_PROTOCOL_AND_VAR.length())); + } \
else { + file = new File("./" + \
fileURL.substring(FILE_PROTOCOL.length())); + }
+ r = new FileSystemResource(file);
+ } else {
+ r = super.getResource(fileURL);
+ }
+ return r;
+ }
+
+}
Modified: james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/Main.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/active/pure_spring_deployment/s \
pring-deployment/src/main/java/org/apache/james/container/spring/Main.java?rev=894909&r1=894908&r2=894909&view=diff
==============================================================================
--- james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/Main.java \
(original)
+++ james/server/sandbox/active/pure_spring_deployment/spring-deployment/src/main/java/org/apache/james/container/spring/Main.java \
Thu Dec 31 17:52:35 2009 @@ -29,7 +29,7 @@
public static void main(String[] args) {
//JamesApplicationContext.newJamesApplicationContext();
- ApplicationContext context = new ClassPathXmlApplicationContext(
+ ApplicationContext context = new JamesServerApplicationContext(
new String[] {"spring-beans.xml"});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic