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 no...@apache.org on 2006/06/21 07:48:39 UTC
svn commit: r415919 -
/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
Author: norman
Date: Tue Jun 20 22:48:38 2006
New Revision: 415919
URL: http://svn.apache.org/viewvc?rev=415919&view=rev
Log:
Make the smptHandlerChain Initializable and Contextualizable. See JAMES-547
Modified:
james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
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=415919&r1=415918&r2=415919&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 Jun 20 22:48:38 2006
@@ -22,6 +22,9 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.james.Constants;
@@ -43,7 +46,7 @@
* IMPORTANT: SMTPServer extends AbstractJamesService. If you implement ANY
* lifecycle methods, you MUST call super.<method> as well.
*/
-public class SMTPServer extends AbstractJamesService implements SMTPServerMBean {
+public class SMTPServer extends AbstractJamesService implements SMTPServerMBean, Contextualizable {
/**
@@ -122,6 +125,7 @@
private ServiceManager serviceManager;
+
/**
* @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
*/
@@ -213,7 +217,7 @@
//set the logger
ContainerUtil.enableLogging(handlerChain,getLogger());
-
+
try {
ContainerUtil.service(handlerChain,serviceManager);
} catch (ServiceException e) {
@@ -230,6 +234,31 @@
mailetcontext.setAttribute(Constants.HELLO_NAME, "localhost");
}
theHandlerFactory = new SMTPHandlerFactory();
+ }
+
+ /**
+ * @see org.apache.james.core.AbstractJamesService#initialize()
+ */
+ public void initialize() throws Exception {
+ super.initialize();
+ ContainerUtil.initialize(handlerChain);
+ }
+
+ /**
+ * @see org.apache.avalon.cornerstone.services.connection.AbstractHandlerFactory#contextualize(org.apache.avalon.framework.context.Context)
+ */
+ public void contextualize(final Context context) {
+ super.contextualize(context);
+ try {
+ ContainerUtil.contextualize(handlerChain, context);
+ } catch (ContextException e) {
+
+ // This is just a hack.. the overridden contextualize method not
+ // support
+ // of throw an exception. But we need it
+ throw new IllegalStateException(e.getMessage());
+ }
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org