james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r420948 - in /james/server/trunk/src/java/org/apache/james: smtpserver/ transport/ userrepository/ util/connection/
Date Tue, 11 Jul 2006 18:47:40 GMT
Author: berndf
Date: Tue Jul 11 11:47:39 2006
New Revision: 420948

URL: http://svn.apache.org/viewvc?rev=420948&view=rev
Log:
- add setters for service components (JAMES-494) (ongoing)
- fix javadoc

Modified:
    james/server/trunk/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SendMailHandler.java
    james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
    james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java
    james/server/trunk/src/java/org/apache/james/transport/Loader.java
    james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
    james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
    james/server/trunk/src/java/org/apache/james/util/connection/SimpleConnectionManager.java

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/EhloCmdHandler.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/EhloCmdHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/EhloCmdHandler.java Tue Jul 11
11:47:39 2006
@@ -76,7 +76,7 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager serviceMan) throws ServiceException {
-        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+        setDNSServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
     }
     
     /**
@@ -113,7 +113,7 @@
      * 
      * @param dnsServer The DNSServer
      */
-    public void setDnsServer(DNSServer dnsServer) {
+    public void setDNSServer(DNSServer dnsServer) {
         this.dnsServer = dnsServer;
     }
 

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/HeloCmdHandler.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/HeloCmdHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/HeloCmdHandler.java Tue Jul 11
11:47:39 2006
@@ -77,7 +77,8 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager serviceMan) throws ServiceException {
-        dnsServer = (DNSServer) serviceMan.lookup(DNSServer.ROLE);
+        DNSServer dnsServer = (DNSServer) serviceMan.lookup(DNSServer.ROLE);
+        setDNSServer(dnsServer);
     }
     
     /**
@@ -113,7 +114,7 @@
      * 
      * @param dnsServer The DNSServer
      */
-    public void setDnsServer(DNSServer dnsServer) {
+    public void setDNSServer(DNSServer dnsServer) {
         this.dnsServer = dnsServer;
     }
       

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java Tue Jul 11
11:47:39 2006
@@ -71,15 +71,15 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager serviceMan) throws ServiceException {
-        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+        setDNSServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
     }
     
     /**
-     * Set the DnsServer
+     * Set the DNSServer
      * 
-     * @param dnsServer The DnsServer
+     * @param dnsServer The DNSServer
      */
-    public void setDnsServer(DNSServer dnsServer) {
+    public void setDNSServer(DNSServer dnsServer) {
         this.dnsServer = dnsServer;
     }
     

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java Tue Jul 11 11:47:39
2006
@@ -130,6 +130,21 @@
 
     private ServiceManager serviceManager;
 
+    public void setMailetContext(MailetContext mailetcontext) {
+        this.mailetcontext = mailetcontext;
+    }
+
+    public void setUsers(UsersRepository users) {
+        this.users = users;
+    }
+
+    public void setMailServer(MailServer mailServer) {
+        this.mailServer = mailServer;
+    }
+
+    public void setDNSServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
 
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
@@ -137,10 +152,10 @@
     public void service( final ServiceManager manager ) throws ServiceException {
         super.service( manager );
         serviceManager = manager;
-        mailetcontext = (MailetContext) manager.lookup("org.apache.mailet.MailetContext");
-        mailServer = (MailServer) manager.lookup(MailServer.ROLE);
-        users = (UsersRepository) manager.lookup(UsersRepository.ROLE);
-        dnsServer = (DNSServer) manager.lookup(DNSServer.ROLE); 
+        setMailetContext((MailetContext) manager.lookup("org.apache.mailet.MailetContext"));
+        setMailServer((MailServer)manager.lookup(MailServer.ROLE));
+        setUsers((UsersRepository)manager.lookup(UsersRepository.ROLE));
+        setDNSServer((DNSServer)manager.lookup(DNSServer.ROLE)); 
     }
 
     /**
@@ -150,54 +165,11 @@
         super.configure(configuration);
         if (isEnabled()) {
             mailetcontext.setAttribute(Constants.HELLO_NAME, helloName);
+            
             Configuration handlerConfiguration = configuration.getChild("handler");
-            String authRequiredString = handlerConfiguration.getChild("authRequired").getValue("false").trim().toLowerCase();
-            if (authRequiredString.equals("true")) authRequired = AUTH_REQUIRED;
-            else if (authRequiredString.equals("announce")) authRequired = AUTH_ANNOUNCE;
-            else authRequired = AUTH_DISABLED;
-            verifyIdentity = handlerConfiguration.getChild("verifyIdentity").getValueAsBoolean(false);
-            if (authRequired != AUTH_DISABLED) {
-                if (verifyIdentity) {
-                    getLogger().info("This SMTP server requires authentication and verifies
that the authentication credentials match the sender address.");
-                } else {
-                    getLogger().info("This SMTP server requires authentication, but doesn't
verify that the authentication credentials match the sender address.");
-                }
-            } else {
-                getLogger().info("This SMTP server does not require authentication.");
-            }
-
-            String authorizedAddresses = handlerConfiguration.getChild("authorizedAddresses").getValue(null);
-            if (authRequired == AUTH_DISABLED && authorizedAddresses == null) {
-                /* if SMTP AUTH is not requred then we will use
-                 * authorizedAddresses to determine whether or not to
-                 * relay e-mail.  Therefore if SMTP AUTH is not
-                 * required, we will not relay e-mail unless the
-                 * sending IP address is authorized.
-                 *
-                 * Since this is a change in behavior for James v2,
-                 * create a default authorizedAddresses network of
-                 * 0.0.0.0/0, which matches all possible addresses, thus
-                 * preserving the current behavior.
-                 *
-                 * James v3 should require the <authorizedAddresses>
-                 * element.
-                 */
-                authorizedAddresses = "0.0.0.0/0.0.0.0";
-            }
+            configureAuthorization(handlerConfiguration);
 
-            if (authorizedAddresses != null) {
-                java.util.StringTokenizer st = new java.util.StringTokenizer(authorizedAddresses,
", ", false);
-                java.util.Collection networks = new java.util.ArrayList();
-                while (st.hasMoreTokens()) {
-                    String addr = st.nextToken();
-                    networks.add(addr);
-                }
-                authorizedNetworks = new NetMatcher(networks,dnsServer);
-            }
-
-            if (authorizedNetworks != null) {
-                getLogger().info("Authorized addresses: " + authorizedNetworks.toString());
-            }
+            configureAuthorizedAddresses(handlerConfiguration);
 
             // get the message size limit from the conf file and multiply
             // by 1024, to put it in bytes
@@ -241,7 +213,59 @@
         }
         theHandlerFactory = new SMTPHandlerFactory();
     }
-    
+
+    private void configureAuthorization(Configuration handlerConfiguration) {
+        String authRequiredString = handlerConfiguration.getChild("authRequired").getValue("false").trim().toLowerCase();
+        if (authRequiredString.equals("true")) authRequired = AUTH_REQUIRED;
+        else if (authRequiredString.equals("announce")) authRequired = AUTH_ANNOUNCE;
+        else authRequired = AUTH_DISABLED;
+        verifyIdentity = handlerConfiguration.getChild("verifyIdentity").getValueAsBoolean(false);
+        if (authRequired != AUTH_DISABLED) {
+            if (verifyIdentity) {
+                getLogger().info("This SMTP server requires authentication and verifies that
the authentication credentials match the sender address.");
+            } else {
+                getLogger().info("This SMTP server requires authentication, but doesn't verify
that the authentication credentials match the sender address.");
+            }
+        } else {
+            getLogger().info("This SMTP server does not require authentication.");
+        }
+    }
+
+    private void configureAuthorizedAddresses(Configuration handlerConfiguration) {
+        String authorizedAddresses = handlerConfiguration.getChild("authorizedAddresses").getValue(null);
+        if (authRequired == AUTH_DISABLED && authorizedAddresses == null) {
+            /* if SMTP AUTH is not requred then we will use
+            * authorizedAddresses to determine whether or not to
+            * relay e-mail.  Therefore if SMTP AUTH is not
+            * required, we will not relay e-mail unless the
+            * sending IP address is authorized.
+            *
+            * Since this is a change in behavior for James v2,
+            * create a default authorizedAddresses network of
+            * 0.0.0.0/0, which matches all possible addresses, thus
+            * preserving the current behavior.
+            *
+            * James v3 should require the <authorizedAddresses>
+            * element.
+            */
+            authorizedAddresses = "0.0.0.0/0.0.0.0";
+        }
+
+        if (authorizedAddresses != null) {
+            java.util.StringTokenizer st = new java.util.StringTokenizer(authorizedAddresses,
", ", false);
+            java.util.Collection networks = new java.util.ArrayList();
+            while (st.hasMoreTokens()) {
+                String addr = st.nextToken();
+                networks.add(addr);
+            }
+            authorizedNetworks = new NetMatcher(networks,dnsServer);
+        }
+
+        if (authorizedNetworks != null) {
+            getLogger().info("Authorized addresses: " + authorizedNetworks.toString());
+        }
+    }
+
     /**
      * @see org.apache.james.core.AbstractJamesService#initialize()
      */
@@ -316,7 +340,7 @@
         }
 
         /**
-         * @see org.apache.avalon.excalibur.pool.ObjectFactory#decommision(Object)
+         * @see org.apache.avalon.excalibur.pool.ObjectFactory#decommission(Object) 
          */
         public void decommission( Object object ) throws Exception {
             return;
@@ -402,7 +426,7 @@
         }
         
         /**
-         * @see org.apache.james.smtpserver.SMTPHandlerConfigurationData#useHeloEnforcement()
+         * @see org.apache.james.smtpserver.SMTPHandlerConfigurationData#useHeloEhloEnforcement()
          */
         public boolean useHeloEhloEnforcement() {
             return SMTPServer.this.heloEhloEnforcement;

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SendMailHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SendMailHandler.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SendMailHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SendMailHandler.java Tue Jul 11
11:47:39 2006
@@ -39,16 +39,20 @@
 
     private MailServer mailServer;
 
+    public void setMailServer(MailServer mailServer) {
+        this.mailServer = mailServer;
+    }
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException {
-        mailServer = (MailServer) serviceManager.lookup(MailServer.ROLE);
+        setMailServer((MailServer) serviceManager.lookup(MailServer.ROLE));
     }
 
     /**
      * Adds header to the message
-     * @see org.apache.james.smtpserver#onMessage(SMTPSession)
+     * @see org.apache.james.smtpserver.MessageHandler#onMessage(SMTPSession)
      */
     public void onMessage(SMTPSession session) {
         getLogger().info("sending mail");

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java Tue Jul
11 11:47:39 2006
@@ -98,13 +98,16 @@
      */
     private MailProcessor processorList;
 
+    public void setSpool(SpoolRepository spool) {
+        this.spool = spool;
+    }
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager comp) throws ServiceException {
-        // threadManager = (ThreadManager) comp.lookup(ThreadManager.ROLE);
         compMgr = comp;
-        spool = (SpoolRepository) compMgr.lookup(SpoolRepository.ROLE);
+        setSpool((SpoolRepository) compMgr.lookup(SpoolRepository.ROLE));
     }
 
     /**
@@ -254,7 +257,6 @@
      * This implementation shuts down the LinearProcessors managed by this
      * JamesSpoolManager
      *
-     * @throws Exception if an error is encountered during shutdown
      */
     public void dispose() {
         getLogger().info("JamesSpoolManager dispose...");

Modified: james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java Tue Jul 11
11:47:39 2006
@@ -116,8 +116,6 @@
     private volatile boolean listsClosed;  // Whether the matcher/mailet lists have been
closed.
     private SpoolRepository spool;  // The spool on which this processor is acting
 
-    private ServiceManager compMgr;
-
     private MailetLoader mailetLoader;
 
     private MatcherLoader matchLoader;
@@ -136,6 +134,14 @@
         this.spool = spool;
     }
 
+    public void setMailetLoader(MailetLoader mailetLoader) {
+        this.mailetLoader = mailetLoader;
+    }
+
+    public void setMatchLoader(MatcherLoader matchLoader) {
+        this.matchLoader = matchLoader;
+    }
+
     /**
      * <p>The dispose operation is called at the end of a components lifecycle.
      * Instances of this class use this method to release and destroy any
@@ -144,7 +150,6 @@
      * <p>This implementation disposes of all the mailet instances added to the
      * processor</p>
      *
-     * @throws Exception if an error is encountered during shutdown
      */
     public void dispose() {
         Iterator it = mailets.iterator();
@@ -615,9 +620,9 @@
                                 .append(": ")
                                 .append(ex.toString());
                     getLogger().error( errorBuffer.toString(), ex );
-        if (ex.getNextException() != null) {
-        getLogger().error( "Caused by nested exception: ", ex.getNextException());
-        }
+                    if (ex.getNextException() != null) {
+                        getLogger().error( "Caused by nested exception: ", ex.getNextException());
+                    }
                 }
                 System.err.println("Unable to init matcher " + matcherName);
                 System.err.println("Check spool manager logs for more details.");
@@ -644,13 +649,12 @@
                                 .append(": ")
                                 .append(ex.toString());
                     getLogger().error( errorBuffer.toString(), ex );
-        if (ex.getNextException() != null) {
-        getLogger().error( "Caused by nested exception: ", ex.getNextException());
-        }
+                    if (ex.getNextException() != null) {
+                        getLogger().error( "Caused by nested exception: ", ex.getNextException());
+                    }
                 }
                 System.err.println("Unable to init mailet " + mailetClassName);
                 System.err.println("Check spool manager logs for more details.");
-                //System.exit(1);
                 throw new ConfigurationException("Unable to init mailet",c,ex);
             }
             //Add this pair to the processor
@@ -669,10 +673,8 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager comp) throws ServiceException {
-        compMgr = comp;
-        mailetLoader = (MailetLoader) compMgr.lookup(MailetLoader.ROLE);
-        matchLoader = (MatcherLoader) compMgr.lookup(MatcherLoader.ROLE);
-        spool = (SpoolRepository) compMgr.lookup(SpoolRepository.ROLE);
-        setSpool(spool);
+        setMailetLoader((MailetLoader) comp.lookup(MailetLoader.ROLE));
+        setMatchLoader((MatcherLoader) comp.lookup(MatcherLoader.ROLE));
+        setSpool( (SpoolRepository) comp.lookup(SpoolRepository.ROLE));
     }
 }

Modified: james/server/trunk/src/java/org/apache/james/transport/Loader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/Loader.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/Loader.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/Loader.java Tue Jul 11 11:47:39
2006
@@ -56,6 +56,10 @@
      */
     protected MailetContext mailetContext;
 
+    public void setMailetContext(MailetContext mailetContext) {
+        this.mailetContext = mailetContext;
+    }
+
     /**
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
      */
@@ -98,7 +102,7 @@
      * @see org.apache.avalon.framework.activity.Initializable#initialize()
      */
     public void initialize() throws Exception {
-        mailetContext = (MailetContext) serviceManager.lookup("org.apache.mailet.MailetContext");
+        setMailetContext((MailetContext) serviceManager.lookup("org.apache.mailet.MailetContext"));
     }
         
     /**

Modified: james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
(original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
Tue Jul 11 11:47:39 2006
@@ -101,12 +101,13 @@
     private String m_updateUserSql;
     private String m_deleteUserSql;
 
-    // Creates a single table with "username" the Primary Key.
-    private String m_createUserTableSql;
-
     // The JDBCUtil helper class
     private JDBCUtil theJDBCUtil;
 
+    public void setDatasources(DataSourceSelector datasources) {
+        m_datasources = datasources;
+    }
+
     /**
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
      */
@@ -116,7 +117,7 @@
     }
 
     /**
-     * @see org.apache.avalon.framework.service.Serviceable#compose(ServiceManager)
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager) 
      */
     public void service( final ServiceManager componentManager )
         throws ServiceException
@@ -131,8 +132,7 @@
             getLogger().debug( logBuffer.toString() );
         }
 
-        m_datasources =
-            (DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE );
+        setDatasources((DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE
));
     }
 
     /**
@@ -301,7 +301,7 @@
             m_deleteUserSql = sqlStatements.getSqlString("delete", true);
 
             // Creates a single table with "username" the Primary Key.
-            m_createUserTableSql = sqlStatements.getSqlString("createTable", true);
+            String createUserTableSql = sqlStatements.getSqlString("createTable", true);
 
             // Check if the required table exists. If not, create it.
             // The table name is defined in the SqlResources.
@@ -327,7 +327,7 @@
                 PreparedStatement createStatement = null;
                 try {
                     createStatement =
-                        conn.prepareStatement(m_createUserTableSql);
+                        conn.prepareStatement(createUserTableSql);
                     createStatement.execute();
                 } finally {
                     theJDBCUtil.closeJDBCStatement(createStatement);

Modified: james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java Tue
Jul 11 11:47:39 2006
@@ -57,13 +57,17 @@
     protected static boolean DEEP_DEBUG = false;
 
     private Store store;
-    private ObjectRepository or;
+    private ObjectRepository objectRepository;
 
     /**
      * The destination URL used to define the repository.
      */
     private String destination;
 
+    public void setStore(Store store) {
+        this.store = store;
+    }
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
@@ -71,7 +75,7 @@
         throws ServiceException {
 
         try {
-            store = (Store)componentManager.lookup( Store.ROLE );
+            setStore((Store)componentManager.lookup( Store.ROLE ));
         } catch (Exception e) {
             final String message = "Failed to retrieve Store component:" + e.getMessage();
             getLogger().error( message, e );
@@ -108,7 +112,7 @@
             objectConfiguration.setAttribute( "type", "OBJECT" );
             objectConfiguration.setAttribute( "model", "SYNCHRONOUS" );
 
-            or = (ObjectRepository)store.select( objectConfiguration );
+            objectRepository = (ObjectRepository)store.select( objectConfiguration );
             if (getLogger().isDebugEnabled()) {
                 StringBuffer logBuffer =
                     new StringBuffer(192)
@@ -131,7 +135,7 @@
      * @return Iterator over a collection of Strings, each being one user in the repository.
      */
     public Iterator list() {
-        return or.list();
+        return objectRepository.list();
     }
 
     /**
@@ -148,7 +152,7 @@
             return false;
         }
         try {
-            or.put(username, user);
+            objectRepository.put(username, user);
         } catch (Exception e) {
             throw new RuntimeException("Exception caught while storing user: " + e );
         }
@@ -176,7 +180,7 @@
     public synchronized User getUserByName(String name) {
         if (contains(name)) {
             try {
-                return (User)or.get(name);
+                return (User)objectRepository.get(name);
             } catch (Exception e) {
                 throw new RuntimeException("Exception while retrieving user: "
                                            + e.getMessage());
@@ -211,7 +215,7 @@
             return false;
         }
         try {
-            or.put(username, user);
+            objectRepository.put(username, user);
         } catch (Exception e) {
             throw new RuntimeException("Exception caught while storing user: " + e );
         }
@@ -219,11 +223,11 @@
     }
 
     public synchronized void removeUser(String name) {
-        or.remove(name);
+        objectRepository.remove(name);
     }
 
     public boolean contains(String name) {
-        return or.containsKey(name);
+        return objectRepository.containsKey(name);
     }
 
     public boolean containsCaseInsensitive(String name) {
@@ -240,7 +244,7 @@
         User user;
         try {
             if (contains(name)) {
-                user = (User) or.get(name);
+                user = (User) objectRepository.get(name);
             } else {
                return false;
             }

Modified: james/server/trunk/src/java/org/apache/james/util/connection/SimpleConnectionManager.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/util/connection/SimpleConnectionManager.java?rev=420948&r1=420947&r2=420948&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/util/connection/SimpleConnectionManager.java
(original)
+++ james/server/trunk/src/java/org/apache/james/util/connection/SimpleConnectionManager.java
Tue Jul 11 11:47:39 2006
@@ -86,6 +86,11 @@
      * Whether the SimpleConnectionManager has been disposed.
      */
     private volatile boolean disposed = false;
+
+    public void setThreadManager(ThreadManager threadManager) {
+        this.threadManager = threadManager;
+    }
+
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
      */
@@ -125,7 +130,7 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager componentManager) throws ServiceException {
-        threadManager = (ThreadManager)componentManager.lookup(ThreadManager.ROLE);
+        setThreadManager((ThreadManager)componentManager.lookup(ThreadManager.ROLE));
     }
     /**
      * Disconnects all the underlying ServerConnections



---------------------------------------------------------------------
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