You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ov...@apache.org on 2002/01/19 01:50:45 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/sitemap Manager.java

ovidiu      02/01/18 16:50:45

  Modified:    src/java/org/apache/cocoon/sitemap Manager.java
  Log:
  Allow the Handler class to be customizable.
  
  Revision  Changes    Path
  1.2       +18 -2     xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Manager.java	3 Jan 2002 12:31:20 -0000	1.1
  +++ Manager.java	19 Jan 2002 00:50:44 -0000	1.2
  @@ -35,7 +35,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:20 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/01/19 00:50:44 $
    */
   public class Manager
           extends AbstractLoggable
  @@ -57,6 +57,7 @@
       /** The sitemap logkit manager */
       protected LogKitManager sitemapLogKitManager;
   
  +    protected Class handlerClass = Handler.class;
   
       /**
        * Set the role manager
  @@ -77,6 +78,17 @@
        */
       public void configure(Configuration conf) throws ConfigurationException {
           this.conf = conf;
  +
  +        String value = conf.getAttribute("handler-class", null);
  +        if (value != null) {
  +          try {
  +            handlerClass = Class.forName(value);
  +          }
  +          catch (ClassNotFoundException ex) {
  +            throw new ConfigurationException("Cannot find Handler class "
  +                                             + value);
  +          }
  +        }
       }
   
       /** get a context
  @@ -224,10 +236,14 @@
                   synchronized (this) {
                       sitemapHandler = (Handler)sitemaps.get(source);
                       if (sitemapHandler == null) {
  -                        sitemapHandler = new Handler(source, check_reload);
  +                        sitemapHandler = (Handler)handlerClass.newInstance();
  +                        sitemapHandler.setSourceFileName(source);
  +                        sitemapHandler.setCheckReload(check_reload);
                           sitemapHandler.setLogger(getLogger());
                           sitemapHandler.compose(newManager);
                           sitemapHandler.contextualize(this.context);
  +                        if (sitemapHandler instanceof Configurable)
  +                          ((Configurable)sitemapHandler).configure(conf);
                           sitemapHandler.regenerate(environment);
                           sitemaps.put(source, sitemapHandler);
                       }
  
  
  

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