[jboss-cvs] JBossAS SVN: r64949 - in projects/microcontainer/trunk: aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jndi and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 29 10:29:22 EDT 2007


Author: adrian at jboss.org
Date: 2007-08-29 10:29:21 -0400 (Wed, 29 Aug 2007)
New Revision: 64949

Added:
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractScopeInfo.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ScopeInfo.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableScopeInfo.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java
Removed:
   projects/microcontainer/trunk/container/src/main/org/jboss/metadata/spi/helpers/
Modified:
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXLifecycleCallback.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jndi/JndiLifecycleCallback.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleCallback.java
   projects/microcontainer/trunk/dependency/.classpath
   projects/microcontainer/trunk/dependency/pom-jdk14.xml
   projects/microcontainer/trunk/dependency/pom.xml
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractControllerContext.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ControllerContext.java
   projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableControllerContext.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/FromContext.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/AbstractKernelRegistryEntry.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/helpers/UnmodifiableKernelControllerContext.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/metadata/KernelMetaDataRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/FromContextUnsupportedTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/metadata/test/AbstractMetaDataTest.java
Log:
[JBMICROCONT-196] - Refactor the Scope/MetaData such that it applies to all contexts and there is more control over the scopes created. Also added some simple trace logging for the annotations processing.

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXLifecycleCallback.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXLifecycleCallback.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXLifecycleCallback.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -26,8 +26,8 @@
 import javax.management.StandardMBean;
 
 import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.spi.MetaData;
 
 /**
  * 
@@ -50,7 +50,7 @@
       JMX jmx = readJmxAnnotation(context);
       ObjectName objectName = createObjectName(context, jmx); 
 
-      Class intfClass = null;
+      Class<?> intfClass = null;
       boolean registerDirectly = false;
       if (jmx != null)
       {
@@ -83,13 +83,9 @@
    
    private JMX readJmxAnnotation(ControllerContext context) throws Exception
    {
-      if (context instanceof KernelControllerContext)
-      {
-         if (((KernelControllerContext)context).getMetaData() != null)
-         {
-            return ((KernelControllerContext)context).getMetaData().getAnnotation(JMX.class);
-         }
-      }
+      MetaData metaData = context.getScopeInfo().getMetaData();
+      if (metaData != null)
+         return metaData.getAnnotation(JMX.class);
       return null;
    }
    

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jndi/JndiLifecycleCallback.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jndi/JndiLifecycleCallback.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jndi/JndiLifecycleCallback.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -30,6 +30,7 @@
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.spi.MetaData;
 import org.jboss.util.naming.Util;
 
 /**
@@ -173,13 +174,9 @@
    
    private JndiBinding readJndiAnnotation(ControllerContext context)
    {
-      if (context instanceof KernelControllerContext)
-      {
-         if (((KernelControllerContext)context).getMetaData() != null)
-         {
-            return ((KernelControllerContext)context).getMetaData().getAnnotation(JndiBinding.class);
-         }
-      }
+      MetaData metaData = context.getScopeInfo().getMetaData();
+      if (metaData != null)
+         return metaData.getAnnotation(JndiBinding.class);
       return null;
    }
 }

Modified: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleCallback.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleCallback.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/LifecycleCallback.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -60,7 +60,7 @@
       {
          for (int i = 0 ; i < lifecycleAnnotations.length ; i++)
          {
-            MetaData metaData = ((KernelControllerContext)context).getMetaData();
+            MetaData metaData = context.getScopeInfo().getMetaData();
             Object cur = metaData.getAnnotation(lifecycleAnnotations[i]);
             if (cur != null)
             {

Modified: projects/microcontainer/trunk/dependency/.classpath
===================================================================
--- projects/microcontainer/trunk/dependency/.classpath	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/.classpath	2007-08-29 14:29:21 UTC (rev 64949)
@@ -1,21 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main"/>
-  <classpathentry kind="src" path="src/tests" output="eclipse-target/tests-classes"/>
-  <classpathentry kind="output" path="eclipse-target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" path="src/main"/>
+	<classpathentry kind="src" output="eclipse-target/tests-classes" path="src/tests"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT.jar" sourcepath="M2_REPO/jboss/jboss-test/1.0.4-SNAPSHOT/jboss-test-1.0.4-SNAPSHOT-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.4.GA/jboss-common-core-2.0.4.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jboss-container"/>
+	<classpathentry kind="output" path="eclipse-target/classes"/>
+</classpath>

Modified: projects/microcontainer/trunk/dependency/pom-jdk14.xml
===================================================================
--- projects/microcontainer/trunk/dependency/pom-jdk14.xml	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/pom-jdk14.xml	2007-08-29 14:29:21 UTC (rev 64949)
@@ -133,6 +133,12 @@
   <dependencies>
     <!-- Global dependencies -->
     <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-container</artifactId>
+      <version>2.0.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core-jdk14</artifactId>
     </dependency>

Modified: projects/microcontainer/trunk/dependency/pom.xml
===================================================================
--- projects/microcontainer/trunk/dependency/pom.xml	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/pom.xml	2007-08-29 14:29:21 UTC (rev 64949)
@@ -47,6 +47,10 @@
   <dependencies>
     <!-- Global dependencies -->
     <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-container</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core</artifactId>
     </dependency>

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractControllerContext.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -33,6 +33,7 @@
 import org.jboss.dependency.spi.ControllerMode;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ScopeInfo;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
 
@@ -71,6 +72,9 @@
    /** The dependencies */
    private DependencyInfo dependencies;
 
+   /** The scope info */
+   private ScopeInfo scopeInfo;
+   
    /** Any error */
    private Throwable error;
 
@@ -134,6 +138,7 @@
         this.dependencies = dependencies;
       this.target = target;
       setAliases(aliases);
+      initScopeInfo();
    }
 
    /**
@@ -149,6 +154,7 @@
 
       this.name = name;
       this.target = target;
+      initScopeInfo();
    }
    
    public Object getName()
@@ -263,6 +269,23 @@
       return dependencies;
    }
 
+   public ScopeInfo getScopeInfo()
+   {
+      return scopeInfo;
+   }
+
+   /**
+    * Set the scopeInfo.
+    * 
+    * @param scopeInfo the scopeInfo.
+    */
+   public void setScopeInfo(ScopeInfo scopeInfo)
+   {
+      if (scopeInfo == null)
+         throw new IllegalArgumentException("Null scope info");
+      this.scopeInfo = scopeInfo;
+   }
+
    public Object getTarget()
    {
       return target;
@@ -353,6 +376,18 @@
    }
    
    /**
+    * Initialise the scope info
+    */
+   protected void initScopeInfo()
+   {
+      String className = null;
+      Object target = getTarget();
+      if (target != null)
+         className = target.getClass().getName();
+      setScopeInfo(new AbstractScopeInfo(getName(), className));
+   }
+   
+   /**
     * Whether the given name needs an alias<p>
     * 
     * By default we just add aliases for JMX like ObjectNames to have a canonical name alias

Added: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractScopeInfo.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractScopeInfo.java	                        (rev 0)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractScopeInfo.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -0,0 +1,194 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.dependency.plugins;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ScopeInfo;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * AbstractScopeInfo.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractScopeInfo implements ScopeInfo
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(AbstractScopeInfo.class);
+   
+   /** The scope */
+   private ScopeKey scopeKey;
+   
+   /** The mutable scope */
+   private ScopeKey mutableScopeKey;
+
+   /** The install scope */
+   private ScopeKey installScope;
+   
+   /** The repository */
+   private MutableMetaDataRepository repository;
+
+   /**
+    * Create a new AbstractScopeInfo.
+    * 
+    * @param name the name
+    */
+   public AbstractScopeInfo(Object name)
+   {
+      this(name, null);
+   }
+   
+   /**
+    * Create a new AbstractScopeInfo.
+    * 
+    * @param name the name
+    * @param className the class name
+    */
+   public AbstractScopeInfo(Object name, String className)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null scope");
+
+      ScopeKey scopeKey = ScopeKey.DEFAULT_SCOPE.clone();
+      scopeKey.addScope(CommonLevels.INSTANCE, name.toString());
+      if (className != null)
+         scopeKey.addScope(CommonLevels.CLASS, className);
+      // todo - some other level
+      scopeKey.addScope(CommonLevels.WORK, String.valueOf(hashCode()));
+      setScope(scopeKey);
+      setMutableScope(new ScopeKey(CommonLevels.INSTANCE, name.toString()));
+   }
+   
+   /**
+    * Create a new AbstractScopeInfo.
+    * 
+    * @param key the scope key
+    * @param mutable the mutable scope key
+    */
+   public AbstractScopeInfo(ScopeKey key, ScopeKey mutable)
+   {
+      setScope(key);
+      setMutableScope(mutable);
+   }
+
+   public MetaData getMetaData()
+   {
+      if (repository == null)
+         return null;
+      return repository.getMetaData(getScope());
+   }
+
+   public void addMetaData(MutableMetaDataRepository repository, ControllerContext context)
+   {
+      this.repository = repository;
+      ScopeKey scope = getMutableScope();
+      MemoryMetaDataLoader mutable = new MemoryMetaDataLoader(scope);
+      repository.addMetaDataRetrieval(mutable);
+      addMetaData(repository, context, mutable);
+   }
+
+   /**
+    * Add metadata
+    * 
+    * @param repository the repository
+    * @param context the context
+    * @param mutable the mutable
+    */
+   protected void addMetaData(MutableMetaDataRepository repository, ControllerContext context, MemoryMetaDataLoader mutable)
+   {
+      // nothing
+   }
+
+   public void removeMetaData(MutableMetaDataRepository repository, ControllerContext context)
+   {
+      // Remove the read only/full scope
+      try
+      {
+         ScopeKey scope = getScope();
+         repository.removeMetaDataRetrieval(scope);
+      }
+      catch (Exception e)
+      {
+         log.trace("Ignored", e);
+      }
+      try
+      {
+         // Remove the mutable scope
+         ScopeKey scope = getMutableScope();
+         repository.removeMetaDataRetrieval(scope);
+      }
+      catch (Exception e)
+      {
+         log.trace("Ignored", e);
+      }
+      this.repository = null;
+      
+   }
+
+   public MetaDataRetrieval initMetaDataRetrieval(MutableMetaDataRepository repository, ControllerContext context, Scope scope)
+   {
+      // Nothing
+      return null;
+   }
+
+   public ScopeKey getScope()
+   {
+      return scopeKey;
+   }
+
+   public void setScope(ScopeKey key)
+   {
+      if (key == null)
+         throw new IllegalArgumentException("Null scope key");
+      this.scopeKey = key;
+   }
+
+   public ScopeKey getMutableScope()
+   {
+      return mutableScopeKey;
+   }
+
+   public void setMutableScope(ScopeKey key)
+   {
+      if (key == null)
+         throw new IllegalArgumentException("Null scope key");
+      this.mutableScopeKey = key;
+   }
+
+   public ScopeKey getInstallScope()
+   {
+      return installScope;
+   }
+
+   public void setInstallScope(ScopeKey key)
+   {
+      this.installScope = key;
+   }
+}

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ControllerContext.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -55,6 +55,13 @@
    DependencyInfo getDependencyInfo();
    
    /**
+    * Get the scope information
+    * 
+    * @return the scope information
+    */
+   ScopeInfo getScopeInfo();
+   
+   /**
     * Get any target
     * 
     * @return the target

Added: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ScopeInfo.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ScopeInfo.java	                        (rev 0)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/ScopeInfo.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -0,0 +1,112 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.dependency.spi;
+
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * ScopeInfo.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ScopeInfo
+{
+   /**
+    * Get the metadata
+    * 
+    * @return the metadata
+    */
+   MetaData getMetaData();
+
+   /**
+    * Add metadata
+    * 
+    * @param repository the repository
+    * @param context the controller context
+    */
+   void addMetaData(MutableMetaDataRepository repository, ControllerContext context);
+
+   /**
+    * Add metadata
+    * 
+    * @param repository the repository
+    * @param context the controller context
+    */
+   void removeMetaData(MutableMetaDataRepository repository, ControllerContext context);
+
+   /**
+    * Initialise the metadata retrieval
+    * 
+    * @param repository the repository
+    * @param context the context
+    * @param scope the scope level
+    * @return the retrieval
+    */
+   MetaDataRetrieval initMetaDataRetrieval(MutableMetaDataRepository repository, ControllerContext context, Scope scope);
+
+   /**
+    * Get the scope
+    * 
+    * @return the scope
+    */
+   ScopeKey getScope();
+
+   /**
+    * Set the scope
+    * 
+    * @param key the scope key
+    */
+   void setScope(ScopeKey key);
+
+   /**
+    * Get the mutable scope
+    * 
+    * @return the scope
+    */
+   ScopeKey getMutableScope();
+
+   /**
+    * Set the mutable scope
+    * 
+    * @param key the scope key
+    */
+   void setMutableScope(ScopeKey key);
+
+   /**
+    * Get the install scope
+    *
+    * @return the scope
+    */
+   ScopeKey getInstallScope();
+
+   /**
+    * Set the install scope
+    *
+    * @param key the scope key
+    */
+   void setInstallScope(ScopeKey key);
+}

Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableControllerContext.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -29,6 +29,7 @@
 import org.jboss.dependency.spi.ControllerMode;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ScopeInfo;
 import org.jboss.util.JBossObject;
 
 /**
@@ -43,6 +44,8 @@
 
    public UnmodifiableControllerContext(T delegate)
    {
+      if (delegate == null)
+         throw new IllegalArgumentException("Null delegate");
       this.delegate = delegate;
    }
 
@@ -63,6 +66,12 @@
       return dependencyInfo != null ? new UnmodifiableDependencyInfo(dependencyInfo) : null;
    }
 
+   public ScopeInfo getScopeInfo()
+   {
+      ScopeInfo scopeInfo = delegate.getScopeInfo();
+      return scopeInfo != null ? new UnmodifiableScopeInfo(scopeInfo) : null;
+   }
+
    public Object getTarget()
    {
       return delegate.getTarget();

Added: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableScopeInfo.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableScopeInfo.java	                        (rev 0)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/helpers/UnmodifiableScopeInfo.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -0,0 +1,104 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.dependency.spi.helpers;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ScopeInfo;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * UnmodifiableScopeInfo.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class UnmodifiableScopeInfo implements ScopeInfo
+{
+   /** The delegate */
+   private ScopeInfo delegate;
+
+   /**
+    * Create a new UnmodifiableScopeInfo.
+    * 
+    * @param delegate the delegate
+    */
+   public UnmodifiableScopeInfo(ScopeInfo delegate)
+   {
+      if (delegate == null)
+         throw new IllegalArgumentException("Null delegate");
+      this.delegate = delegate;
+   }
+
+   public void addMetaData(MutableMetaDataRepository repository, ControllerContext context)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+
+   public void removeMetaData(MutableMetaDataRepository repository, ControllerContext context)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+
+   public MetaDataRetrieval initMetaDataRetrieval(MutableMetaDataRepository repository, ControllerContext context, Scope scope)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+
+   public MetaData getMetaData()
+   {
+      return delegate.getMetaData();
+   }
+
+   public ScopeKey getScope()
+   {
+      return delegate.getScope();
+   }
+
+   public void setScope(ScopeKey key)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+
+   public ScopeKey getMutableScope()
+   {
+      return delegate.getScope();
+   }
+
+   public void setMutableScope(ScopeKey key)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+
+   public ScopeKey getInstallScope()
+   {
+      return delegate.getInstallScope();
+   }
+
+   public void setInstallScope(ScopeKey key)
+   {
+      throw new UnsupportedOperationException("Cannot modify immutable");
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/FromContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/FromContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/FromContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -22,25 +22,24 @@
 package org.jboss.beans.metadata.plugins;
 
 import java.io.Serializable;
-import java.lang.reflect.Method;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.util.Set;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.Set;
 
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.helpers.UnmodifiableBeanInfo;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.helpers.UnmodifiableControllerContext;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.kernel.spi.dependency.helpers.UnmodifiableKernelControllerContext;
 import org.jboss.metadata.spi.MetaData;
 import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.metadata.spi.helpers.UnmodifiableMetaData;
+import org.jboss.reflect.plugins.introspection.ReflectionUtils;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
-import org.jboss.reflect.plugins.introspection.ReflectionUtils;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.helpers.UnmodifiableControllerContext;
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.helpers.UnmodifiableBeanInfo;
 
 /**
  * Inject from controller context:
@@ -242,8 +241,7 @@
 
       public MetaData internalExecute(KernelControllerContext context)
       {
-         MetaData metaData = context.getMetaData();
-         return metaData != null ? new UnmodifiableMetaData(metaData) : null;
+         return context.getScopeInfo().getMetaData();
       }
    }
 
@@ -274,8 +272,7 @@
 
       public ScopeKey internalExecute(KernelControllerContext context)
       {
-         ScopeKey key = context.getScope();
-         return key != null ? key.clone() : null;
+         return context.getScopeInfo().getScope();
       }
    }
 

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/AbstractAnnotationPlugin.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -116,10 +116,26 @@
 
    public final void applyAnnotation(T info, MetaDataRetrieval retrieval, MetaDataVisitor visitor) throws Throwable
    {
-      AnnotationItem<C> item = retrieval.retrieveAnnotation(getAnnotation());
-      if (item == null || isMetaDataAlreadyPresent(info, item.getAnnotation(), visitor.getControllerContext()))
+      boolean trace = log.isTraceEnabled();
+      
+      Class<C> annotationClass = getAnnotation();
+      AnnotationItem<C> item = retrieval.retrieveAnnotation(annotationClass);
+      if (item == null)
+      {
+         if (trace)
+            log.trace("No annotation: " + annotationClass.getName());
          return;
-      List<? extends MetaDataVisitorNode> nodes = internalApplyAnnotation(info, retrieval, item.getAnnotation(), visitor.getControllerContext());
+      }
+      C annotation = item.getAnnotation();
+      if (isMetaDataAlreadyPresent(info, annotation, visitor.getControllerContext()))
+      {
+         if (trace)
+            log.trace("MetaDataAlreadyPresent, ignoring " + annotation);
+         return;
+      }
+      if (trace)
+         log.trace("Applying annotation: " + annotation);
+      List<? extends MetaDataVisitorNode> nodes = internalApplyAnnotation(info, retrieval, annotation, visitor.getControllerContext());
       if (nodes != null && nodes.isEmpty() == false)
       {
          for(MetaDataVisitorNode node : nodes)

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -163,6 +163,9 @@
 
       boolean trace = log.isTraceEnabled();
       BeanInfo info = context.getBeanInfo();
+      Object name = context.getName();
+      if (trace)
+         log.trace(name + " apply annotations");
 
       // class
       ClassInfo classInfo = info.getClassInfo();
@@ -182,8 +185,12 @@
                for(AnnotationPlugin plugin : constructorAnnotationPlugins)
                   plugin.applyAnnotation(ci, cmdr, visitor);
             }
+            else if (trace)
+               log.trace("No annotations for " + ci);
          }
       }
+      else if (trace)
+         log.trace("No constructors");
 
       // properties
       Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
@@ -203,9 +210,13 @@
                   for(AnnotationPlugin plugin : propertyAnnotationPlugins)
                      plugin.applyAnnotation(pi, cmdr, visitor);
                }
+               else if (trace)
+                  log.trace("No annotations for property " + pi.getName());
             }
          }
       }
+      else if (trace)
+         log.trace("No properties");
 
       // methods
       Set<MethodInfo> methods = info.getMethods();
@@ -222,9 +233,13 @@
                   for(AnnotationPlugin plugin : methodAnnotationPlugins)
                      plugin.applyAnnotation(mi, cmdr, visitor);
                }
+               else if (trace)
+                  log.trace("No annotations for " + mi);
             }
          }
       }
+      else if (trace)
+         log.trace("No methods");
 
       // static methods
       MethodInfo[] staticMethods = classInfo.getDeclaredMethods();
@@ -241,9 +256,13 @@
                   for(AnnotationPlugin plugin : methodAnnotationPlugins)
                      plugin.applyAnnotation(smi, cmdr, visitor);
                }
+               else if (trace)
+                  log.trace("No annotations for " + smi);
             }
          }
       }
+      else if (trace)
+         log.trace("No static methods");
 
       // fields
       FieldInfo[] fields = classInfo.getDeclaredFields();
@@ -258,8 +277,12 @@
                for(AnnotationPlugin plugin : fieldAnnotationPlugins)
                   plugin.applyAnnotation(fi, cmdr, visitor);
             }
+            else if (trace)
+               log.trace("No annotations for field " + fi.getName());
          }
       }
+      else if (trace)
+         log.trace("No fields");
    }
 
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -37,10 +37,6 @@
 import org.jboss.kernel.plugins.config.Configurator;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.metadata.KernelMetaDataRepository;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.repository.MetaDataRepository;
-import org.jboss.metadata.spi.scope.ScopeKey;
 import org.jboss.util.JBossStringBuilder;
 
 /**
@@ -72,12 +68,6 @@
    /** Did we do a describeVisit */
    protected boolean isDescribeProcessed;
 
-   /** The scope */
-   protected ScopeKey scope;
-
-   /** The install scope */
-   protected ScopeKey installScope;
-
    /**
     * Create an abstract controller context
     *
@@ -97,6 +87,7 @@
       getDependencyInfo().setAutowireCandidate(autowireCandidate);
       if (System.getSecurityManager() != null)
          accessContext = AccessController.getContext();
+      initKernelScopeInfo();
    }
 
    public Kernel getKernel()
@@ -129,45 +120,6 @@
       return metaData;
    }
 
-   public MetaData getMetaData()
-   {
-      KernelController controller = (KernelController) getController();
-      if (controller == null)
-         throw new IllegalStateException("Context is not associated with a controller");
-      MetaDataRepository repository = controller.getKernel().getMetaDataRepository().getMetaDataRepository();
-      ScopeKey scope = getScope();
-      return repository.getMetaData(scope);
-   }
-
-   public ScopeKey getScope()
-   {
-      if (scope == null)
-      {
-         // Bootstrap (probably not really a good idea?)
-         KernelController controller = (KernelController) getController();
-         if (controller == null)
-            return null;
-         KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
-         scope = repository.getFullScope(this);
-      }
-      return scope;
-   }
-
-   public void setScope(ScopeKey key)
-   {
-      this.scope = key;
-   }
-
-   public ScopeKey getInstallScope()
-   {
-      return installScope;
-   }
-
-   public void setInstallScope(ScopeKey key)
-   {
-      this.installScope = key;
-   }
-
    public void toString(JBossStringBuilder buffer)
    {
       if (metaData != null)
@@ -181,6 +133,28 @@
       preprocessMetaData();
    }
 
+   @Override
+   protected void initScopeInfo()
+   {
+      // nothing
+   }
+
+   protected void initKernelScopeInfo()
+   {
+      String className = null;
+      Object target = getTarget();
+      if (target != null)
+         className = target.getClass().getName();
+      BeanMetaData bmd = getBeanMetaData();
+      if (bmd != null)
+      {
+         String bean = bmd.getBean();
+         if (bean != null)
+            className = bean;
+      }
+      setScopeInfo(new KernelScopeInfo(getName(), className));
+   }
+
    /**
     * Preprocess the metadata for this context
     */

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-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -87,7 +87,7 @@
       if (md != null)
          MetaDataStack.push(md);
       else
-         staticLog.warn("NO METADATA! for " + context.getName() + " with scope " + context.getScope());
+         staticLog.warn("NO METADATA! for " + context.getName() + " with scope " + context.getScopeInfo().getScope());
       try
       {
 

Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -0,0 +1,252 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.kernel.plugins.dependency;
+
+import java.util.Set;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.dependency.plugins.AbstractScopeInfo;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.plugins.config.Configurator;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.TypeInfo;
+
+/**
+ * KernelScopeInfo.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class KernelScopeInfo extends AbstractScopeInfo
+{
+   /**
+    * Create a new KernelScopeInfo.
+    * 
+    * @param name the name
+    * @param className the class name
+    */
+   public KernelScopeInfo(Object name, String className)
+   {
+      super(name, className);
+   }
+
+   /**
+    * Create a new KernelScopeInfo.
+    * 
+    * @param name the name
+    */
+   public KernelScopeInfo(Object name)
+   {
+      super(name);
+   }
+
+   /**
+    * Create a new KernelScopeInfo.
+    * 
+    * @param key the scope
+    * @param mutable the mutable scope
+    */
+   public KernelScopeInfo(ScopeKey key, ScopeKey mutable)
+   {
+      super(key, mutable);
+   }
+
+   @Override
+   public MetaDataRetrieval initMetaDataRetrieval(MutableMetaDataRepository repository, ControllerContext context, Scope scope)
+   {
+      if (scope.getScopeLevel() == CommonLevels.CLASS)
+      {
+         if (context instanceof KernelControllerContext == false)
+            return null;
+         KernelControllerContext theContext = (KernelControllerContext) context;
+         BeanMetaData metaData = theContext.getBeanMetaData();
+         ClassLoader cl = null;
+         try
+         {
+            cl = Configurator.getClassLoader(metaData);
+         }
+         catch (Throwable t)
+         {
+            throw new RuntimeException("Error getting classloader for " + context.getName(), t);
+         }
+         try
+         {
+            Class<?> clazz = cl.loadClass(scope.getQualifier());
+            return new AnnotatedElementMetaDataLoader(clazz);
+         }
+         catch (ClassNotFoundException e)
+         {
+            throw new RuntimeException("Unable to load class: " + scope.getQualifier(), e);
+         }
+      }
+      return null;
+   }
+
+   @Override
+   public void addMetaData(MutableMetaDataRepository repository, ControllerContext context, MemoryMetaDataLoader mutable)
+   {
+      if (context instanceof KernelControllerContext == false)
+         return;
+      KernelControllerContext theContext = (KernelControllerContext) context;
+      addClassAnnotations(mutable, theContext);
+      addPropertyAnnotations(mutable, theContext);
+   }
+
+   
+   /**
+    * Add class annotations
+    * 
+    * @param mutable the mutable metadata
+    * @param context the context
+    */
+   private void addClassAnnotations(MemoryMetaDataLoader mutable, KernelControllerContext context)
+   {
+      BeanMetaData beanMetaData = context.getBeanMetaData();
+      if (beanMetaData != null)
+      {
+         try
+         {
+            ClassLoader cl = Configurator.getClassLoader(beanMetaData);
+            addAnnotations(cl, mutable, beanMetaData.getAnnotations());
+         }
+         catch(Throwable t)
+         {
+            throw new RuntimeException("Error getting classloader for metadata", t);
+         }
+      }
+   }
+
+   /**
+    * Add property annotations
+    * 
+    * @param mutable the mutable
+    * @param context the kernel controller contex
+    */
+   private void addPropertyAnnotations(MemoryMetaDataLoader mutable, KernelControllerContext context)
+   {
+      BeanMetaData beanMetaData = context.getBeanMetaData();
+      if (beanMetaData == null)
+         return;
+
+      Set<PropertyMetaData> properties = beanMetaData.getProperties();
+
+      if (properties == null || properties.size() == 0)
+         return;
+
+      BeanInfo beanInfo = context.getBeanInfo();
+      if (beanInfo == null)
+         return;
+      
+      try
+      {
+         ClassLoader cl = Configurator.getClassLoader(beanMetaData);
+         for (PropertyMetaData property : properties)
+            addPropertyAnnotations(cl, mutable, property, beanInfo);
+      }
+      catch(Throwable t)
+      {
+         throw new RuntimeException("Error getting classloader for metadata");
+      }
+   }
+
+   /**
+    * Add property annotations
+    * 
+    * @param classloader the classloader
+    * @param mutable the mutable
+    * @param propertyMetaData the property
+    * @param beanInfo the bean info
+    */
+   private void addPropertyAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, PropertyMetaData propertyMetaData, BeanInfo beanInfo)
+   {
+      Set<AnnotationMetaData> propertyAnnotations = propertyMetaData.getAnnotations();
+      if (propertyAnnotations == null || propertyAnnotations.size() == 0)
+         return;
+
+      Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
+      if (propertyInfos != null && propertyInfos.size() > 0)
+      {
+         for (PropertyInfo propertyInfo : propertyInfos)
+         {
+            if (propertyInfo.getName().equals(propertyMetaData.getName()))
+            {
+               MethodInfo methodInfo = propertyInfo.getGetter();
+               if (methodInfo != null)
+                  addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
+               methodInfo = propertyInfo.getSetter();
+               if (methodInfo != null)
+                  addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
+            }
+         }
+      }
+   }
+   
+   /**
+    * Add annotations for a method
+    *
+    * @param classloader the classloader
+    * @param mutable the mutable metadata
+    * @param methodInfo the method info
+    * @param annotations the annotations
+    */
+   private void addAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, MethodInfo methodInfo, Set<AnnotationMetaData> annotations)
+   {
+      TypeInfo[] typeInfos = methodInfo.getParameterTypes();
+      String[] paramTypes = new String[typeInfos.length];
+      for (int i = 0; i < typeInfos.length; ++i)
+         paramTypes[i] = typeInfos[i].getName();
+
+      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, methodInfo.getName());
+      MemoryMetaDataLoader loader = new MemoryMetaDataLoader(scope);
+      addAnnotations(classloader, loader, annotations);
+      mutable.addComponentMetaDataRetrieval(new MethodSignature(methodInfo.getName(), paramTypes), loader);
+   }
+   
+   /**
+    * Add annotations to a mutable metadata
+    *
+    * @param classloader the classloader
+    * @param mutable the mutable metadata
+    * @param annotations the annotations
+    */
+   private void addAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, Set<AnnotationMetaData> annotations)
+   {
+      if (annotations == null || annotations.size() == 0)
+         return;
+
+      for (AnnotationMetaData annotation : annotations)
+         mutable.addAnnotation(annotation.getAnnotationInstance(classloader));
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -121,7 +121,7 @@
       if (scopeKey != null)
       {
          scopeKey.freeze();
-         context.setInstallScope(scopeKey);
+         context.getScopeInfo().setInstallScope(scopeKey);
          // todo - should this be done (repare the current context scope key)
          //        or where to store this 'deployment' key?
 /*
@@ -177,7 +177,7 @@
    {
       KernelController controller = (KernelController)context.getController();
       KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
-      ScopeKey scopeKey = context.getInstallScope();
+      ScopeKey scopeKey = context.getScopeInfo().getInstallScope();
       if (scopeKey != null)
       {
          // find scoped controller

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -22,31 +22,18 @@
 package org.jboss.kernel.plugins.metadata.basic;
 
 import java.util.ArrayList;
-import java.util.Set;
 
-import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.beans.metadata.spi.AnnotationMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.kernel.plugins.config.Configurator;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ScopeInfo;
 import org.jboss.kernel.plugins.metadata.AbstractKernelMetaDataRepository;
-import org.jboss.kernel.spi.config.KernelConfigurator;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.metadata.plugins.context.AbstractMetaDataContext;
 import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
-import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
 import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository;
 import org.jboss.metadata.spi.MetaData;
 import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
 import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
-import org.jboss.metadata.spi.scope.CommonLevels;
 import org.jboss.metadata.spi.scope.Scope;
 import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.metadata.spi.signature.MethodSignature;
-import org.jboss.metadata.spi.stack.MetaDataStack;
-import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.TypeInfo;
 
 /**
  * BasicKernelMetaDataRepository.
@@ -64,10 +51,10 @@
       super(new BasicMetaDataRepository());
    }
 
-   public MetaData getMetaData(KernelControllerContext context)
+   public MetaData getMetaData(ControllerContext context)
    {
       MutableMetaDataRepository repository = getMetaDataRepository();
-      ScopeKey scope = context.getScope();
+      ScopeKey scope = context.getScopeInfo().getScope();
       MetaData metaData = repository.getMetaData(scope);
       if (metaData == null)
       {
@@ -77,74 +64,51 @@
       return metaData;
    }
 
-   public MetaDataRetrieval getMetaDataRetrieval(KernelControllerContext context)
+   public MetaDataRetrieval getMetaDataRetrieval(ControllerContext context)
    {
       MutableMetaDataRepository repository = getMetaDataRepository();
-      ScopeKey scope = context.getScope();
+      ScopeKey scope = context.getScopeInfo().getScope();
       MetaDataRetrieval metaDataRetrieval = repository.getMetaDataRetrieval(scope);
       if (metaDataRetrieval == null)
          metaDataRetrieval = initMetaDataRetrieval(context);
       return metaDataRetrieval;
    }
 
-   public void popMetaData(KernelControllerContext context)
+   public void addMetaData(ControllerContext context)
    {
-      MetaDataStack.pop();
-   }
-
-   public void addMetaData(KernelControllerContext context)
-   {
       MutableMetaDataRepository repository = getMetaDataRepository();
-      ScopeKey scope = getMutableScope(context);
-      MemoryMetaDataLoader mutable = new MemoryMetaDataLoader(scope);
-      repository.addMetaDataRetrieval(mutable);
-      addClassAnnotations(mutable, context);
-      addPropertyAnnotations(mutable, context);
+      ScopeInfo scopeInfo = context.getScopeInfo();
+      scopeInfo.addMetaData(repository, context);
    }
 
-   public void removeMetaData(KernelControllerContext context)
+   public void removeMetaData(ControllerContext context)
    {
       MutableMetaDataRepository repository = getMetaDataRepository();
-      // Remove the read only/full scope
-      ScopeKey scope = context.getScope();
-      repository.removeMetaDataRetrieval(scope);
-      // Remove the mutable scope
-      scope = getMutableScope(context);
-      repository.removeMetaDataRetrieval(scope);
+      ScopeInfo scopeInfo = context.getScopeInfo();
+      scopeInfo.removeMetaData(repository, context);
    }
 
-   public ScopeKey getFullScope(KernelControllerContext context)
+   public ScopeKey getFullScope(ControllerContext context)
    {
-      ScopeKey scope = ScopeKey.DEFAULT_SCOPE.clone();
-      scope.addScope(CommonLevels.INSTANCE, context.getName().toString());
-      BeanMetaData beanMetaData = context.getBeanMetaData();
-      if (beanMetaData != null)
-      {
-         String bean = beanMetaData.getBean();
-         if (bean != null)
-            scope.addScope(CommonLevels.CLASS, bean);
-      }
-      // todo - some other level
-      scope.addScope(CommonLevels.WORK, String.valueOf(context.hashCode()));
-      return scope;
+      return context.getScopeInfo().getScope();
    }
 
-   public ScopeKey getMutableScope(KernelControllerContext context)
+   public ScopeKey getMutableScope(ControllerContext context)
    {
-      return new ScopeKey(CommonLevels.INSTANCE, context.getName().toString());
+      return context.getScopeInfo().getMutableScope();
    }
 
    /**
     * Initialise metadata retrieval
     * 
-    * TODO lots more work
     * @param context the context
     * @return the retrieval
     */
-   protected MetaDataRetrieval initMetaDataRetrieval(KernelControllerContext context)
+   protected MetaDataRetrieval initMetaDataRetrieval(ControllerContext context)
    {
       MutableMetaDataRepository repository = getMetaDataRepository();
-      ScopeKey scopeKey = context.getScope();
+      ScopeInfo scopeInfo = context.getScopeInfo();
+      ScopeKey scopeKey = scopeInfo.getScope();
       ArrayList<MetaDataRetrieval> retrievals = new ArrayList<MetaDataRetrieval>();
       for (Scope scope : scopeKey.getScopes())
       {
@@ -152,30 +116,9 @@
          MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(thisScope);
          if (retrieval == null)
          {
-            if (scope.getScopeLevel() == CommonLevels.CLASS)
+            retrieval = scopeInfo.initMetaDataRetrieval(repository, context, scope);
+            if (retrieval == null)
             {
-               BeanMetaData metaData = context.getBeanMetaData();
-               ClassLoader cl = null;
-               try
-               {
-                  cl = Configurator.getClassLoader(metaData);
-               }
-               catch (Throwable t)
-               {
-                  throw new RuntimeException("Error getting classloader for " + context.getName(), t);
-               }
-               try
-               {
-                  Class clazz = cl.loadClass(scope.getQualifier());
-                  retrieval = new AnnotatedElementMetaDataLoader(clazz);
-               }
-               catch (ClassNotFoundException e)
-               {
-                  throw new RuntimeException("Unable to load class: " + scope.getQualifier(), e);
-               }
-            }
-            else
-            {
                retrieval = new MemoryMetaDataLoader(thisScope);
                repository.addMetaDataRetrieval(retrieval);
             }
@@ -186,129 +129,4 @@
       repository.addMetaDataRetrieval(metaDataContext);
       return metaDataContext;
    }
-   
-   /**
-    * Add class annotations
-    * 
-    * @param mutable the mutable metadata
-    * @param context the context
-    */
-   private void addClassAnnotations(MemoryMetaDataLoader mutable, KernelControllerContext context)
-   {
-      BeanMetaData beanMetaData = context.getBeanMetaData();
-      if (beanMetaData != null)
-      {
-         try
-         {
-            ClassLoader cl = Configurator.getClassLoader(beanMetaData);
-            addAnnotations(cl, mutable, beanMetaData.getAnnotations());
-         }
-         catch(Throwable t)
-         {
-            throw new RuntimeException("Error getting classloader for metadata", t);
-         }
-      }
-   }
-
-   /**
-    * Add property annotations
-    * 
-    * @param mutable the mutable
-    * @param context the kernel controller contex
-    */
-   private void addPropertyAnnotations(MemoryMetaDataLoader mutable, KernelControllerContext context)
-   {
-      BeanMetaData beanMetaData = context.getBeanMetaData();
-      if (beanMetaData == null)
-         return;
-
-      Set<PropertyMetaData> properties = beanMetaData.getProperties();
-
-      if (properties == null || properties.size() == 0)
-         return;
-
-      BeanInfo beanInfo = context.getBeanInfo();
-      if (beanInfo == null)
-         return;
-      
-      try
-      {
-         ClassLoader cl = Configurator.getClassLoader(beanMetaData);
-         for (PropertyMetaData property : properties)
-            addPropertyAnnotations(cl, mutable, property, beanInfo);
-      }
-      catch(Throwable t)
-      {
-         throw new RuntimeException("Error getting classloader for metadata");
-      }
-   }
-
-   /**
-    * Add property annotations
-    * 
-    * @param classloader the classloader
-    * @param mutable the mutable
-    * @param propertyMetaData the property
-    * @param beanInfo the bean info
-    */
-   private void addPropertyAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, PropertyMetaData propertyMetaData, BeanInfo beanInfo)
-   {
-      Set<AnnotationMetaData> propertyAnnotations = propertyMetaData.getAnnotations();
-      if (propertyAnnotations == null || propertyAnnotations.size() == 0)
-         return;
-
-      Set<PropertyInfo> propertyInfos = beanInfo.getProperties();
-      if (propertyInfos != null && propertyInfos.size() > 0)
-      {
-         for (PropertyInfo propertyInfo : propertyInfos)
-         {
-            if (propertyInfo.getName().equals(propertyMetaData.getName()))
-            {
-               MethodInfo methodInfo = propertyInfo.getGetter();
-               if (methodInfo != null)
-                  addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
-               methodInfo = propertyInfo.getSetter();
-               if (methodInfo != null)
-                  addAnnotations(classloader, mutable, methodInfo, propertyAnnotations);
-            }
-         }
-      }
-   }
-   
-   /**
-    * Add annotations for a method
-    *
-    * @param classloader the classloader
-    * @param mutable the mutable metadata
-    * @param methodInfo the method info
-    * @param annotations the annotations
-    */
-   private void addAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, MethodInfo methodInfo, Set<AnnotationMetaData> annotations)
-   {
-      TypeInfo[] typeInfos = methodInfo.getParameterTypes();
-      String[] paramTypes = new String[typeInfos.length];
-      for (int i = 0; i < typeInfos.length; ++i)
-         paramTypes[i] = typeInfos[i].getName();
-
-      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, methodInfo.getName());
-      MemoryMetaDataLoader loader = new MemoryMetaDataLoader(scope);
-      addAnnotations(classloader, loader, annotations);
-      mutable.addComponentMetaDataRetrieval(new MethodSignature(methodInfo.getName(), paramTypes), loader);
-   }
-   
-   /**
-    * Add annotations to a mutable metadata
-    *
-    * @param classloader the classloader
-    * @param mutable the mutable metadata
-    * @param annotations the annotations
-    */
-   private void addAnnotations(ClassLoader classloader, MemoryMetaDataLoader mutable, Set<AnnotationMetaData> annotations)
-   {
-      if (annotations == null || annotations.size() == 0)
-         return;
-
-      for (AnnotationMetaData annotation : annotations)
-         mutable.addAnnotation(annotation.getAnnotationInstance(classloader));
-   }
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/AbstractKernelRegistryEntry.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/AbstractKernelRegistryEntry.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/AbstractKernelRegistryEntry.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -23,10 +23,12 @@
 
 import java.util.Set;
 
+import org.jboss.dependency.plugins.AbstractScopeInfo;
 import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerMode;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ScopeInfo;
 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
@@ -101,6 +103,15 @@
       return null;
    }
 
+   public ScopeInfo getScopeInfo()
+   {
+      String className = null;
+      Object target = getTarget();
+      if (target != null)
+         className = target.getClass().getName();
+      return new AbstractScopeInfo(getName(), className);
+   }
+   
    public Throwable getError()
    {
       throw new NotImplementedException("getError");

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -27,7 +27,6 @@
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
 import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.scope.ScopeKey;
 
 /**
  * Information about dependencies and state.
@@ -71,39 +70,4 @@
     * @param target the target
     */
    void setTarget(Object target);
-
-   /**
-    * Get the metadata
-    * 
-    * @return the metadata
-    */
-   MetaData getMetaData();
-
-   /**
-    * Get the scope
-    * 
-    * @return the scope
-    */
-   ScopeKey getScope();
-
-   /**
-    * Set the scope
-    * 
-    * @param key the scope key
-    */
-   void setScope(ScopeKey key);
-
-   /**
-    * Get the install scope
-    *
-    * @return the scope
-    */
-   ScopeKey getInstallScope();
-
-   /**
-    * Set the install scope
-    *
-    * @param key the scope key
-    */
-   void setInstallScope(ScopeKey key);
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/helpers/UnmodifiableKernelControllerContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/helpers/UnmodifiableKernelControllerContext.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/helpers/UnmodifiableKernelControllerContext.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -21,15 +21,13 @@
 */
 package org.jboss.kernel.spi.dependency.helpers;
 
-import org.jboss.dependency.spi.helpers.UnmodifiableControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.Kernel;
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.info.spi.helpers.UnmodifiableBeanInfo;
 import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.helpers.UnmodifiableControllerContext;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.helpers.UnmodifiableMetaData;
-import org.jboss.metadata.spi.scope.ScopeKey;
 
 /**
  * Unmodifiable instance.
@@ -69,34 +67,6 @@
       throw new UnsupportedOperationException("Cannot execute set on unmodifiable wrapper.");
    }
 
-   public MetaData getMetaData()
-   {
-      MetaData metaData = delegate.getMetaData();
-      return metaData != null ? new UnmodifiableMetaData(metaData) : null;
-   }
-
-   public ScopeKey getScope()
-   {
-      ScopeKey key = delegate.getScope();
-      return key != null ? key.clone() :null;
-   }
-
-   public void setScope(ScopeKey key)
-   {
-      throw new UnsupportedOperationException("Cannot execute set on unmodifiable wrapper.");
-   }
-
-   public ScopeKey getInstallScope()
-   {
-      ScopeKey key = delegate.getInstallScope();
-      return key != null ? key.clone() : null;
-   }
-
-   public void setInstallScope(ScopeKey key)
-   {
-      throw new UnsupportedOperationException("Cannot execute set on unmodifiable wrapper.");
-   }
-
    public void setName(Object name)
    {
       throw new UnsupportedOperationException("Cannot execute set on unmodifiable wrapper.");

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/metadata/KernelMetaDataRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/metadata/KernelMetaDataRepository.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/metadata/KernelMetaDataRepository.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -21,8 +21,8 @@
 */
 package org.jboss.kernel.spi.metadata;
 
+import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.kernel.spi.KernelObject;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.metadata.spi.MetaData;
 import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
 import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
@@ -49,7 +49,7 @@
     * @param context the context
     * @return the metadata
     */
-   MetaData getMetaData(KernelControllerContext context);
+   MetaData getMetaData(ControllerContext context);
 
    /**
     * Get the MetaData retrieval
@@ -57,21 +57,21 @@
     * @param context the context
     * @return the metadata retrieval
     */
-   MetaDataRetrieval getMetaDataRetrieval(KernelControllerContext context);
+   MetaDataRetrieval getMetaDataRetrieval(ControllerContext context);
    
    /**
     * Add metadata to the bean.
     * 
     * @param context the context
     */
-   void addMetaData(KernelControllerContext context);
+   void addMetaData(ControllerContext context);
 
    /**
     * Remove any previously added metadata
     * 
     * @param context the context
     */
-   void removeMetaData(KernelControllerContext context);
+   void removeMetaData(ControllerContext context);
 
    /**
     * Get the default scope for a context
@@ -79,7 +79,7 @@
     * @param context the context
     * @return the default scope
     */
-   ScopeKey getFullScope(KernelControllerContext context);
+   ScopeKey getFullScope(ControllerContext context);
    
    /**
     * Get the mutable scope for a context
@@ -87,5 +87,5 @@
     * @param context the context
     * @return the default scope
     */
-   ScopeKey getMutableScope(KernelControllerContext context);
+   ScopeKey getMutableScope(ControllerContext context);
 }

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/FromContextUnsupportedTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/FromContextUnsupportedTestCase.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/FromContextUnsupportedTestCase.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -98,7 +98,7 @@
       assertNotNull(key);
       assertInstanceOf(key, ScopeKey.class);
       KernelControllerContext context = getControllerContext("scopekey");
-      assertNotSame(key, context.getScope());
+      assertEquals(key, context.getScopeInfo().getScope());
 
       NameAwareBean dynamic = (NameAwareBean)getBean("dynamic");
       assertNotNull(dynamic);

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/metadata/test/AbstractMetaDataTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/metadata/test/AbstractMetaDataTest.java	2007-08-29 14:14:34 UTC (rev 64948)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/metadata/test/AbstractMetaDataTest.java	2007-08-29 14:29:21 UTC (rev 64949)
@@ -68,7 +68,7 @@
    {
       KernelControllerContext context = getControllerContext(name);
       MetaDataRepository repository = getMetaDataRepository().getMetaDataRepository();
-      ScopeKey result = context.getScope();
+      ScopeKey result = context.getScopeInfo().getScope();
       assertNotNull(repository.getMetaDataRetrieval(result));
       assertNotNull(repository.getMetaDataRetrieval(new ScopeKey(CommonLevels.INSTANCE, name)));
       return result;




More information about the jboss-cvs-commits mailing list