james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r561681 - in /james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle: ContextPropagator.java InitializationPropagator.java LoggerPropagator.java ServicePropagator.java
Date Wed, 01 Aug 2007 07:03:10 GMT
Author: berndf
Date: Wed Aug  1 00:03:09 2007
New Revision: 561681

URL: http://svn.apache.org/viewvc?view=rev&rev=561681
Log:
simplify some lifecycle method calls, thanks to Stefano for the hint

Modified:
    james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ContextPropagator.java
    james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/InitializationPropagator.java
    james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/LoggerPropagator.java
    james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ServicePropagator.java

Modified: james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ContextPropagator.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ContextPropagator.java?view=diff&rev=561681&r1=561680&r2=561681
==============================================================================
--- james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ContextPropagator.java
(original)
+++ james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ContextPropagator.java
Wed Aug  1 00:03:09 2007
@@ -21,6 +21,7 @@
 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.container.ContainerUtil;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.core.Ordered;
@@ -41,12 +42,10 @@
     }
 
     protected void invokeLifecycleWorker(String beanName, Object bean, BeanDefinition beanDefinition)
{
-        if (!(bean instanceof Contextualizable)) return;
-        Contextualizable contextualizable = (Contextualizable) bean;
         try {
-            contextualizable.contextualize(context);
+            ContainerUtil.contextualize(bean, context);
         } catch (ContextException e) {
-            throw new RuntimeException("could not successfully run contextualize method on
component of type " + contextualizable.getClass(), e);
+            throw new RuntimeException("could not successfully run contextualize method on
component of type " + bean.getClass(), e);
         }
     }
 

Modified: james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/InitializationPropagator.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/InitializationPropagator.java?view=diff&rev=561681&r1=561680&r2=561681
==============================================================================
--- james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/InitializationPropagator.java
(original)
+++ james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/InitializationPropagator.java
Wed Aug  1 00:03:09 2007
@@ -19,6 +19,7 @@
 package org.apache.james.container.spring.lifecycle;
 
 import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.core.Ordered;
@@ -33,12 +34,10 @@
     }
 
     protected void invokeLifecycleWorker(String beanName, Object bean, BeanDefinition beanDefinition)
{
-        if (!(bean instanceof Initializable)) return;
-        Initializable initializable = (Initializable) bean;
         try {
-            initializable.initialize();
+            ContainerUtil.initialize(bean);
         } catch (Exception e) {
-            throw new RuntimeException("could not initialize component of type " + initializable.getClass(),
e);
+            throw new RuntimeException("could not initialize component of type " + bean.getClass(),
e);
         }
     }
 

Modified: james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/LoggerPropagator.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/LoggerPropagator.java?view=diff&rev=561681&r1=561680&r2=561681
==============================================================================
--- james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/LoggerPropagator.java
(original)
+++ james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/LoggerPropagator.java
Wed Aug  1 00:03:09 2007
@@ -19,6 +19,7 @@
 package org.apache.james.container.spring.lifecycle;
 
 import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.container.spring.adaptor.LoggingBridge;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
@@ -36,9 +37,7 @@
     }
 
     protected void invokeLifecycleWorker(String beanName, Object bean, BeanDefinition beanDefinition)
{
-        if (!(bean instanceof LogEnabled)) return;
-        LogEnabled logEnabled = (LogEnabled) bean;
-        logEnabled.enableLogging(loggingBridge);
+        ContainerUtil.enableLogging(bean, loggingBridge);
     }
 
     public int getOrder() {

Modified: james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ServicePropagator.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ServicePropagator.java?view=diff&rev=561681&r1=561680&r2=561681
==============================================================================
--- james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ServicePropagator.java
(original)
+++ james/server/sandbox/spring-integration/src/main/java/org/apache/james/container/spring/lifecycle/ServicePropagator.java
Wed Aug  1 00:03:09 2007
@@ -21,9 +21,8 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.james.container.spring.adaptor.ServiceManagerFactory;
 import org.apache.james.container.spring.adaptor.DefaultServiceManagerFactory;
+import org.apache.james.container.spring.adaptor.ServiceManagerFactory;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.core.Ordered;



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