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/scratchpad/schecoon/src/org/apache/cocoon/components/flow InterpreterSelector.java
Date Fri, 15 Mar 2002 23:35:47 GMT
ovidiu      02/03/15 15:35:47

  Modified:    src/scratchpad/schecoon/src/org/apache/cocoon/components/flow
                        InterpreterSelector.java
  Log:
  Remember the default language.
  
  Revision  Changes    Path
  1.3       +17 -0     xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/InterpreterSelector.java
  
  Index: InterpreterSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/InterpreterSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InterpreterSelector.java	14 Mar 2002 03:50:20 -0000	1.2
  +++ InterpreterSelector.java	15 Mar 2002 23:35:47 -0000	1.3
  @@ -15,13 +15,19 @@
     implements Configurable, ThreadSafe, Composable
   {
     ComponentManager manager;
  +  String defaultLanguage;
     
     ClassLoader loader = Thread.currentThread().getContextClassLoader();
   
     public void configure(Configuration config)
       throws ConfigurationException
     {
  +    defaultLanguage = config.getAttribute("default", null);
  +
       Configuration[] components = config.getChildren("component-instance");
  +    if (components.length == 0)
  +      throw new ConfigurationException("No languages defined!");
  +
       for (int i = 0; i < components.length; i++) {
         Configuration component = components[i];
         String name = component.getAttribute("name");
  @@ -34,11 +40,22 @@
         catch (Exception ex) {
           throw new ConfigurationException("Cannot load class " + className);
         }
  +
  +      // If there's no default language specified through the
  +      // `default' attribute, set up as default the first language in
  +      // the sequence.
  +      if (defaultLanguage == null && i == 0)
  +        defaultLanguage = name;
       }
     }
   
     public void compose(ComponentManager manager)
     {
       this.manager = manager;
  +  }
  +
  +  public String getDefaultLanguage()
  +  {
  +    return defaultLanguage;
     }
   }
  
  
  

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