cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation XMLDBTransformer.java
Date Mon, 03 May 2004 15:45:43 GMT
vgritsenko    2004/05/03 08:45:43

  Modified:    src/blocks/xmldb/conf xmldb.transformer.xmap
               src/blocks/xmldb/java/org/apache/cocoon/transformation
                        XMLDBTransformer.java
  Log:
  Bug #26456. XMLDBTransformer was initializing database with no config settings.
  Make initialization optional.
  
  Revision  Changes    Path
  1.3       +4 -0      cocoon-2.1/src/blocks/xmldb/conf/xmldb.transformer.xmap
  
  Index: xmldb.transformer.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/xmldb/conf/xmldb.transformer.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- xmldb.transformer.xmap	6 Mar 2004 02:25:56 -0000	1.2
  +++ xmldb.transformer.xmap	3 May 2004 15:45:43 -0000	1.3
  @@ -18,7 +18,11 @@
   <xmap xpath="/sitemap/components/transformers" unless="transformer[@name='xmldb']">
   
       <map:transformer logger="sitemap.transformer.xmldb" name="xmldb" src="org.apache.cocoon.transformation.XMLDBTransformer">
  +      <!-- Driver class (optional). Uncomment if you want XMLDBTransformer
  +           to create and register XML:DB database. Keep commented out if
  +           database created somewhere else (for example, by XML:DB source factory)
         <driver>org.apache.xindice.client.xmldb.embed.DatabaseImpl</driver>
  +      -->
         <base>xmldb:xindice-embed:///db</base>
       </map:transformer>
   </xmap>
  
  
  
  1.10      +14 -10    cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
  
  Index: XMLDBTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLDBTransformer.java	5 Mar 2004 13:02:37 -0000	1.9
  +++ XMLDBTransformer.java	3 May 2004 15:45:43 -0000	1.10
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -67,7 +67,9 @@
    * <p>Definition:</p>
    * <pre>
    * &lt;map:transformer name="xmldb" src="org.apache.cocoon.transformation.XMLDBTransformer"&gt;
  + *   &lt;!-- Optional driver parameter. Uncomment if you want transformer to register
a database.
    *   &lt;driver&gt;org.apache.xindice.client.xmldb.DatabaseImpl&lt;/driver&gt;
  + *   --&gt;
    *   &lt;base&gt;xmldb:xindice:///db/collection&lt;/base&gt;
    * &lt;/map:transformer&gt;
    * </pre>
  @@ -156,7 +158,7 @@
       /** The map of namespace prefixes. */
       private Map prefixMap = new HashMap();
   
  -    /** XML:DB driver class name. */
  +    /** XML:DB driver class name (optional) */
       private String driver = null;
   
       /** Default collection name. */
  @@ -199,19 +201,21 @@
       public void configure(Configuration configuration) throws ConfigurationException {
           this.driver = configuration.getChild("driver").getValue(null);
           if (driver == null) {
  -            throw new ConfigurationException("Required driver parameter is missing.");
  +            getLogger().debug("Driver parameter is missing. Transformer will not initialize
database.");
           }
   
           this.default_base = configuration.getChild("base").getValue(null);
       }
   
       /**
  -     * Initializes XML:DB database instance using specified driver class.
  +     * Initializes XML:DB database instance if driver class was configured.
        */
       public void initialize() throws Exception {
  -        Class c = Class.forName(driver);
  -        Database database = (Database)c.newInstance();
  -        DatabaseManager.registerDatabase(database);
  +        if (driver != null) {
  +            Class c = Class.forName(driver);
  +            Database database = (Database)c.newInstance();
  +            DatabaseManager.registerDatabase(database);
  +        }
       }
   
       /** Setup the transformer. */
  
  
  

Mime
View raw message