You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2002/11/25 23:13:10 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables NOPVariableResolver.java PreparedVariableResolver.java VariableResolver.java

sylvain     2002/11/25 14:13:10

  Modified:    src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        RedirectToNodeBuilder.java
               src/java/org/apache/cocoon/components/treeprocessor/variables
                        NOPVariableResolver.java
                        PreparedVariableResolver.java VariableResolver.java
  Log:
  Minor fixes
  
  Revision  Changes    Path
  1.4       +2 -7      xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToNodeBuilder.java
  
  Index: RedirectToNodeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToNodeBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RedirectToNodeBuilder.java	11 Sep 2002 10:08:35 -0000	1.3
  +++ RedirectToNodeBuilder.java	25 Nov 2002 22:13:10 -0000	1.4
  @@ -73,15 +73,10 @@
    */
   
   public class RedirectToNodeBuilder extends AbstractProcessingNodeBuilder
  -  implements LinkedProcessingNodeBuilder, Composable {
  +  implements LinkedProcessingNodeBuilder {
   
  -    private ComponentManager manager;
       private CallNode callNode;
       private String resourceName;
  -
  -    public void compose(ComponentManager manager) throws ComponentException {
  -        this.manager = manager;
  -    }
   
       /** This builder has no parameters -- return <code>false</code> */
       protected boolean hasParameters() {
  
  
  
  1.4       +1 -6      xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/NOPVariableResolver.java
  
  Index: NOPVariableResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/NOPVariableResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NOPVariableResolver.java	12 Oct 2002 05:11:40 -0000	1.3
  +++ NOPVariableResolver.java	25 Nov 2002 22:13:10 -0000	1.4
  @@ -64,15 +64,10 @@
       private String expression = null;
   
       public NOPVariableResolver(String expression) {
  +        super(expression);
           if (expression != null) {
  -            // Keep the original unescaped expression
  -            this.originalExpr = expression;
               this.expression = VariableResolverFactory.unescape(expression);
           }
  -    }
  -
  -    public String toString() {
  -        return this.originalExpr;
       }
   
       public final String resolve(InvokeContext context, Map objectModel) {
  
  
  
  1.7       +2 -3      xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java
  
  Index: PreparedVariableResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolver.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PreparedVariableResolver.java	29 Oct 2002 13:16:12 -0000	1.6
  +++ PreparedVariableResolver.java	25 Nov 2002 22:13:10 -0000	1.7
  @@ -78,7 +78,6 @@
       private ComponentSelector selector;
       
       final private List items = new ArrayList();
  -    final private String originalExpr;
   
       // Special constants used for levels
       static final int ROOT = 0;
  @@ -95,7 +94,7 @@
       
       public PreparedVariableResolver(String expr, ComponentManager manager) throws PatternException {
           
  -        this.originalExpr = expr;
  +        super(expr);
           this.manager = manager;
           
   
  @@ -267,7 +266,7 @@
                       {
                           String name = (String) this.items.get(++i);
                           Object variable = this.items.get(++i);
  -                        Map levelResult = context.getMapByAnchor(name);
  +                        Map levelResult = null; //context.getMapByAnchor(name);
   
                           if (levelResult == null) {
                             throw new PatternException("Error while evaluating '" + this.originalExpr +
  
  
  
  1.4       +13 -8     xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolver.java
  
  Index: VariableResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/variables/VariableResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VariableResolver.java	12 Oct 2002 05:11:40 -0000	1.3
  +++ VariableResolver.java	25 Nov 2002 22:13:10 -0000	1.4
  @@ -72,9 +72,13 @@
   
       public static final Map EMPTY_MAP = Collections.unmodifiableMap(new java.util.HashMap(0));
   
  -    protected String originalExpr = null;
  +    protected final String originalExpr;
  +    
  +    protected VariableResolver(String expr) {
  +        this.originalExpr = expr;
  +    }
   
  -    public String getKey() {
  +    public final String toString() {
           return this.originalExpr;
       }
   
  @@ -83,11 +87,12 @@
        */
       public boolean equals(Object object) {
           if (object instanceof VariableResolver) {
  -            if (((VariableResolver)object).getKey().equals(this.getKey())) {
  -                return true;
  -            }
  +            VariableResolver other = (VariableResolver)object;
  +            return (this.originalExpr == null && other.originalExpr == null) ||
  +                   (this.originalExpr.equals(other.originalExpr));
  +        } else {
  +            return false;
           }
  -        return false;
       }
   
       /**
  @@ -95,7 +100,7 @@
        * needed to determine uniqueness within hashtables
        */
       public int hashCode() {
  -        return  (int) HashUtil.hash(this.getKey());
  +        return this.originalExpr == null ? 0 : this.originalExpr.hashCode();
       }
   
       /**
  
  
  

----------------------------------------------------------------------
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