You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by be...@apache.org on 2008/02/04 00:14:29 UTC
svn commit: r618118 - in /james/server/trunk/spring-deployment: ./
src/main/config/warfile/ src/main/config/warfile/WEB-INF/
src/main/java/org/apache/james/container/spring/beanfactory/
Author: berndf
Date: Sun Feb 3 15:14:25 2008
New Revision: 618118
URL: http://svn.apache.org/viewvc?rev=618118&view=rev
Log:
web container deployment, first take. see JAMES-834
Added:
james/server/trunk/spring-deployment/src/main/config/warfile/
james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/
james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/web.xml
james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/beanfactory/AvalonWebApplicationContext.java
Modified:
james/server/trunk/spring-deployment/build.xml
Modified: james/server/trunk/spring-deployment/build.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/build.xml?rev=618118&r1=618117&r2=618118&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/build.xml (original)
+++ james/server/trunk/spring-deployment/build.xml Sun Feb 3 15:14:25 2008
@@ -346,6 +346,16 @@
<replace file="${spring-deployment.target.bin.dir}/run.bat" token=":" value=";" />
</target>
+ <target name="dist-war" >
+ <war destfile="${spring-deployment.dist.dir}/${name}-spring-deployment-${version}.war"
+ webxml="src/main/config/warfile/WEB-INF/web.xml" >
+ <fileset dir="${spring-deployment.target.dir}" ><include name="NOTICE.txt" /></fileset>
+ <fileset dir="${spring-deployment.target.dir}" ><include name="LICENSE.txt" /></fileset>
+ <lib dir="${spring-deployment.target.lib.dir}" />
+ <zipfileset dir="${basedir}/src/main/config/james/" prefix="WEB-INF"/>
+ </war>
+ </target>
+
<target name="dist-binary" >
<mkdir dir="${spring-deployment.dist.dir}" />
<zip compress="true" destfile="${spring-deployment.dist.bin.zip}" >
Added: james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/web.xml?rev=618118&view=auto
==============================================================================
--- james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/web.xml (added)
+++ james/server/trunk/spring-deployment/src/main/config/warfile/WEB-INF/web.xml Sun Feb 3 15:14:25 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <context-param>
+ <description>WebFlow context configuration</description>
+ <param-name>contextClass</param-name>
+ <param-value>org.apache.james.container.spring.beanfactory.AvalonWebApplicationContext</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+
+ <servlet>
+ <servlet-name>james</servlet-name>
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>james</servlet-name>
+ <url-pattern>*.html</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+
+</web-app>
Added: james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/beanfactory/AvalonWebApplicationContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/beanfactory/AvalonWebApplicationContext.java?rev=618118&view=auto
==============================================================================
--- james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/beanfactory/AvalonWebApplicationContext.java (added)
+++ james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/beanfactory/AvalonWebApplicationContext.java Sun Feb 3 15:14:25 2008
@@ -0,0 +1,55 @@
+/****************************************************************
+ * 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.beanfactory;
+
+import org.springframework.web.context.support.AbstractRefreshableWebApplicationContext;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.core.io.Resource;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * application context which can be initialized in a web container environment
+ */
+public class AvalonWebApplicationContext extends AbstractRefreshableWebApplicationContext {
+
+ private List jamesAssemblyResources = new ArrayList();
+ private List springBeanLocations = new ArrayList();
+
+ protected void loadBeanDefinitions(DefaultListableBeanFactory defaultListableBeanFactory) throws IOException, BeansException {
+ // for the sake of simplicity, support only one james assembly and one bean definition currently
+ if (jamesAssemblyResources.size() != 1) throw new RuntimeException("can only load one Avalon-type assembly file");
+ if (springBeanLocations.size() != 1) throw new RuntimeException("can only load one Spring bean definition file");
+ Resource springBeanResource = getResourceByPath((String) springBeanLocations.get(0));
+ Resource jamesAssemblyResource = (Resource) jamesAssemblyResources.get(0);
+ AvalonApplicationContext.loadAvalonBasedBeanDefinitions(defaultListableBeanFactory, springBeanResource, jamesAssemblyResource);
+ }
+
+ public void setConfigLocations(String[] locationStrings) {
+ if (locationStrings == null) locationStrings = new String[] {"/WEB-INF/james-assembly.xml", "/WEB-INF/spring-beans.xml"};
+ for (int i = 0; i < locationStrings.length; i++) {
+ String locationString = locationStrings[i];
+ if (locationString.contains("james-assembly")) jamesAssemblyResources.add(getResourceByPath(locationString));
+ else springBeanLocations.add(locationString);
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org