james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r552555 - /james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java
Date Mon, 02 Jul 2007 18:15:16 GMT
Author: rdonkin
Date: Mon Jul  2 11:15:15 2007
New Revision: 552555

URL: http://svn.apache.org/viewvc?view=rev&rev=552555
Log:
Let Phoenix assemble the dependencies.

Modified:
    james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java

Modified: james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java?view=diff&rev=552555&r1=552554&r2=552555
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapServer.java
Mon Jul  2 11:15:15 2007
@@ -70,25 +70,14 @@
     {
         super.service( serviceManager );
         setMailServer((MailServer) serviceManager.lookup(MailServer.ROLE));
-        setUp(decoderFactory, serviceManager);
-        setUp(encoderFactory, serviceManager);
-        setUp(processorFactory, serviceManager);
-        
-        imapProcessor = processorFactory.buildImapProcessor();
-        imapDecoder = decoderFactory.buildImapDecoder();
-        imapEncoder = encoderFactory.buildImapEncoder();
+        processorFactory = (ImapProcessorFactory) serviceManager.lookup(ImapProcessorFactory.class.getName());
+        decoderFactory = (ImapDecoderFactory) serviceManager.lookup(ImapDecoderFactory.class.getName());
+        encoderFactory = (ImapEncoderFactory) serviceManager.lookup(ImapEncoderFactory.class.getName());
     }
 
     void setMailServer(MailServer mailServer) {
         this.mailServer = mailServer;
     }
-
-    private void setUp(Object service, ServiceManager serviceManager) throws ServiceException{
-        if (service instanceof Serviceable) {
-            Serviceable serviceable = (Serviceable) service;
-            serviceable.service(serviceManager);
-        }
-    }
     
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
@@ -99,39 +88,14 @@
         if ( isEnabled() ) {
             Configuration handlerConfiguration = configuration.getChild( "handler" );
             lengthReset = handlerConfiguration.getChild( "lengthReset" ).getValueAsInteger(
lengthReset );
-            getLogger().info( "The idle timeout will be reset every " + lengthReset + " bytes."
);  
-            
-            Configuration encoderConfiguration = configuration.getChild( "encoder-factory"
);
-            encoderFactory = (ImapEncoderFactory) createFactory(encoderConfiguration);
-            
-            Configuration decoderConfiguration = configuration.getChild ( "decoder-factory"
);
-            decoderFactory = (ImapDecoderFactory) createFactory(decoderConfiguration);
+            getLogger().info( "The idle timeout will be reset every " + lengthReset + " bytes."
);
             
-            Configuration processorConfiguration = configuration.getChild( "processor-factory"
);
-            processorFactory = (ImapProcessorFactory) createFactory(processorConfiguration);
+            imapProcessor = processorFactory.buildImapProcessor();
+            imapDecoder = decoderFactory.buildImapDecoder();
+            imapEncoder = encoderFactory.buildImapEncoder();
         }
     }
     
-    private Object createFactory(Configuration configuration) throws ConfigurationException
-    {
-        try {
-            final String className = configuration.getAttribute("class");
-            final Object result = Class.forName(className).newInstance();
-            if (result instanceof Configurable)
-            {
-                Configurable configurable = (Configurable) result;
-                configurable.configure(configuration);
-            }
-            return result;
-        } catch (ClassNotFoundException e) {
-            throw new ConfigurationException("Cannot load factory class", configuration,
e);
-        } catch (InstantiationException e) {
-            throw new ConfigurationException("Cannot load factory class", configuration,
e);
-        } catch (IllegalAccessException e) {
-            throw new ConfigurationException("Cannot load factory class", configuration,
e);
-        }
-    }
-
     /**
      * @see AbstractJamesService#getDefaultPort()
      */



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