You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/24 09:26:38 UTC

svn commit: r178131 - in /lenya/trunk/src: java/org/apache/lenya/cms/editors/EditDocument.java java/org/apache/lenya/cms/usecase/AbstractUsecase.java java/org/apache/lenya/transaction/UnitOfWorkImpl.java webapp/lenya/usecases/edit-document.js

Author: jwkaltz
Date: Tue May 24 00:26:38 2005
New Revision: 178131

URL: http://svn.apache.org/viewcvs?rev=178131&view=rev
Log:
[minor change] added debug messages

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/editors/EditDocument.java
    lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
    lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
    lenya/trunk/src/webapp/lenya/usecases/edit-document.js

Modified: lenya/trunk/src/java/org/apache/lenya/cms/editors/EditDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/editors/EditDocument.java?rev=178131&r1=178130&r2=178131&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/editors/EditDocument.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/editors/EditDocument.java Tue May 24 00:26:38 2005
@@ -26,7 +26,7 @@
 /**
  * Usecase to edit documents.
  * 
- * @version $Id:$
+ * @version $Id$
  */
 public class EditDocument extends DocumentUsecase {
 
@@ -63,6 +63,11 @@
     }
 
     protected Transactionable[] getObjectsToLock() throws UsecaseException {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("EditDocument::getObjectsToLock() called on source document [" + getSourceDocument().getId() + "]");
+        }
+
         return getSourceDocument().getRepositoryNodes();
     }
+
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java?rev=178131&r1=178130&r2=178131&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Tue May 24 00:26:38 2005
@@ -619,17 +619,27 @@
      * @see #getObjectsToLock()
      */
     public final void lockInvolvedObjects(Transactionable[] objects) throws UsecaseException {
+
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("AbstractUsecase::lockInvolvedObjects() called, are there objects to lock ? " + (objects != null));
+
         try {
             boolean canExecute = true;
 
             for (int i = 0; i < objects.length; i++) {
                 if (objects[i].isCheckedOut()) {
+                    if (getLogger().isDebugEnabled())
+                        getLogger().debug("AbstractUsecase::lockInvolvedObjects() can not execute, object [" + objects[i] + "] is already checked out");
+
                     canExecute = false;
                 }
             }
 
             if (canExecute) {
                 for (int i = 0; i < objects.length; i++) {
+                    if (getLogger().isDebugEnabled())
+                        getLogger().debug("AbstractUsecase::lockInvolvedObjects() locking " + objects[i]);
+
                     objects[i].lock();
                     if (!isOptimistic()) {
                         objects[i].checkout();

Modified: lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java?rev=178131&r1=178130&r2=178131&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java Tue May 24 00:26:38 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 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.
@@ -97,7 +97,7 @@
      */
     public synchronized void commit() throws TransactionException {
         if (getLogger().isDebugEnabled()) {
-            getLogger().debug("commit");
+            getLogger().debug("UnitOfWorkImpl::commit() called");
         }
 
         Set involvedObjects = new HashSet();
@@ -122,7 +122,7 @@
         for (Iterator i = this.modifiedObjects.iterator(); i.hasNext();) {
             Transactionable t = (Transactionable) i.next();
             if (getLogger().isDebugEnabled()) {
-                getLogger().debug("save [" + t + "]");
+                getLogger().debug("UnitOfWorkImpl::commit() calling save on [" + t + "]");
             }
             t.saveTransactionable();
         }
@@ -175,7 +175,7 @@
      */
     public synchronized void rollback() throws TransactionException {
         if (getLogger().isDebugEnabled()) {
-            getLogger().debug("rollback");
+            getLogger().debug("UnitOfWorkImpl::rollback() called");
         }
         if (getIdentityMap() != null) {
             Identifiable[] objects = getIdentityMap().getObjects();
@@ -193,4 +193,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: lenya/trunk/src/webapp/lenya/usecases/edit-document.js
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/edit-document.js?rev=178131&r1=178130&r2=178131&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/edit-document.js (original)
+++ lenya/trunk/src/webapp/lenya/usecases/edit-document.js Tue May 24 00:26:38 2005
@@ -49,6 +49,11 @@
         var flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
         var request = flowHelper.getRequest(cocoon);
         var sourceUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(request);
+
+        if (cocoon.log.isDebugEnabled()) {
+            cocoon.log.debug("edit-document.js::editDocument() calling usecase methods, usecaseName [" + usecaseName + "], sourceUrl [" + sourceUrl + "]");    
+        }
+
         usecase.setSourceURL(sourceUrl);
         usecase.setName(usecaseName);
 
@@ -56,6 +61,10 @@
         usecase.lockInvolvedObjects();
         
         usecase.execute();
+
+        if (cocoon.log.isDebugEnabled()) {
+            cocoon.log.debug("edit-document.js::editDocument() after usecase.execute(), hasErrors ? " + usecase.hasErrors());
+        }
 
         // FIXME: handle error messages
         //if (usecase.hasErrors()) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org