You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2008/09/03 17:54:00 UTC

svn commit: r691642 - /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java

Author: ate
Date: Wed Sep  3 08:54:00 2008
New Revision: 691642

URL: http://svn.apache.org/viewvc?rev=691642&view=rev
Log:
Small improvement by implementing the real Spring InitializationBean and DisposableBean interfaces so init-method and destroy-method attributes no longer need to be defined for each usage. 

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java?rev=691642&r1=691641&r2=691642&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/LifecycleAwareStaticClassInitializer.java Wed Sep  3 08:54:00 2008
@@ -20,6 +20,9 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+
 /**
  * Utility bean which can be used to initialize a static class member with a Spring managed (singleton) bean on context initialization and removing it
  * automatically again when the context is destroyed.
@@ -27,12 +30,12 @@
  * The target class needs a public static (void) method with one single object argument. This bean needs to be configured with the target class name,
  * the target static method name, the class name of the target value and finally the value (e.g. a bean reference) itself.
  * 
- * The value will be "injected" into the target class when the init() method is called.
+ * The value will be "injected" into the target class when the afterPropertiesSet() method is called.
  * When the destroy() method is called, the same method will be called again with a null value.
  * @version $Id$
  *
  */
-public class LifecycleAwareStaticClassInitializer
+public class LifecycleAwareStaticClassInitializer implements InitializingBean, DisposableBean
 {
     private String className;
     private String methodName;
@@ -61,7 +64,7 @@
     }
     
     @SuppressWarnings("unchecked")
-    public void init() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
+    public void afterPropertiesSet() throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
     {
         Class clazz = Class.forName(className);
         Class type = Class.forName(typeName);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org