cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap ActNodeBuilder.java ComponentsSelector.java GenerateNode.java PreparableMatchNode.java SelectNode.java SerializeNode.java SitemapLanguage.java SwitchSelectNode.java
Date Sat, 03 Jan 2004 12:42:39 GMT
vgritsenko    2004/01/03 04:42:39

  Modified:    src/java/org/apache/cocoon/components/treeprocessor
                        PipelineEventComponentProcessingNode.java
               src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        ActNodeBuilder.java ComponentsSelector.java
                        GenerateNode.java PreparableMatchNode.java
                        SelectNode.java SerializeNode.java
                        SitemapLanguage.java SwitchSelectNode.java
  Log:
  Disposables should implement Disposable (see PreparableMatchNode).
  Releasables should be properly released.
  There is still one unreleased component and/or selector left...
  
  Revision  Changes    Path
  1.2       +2 -7      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/PipelineEventComponentProcessingNode.java
  
  Index: PipelineEventComponentProcessingNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/PipelineEventComponentProcessingNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PipelineEventComponentProcessingNode.java	9 Mar 2003 00:09:16 -0000	1.1
  +++ PipelineEventComponentProcessingNode.java	3 Jan 2004 12:42:39 -0000	1.2
  @@ -57,7 +57,6 @@
    * @author <a href="mailto:Michael.Melhem@dresdner-bank.com">Michael Melhem</a>
    * @version CVS $Id$
    */
  -
   public abstract class PipelineEventComponentProcessingNode extends AbstractProcessingNode
{
   
       protected Map views;
  @@ -73,10 +72,6 @@
       }
   
       public boolean hasViews() {
  -        if (this.views != null)
  -            return true;
  -
  -        return false;
  +        return this.views != null;
       }
  -
   }
  
  
  
  1.4       +2 -3      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActNodeBuilder.java
  
  Index: ActNodeBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActNodeBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActNodeBuilder.java	7 Aug 2003 08:42:20 -0000	1.3
  +++ ActNodeBuilder.java	3 Jan 2004 12:42:39 -0000	1.4
  @@ -65,9 +65,8 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
  -
   public class ActNodeBuilder extends AbstractParentProcessingNodeBuilder
  -  implements LinkedProcessingNodeBuilder {
  +                            implements LinkedProcessingNodeBuilder {
   
       private ActSetNode  actSetNode;
       private String      actSetName;
  
  
  
  1.8       +2 -2      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java
  
  Index: ComponentsSelector.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ComponentsSelector.java	6 Nov 2003 21:31:05 -0000	1.7
  +++ ComponentsSelector.java	3 Jan 2004 12:42:39 -0000	1.8
  @@ -83,7 +83,7 @@
    */
   
   public class ComponentsSelector extends ExtendedComponentSelector
  -implements OutputComponentSelector, SitemapComponentSelector {
  +                                implements OutputComponentSelector, SitemapComponentSelector
{
   
       public static final int UNKNOWN     = -1;
       public static final int GENERATOR   = 0;
  
  
  
  1.3       +3 -3      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/GenerateNode.java
  
  Index: GenerateNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/GenerateNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GenerateNode.java	24 Mar 2003 14:33:55 -0000	1.2
  +++ GenerateNode.java	3 Jan 2004 12:42:39 -0000	1.3
  @@ -66,7 +66,6 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
  -
   public class GenerateNode extends PipelineEventComponentProcessingNode implements ParameterizableProcessingNode
{
   
       private String generatorName;
  @@ -75,6 +74,7 @@
   
       private Map parameters;
   
  +
       public GenerateNode(String name, VariableResolver source) throws PatternException {
           this.generatorName = name;
           this.source = source;
  @@ -85,7 +85,7 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  +    throws Exception {
   
           Map objectModel = env.getObjectModel();
   
  
  
  
  1.4       +14 -5     cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PreparableMatchNode.java
  
  Index: PreparableMatchNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PreparableMatchNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PreparableMatchNode.java	4 Aug 2003 03:19:22 -0000	1.3
  +++ PreparableMatchNode.java	3 Jan 2004 12:42:39 -0000	1.4
  @@ -50,6 +50,7 @@
   */
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
  +import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentSelector;
  @@ -72,8 +73,8 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
  -
  -public class PreparableMatchNode extends SimpleSelectorProcessingNode implements ParameterizableProcessingNode,
Composable {
  +public class PreparableMatchNode extends SimpleSelectorProcessingNode
  +                                 implements ParameterizableProcessingNode, Composable,
Disposable {
   
       /** The 'pattern' attribute */
       private String pattern;
  @@ -127,7 +128,7 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  +    throws Exception {
         
         	// Perform any common invoke functionality 
         	super.invoke(env, context);
  @@ -173,6 +174,14 @@
        * Disposable Interface
        */
       public void dispose() {
  -        this.manager.release(this.selector);
  +        if (this.threadSafeMatcher != null) {
  +            selector.release(this.threadSafeMatcher);
  +            this.threadSafeMatcher = null;
  +        }
  +        if (this.selector != null) {
  +            this.manager.release(this.selector);
  +            this.selector = null;
  +        }
  +        this.manager = null;
       }
   }
  
  
  
  1.2       +9 -5      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SelectNode.java
  
  Index: SelectNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SelectNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SelectNode.java	9 Mar 2003 00:09:22 -0000	1.1
  +++ SelectNode.java	3 Jan 2004 12:42:39 -0000	1.2
  @@ -72,9 +72,8 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
  -
   public class SelectNode extends SimpleSelectorProcessingNode
  -  implements ParameterizableProcessingNode, Composable, Disposable {
  +                        implements ParameterizableProcessingNode, Composable, Disposable
{
   
       /** The parameters of this node */
       private Map parameters;
  @@ -113,7 +112,7 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  +    throws Exception {
   
         	// Perform any common invoke functionality 
           super.invoke(env, context);
  @@ -167,7 +166,12 @@
       public void dispose() {
           if (this.threadSafeSelector != null) {
               this.selector.release(this.threadSafeSelector);
  +            this.threadSafeSelector = null;
  +        }
  +        if (this.selector != null) {
  +            this.manager.release(this.selector);
  +            this.selector = null;
           }
  -        this.manager.release(this.selector);
  +        this.manager = null;
       }
   }
  
  
  
  1.7       +4 -6      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
  
  Index: SerializeNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SerializeNode.java	21 Nov 2003 18:15:44 -0000	1.6
  +++ SerializeNode.java	3 Jan 2004 12:42:39 -0000	1.7
  @@ -68,8 +68,7 @@
    * @author <a href="mailto:uv@upaya.co.uk">Upayavira</a>
    * @version CVS $Id$
    */
  -
  -public class SerializeNode extends PipelineEventComponentProcessingNode implements ParameterizableProcessingNode{
  +public class SerializeNode extends PipelineEventComponentProcessingNode implements ParameterizableProcessingNode
{
   
       private String serializerName;
   
  @@ -81,6 +80,7 @@
   
       private Map parameters;
   
  +
       /**
        * Build a <code>SerializerNode</code> having a name, a mime-type and a
status code (HTTP codes).
        *
  @@ -100,7 +100,7 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  +    throws Exception {
   
           // Check view
           if (this.views != null) {
  @@ -160,5 +160,3 @@
           }
       }
   }
  -
  -
  
  
  
  1.9       +16 -18    cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
  
  Index: SitemapLanguage.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SitemapLanguage.java	6 Nov 2003 15:44:26 -0000	1.8
  +++ SitemapLanguage.java	3 Jan 2004 12:42:39 -0000	1.9
  @@ -100,7 +100,7 @@
           Configuration config = tree.getChild("components", false);
   
           if (config == null) {
  -            if (this.getLogger().isDebugEnabled()) {
  +            if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Sitemap has no components definition at " + tree.getLocation());
               }
               config = new DefaultConfiguration("", "");
  @@ -197,7 +197,7 @@
        * @param view the view name
        */
       public void addViewForLabel(String label, String view) {
  -        if (this.getLogger().isDebugEnabled()) {
  +        if (getLogger().isDebugEnabled()) {
               getLogger().debug("views:addViewForLabel(" + label + ", " + view + ")");
           }
           Set views = (Set)this.labelViews.get(label);
  @@ -377,15 +377,17 @@
   
           // firstly, determine if any pipeline-hints are defined at the component level
           // if so, inherit these pipeline-hints (these hints can be overriden by local pipeline-hints)
  +        SitemapComponentSelector selector = null;
           try {
  -            SitemapComponentSelector  selector = (SitemapComponentSelector)this.manager.lookup(role
+ "Selector");
  +            selector = (SitemapComponentSelector)this.manager.lookup(role + "Selector");
               componentHintParams = selector.getPipelineHint(hint);
  -        }
  -        catch (Exception ex) {
  -            if (this.getLogger().isWarnEnabled()) {
  +        } catch (Exception ex) {
  +            if (getLogger().isWarnEnabled()) {
                   getLogger().warn("pipeline-hints: Component Exception: could not " + 
                                "check for component level hints " + ex);
               }
  +        } finally {
  +            this.manager.release(selector);
           }
   
           if (componentHintParams != null) {
  @@ -394,8 +396,7 @@
               if (statementHintParams != null) {
                   hintParams = hintParams + "," + statementHintParams; 
               }
  -        }
  -        else {
  +        } else {
               hintParams = statementHintParams;
           }
   
  @@ -412,7 +413,7 @@
   
           String[]  expressions = commaSplit.split(hintParams.trim());
   
  -        if (this.getLogger().isDebugEnabled()) {
  +        if (getLogger().isDebugEnabled()) {
               getLogger().debug("pipeline-hints: (aggregate-hint) " + hintParams); 
           }
   
  @@ -421,17 +422,15 @@
   
               try {
                   if (nameValuePair.length < 2) {
  -                    if (this.getLogger().isDebugEnabled()) {
  +                    if (getLogger().isDebugEnabled()) {
                           getLogger().debug("pipeline-hints: (name) " + nameValuePair[0]

                                          + "\npipeline-hints: (value) [implicit] true");
                       }
     
                       params.put( VariableResolverFactory.getResolver(nameValuePair[0], this.manager),
                                   VariableResolverFactory.getResolver("true", this.manager));
  -                }
  -                else
  -                {
  -                    if (this.getLogger().isDebugEnabled()) {
  +                } else {
  +                    if (getLogger().isDebugEnabled()) {
                           getLogger().debug("pipeline-hints: (name) " + nameValuePair[0]
                                             + "\npipeline-hints: (value) " + nameValuePair[1]);
                       }
  @@ -439,12 +438,11 @@
                       params.put( VariableResolverFactory.getResolver(nameValuePair[0], this.manager),
                                   VariableResolverFactory.getResolver(nameValuePair[1], this.manager));
                   }
  -            }
  -            catch(PatternException pe) {
  +            } catch(PatternException pe) {
                   String msg = "Invalid pattern '" + hintParams + "' at " + statement.getLocation();
                   getLogger().error(msg, pe);
                   throw new ConfigurationException(msg, pe);
  -             }
  +            }
           }
   
           return params;
  
  
  
  1.4       +9 -6      cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SwitchSelectNode.java
  
  Index: SwitchSelectNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SwitchSelectNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SwitchSelectNode.java	29 Jul 2003 08:46:00 -0000	1.3
  +++ SwitchSelectNode.java	3 Jan 2004 12:42:39 -0000	1.4
  @@ -73,9 +73,8 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
  -
   public class SwitchSelectNode extends SimpleSelectorProcessingNode
  -  implements ParameterizableProcessingNode, Composable, Disposable {
  +                              implements ParameterizableProcessingNode, Composable, Disposable
{
   
       /** The parameters of this node */
       private Map parameters;
  @@ -115,7 +114,7 @@
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  -      throws Exception {
  +    throws Exception {
   	
         	// Perform any common invoke functionality 
           super.invoke(env, context);
  @@ -167,8 +166,12 @@
       public void dispose() {
           if (this.threadSafeSelector != null) {
               this.selector.release(this.threadSafeSelector);
  +            this.threadSafeSelector = null;
  +        }
  +        if (this.selector == null) {
  +            this.manager.release(this.selector);
  +            this.selector = null;
           }
  -        this.manager.release(this.selector);
  -        this.selector = null;
  +        this.manager = null;
       }
   }
  
  
  

Mime
View raw message