james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1138923 - in /james/server/trunk: container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ protocols-library/src/main/java/org/apache/james/protocols/lib/ protocols-library/src/test/java/org/apache/james/pro...
Date Thu, 23 Jun 2011 15:21:03 GMT
Author: norman
Date: Thu Jun 23 15:21:03 2011
New Revision: 1138923

URL: http://svn.apache.org/viewvc?rev=1138923&view=rev
Log:
Add lifecycle support via the LifecycleAwareProtocolHandler interface. Also add an interface
to load ProtocolHandlers, inject resources and call lifecycle methods. See PROTOCOLS-24

Modified:
    james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
    james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
    james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java?rev=1138923&r1=1138922&r2=1138923&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
(original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
Thu Jun 23 15:21:03 2011
@@ -30,11 +30,11 @@ public class ProtocolHandlerLoaderBeanFa
 
     @SuppressWarnings("unchecked")
     @Override
-    public ProtocolHandler load(Configuration config) throws LoadingException {
+    public ProtocolHandler load(String name, Configuration config) throws LoadingException
{
         
         try {
             // Use the classloader which is used for bean instance stuff
-            Class<ProtocolHandler> c = (Class<ProtocolHandler>) getBeanFactory().getBeanClassLoader().loadClass(config.getString("[@class]"));
+            Class<ProtocolHandler> c = (Class<ProtocolHandler>) getBeanFactory().getBeanClassLoader().loadClass(name);
             ProtocolHandler handler =  (ProtocolHandler) getBeanFactory().createBean(c);
             if (handler instanceof LifecycleAwareProtocolHandler) {
                 ((LifecycleAwareProtocolHandler) handler).init(config);

Modified: james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java?rev=1138923&r1=1138922&r2=1138923&view=diff
==============================================================================
--- james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
(original)
+++ james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
Thu Jun 23 15:21:03 2011
@@ -68,13 +68,13 @@ public class ProtocolHandlerChainImpl im
 
         String jmxHandlersPackage = handlerchainConfig.getString("[@jmxHandlersPackage]");
  
-        HandlersPackage handlersPackage = (HandlersPackage) loader.load(addHandler(coreHandlersPackage));
+        HandlersPackage handlersPackage = (HandlersPackage) loader.load(coreHandlersPackage,
addHandler(coreHandlersPackage));
         registerHandlersPackage(handlersPackage, null, children);
 
         if (handlerchainConfig.getBoolean("[@enableJmx]", true)) {
             DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
             builder.addProperty("jmxName", jmxName);
-            HandlersPackage jmxPackage = (HandlersPackage) loader.load(addHandler(jmxHandlersPackage));
+            HandlersPackage jmxPackage = (HandlersPackage) loader.load(jmxHandlersPackage,
addHandler(jmxHandlersPackage));
             
             registerHandlersPackage(jmxPackage, builder, children);
         }
@@ -83,7 +83,7 @@ public class ProtocolHandlerChainImpl im
             HierarchicalConfiguration hConf = children.get(i);
             String className = hConf.getString("[@class]", null);
             if (className != null) {
-                handlers.add(loader.load(hConf));
+                handlers.add(loader.load(className, hConf));
             } else {
                 throw new ConfigurationException("Missing @class attribute in configuration:
" + ConfigurationUtils.toString(hConf));
             }

Modified: james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java?rev=1138923&r1=1138922&r2=1138923&view=diff
==============================================================================
--- james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
(original)
+++ james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
Thu Jun 23 15:21:03 2011
@@ -18,9 +18,9 @@ import org.apache.james.protocols.api.Pr
 public class MockProtocolHandlerLoader implements ProtocolHandlerLoader{
 
     @Override
-    public ProtocolHandler load(Configuration config) throws LoadingException {
+    public ProtocolHandler load(String name, Configuration config) throws LoadingException
{
         try {
-            ProtocolHandler obj = create(config.getString("[@class]"));
+            ProtocolHandler obj = create(name);
             injectResources(obj);
             postConstruct(obj);
             synchronized (this) {



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