You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ralph Goers <Ra...@dslextreme.com> on 2006/01/13 14:54:56 UTC

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml

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

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransforme r.java status.xml

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Ralph Goers:

> It is good practice to apply patches to both branches just so it
> doesn't get forgotten.

* Antonio Gallardo:

> Yes, please  keep the  both version in  sync. If not,  then this
> problem will show up again in 2.2.

* Upayavira:

> No, but if you don't do it now, likely it will be forgotten.

No problem, I will do it tomorrow ;-)  I won't forget, it's on my
TODO list.

Thanks for reminding.
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml

Posted by Upayavira <uv...@odoko.co.uk>.
Jean-Baptiste Quenot wrote:
> * Ralph Goers:
> 
> 
>>I  don't see  a  corresponding email  for  trunk. Was this  also
>>applied there?
> 
> 
> Not yet.  Is it urgently needed in 2.2?

No, but if you don't do it now, likely it will be forgotten.

Regards, Upayavira


Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransforme r.java status.xml

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joerg Heinicke wrote:
> On 13.01.2006 17:37, Ralph Goers wrote:
> 
>>>> I  don't see  a  corresponding email  for  trunk. Was this  also
>>>> applied there?
>>>
>>> Not yet.  Is it urgently needed in 2.2?
>>
>> I have no idea. It is good practice to apply patches to both branches 
>> just
>> so it doesn't get forgotten.
> 
> Otherwise it should go into 
> http://svn.apache.org/viewcvs.cgi/cocoon/trunk/TO-SYNC-FROM-BRANCH.txt?rev=328590&view=log 

No-no-no-no! This file should be getting *smaller*, not *bigger*!!! :-)

Vadim


Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransforme r.java status.xml

Posted by Joerg Heinicke <jo...@gmx.de>.
On 13.01.2006 17:37, Ralph Goers wrote:

>>>I  don't see  a  corresponding email  for  trunk. Was this  also
>>>applied there?
>>
>>Not yet.  Is it urgently needed in 2.2?
> 
> I have no idea. It is good practice to apply patches to both branches just
> so it doesn't get forgotten.

Otherwise it should go into 
http://svn.apache.org/viewcvs.cgi/cocoon/trunk/TO-SYNC-FROM-BRANCH.txt?rev=328590&view=log

Jörg

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransforme r.java status.xml

Posted by Antonio Gallardo <ag...@agssa.net>.
Ralph Goers wrote:

>Jean-Baptiste Quenot said:
>  
>
>>* Ralph Goers:
>>
>>    
>>
>>>I  don't see  a  corresponding email  for  trunk. Was this  also
>>>applied there?
>>>      
>>>
>>Not yet.  Is it urgently needed in 2.2?
>>    
>>
>
>I have no idea. It is good practice to apply patches to both branches just
>so it doesn't get forgotten.
>  
>
Yes, please keep the both version in sync. If not, then this problem 
will show up again in 2.2.

Best Regards,

Antonio Gallardo.


Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransforme r.java status.xml

Posted by Ralph Goers <Ra...@dslextreme.com>.
Jean-Baptiste Quenot said:
> * Ralph Goers:
>
>> I  don't see  a  corresponding email  for  trunk. Was this  also
>> applied there?
>
> Not yet.  Is it urgently needed in 2.2?

I have no idea. It is good practice to apply patches to both branches just
so it doesn't get forgotten.

Ralph


Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Ralph Goers:

> I  don't see  a  corresponding email  for  trunk. Was this  also
> applied there?

Not yet.  Is it urgently needed in 2.2?
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml

Posted by Upayavira <uv...@odoko.co.uk>.
Jean-Baptiste Quenot wrote:
> BTW, no email was sent for my first commit:
> 
> The commit in question:
> http://svn.apache.org/viewcvs.cgi?rev=368641&view=rev
> 
> The cvs archive for my commits:
> http://marc.theaimsgroup.com/?l=xml-cocoon-cvs&w=2&r=1&s=jbq&q=b

You need to be subscribed to the cvs@ list via your apache.org email
address. Normally a moderator will see your commit and moderate it
through, adding you to the 'allow' list so you can do it in future. I
believe I did this for your commit mail when I saw the moderation
message. The only thing that could have happened is another moderator
replied saying "no", but I think that unlikely.

I'd suggest you try another, this time inconsequential commit (add a
space to a file or something) so we can moderate you through properly
this time!

Regards, Upayavira

Re: svn commit: r368690 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java status.xml

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
BTW, no email was sent for my first commit:

The commit in question:
http://svn.apache.org/viewcvs.cgi?rev=368641&view=rev

The cvs archive for my commits:
http://marc.theaimsgroup.com/?l=xml-cocoon-cvs&w=2&r=1&s=jbq&q=b

What went wrong?
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/