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 pg...@apache.org on 2002/10/14 10:56:18 UTC

cvs commit: jakarta-james/proposals/imap/java/org/apache/james/imapserver IMAPSystem.java SimpleSystem.java JamesHost.java

pgoldstein    2002/10/14 01:56:18

  Modified:    proposals/imap/java/org/apache/james/imapserver
                        IMAPSystem.java SimpleSystem.java JamesHost.java
  Log:
  Removed internal interfaces from externally exported interfaces.
  Readjusted code so that classes that usefully implemented the internal
  worker interfaces kept them, those that didn't had them removed.
  Some spacing adjustments to bring code into line with the
  remainder of the code base.
  Partial correction of the "seperator" misspelling - a full correction would require
  a more extensive change.
  Thanks to Peter Loffler
  
  Revision  Changes    Path
  1.5       +5 -9      jakarta-james/proposals/imap/java/org/apache/james/imapserver/IMAPSystem.java
  
  Index: IMAPSystem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/proposals/imap/java/org/apache/james/imapserver/IMAPSystem.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IMAPSystem.java	17 Sep 2002 17:00:38 -0000	1.4
  +++ IMAPSystem.java	14 Oct 2002 08:56:18 -0000	1.5
  @@ -7,9 +7,6 @@
    */
   package org.apache.james.imapserver;
   
  -import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.james.imapserver.AuthenticationException;
   
   import java.util.Iterator;
  @@ -24,8 +21,7 @@
    * @version 0.1 on 14 Dec 2000
    * @see Host
    */
  -public interface IMAPSystem
  -    extends Configurable, Contextualizable, Composable {
  +public interface IMAPSystem {
   
       String ROLE = "org.apache.james.imapserver.IMAPSystem";
   
  @@ -56,8 +52,8 @@
           throws AuthenticationException;
   
       /**
  -     * Returns the character used as a mail hierarchy seperator in a given
  -     * namespace. A namespace must use the same seperator at all levels of
  +     * Returns the character used as a mail hierarchy separator in a given
  +     * namespace. A namespace must use the same separator at all levels of
        * hierarchy.
        * <p>Recommendations (from rfc 2683) are period (US)/ full stop (Brit),
        * forward slash or backslash.
  @@ -68,8 +64,8 @@
       String getHierarchySeperator( String namespace );
   
       /**
  -     * Provides the set of namesapces a given user can access. Implementations
  -     * should but are not required to reveal all namespaces that a user can
  +     * Provides the set of namespaces a given user can access. Implementations
  +     * should, but are not required to, reveal all namespaces that a user can
        * access. Different namespaces may be handled by different
        * <code>IMAPHosts</code>
        *
  
  
  
  1.8       +9 -30     jakarta-james/proposals/imap/java/org/apache/james/imapserver/SimpleSystem.java
  
  Index: SimpleSystem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/proposals/imap/java/org/apache/james/imapserver/SimpleSystem.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SimpleSystem.java	17 Sep 2002 17:00:38 -0000	1.7
  +++ SimpleSystem.java	14 Oct 2002 08:56:18 -0000	1.8
  @@ -7,12 +7,8 @@
    */
   package org.apache.james.imapserver;
   
  +import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.context.Context;
  -import org.apache.avalon.phoenix.Block;
   import org.apache.james.imapserver.AuthenticationException;
   
   import java.net.InetAddress;
  @@ -30,33 +26,20 @@
    * @version 0.1 on 14 Dec 2000
    */
   public class SimpleSystem
  -    implements IMAPSystem, Block, Initializable {
  +    implements IMAPSystem, Component, Initializable {
   
       private static final String namespaceToken = "#";
  -    private static final String hierarchySeperator = ".";
  +    private static final String hierarchySeparator = ".";
       private static final String namespace
           = "((\"#mail.\" \".\")) ((\"#users.\" \".\")) ((\"#shared.\" \".\"))";
   
       private static String singleServer;
       private Set servers = new HashSet();
  -    private Context context;
  -    private Configuration conf;
  -    private ComponentManager compMgr;
  -
  -    public void configure(Configuration conf) throws ConfigurationException {
  -        this.conf = conf;
  -    }
  -
  -    public void contextualize(Context context) {
  -        this.context = context;
  -    }
  -
  -    public void compose(ComponentManager comp) {
  -        compMgr = comp;
  -    }
   
  +    /**
  +     * @see org.apache.avalon.framework.activity.Initializable#initialize()
  +     */
       public void initialize() throws Exception {
  -        // Derive namespace and namespaceToken from conf
           String hostName = null;
           try {
               hostName = InetAddress.getLocalHost().getHostName();
  @@ -93,8 +76,8 @@
       }
   
       /**
  -     * Returns the character used as a mail hierarchy seperator in a given
  -     * namespace. A namespace must use the same seperator at all levels of
  +     * Returns the character used as a mail hierarchy separator in a given
  +     * namespace. A namespace must use the same separator at all levels of
        * hierarchy.
        * <p>Recommendations (from rfc 2683) are period (US)/ full stop (Brit),
        * forward slash or backslash.
  @@ -103,7 +86,7 @@
        * @return char, usually '.', '/', or '\'
        */
       public String getHierarchySeperator(String namespace) {
  -        return hierarchySeperator;
  +        return hierarchySeparator;
       }
   
       /**
  @@ -133,7 +116,3 @@
           return Collections.unmodifiableSet(servers).iterator();
       }
   }
  -
  -
  -
  -
  
  
  
  1.9       +108 -153  jakarta-james/proposals/imap/java/org/apache/james/imapserver/JamesHost.java
  
  Index: JamesHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/proposals/imap/java/org/apache/james/imapserver/JamesHost.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JamesHost.java	17 Sep 2002 17:00:38 -0000	1.8
  +++ JamesHost.java	14 Oct 2002 08:56:18 -0000	1.9
  @@ -8,6 +8,7 @@
   package org.apache.james.imapserver;
   
   import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.configuration.Configurable;
  @@ -16,7 +17,6 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.phoenix.Block;
   import org.apache.james.imapserver.AccessControlException;
   import org.apache.james.imapserver.AuthorizationException;
   import org.apache.james.services.MailServer;
  @@ -49,12 +49,13 @@
    */
   public class JamesHost
           extends AbstractLogEnabled
  -        implements Host, Block, Configurable, Composable, Contextualizable, Initializable {
  -            
  +        implements Host, Component, Composable, 
  +                   Configurable, Contextualizable, Initializable {
  +
       private Context context;
       private Configuration conf;
       private ComponentManager compMgr;
  -    private String rootPath; // ends with File.seperator
  +    private String rootPath; // ends with File.separator
       private IMAPSystem imapSystem;
       private UsersRepository localUsers;
       private RecordRepository recordRep;
  @@ -101,24 +102,31 @@
   
       /* No constructor */
   
  -    public void configure( Configuration conf ) throws ConfigurationException
  -    {
  -        this.conf = conf;
  -    }
  -
  -    public void contextualize( Context context )
  -    {
  +    /**
  +     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
  +     */
  +    public void contextualize( Context context ) {
           this.context = context;
       }
   
  -    public void compose( ComponentManager comp )
  -    {
  +    /**
  +     * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
  +     */
  +    public void compose( ComponentManager comp ) {
           compMgr = comp;
       }
   
  -    public void initialize() throws Exception
  -    {
  +    /**
  +     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
  +     */
  +    public void configure( Configuration conf ) throws ConfigurationException {
  +        this.conf = conf;
  +    }
   
  +    /**
  +     * @see org.apache.avalon.framework.activity.Initializable#initialize()
  +     */
  +    public void initialize() throws Exception {
           getLogger().info( "JamesHost init..." );
   
           imapSystem = (IMAPSystem) compMgr.lookup( IMAPSystem.ROLE );
  @@ -149,17 +157,15 @@
       }
   
       /**
  -     *  Checks that the Directory provided exists and is writable, creating it if it is not.
  +     *  Checks that the Directory provided exists and is writeable, creating it if it is not.
        */
  -    private void prepareDir( String dir )
  -    {
  +    private void prepareDir( String dir ) {
           File newFolder = new File( dir );
           if ( !newFolder.isDirectory() ) {
               if ( !newFolder.mkdir() ) {
                   throw new RuntimeException( "Error: Cannot create directory: " + dir );
               }
  -        }
  -        else if ( !newFolder.canWrite() ) {
  +        } else if ( !newFolder.canWrite() ) {
               throw new RuntimeException( "Error: Cannot write to directory: " + dir );
           }
       }
  @@ -173,8 +179,7 @@
        * @return true if inbox (and private mailfolders) are accessible through
        * this host.
        */
  -    public boolean isHomeServer( String username )
  -    {
  +    public boolean isHomeServer( String username ) {
           return localUsers.contains( username );
       }
   
  @@ -187,8 +192,7 @@
        * @return true if the specified user has at least read access to any
        * mailboxes on this host.
        */
  -    public boolean hasLocalAccess( String username )
  -    {
  +    public boolean hasLocalAccess( String username ) {
           return localUsers.contains( username );
       }
   
  @@ -205,23 +209,19 @@
        * @throws MailboxException if mailbox does not exist locally.
        */
       public synchronized ACLMailbox getMailbox( String user, String mailboxName )
  -            throws AccessControlException, MailboxException
  -    {
  +            throws AccessControlException, MailboxException {
           Assert.isTrue( Assert.ON &&
                          user != null &&
                          user.length() > 0 &&
                          mailboxName != null );
   
           getLogger().debug( "Getting mailbox " + mailboxName + " for " + user );
  -
           String absoluteName = getAbsoluteMailboxName( user, mailboxName );
  -
           return getAbsoluteMailbox( user, absoluteName );
       }
   
       private synchronized ACLMailbox getAbsoluteMailbox( String user, String absoluteName )
  -            throws AccessControlException, MailboxException
  -    {
  +            throws AccessControlException, MailboxException {
           Assert.isTrue( Assert.ON &&
                          user != null &&
                          absoluteName.startsWith( NAMESPACE_TOKEN ) );
  @@ -230,30 +230,26 @@
           FolderRecord record = null;
   
           // Has a folder with this name ever been created?
  -        System.out.println("THISISTHEFUCKING ABSOLUETENAME IN getAbsoluteMailbox "+absoluteName);
  +        System.out.println("THISISTHE ABSOLUTENAME IN getAbsoluteMailbox " + absoluteName);
           if ( !recordRep.containsRecord( absoluteName ) ) {
               throw new MailboxException( "Mailbox: " + absoluteName + " has never been created.", MailboxException.NOT_LOCAL );
  -        }
  -        else {
  +        } else {
               record = recordRep.retrieve( absoluteName );
               if ( record.isDeleted() ) {
                   throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
  -            }
  -            else if ( openMailboxes.contains( absoluteName ) ) {
  +            } else if ( openMailboxes.contains( absoluteName ) ) {
                   mailbox = openMailboxes.getMailbox( absoluteName );
                   if ( ! mailbox.hasLookupRights( user ) ) {
                       throw new AccessControlException( "No lookup rights." );
                   }
                   openMailboxes.addReference( absoluteName );
                   return mailbox;
  -            }
  -            else {
  +            } else {
                   String owner = record.getUser();
                   String key = getPath( absoluteName );
                   ObjectInputStream in = null;
                   try {
                       // SK:UPDATE
  -                    
                       in = new ObjectInputStream( new FileInputStream( key + File.separator + FileMailbox.MAILBOX_FILE_NAME ) );
                       mailbox = (FileMailbox) in.readObject();
                       setupLogger( mailbox );
  @@ -261,12 +257,10 @@
                       mailbox.contextualize( context );
                       mailbox.compose( compMgr );
                       mailbox.reinitialize();
  -                }
  -                catch ( Exception e ) {
  +                } catch ( Exception e ) {
                       e.printStackTrace();
                       throw new RuntimeException( "Exception caught while reading FileMailbox: " + e );
  -                }
  -                finally {
  +                } finally {
                       if ( in != null ) {
                           try {
                               in.close();
  @@ -325,7 +319,7 @@
   
       private synchronized ACLMailbox createAbsoluteMailbox( String user, String absoluteName )
               throws AccessControlException, AuthorizationException, MailboxException {
  -                
  +
           Assert.isTrue( Assert.ON &&
                          absoluteName.startsWith( NAMESPACE_TOKEN ) &&
                          absoluteName.indexOf( HIERARCHY_SEPARATOR ) != -1 );
  @@ -360,7 +354,7 @@
                   throw new AuthorizationException( "User does not have create rights." );
               }
               try {
  -                //BUG! Here MUST be used a Factory for using FILE / JDBC !!!
  +                //TODO: BUG! Here MUST be used a Factory for using FILE / JDBC !!!
                   mailbox = new FileMailbox();
                   setupLogger( mailbox );
                   mailbox.configure( conf );
  @@ -368,8 +362,7 @@
                   mailbox.compose( compMgr );
                   mailbox.prepareMailbox( user, absoluteName, user, recordRep.nextUIDValidity() );
                   mailbox.initialize();
  -            }
  -            catch ( Exception e ) {
  +            } catch ( Exception e ) {
                   getLogger().error( "Exception creating mailbox: " + e );
                   throw new MailboxException( "Exception creating mailbox: " + e );
               }
  @@ -386,7 +379,7 @@
       /**
        * Releases a reference to a mailbox, allowing Host to do any housekeeping.
        *
  -     * @param mbox a non-null reference to an ACL Mailbox.
  +     * @param mailbox a non-null reference to an ACL Mailbox.
        */
       public void releaseMailbox( String user, ACLMailbox mailbox )
       {
  @@ -416,13 +409,11 @@
                   mailbox.dispose();
                   mailbox = null;
                   getLogger().info( "Mailbox object destroyed: " + absoluteName );
  -            }
  -            catch ( Exception e ) {
  +            } catch ( Exception e ) {
                   getLogger().error( "Exception destroying mailbox object: " + e );
                   e.printStackTrace();
               }
  -        }
  -        else {
  +        } else {
               getLogger().info( "Mailbox " + absoluteName + " now has " + count + "live references" );
           }
       }
  @@ -444,8 +435,7 @@
        * @see FolderRecord
        */
       public boolean deleteMailbox( String user, String mailboxName )
  -            throws MailboxException, AuthorizationException, AccessControlException
  -    {
  +            throws MailboxException, AuthorizationException, AccessControlException {
           Assert.isTrue( Assert.ON &&
                          user != null &&
                          mailboxName != null &&
  @@ -458,8 +448,7 @@
       }
   
       private boolean deleteAbsoluteMailbox( String user, String absoluteName )
  -            throws MailboxException, AuthorizationException, AccessControlException
  -    {
  +            throws MailboxException, AuthorizationException, AccessControlException {
           if ( ! recordRep.containsRecord( absoluteName ) ) {
               throw new MailboxException( "Mailbox doesn't exist" );
           }
  @@ -479,15 +468,13 @@
           if ( ! childList.isEmpty() ) {
               if ( mailbox.isNotSelectableByAnyone() ) {
                   throw new MailboxException( "Mailbox with \\Noselect AND subfolders cannot be deleted" );
  -            }
  -            else {
  +            } else {
                   // Delete and expunge all messages, and set NotSelectableByAnyone.
                   deleteAllMessages( mailbox, user );
                   mailbox.setNotSelectableByAnyone( true );
                   releaseMailbox( user, mailbox );
               }
  -        }
  -        else {
  +        } else {
               deleteAllMessages( mailbox, user );
               Assert.isTrue( Assert.ON &&
                              mailbox.getExists() == 0 );
  @@ -499,8 +486,8 @@
           return true;
       }
   
  -    private void deleteAllMessages( ACLMailbox mailbox, String user ) throws AccessControlException, AuthorizationException
  -    {
  +    private void deleteAllMessages( ACLMailbox mailbox, String user )
  +            throws AccessControlException, AuthorizationException {
           // Delete all messages in this box
           int messageCount = mailbox.getExists();
           for ( int i = 0; i < messageCount; i++ ) {
  @@ -556,10 +543,10 @@
                   while(strl.hasMoreTokens()) {
                       String token = strl.nextToken();
                       if(token.equals("\""+this.HIERARCHY_SEPARATOR+"\"") || mbxfound) {
  -                        // This must be the FileSeperator Token. After that comes the name of the Mailbox
  +                        // This must be the FileSeparator Token. After that comes the name of the Mailbox
                           if(mbxfound){
                               mailboxname += " "+token;
  -                        }else{
  +                        } else {
                               mailboxname += strl.nextToken();
                           }
                           mbxfound=true;
  @@ -578,13 +565,17 @@
                       HashSet hs = new HashSet();
                       hs.add(mailboxname);
                       tr.put(new Integer(strl.countTokens()), hs);
  -                }else{
  +                } else {
                       HashSet hs = (HashSet) oldcoll;
                       hs.add(mailboxname);
                       tr.put(new Integer(strl.countTokens()), hs);
                   }
  -                if(maxdepth<strl.countTokens()) maxdepth=strl.countTokens();
  -                if(mindepth>strl.countTokens()) mindepth=strl.countTokens();
  +                if(maxdepth<strl.countTokens()) {
  +                    maxdepth=strl.countTokens();
  +                }
  +                if(mindepth>strl.countTokens()) {
  +                    mindepth=strl.countTokens();
  +                }
               }
               System.out.println("RENAME: POSSIBLE MAXDEPTH FOUND: "+maxdepth+" THE MINDEPTH IS "+mindepth);
               for(int i=maxdepth;i>=0;i--) {
  @@ -620,7 +611,7 @@
                               // Remove old entry from openMailboxes and create a new one
                               this.openMailboxes.removeMailbox(suboldabsolutename);
                               this.openMailboxes.addMailbox(subnewabsolutename,mmm);
  -                        }else{
  +                        } else {
                               // RENAME MAILBOX MAIN
                               System.out.println("NEWMAILBOXNAME WILL BE "+newMailboxName);
                               if (mmm.renameMailbox(user, newMailboxName)) {
  @@ -647,7 +638,7 @@
                                   mailbox = getAbsoluteMailbox( user, absolutenewName );
                                   this.openMailboxes.addMailbox(absolutenewName,mailbox);
                                   return true;
  -                            }else{
  +                            } else {
                                   return false;
                               }
                           }
  @@ -655,9 +646,9 @@
                   }
               }
               return false;
  -        }catch(Exception e){
  +        } catch (Exception e) {
               e.printStackTrace();
  -            throw new AuthorizationException("You have no rights for changing the Mailbox Name");
  +            throw new AuthorizationException("You have insufficient permission to change the Mailbox Name");
           }
       }
   
  @@ -668,8 +659,7 @@
        * @param username String an email address
        * @return a String of a namespace
        */
  -    public String getDefaultNamespace( String username )
  -    {
  +    public String getDefaultNamespace( String username ) {
           return PRIVATE_NAMESPACE_PREFIX;
       }
   
  @@ -753,13 +743,11 @@
               String userTarget;
               if ( mailboxName.startsWith( NAMESPACE_TOKEN ) ) {
                   userTarget = mailboxName;
  -            }
  -            else {
  +            } else {
                   if ( referenceName.length() == 0 ||
                           referenceName.endsWith( HIERARCHY_SEPARATOR ) ) {
                       userTarget = referenceName + mailboxName;
  -                }
  -                else {
  +                } else {
                       userTarget = referenceName + HIERARCHY_SEPARATOR + mailboxName;
                   }
               }
  @@ -806,12 +794,10 @@
   
                   if ( starWildcard ) {
                       match = testMailboxName.startsWith( targetMatch );
  -                }
  -                else if ( percentWildcard ) {
  +                } else if ( percentWildcard ) {
                       match = (testMailboxName.startsWith( targetMatch )
                               && testMailboxName.lastIndexOf( HIERARCHY_SEPARATOR ) < targetMatch.length());
  -                }
  -                else {
  +                } else {
                       // no wildcards so exact or nothing
                       match = testMailboxName.equals( target );
                       getLogger().debug( "match/ no match at testMailboxName 1" );
  @@ -836,27 +822,23 @@
                       }
                       if ( record.isDeleted() ) {
                           buf.append( "\\Noselect" );
  -                    }
  -                    else if ( openMailboxes.contains( target ) ) {
  +                    } else if ( openMailboxes.contains( target ) ) {
                           mailbox = openMailboxes.getMailbox( target );
                           if ( !mailbox.isSelectable( username ) ) {
                               buf.append( "\\Noselect" );
                           }
                           if ( mailbox.isMarked() ) {
                               buf.append( "\\Marked" );
  -                        }
  -                        else {
  +                        } else {
                               buf.append( "\\Unmarked" );
                           }
  -                    }
  -                    else {
  +                    } else {
                           if ( !record.isSelectable( username ) ) {
                               buf.append( "\\Noselect" );
                           }
                           if ( record.isMarked() ) {
                               buf.append( "\\Marked" );
  -                        }
  -                        else {
  +                        } else {
                               buf.append( "\\Unmarked" );
                           }
                       }
  @@ -881,11 +863,9 @@
       {
           if ( mailbox.startsWith( USER_NAMESPACE_PREFIX ) ) {
               return USER_NAMESPACE_PREFIX;
  -        }
  -        else if ( mailbox.startsWith( SHARE_NAMESPACE_PREFIX ) ) {
  +        } else if ( mailbox.startsWith( SHARE_NAMESPACE_PREFIX ) ) {
               return SHARE_NAMESPACE_PREFIX;
  -        }
  -        else {
  +        } else {
               return PRIVATE_NAMESPACE_PREFIX;
           }
       }
  @@ -977,13 +957,11 @@
           // Has a folder with this name ever been created?
           if ( !recordRep.containsRecord( absoluteName ) ) {
               throw new MailboxException( "Mailbox: " + absoluteName + " has never been created.", MailboxException.NOT_LOCAL );
  -        }
  -        else {
  +        } else {
               record = recordRep.retrieve( absoluteName );
               if ( record.isDeleted() ) {
                   throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
  -            }
  -            else if ( openMailboxes.contains( absoluteName ) ) {
  +            } else if ( openMailboxes.contains( absoluteName ) ) {
                   response = new String();
                   mailbox = openMailboxes.getMailbox( absoluteName );
                   if ( !mailbox.hasLookupRights( username ) ) {
  @@ -993,17 +971,13 @@
                       String dataItem = (String) it.next();
                       if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
                           response += "MESSAGES " + mailbox.getExists();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
  +                    } else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
                           response += "RECENT " + mailbox.getRecent();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
  +                    } else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
                           response += "UIDNEXT " + mailbox.getNextUID();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
  +                    } else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
                           response += "UIDVALIDITY " + mailbox.getUIDValidity();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
  +                    } else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
                           response += "UNSEEN " + mailbox.getUnseen( username );
                       }
                       if ( it.hasNext() ) {
  @@ -1020,19 +994,15 @@
                   while ( it.hasNext() ) {
                       String dataItem = (String) it.next();
                       if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
  -                        response += "MESSAGES " + record.getExists();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
  -                        response += "RECENT " + record.getRecent();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
  -                        response += "UIDNEXT " + (record.getHighestUid() + 1);
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
  -                        response += "UIDVALIDITY " + record.getUidValidity();
  -                    }
  -                    else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
  -                        response += "UNSEEN " + record.getUnseen( username );
  +                        response += "MESSAGES" + " " + record.getExists();
  +                    } else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
  +                        response += "RECENT" + " " + record.getRecent();
  +                    } else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
  +                        response += "UIDNEXT" + " " + (record.getHighestUid() + 1);
  +                    } else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
  +                        response += "UIDVALIDITY" + " " + record.getUidValidity();
  +                    } else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
  +                        response += "UNSEEN" + " " + record.getUnseen( username );
                       }
                       if ( it.hasNext() ) {
                           response += " ";
  @@ -1097,8 +1067,7 @@
        * @param absoluteName the user-independent name of the mailbox
        * @param owner string name of owner of mailbox
        */
  -    String getPath( String absoluteName )
  -    {
  +    String getPath( String absoluteName ) {
           Assert.isTrue( Assert.ON &&
                          absoluteName.startsWith( NAMESPACE_TOKEN ) );
   
  @@ -1108,8 +1077,7 @@
           return rootPath + filePath;
       }
   
  -    public boolean createPrivateMailAccount( String user )
  -    {
  +    public boolean createPrivateMailAccount( String user ) {
           Assert.isTrue( Assert.ON &&
                          user != null &&
                          user.length() > 0 );
  @@ -1165,84 +1133,71 @@
           return true;
       }
   
  -    private static final class OpenMailboxes
  -    {
  +    private static final class OpenMailboxes {
  +
           private Map _mailboxes = new HashMap();
   
  -        boolean contains( String absoluteName )
  -        {
  +        boolean contains( String absoluteName ) {
               return _mailboxes.containsKey( absoluteName );
           }
   
  -        private OpenMailbox getOpen( String absoluteName )
  -        {
  +        private OpenMailbox getOpen( String absoluteName ) {
               return (OpenMailbox)_mailboxes.get( absoluteName );
           }
   
  -        void addMailbox( String absoluteName, ACLMailbox mailbox )
  -        {
  +        void addMailbox( String absoluteName, ACLMailbox mailbox ) {
               OpenMailbox openMailbox = new OpenMailbox( mailbox );
               _mailboxes.put( absoluteName, openMailbox );
           }
   
  -        void removeMailbox( String absoluteName )
  -        {
  +        void removeMailbox( String absoluteName ) {
               _mailboxes.remove( absoluteName );
           }
   
  -        ACLMailbox getMailbox( String absoluteName )
  -        {
  +        ACLMailbox getMailbox( String absoluteName ) {
               return getOpen( absoluteName ).getMailbox();
           }
   
  -        int addReference( String absoluteName )
  -        {
  +        int addReference( String absoluteName ) {
               return getOpen( absoluteName ).addReference();
           }
   
  -        int removeReference( String absoluteName )
  -        {
  +        int removeReference( String absoluteName ) {
               return getOpen( absoluteName ).removeReference();
           }
   
  -        int getReferenceCount( String absoluteName )
  -        {
  +        int getReferenceCount( String absoluteName ) {
               OpenMailbox openMailbox = getOpen( absoluteName );
               if ( openMailbox == null ) {
                   return 0;
  -            }
  -            else {
  +            } else {
                   return openMailbox.getReferenceCount();
               }
           }
       }
   
  -    private static final class OpenMailbox
  -    {
  +    private static final class OpenMailbox {
           private ACLMailbox _mailbox;
           private int _referenceCount;
   
  -        OpenMailbox( ACLMailbox mailbox )
  -        {
  +        OpenMailbox( ACLMailbox mailbox ) {
               _mailbox = mailbox;
               _referenceCount = 1;
           }
   
  -        ACLMailbox getMailbox()
  -        {
  +        ACLMailbox getMailbox() {
               return _mailbox;
           }
  -        int getReferenceCount()
  -        {
  +
  +        int getReferenceCount() {
               return _referenceCount;
           }
   
  -        int addReference()
  -        {
  +        int addReference() {
               return ++_referenceCount;
           }
  -        int removeReference()
  -        {
  +
  +        int removeReference() {
               return --_referenceCount;
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>