You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/10/30 16:38:21 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/generator ProgramGeneratorImpl.java

cziegeler    01/10/30 07:38:21

  Modified:    src/org/apache/cocoon/components/language/generator
                        ProgramGeneratorImpl.java
  Log:
  One more getRealPath() removed
  
  Revision  Changes    Path
  1.23      +19 -19    xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ProgramGeneratorImpl.java	2001/10/25 19:32:58	1.22
  +++ ProgramGeneratorImpl.java	2001/10/30 15:38:21	1.23
  @@ -39,7 +39,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.22 $ $Date: 2001/10/25 19:32:58 $
  + * @version CVS $Revision: 1.23 $ $Date: 2001/10/30 15:38:21 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable
       implements ProgramGenerator, Contextualizable, Composable, Configurable, ThreadSafe, Disposable {
  @@ -87,7 +87,7 @@
               org.apache.cocoon.environment.Context ctx =
                   (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
               try {
  -                this.contextDir = new File(ctx.getRealPath("/")).toURL().toExternalForm();
  +                this.contextDir = ctx.getResource("/").toExternalForm();
                   getLogger().debug("Context directory is " + this.contextDir);
               } catch (MalformedURLException e) {
                   getLogger().warn("Could not get context directory", e);
  @@ -159,21 +159,21 @@
                   contextFilename.append(id);
               }
               String normalizedName = IOUtils.normalizedFilename(contextFilename.toString());
  -    
  +
               // Ensure no 2 requests for the same file overlap
               Class program = null;
               CompiledComponent programInstance = null;
  -    
  +
               // Attempt to load program object from cache
               try {
                   programInstance = (CompiledComponent) select(normalizedName);
               } catch (Exception e) {
                   getLogger().debug("The instance was not accessible from the internal cache. Proceeding.");
               }
  -    
  +
               if ((programInstance == null) && this.preload) {
                   String className = normalizedName.replace(File.separatorChar, '.');
  -    
  +
                   try {
                       program = this.classManager.loadClass(className);
                       this.addCompiledComponent(newManager, normalizedName, program);
  @@ -182,44 +182,44 @@
                       getLogger().debug("The class was not preloaded");
                   }
               }
  -    
  +
               if (programInstance == null) {
  -	        programInstance =
  +            programInstance =
                       this.createResource(
                           newManager, fileName, normalizedName,
                           markupLanguageName, programmingLanguageName, resolver
                       );
               }
  -    
  +
               if (this.autoReload == false) {
                   return programInstance;
               }
  -    
  +
               /*
                * FIXME: It's the program (not the instance) that must
                * be queried for changes!!!
                */
  -    
  +
               if (programInstance != null && programInstance.modifiedSince(source.getLastModified())) {
                   // Release the component.
                   release(programInstance);
  -    
  +
                   // Unload program
                   ProgrammingLanguage programmingLanguage = (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
                   programmingLanguage.setLanguageName(programmingLanguageName);
                   programmingLanguage.unload(program, normalizedName, this.workDir);
                   this.cache.removeGenerator(normalizedName);
  -    
  +
                   // Invalidate previous program/instance pair
                   program = null;
                   programInstance = null;
               }
  -    
  +
               if (programInstance == null) {
                   if (program == null) {
                       programInstance =
                           this.createResource(
  -                            newManager, fileName, normalizedName, 
  +                            newManager, fileName, normalizedName,
                               markupLanguageName, programmingLanguageName,
                               resolver
                           );
  @@ -290,7 +290,7 @@
               }
           }
   
  -	return programInstance;
  +    return programInstance;
       }
   
       private Class generateResource(ComponentManager newManager,
  @@ -302,7 +302,7 @@
           throws Exception {
   
           Source source = resolver.resolve(fileName);
  -        try { 
  +        try {
               // Input Source
               InputSource is = source.getInputSource();
               // Generate code
  @@ -321,7 +321,7 @@
               Class program = programmingLanguage.load(normalizedName, this.workDir, markupLanguage.getEncoding());
               // Store generated program in cache
               this.addCompiledComponent(newManager, normalizedName, program);
  -    
  +
               // FIXME: Do we want this functionality?  All analysis says no.
               if (markupLanguage.getClass().equals(SitemapMarkupLanguage.class)) {
                   try {
  @@ -331,7 +331,7 @@
                       this.addCompiledComponent(newManager, "sitemap", program);
                   }
               }
  -    
  +
               return program;
           } finally {
               source.recycle();
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org