weaver 2004/08/02 12:41:34
Modified: portal/src/java/org/apache/jetspeed/engine SpringEngine.java
portal/src/webapp/WEB-INF/conf jetspeed.properties
Log:
Allow for any number of assembly files to be sourced from the assembly dir directory
denoted by the assembly.dir property in jetspeed.properties
Revision Changes Path
1.6 +40 -14
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/SpringEngine.java
Index: SpringEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/SpringEngine.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SpringEngine.java 1 Aug 2004 23:17:24 -0000 1.5
+++ SpringEngine.java 2 Aug 2004 19:41:34 -0000 1.6
@@ -16,8 +16,9 @@
package org.apache.jetspeed.engine;
import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.ArrayList;
import javax.naming.NamingException;
import javax.servlet.ServletConfig;
@@ -60,22 +61,47 @@
ServletConfigFactoryBean.setServletConfig(servletConfig);
String relativeApplicationRoot = getRealPath("/");
- String absApplicationRoot = new
File(relativeApplicationRoot).getCanonicalPath();
- // String absoluteApplicationRoot = new
File(relativeApplicationRoot).getCanonicalPath();
- System.setProperty("applicationRoot", absApplicationRoot);
- ArrayList configs = new ArrayList();
- if (useInternalJNDI)
+ String absApplicationRoot = new
File(relativeApplicationRoot).getCanonicalPath();
+ System.setProperty("applicationRoot", absApplicationRoot);
+
+ final String assemblyDir =
configuration.getString("assembly.dir","/WEB-INF/assembly");
+ final String assemblyFileExtension =
configuration.getString("assembly.extension",".xml");
+
+ FileFilter extFilter = new FileFilter()
+ {
+ public boolean accept( File pathname )
+ {
+ boolean isConfig =
pathname.getName().endsWith(assemblyFileExtension);
+ if(useInternalJNDI)
+ {
+ return isConfig;
+
+ }
+ else
+ {
+ return isConfig &&
pathname.getName().indexOf("pooled-datasource-support") < 0;
+ }
+ }
+
+ };
+
+ File assemblyDirFile = new File(getRealPath(assemblyDir));
+ if(!assemblyDirFile.exists())
+ {
+ throw new FileNotFoundException("The assembly path
"+assemblyDirFile.getAbsolutePath()+" does not exist.");
+ }
+
+ File[] configFiles = assemblyDirFile.listFiles(extFilter);
+ String[] configs = new String[configFiles.length];
+ for(int i=0; i<configFiles.length; i++)
{
- configs.add("file:///"+absApplicationRoot +
configuration.getString("jetspeed.spring.datasource.xml",
- "/WEB-INF/assembly/pooled-datasource-support.xml"));
+ configs[i] =
configFiles[i].getCanonicalFile().toURL().toExternalForm();
}
- configs.add("file:///"+absApplicationRoot +
configuration.getString("jetspeed.spring.xml",
"/WEB-INF/assembly/jetspeed-spring.xml"));
- configs.add("file:///"+absApplicationRoot +
configuration.getString("pluto-factories.xml",
"/WEB-INF/assembly/pluto-factories.xml"));
- configs.add("file:///"+absApplicationRoot +
configuration.getString("pipelines.xml", "/WEB-INF/assembly/pipelines.xml"));
- ComponentManager cm = new
SpringComponentManager((String[])configs.toArray(new String[configs.size()]), null);
+ ComponentManager cm = new SpringComponentManager(configs, null);
return cm;
- }
+ }
+
}
1.59 +3 -2
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties
Index: jetspeed.properties
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- jetspeed.properties 2 Aug 2004 19:01:31 -0000 1.58
+++ jetspeed.properties 2 Aug 2004 19:41:34 -0000 1.59
@@ -113,4 +113,5 @@
#-------------------------------------------------------------------------
# A S S E M B L Y (note may move this to class path)
#-------------------------------------------------------------------------
-jetspeed.root.assembly = /WEB-INF/assembly/jetspeed.groovy
+assembly.dir=/WEB-INF/assembly
+assembly.extension=.xml
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]