You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2008/08/14 15:30:58 UTC

svn commit: r685886 - in /james/server/trunk/management-library/src/main/java/org/apache/james/management: SpoolManagementService.java impl/SpoolManagement.java

Author: bago
Date: Thu Aug 14 06:30:56 2008
New Revision: 685886

URL: http://svn.apache.org/viewvc?rev=685886&view=rev
Log:
No need to use avalon ServiceException in our services interface.
Wrapped the ServiceException in a SpoolManagementException and made sure the interface does not expose implementation details.

Modified:
    james/server/trunk/management-library/src/main/java/org/apache/james/management/SpoolManagementService.java
    james/server/trunk/management-library/src/main/java/org/apache/james/management/impl/SpoolManagement.java

Modified: james/server/trunk/management-library/src/main/java/org/apache/james/management/SpoolManagementService.java
URL: http://svn.apache.org/viewvc/james/server/trunk/management-library/src/main/java/org/apache/james/management/SpoolManagementService.java?rev=685886&r1=685885&r2=685886&view=diff
==============================================================================
--- james/server/trunk/management-library/src/main/java/org/apache/james/management/SpoolManagementService.java (original)
+++ james/server/trunk/management-library/src/main/java/org/apache/james/management/SpoolManagementService.java Thu Aug 14 06:30:56 2008
@@ -22,8 +22,6 @@
 
 package org.apache.james.management;
 
-import org.apache.avalon.framework.service.ServiceException;
-
 import javax.mail.MessagingException;
 import java.util.List;
 
@@ -38,12 +36,11 @@
      * @param dstState if not NULL, the state will be changed before storing the message to the new repository.
      * @param filter the filter to select messages from the source repository
      * @return a counter of moved mails
-     * @throws ServiceException 
      * @throws MessagingException 
      * @throws SpoolManagementException
      */
     public int moveSpoolItems(String srcSpoolRepositoryURL, String dstSpoolRepositoryURL, String dstState, SpoolFilter filter)
-            throws ServiceException, MessagingException, SpoolManagementException;
+            throws MessagingException, SpoolManagementException;
 
     /**
      * Removes all mails from the given repository matching the filter
@@ -54,11 +51,11 @@
      * a lock could not be obtained
      * @param filter the criteria against which all mails are matched. only applied if key is NULL.
      * @return number of removed mails
-     * @throws ServiceException
-     * @throws MessagingException
+     * @throws MessagingException 
+     * @throws SpoolManagementException
      */
     public int removeSpoolItems(String spoolRepositoryURL, String key, List lockingFailures, SpoolFilter filter) 
-            throws ServiceException, MessagingException;
+            throws MessagingException, SpoolManagementException;
     
     /**
      * Tries to resend all mails from the given repository matching the given filter criteria 
@@ -69,12 +66,11 @@
      *                        a lock could not be obtained
      * @param filter the criteria against which all mails are matched. only applied if key is NULL.
      * @return int number of resent mails 
-     * @throws ServiceException
      * @throws MessagingException
      * @throws SpoolManagementException
      */
     public int resendSpoolItems(String spoolRepositoryURL, String key, List lockingFailures, SpoolFilter filter) 
-            throws ServiceException, MessagingException, SpoolManagementException;
+            throws MessagingException, SpoolManagementException;
 
     /**
      * Return a List which contains all mails which can accessed by given spoolRepositoryUrl and matched
@@ -83,10 +79,9 @@
      * @param spoolRepositoryURL the url under which a spool can be accessed
      * @param filter the SpoolFilter to use
      * @return List<Mail> all matching mails from the given spool
-     * @throws ServiceException
      * @throws MessagingException
      * @throws SpoolManagementException
      */
     public List getSpoolItems(String spoolRepositoryURL, SpoolFilter filter) 
-            throws ServiceException, MessagingException, SpoolManagementException;
+            throws MessagingException, SpoolManagementException;
 }

Modified: james/server/trunk/management-library/src/main/java/org/apache/james/management/impl/SpoolManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/management-library/src/main/java/org/apache/james/management/impl/SpoolManagement.java?rev=685886&r1=685885&r2=685886&view=diff
==============================================================================
--- james/server/trunk/management-library/src/main/java/org/apache/james/management/impl/SpoolManagement.java (original)
+++ james/server/trunk/management-library/src/main/java/org/apache/james/management/impl/SpoolManagement.java Thu Aug 14 06:30:56 2008
@@ -106,7 +106,7 @@
      * @throws SpoolManagementException
      */
     public int moveSpoolItems(String srcSpoolRepositoryURL, String dstSpoolRepositoryURL, String dstState, SpoolFilter filter)
-            throws ServiceException, MessagingException, SpoolManagementException {
+            throws MessagingException, SpoolManagementException {
         
         SpoolRepository srcSpoolRepository;
         SpoolRepository dstSpoolRepository;
@@ -264,7 +264,7 @@
      * @see org.apache.james.management.SpoolManagementService#getSpoolItems(String, SpoolFilter)
      */
     public List getSpoolItems(String spoolRepositoryURL, SpoolFilter filter)
-            throws ServiceException, MessagingException, SpoolManagementException {
+            throws MessagingException, SpoolManagementException {
         SpoolRepository spoolRepository = getSpoolRepository(spoolRepositoryURL);
 
         List items = new ArrayList();
@@ -319,7 +319,7 @@
     /**
      * @see org.apache.james.management.SpoolManagementService#removeSpoolItems(String, String, List, SpoolFilter)
      */
-    public int removeSpoolItems(String spoolRepositoryURL, String key, List lockingFailures, SpoolFilter filter) throws ServiceException, MessagingException {
+    public int removeSpoolItems(String spoolRepositoryURL, String key, List lockingFailures, SpoolFilter filter) throws SpoolManagementException, MessagingException, SpoolManagementException {
         int count = 0;
         SpoolRepository spoolRepository = getSpoolRepository(spoolRepositoryURL);
 
@@ -383,7 +383,7 @@
      * @see org.apache.james.management.SpoolManagementService#resendSpoolItems(String, String, List, SpoolFilter)
      */
     public int resendSpoolItems(String spoolRepositoryURL, String key, List lockingFailures, SpoolFilter filter)
-            throws ServiceException, MessagingException, SpoolManagementException {
+            throws MessagingException, SpoolManagementException {
         int count = 0;
         SpoolRepository spoolRepository = getSpoolRepository(spoolRepositoryURL);
 
@@ -474,14 +474,18 @@
      * @throws ServiceException Get thrown if the spoolRepository can not retrieved
      */
     private SpoolRepository getSpoolRepository(String url)
-            throws ServiceException {
+            throws SpoolManagementException {
         // Setup all needed data
         DefaultConfiguration spoolConf = new DefaultConfiguration("spool",
                 "generated:RemoteManager.java");
         spoolConf.setAttribute("destinationURL", url);
         spoolConf.setAttribute("type", "SPOOL");
 
-        return (SpoolRepository) mailStore.select(spoolConf);
+        try {
+            return (SpoolRepository) mailStore.select(spoolConf);
+        } catch (ServiceException e) {
+            throw new SpoolManagementException("Exception while looking up for the repository", e);
+        }
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org