cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/webapp cocoon.xconf
Date Wed, 21 Feb 2001 17:22:34 GMT
bloritsch    01/02/21 09:22:34

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2
                        CocoonComponentSelector.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/store Tag: xml-cocoon2
                        FilesystemStore.java
               src/org/apache/cocoon/util Tag: xml-cocoon2 IOUtils.java
               webapp   Tag: xml-cocoon2 cocoon.xconf
  Log:
  Cocoon can now create classes that can be precompiled!!!
  Question is how to use them....
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.21  +2 -2      xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
  
  Index: CocoonComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- CocoonComponentSelector.java	2001/02/19 19:43:48	1.1.2.20
  +++ CocoonComponentSelector.java	2001/02/21 17:22:26	1.1.2.21
  @@ -42,7 +42,7 @@
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/19 19:43:48 $
  + * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/21 17:22:26 $
    */
   public class CocoonComponentSelector implements Contextualizable, ComponentSelector, Composer,
Configurable, ThreadSafe, Loggable {
       protected Logger log;
  @@ -51,7 +51,7 @@
       protected Map components;
   
       /** The app Context */
  -    private Context context;
  +    protected Context context;
   
       /** Static component instances.
        */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.34  +16 -6     xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.33
  retrieving revision 1.1.2.34
  diff -u -r1.1.2.33 -r1.1.2.34
  --- ProgramGeneratorImpl.java	2001/02/20 20:46:34	1.1.2.33
  +++ ProgramGeneratorImpl.java	2001/02/21 17:22:28	1.1.2.34
  @@ -46,7 +46,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.33 $ $Date: 2001/02/20 20:46:34 $
  + * @version CVS $Revision: 1.1.2.34 $ $Date: 2001/02/21 17:22:28 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable implements ProgramGenerator,
Contextualizable, Composer, Configurable, ThreadSafe {
   
  @@ -71,6 +71,12 @@
       /** The working directory */
       protected File workDir;
   
  +    /** The context root */
  +    protected String rootPath;
  +
  +    /** The root package */
  +    protected String rootPackage;
  +
       /** Set the Cache's logger */
       public void setLogger(Logger log) {
           super.setLogger(log);
  @@ -80,6 +86,7 @@
       public void contextualize(Context context) {
          if (this.workDir == null) {
              this.workDir = (File) context.get(Constants.CONTEXT_WORK_DIR);
  +           this.rootPath = (String) context.get(Constants.CONTEXT_ROOT_PATH);
          }
       }
   
  @@ -110,6 +117,7 @@
       public void configure(Configuration conf) throws ConfigurationException {
           Parameters params = Parameters.fromConfiguration(conf);
           this.autoReload = params.getParameterAsBoolean("auto-reload", autoReload);
  +        this.rootPackage = params.getParameter("root-package", "org.apache.cocoon");
       }
   
       /**
  @@ -134,7 +142,10 @@
           // Create filesystem store
           // Set filenames
           String filename = IOUtils.getFullFilename(file);
  -        String normalizedName = IOUtils.normalizedFilename(filename);
  +        StringBuffer contextFilename = new StringBuffer(this.rootPackage.replace('.', File.separatorChar));
  +        contextFilename.append(File.separator);
  +        contextFilename.append(IOUtils.getContextFilePath(this.rootPath, filename));
  +        String normalizedName = IOUtils.normalizedFilename(contextFilename.toString());
           // Ensure no 2 requests for the same file overlap
           Class program = null;
           CompiledComponent programInstance = null;
  @@ -148,7 +159,7 @@
   
           if (programInstance == null) {
               try {
  -                program = generateResource(file, filename, normalizedName, markupLanguage,
programmingLanguage, resolver);
  +                program = generateResource(file, normalizedName, markupLanguage, programmingLanguage,
resolver);
               } catch (LanguageException le) {
                   getLogger().debug("Language Exception", le);
               }
  @@ -176,14 +187,13 @@
           }
   
           if (program == null) {
  -            program = generateResource(file, filename, normalizedName, markupLanguage,
programmingLanguage, resolver);
  +            program = generateResource(file, normalizedName, markupLanguage, programmingLanguage,
resolver);
           }
           // Instantiate
           return (CompiledComponent) this.cache.select(normalizedName);
       }
   
       private Class generateResource(File file,
  -                                  String filename,
                                     String normalizedName,
                                     MarkupLanguage markupLanguage,
                                     ProgrammingLanguage programmingLanguage,
  @@ -200,7 +210,7 @@
               code = codeFormatter.format(code, encoding);
           }
           // Store generated code
  -        String sourceFilename = filename + "." + programmingLanguage.getSourceExtension();
  +        String sourceFilename = normalizedName + "." + programmingLanguage.getSourceExtension();
           repository.store(sourceFilename, code);
           // [Compile]/Load generated program
           Class program = programmingLanguage.load(normalizedName, this.workDir, markupLanguage.getEncoding());
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +3 -2      xml-cocoon/src/org/apache/cocoon/components/store/Attic/FilesystemStore.java
  
  Index: FilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/store/Attic/FilesystemStore.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- FilesystemStore.java	2001/02/17 19:09:12	1.1.2.10
  +++ FilesystemStore.java	2001/02/21 17:22:29	1.1.2.11
  @@ -151,7 +151,8 @@
     /* Utility Methods*/
     protected File fileFromKey(Object key) {
       String name = key.toString();
  -
  +    return IOUtils.createFile(this.directoryFile, name);
  +/*
       name = IOUtils.getFullFilename(new File(name));
   
       String path = IOUtils.normalizedFilename(IOUtils.pathComponent(name));
  @@ -170,7 +171,7 @@
         filename += "." + extension;
       }
   
  -    return new File(this.directoryPath + path + File.separator + filename);
  +    return new File(this.directoryPath + path + File.separator + filename);*/
     }
   
     public String getString(Object key) throws IOException {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +2 -2      xml-cocoon/src/org/apache/cocoon/util/Attic/IOUtils.java
  
  Index: IOUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/IOUtils.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- IOUtils.java	2001/02/21 14:54:35	1.1.2.10
  +++ IOUtils.java	2001/02/21 17:22:31	1.1.2.11
  @@ -24,7 +24,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/21 14:54:35 $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/02/21 17:22:31 $
    */
   public class IOUtils {
   
  @@ -131,8 +131,8 @@
           buffer.append(File.separator);
         }
   
  -      buffer.append('_');
         char[] chars = path[i].toCharArray();
  +      if (chars.length < 1) buffer.append('_');
   
         for (int j = 0; j < chars.length; j++) {
           if (StringUtils.isAlphaNumeric(chars[j])) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.23  +5 -4      xml-cocoon/webapp/Attic/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/Attic/cocoon.xconf,v
  retrieving revision 1.1.2.22
  retrieving revision 1.1.2.23
  diff -u -r1.1.2.22 -r1.1.2.23
  --- cocoon.xconf	2001/02/12 13:30:48	1.1.2.22
  +++ cocoon.xconf	2001/02/21 17:22:32	1.1.2.23
  @@ -11,6 +11,11 @@
       <protocol name="context"  class="org.apache.cocoon.components.url.ContextURLFactory"/>
     </url-factory>
   
  +  <program-generator>
  +    <parameter name="auto-reload" value="true"/>
  +    <parameter name="root-package" value="org.apache.cocoon"/>
  +  </program-generator>
  +
     <programming-languages>
       <component-instance name="java" class="org.apache.cocoon.components.language.programming.java.JavaLanguage">
         <parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.Javac"/>
  @@ -70,10 +75,6 @@
         </target-language>
       </component-instance>
     </markup-languages>
  -
  -  <program-generator>
  -    <parameter name="auto-reload" value="true"/>
  -  </program-generator>
   
     <datasources>
       <component-instance name="personnel" class="org.apache.avalon.util.datasource.JdbcDataSource">
  
  
  

Mime
View raw message