You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by je...@apache.org on 2003/05/03 12:24:56 UTC

cvs commit: cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers InterpolatingConfigurationHandler.java VariableConfiguration.java

jefft       2003/05/03 03:24:55

  Modified:    src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers
                        InterpolatingConfigurationHandler.java
                        VariableConfiguration.java
  Log:
  Allow the caller to set a 'location' string, so conf.getLocation() returns
  something more informative than "Unknown".
  
  Revision  Changes    Path
  1.3       +17 -2     cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers/InterpolatingConfigurationHandler.java
  
  Index: InterpolatingConfigurationHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers/InterpolatingConfigurationHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InterpolatingConfigurationHandler.java	11 Mar 2003 17:44:21 -0000	1.2
  +++ InterpolatingConfigurationHandler.java	3 May 2003 10:24:55 -0000	1.3
  @@ -65,13 +65,24 @@
    * @version CVS $Id$
    */
   public class InterpolatingConfigurationHandler extends SAXConfigurationHandler {
  -    private Map vars;
  +    final private Map vars;
  +    final private String location;
   
       /** Constructor.
        * @param vars The mappings from variable name to value.
        */
       public InterpolatingConfigurationHandler(Map vars) {
           this.vars = vars;
  +        this.location = "Unknown";
  +    }
  +
  +    /** Constructor.
  +     * @param vars The mappings from variable name to value.
  +     * @param location The origin of this configuration info.
  +     */
  +    public InterpolatingConfigurationHandler(Map vars, String location) {
  +        this.vars = vars;
  +        this.location = location;
       }
   
       /** Replace {vars} in attributes.  */
  @@ -93,6 +104,10 @@
           buf.append(newVal);
           buf.append(ch, start+len, ch.length-(start+len));
           super.characters(buf.toString().toCharArray(), start, newVal.length());
  +    }
  +
  +    protected String getLocationString() {
  +        return this.location;
       }
   
   
  
  
  
  1.3       +2 -2      cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers/VariableConfiguration.java
  
  Index: VariableConfiguration.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/helpers/VariableConfiguration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VariableConfiguration.java	11 Mar 2003 17:44:21 -0000	1.2
  +++ VariableConfiguration.java	3 May 2003 10:24:55 -0000	1.3
  @@ -106,7 +106,7 @@
       public Configuration getConfiguration() throws SAXException, ConfigurationException {
   
           if (this.conf == null) return null;
  -        InterpolatingConfigurationHandler handler = new InterpolatingConfigurationHandler(this.vars);
  +        InterpolatingConfigurationHandler handler = new InterpolatingConfigurationHandler(this.vars, this.conf.getLocation());
           DefaultConfigurationSerializer ser = new DefaultConfigurationSerializer();
           ser.serialize(handler, this.conf);
           return handler.getConfiguration();