noel        2003/08/28 09:32:02

  Modified:    src/java/org/apache/james/mailrepository Tag: branch_2_1_fcs
                        AvalonMailRepository.java JDBCMailRepository.java
               src/java/org/apache/james/pop3server Tag: branch_2_1_fcs
                        POP3Handler.java
               src/java/org/apache/james/services Tag: branch_2_1_fcs
                        MailRepository.java
  Log:
  Previous commit added MailRepository.remove(Collection) to remove mail from a 
repository in a single batch.  Corrected javadocs.  Committing POP3Handler that uses 
this new capability.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.20.4.9  +2 -2      
james-server/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
  
  Index: AvalonMailRepository.java
  ===================================================================
  RCS file: 
/home/cvs/james-server/src/java/org/apache/james/mailrepository/AvalonMailRepository.java,v
  retrieving revision 1.20.4.8
  retrieving revision 1.20.4.9
  diff -u -r1.20.4.8 -r1.20.4.9
  --- AvalonMailRepository.java 28 Aug 2003 16:22:37 -0000      1.20.4.8
  +++ AvalonMailRepository.java 28 Aug 2003 16:32:02 -0000      1.20.4.9
  @@ -401,8 +401,8 @@
   
   
       /**
  -     * Removes a list of mails from the repository
  -     * @param mails The list of <code>MailImpl</code>'s to delete
  +     * Removes a Collection of mails from the repository
  +     * @param mails The Collection of <code>MailImpl</code>'s to delete
        * @throws MessagingException
        * @since 2.2.0
        */
  
  
  
  1.30.4.10 +3 -3      
james-server/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
  
  Index: JDBCMailRepository.java
  ===================================================================
  RCS file: 
/home/cvs/james-server/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
  retrieving revision 1.30.4.9
  retrieving revision 1.30.4.10
  diff -u -r1.30.4.9 -r1.30.4.10
  --- JDBCMailRepository.java   28 Aug 2003 16:22:37 -0000      1.30.4.9
  +++ JDBCMailRepository.java   28 Aug 2003 16:32:02 -0000      1.30.4.10
  @@ -874,8 +874,8 @@
       }
   
       /**
  -     * Removes a list of mails from the repository
  -     * @param mails The list of <code>MailImpl</code>'s to delete
  +     * Removes a Collection of mails from the repository
  +     * @param mails The Collection of <code>MailImpl</code>'s to delete
        * @throws MessagingException
        * @since 2.2.0
        */
  
  
  
  No                   revision
  No                   revision
  1.18.4.6  +45 -37    
james-server/src/java/org/apache/james/pop3server/POP3Handler.java
  
  Index: POP3Handler.java
  ===================================================================
  RCS file: 
/home/cvs/james-server/src/java/org/apache/james/pop3server/POP3Handler.java,v
  retrieving revision 1.18.4.5
  retrieving revision 1.18.4.6
  diff -u -r1.18.4.5 -r1.18.4.6
  --- POP3Handler.java  16 Jul 2003 03:58:44 -0000      1.18.4.5
  +++ POP3Handler.java  28 Aug 2003 16:32:02 -0000      1.18.4.6
  @@ -425,17 +425,24 @@
       private void stat() {
           userMailbox = new ArrayList();
           userMailbox.add(DELETED);
  -        for (Iterator it = userInbox.list(); it.hasNext(); ) {
  -            String key = (String) it.next();
  -            Mail mc = userInbox.retrieve(key);
  -            // Retrieve can return null if the mail is no longer in the store.
  -            // In this case we simply continue to the next key
  -            if (mc == null) {
  -                continue;
  +        try {
  +            for (Iterator it = userInbox.list(); it.hasNext(); ) {
  +                String key = (String) it.next();
  +                Mail mc = userInbox.retrieve(key);
  +                // Retrieve can return null if the mail is no longer in the store.
  +                // In this case we simply continue to the next key
  +                if (mc == null) {
  +                    continue;
  +                }
  +                userMailbox.add(mc);
               }
  -            userMailbox.add(mc);
  +        } catch(MessagingException e) {
  +            // In the event of an exception being thrown there may or may not be 
anything in userMailbox
  +            getLogger().error("Unable to STAT mail box ", e);
  +        }
  +        finally {
  +            backupUserMailbox = (ArrayList) userMailbox.clone();
           }
  -        backupUserMailbox = (ArrayList) userMailbox.clone();
       }
   
       /**
  @@ -532,8 +539,8 @@
        * Reads in the user id.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doUSER(String command,String argument,String argument1) {
           String responseString = null;
  @@ -552,8 +559,8 @@
        * Reads in and validates the password.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doPASS(String command,String argument,String argument1) {
           String responseString = null;
  @@ -587,8 +594,8 @@
        * aggregate size.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doSTAT(String command,String argument,String argument1) {
           String responseString = null;
  @@ -629,8 +636,8 @@
        * a single message.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doLIST(String command,String argument,String argument1) {
           String responseString = null;
  @@ -733,8 +740,8 @@
        * Returns a listing of message ids to the client.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doUIDL(String command,String argument,String argument1) {
           String responseString = null;
  @@ -811,8 +818,8 @@
        * Calls stat() to reset the mailbox.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doRSET(String command,String argument,String argument1) {
           String responseString = null;
  @@ -831,8 +838,8 @@
        * mailbox.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doDELE(String command,String argument,String argument1) {
           String responseString = null;
  @@ -881,8 +888,8 @@
        * Like all good NOOPs, does nothing much.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doNOOP(String command,String argument,String argument1) {
           String responseString = null;
  @@ -901,8 +908,8 @@
        * mailbox.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doRETR(String command,String argument,String argument1) {
           String responseString = null;
  @@ -972,8 +979,8 @@
        *  TOP [mail message number] [number of lines to return]
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doTOP(String command,String argument,String argument1) {
           String responseString = null;
  @@ -1043,8 +1050,8 @@
        * This method handles cleanup of the POP3Handler state.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doQUIT(String command,String argument,String argument1) {
           String responseString = null;
  @@ -1055,10 +1062,11 @@
           }
           List toBeRemoved =  ListUtils.subtract(backupUserMailbox, userMailbox);
           try {
  -            for (Iterator it = toBeRemoved.iterator(); it.hasNext(); ) {
  -                MailImpl mc = (MailImpl) it.next();
  -                userInbox.remove(mc.getName());
  -            }
  +            userInbox.remove(toBeRemoved);
  +            // for (Iterator it = toBeRemoved.iterator(); it.hasNext(); ) {
  +            //    MailImpl mc = (MailImpl) it.next();
  +            //    userInbox.remove(mc.getName());
  +            //}
               responseString = OK_RESPONSE + " Apache James POP3 Server signing off.";
               writeLoggedFlushedResponse(responseString);
           } catch (Exception ex) {
  @@ -1073,8 +1081,8 @@
        * Returns an error response and logs the command.
        *
        * @param command the command parsed by the parseCommand method
  -     * @argument the first argument parsed by the parseCommand method
  -     * @argument1 the second argument parsed by the parseCommand method
  +     * @param argument the first argument parsed by the parseCommand method
  +     * @param argument1 the second argument parsed by the parseCommand method
        */
       private void doUnknownCmd(String command,String argument,String argument1) {
           writeLoggedFlushedResponse(ERR_RESPONSE);
  
  
  
  No                   revision
  No                   revision
  1.4.4.4   +2 -2      
james-server/src/java/org/apache/james/services/Attic/MailRepository.java
  
  Index: MailRepository.java
  ===================================================================
  RCS file: 
/home/cvs/james-server/src/java/org/apache/james/services/Attic/MailRepository.java,v
  retrieving revision 1.4.4.3
  retrieving revision 1.4.4.4
  diff -u -r1.4.4.3 -r1.4.4.4
  --- MailRepository.java       28 Aug 2003 16:22:37 -0000      1.4.4.3
  +++ MailRepository.java       28 Aug 2003 16:32:02 -0000      1.4.4.4
  @@ -113,9 +113,9 @@
       void remove(MailImpl mail) throws MessagingException;
   
       /**
  -     * Remove the messages in the collection mails from the repository
  +     * Remove an Collection of mails from the repository
        *
  -     * @param mails
  +     * @param mails The Collection of <code>MailImpl</code>'s to delete
        * @since 2.2.0
        */
        void remove(Collection mails) throws MessagingException;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to