cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ovi...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper EnvironmentWrapper.java
Date Sat, 30 Mar 2002 05:27:14 GMT
ovidiu      02/03/29 21:27:14

  Modified:    src/java/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
  Log:
  Implement getAttribute and removeAttribute to find or remove attribute
  from the receiver instance, as well as from the wrapped
  environment. Still need to implement getAttributeNames() for
  completion.
  
  Revision  Changes    Path
  1.11      +31 -1     xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EnvironmentWrapper.java	27 Mar 2002 15:13:40 -0000	1.10
  +++ EnvironmentWrapper.java	30 Mar 2002 05:27:14 -0000	1.11
  @@ -72,7 +72,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.10 2002/03/27 15:13:40 sylvain Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.11 2002/03/30 05:27:14 ovidiu Exp $
    */
   public class EnvironmentWrapper extends AbstractEnvironment implements Environment {
   
  @@ -273,6 +273,36 @@
           this.setURIPrefix(this.lastPrefix);
           this.uris = this.lastURI;
       }
  +
  +  /**
  +   * Lookup an attribute in this instance, and if not found search it
  +   * in the wrapped environment.
  +   *
  +   * @param name a <code>String</code>, the name of the attribute to
  +   * look for
  +   * @return an <code>Object</code>, the value of the attribute or
  +   * null if no such attribute was found.
  +   */
  +  public Object getAttribute(String name)
  +  {
  +    Object value = super.getAttribute(name);
  +    if (value == null)
  +      value = environment.getAttribute(name);
  +
  +    return value;
  +  }
  +
  +  /**
  +   * Remove attribute from the current instance, as well as from the
  +   * wrapped environment.
  +   *
  +   * @param name a <code>String</code> value
  +   */
  +  public void removeAttribute(String name)
  +  {
  +    super.removeAttribute(name);
  +    environment.removeAttribute(name);
  +  }
   }
   
   
  
  
  

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


Mime
View raw message