james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r472978 - in /james/server/sandbox/mailet-refactorings/src: java/org/apache/james/ java/org/apache/james/core/ java/org/apache/james/fetchmail/ java/org/apache/james/imapserver/store/ java/org/apache/james/smtpserver/core/filter/ java/org/a...
Date Thu, 09 Nov 2006 16:57:43 GMT
Author: danny
Date: Thu Nov  9 08:57:41 2006
New Revision: 472978

URL: http://svn.apache.org/viewvc?view=rev&rev=472978
Log:
normalised MailAddress getUser to getLocalPart 

Modified:
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/James.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/core/LocalUsersRepository.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/fetchmail/MessageProcessor.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/RcptFilterCmdHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ReverseEqualsEhloHeloHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/CommandListservManager.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/GenericListservManager.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/PostmasterAlias.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/XMLVirtualUserTable.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/listservcommands/BaseCommand.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/smime/AbstractSign.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandForListserv.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandListservMatcher.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/UserIs.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailAddress.java
    james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/UsersRepository.java
    james/server/sandbox/mailet-refactorings/src/test/org/apache/james/userrepository/MockUsersRepositoryTest.java

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/James.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/James.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/James.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/James.java Thu Nov
 9 08:57:41 2006
@@ -717,7 +717,7 @@
         if (!isLocalServer(mailAddress.getHost())) {
             return false;
         }
-        return localusers.contains(mailAddress.getUser());
+        return localusers.contains(mailAddress.getLocalPart());
     }
 
     /**
@@ -917,7 +917,7 @@
      * @see org.apache.mailet.MailetContext#getMailRepository(org.apache.mailet.MailAddress)
      */
     public MailRepository getMailRepository(MailAddress recipient)  {
-        return getUserInbox(recipient.getUser());
+        return getUserInbox(recipient.getLocalPart());
     }
 
     /**

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/core/LocalUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/core/LocalUsersRepository.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/core/LocalUsersRepository.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/core/LocalUsersRepository.java
Thu Nov  9 08:57:41 2006
@@ -68,13 +68,7 @@
     public boolean addUser(User user) {
         return users.addUser(user);
     }
-    
-    /**
-     * @see org.apache.mailet.UsersRepository#addUser(java.lang.String, java.lang.Object)
-     */
-    public void addUser(String name, Object attributes) {
-        users.addUser(name,attributes);
-    }
+   
 
     /**
      * @see org.apache.mailet.UsersRepository#addUser(java.lang.String, java.lang.String)
@@ -125,12 +119,7 @@
         return users.contains(name);
     }
 
-    /**
-     * @see org.apache.mailet.UsersRepository#containsCaseInsensitive(java.lang.String)
-     */
-    public boolean containsCaseInsensitive(String name) {
-        return users.containsCaseInsensitive(name);
-    }
+    
 
     /**
      * @see org.apache.mailet.UsersRepository#test(java.lang.String, java.lang.String)

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/fetchmail/MessageProcessor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/fetchmail/MessageProcessor.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/fetchmail/MessageProcessor.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/fetchmail/MessageProcessor.java
Thu Nov  9 08:57:41 2006
@@ -882,7 +882,7 @@
      */
     protected boolean isLocalRecipient(MailAddress recipient)
     {
-        return isLocalServer(recipient) && getLocalUsers().contains(recipient.getUser());
+        return isLocalServer(recipient) && getLocalUsers().contains(recipient.getLocalPart());
     }
     
     /**

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
Thu Nov  9 08:57:41 2006
@@ -419,7 +419,7 @@
             buf.append( SP);
             try {
                 MailAddress mailAddr = new MailAddress(netAddr);
-                buf.append(Q + mailAddr.getUser() + Q);
+                buf.append(Q + mailAddr.getLocalPart() + Q);
                 buf.append(SP);
                 buf.append(Q + mailAddr.getHost() + Q);
             } catch (ParseException pe) {

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/RcptFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/RcptFilterCmdHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/RcptFilterCmdHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/RcptFilterCmdHandler.java
Thu Nov  9 08:57:41 2006
@@ -173,7 +173,7 @@
                         String authUser = (session.getUser()).toLowerCase(Locale.US);
                         MailAddress senderAddress = (MailAddress) session.getState().get(SMTPSession.SENDER);
 
-                        if ((senderAddress == null) || (!authUser.equals(senderAddress.getUser()))
||
+                        if ((senderAddress == null) || (!authUser.equals(senderAddress.getLocalPart()))
||
                             (!session.getConfigurationData().getMailServer().isLocalServer(senderAddress.getHost())))
{
                             responseString = "503 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SECURITY_AUTH)+"
Incorrect Authentication for Specified Email Address";
                             session.writeResponse(responseString);

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
Thu Nov  9 08:57:41 2006
@@ -264,8 +264,8 @@
                 !(session.isAuthRequired() && session
                         .getUser() != null) && // Not (SMTP AUTH is enabled and
                                                 // not authenticated)
-                !(recipientAddress.getUser().equalsIgnoreCase("postmaster") || recipientAddress
-                        .getUser().equalsIgnoreCase("abuse"))) {
+                !(recipientAddress.getLocalPart().equalsIgnoreCase("postmaster") || recipientAddress
+                        .getLocalPart().equalsIgnoreCase("abuse"))) {
 
             // trying to send e-mail to other than postmaster or abuse
             if (blocklistedDetail != null) {

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
Thu Nov  9 08:57:41 2006
@@ -157,8 +157,8 @@
 
         // not reject it
         if (session.getState().get(BAD_EHLO_HELO) == null
-                || rcpt.getUser().equalsIgnoreCase("postmaster")
-                || rcpt.getUser().equalsIgnoreCase("abuse"))
+                || rcpt.getLocalPart().equalsIgnoreCase("postmaster")
+                || rcpt.getLocalPart().equalsIgnoreCase("abuse"))
             return;
 
         // Check if the client was authenticated

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ReverseEqualsEhloHeloHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ReverseEqualsEhloHeloHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ReverseEqualsEhloHeloHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ReverseEqualsEhloHeloHandler.java
Thu Nov  9 08:57:41 2006
@@ -157,8 +157,8 @@
 
         // not reject it
         if (session.getState().get(BAD_EHLO_HELO) == null
-                || rcpt.getUser().equalsIgnoreCase("postmaster")
-                || rcpt.getUser().equalsIgnoreCase("abuse"))
+                || rcpt.getLocalPart().equalsIgnoreCase("postmaster")
+                || rcpt.getLocalPart().equalsIgnoreCase("abuse"))
             return;
 
         // Check if the client was authenticated

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
Thu Nov  9 08:57:41 2006
@@ -245,8 +245,8 @@
 
         // Check if the recipient is postmaster or abuse..
         if (recipientAddress != null
-                && (recipientAddress.getUser().equalsIgnoreCase("postmaster")
-                        || recipientAddress.getUser().equalsIgnoreCase("abuse") || ((session
+                && (recipientAddress.getLocalPart().equalsIgnoreCase("postmaster")
+                        || recipientAddress.getLocalPart().equalsIgnoreCase("abuse") || ((session
                         .isAuthRequired() && session.getUser() != null)))) {
             
             //remove invalid data

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
Thu Nov  9 08:57:41 2006
@@ -191,14 +191,14 @@
         MailAddress rcpt = (MailAddress) session.getState().get(SMTPSession.CURRENT_RECIPIENT);
         boolean invalidUser = true;
 
-        if (session.getConfigurationData().getUsersRepository().contains(rcpt.getUser())
== true || recipients.contains(rcpt.toString().toLowerCase()) || domains.contains(rcpt.getHost().toLowerCase()))
{
+        if (session.getConfigurationData().getUsersRepository().contains(rcpt.getLocalPart())
== true || recipients.contains(rcpt.toString().toLowerCase()) || domains.contains(rcpt.getHost().toLowerCase()))
{
             invalidUser = false;
         }
 
         // check if an valid virtual mapping exists
         if (invalidUser == true  && vut == true) {
             try {
-                Collection targetString = table.getMappings(rcpt.getUser(), rcpt.getHost());
+                Collection targetString = table.getMappings(rcpt.getLocalPart(), rcpt.getHost());
         
                 if (targetString != null && targetString.isEmpty() == false) {
                     invalidUser = false;

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/CommandListservManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/CommandListservManager.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/CommandListservManager.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/CommandListservManager.java
Thu Nov  9 08:57:41 2006
@@ -323,7 +323,7 @@
      * @return the name of the command
      */
     protected String getCommandName(MailAddress mailAddress) {
-        String user = mailAddress.getUser();
+        String user = mailAddress.getLocalPart();
         int index = user.indexOf('-', listName.length());
         String commandName = user.substring(++index);
         return commandName;

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/GenericListservManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/GenericListservManager.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/GenericListservManager.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/GenericListservManager.java
Thu Nov  9 08:57:41 2006
@@ -61,7 +61,7 @@
             return;
         }
         MailAddress address = (MailAddress)mail.getRecipients().iterator().next();
-        if (address.getUser().endsWith("-off")) {
+        if (address.getLocalPart().endsWith("-off")) {
             if (existsAddress(mail.getSender())) {
                 if (removeAddress(mail.getSender())) {
                     getMailetContext().bounce(mail, "Successfully removed from listserv.");
@@ -71,7 +71,7 @@
             } else {
                 getMailetContext().bounce(mail, "You are not subscribed to this listserv.");
             }
-        } else if (address.getUser().endsWith("-on")) {
+        } else if (address.getLocalPart().endsWith("-on")) {
             if (existsAddress(mail.getSender())) {
                 getMailetContext().bounce(mail, "You are already subscribed to this listserv.");
             } else {

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
Thu Nov  9 08:57:41 2006
@@ -178,7 +178,7 @@
                 ResultSet mappingRS = null;
                 try {
                     MailAddress source = (MailAddress)i.next();
-                    mappingStmt.setString(1, source.getUser());
+                    mappingStmt.setString(1, source.getLocalPart());
                     mappingStmt.setString(2, source.getHost());
                     mappingStmt.setString(3, source.getHost());
                     mappingRS = mappingStmt.executeQuery();

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/PostmasterAlias.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/PostmasterAlias.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/PostmasterAlias.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/PostmasterAlias.java
Thu Nov  9 08:57:41 2006
@@ -55,7 +55,7 @@
 
         for (Iterator i = recipients.iterator(); i.hasNext(); ) {
             MailAddress addr = (MailAddress)i.next();
-            if (addr.getUser().equalsIgnoreCase("postmaster") &&
+            if (addr.getLocalPart().equalsIgnoreCase("postmaster") &&
                 mailetContext.isLocalServer(addr.getHost())) {
                 //Should remove this address... we want to replace it with
                 //  the server's postmaster address

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/ToMultiRepository.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
Thu Nov  9 08:57:41 2006
@@ -197,7 +197,7 @@
             throw new IllegalArgumentException(
                     "Mail message to be spooled cannot be null.");
         }
-        username = recipient.getUser();
+        username = recipient.getLocalPart();
 
         Collection recipients = new HashSet();
         recipients.add(recipient);

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/UsersRepositoryAliasingForwarding.java
Thu Nov  9 08:57:41 2006
@@ -161,7 +161,7 @@
         if (usersRepository instanceof VirtualUserTable) {
             Collection mappings;
             try {
-                mappings = ((VirtualUserTable) usersRepository).getMappings(recipient.getUser(),
recipient.getHost());
+                mappings = ((VirtualUserTable) usersRepository).getMappings(recipient.getLocalPart(),
recipient.getHost());
             } catch (ErrorMappingException e) {
                 StringBuffer errorBuffer = new StringBuffer(128)
                     .append("A problem as occoured trying to alias and forward user ")
@@ -226,7 +226,7 @@
                 .append(" does not implement VirtualUserTable interface).");
             getMailetContext().log(errorBuffer.toString());
         }
-        String realName = usersRepository.getRealName(recipient.getUser());
+        String realName = usersRepository.getRealName(recipient.getLocalPart());
         if (realName != null) {
             ArrayList ret = new ArrayList();
             ret.add(new MailAddress(realName, recipient.getHost()));

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
Thu Nov  9 08:57:41 2006
@@ -326,7 +326,7 @@
      * list and inserts in it otherwise.
      */    
     private void checkAndInsert(MailAddress senderMailAddress, Collection recipients) throws
MessagingException {
-        String senderUser = senderMailAddress.getUser().toLowerCase(Locale.US);
+        String senderUser = senderMailAddress.getLocalPart().toLowerCase(Locale.US);
         String senderHost = senderMailAddress.getHost().toLowerCase(Locale.US);
         
         senderUser = getPrimaryName(senderUser);
@@ -342,7 +342,7 @@
                 ResultSet selectRS = null;
                 try {
                     MailAddress recipientMailAddress = (MailAddress)i.next();
-                    String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
+                    String recipientUser = recipientMailAddress.getLocalPart().toLowerCase(Locale.US);
                     String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
                     
                     if (getMailetContext().isLocalServer(recipientHost)) {
@@ -410,7 +410,7 @@
     private void manageDisplayRequest(Mail mail)
     throws MessagingException {
         MailAddress senderMailAddress = mail.getSender();
-        String senderUser = senderMailAddress.getUser().toLowerCase(Locale.US);
+        String senderUser = senderMailAddress.getLocalPart().toLowerCase(Locale.US);
         String senderHost = senderMailAddress.getHost().toLowerCase(Locale.US);
         
         senderUser = getPrimaryName(senderUser);
@@ -459,7 +459,7 @@
     private void manageInsertRequest(Mail mail)
     throws MessagingException {
         MailAddress senderMailAddress = mail.getSender();
-        String senderUser = senderMailAddress.getUser().toLowerCase(Locale.US);
+        String senderUser = senderMailAddress.getLocalPart().toLowerCase(Locale.US);
         String senderHost = senderMailAddress.getHost().toLowerCase(Locale.US);
         
         senderUser = getPrimaryName(senderUser);
@@ -494,7 +494,7 @@
                         catch (javax.mail.internet.ParseException pe) {
                             continue;
                         }
-                        String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
+                        String recipientUser = recipientMailAddress.getLocalPart().toLowerCase(Locale.US);
                         String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
                         
                         if (getMailetContext().isLocalServer(recipientHost)) {
@@ -582,7 +582,7 @@
     private void manageRemoveRequest(Mail mail)
     throws MessagingException {
         MailAddress senderMailAddress = mail.getSender();
-        String senderUser = senderMailAddress.getUser().toLowerCase(Locale.US);
+        String senderUser = senderMailAddress.getLocalPart().toLowerCase(Locale.US);
         String senderHost = senderMailAddress.getHost().toLowerCase(Locale.US);
         
         senderUser = getPrimaryName(senderUser);
@@ -617,7 +617,7 @@
                         catch (javax.mail.internet.ParseException pe) {
                             continue;
                         }
-                        String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
+                        String recipientUser = recipientMailAddress.getLocalPart().toLowerCase(Locale.US);
                         String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
                         
                         if (getMailetContext().isLocalServer(recipientHost)) {

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/XMLVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/XMLVirtualUserTable.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/XMLVirtualUserTable.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/XMLVirtualUserTable.java
Thu Nov  9 08:57:41 2006
@@ -83,7 +83,7 @@
         
       for (Iterator i = recipients.iterator(); i.hasNext(); ) {
           MailAddress source = (MailAddress)i.next();
-          String user = source.getUser().toLowerCase();
+          String user = source.getLocalPart().toLowerCase();
           String domain = source.getHost().toLowerCase();
     
           String targetString = VirtualUserTableUtil.getTargetString(user, domain, mappings);

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/listservcommands/BaseCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/listservcommands/BaseCommand.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/listservcommands/BaseCommand.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/listservcommands/BaseCommand.java
Thu Nov  9 08:57:41 2006
@@ -161,7 +161,7 @@
         MailAddress senderAddress = origMail.getSender();
         try {
             MimeMessage mimeMessage = generateMail(senderAddress.toString(),
-                    senderAddress.getUser(),
+                    senderAddress.getLocalPart(),
                     getCommandListservManager().getListOwner(),
                     getCommandListservManager().getListName(true),
                     subject,

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/smime/AbstractSign.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/smime/AbstractSign.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/smime/AbstractSign.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/smime/AbstractSign.java
Thu Nov  9 08:57:41 2006
@@ -580,7 +580,7 @@
             }
         } else {
             // is the reverse-path user different from the SMTP authorized user?
-            if (!reversePath.getUser().equals(authUser)) {
+            if (!reversePath.getLocalPart().equals(authUser)) {
                 return false;
             }
             // is there no "From:" address same as the reverse-path?

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandForListserv.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandForListserv.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandForListserv.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandForListserv.java
Thu Nov  9 08:57:41 2006
@@ -48,8 +48,8 @@
      */
     public boolean matchRecipient(MailAddress recipient) {
         if (recipient.getHost().equals(listservAddress.getHost())) {
-            if (recipient.getUser().equals(listservAddress.getUser() + "-on")
-                || recipient.getUser().equals(listservAddress.getUser() + "-off")) {
+            if (recipient.getLocalPart().equals(listservAddress.getLocalPart() + "-on")
+                || recipient.getLocalPart().equals(listservAddress.getLocalPart() + "-off"))
{
                 return true;
             }
         }

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandListservMatcher.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandListservMatcher.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandListservMatcher.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/CommandListservMatcher.java
Thu Nov  9 08:57:41 2006
@@ -57,7 +57,7 @@
      */
     public boolean matchRecipient(MailAddress recipient) {
         if (recipient.getHost().equals(listservAddress.getHost())) {
-            if (recipient.getUser().startsWith(listservAddress.getUser() + "-")) {
+            if (recipient.getLocalPart().startsWith(listservAddress.getLocalPart() + "-"))
{
                 return true;
             }
         }

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
Thu Nov  9 08:57:41 2006
@@ -178,7 +178,7 @@
             return null;
         }
         
-        String senderUser = senderMailAddress.getUser();
+        String senderUser = senderMailAddress.getLocalPart();
         String senderHost = senderMailAddress.getHost();
         
         senderUser = senderUser.toLowerCase(Locale.US);
@@ -196,7 +196,7 @@
             for (Iterator i = recipients.iterator(); i.hasNext(); ) {
                 try {
                     MailAddress recipientMailAddress = (MailAddress)i.next();
-                    String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
+                    String recipientUser = recipientMailAddress.getLocalPart().toLowerCase(Locale.US);
                     String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
                     
                     if (!getMailetContext().isLocalServer(recipientHost)) {

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/UserIs.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/UserIs.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/UserIs.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/UserIs.java
Thu Nov  9 08:57:41 2006
@@ -42,7 +42,7 @@
     }
 
     public boolean matchRecipient(MailAddress recipient) {
-        return users.contains(recipient.getUser());
+        return users.contains(recipient.getLocalPart());
     }
 }
 

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailAddress.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailAddress.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailAddress.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailAddress.java Thu
Nov  9 08:57:41 2006
@@ -206,7 +206,7 @@
      *          of this email address.
      * @throws  AddressException    if the parse failed
      */
-    public String getUser() {
+    public String getLocalPart() {
         return user;
     }
 
@@ -236,7 +236,7 @@
             return toString().equalsIgnoreCase(theString);
         } else if (obj instanceof MailAddress) {
             MailAddress addr = (MailAddress)obj;
-            return getUser().equalsIgnoreCase(addr.getUser()) && getHost().equalsIgnoreCase(addr.getHost());
+            return getLocalPart().equalsIgnoreCase(addr.getLocalPart()) && getHost().equalsIgnoreCase(addr.getHost());
         }
         return false;
     }

Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/UsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/UsersRepository.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/UsersRepository.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/UsersRepository.java
Thu Nov  9 08:57:41 2006
@@ -48,23 +48,11 @@
      * @return true if succesful, false otherwise
      * @since James 1.2.2
      * 
-     * @deprecated James 2.4 user should be added using username/password
-     * because specific implementations of UsersRepository will support specific 
-     * implementations of users object.
+    
      */
     boolean addUser(User user);
 
-    /**
-     * Adds a user to the repository with the specified attributes.  In current
-     * implementations, the Object attributes is generally a String password.
-     *
-     * @param name the name of the user to be added
-     * @param attributes see decription
-     * 
-     * @deprecated James 2.4 user is always added using username/password and
-     * eventually modified by retrieving it later.
-     */
-    void addUser(String name, Object attributes);
+    
     
     /**
      * Adds a user to the repository with the specified password
@@ -133,17 +121,7 @@
      */
     boolean contains(String name);
 
-    /**
-     * Returns whether or not this user is in the repository. Names are
-     * matched on a case insensitive basis.
-     *
-     * @param name the name to check in the repository
-     * @return whether the user is in the repository
-     * 
-     * @deprecated James 2.4 now caseSensitive is a property of the repository
-     * implementations and the contains will search according to this property.
-     */
-    boolean containsCaseInsensitive(String name);
+    
 
     /**
      * Test if user with name 'name' has password 'password'.

Modified: james/server/sandbox/mailet-refactorings/src/test/org/apache/james/userrepository/MockUsersRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/test/org/apache/james/userrepository/MockUsersRepositoryTest.java?view=diff&rev=472978&r1=472977&r2=472978
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/test/org/apache/james/userrepository/MockUsersRepositoryTest.java
(original)
+++ james/server/sandbox/mailet-refactorings/src/test/org/apache/james/userrepository/MockUsersRepositoryTest.java
Thu Nov  9 08:57:41 2006
@@ -59,7 +59,7 @@
         res = usersRepository.addUser("username", "password2");
         assertFalse("User added twice!", res);
         try {
-            usersRepository.addUser("username2", (Object) "password2");
+            usersRepository.addUser("username2",  "password2");
             assertTrue(usersRepository.contains("username2"));
             User u = new DefaultJamesUser("username3","SHA","password3");
             usersRepository.addUser(u);
@@ -68,12 +68,7 @@
             
         }
         
-        try {
-            usersRepository.addUser("username2", new Object());
-            fail("adduser should throw an exception if a non string is passed");
-        } catch (Exception e) {
-            
-        }
+        
         
     }
     
@@ -84,11 +79,7 @@
         assertNotNull(user);
         assertEquals("username does not match", user.getUserName(), "username");
         assertTrue("user not contained in the repository", usersRepository.contains("username"));
-        try {
-            assertTrue("case insensitive user not found in the repository", usersRepository.containsCaseInsensitive("userName"));
-        } catch (UnsupportedOperationException e) {
-            // some implementation could not support deprecated methods
-        }
+        
         
         User u = usersRepository.getUserByName("uSERNAMe");
         assertNull("found the user searching for a different case!", u);
@@ -175,8 +166,7 @@
     public void testCaseInsensitivesMethods() {
         assertTrue("User not added", usersRepository.addUser("userName", "password"));
         try {
-            assertTrue(usersRepository.containsCaseInsensitive("usERname"));
-            assertNotNull(usersRepository.getUserByNameCaseInsensitive("userNAMe"));
+                      assertNotNull(usersRepository.getUserByNameCaseInsensitive("userNAMe"));
         } catch (UnsupportedOperationException e) {
             // some implementations do not support it.
         }



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


Mime
View raw message