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 2010/12/19 11:38:39 UTC
svn commit: r1050796 -
/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java
Author: norman
Date: Sun Dec 19 10:38:39 2010
New Revision: 1050796
URL: http://svn.apache.org/viewvc?rev=1050796&view=rev
Log:
Replace tabs with whitespaces
Modified:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java
Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java?rev=1050796&r1=1050795&r2=1050796&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/lifecycle/api/AbstractLifeCycleBeanPostProcessor.java Sun Dec 19 10:38:39 2010
@@ -25,88 +25,100 @@ import org.springframework.core.Ordered;
import org.springframework.core.PriorityOrdered;
/**
- * Abstract base class which BeanPostProcessors should extend if they provide an LifeCycle handling
+ * Abstract base class which BeanPostProcessors should extend if they provide an
+ * LifeCycle handling
+ *
*
- *
* @param <T>
*/
-public abstract class AbstractLifeCycleBeanPostProcessor<T> implements BeanPostProcessor, PriorityOrdered{
+public abstract class AbstractLifeCycleBeanPostProcessor<T> implements BeanPostProcessor, PriorityOrdered {
+
+ private int order = Ordered.HIGHEST_PRECEDENCE;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.beans.factory.config.BeanPostProcessor#
+ * postProcessAfterInitialization(java.lang.Object, java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public final Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
+ try {
+ Class<T> lClass = getLifeCycleInterface();
+ if (lClass.isInstance(bean))
+ executeLifecycleMethodAfterInit((T) bean, name);
+ } catch (Exception e) {
+ throw new FatalBeanException("Unable to execute lifecycle method on bean" + name, e);
+ }
+ return bean;
+ }
+
+ /**
+ * Return the class which mark the lifecycle
+ *
+ * @return interfaceClass
+ */
+ protected abstract Class<T> getLifeCycleInterface();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.beans.factory.config.BeanPostProcessor#
+ * postProcessBeforeInitialization(java.lang.Object, java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ public final Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
+ try {
+ Class<T> lClass = getLifeCycleInterface();
+ if (lClass.isInstance(bean))
+ executeLifecycleMethodBeforeInit((T) bean, name);
+ } catch (Exception e) {
+ throw new FatalBeanException("Unable to execute lifecycle method on bean" + name, e);
+ }
+ return bean;
+ }
+
+ /**
+ * Method which gets executed if the bean implement the LifeCycleInterface.
+ * Override this if you wish perform any action. Default is todo nothing
+ *
+ * @param bean
+ * the actual bean
+ * @param beanname
+ * then name of the bean
+ * @throws Exception
+ */
+ protected void executeLifecycleMethodBeforeInit(T bean, String beanname) throws Exception {
+
+ }
+
+ /**
+ * Method which gets executed if the bean implement the LifeCycleInterface.
+ * Override this if you wish perform any action. Default is todo nothing
+ *
+ * @param bean
+ * the actual bean
+ * @param beanname
+ * then name of the bean
+ * @param componentName
+ * the component name
+ * @throws Exception
+ */
+ protected void executeLifecycleMethodAfterInit(T bean, String beanname) throws Exception {
+
+ }
+
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.core.Ordered#getOrder()
+ */
+ public int getOrder() {
+ return order;
+ }
- private int order = Ordered.HIGHEST_PRECEDENCE;
-
- /*
- * (non-Javadoc)
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
- */
- @SuppressWarnings("unchecked")
- public final Object postProcessAfterInitialization(Object bean, String name)
- throws BeansException {
- try {
- Class<T> lClass = getLifeCycleInterface();
- if (lClass.isInstance(bean)) executeLifecycleMethodAfterInit((T)bean, name);
- } catch (Exception e) {
- throw new FatalBeanException("Unable to execute lifecycle method on bean" + name,e);
- }
- return bean; }
-
- /**
- * Return the class which mark the lifecycle
- *
- * @return interfaceClass
- */
- protected abstract Class<T> getLifeCycleInterface();
-
- /*
- * (non-Javadoc)
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
- */
- @SuppressWarnings("unchecked")
- public final Object postProcessBeforeInitialization(Object bean, String name)
- throws BeansException {
- try {
- Class<T> lClass = getLifeCycleInterface();
- if (lClass.isInstance(bean)) executeLifecycleMethodBeforeInit((T)bean, name);
- } catch (Exception e) {
- throw new FatalBeanException("Unable to execute lifecycle method on bean" + name,e);
- }
- return bean;
- }
-
- /**
- * Method which gets executed if the bean implement the LifeCycleInterface. Override this if you wish perform any action.
- * Default is todo nothing
- *
- * @param bean the actual bean
- * @param beanname then name of the bean
- * @throws Exception
- */
- protected void executeLifecycleMethodBeforeInit(T bean, String beanname) throws Exception {
-
- }
-
- /**
- * Method which gets executed if the bean implement the LifeCycleInterface. Override this if you wish perform any action.
- * Default is todo nothing
- *
- * @param bean the actual bean
- * @param beanname then name of the bean
- * @param componentName the component name
- * @throws Exception
- */
- protected void executeLifecycleMethodAfterInit(T bean, String beanname) throws Exception {
-
- }
-
- public void setOrder(int order) {
- this.order = order;
- }
-
- /*
- * (non-Javadoc)
- * @see org.springframework.core.Ordered#getOrder()
- */
- public int getOrder() {
- return order;
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org