greenrd     00/10/15 15:43:15

  Modified:    src/org/apache/cocoon Engine.java
               src/org/apache/cocoon/framework Router.java
  Log:
  Trims spaces from class names obtained from cocoon.properties
  
  Revision  Changes    Path
  1.35      +10 -5     xml-cocoon/src/org/apache/cocoon/Engine.java
  
  Index: Engine.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Engine.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Engine.java       2000/09/16 16:04:30     1.34
  +++ Engine.java       2000/10/15 22:43:13     1.35
  @@ -1,4 +1,4 @@
  -/*-- $Id: Engine.java,v 1.34 2000/09/16 16:04:30 greenrd Exp $ --
  +/*-- $Id: Engine.java,v 1.35 2000/10/15 22:43:13 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -75,7 +75,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Robin Green</a>
  - * @version $Revision: 1.34 $ $Date: 2000/09/16 16:04:30 $
  + * @version $Revision: 1.35 $ $Date: 2000/10/15 22:43:13 $
    */
   
   public class Engine implements Defaults {
  @@ -136,22 +136,22 @@
           manager.setRole("logger", logger);
   
           // Create the parser and register it
  -        parser = (Parser) manager.create((String) 
configurations.get(PARSER_PROP,
  +        parser = (Parser) manager.create(getConfigTr(PARSER_PROP,
               PARSER_DEFAULT), configurations.getConfigurations(PARSER_PROP));
           manager.setRole("parser", parser);
   
           // Create the transformer and register it
  -        transformer = (Transformer) manager.create((String) 
configurations.get(TRANSFORMER_PROP,
  +        transformer = (Transformer) 
manager.create(getConfigTr(TRANSFORMER_PROP,
               TRANSFORMER_DEFAULT), 
configurations.getConfigurations(TRANSFORMER_PROP));
           manager.setRole("transformer", transformer);
   
           // Create the store and register it
  -        store = (Store) manager.create((String) 
configurations.get(STORE_PROP,
  +        store = (Store) manager.create(getConfigTr(STORE_PROP,
               STORE_DEFAULT), configurations.getConfigurations(STORE_PROP));
           manager.setRole("store", store);
   
           // Create the cache and register it
  -        cache = (Cache) manager.create((String) 
configurations.get(CACHE_PROP,
  +        cache = (Cache) manager.create(getConfigTr(CACHE_PROP,
               CACHE_DEFAULT), configurations.getConfigurations(CACHE_PROP));
           manager.setRole("cache", cache);
   
  @@ -190,10 +190,15 @@
           // If enabled, create the profiler and register it
           PROFILE = configurations.get ("profiler.enabled", "false").equals 
("true");
           if (PROFILE) {
  -          profiler = (Profiler) manager.create((String) 
configurations.get(PROFILER_PROP,
  +          profiler = (Profiler) manager.create(getConfigTr(PROFILER_PROP,
                 PROFILER_DEFAULT), 
configurations.getConfigurations(PROFILER_PROP));
             manager.setRole("profiler", profiler);
           }
  +    }
  +
  +    /** Gets a configuration string with spaces trimmed from each end. */
  +    private String getConfigTr (String name, String defaultStr) {
  +      return ((String) configurations.get (name, defaultStr)).trim ();
       }
   
       /**
  
  
  
  1.6       +4 -4      xml-cocoon/src/org/apache/cocoon/framework/Router.java
  
  Index: Router.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/framework/Router.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Router.java       2000/04/04 11:12:02     1.5
  +++ Router.java       2000/10/15 22:43:14     1.6
  @@ -1,4 +1,4 @@
  -/*-- $Id: Router.java,v 1.5 2000/04/04 11:12:02 stefano Exp $ -- 
  +/*-- $Id: Router.java,v 1.6 2000/10/15 22:43:14 greenrd Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -59,7 +59,7 @@
    * pluggable instance depending on some "type reaction".
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
  - * @version $Revision: 1.5 $ $Date: 2000/04/04 11:12:02 $
  + * @version $Revision: 1.6 $ $Date: 2000/10/15 22:43:14 $
    */
   
   public abstract class Router extends AbstractActor implements Configurable, 
Status {
  @@ -76,7 +76,7 @@
           Enumeration e = types.keys();
           while (e.hasMoreElements()) {
               String type = (String) e.nextElement();
  -            String name = (String) types.get(type);
  +            String name = ((String) types.get(type)).trim ();
               objects.put(type, factory.create(name, 
conf.getConfigurations(type)));
           }
        }
  @@ -96,4 +96,4 @@
           }
           return buffer.toString();
        }
  -}
  \ No newline at end of file
  +}
  
  
  

Reply via email to