[jboss-cvs] JBossAS SVN: r59673 - in projects/microcontainer/trunk: aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 16 11:52:17 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-01-16 11:52:00 -0500 (Tue, 16 Jan 2007)
New Revision: 59673

Added:
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ConfigureLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/CreateLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DescribeLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstallLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstantiateLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/StartLifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleTestCaseNotAutomatic.xml
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Configure.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Create.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Describe.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Install.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Instantiate.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleInterceptor.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Start.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleTestCase.java
Modified:
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java
   projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JMXLifecycleTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FineGrainedBean.java
Log:
Add support for fine-grained KernelControllerContextAware interfaces in aop-mc integration

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -30,8 +30,8 @@
 import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
 import org.jboss.dependency.spi.Controller;
 import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.ConfigureKernelControllerContextAware;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
 import org.jboss.logging.Logger;
 import org.jboss.util.id.GUID;
 
@@ -41,7 +41,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class Aspect implements KernelControllerContextAware, Untransformable
+public class Aspect implements ConfigureKernelControllerContextAware, Untransformable
 {
    private static final Logger log = Logger.getLogger(Aspect.class);
    

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ConfigureLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ConfigureLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ConfigureLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigureLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.ConfigureKernelControllerContextAware";
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/CreateLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/CreateLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/CreateLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class CreateLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.CreateKernelControllerContextAware";
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DescribeLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DescribeLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DescribeLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DescribeLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.DescribeKernelControllerContextAware";
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstallLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstallLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstallLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstallLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.InstallKernelControllerContextAware";
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstantiateLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstantiateLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/InstantiateLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class InstantiateLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.InstantiateKernelControllerContextAware";
+   }
+}

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -36,8 +36,7 @@
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision: 1.1 $
  */
-public class LifecycleBeanMetaDataFactory extends AspectBeanMetaDataFactory
-   implements BeanMetaDataFactory
+public abstract class LifecycleBeanMetaDataFactory extends AspectBeanMetaDataFactory implements BeanMetaDataFactory
 {
    private static final long serialVersionUID = 1L;
 
@@ -73,7 +72,9 @@
    {
       AbstractListMetaData interfaces = new AbstractListMetaData();
       interfaces.setElementType("java.lang.String");
-      interfaces.add(new StringValueMetaData("org.jboss.kernel.spi.dependency.KernelControllerContextAware"));
+      interfaces.add(new StringValueMetaData(getControllerInterface()));
       return interfaces;
    }
+   
+   protected abstract String getControllerInterface();
 }

Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/StartLifecycleBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/StartLifecycleBeanMetaDataFactory.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/StartLifecycleBeanMetaDataFactory.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.aop.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartLifecycleBeanMetaDataFactory extends LifecycleBeanMetaDataFactory
+{
+   @Override
+   protected String getControllerInterface()
+   {
+      return "org.jboss.kernel.spi.dependency.StartKernelControllerContextAware";
+   }
+
+}

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -25,7 +25,13 @@
 import javax.xml.namespace.QName;
 
 import org.jboss.aop.microcontainer.beans.AspectBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.ConfigureLifecycleBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.CreateLifecycleBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.DescribeLifecycleBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.InstallLifecycleBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.InstantiateLifecycleBeanMetaDataFactory;
 import org.jboss.aop.microcontainer.beans.LifecycleBeanMetaDataFactory;
+import org.jboss.aop.microcontainer.beans.StartLifecycleBeanMetaDataFactory;
 import org.jboss.kernel.plugins.deployment.xml.BeanFactoryHandler;
 import org.jboss.kernel.plugins.deployment.xml.BeanSchemaBinding20;
 import org.jboss.kernel.plugins.deployment.xml.BeanSchemaBindingHelper;
@@ -49,72 +55,166 @@
    /** The aspect binding */
    private static final QName aspectTypeQName = new QName(AOP_BEANS_NS, "aspectType");
    
+   /** The lifecycle configure aspect binding */
+   private static final QName lifecycleConfigureTypeQName = new QName(AOP_BEANS_NS, "lifecycleConfigureType");
+   
+   /** The lifecycle create aspect binding */
+   private static final QName lifecycleCreateTypeQName = new QName(AOP_BEANS_NS, "lifecycleCreateType");
+   
+   /** The lifecycle describe aspect binding */
+   private static final QName lifecycleDescribeTypeQName = new QName(AOP_BEANS_NS, "lifecycleDescribeType");
+   
    /** The lifecycle aspect binding */
-   private static final QName lifecycleTypeQName = new QName(AOP_BEANS_NS, "lifecycleType");
+   private static final QName lifecycleInstallTypeQName = new QName(AOP_BEANS_NS, "lifecycleInstallType");
    
+   /** The lifecycle aspect binding */
+   private static final QName lifecycleInstantiateTypeQName = new QName(AOP_BEANS_NS, "lifecycleInstantiateType");
+   
+   /** The lifecycle start aspect binding */
+   private static final QName lifecycleStartTypeQName = new QName(AOP_BEANS_NS, "lifecycleStartType");
+
+   
    public SchemaBinding init(SchemaBinding schema)
    {
       // aspect binding
       TypeBinding aspectType = schema.getType(aspectTypeQName);
       BeanSchemaBindingHelper.initBeanFactoryHandlers(aspectType);
-      aspectType.setHandler(new BeanFactoryHandler()
+      aspectType.setHandler(new AspectBeanFactoryHandler());
+
+      //Configure binding
+      TypeBinding lifecycleConfigureTypeQ = schema.getType(lifecycleConfigureTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleConfigureTypeQ);
+      lifecycleConfigureTypeQ.setHandler(new ConfigureLifecycleBeanFactoryHandler());
+
+      //Create binding
+      TypeBinding lifecycleCreateType = schema.getType(lifecycleCreateTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleCreateType);
+      lifecycleCreateType.setHandler(new CreateLifecycleBeanFactoryHandler());
+
+      //Describe binding
+      TypeBinding lifecycleDescribeType = schema.getType(lifecycleDescribeTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleDescribeType);
+      lifecycleDescribeType.setHandler(new DescribeLifecycleBeanFactoryHandler());
+
+      //Install binding
+      TypeBinding lifecycleInstallType = schema.getType(lifecycleInstallTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleInstallType);
+      lifecycleInstallType.setHandler(new InstallLifecycleBeanFactoryHandler());
+      
+      //Instantiate binding
+      TypeBinding lifecycleInstantiateType = schema.getType(lifecycleInstantiateTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleInstantiateType);
+      lifecycleInstantiateType.setHandler(new InstantiateLifecycleBeanFactoryHandler());
+      
+      //Start binding
+      TypeBinding lifecycleStartType = schema.getType(lifecycleStartTypeQName);
+      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleStartType);
+      lifecycleStartType.setHandler(new StartLifecycleBeanFactoryHandler());
+      
+      // TODO FIXME???
+      BeanSchemaBinding20.initArtifacts(schema);
+      
+      return schema;
+   }
+   
+   private static class AspectBeanFactoryHandler extends BeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
       {
-         public Object startElement(Object parent, QName name, ElementBinding element)
-         {
-            return new AspectBeanMetaDataFactory();
-         }
+         return new AspectBeanMetaDataFactory();
+      }
 
-         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
+      public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
+      {
+         super.attributes(o, elementName, element, attrs, nsCtx);
+
+         AspectBeanMetaDataFactory factory = (AspectBeanMetaDataFactory) o;
+         for (int i = 0; i < attrs.getLength(); ++i)
          {
-            super.attributes(o, elementName, element, attrs, nsCtx);
-
-            AspectBeanMetaDataFactory factory = (AspectBeanMetaDataFactory) o;
-            for (int i = 0; i < attrs.getLength(); ++i)
-            {
-               String localName = attrs.getLocalName(i);
-               if ("pointcut".equals(localName))
-                  factory.setPointcut(attrs.getValue(i));
-               else if ("manager-bean".equals(localName))
-                  factory.setManagerBean(attrs.getValue(i));
-               else if ("manager-property".equals(localName))
-                  factory.setManagerProperty(attrs.getValue(i));
-            }
+            String localName = attrs.getLocalName(i);
+            setAttribute(factory, localName, attrs.getValue(i));
          }
-      });
-
-      //lifecycle binding
-      TypeBinding lifecycleType = schema.getType(lifecycleTypeQName);
-      BeanSchemaBindingHelper.initBeanFactoryHandlers(lifecycleType);
-      lifecycleType.setHandler(new BeanFactoryHandler()
+      }
+      
+      protected void setAttribute(AspectBeanMetaDataFactory factory, String localName, String attr)
       {
-         public Object startElement(Object parent, QName name, ElementBinding element)
+         if ("pointcut".equals(localName))
          {
-            return new LifecycleBeanMetaDataFactory();
+            factory.setPointcut(attr);
          }
+         else if ("manager-bean".equals(localName))
+         {
+            factory.setManagerBean(attr);
+         }
+         else if ("manager-property".equals(localName))
+         {
+            factory.setManagerProperty(attr);
+         }
+      }
+   }
 
-         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
+   private static class LifecycleBeanFactoryHandler extends AspectBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         throw new RuntimeException("Do not use <lifecycle> directly");
+      }
+
+      protected void setAttribute(AspectBeanMetaDataFactory factory, String localName, String attr)
+      {
+         super.setAttribute(factory, localName, attr);
+         if ("classes".equals(localName))
          {
-            super.attributes(o, elementName, element, attrs, nsCtx);
-
-            LifecycleBeanMetaDataFactory factory = (LifecycleBeanMetaDataFactory) o;
-            for (int i = 0; i < attrs.getLength(); ++i)
-            {
-               String localName = attrs.getLocalName(i);
-               if ("pointcut".equals(localName))
-                  factory.setPointcut(attrs.getValue(i));
-               else if ("manager-bean".equals(localName))
-                  factory.setManagerBean(attrs.getValue(i));
-               else if ("manager-property".equals(localName))
-                  factory.setManagerProperty(attrs.getValue(i));
-               else if ("classes".equals(localName))
-                  factory.setClasses(attrs.getValue(i));
-            }
+            ((LifecycleBeanMetaDataFactory)factory).setClasses(attr);
          }
-      });
-      
-      // TODO FIXME???
-      BeanSchemaBinding20.initArtifacts(schema);
-      
-      return schema;
+      }
    }
+   
+   private static class ConfigureLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new ConfigureLifecycleBeanMetaDataFactory();
+      }
+   }
+   
+   private static class CreateLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new CreateLifecycleBeanMetaDataFactory();
+      }
+   }
+   
+   private static class DescribeLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new DescribeLifecycleBeanMetaDataFactory();
+      }
+   }
+   
+   private static class InstallLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new InstallLifecycleBeanMetaDataFactory();
+      }
+   }
+   
+   private static class InstantiateLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new InstantiateLifecycleBeanMetaDataFactory();
+      }
+   }
+   
+   private static class StartLifecycleBeanFactoryHandler extends LifecycleBeanFactoryHandler
+   {
+      public Object startElement(Object parent, QName name, ElementBinding element)
+      {
+         return new StartLifecycleBeanMetaDataFactory();
+      }
+   }
 }

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd	2007-01-16 16:52:00 UTC (rev 59673)
@@ -47,7 +47,7 @@
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>
-   
+<!--   
    <xsd:element name="lifecycle" type="lifecycleType">
       <xsd:annotation>
          <xsd:documentation>
@@ -57,7 +57,7 @@
          </xsd:documentation>
       </xsd:annotation>
    </xsd:element>
-
+-->
    <xsd:complexType name="lifecycleType">
       <xsd:annotation>
          <xsd:documentation>
@@ -73,4 +73,142 @@
       </xsd:complexContent>
    </xsd:complexType>
    
+   <xsd:element name="lifecycle-configure" type="lifecycleConfigureType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is configured/unconfigured
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleConfigureType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is configured/unconfigured
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
+   <xsd:element name="lifecycle-create" type="lifecycleCreateType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is created/destroyed
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleCreateType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is created/destroyed
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
+   <xsd:element name="lifecycle-describe" type="lifecycleDescribeType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is described/undescribed
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleDescribeType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is described/undescribed
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
+   <xsd:element name="lifecycle-install" type="lifecycleInstallType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is installed/uninstalled
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleInstallType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is installed/uninstalled
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
+   <xsd:element name="lifecycle-instantiate" type="lifecycleInstantiateType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is instantiated/uninstantiated
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleInstantiateType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is instantiated/uninstantiated
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
+   <xsd:element name="lifecycle-start" type="lifecycleStartType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is started/stopped
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+   </xsd:element>
+   
+   <xsd:complexType name="lifecycleStartType">
+      <xsd:annotation>
+         <xsd:documentation>
+           <![CDATA[
+           An aspect intercepting when a bean is started/stopped
+           ]]>
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+         <xsd:extension base="lifecycleType"/>
+      </xsd:complexContent>
+   </xsd:complexType>
+   
 </xsd:schema>

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JMXLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JMXLifecycleTestCase.xml	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JMXLifecycleTestCase.xml	2007-01-16 16:52:00 UTC (rev 59673)
@@ -12,13 +12,13 @@
       <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
    </bean>
 
-   <aop:lifecycle xmlns:aop="urn:jboss:aop-beans:1.0"
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
                name="DependencyAdvice"
                class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction"
                classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX"
                pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
       <property name="mbeanServer"><inject bean="MBeanServer"/></property>
-   </aop:lifecycle>
+   </aop:lifecycle-configure>
 
    <bean name="Bean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="", exposedInterface=org.jboss.test.microcontainer.support.SimpleBean.class)</annotation>

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.xml	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/JndiLifeCycleTestCase.xml	2007-01-16 16:52:00 UTC (rev 59673)
@@ -8,7 +8,7 @@
       <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
    </bean>
 
-   <aop:lifecycle xmlns:aop="urn:jboss:aop-beans:1.0"
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
       name="DependencyAdvice"
       class="org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction"
       classes="@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding"
@@ -18,7 +18,7 @@
             <entry><key>java.naming.factory.initial</key><value>org.jboss.test.microcontainer.support.jndi.MockInitialContextFactory</value></entry>
          </map>
       </property>
-   </aop:lifecycle>
+   </aop:lifecycle-configure>
 
    
    <bean name="Bean" class="org.jboss.test.microcontainer.support.jndi.SimpleBean">

Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleTestCaseNotAutomatic.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleTestCaseNotAutomatic.xml	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleTestCaseNotAutomatic.xml	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="MBeanServer" class="java.lang.Object">
+      <constructor factoryClass="javax.management.MBeanServerFactory" factoryMethod="createMBeanServer"/>
+   </bean>
+
+   <bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="ConfigureAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Configure"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Configure->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-configure>
+
+   <aop:lifecycle-create xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="CreateAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Create"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Create->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-create>
+
+   <aop:lifecycle-describe xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="DescribeAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Describe"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Describe->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-describe>
+
+   <aop:lifecycle-install xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="InstallAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Install"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Install->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-install>
+
+   <aop:lifecycle-instantiate xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="InstantiateAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Instantiate"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Instantiate->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-instantiate>
+
+   <aop:lifecycle-start xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="StartAdvice"
+               class="org.jboss.test.microcontainer.support.LifecycleInterceptor"
+               classes="@org.jboss.test.microcontainer.support.Start"
+               pointcut="execution(* @org.jboss.test.microcontainer.support.Start->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+   </aop:lifecycle-start>
+
+   <bean name="ConfigureBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Configure</annotation>
+   </bean>
+
+   <bean name="CreateBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Create</annotation>
+   </bean>
+
+   <bean name="DescribeBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Describe</annotation>
+   </bean>
+
+   <bean name="InstallBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Install</annotation>
+   </bean>
+
+   <bean name="InstantiateBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Instantiate</annotation>
+   </bean>
+
+   <bean name="StartBean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.test.microcontainer.support.Start</annotation>
+   </bean>
+</deployment>

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.xml	2007-01-16 16:52:00 UTC (rev 59673)
@@ -12,20 +12,20 @@
       <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
    </bean>
 
-   <aop:lifecycle xmlns:aop="urn:jboss:aop-beans:1.0"
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
                name="JMXAdvice"
                class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction"
                classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX"
                pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
       <property name="mbeanServer"><inject bean="MBeanServer"/></property>
-   </aop:lifecycle>
+   </aop:lifecycle-configure>
 
-   <aop:lifecycle xmlns:aop="urn:jboss:aop-beans:1.0"
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
                name="JndiAdvice"
                class="org.jboss.test.microcontainer.support.CalledInterceptor"
                classes="org.jboss.test.microcontainer.support.SimpleBeanImpl"
                pointcut="execution(* org.jboss.test.microcontainer.support.SimpleBeanImpl->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
-   </aop:lifecycle>
+   </aop:lifecycle-configure>
 
    <bean name="Bean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="", exposedInterface=org.jboss.test.microcontainer.support.SimpleBean.class)</annotation>

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Configure.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Configure.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Configure.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Configure {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Create.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Create.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Create.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Create {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Describe.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Describe.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Describe.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Describe {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Install.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Install.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Install.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Install {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Instantiate.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Instantiate.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Instantiate.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Instantiate {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleInterceptor.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleInterceptor.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleInterceptor.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LifecycleInterceptor implements Interceptor
+{
+   public static Map<String, ArrayList<Class>> interceptions = new HashMap<String, ArrayList<Class>>();
+   Class[] lifecycleAnnotations = new Class[] {Configure.class, Create.class, Describe.class, Install.class, Instantiate.class, Start.class}; 
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      MethodInvocation mi = (MethodInvocation)invocation;
+      KernelControllerContext context = (KernelControllerContext) mi.getArguments()[0];
+
+      for (int i = 0 ; i < lifecycleAnnotations.length ; i++)
+      {
+         Object cur = invocation.resolveClassAnnotation(lifecycleAnnotations[i]);
+         if (cur != null)
+         {
+            addInterception(context, lifecycleAnnotations[i]);
+         }
+      }
+      
+      return null;
+   }
+   
+   private void addInterception(KernelControllerContext context, Class annotation)
+   {
+      String name = (String)context.getName();
+      ArrayList<Class> beanInterceptions = interceptions.get(name);
+      if (beanInterceptions == null)
+      {
+         beanInterceptions = new ArrayList<Class>();
+         interceptions.put(name, beanInterceptions);
+      }
+      beanInterceptions.add(annotation);
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Start.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Start.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Start.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.microcontainer.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public @interface Start {
+
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleTestCase.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleTestCase.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -0,0 +1,112 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.microcontainer.test;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+
+import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
+import org.jboss.kernel.plugins.deployment.xml.LifecycleAnnotationsInterceptor;
+import org.jboss.test.microcontainer.support.Configure;
+import org.jboss.test.microcontainer.support.Create;
+import org.jboss.test.microcontainer.support.Describe;
+import org.jboss.test.microcontainer.support.Install;
+import org.jboss.test.microcontainer.support.Instantiate;
+import org.jboss.test.microcontainer.support.LifecycleInterceptor;
+import org.jboss.test.microcontainer.support.SimpleBeanImpl;
+import org.jboss.test.microcontainer.support.Start;
+
+public class LifecycleTestCase extends AOPMicrocontainerTest
+{
+   public static Test suite()
+   {
+      return suite(LifecycleTestCase.class);
+   }
+   
+   public LifecycleTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testLifecycleInterceptions() throws Exception
+   {
+      boolean undeployed = false;
+      try
+      {
+         LifecycleInterceptor.interceptions.clear();
+         deploy("LifecycleTestCaseNotAutomatic.xml");
+         
+         //Verify the beans exist
+         checkBeanExists("ConfigureBean");
+         checkBeanExists("CreateBean");
+//         checkBeanExists("DescribeBean"); 
+         checkBeanExists("InstallBean");
+         checkBeanExists("InstantiateBean"); 
+         checkBeanExists("StartBean"); 
+
+         //Now check the expected lifecycle events for each bean
+         checkExpectedAnnotations("ConfigureBean", Configure.class);
+         checkExpectedAnnotations("CreateBean", Create.class);
+//         checkExpectedAnnotations("DescribeBean", Describe.class);
+         checkExpectedAnnotations("InstallBean", Install.class);
+         checkExpectedAnnotations("InstantiateBean", Instantiate.class);
+         checkExpectedAnnotations("StartBean", Start.class);
+         
+         
+         LifecycleInterceptor.interceptions.clear();
+         
+         undeploy("LifecycleTestCaseNotAutomatic.xml");
+         undeployed = true;
+         
+         checkExpectedAnnotations("ConfigureBean", Configure.class);
+         checkExpectedAnnotations("CreateBean", Create.class);
+//         checkExpectedAnnotations("DescribeBean", Describe.class);
+         checkExpectedAnnotations("InstallBean", Install.class);
+         checkExpectedAnnotations("InstantiateBean", Instantiate.class);
+         checkExpectedAnnotations("StartBean", Start.class);
+         
+      }
+      finally
+      {
+         if (!undeployed)
+         {
+            undeploy("LifecycleTestCaseNotAutomatic.xml");
+         }
+      }
+   }
+   
+   public void checkBeanExists(String name)
+   {
+      Object bean = getBean(name);
+      assertNotNull(bean);
+   }
+   
+   public void checkExpectedAnnotations(String name, Class annotation)
+   {
+      ArrayList<Class> events = LifecycleInterceptor.interceptions.get(name);
+      assertNotNull(events);
+      assertEquals("Wrong events, expected one element only " + events, 1, events.size());
+      Class actualAnnotation = events.get(0);
+      assertEquals(annotation, actualAnnotation);
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -29,10 +29,15 @@
 import org.jboss.joinpoint.spi.TargettedJoinpoint;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.dependency.CreateKernelControllerContextAware;
+import org.jboss.kernel.spi.dependency.DescribeKernelControllerContextAware;
+import org.jboss.kernel.spi.dependency.InstallKernelControllerContextAware;
+import org.jboss.kernel.spi.dependency.InstantiateKernelControllerContextAware;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
 import org.jboss.kernel.spi.dependency.ConfigureKernelControllerContextAware;
+import org.jboss.kernel.spi.dependency.StartKernelControllerContextAware;
 
 /**
  * ConfigureAction.
@@ -54,8 +59,13 @@
       Set joinPoints = configurator.getPropertySetterJoinPoints(info, metaData);
       setAttributes(context, object, joinPoints, false);
 
-      if (object instanceof KernelControllerContextAware)
-         ((KernelControllerContextAware) object).setKernelControllerContext(context);
+      //TODO remove this?
+      //In case the class is EXACTLY KernelControllerContextAware, we call it from here, 
+      //required for KernelControllerContextAwareTestCase and KernelControllerContextAwareXMLTestCase
+      if (isExactlyKernelControllerContextAware(object))
+      {
+         ((KernelControllerContextAware) object).setKernelControllerContext(context);            
+      }
 
    }
 
@@ -76,8 +86,13 @@
       {
          if (object != null)
          {
-            if (object instanceof KernelControllerContextAware)
+            //TODO remove this?
+            //In case the class is EXACTLY KernelControllerContextAware, we call it from here, 
+            //required for KernelControllerContextAwareTestCase and KernelControllerContextAwareXMLTestCase
+            if (isExactlyKernelControllerContextAware(object))
+            {
                ((KernelControllerContextAware) object).unsetKernelControllerContext(context);
+            }
          }
       }
       catch (Throwable ignored)
@@ -137,4 +152,15 @@
       }
    }
 
+   private boolean isExactlyKernelControllerContextAware(Object o)
+   {
+      Class clazz = o.getClass();
+      return KernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               (!ConfigureKernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               !CreateKernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               !DescribeKernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               !InstallKernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               !InstantiateKernelControllerContextAware.class.isAssignableFrom(o.getClass()) &&
+               !StartKernelControllerContextAware.class.isAssignableFrom(o.getClass()));
+   }
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -207,7 +207,8 @@
                awareInterface.equals(KernelControllerContextAware.class) == false &&
                awareInterface.isAssignableFrom(target.getClass()))
          {
-            ((KernelControllerContextAware) target).setKernelControllerContext(context);
+            System.out.println("-----> " + context.getName() + " " + target.getClass() + " " + context.getState());
+            ((KernelControllerContextAware)target).setKernelControllerContext(context);
          }
       }
    }

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FineGrainedBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FineGrainedBean.java	2007-01-16 16:48:36 UTC (rev 59672)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FineGrainedBean.java	2007-01-16 16:52:00 UTC (rev 59673)
@@ -36,7 +36,6 @@
    public static String[] states = {
          "NOT_INSTALLED (DESCRIBED)",
          "INSTANTIATED",
-         "CONFIGURED", // since ConfigureAction calls this as well, remove this once we remove that from CA
          "CONFIGURED",
          "CREATE",
          "START",




More information about the jboss-cvs-commits mailing list