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/03/16 15:51:37 UTC

svn commit: r157758 - in lenya/trunk/src/java/org/apache/lenya/cms: site/usecases/ChangeNodeID.java usecase/AbstractUsecase.java

Author: jwkaltz
Date: Wed Mar 16 06:51:30 2005
New Revision: 157758

URL: http://svn.apache.org/viewcvs?view=rev&rev=157758
Log:
DocumentManager instance is now not created for every case, only upon
request in getDocumentManager(). This method can now throw an exception,
so methods explicitly listing exceptions as in ChangeNodeID.java must
reflect this.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
    lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java?view=diff&r1=157757&r2=157758
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/ChangeNodeID.java Wed Mar 16 06:51:30 2005
@@ -16,6 +16,7 @@
  */
 package org.apache.lenya.cms.site.usecases;
 
+import org.apache.avalon.framework.service.ServiceException;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentBuildException;
 import org.apache.lenya.cms.publication.DocumentException;
@@ -114,9 +115,10 @@
      * @throws DocumentException if an error occurs.
      * @throws DocumentBuildException if an error occurs.
      * @throws PublicationException if an error occurs.
+     * @throws ServiceException if an access error to a an Avalon service occurs
      */
     protected Document moveAllLanguageVersions(Document document) throws DocumentException,
-            DocumentBuildException, PublicationException {
+            DocumentBuildException, PublicationException, ServiceException {
         Document newDocument = null;
 
         DocumentIdentityMap identityMap = document.getIdentityMap();
@@ -160,4 +162,4 @@
 
         return newDocumentId;
     }
-}
\ No newline at end of file
+}

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?view=diff&r1=157757&r2=157758
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Wed Mar 16 06:51:30 2005
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.servlet.multipart.Part;
 import org.apache.lenya.cms.publication.DocumentManager;
 
@@ -351,7 +352,14 @@
 
     private DocumentManager documentManager;
 
-    protected DocumentManager getDocumentManager() {
+    protected DocumentManager getDocumentManager() throws ServiceException {
+        if (this.documentManager == null) {
+           if (getLogger().isDebugEnabled())
+               getLogger().debug("AbstractUsecase.getDocumentManager() does not yet have instance, looking up role [" + DocumentManager.ROLE + "]");
+
+           this.documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
+        }
+
         return this.documentManager;
     }
 
@@ -360,7 +368,6 @@
      */
     public final void initialize() throws Exception {
         super.initialize();
-        this.documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
     }
 
     /**
@@ -434,4 +441,4 @@
         initParameters();
     }
 
-}
\ No newline at end of file
+}



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