cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/environment AbstractEnvironment.java Environment.java
Date Wed, 07 Nov 2001 16:45:33 GMT
sylvain     01/11/07 08:45:33

  Modified:    src/org/apache/cocoon/environment AbstractEnvironment.java
                        Environment.java
  Log:
  added get/setAttribute stuff on Environment, like other interfaces in this package. This
allows the pipeline Processor to store objects that shouldn't be exposed in the object model.
  
  Revision  Changes    Path
  1.25      +22 -1     xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AbstractEnvironment.java	2001/10/25 19:32:59	1.24
  +++ AbstractEnvironment.java	2001/11/07 16:45:33	1.25
  @@ -7,6 +7,7 @@
    *****************************************************************************/
   package org.apache.cocoon.environment;
   
  +import org.apache.avalon.excalibur.collections.IteratorEnumeration;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.source.SourceHandler;
  @@ -16,6 +17,7 @@
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.util.Enumeration;
   import java.util.HashMap;
   import java.util.Map;
   
  @@ -24,7 +26,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.24 $ $Date: 2001/10/25 19:32:59 $
  + * @version CVS $Revision: 1.25 $ $Date: 2001/11/07 16:45:33 $
    */
   public abstract class AbstractEnvironment extends AbstractLoggable implements Environment
{
   
  @@ -52,6 +54,9 @@
       /** The source handler for the current environment */
       protected SourceHandler sourceHandler;
   
  +    /** The attributes */
  +    private Map attributes = new HashMap();
  +    
       /**
        * Constructs the abstract enviornment
        */
  @@ -304,5 +309,21 @@
        */
       public void setResponseIsNotModified() {
           // does nothing
  +    }
  +
  +    public Object getAttribute(String name) {
  +        return this.attributes.get(name);
  +    }
  +
  +    public void setAttribute(String name, Object value) {
  +        this.attributes.put(name, value);
  +    }
  +    
  +    public void removeAttribute(String name) {
  +        this.attributes.remove(name);
  +    }
  +    
  +    public Enumeration getAttributeNames() {
  +        return new IteratorEnumeration(this.attributes.keySet().iterator());
       }
   }
  
  
  
  1.14      +42 -1     xml-cocoon2/src/org/apache/cocoon/environment/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Environment.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Environment.java	2001/10/11 07:28:20	1.13
  +++ Environment.java	2001/11/07 16:45:33	1.14
  @@ -13,6 +13,7 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.net.URL;
  +import java.util.Enumeration;
   import java.util.Map;
   
   /**
  @@ -20,7 +21,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/10/11 07:28:20 $
  + * @version CVS $Revision: 1.14 $ $Date: 2001/11/07 16:45:33 $
    */
   
   public interface Environment extends SourceResolver {
  @@ -125,5 +126,45 @@
        * Mark the response as not modified.
        */
       void setResponseIsNotModified();
  +    
  +    /**
  +     * Binds an object to this environment, using the name specified. This allows
  +     * the pipeline assembly engine to store for its own use objects that souldn't
  +     * be exposed to other components (generators, selectors, etc) and therefore
  +     * cannot be put in the object model.
  +     * <p>
  +     * If an object of the same name is already bound, the object is replaced.
  +     *
  +     * @param name  the name to which the object is bound
  +     * @param value the object to be bound
  +     */
  +    void setAttribute(String name, Object value);
  +    
  +    /**
  +     * Returns the object bound with the specified name, or <code>null</code>
  +     * if no object is bound under the name.
  +     *
  +     * @param name                a string specifying the name of the object
  +     * @return                        the object with the specified name
  +     */
  +    Object getAttribute(String name);
  +    
  +    /**
  +     * Removes the object bound with the specified name from
  +     * this environment. If the environment does not have an object
  +     * bound with the specified name, this method does nothing.
  +     *
  +     * @param name the name of the object to remove
  +     */
  +    void removeAttribute(String name);
  +    
  +    /**
  +     * Returns an <code>Enumeration</code> of <code>String</code>
objects
  +     * containing the names of all the objects bound to this environment.
  +     *
  +     * @return an <code>Enumeration</code> of <code>String</code>s.
  +     */
  +    Enumeration getAttributeNames();
  +
   }
   
  
  
  

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