cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor AbstractParentProcessingNode.java
Date Wed, 21 Jan 2004 10:46:43 GMT
antonio     2004/01/21 02:46:43

  Modified:    src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        ActTypeNode.java
               src/java/org/apache/cocoon/generation
                        ServerPagesGenerator.java
               src/java/org/apache/cocoon/acting ServerPagesAction.java
               src/java/org/apache/cocoon/components/treeprocessor
                        AbstractParentProcessingNode.java
  Log:
  Formating code + little some changes
  
  Revision  Changes    Path
  1.4       +40 -45    cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActTypeNode.java
  
  Index: ActTypeNode.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActTypeNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActTypeNode.java	7 Aug 2003 09:49:51 -0000	1.3
  +++ ActTypeNode.java	21 Jan 2004 10:46:43 -0000	1.4
  @@ -50,27 +50,25 @@
   */
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
  +import java.util.HashMap;
  +import java.util.Map;
  +
   import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.component.ComponentSelector;
  +import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
  -
   import org.apache.cocoon.acting.Action;
  +import org.apache.cocoon.components.treeprocessor.InvokeContext;
  +import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
  +import org.apache.cocoon.components.treeprocessor.SimpleSelectorProcessingNode;
  +import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
  -
   import org.apache.cocoon.sitemap.PatternException;
   
  -import org.apache.cocoon.components.treeprocessor.InvokeContext;
  -import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
  -import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
  -import org.apache.cocoon.components.treeprocessor.SimpleSelectorProcessingNode;
  -
  -import java.util.*;
  -import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.component.ComponentManager;
  -
   /**
    * Handles <map:act type="..."> (action-sets calls are handled by {@link
ActSetNode}).
    *
  @@ -97,7 +95,8 @@
   
       protected boolean inActionSet;
   
  -    public ActTypeNode(String type, VariableResolver source, String name, boolean inActionSet)
throws PatternException {
  +    public ActTypeNode(String type, VariableResolver source, String name,
  +            boolean inActionSet) throws PatternException {
           super(type);
           this.source = source;
           this.name = name;
  @@ -117,28 +116,31 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  -      
  -      // Perform any common invoke functionality 
  -      super.invoke(env, context);
  +          throws Exception {
  +
  +        // Perform any common invoke functionality 
  +        super.invoke(env, context);
   
           // Prepare data needed by the action
  -        Map            objectModel    = env.getObjectModel();
  -        Redirector     redirector     = PipelinesNode.getRedirector(env);
  -        SourceResolver resolver       = getSourceResolver(objectModel);
  -        String         resolvedSource = source.resolve(context, objectModel);
  -        Parameters     resolvedParams = VariableResolver.buildParameters(this.parameters,
context, objectModel);
  +        Map objectModel = env.getObjectModel();
  +        Redirector redirector = PipelinesNode.getRedirector(env);
  +        SourceResolver resolver = getSourceResolver(objectModel);
  +        String resolvedSource = source.resolve(context, objectModel);
  +        Parameters resolvedParams =
  +            VariableResolver.buildParameters(this.parameters,
  +                    context, objectModel);
   
           Map actionResult;
  -        
  +
           // If in action set, merge parameters
           if (inActionSet) {
  -            Parameters callerParams = (Parameters)env.getAttribute(ActionSetNode.CALLER_PARAMETERS);
  +            Parameters callerParams =
  +                (Parameters)env.getAttribute(ActionSetNode.CALLER_PARAMETERS);
               if (resolvedParams == Parameters.EMPTY_PARAMETERS) {
                   // Just swap
                   resolvedParams = callerParams;
               } else if (callerParams != Parameters.EMPTY_PARAMETERS) {
  -                // Build a new Parameters object since the both we hare are read-only
  +                // Build new Parameters object, the both we hare are read-only!
                   Parameters newParams = new Parameters();
                   // And merge both
                   newParams.merge(resolvedParams);
  @@ -149,14 +151,13 @@
   
           // If action is ThreadSafe, avoid select() and try/catch block (faster !)
           if (this.threadSafeAction != null) {
  -            actionResult = this.threadSafeAction.act(
  -                redirector, resolver, objectModel, resolvedSource, resolvedParams);
  +            actionResult = this.threadSafeAction.act(redirector, resolver,
  +                    objectModel, resolvedSource, resolvedParams);
           } else {
               Action action = (Action)this.selector.select(this.componentName);
               try {
  -                actionResult = action.act(
  -                redirector, resolver, objectModel, resolvedSource, resolvedParams);
  -
  +                actionResult = action.act(redirector, resolver,
  +                        objectModel, resolvedSource, resolvedParams);
               } finally {
                   this.selector.release(action);
               }
  @@ -166,15 +167,11 @@
               return true;
           }
   
  -        if (actionResult == null) {
  -            // Action failed
  -            return false;
  -
  -        } else {
  +        if (actionResult != null) {
               // Action succeeded : process children if there are some, with the action result
               if (this.children != null) {
                   boolean result = this.invokeNodes(this.children, env, context, name, actionResult);
  -                
  +
                   if (inActionSet) {
                       // Merge child action results, if any
                       Map childMap = (Map)env.getAttribute(ActionSetNode.ACTION_RESULTS);
  @@ -187,15 +184,13 @@
                           env.setAttribute(ActionSetNode.ACTION_RESULTS, actionResult);
                       }
                   }
  -                
                   return result;
  -
  -
  -            } else {
  -                // Return false to continue sitemap invocation
  -                return false;
  -            }
  -        }
  +            }// else {
  +               // return false; // Return false to continue sitemap invocation
  +            //}
  +        }// else {
  +            return false;   // Action failed
  +        //}
       }
   
       public void dispose() {
  
  
  
  1.5       +4 -3      cocoon-2.1/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServerPagesGenerator.java	7 Oct 2003 16:07:33 -0000	1.4
  +++ ServerPagesGenerator.java	21 Jan 2004 10:46:43 -0000	1.5
  @@ -195,9 +195,10 @@
                   "programming-language", this.programmingLanguage);
   
           try {
  -            this.inputSource = this.resolver.resolveURI(super.source);
  +            this.inputSource = this.resolver.resolveURI(src);
           } catch (SourceException se) {
  -            throw SourceUtil.handle(se);
  +            throw SourceUtil.handle("Error during resolving of '" + src + "'.", se);
  +            //throw SourceUtil.handle(se);
           }
   
           try {
  
  
  
  1.4       +2 -2      cocoon-2.1/src/java/org/apache/cocoon/acting/ServerPagesAction.java
  
  Index: ServerPagesAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/acting/ServerPagesAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServerPagesAction.java	31 Oct 2003 11:30:41 -0000	1.3
  +++ ServerPagesAction.java	21 Jan 2004 10:46:43 -0000	1.4
  @@ -160,7 +160,7 @@
           // Get a ServerPagesGenerator
           ServerPagesGenerator generator = (ServerPagesGenerator)this.generatorHandler.get();
   
  -        // Generator ouptut, if output-attribute was given
  +        // Generator output, if output-attribute was given
           XMLByteStreamCompiler compiler = null;
   
           try {
  
  
  
  1.2       +1 -3      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/AbstractParentProcessingNode.java
  
  Index: AbstractParentProcessingNode.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/AbstractParentProcessingNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractParentProcessingNode.java	9 Mar 2003 00:09:15 -0000	1.1
  +++ AbstractParentProcessingNode.java	21 Jan 2004 10:46:43 -0000	1.2
  @@ -91,7 +91,6 @@
               // No success
               context.popMap();
           }
  -
           return false;
       }
   
  @@ -109,7 +108,6 @@
                   return true;
               }
           }
  -
           return false;
       }
   }
  
  
  

Mime
View raw message