Beispiel #1
0
 @Override
 public synchronized void test() throws ServiceException {
   validateDataSource();
   try {
     connect();
     if (dataSource.leaveOnServer() && !hasUIDL()) {
       throw RemoteServiceException.POP3_UIDL_REQUIRED();
     }
     connection.quit();
   } catch (IOException e) {
     throw ServiceException.FAILURE("Unable to connect to POP3 server: " + dataSource, e);
   } finally {
     connection.close();
   }
 }
Beispiel #2
0
 @Override
 public synchronized void importData(List<Integer> folderIds, boolean fullSync)
     throws ServiceException {
   validateDataSource();
   connect();
   try {
     if (connection.getMessageCount() > 0) {
       if (dataSource.leaveOnServer()) {
         fetchAndRetainMessages();
       } else {
         fetchAndDeleteMessages();
       }
     }
     connection.quit();
   } catch (ServiceException e) {
     throw e;
   } catch (Exception e) {
     throw ServiceException.FAILURE("Synchronization of POP3 folder failed", e);
   } finally {
     connection.close();
   }
 }