cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: rev 36518 - in cocoon/branches/BRANCH_2_1_X: . src/blocks/xmldb/java/org/apache/cocoon/transformation
Date Tue, 17 Aug 2004 12:08:10 GMT
Author: vgritsenko
Date: Tue Aug 17 05:08:10 2004
New Revision: 36518

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
Log:
Sync with 2.2:
Fix bug #29765: Add ability to delete collections with XMLDBTransformer.


Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
==============================================================================
--- 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
Tue Aug 17 05:08:10 2004
@@ -139,7 +139,7 @@
  * </ul>
  *
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
- * @version CVS $Id: XMLDBTransformer.java,v 1.11 2004/05/16 16:16:43 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class XMLDBTransformer extends AbstractTransformer
         implements CacheableProcessingComponent, Configurable, Initializable {
@@ -446,18 +446,32 @@
                             }
                         }
                     } else if ("delete".equals(operation)) {
-                        try {
-                            Resource resource = collection.getResource(this.key);
-                            if (resource == null) {
-                                message = "Resource " + this.key + " does not exist";
-                                getLogger().debug(message);
-                            } else {
-                                collection.removeResource(resource);
+                        if (key != null && key.endsWith("/")) {
+                            try {
+                                // Cut trailing '/'
+                                String k = this.key.substring(0, this.key.length() - 1);
+                                CollectionManagementService service =
+                                        (CollectionManagementService) collection.getService("CollectionManagementService",
"1.0");
+                                service.removeCollection(k);
                                 result = "success";
+                            } catch (XMLDBException e) {
+                                message = "Failed to delete collection " + this.key + ":
" + e.errorCode;
+                                getLogger().error(message, e);
+                            }
+                        } else {
+                            try {
+                                Resource resource = collection.getResource(this.key);
+                                if (resource == null) {
+                                    message = "Resource " + this.key + " does not exist";
+                                    getLogger().debug(message);
+                                } else {
+                                    collection.removeResource(resource);
+                                    result = "success";
+                                }
+                            } catch (XMLDBException e) {
+                                message = "Failed to delete resource " + key + ": " + e.errorCode;
+                                getLogger().debug(message, e);
                             }
-                        } catch (XMLDBException e) {
-                            message = "Failed to delete resource " + key + ": " + e.errorCode;
-                            getLogger().debug(message, e);
                         }
                     } else if ("update".equals(operation)) {
                         try {

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml	Tue Aug 17 05:08:10 2004
@@ -219,6 +219,9 @@
      AbstractMessageListener and AbstractMessagePublisher should be used as basis for
      custom publish/subscribe components.
    </action>
+   <action dev="VG" type="fix" fixes-bug="29765" due-to="Rui Alberto L. Gon&ccedil;alves"
due-to-email="rui-l-goncalves@ptinovacao.pt">
+     XMLDB Block: Add ability to delete collections with XMLDBTransformer.
+   </action>
    <action dev="CZ" type="fix" fixes-bug="27260">
      Make implementation of Cocoon protocol compliant with the Source interface.
    </action>

Mime
View raw message