cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: rev 36372 - in cocoon/trunk: . src/blocks/xmldb/java/org/apache/cocoon/transformation
Date Sat, 14 Aug 2004 01:55:09 GMT
Author: vgritsenko
Date: Fri Aug 13 18:55:08 2004
New Revision: 36372

Modified:
   cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
   cocoon/trunk/status.xml
Log:
Fix bug #29765: Add ability to delete collections with XMLDBTransformer.


Modified: cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
(original)
+++ cocoon/trunk/src/blocks/xmldb/java/org/apache/cocoon/transformation/XMLDBTransformer.java
Fri Aug 13 18:55:08 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/trunk/status.xml
==============================================================================
--- cocoon/trunk/status.xml	(original)
+++ cocoon/trunk/status.xml	Fri Aug 13 18:55:08 2004
@@ -55,6 +55,7 @@
 <!ENTITY eacute           "&#x000E9;">
 <!ENTITY ouml             "&#x000F6;">
 <!ENTITY uuml             "&#x000FC;">
+<!ENTITY ccedil           "&#x000E7;">
 ]>
 
 <!-- CVS $Id$ -->
@@ -203,6 +204,9 @@
 
   <changes>
  <release version="@version@" date="@date@">
+   <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="VG" type="update">
      Reworked LocaleAction and I18nMatcher to have similar logic and
      configuration.

Mime
View raw message