portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf jetspeed.properties
Date Mon, 02 Aug 2004 19:41:34 GMT
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: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message