cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml
Date Fri, 13 Jan 2006 13:54:56 GMT
I don't see a corresponding email for trunk. Was this also applied there?

jbq@apache.org wrote:

>Author: jbq
>Date: Fri Jan 13 03:27:18 2006
>New Revision: 368690
>
>URL: http://svn.apache.org/viewcvs?rev=368690&view=rev
>Log:
>Fix COCOON-1259: XMLDBTransformer can use username/password to access XMLDB
>
>Note that DatabaseManager.getCollection() accepts null values for user and
>password, see
>http://xmldb-org.sourceforge.net/xapi/api/org/xmldb/api/DatabaseManager.html#getCollection(java.lang.String,%20java.lang.String,%20java.lang.String)
>
>Modified:
>    cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
>    cocoon/branches/BRANCH_2_1_X/status.xml
>
>Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
>URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java?rev=368690&r1=368689&r2=368690&view=diff
>==============================================================================
>--- cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
(original)
>+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
Fri Jan 13 03:27:18 2006
>@@ -15,24 +15,35 @@
>  */
> package org.apache.cocoon.transformation;
> 
>+import java.io.IOException;
>+import java.io.Serializable;
>+import java.io.StringWriter;
>+import java.util.HashMap;
>+import java.util.Iterator;
>+import java.util.Map;
>+import java.util.Properties;
>+
>+import javax.xml.transform.OutputKeys;
>+import javax.xml.transform.TransformerConfigurationException;
>+import javax.xml.transform.TransformerFactory;
>+import javax.xml.transform.sax.SAXTransformerFactory;
>+import javax.xml.transform.sax.TransformerHandler;
>+import javax.xml.transform.stream.StreamResult;
>+
> import org.apache.avalon.framework.activity.Initializable;
> import org.apache.avalon.framework.configuration.Configurable;
> import org.apache.avalon.framework.configuration.Configuration;
> import org.apache.avalon.framework.configuration.ConfigurationException;
> import org.apache.avalon.framework.parameters.Parameters;
>-
> import org.apache.cocoon.ProcessingException;
> import org.apache.cocoon.ResourceNotFoundException;
> import org.apache.cocoon.caching.CacheableProcessingComponent;
> import org.apache.cocoon.environment.SourceResolver;
> import org.apache.cocoon.util.TraxErrorHandler;
>-
> import org.apache.excalibur.source.SourceValidity;
>-
> import org.xml.sax.Attributes;
> import org.xml.sax.SAXException;
> import org.xml.sax.helpers.AttributesImpl;
>-
> import org.xmldb.api.DatabaseManager;
> import org.xmldb.api.base.Collection;
> import org.xmldb.api.base.Database;
>@@ -41,22 +52,6 @@
> import org.xmldb.api.modules.CollectionManagementService;
> import org.xmldb.api.modules.XUpdateQueryService;
> 
>-import java.io.IOException;
>-import java.io.Serializable;
>-import java.io.StringWriter;
>-
>-import java.util.HashMap;
>-import java.util.Iterator;
>-import java.util.Map;
>-import java.util.Properties;
>-
>-import javax.xml.transform.OutputKeys;
>-import javax.xml.transform.TransformerConfigurationException;
>-import javax.xml.transform.TransformerFactory;
>-import javax.xml.transform.sax.SAXTransformerFactory;
>-import javax.xml.transform.sax.TransformerHandler;
>-import javax.xml.transform.stream.StreamResult;
>-
> /**
>  * This transformer allows to perform resource creation, deletion, and
>  * XUpdate command execution in XML:DB. All operations are performed either
>@@ -71,13 +66,18 @@
>  *   &lt;driver&gt;org.apache.xindice.client.xmldb.DatabaseImpl&lt;/driver&gt;
>  *   --&gt;
>  *   &lt;base&gt;xmldb:xindice:///db/collection&lt;/base&gt;
>+ *   &lt;user&gt;myDatabaseLogin&lt;/user&gt;
>+ *   &lt;password&gt;myDatabasePassword&lt;/password&gt;
>  * &lt;/map:transformer&gt;
>  * </pre>
>  *
>- * <p>Invocation:</p>
>+ * <p>The component configuration defined in &lt;map:transformer&gt; can
be
>+ * overriden with sitemap parameters on the &lt;map:transform&gt;:</p>
>  * <pre>
>  * &lt;map:transform type="xmldb"&gt;
>  *   &lt;map:parameter name="base" value="xmldb:xindice:///db/collection"/&gt;
>+ *   &lt;map:parameter name="user" value="myDatabaseLogin"/&gt;
>+ *   &lt;map:parameter name="password" value="myDatabasePassword"/&gt;
>  * &lt;/map:transform&gt;
>  * </pre>
>  *
>@@ -109,7 +109,7 @@
>  *   &lt;db:query type="create" oid="inner/"/&gt;
>  *
>  *   &lt;p&gt;Create XML resource in context collection with specified object
ID&lt;/p&gt;
>- *   &lt;xmldb:query type="create" collection="inner" oid="xmldb-object-id"&gt;
>+ *   &lt;db:query type="create" collection="inner" oid="xmldb-object-id"&gt;
>  *     &lt;page&gt;
>  *       XML Object body
>  *     &lt;/page&gt;
>@@ -138,8 +138,7 @@
>  * <li>No namespaces with Xalan (see AbstractTextSerializer)</li>
>  * </ul>
>  *
>- * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
>- * @version CVS $Id$
>+ * @version $Id$
>  */
> public class XMLDBTransformer extends AbstractTransformer
>         implements CacheableProcessingComponent, Configurable, Initializable {
>@@ -164,6 +163,12 @@
>     /** Default collection name. */
>     private String default_base;
> 
>+    /** Default user name. */
>+    private String default_user;
>+
>+    /** Default password. */
>+    private String default_password;
>+
>     /** Current collection name. */
>     private String local_base;
> 
>@@ -173,6 +178,12 @@
>     /** Current collection. */
>     private Collection collection;
> 
>+    /** database login */
>+    private String local_user = null;
>+
>+    /** database password */
>+    private String local_password = null;
>+
>     /** Operation. One of: create, delete, update. */
>     private String operation;
> 
>@@ -205,6 +216,8 @@
>         }
> 
>         this.default_base = configuration.getChild("base").getValue(null);
>+        this.default_user = configuration.getChild("user").getValue(null);
>+        this.default_password = configuration.getChild("password").getValue(null);
>     }
> 
>     /**
>@@ -227,8 +240,12 @@
>             throw new ProcessingException("Required base parameter is missing. Syntax
is: xmldb:xindice:///db/collection");
>         }
> 
>+        /** Get user password from parameter for the database. Usefull for update action
*/
>+        this.local_user     = par.getParameter("user",     this.default_user);
>+        this.local_password = par.getParameter("password", this.default_password);
>+
>         try {
>-            this.collection = DatabaseManager.getCollection(this.local_base);
>+            this.collection = DatabaseManager.getCollection(this.local_base, this.local_user,
this.local_password);
>         } catch (XMLDBException e) {
>             throw new ProcessingException("Could not get collection " + this.local_base
+ ": " + e.errorCode, e);
>         }
>@@ -414,7 +431,7 @@
>                 Collection collection = null;
>                 try {
>                     // Obtain collection for the current operation
>-                    collection = (xbase != null)? DatabaseManager.getCollection(local_base
+ "/" + xbase) : this.collection;
>+                    collection = (xbase != null)? DatabaseManager.getCollection(local_base
+ "/" + xbase, this.local_user, this.local_password) : this.collection;
> 
>                     if (collection == null) {
>                         message = "Failed to " + operation + " resource " + this.key
+ ": Collection " + local_base + "/" + xbase + " not found.";
>
>Modified: cocoon/branches/BRANCH_2_1_X/status.xml
>URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=368690&r1=368689&r2=368690&view=diff
>==============================================================================
>--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
>+++ cocoon/branches/BRANCH_2_1_X/status.xml Fri Jan 13 03:27:18 2006
>@@ -102,6 +102,7 @@
>   <person name="Konstantin Piroumian" email="kpiroumian@apache.org" id="KP"/>
>   <person name="Marc Portier" email="mpo@apache.org" id="MPO"/>
>   <person name="Ovidiu Predescu" email="ovidiu@apache.org" id="OP"/>
>+  <person name="Jean-Baptiste Quenot" email="jbq@apache.org" id="JBQ"/>
>   <person name="Jeremy Quinn" email="jeremy@apache.org" id="JQ"/>
>   <person name="Reinhard P&#246;tz" email="reinhard@apache.org" id="RP"/>
>   <person name="Gianugo Rabellino" email="gianugo@apache.org" id="GR"/>
>@@ -179,6 +180,12 @@
>   <release version="@version@" date="@date@">
> -->
>   <release version="2.1.9" date="TBD">
>+    <action dev="JBQ" type="fix" fixes-bug="COCOON-1259">
>+      XMLDBTransformer can use username/password to access XMLDB.
>+      Note that DatabaseManager.getCollection() accepts null values for user and
>+      password, see
>+      http://xmldb-org.sourceforge.net/xapi/api/org/xmldb/api/DatabaseManager.html#getCollection(java.lang.String,%20java.lang.String,%20java.lang.String)
>+    </action>
>    <action dev="CZ" type="add">
>       Portal Block: Provide user name to portlets.
>     </action> 
>
>
>  
>

Mime
View raw message