[jboss-cvs] JBossAS SVN: r63037 - in projects/microcontainer/trunk: kernel/src/main/org/jboss/beans/metadata/plugins and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 14 21:06:50 EDT 2007


Author: alesj
Date: 2007-05-14 21:06:50 -0400 (Mon, 14 May 2007)
New Revision: 63037

Added:
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleWithIgnored.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredAnnotatedLifecycleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredLifecycleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/MixedLifecycleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleLifecycleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java
Modified:
   projects/microcontainer/trunk/classloader/src/main/org/jboss/classloader/spi/base/BaseClassLoader.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/LifecycleMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/CreateLifecycle.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/DestroyLifecycle.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StartLifecycle.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StopLifecycle.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CreateDestroyLifecycleAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/StartStopLifecycleAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/LifecycleHandler.java
   projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_1_0.xsd
   projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedLifecycleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java
Log:
Added ignore lifecycle.

Reverted classloader refactoring.
Bug in IDEA compiler binding?

Modified: projects/microcontainer/trunk/classloader/src/main/org/jboss/classloader/spi/base/BaseClassLoader.java
===================================================================
--- projects/microcontainer/trunk/classloader/src/main/org/jboss/classloader/spi/base/BaseClassLoader.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/classloader/src/main/org/jboss/classloader/spi/base/BaseClassLoader.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -86,14 +86,15 @@
          throw new IllegalArgumentException("Null policy");
       this.policy = policy;
 
-      policy.setClassLoader(this);
+      BaseClassLoaderPolicy basePolicy = policy;
+      basePolicy.setClassLoader(this);
 
       loader = new DelegateLoader(policy);
-      
-      if (policy.isCachable())
+
+      if (basePolicy.isCachable())
          resourceCache = new ConcurrentHashMap<String, URL>();
-      
-      if (policy.isBlackListable())
+
+      if (basePolicy.isBlackListable())
          blackList = new CopyOnWriteArraySet<String>();
       
       if (log.isTraceEnabled())

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLifecycleMetaData.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -55,6 +55,9 @@
    /** The method name */
    protected String methodName;
 
+   /** The ignored attribute */
+   boolean ignored;
+
    /** The paramaters List<ParameterMetaData> */
    protected List<ParameterMetaData> parameters;
 
@@ -99,6 +102,21 @@
       flushJBossObjectCache();
    }
 
+   public boolean isIgnored()
+   {
+      return ignored;
+   }
+
+   /**
+    * Set ignored attribute.
+    *
+    * @param ignored the ignored
+    */
+   public void setIgnored(boolean ignored)
+   {
+      this.ignored = ignored;
+   }
+
    public List<ParameterMetaData> getParameters()
    {
       return parameters;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/LifecycleMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/LifecycleMetaData.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/LifecycleMetaData.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -51,4 +51,11 @@
     * @return the method name.
     */
    String getMethodName();
+
+   /**
+    * Is default ignored.
+    *
+    * @return should we ignore default
+    */
+   boolean isIgnored();
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/CreateLifecycle.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/CreateLifecycle.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/CreateLifecycle.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -1,9 +1,9 @@
 package org.jboss.beans.metadata.spi.annotations;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
@@ -12,4 +12,10 @@
 @Target({ElementType.METHOD})
 public @interface CreateLifecycle
 {
+   /**
+    * Is this lifecycle callback ignored.
+    *
+    * @return ignored
+    */
+   boolean ignored() default false;
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/DestroyLifecycle.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/DestroyLifecycle.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/DestroyLifecycle.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -1,9 +1,9 @@
 package org.jboss.beans.metadata.spi.annotations;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
@@ -12,4 +12,10 @@
 @Target({ElementType.METHOD})
 public @interface DestroyLifecycle
 {
+   /**
+    * Is this lifecycle callback ignored.
+    *
+    * @return ignored
+    */
+   boolean ignored() default false;
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StartLifecycle.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StartLifecycle.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StartLifecycle.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -1,9 +1,9 @@
 package org.jboss.beans.metadata.spi.annotations;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
@@ -12,4 +12,10 @@
 @Target({ElementType.METHOD})
 public @interface StartLifecycle
 {
+   /**
+    * Is this lifecycle callback ignored.
+    *
+    * @return ignored
+    */
+   boolean ignored() default false;
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StopLifecycle.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StopLifecycle.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/StopLifecycle.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -1,9 +1,9 @@
 package org.jboss.beans.metadata.spi.annotations;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
@@ -12,4 +12,10 @@
 @Target({ElementType.METHOD})
 public @interface StopLifecycle
 {
+   /**
+    * Is this lifecycle callback ignored.
+    *
+    * @return ignored
+    */
+   boolean ignored() default false;
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CreateDestroyLifecycleAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CreateDestroyLifecycleAction.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/CreateDestroyLifecycleAction.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -21,30 +21,25 @@
 */
 package org.jboss.kernel.plugins.dependency;
 
-import java.util.List;
-
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.LifecycleMetaData;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
 import org.jboss.beans.metadata.spi.annotations.CreateLifecycle;
 import org.jboss.beans.metadata.spi.annotations.DestroyLifecycle;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
 import org.jboss.kernel.spi.dependency.CreateKernelControllerContextAware;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
 
 /**
  * CreateDestroyLifecycleAction.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision$
  */
 public class CreateDestroyLifecycleAction extends LifecycleAction
 {
-   public String getInstallMethod(BeanMetaData beanMetaData)
+   protected LifecycleMetaData getInstallLifecycle(BeanMetaData beanMetaData)
    {
-      LifecycleMetaData lifecycle = beanMetaData.getCreate();
-      if (lifecycle != null)
-         return lifecycle.getMethodName();
-      return null;
+      return beanMetaData.getCreate();
    }
 
    public String getDefaultInstallMethod()
@@ -57,25 +52,14 @@
       return CreateLifecycle.class.getName();
    }
 
-   public List<ParameterMetaData> getInstallParameters(BeanMetaData beanMetaData)
-   {
-      LifecycleMetaData lifecycle = beanMetaData.getCreate();
-      if (lifecycle != null)
-         return lifecycle.getParameters();
-      return null;
-   }
-
    protected Class<? extends KernelControllerContextAware> getActionAwareInterface()
    {
       return CreateKernelControllerContextAware.class;
    }
 
-   public String getUninstallMethod(BeanMetaData beanMetaData)
+   protected LifecycleMetaData getUninstallLifecycle(BeanMetaData beanMetaData)
    {
-      LifecycleMetaData lifecycle = beanMetaData.getDestroy();
-      if (lifecycle != null)
-         return lifecycle.getMethodName();
-      return null;
+      return beanMetaData.getDestroy();
    }
 
    public String getDefaultUninstallMethod()
@@ -87,12 +71,4 @@
    {
       return DestroyLifecycle.class.getName();
    }
-
-   public List<ParameterMetaData> getUninstallParameters(BeanMetaData beanMetaData)
-   {
-      LifecycleMetaData lifecycle = beanMetaData.getDestroy();
-      if (lifecycle != null)
-         return lifecycle.getParameters();
-      return null;
-   }
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -26,6 +26,7 @@
 
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
 import org.jboss.beans.metadata.spi.ParameterMetaData;
 import org.jboss.joinpoint.spi.JoinpointException;
 import org.jboss.joinpoint.spi.MethodJoinpoint;
@@ -34,12 +35,15 @@
 import org.jboss.kernel.spi.config.KernelConfigurator;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.reflect.spi.AnnotationValue;
 import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.Value;
 
 /**
  * LifecycleAction.
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision$
  */
 public abstract class LifecycleAction extends KernelControllerContextAction
@@ -51,13 +55,34 @@
    {
    }
 
+   protected abstract LifecycleMetaData getInstallLifecycle(BeanMetaData beanMetaData);
+
+   protected abstract LifecycleMetaData getUninstallLifecycle(BeanMetaData beanMetaData);
+
+   protected String getMethod(LifecycleMetaData lifecycle)
+   {
+      if (lifecycle != null)
+         return lifecycle.getMethodName();
+      return null;
+   }
+
+   protected List<ParameterMetaData> getParameters(LifecycleMetaData lifecycle)
+   {
+      if (lifecycle != null)
+         return lifecycle.getParameters();
+      return null;
+   }
+
    /**
     * Get the install method
     * 
-    * @param beanMetaData
+    * @param beanMetaData bean meta data
     * @return the method
     */
-   public abstract String getInstallMethod(BeanMetaData beanMetaData);
+   protected String getInstallMethod(BeanMetaData beanMetaData)
+   {
+      return getMethod(getInstallLifecycle(beanMetaData));
+   }
 
    /**
     * Get install default method name
@@ -76,18 +101,24 @@
    /**
     * Get the install parameters
     * 
-    * @param beanMetaData
+    * @param beanMetaData bean meta data
     * @return the parameters
     */
-   public abstract List<ParameterMetaData> getInstallParameters(BeanMetaData beanMetaData);
+   protected List<ParameterMetaData> getInstallParameters(BeanMetaData beanMetaData)
+   {
+      return getParameters(getInstallLifecycle(beanMetaData));
+   }
 
    /**
     * Get the uninstall method
     * 
-    * @param beanMetaData
+    * @param beanMetaData bean meta data
     * @return the method
     */
-   public abstract String getUninstallMethod(BeanMetaData beanMetaData);
+   protected String getUninstallMethod(BeanMetaData beanMetaData)
+   {
+      return getMethod(getUninstallLifecycle(beanMetaData));
+   }
 
    /**
     * Get uninstall default method name
@@ -106,86 +137,145 @@
    /**
     * Get the uninstall parameters
     *
-    * @param beanMetaData
+    * @param beanMetaData bean meta data
     * @return the parameters
     */
-   public abstract List<ParameterMetaData> getUninstallParameters(BeanMetaData beanMetaData);
+   protected List<ParameterMetaData> getUninstallParameters(BeanMetaData beanMetaData)
+   {
+      return getParameters(getUninstallLifecycle(beanMetaData));
+   }
 
-   protected void installActionInternal(KernelControllerContext context) throws Throwable
+   protected boolean isInstallInvocationIgnored(KernelControllerContext context)
    {
-      boolean trace = log.isTraceEnabled();
+      return isInvocationIgnored(getInstallLifecycle(context.getBeanMetaData())) || isInvocationIgnored(context, getInstallAnnotation());
+   }
 
-      KernelController controller = (KernelController) context.getController();
-      Kernel kernel = controller.getKernel();
-      KernelConfigurator configurator = kernel.getConfigurator();
+   protected boolean isUninstallInvocationIgnored(KernelControllerContext context)
+   {
+      return isInvocationIgnored(getUninstallLifecycle(context.getBeanMetaData())) || isInvocationIgnored(context, getUninstallAnnotation());
+   }
 
-      Object target = context.getTarget();
-      BeanInfo info = context.getBeanInfo();
-      BeanMetaData metaData = context.getBeanMetaData();
-      String method = getInstallMethod(context);
-      List<ParameterMetaData> parameters = getInstallParameters(context);
-      MethodJoinpoint joinpoint;
-      try
+   protected boolean isInvocationIgnored(LifecycleMetaData lifecycle)
+   {
+      return lifecycle != null && lifecycle.isIgnored();
+   }
+
+   protected boolean isInvocationIgnored(KernelControllerContext context, String annotationName)
+   {
+      MethodInfo mi = findMethodWithAnnotation(context, annotationName);
+      if (mi != null)
       {
-         ClassLoader cl = Configurator.getClassLoader(metaData);
-         joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+         AnnotationValue av = mi.getAnnotation(annotationName);
+         Value value = av.getValue("ignored");
+         if (value != null)
+         {
+            return Boolean.parseBoolean(value.asPrimitive().getValue());
+         }
       }
-      catch (JoinpointException ignored)
+      return false;
+   }
+
+   protected MethodInfo findMethodWithAnnotation(KernelControllerContext context, String annotationName)
+   {
+      BeanInfo info = context.getBeanInfo();
+      if (info != null)
       {
-         if (trace)
+         Set<MethodInfo> methods = info.getMethods();
+         if (methods != null)
          {
-            if (parameters == null)
-               log.trace("No " + method + " method for " + context);
-            else
-               log.trace("No " + method + parameters + " method for " + context);
+            for (MethodInfo mi : methods)
+            {
+               if (mi.isAnnotationPresent(annotationName))
+               {
+                  return mi;
+               }
+            }
          }
-         return;
       }
-      joinpoint.setTarget(target);
-      dispatchJoinPoint(context, joinpoint);
+      return null;
    }
 
-   protected void uninstallActionInternal(KernelControllerContext context)
+   protected void installActionInternal(KernelControllerContext context) throws Throwable
    {
-      boolean trace = log.isTraceEnabled();
+      if (isInstallInvocationIgnored(context) == false)
+      {
+         boolean trace = log.isTraceEnabled();
 
-      KernelController controller = (KernelController) context.getController();
-      Kernel kernel = controller.getKernel();
-      KernelConfigurator configurator = kernel.getConfigurator();
+         KernelController controller = (KernelController) context.getController();
+         Kernel kernel = controller.getKernel();
+         KernelConfigurator configurator = kernel.getConfigurator();
 
-      Object target = context.getTarget();
-      BeanInfo info = context.getBeanInfo();
-      BeanMetaData metaData = context.getBeanMetaData();
-      String method = getUninstallMethod(context);
-      List<ParameterMetaData> parameters = getUninstallParameters(context);
-      MethodJoinpoint joinpoint;
-      try
-      {
+         Object target = context.getTarget();
+         BeanInfo info = context.getBeanInfo();
+         BeanMetaData metaData = context.getBeanMetaData();
+         String method = getInstallMethod(context);
+         List<ParameterMetaData> parameters = getInstallParameters(context);
+         MethodJoinpoint joinpoint;
+         try
+         {
          ClassLoader cl = Configurator.getClassLoader(metaData);
-         joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+            joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+         }
+         catch (JoinpointException ignored)
+         {
+            if (trace)
+            {
+               if (parameters == null)
+                  log.trace("No " + method + " method for " + context);
+               else
+                  log.trace("No " + method + parameters + " method for " + context);
+            }
+            return;
+         }
          joinpoint.setTarget(target);
          dispatchJoinPoint(context, joinpoint);
       }
-      catch (JoinpointException ignored)
+   }
+
+   protected void uninstallActionInternal(KernelControllerContext context)
+   {
+      if (isUninstallInvocationIgnored(context) == false)
       {
-         if (trace)
+         boolean trace = log.isTraceEnabled();
+
+         KernelController controller = (KernelController) context.getController();
+         Kernel kernel = controller.getKernel();
+         KernelConfigurator configurator = kernel.getConfigurator();
+
+         Object target = context.getTarget();
+         BeanInfo info = context.getBeanInfo();
+         BeanMetaData metaData = context.getBeanMetaData();
+         String method = getUninstallMethod(context);
+         List<ParameterMetaData> parameters = getUninstallParameters(context);
+         MethodJoinpoint joinpoint;
+         try
          {
-            if (parameters == null)
-               log.trace("No " + method + " method for " + context);
-            else
-               log.trace("No " + method + parameters + " method for " + context);
+         ClassLoader cl = Configurator.getClassLoader(metaData);
+            joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
+            joinpoint.setTarget(target);
+            dispatchJoinPoint(context, joinpoint);
          }
+         catch (JoinpointException ignored)
+         {
+            if (trace)
+            {
+               if (parameters == null)
+                  log.trace("No " + method + " method for " + context);
+               else
+                  log.trace("No " + method + parameters + " method for " + context);
+            }
+         }
+         catch (Throwable throwable)
+         {
+            log.warn("Error during " + method + " for " + context.getName(), throwable);
+         }
       }
-      catch (Throwable throwable)
-      {
-         log.warn("Error during " + method + " for " + context.getName(), throwable);
-      }
    }
 
    /**
     * Get the install method
     *
-    * @param context
+    * @param context the context
     * @return the method
     */
    public String getInstallMethod(KernelControllerContext context)
@@ -195,17 +285,10 @@
       {
          return installMethod;
       }
-      BeanInfo beanInfo = context.getBeanInfo();
-      Set<MethodInfo> methods = beanInfo.getMethods();
-      if (methods != null)
+      MethodInfo mi = findMethodWithAnnotation(context, getInstallAnnotation());
+      if (mi != null)
       {
-         for (MethodInfo mi : methods)
-         {
-            if (mi.isAnnotationPresent(getInstallAnnotation()))
-            {
-               return mi.getName();
-            }
-         }
+         return mi.getName();
       }
       return getDefaultInstallMethod();
    }
@@ -213,7 +296,7 @@
    /**
     * Get the install parameters
     *
-    * @param context
+    * @param context the context
     * @return the parameters
     */
    public List<ParameterMetaData> getInstallParameters(KernelControllerContext context)
@@ -225,7 +308,7 @@
    /**
     * Get the uninstall method
     *
-    * @param context
+    * @param context the context
     * @return the method
     */
    public String getUninstallMethod(KernelControllerContext context)
@@ -235,17 +318,10 @@
       {
          return uninstallMethod;
       }
-      BeanInfo beanInfo = context.getBeanInfo();
-      Set<MethodInfo> methods = beanInfo.getMethods();
-      if (methods != null)
+      MethodInfo mi = findMethodWithAnnotation(context, getUninstallAnnotation());
+      if (mi != null)
       {
-         for (MethodInfo mi : methods)
-         {
-            if (mi.isAnnotationPresent(getUninstallAnnotation()))
-            {
-               return mi.getName();
-            }
-         }
+         return mi.getName();
       }
       return getDefaultUninstallMethod();
    }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/StartStopLifecycleAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/StartStopLifecycleAction.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/StartStopLifecycleAction.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -21,11 +21,8 @@
 */
 package org.jboss.kernel.plugins.dependency;
 
-import java.util.List;
-
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.LifecycleMetaData;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
 import org.jboss.beans.metadata.spi.annotations.StartLifecycle;
 import org.jboss.beans.metadata.spi.annotations.StopLifecycle;
 import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
@@ -35,16 +32,14 @@
  * StartStopLifecycleAction.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision$
  */
 public class StartStopLifecycleAction extends LifecycleAction
 {
-   public String getInstallMethod(BeanMetaData beanMetaData)
+   protected LifecycleMetaData getInstallLifecycle(BeanMetaData beanMetaData)
    {
-      LifecycleMetaData lifecycle = beanMetaData.getStart();
-      if (lifecycle != null)
-         return lifecycle.getMethodName();
-      return null;
+      return beanMetaData.getStart();
    }
 
    public String getDefaultInstallMethod()
@@ -57,25 +52,14 @@
       return StartLifecycle.class.getName();
    }
 
-   public List<ParameterMetaData> getInstallParameters(BeanMetaData beanMetaData)
-   {
-      LifecycleMetaData lifecycle = beanMetaData.getStart();
-      if (lifecycle != null)
-         return lifecycle.getParameters();
-      return null;
-   }
-
    protected Class<? extends KernelControllerContextAware> getActionAwareInterface()
    {
       return StartKernelControllerContextAware.class;
    }
 
-   public String getUninstallMethod(BeanMetaData beanMetaData)
+   protected LifecycleMetaData getUninstallLifecycle(BeanMetaData beanMetaData)
    {
-      LifecycleMetaData lifecycle = beanMetaData.getStop();
-      if (lifecycle != null)
-         return lifecycle.getMethodName();
-      return null;
+      return beanMetaData.getStop();
    }
 
    public String getDefaultUninstallMethod()
@@ -87,12 +71,4 @@
    {
       return StopLifecycle.class.getName();
    }
-
-   public List<ParameterMetaData> getUninstallParameters(BeanMetaData beanMetaData)
-   {
-      LifecycleMetaData lifecycle = beanMetaData.getStop();
-      if (lifecycle != null)
-         return lifecycle.getParameters();
-      return null;
-   }
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -633,6 +633,8 @@
                String localName = attrs.getLocalName(i);
                if ("method".equals(localName))
                   lifecycle.setMethodName(attrs.getValue(i));
+               else if ("ignored".equals(localName))
+                  lifecycle.setIgnored(Boolean.parseBoolean(attrs.getValue(i)));
             }
          }
       });

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/LifecycleHandler.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/LifecycleHandler.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/LifecycleHandler.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -53,6 +53,8 @@
          String localName = attrs.getLocalName(i);
          if ("method".equals(localName))
             lifecycle.setMethodName(attrs.getValue(i));
+         else if ("ignored".equals(localName))
+            lifecycle.setIgnored(Boolean.parseBoolean(attrs.getValue(i)));
       }
    }
 }

Modified: projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_1_0.xsd	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_1_0.xsd	2007-05-15 01:06:50 UTC (rev 63037)
@@ -219,6 +219,7 @@
          <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
       <xsd:attribute name="method" type="xsd:token" use="optional"/>
+      <xsd:attribute name="ignored" type="xsd:boolean" use="optional" default="false"/>
    </xsd:complexType>
 
    <xsd:complexType name="dependencyType">

Modified: projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/resources/main/schema/bean-deployer_2_0.xsd	2007-05-15 01:06:50 UTC (rev 63037)
@@ -248,6 +248,7 @@
          <xsd:element name="parameter" type="parameterType" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
       <xsd:attribute name="method" type="xsd:token" use="optional"/>
+      <xsd:attribute name="ignored" type="xsd:boolean" use="optional" default="false"/>
    </xsd:complexType>
 
    <xsd:complexType name="installType">

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.xml	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="LifecycleBean" class="org.jboss.test.kernel.deployment.support.IgnoredAnnotatedLifecycleBean" mode="Manual" />
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.xml	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="LifecycleBean" class="org.jboss.test.kernel.deployment.support.IgnoredLifecycleBean" mode="Manual">
+      <create ignored="true"/>
+      <start ignored="true"/>
+      <stop ignored="true"/>
+      <destroy ignored="true"/>
+   </bean>
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.xml	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="LifecycleBean" class="org.jboss.test.kernel.deployment.support.MixedLifecycleBean" mode="Manual" />
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleWithIgnored.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleWithIgnored.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleWithIgnored.xml	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+   <create ignored="true"/>
+</bean>

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedLifecycleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedLifecycleBean.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedLifecycleBean.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -23,40 +23,14 @@
 
 import org.jboss.beans.metadata.spi.annotations.CreateLifecycle;
 import org.jboss.beans.metadata.spi.annotations.DestroyLifecycle;
-import org.jboss.beans.metadata.spi.annotations.StopLifecycle;
 import org.jboss.beans.metadata.spi.annotations.StartLifecycle;
+import org.jboss.beans.metadata.spi.annotations.StopLifecycle;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class AnnotatedLifecycleBean
+public class AnnotatedLifecycleBean extends SimpleLifecycleBean
 {
-
-   private boolean m_create;
-   private boolean m_start;
-   private boolean m_stop;
-   private boolean m_destroy;
-
-   public boolean isCreate()
-   {
-      return m_create;
-   }
-
-   public boolean isStart()
-   {
-      return m_start;
-   }
-
-   public boolean isStop()
-   {
-      return m_stop;
-   }
-
-   public boolean isDestroy()
-   {
-      return m_destroy;
-   }
-
    @CreateLifecycle
    public void annotatedCreate()
    {
@@ -82,5 +56,4 @@
       m_create = false;
       m_destroy = true;
    }
-
 }

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredAnnotatedLifecycleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredAnnotatedLifecycleBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredAnnotatedLifecycleBean.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.support;
+
+import org.jboss.beans.metadata.spi.annotations.CreateLifecycle;
+import org.jboss.beans.metadata.spi.annotations.DestroyLifecycle;
+import org.jboss.beans.metadata.spi.annotations.StartLifecycle;
+import org.jboss.beans.metadata.spi.annotations.StopLifecycle;
+
+/**
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IgnoredAnnotatedLifecycleBean extends AnnotatedLifecycleBean
+{
+   @CreateLifecycle(ignored = true)
+   public void ignoredCreate()
+   {
+      m_create = true;
+   }
+
+   @StartLifecycle(ignored = true)
+   public void annotatedStart()
+   {
+      m_start = true;
+   }
+
+   @StopLifecycle(ignored = true)
+   public void annotatedStop()
+   {
+      m_start = false;
+      m_stop = true;
+   }
+
+   @DestroyLifecycle(ignored = true)
+   public void ignoredDestroy()
+   {
+      m_create = false;
+      m_destroy = true;
+   }
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredLifecycleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredLifecycleBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/IgnoredLifecycleBean.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.support;
+
+/**
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IgnoredLifecycleBean extends SimpleLifecycleBean
+{
+   public void create()
+   {
+      m_create = true;
+   }
+
+   public void start()
+   {
+      m_start = true;
+   }
+
+   public void stop()
+   {
+      m_stop = true;
+   }
+
+   public void destroy()
+   {
+      m_destroy = true;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/MixedLifecycleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/MixedLifecycleBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/MixedLifecycleBean.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.support;
+
+import org.jboss.beans.metadata.spi.annotations.CreateLifecycle;
+
+/**
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class MixedLifecycleBean extends SimpleLifecycleBean
+{
+   @CreateLifecycle(ignored = true)
+   public void create()
+   {
+      m_create = true;
+   }
+
+   public void start()
+   {
+      m_start = true;
+   }
+
+   public void stop()
+   {
+      m_stop = true;
+   }
+
+   public void destroy()
+   {
+      m_destroy = true;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleLifecycleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleLifecycleBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleLifecycleBean.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.support;
+
+/**
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class SimpleLifecycleBean
+{
+   protected boolean m_create;
+   protected boolean m_start;
+   protected boolean m_stop;
+   protected boolean m_destroy;
+
+   public boolean isCreate()
+   {
+      return m_create;
+   }
+
+   public boolean isStart()
+   {
+      return m_start;
+   }
+
+   public boolean isStop()
+   {
+      return m_stop;
+   }
+
+   public boolean isDestroy()
+   {
+      return m_destroy;
+   }
+
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -57,6 +57,7 @@
       change(context, ControllerState.CREATE);
       assertEquals(context.getState(), ControllerState.CREATE);
       target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
       assertTrue(target.isCreate());
       assertFalse(target.isStart());
       assertFalse(target.isStop());
@@ -65,6 +66,7 @@
       change(context, ControllerState.START);
       assertEquals(context.getState(), ControllerState.START);
       target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
       assertTrue(target.isCreate());
       assertTrue(target.isStart());
       assertFalse(target.isStop());
@@ -73,6 +75,7 @@
       change(context, ControllerState.CREATE);
       assertEquals(context.getState(), ControllerState.CREATE);
       target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
       assertTrue(target.isCreate());
       assertFalse(target.isStart());
       assertTrue(target.isStop());
@@ -81,6 +84,7 @@
       change(context, ControllerState.CONFIGURED);
       assertEquals(context.getState(), ControllerState.CONFIGURED);
       target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
       assertFalse(target.isCreate());
       assertFalse(target.isStart());
       assertTrue(target.isStop());

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -49,6 +49,9 @@
       suite.addTest(WildcardClassLoaderTestCase.suite());
       suite.addTest(BeanMetaDataFactoryTestCase.suite());
       suite.addTest(AnnotatedLifecycleTestCase.suite());
+      suite.addTest(IgnoredAnnotatedLifecycleTestCase.suite());
+      suite.addTest(IgnoredLifecycleTestCase.suite());
+      suite.addTest(MixedLifecycleTestCase.suite());
       suite.addTest(FineGrainedActionTestCase.suite());
       suite.addTest(ScopingTestCase.suite());
       suite.addTest(AnnotatedDeploymentScopingTestCase.suite());

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.deployment.support.AnnotatedLifecycleBean;
+import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
+
+/**
+ * Test ignore lifecycle annotations.
+ *
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IgnoredAnnotatedLifecycleTestCase extends ManualMicrocontainerTest
+{
+   private static final String BEAN_NAME = "LifecycleBean";
+
+   public IgnoredAnnotatedLifecycleTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(IgnoredAnnotatedLifecycleTestCase.class);
+   }
+
+   public void testAnnotatedLifecycle() throws Throwable
+   {
+      AnnotatedLifecycleBean target;
+
+      KernelControllerContext context = getControllerContext(BEAN_NAME, ControllerState.NOT_INSTALLED);
+      assertEquals(context.getState(), ControllerState.NOT_INSTALLED);
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.START);
+      assertEquals(context.getState(), ControllerState.START);
+      target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CONFIGURED);
+      assertEquals(context.getState(), ControllerState.CONFIGURED);
+      target = (AnnotatedLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.deployment.support.SimpleLifecycleBean;
+import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
+
+/**
+ * Test ignore lifecycle.
+ *
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IgnoredLifecycleTestCase extends ManualMicrocontainerTest
+{
+   private static final String BEAN_NAME = "LifecycleBean";
+
+   public IgnoredLifecycleTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(IgnoredLifecycleTestCase.class);
+   }
+
+   public void testAnnotatedLifecycle() throws Throwable
+   {
+      SimpleLifecycleBean target;
+
+      KernelControllerContext context = getControllerContext(BEAN_NAME, ControllerState.NOT_INSTALLED);
+      assertEquals(context.getState(), ControllerState.NOT_INSTALLED);
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.START);
+      assertEquals(context.getState(), ControllerState.START);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CONFIGURED);
+      assertEquals(context.getState(), ControllerState.CONFIGURED);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.deployment.support.SimpleLifecycleBean;
+import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
+
+/**
+ * Test mixed lifecycle with annotation override.
+ *
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class MixedLifecycleTestCase extends ManualMicrocontainerTest
+{
+
+   private static final String BEAN_NAME = "LifecycleBean";
+
+   public MixedLifecycleTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(MixedLifecycleTestCase.class);
+   }
+
+   public void testAnnotatedLifecycle() throws Throwable
+   {
+      SimpleLifecycleBean target;
+
+      KernelControllerContext context = getControllerContext(BEAN_NAME, ControllerState.NOT_INSTALLED);
+      assertEquals(context.getState(), ControllerState.NOT_INSTALLED);
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertFalse(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.START);
+      assertEquals(context.getState(), ControllerState.START);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertTrue(target.isStart());
+      assertFalse(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CREATE);
+      assertEquals(context.getState(), ControllerState.CREATE);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertTrue(target.isStart());
+      assertTrue(target.isStop());
+      assertFalse(target.isDestroy());
+
+      change(context, ControllerState.CONFIGURED);
+      assertEquals(context.getState(), ControllerState.CONFIGURED);
+      target = (SimpleLifecycleBean) context.getTarget();
+      assertNotNull(target);
+      assertFalse(target.isCreate());
+      assertTrue(target.isStart());
+      assertTrue(target.isStop());
+      assertTrue(target.isDestroy());
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java	2007-05-14 21:33:31 UTC (rev 63036)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleTestCase.java	2007-05-15 01:06:50 UTC (rev 63037)
@@ -25,7 +25,6 @@
 import java.util.HashSet;
 
 import junit.framework.Test;
-
 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
 import org.jboss.beans.metadata.spi.LifecycleMetaData;
 
@@ -61,6 +60,15 @@
       assertNull(lifecycle.getParameters());
    }
 
+   public void testLifecycleWithIgnored() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle("LifecycleWithIgnored.xml");
+      assertTrue(lifecycle.isIgnored());
+      assertNull(lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
    public void testLifecycleWithAnnotation() throws Exception
    {
       LifecycleMetaData lifecycle = getLifecycle("LifecycleWithAnnotation.xml");




More information about the jboss-cvs-commits mailing list