dims        01/04/02 09:35:51

  Modified:    .        Tag: xml-cocoon2 build.xml
               src/org/apache/cocoon Tag: xml-cocoon2 Main.java
  Log:
  Support for Pre-Compiled XSP's is complete. The steps are as follows:
  
  1.  Set the "work-directory" parameter in web.xml as follows:
     <init-param>
      <param-name>work-directory</param-name>
      <param-value>WEB-INF/classes</param-value>
     </init-param>
  2. Set the auto-reload to false in your cocoon.xconf as follows:
     <parameter name="auto-reload" value="false"/>
  3. Use "-Dcompile.xsp=yes" in your build command line when you are
      building your WAR file.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.65  +17 -1     xml-cocoon/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/build.xml,v
  retrieving revision 1.6.2.64
  retrieving revision 1.6.2.65
  diff -u -r1.6.2.64 -r1.6.2.65
  --- build.xml 2001/03/16 15:14:55     1.6.2.64
  +++ build.xml 2001/04/02 16:35:49     1.6.2.65
  @@ -322,6 +322,22 @@
     <!-- =================================================================== 
-->
     <!-- Prepares the libraries for the war package                          
-->
     <!-- =================================================================== 
-->
  +  <target name="prepare-xsp" depends="package" if="compile.xsp">
  +    <java classname="org.apache.cocoon.Main" fork="yes">
  +      <arg line="-x -w ${build.war}/WEB-INF/classes -c webapp" />
  +      <classpath>
  +        <fileset dir="lib">
  +          <include name="**/*.jar"/>
  +        </fileset>
  +        <pathelement location="${build.dir}/${name}.jar"/>
  +        <pathelement location="${java.home}/../lib/tools.jar"/>
  +      </classpath>
  +    </java>  
  +  </target>
  +
  +  <!-- =================================================================== 
-->
  +  <!-- Prepares the libraries for the war package                          
-->
  +  <!-- =================================================================== 
-->
     <target name="prepare-webapp-libs" depends="package" 
if="include.webapp.libs">
       <copy todir="${build.war}/WEB-INF/lib">
         <fileset dir="${lib.dir}">
  @@ -340,7 +356,7 @@
     <!-- =================================================================== 
-->
     <!-- Creates the war file                                                
-->
     <!-- =================================================================== 
-->
  -  <target name="webapp" depends="prepare-webapp, prepare-webapp-libs" 
description="Generates the war package">
  +  <target name="webapp" depends="prepare-webapp, prepare-webapp-libs, 
prepare-xsp" description="Generates the war package">
       <jar jarfile="${build.dir}/${name}.war" basedir="${build.war}" 
includes="**"/>
     </target>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.28  +35 -8     xml-cocoon/src/org/apache/cocoon/Attic/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
  retrieving revision 1.1.4.27
  retrieving revision 1.1.4.28
  diff -u -r1.1.4.27 -r1.1.4.28
  --- Main.java 2001/03/19 17:08:32     1.1.4.27
  +++ Main.java 2001/04/02 16:35:50     1.1.4.28
  @@ -44,13 +44,14 @@
   import org.apache.log.Priority;
   import org.apache.log.Category;
   import org.apache.log.output.FileOutputLogTarget;
  +import org.apache.log.output.DefaultOutputLogTarget;
   import org.apache.log.LogTarget;
   
   /**
    * Command line entry point.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.27 $ $Date: 2001/03/19 17:08:32 $
  + * @version CVS $Revision: 1.1.4.28 $ $Date: 2001/04/02 16:35:50 $
    */
   
   public class Main {
  @@ -109,7 +110,7 @@
           String workDir = Constants.DEFAULT_WORK_DIR;
           List targets = new ArrayList();
           CLArgsParser parser = new CLArgsParser(args, options);
  -        String logUrl = "logs/cocoon.log";
  +        String logUrl = null;
           String logLevel = "DEBUG";
           boolean xspOnly = false;
   
  @@ -161,8 +162,10 @@
           try {
               LogKit.setGlobalPriority(LogKit.getPriorityForName(logLevel));
               Category cocoonCategory = LogKit.createCategory("cocoon", 
LogKit.getPriorityForName(logLevel));
  -
  -            log = LogKit.createLogger(cocoonCategory,new LogTarget[] {new 
FileOutputLogTarget(logUrl)});
  +            if(logUrl == null)
  +                log = LogKit.createLogger(cocoonCategory,new LogTarget[] 
{new DefaultOutputLogTarget(System.out)});
  +            else
  +                log = LogKit.createLogger(cocoonCategory,new LogTarget[] 
{new FileOutputLogTarget(logUrl)});
           } catch (MalformedURLException mue) {
               String error = "Cannot write on the specified log file.  Please, 
make sure the path exists and you have write permissions.";
               LogKit.log(error, mue);
  @@ -191,7 +194,7 @@
               System.exit(1);
           }
   
  -        if (targets.size() == 0) {
  +        if (targets.size() == 0 && xspOnly == false) {
               String error = "Please, specify at least one starting URI.";
               log.error(error);
               System.out.println(error);
  @@ -199,7 +202,9 @@
           }
   
           try {
  -            File dest = getDir(destDir, "destination");
  +            File dest = null;
  +            if(!xspOnly)
  +                dest = getDir(destDir, "destination");
               File work = getDir(workDir, "working");
               File context = getDir(contextDir, "context");
               File conf = getConfigurationFile(context);
  @@ -215,7 +220,8 @@
               c.init();
               Main main = new Main(c, context, dest);
               main.warmup();
  -            main.process(targets, xspOnly);
  +            if(main.process(targets, xspOnly)==0)
  +                main.recursivelyProcessXSP(context, context);
               c.dispose();
               log.info("Done");
           } catch (Exception e) {
  @@ -317,7 +323,8 @@
       /**
        * Process the URI list and process them all independently.
        */
  -    public void process(Collection uris, boolean xspOnly) throws Exception {
  +    public int process(Collection uris, boolean xspOnly) throws Exception {
  +        int nCount = 0;
           log.info("...ready, let's go:");
           Iterator i = uris.iterator();
           while (i.hasNext()) {
  @@ -325,6 +332,26 @@
                   this.processXSP(NetUtils.normalize((String) i.next()));
               else 
                   this.processURI(NetUtils.normalize((String) i.next()), 0);
  +            nCount++;
  +        }
  +        return nCount;
  +    }
  +
  +    /**
  +     * Recurse the directory hierarchy and process the XSP's.
  +     */
  +    public void recursivelyProcessXSP(File contextDir, File file) {
  +        if (file.isDirectory()) {
  +            String entries[] = file.list();
  +            for (int i = 0; i < entries.length; i++) {
  +                recursivelyProcessXSP(contextDir, new File(file, 
entries[i]));
  +            }
  +        } else if(file.getName().toLowerCase().endsWith(".xsp")) {
  +            try {
  +                
this.processXSP(IOUtils.getContextFilePath(contextDir.getCanonicalPath(),file.getCanonicalPath()));
  +            } catch (Exception e){
  +                //Ignore for now.
  +            }
           }
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to