[jboss-cvs] JBossAS SVN: r75307 - trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 2 12:30:57 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-07-02 12:30:57 -0400 (Wed, 02 Jul 2008)
New Revision: 75307

Added:
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPClassLoaderDeployer.java
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AliasesImpl.java
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScope.java
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeFactory.java
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeImpl.java
Removed:
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPUnregisterAMClassLoaderDeployer.java
Modified:
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AbstractAopMetaDataDeployer.java
   trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AopMetaDataDeployerOutput.java
Log:
[JBAOP-468] Get the scooped tests working with the new bean metadata deployers

Copied: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPClassLoaderDeployer.java (from rev 75250, trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPUnregisterAMClassLoaderDeployer.java)
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPClassLoaderDeployer.java	                        (rev 0)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPClassLoaderDeployer.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -0,0 +1,93 @@
+/*
+* 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.asintegration.jboss5.temp;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
+import org.jboss.aop.domain.DomainInitializer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AOPClassLoaderDeployer extends AbstractVFSRealDeployer
+{
+   AspectManager aspectManager;
+   
+   public AOPClassLoaderDeployer()
+   {
+      setStage(DeploymentStages.CLASSLOADER);
+      //This needs to come after the classloader deployer
+      setRelativeOrder(10);
+   }
+
+   public AspectManager getAspectManager()
+   {
+      return aspectManager;
+   }
+
+   public void setAspectManager(AspectManager aspectManager)
+   {
+      this.aspectManager = aspectManager;
+   }
+
+   @Override
+   public void deploy(VFSDeploymentUnit unit) throws DeploymentException
+   {
+      //Scoped AOP deployments are only available when deployed as part of a scoped sar, ear etc.
+      //It can contain an aop.xml file, or it can be part of a .aop file
+      //Linking a standalone -aop.xml file onto a scoped deployment is not possible at the moment
+      AOPClassLoaderScopingPolicy policy = AspectManager.getClassLoaderScopingPolicy();
+
+      AspectManager manager = aspectManager;
+      if (policy != null)
+      {
+         if (policy instanceof DomainInitializer == false)
+         {
+            throw new RuntimeException(policy + " must implement DomainInitializer");
+         }
+         DomainInitializer initializer = (DomainInitializer)policy;
+         Domain domain  = initializer.initializeDomain(unit);
+         if (domain != null)
+         {
+            manager = domain;
+         }
+      }
+      
+      unit.getTransientManagedObjects().addAttachment(AspectManager.class, manager);
+   }
+
+   @Override
+   public void undeploy(VFSDeploymentUnit unit)
+   {
+      if (unit.getTopLevel() == unit)
+      {
+         aspectManager.unregisterClassLoader(unit.getClassLoader());
+      }
+   }
+}

Deleted: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPUnregisterAMClassLoaderDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPUnregisterAMClassLoaderDeployer.java	2008-07-02 15:14:58 UTC (rev 75306)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AOPUnregisterAMClassLoaderDeployer.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -1,69 +0,0 @@
-/*
-* 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.asintegration.jboss5.temp;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class AOPUnregisterAMClassLoaderDeployer extends AbstractVFSRealDeployer
-{
-   AspectManager aspectManager;
-   
-   public AOPUnregisterAMClassLoaderDeployer()
-   {
-      setStage(DeploymentStages.CLASSLOADER);
-      //This needs to come after the classloader deployer
-      setRelativeOrder(10);
-   }
-
-   public AspectManager getAspectManager()
-   {
-      return aspectManager;
-   }
-
-   public void setAspectManager(AspectManager aspectManager)
-   {
-      this.aspectManager = aspectManager;
-   }
-
-   @Override
-   public void deploy(VFSDeploymentUnit unit) throws DeploymentException
-   {
-   }
-
-   @Override
-   public void undeploy(VFSDeploymentUnit unit)
-   {
-      if (unit.getTopLevel() == unit)
-      {
-         aspectManager.unregisterClassLoader(unit.getClassLoader());
-      }
-   }
-}

Modified: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AbstractAopMetaDataDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AbstractAopMetaDataDeployer.java	2008-07-02 15:14:58 UTC (rev 75306)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AbstractAopMetaDataDeployer.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -26,9 +26,6 @@
 import java.util.List;
 
 import org.jboss.aop.AspectManager;
-import org.jboss.aop.Domain;
-import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.domain.DomainInitializer;
 import org.jboss.aop.microcontainer.beans.metadata.AspectManagerAwareBeanMetaDataFactory;
 import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
 import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
@@ -37,6 +34,8 @@
 import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
 import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.dependency.Module;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -109,11 +108,12 @@
       
       if (extractAopBeanMetaDataFactories(unit, deployment, output))
       {
-         AspectManager correctManager = getCorrectManager(unit, output);
+         AspectManager correctManager = unit.getAttachment(AspectManager.class);
          if (correctManager != aspectManager)
          {
-            registerScopedManagerBean(unit, correctManager, output);
-            massageScopedDeployment(unit, deployment, output);
+            int sequence = getSequence();
+            String scopedManagerName = registerScopedManagerBean(sequence, unit, correctManager, output);
+            massageScopedDeployment(sequence, unit, deployment, output, scopedManagerName);
          }
       }
       
@@ -144,7 +144,7 @@
    {
       log.debug("Undeploying " + unit + " " + deployment);
       
-      AopMetaDataDeployerOutput output = unit.getTransientManagedObjects().getAttachment(AopMetaDataDeployerOutput.class);
+      AopMetaDataDeployerOutput output = unit.getAttachment(AopMetaDataDeployerOutput.class);
       
       undeployBeans(unit, output);
       
@@ -180,42 +180,15 @@
       return false;
    }
    
-   private AspectManager getCorrectManager(VFSDeploymentUnit unit, AopMetaDataDeployerOutput output) throws DeploymentException
+   private String registerScopedManagerBean(int sequence, VFSDeploymentUnit unit, AspectManager scopedManager, AopMetaDataDeployerOutput output) throws DeploymentException
    {
-      //Scoped AOP deployments are only available when deployed as part of a scoped sar, ear etc.
-      //It can contain an aop.xml file, or it can be part of a .aop file
-      //Linking a standalone -aop.xml file onto a scoped deployment is not possible at the moment
-      AOPClassLoaderScopingPolicy policy = AspectManager.getClassLoaderScopingPolicy();
-
-      Domain domain = null;
-      if (policy != null)
-      {
-         if (policy instanceof DomainInitializer == false)
-         {
-            throw new RuntimeException(policy + " must implement DomainInitializer");
-         }
-         DomainInitializer initializer = (DomainInitializer)policy;
-         domain = initializer.initializeDomain(unit); 
-      }
-      
-      if (domain != null)
-      {
-         log.debug("Deployment is scoped to " + domain);
-         return domain;
-      }
-      
-      return aspectManager;
-   }
-   
-   private void registerScopedManagerBean(VFSDeploymentUnit unit, AspectManager scopedManager, AopMetaDataDeployerOutput output) throws DeploymentException
-   {
       String name = "ScopedManager_" + getSequence() + "_" + unit.getName();
       BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, scopedManager.getClass().getName());
       
       try
       {
          controller.install(builder.getBeanMetaData(), scopedManager);
-         output.setScopedAspectManagerBeanName(name);
+         return name;
       }
       catch (Throwable e)
       {
@@ -249,45 +222,37 @@
       }
    }
    
-   private void massageScopedDeployment(VFSDeploymentUnit unit, T deployment, AopMetaDataDeployerOutput output) throws DeploymentException
+   private void massageScopedDeployment(int sequence, VFSDeploymentUnit unit, T deployment, AopMetaDataDeployerOutput output, String scopedManagerName) throws DeploymentException
    {
-      if (output.getScopedAspectManagerBeanName() == null)
+      log.debug("Massaging scoped deployment " + unit + " setting manager to " + scopedManagerName);
+      String domainName = getDomainName(unit);
+      output.setScopedInformation(scopedManagerName, domainName, sequence);
+   }
+   
+   private String getDomainName(VFSDeploymentUnit unit)
+   {
+      Module module = unit.getTopLevel().getAttachment(Module.class);
+      if (module != null && !module.getDeterminedDomainName().equals(ClassLoaderSystem.DEFAULT_DOMAIN_NAME))
       {
-         return;
+         return module.getDeterminedDomainName();
       }
       
-      log.debug("Massaging scoped deployment " + unit);
-      List<AspectManagerAwareBeanMetaDataFactory> aopFactories = output.getFactories();
-
-      if (aopFactories != null && aopFactories.size() > 0)
-      {
-         for (AspectManagerAwareBeanMetaDataFactory factory : aopFactories)
-         {
-            factory.setManagerBean(output.getScopedAspectManagerBeanName());
-            factory.setManagerProperty(null);
-         }
-      }
+      return null;
    }
    
    private void deployBeans(VFSDeploymentUnit unit, AopMetaDataDeployerOutput output) throws DeploymentException
    {
-      List<AspectManagerAwareBeanMetaDataFactory> aopFactories = output.getFactories();
+      List<BeanMetaData> aopBeans = output.getBeans();
       List<BeanMetaData> done = new ArrayList<BeanMetaData>();
       try
       {
-         if (aopFactories != null && aopFactories.size() > 0)
+         if (aopBeans != null && aopBeans.size() > 0)
          {
-            for (AspectManagerAwareBeanMetaDataFactory factory : aopFactories)
+            System.out.println("====> Install size " + aopBeans.size());
+            for (BeanMetaData bean : aopBeans)
             {
-               List<BeanMetaData> beans = factory.getBeans();
-               if (beans != null && beans.size() > 0)
-               {
-                  for (BeanMetaData bean : beans)
-                  {
-                     beanMetaDataDeployer.deploy(unit, bean);
-                     done.add(bean);
-                  }
-               }
+               beanMetaDataDeployer.deploy(unit, bean);
+               done.add(bean);
             }
          }
       }
@@ -311,21 +276,13 @@
    
    private void undeployBeans(VFSDeploymentUnit unit, AopMetaDataDeployerOutput output)
    {
-      List<AspectManagerAwareBeanMetaDataFactory> aopFactories = output.getFactories();
-      if (aopFactories != null && aopFactories.size() > 0)
+      List<BeanMetaData> aopBeans = output.getBeans();
+      if (aopBeans != null && aopBeans.size() > 0)
       {
-         for (int i = aopFactories.size() - 1 ; i >= 0 ; i--)
+         for (int i = aopBeans.size() - 1 ; i >= 0 ; i--)
          {
-            AspectManagerAwareBeanMetaDataFactory factory = aopFactories.get(i);
-            List<BeanMetaData> beans = factory.getBeans();
-            if (beans != null && beans.size() > 0)
-            {
-               for (int j = beans.size() - 1 ; j >= 0 ; j--)
-               {
-                  BeanMetaData bean = beans.get(j);
-                  beanMetaDataDeployer.undeploy(unit, bean);
-               }
-            }
+            BeanMetaData bean = aopBeans.get(i);
+            beanMetaDataDeployer.undeploy(unit, bean);
          }
       }      
    }

Added: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AliasesImpl.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AliasesImpl.java	                        (rev 0)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AliasesImpl.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -0,0 +1,57 @@
+/*
+* 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.asintegration.jboss5.temp;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.beans.metadata.api.annotations.Aliases;
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AliasesImpl implements Aliases
+{
+   String[] names;
+   
+   public AliasesImpl(String name)
+   {
+      super();
+      this.names = new String[] {name};
+   }
+
+   public boolean replace()
+   {
+      return false;
+   }
+
+   public String[] value()
+   {
+      return names;
+   }
+
+   public Class<? extends Annotation> annotationType()
+   {
+      return Aliases.class;
+   }
+
+}

Modified: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AopMetaDataDeployerOutput.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AopMetaDataDeployerOutput.java	2008-07-02 15:14:58 UTC (rev 75306)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/AopMetaDataDeployerOutput.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -21,42 +21,99 @@
 */ 
 package org.jboss.aop.asintegration.jboss5.temp;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.jboss.aop.microcontainer.beans.metadata.AspectManagerAwareBeanMetaDataFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
 
 /**
  * 
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision: 1.1 $
  */
-public class AopMetaDataDeployerOutput
+class AopMetaDataDeployerOutput
 {
+   List<AspectManagerAwareBeanMetaDataFactory> factories;
+   List<BeanMetaData> beans;
+   boolean scoped;
    String scopedAspectManagerBeanName;
-   List<AspectManagerAwareBeanMetaDataFactory> factories;
+   String domainName;
+   int sequence;
    
-   public AopMetaDataDeployerOutput()
+   AopMetaDataDeployerOutput()
    {
       
    }
 
-   public String getScopedAspectManagerBeanName()
+   String getScopedAspectManagerBeanName()
    {
       return scopedAspectManagerBeanName;
    }
 
-   public void setScopedAspectManagerBeanName(String scopedAspectManagerBeanName)
+   void setFactories(List<AspectManagerAwareBeanMetaDataFactory> factories)
    {
+      this.factories = factories;
+   }
+   
+   void setScopedInformation(String scopedAspectManagerBeanName, String domainName, int sequence)
+   {
+      scoped = true;
       this.scopedAspectManagerBeanName = scopedAspectManagerBeanName;
+      this.domainName = domainName;
+      this.sequence = sequence;
    }
+   
+   List<BeanMetaData> getBeans()
+   {
+      if (beans == null && factories != null && factories.size() > 0)
+      {
+         beans = new ArrayList<BeanMetaData>();
+         
+         for (AspectManagerAwareBeanMetaDataFactory factory : factories)
+         {
+            if (scopedAspectManagerBeanName != null)
+            {
+               factory.setManagerBean(scopedAspectManagerBeanName);
+               factory.setManagerProperty(null);
+            }
 
-   public List<AspectManagerAwareBeanMetaDataFactory> getFactories()
-   {
-      return factories;
+            List<BeanMetaData> mybeans = factory.getBeans();
+            if (mybeans != null && mybeans.size() > 0)
+            {
+               for (BeanMetaData bean : mybeans)
+               {
+                  massageScopedBean(bean);
+               }
+               beans.addAll(mybeans);
+            }
+         }
+      }
+      return beans;
    }
 
-   public void setFactories(List<AspectManagerAwareBeanMetaDataFactory> factories)
+   private void massageScopedBean(BeanMetaData bean)
    {
-      this.factories = factories;
+      if (scoped)
+      {         
+         String name = bean.getName();
+         String newName = "ScopedAlias_" + sequence + "_" + name;
+      
+         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(bean);
+         
+         //Set the alias to the original name
+         builder.addAnnotation(new AliasesImpl(name));
+         
+         //Set the domain name
+         if (domainName == null)
+         {
+            throw new IllegalStateException("Should not have null domainName for scoped bean");
+         }
+         builder.addAnnotation(new ClassLoaderDomainScopeImpl(domainName));
+      
+         //set the new name used by the controller for managing beans
+         builder.setName(newName);
+      }
    }
 }

Added: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScope.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScope.java	                        (rev 0)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScope.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -0,0 +1,42 @@
+/*
+* 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.asintegration.jboss5.temp;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.metadata.spi.scope.ScopeFactoryLookup;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at ScopeFactoryLookup(ClassLoaderDomainScopeFactory.class)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE})
+public @interface ClassLoaderDomainScope
+{
+   String value();
+}

Added: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeFactory.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeFactory.java	                        (rev 0)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeFactory.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -0,0 +1,41 @@
+/*
+* 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.asintegration.jboss5.temp;
+
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeFactory;
+import org.jboss.metadata.spi.scope.ScopeLevel;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassLoaderDomainScopeFactory implements ScopeFactory<ClassLoaderDomainScope>
+{
+   public Scope create(ClassLoaderDomainScope annotation)
+   {
+      return new Scope(new ScopeLevel(CommonLevels.APPLICATION.getLevel() + 10, "ClassLoaderDomainScope"), annotation.value());
+   }
+
+}

Added: trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeImpl.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeImpl.java	                        (rev 0)
+++ trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/temp/ClassLoaderDomainScopeImpl.java	2008-07-02 16:30:57 UTC (rev 75307)
@@ -0,0 +1,50 @@
+/*
+* 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.asintegration.jboss5.temp;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassLoaderDomainScopeImpl implements ClassLoaderDomainScope
+{
+   String name;
+   
+   public ClassLoaderDomainScopeImpl(String name)
+   {
+      this.name = name;
+   }
+   
+   public String value()
+   {
+      return name;
+   }
+
+   public Class<? extends Annotation> annotationType()
+   {
+      return ClassLoaderDomainScope.class;
+   }
+
+}




More information about the jboss-cvs-commits mailing list