[jboss-cvs] JBossAS SVN: r78868 - in projects/aop/trunk: asintegration-mc and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 25 13:10:56 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-09-25 13:10:56 -0400 (Thu, 25 Sep 2008)
New Revision: 78868

Added:
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/
Removed:
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPClassLoaderDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPDeploymentAopMetaDataDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AliasesImpl.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectAppParsingDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/BeansDeploymentAopMetaDataDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScope.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeFactory.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeImpl.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/IntegrationStrategy.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/MetaDataClassLoaderScopingPolicy.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/RepositoryIntegrationStrategy.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSIntegrationStrategy.java
Modified:
   projects/aop/trunk/asintegration-jmx/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java
   projects/aop/trunk/asintegration-mc/.classpath
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectDeployer.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/DefaultTranslator.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java
   projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java
Log:
[JBAOP-652] Add the files to do integration with VFSClassLoaderScopingPolicy

Modified: projects/aop/trunk/asintegration-jmx/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-jmx/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -31,6 +31,7 @@
 import org.jboss.logging.Logger;
 
 /**
+ * MC Bean to register and unregister the AspectManagerService MBean in JMX
  * 
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision: 1.1 $

Modified: projects/aop/trunk/asintegration-mc/.classpath
===================================================================
--- projects/aop/trunk/asintegration-mc/.classpath	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/.classpath	2008-09-25 17:10:56 UTC (rev 78868)
@@ -9,10 +9,19 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar" sourcepath="/thirdparty/jboss/common-core/lib/jboss-common-core-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/integration/lib/jboss-classloading-spi.jar" sourcepath="/thirdparty/jboss/integration/lib/jboss-classloading-spi-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs.jar" sourcepath="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-vfs-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-core-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-structure-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-deployers/lib/jboss-deployers-client-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-managed/lib/jboss-managed.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-mdr/lib/jboss-mdr.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-cl/lib/jboss-classloader.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/pluggable-instrumentor"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/asintegration-core"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-cl/lib/jboss-classloading.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Copied: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5 (from rev 78867, trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5)

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,188 +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;
-
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javassist.bytecode.ClassFile;
-
-import org.jboss.aop.AspectAnnotationLoader;
-import org.jboss.aop.microcontainer.beans.metadata.AOPDeployment;
-import org.jboss.aop.microcontainer.beans.metadata.AspectManagerAwareBeanMetaDataFactory;
-import org.jboss.aop.microcontainer.beans.metadata.MicrocontainerAnnotationLoaderStrategy;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
-
-/**
- * Reads the annotations and converts them into AOP metadata to be deployed properly 
- * by the AOPDeploymentAopMetaDataDeployer
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class AOPAnnotationMetaDataParserDeployer extends AbstractDeployer
-{
-   public AOPAnnotationMetaDataParserDeployer(int xmlParserOrder)
-   {
-      super.setOutput(AOPDeployment.class);
-      super.setStage(DeploymentStages.PARSE);
-      //Make this come after the AOPXMLMetaDataParserDeployer
-      super.setRelativeOrder(xmlParserOrder + 1);
-   }
-
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      // Ignore non-vfs deployments
-      if (unit instanceof VFSDeploymentUnit == false)
-      {
-         log.trace("Not a vfs deployment: " + unit.getName());
-         return;
-      }
-      // See if the suffix matches the .aop requirement
-      if (unit.getSimpleName().endsWith(".aop") == false)
-      {
-         log.trace("Unit name does not end in .aop: " + unit.getSimpleName());
-         return;
-      }
-      internalDeploy((VFSDeploymentUnit)unit);
-   }
-   
-   private void internalDeploy(VFSDeploymentUnit unit) throws DeploymentException
-   {
-      MicrocontainerAnnotationLoaderStrategy strategy = new MicrocontainerAnnotationLoaderStrategy(); 
-      AspectAnnotationLoader loader = new AspectAnnotationLoader(null, strategy);
-      
-      List<VirtualFile> files = getClasses(unit);
-      for(VirtualFile file : files)
-      {
-         try
-         {
-            ClassFile cf = loadClassFile(file);
-            log.debug("Deploying possibly annotated class " + cf.getName());
-            loader.deployClassFile(cf);
-         }
-         catch (Exception e)
-         {
-            throw new DeploymentException("Error reading annotations for " + file, e);
-         }
-      }
-      
-      List<AspectManagerAwareBeanMetaDataFactory> factories = strategy.getFactories();
-      
-      AOPDeployment deployment = unit.getAttachment(AOPDeployment.class);
-      if (factories != null && factories.size() > 0)
-      {
-         if (deployment == null)
-         {
-            deployment = new AOPDeployment();
-            unit.getTransientManagedObjects().addAttachment(AOPDeployment.class.getName(), deployment, AOPDeployment.class);
-         }
-         if (deployment.getBeanFactories() == null)
-         {
-            deployment.setBeanFactories(new ArrayList<BeanMetaDataFactory>());
-         }
-         deployment.getBeanFactories().addAll(factories);
-      }  
-   }
-
-   private ClassFile loadClassFile(VirtualFile file)
-   {
-      DataInputStream din = null;
-      ClassFile cf = null;
-      try
-      {
-         InputStream in = file.openStream();
-         din = new DataInputStream(new BufferedInputStream(in));
-         cf = new ClassFile(din);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException("Error reading " + file, e);
-      }
-      finally
-      {
-         try
-         {
-            din.close();
-         }
-         catch (IOException ignored)
-         {
-         }
-      }
-      
-      return cf;
-   }
-
-   private List<VirtualFile> getClasses(VFSDeploymentUnit unit)
-   {
-      VisitorAttributes va = new VisitorAttributes();
-      va.setLeavesOnly(true);
-      ClassFileFilter filter = new ClassFileFilter();
-      SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
-      va.setRecurseFilter(noJars);
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
-
-      for (VirtualFile vf : unit.getClassPath())
-      {
-         try
-         {
-            vf.visit(visitor);
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-      return visitor.getMatched();
-
-   }
-   
-   private static class ClassFileFilter implements VirtualFileFilter
-   {
-      public boolean accepts(VirtualFile file)
-      {
-         try
-         {
-            return file.isLeaf() && file.getName().endsWith(".class");
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException("Error visiting file: " + file.getName(), e);
-         }
-      }
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPClassLoaderDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AOPClassLoaderDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPClassLoaderDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,137 +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;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Domain;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-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.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(int xmlRelativeOrder)
-   {
-      setStage(DeploymentStages.CLASSLOADER);
-      //This needs to come after the classloader deployer
-      setRelativeOrder(xmlRelativeOrder + 1);
-   }
-
-   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
-      VFSClassLoaderScopingPolicy policy = (VFSClassLoaderScopingPolicy)AspectManager.getClassLoaderScopingPolicy();
-
-      AspectManager manager = aspectManager;
-      Domain domain = initializeDomain(policy, 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());
-      }
-   }
-
-   private Domain initializeDomain(VFSClassLoaderScopingPolicy policy, VFSDeploymentUnit unit)
-   {
-      Module module = unit.getTopLevel().getAttachment(Module.class);
-      ClassLoader loader = unit.getClassLoader();
-      ClassLoader topLoader = unit.getTopLevel().getClassLoader();
-      
-      VFSClassLoaderDomainRegistry registry = policy.getRegistry();
-      
-      boolean isWar = unit.isAttachmentPresent("org.jboss.metadata.web.jboss.JBossWebMetaData");
-
-      if (isWar && loader != topLoader)
-      {
-         ScopedVFSClassLoaderDomain scopedDomain = (ScopedVFSClassLoaderDomain)registry.getRegisteredDomain(loader);
-         if (scopedDomain == null) 
-         {
-            scopedDomain = (ScopedVFSClassLoaderDomain)registry.getRegisteredDomain(topLoader);
-         }
-         
-         if (scopedDomain != null)
-         {
-            registry.initMapsForLoader(loader, module, scopedDomain);
-         }
-
-         policy.registerClassLoader(module, isWar, loader);
-         
-         return scopedDomain;
-      }
-      else
-      {
-         ScopedVFSClassLoaderDomain scopedDomain = (ScopedVFSClassLoaderDomain)registry.getRegisteredDomain(loader);
-         if (scopedDomain == null)
-         {
-            if (!module.getDeterminedDomainName().equals(ClassLoaderSystem.DEFAULT_DOMAIN_NAME))
-            {
-               ClassLoaderSystem system = ClassLoaderSystem.getInstance();
-               String domainName = module.getDeterminedDomainName();
-               ClassLoaderDomain domain = system.getDomain(domainName);
-      
-               boolean parentDelegation = module.isJ2seClassLoadingCompliance();
-               String name = String.valueOf(System.identityHashCode(loader));
-               
-               scopedDomain = new ScopedVFSClassLoaderDomain(loader, name, parentDelegation, AspectManager.getTopLevelAspectManager(), false, domain, registry);
-            }
-      
-            registry.initMapsForLoader(loader, module, scopedDomain);
-            
-            policy.registerClassLoader(module, isWar, loader);
-         }
-         return scopedDomain;
-      }      
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPDeploymentAopMetaDataDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AOPDeploymentAopMetaDataDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AOPDeploymentAopMetaDataDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,61 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., 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.aop.asintegration.jboss5;
-
-import java.util.List;
-
-import org.jboss.aop.microcontainer.beans.metadata.AOPDeployment;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-
-/**
- * Deployer for Aspects in a -aop.xml or .aop
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- */
-public class AOPDeploymentAopMetaDataDeployer extends AbstractAopMetaDataDeployer<AOPDeployment>
-{
-   public AOPDeploymentAopMetaDataDeployer()
-   {
-      super(AOPDeployment.class);
-   }
-
-   @Override
-   public void deploy(VFSDeploymentUnit unit, AOPDeployment aopDeployment) throws DeploymentException
-   {
-      super.deploy(unit, aopDeployment);
-   }
-   
-   @Override
-   public void undeploy(VFSDeploymentUnit unit, AOPDeployment aopDeployment)
-   {
-      super.undeploy(unit, aopDeployment);
-   }
-
-
-   @Override
-   protected List<BeanMetaDataFactory> getFactories(AOPDeployment deployment)
-   {
-      return deployment.getBeanFactories();
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,444 +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;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.microcontainer.beans.metadata.AspectManagerAwareBeanMetaDataFactory;
-import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
-import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-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.dependency.spi.ScopeInfo;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.metadata.spi.scope.Scope;
-import org.jboss.metadata.spi.scope.ScopeKey;
-
-/**
- * Deployer for deployments containing AOP metadata. It makes sure that the metadata is deployed to the 
- * right aop domain in the case of scoped classloaders. The AOP metadata is stripped out of the deployment
- * to avoid deploying it twice.
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractAopMetaDataDeployer<T> extends AbstractSimpleVFSRealDeployer<T>
-{
-   private AspectManager aspectManager;
-   private KernelController controller;
-   private MyBeanMetaDataDeployer beanMetaDataDeployer = new MyBeanMetaDataDeployer();
-   private static int sequence;
-   
-   
-   public AbstractAopMetaDataDeployer(Class<T> input)
-   {
-      super(input);
-      super.setStage(DeploymentStages.POST_CLASSLOADER);
-      super.setOutput(AopMetaDataDeployerOutput.class);
-   }
-
-   /**
-    * Get the aspectManager.
-    * 
-    * @return the aspectManager.
-    */
-   public AspectManager getAspectManager()
-   {
-      return aspectManager;
-   }
-
-   /**
-    * Set the aspectManager.
-    * 
-    * @param aspectManager the aspectManager.
-    */
-   public void setAspectManager(AspectManager aspectManager)
-   {
-      this.aspectManager = aspectManager;
-   }
-   
-   /**
-    * Set the kernel.
-    * 
-    * @param kernel the kernel
-    */
-   public void setKernel(Kernel kernel)
-   {
-      this.controller = kernel.getController();
-   }
-   
-   /**
-    * Method for subclasses to call upon deployment 
-    */
-   @Override
-   public void deploy(VFSDeploymentUnit unit, T deployment) throws DeploymentException
-   {
-      log.debug("Deploying " + unit + " " + deployment);
-      
-      AopMetaDataDeployerOutput output = new AopMetaDataDeployerOutput();
-      unit.getTransientManagedObjects().addAttachment(AopMetaDataDeployerOutput.class, output);
-      
-      if (extractAopBeanMetaDataFactories(unit, deployment, output))
-      {
-         AspectManager correctManager = unit.getAttachment(AspectManager.class);
-         if (correctManager != aspectManager)
-         {
-            int sequence = getSequence();
-            String scopedManagerName = registerScopedManagerBean(sequence, unit, correctManager, output);
-            massageScopedDeployment(sequence, unit, deployment, output, scopedManagerName);
-         }
-      }
-      
-      try
-      {
-         deployBeans(unit, output);
-      }
-      catch (Throwable t)
-      {
-         unregisterScopedManagerBean(output.getScopedAspectManagerBeanName(), false);
-         if (t instanceof DeploymentException)
-         {
-            throw (DeploymentException)t;
-         }
-         else
-         {
-            throw new DeploymentException(t);
-         }
-      }
-   }
-
-   
-   /**
-    * Method for subclasses to call upon undeployment 
-    */
-   @Override
-   public void undeploy(VFSDeploymentUnit unit, T deployment)
-   {
-      log.debug("Undeploying " + unit + " " + deployment);
-      
-      AopMetaDataDeployerOutput output = unit.getAttachment(AopMetaDataDeployerOutput.class);
-      
-      undeployBeans(unit, output);
-   }
-
-   protected abstract List<BeanMetaDataFactory> getFactories(T deployment);
-   
-   private boolean extractAopBeanMetaDataFactories(VFSDeploymentUnit unit, T deployment, AopMetaDataDeployerOutput output)
-   {
-      log.debug("Extracting aop bean metadata factories for  " + unit);
-      List<AspectManagerAwareBeanMetaDataFactory> aopFactories = new ArrayList<AspectManagerAwareBeanMetaDataFactory>();
-      
-      List<BeanMetaDataFactory> factories = getFactories(deployment);
-      if (factories != null && factories.size() > 0)
-      {
-         for (Iterator<BeanMetaDataFactory> it = factories.iterator() ; it.hasNext() ; )
-         {
-            BeanMetaDataFactory factory = it.next();
-            if (factory instanceof AspectManagerAwareBeanMetaDataFactory)
-            {
-               it.remove();
-               aopFactories.add((AspectManagerAwareBeanMetaDataFactory)factory);
-            }
-         }     
-      }
-      
-      if (aopFactories.size() > 0)
-      {
-         output.setFactories(aopFactories);
-         return true;
-      }
-      return false;
-   }
-   
-   private String registerScopedManagerBean(int sequence, VFSDeploymentUnit unit, AspectManager scopedManager, AopMetaDataDeployerOutput output) throws DeploymentException
-   {
-      String name = "ScopedManager_" + getSequence() + "_" + unit.getName();
-      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, scopedManager.getClass().getName());
-      unit.getMutableMetaData().addMetaData(scopedManager, AspectManager.class);
-      
-      try
-      {
-         controller.install(builder.getBeanMetaData(), scopedManager);
-         return name;
-      }
-      catch (Throwable e)
-      {
-         throw new DeploymentException("Error registering scoped manager" + name + " " + scopedManager, e);
-      }
-   }
- 
-   private synchronized int getSequence()
-   {
-      return ++sequence;
-   }
-   
-   private void unregisterScopedManagerBean(String name, boolean logError)
-   {
-      if (name == null)
-      {
-         return;
-      }
-      
-      try
-      {
-         controller.uninstall(name);
-      }
-      catch(Throwable t)
-      {
-         if (logError)
-         {
-            log.debug("Error unregistering scoped aspect manager " + name, t);
-         }
-      }
-   }
-   
-   private void massageScopedDeployment(int sequence, VFSDeploymentUnit unit, T deployment, AopMetaDataDeployerOutput output, String scopedManagerName) throws DeploymentException
-   {
-      log.debug("Massaging scoped deployment " + unit + " setting manager to " + scopedManagerName);
-      String domainName = getDomainName(unit);
-      output.setScopedInformation(scopedManagerName, domainName, sequence);
-      unit.getMutableMetaData().addAnnotation(output.getScopeAnnotation());
-   }
-   
-   private String getDomainName(VFSDeploymentUnit unit)
-   {
-      Module module = unit.getTopLevel().getAttachment(Module.class);
-      if (module != null && !module.getDeterminedDomainName().equals(ClassLoaderSystem.DEFAULT_DOMAIN_NAME))
-      {
-         return module.getDeterminedDomainName();
-      }
-      
-      return null;
-   }
-   
-   private void deployBeans(VFSDeploymentUnit unit, AopMetaDataDeployerOutput output) throws DeploymentException
-   {
-      List<BeanMetaData> aopBeans = output.getBeans();
-      List<BeanMetaData> done = new ArrayList<BeanMetaData>();
-      try
-      {
-         if (aopBeans != null && aopBeans.size() > 0)
-         {
-            for (BeanMetaData bean : aopBeans)
-            {
-               //Register the component deployment context so we get the correct mutable metadata scope
-               DeploymentUnit componentUnit = deployComponentDeploymentContext(unit, bean);
-               try
-               {
-                  beanMetaDataDeployer.deploy(componentUnit, bean);
-                  done.add(bean);
-               }
-               finally
-               {
-                  //Unregister the component deployment context so that this bean does not get deployed
-                  //again by the real BeanMetaDataDeployer
-                  undeployComponentDeploymentContext(unit, bean);
-               }
-            }
-         }
-      }
-      catch (Throwable t)
-      {
-         for (int i = done.size() - 1 ; i >= 0 ; i--)
-         {
-            try
-            {
-               beanMetaDataDeployer.undeploy(unit, done.get(i));
-               controller.uninstall(done.get(i));
-            }
-            catch (Throwable e)
-            {
-               log.debug("Error undeploying " + done.get(i) + " for " + unit);
-            }
-         }
-         throw new DeploymentException(t);
-      }
-   }
-   
-   private void undeployBeans(VFSDeploymentUnit unit, AopMetaDataDeployerOutput output)
-   {
-      if (output != null)
-      {
-         List<BeanMetaData> aopBeans = output.getBeans();
-         if (aopBeans != null && aopBeans.size() > 0)
-         {
-            for (int i = aopBeans.size() - 1 ; i >= 0 ; i--)
-            {
-               BeanMetaData bean = aopBeans.get(i);
-               beanMetaDataDeployer.undeploy(unit, bean);
-            }
-         }
-      }
-   }
-   
-   /**
-    * Wrap the deployment unit in a component deployment unit similar to what the KernelDeploymentDeployer does
-    */
-   private DeploymentUnit deployComponentDeploymentContext(DeploymentUnit unit, BeanMetaData deployment)
-   {
-      DeploymentUnit componentUnit = unit.addComponent(deployment.getName());
-      componentUnit.addAttachment(BeanMetaData.class.getName(), deployment);
-      return componentUnit;
-   }
-   
-   /**
-    * Undeploy the component deployment unit similar to what the KernelDeploymentDeployer does 
-    */
-   private void undeployComponentDeploymentContext(DeploymentUnit unit, BeanMetaData bean)
-   {
-      unit.removeComponent(bean.getName());
-   }
-   
-   private class MyBeanMetaDataDeployer
-   {   
-      /**
-       * Copied from the real org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer
-       */
-      private void deploy(DeploymentUnit unit, BeanMetaData deployment) throws DeploymentException
-      {
-         // No explicit classloader, use the deployment's classloader
-         if (deployment.getClassLoader() == null)
-         {
-            try
-            {
-               // Check the unit has a classloader
-               unit.getClassLoader();
-               // TODO clone the metadata?
-               deployment.setClassLoader(new DeploymentClassLoaderMetaData(unit));
-            }
-            catch (Exception e)
-            {
-               log.debug("Unable to retrieve classloader for deployment: " + unit.getName() + " reason=" + e.toString());
-            }
-         }
-         KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
-         //Make sure that the metadata from the deployment gets put into the context
-         ScopeInfo scopeInfo = context.getScopeInfo();
-         if (scopeInfo != null)
-         {
-            mergeScopes(scopeInfo.getScope(), unit.getScope());
-            mergeScopes(scopeInfo.getMutableScope(), unit.getMutableScope());
-         }
-         
-         try
-         {
-            //System.out.println("==============> Installing " + context.getName());
-            controller.install(context);
-         }
-         catch (Throwable t)
-         {
-            throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + deployment.getName(), t);
-         }
-         
-         
-      }
-   
-      /**
-       * Copied from the real org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer
-       * Merge scope keys.
-       *
-       * @param contextKey the context key
-       * @param unitKey the unit key
-       */
-      protected void mergeScopes(ScopeKey contextKey, ScopeKey unitKey)
-      {
-         if (contextKey == null)
-            return;
-         if (unitKey == null)
-            return;
-
-         Collection<Scope> unitScopes = unitKey.getScopes();
-         if (unitScopes == null || unitScopes.isEmpty())
-            return;
-
-         for (Scope scope : unitScopes)
-            contextKey.addScope(scope);
-      }
-
-      /**
-       * Copied from the real org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer
-       */
-      private void undeploy(DeploymentUnit unit, BeanMetaData deployment)
-      {
-         try
-         {
-            controller.uninstall(deployment.getName());
-            
-            // Remove any classloader metadata we added (not necessary if we clone above)
-            ClassLoaderMetaData classLoader = deployment.getClassLoader();
-            if (classLoader instanceof DeploymentClassLoaderMetaData)
-               deployment.setClassLoader(null);
-         }
-         catch(Throwable t)
-         {
-            log.info("Error undeploying " + deployment + " for " + unit);
-         }
-      }
-   }
-   
-   /**
-    * Copied from BeanMetaDataDeployer
-    */
-   private static class DeploymentClassLoaderMetaData extends AbstractClassLoaderMetaData
-   {
-      /** The serialVersionUID */
-      private static final long serialVersionUID = 1L;
-      
-      /** The deployment unit */
-      private DeploymentUnit unit;
-
-      /**
-       * Create a new DeploymentClassLoaderMetaData.
-       * 
-       * @param unit the deployment unit
-       */
-      public DeploymentClassLoaderMetaData(DeploymentUnit unit)
-      {
-         if (unit == null)
-            throw new IllegalArgumentException("Null unit");
-         this.unit = unit;
-      }
-      
-      @Override
-      public ValueMetaData getClassLoader()
-      {
-         return new AbstractValueMetaData(unit.getClassLoader());
-      }
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AliasesImpl.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AliasesImpl.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AliasesImpl.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,57 +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;
-
-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;
-   }
-
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,143 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.aop.microcontainer.beans.Aspect;
-import org.jboss.aop.microcontainer.beans.metadata.AspectManagerAwareBeanMetaDataFactory;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-class AopMetaDataDeployerOutput
-{
-   List<AspectManagerAwareBeanMetaDataFactory> factories;
-   List<BeanMetaData> beans;
-   boolean scoped;
-   String scopedAspectManagerBeanName;
-   String domainName;
-   int sequence;
-   ClassLoaderDomainScope scopeAnnotation;
-   
-   AopMetaDataDeployerOutput()
-   {
-      
-   }
-
-   String getScopedAspectManagerBeanName()
-   {
-      return scopedAspectManagerBeanName;
-   }
-
-   ClassLoaderDomainScope getScopeAnnotation()
-   {
-      return scopeAnnotation;
-   }
-   
-   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;
-      if (domainName == null)
-      {
-         throw new IllegalStateException("Should not have null domainName for scoped bean");
-      }
-      scopeAnnotation = new ClassLoaderDomainScopeImpl(domainName);
-   }
-   
-   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);
-            }
-
-            List<BeanMetaData> mybeans = factory.getBeans();
-            if (mybeans != null && mybeans.size() > 0)
-            {
-               for (BeanMetaData bean : mybeans)
-               {
-                  massageScopedBean(bean);
-               }
-               beans.addAll(mybeans);
-            }
-         }
-      }
-      return beans;
-   }
-
-   private void massageScopedBean(BeanMetaData bean)
-   {
-      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
-         builder.addAnnotation(scopeAnnotation);
-      
-         //set the new name used by the controller for managing beans
-         builder.setName(newName);
-         
-         //Debug stuff
-         if (bean.getBean().equals(Aspect.class.getName()))
-         {
-            Object scope = null;
-            Set<PropertyMetaData> properties = bean.getProperties();
-            for (PropertyMetaData property : properties)
-            {
-               if (property.getName().equals("scope"))
-               {
-                  scope = property.getValue().getUnderlyingValue();
-               }
-            }
-         }
-      }
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectAppParsingDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AspectAppParsingDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectAppParsingDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,77 +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;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.JAXPDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.mx.loading.LoaderRepositoryFactory;
-import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
-import org.jboss.virtual.VirtualFile;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Deployer to read the loader-repository config from a .aop/META-INF/jboss-aop.xml
- * and populate the LoaderRepositoryConfig attachment. The main use-case is when 
- * deploying a standalone .aop file that we want to attach to a scoped deployment.
- * 
- * @deprecated Use the one from the aop project instead once that is released, and delete these from .classpath: jboss-deployers-vfs-spi.jar, jboss-deployers-spi.jar, jboss-managed.jar
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
- at Deprecated
-public class AspectAppParsingDeployer extends JAXPDeployer<AspectDeployment>
-{
-   public AspectAppParsingDeployer()
-   {
-      super(AspectDeployment.class);
-      setSuffix("-aop.xml");
-      setStage(DeploymentStages.DESCRIBE);
-   }
-
-   protected AspectDeployment parse(VFSDeploymentUnit unit, VirtualFile file, Document document) throws Exception
-   {
-      if (unit.getTopLevel() == unit)
-      {
-         // Check for a custom loader-repository for scoping
-         NodeList loaders = document.getElementsByTagName("loader-repository");
-         if( loaders.getLength() > 0 )
-         {
-            Element loader = (Element) loaders.item(0);
-            try
-            {
-               LoaderRepositoryConfig config = LoaderRepositoryFactory.parseRepositoryConfig(loader);
-               unit.addAttachment(LoaderRepositoryConfig.class, config);
-            }
-            catch (Exception e)
-            {
-               throw DeploymentException.rethrowAsDeploymentException("Unable to parse loader repository config", e);
-            }
-         }
-      }
-      return null;
-   }
-
-}

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/AspectDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/AspectDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -34,7 +34,6 @@
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.AspectXmlLoader;
 import org.jboss.aop.Domain;
-import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
 import org.jboss.classloader.spi.ClassLoaderDomain;
 import org.jboss.classloader.spi.ClassLoaderSystem;
 import org.jboss.classloading.spi.dependency.Module;

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/BeansDeploymentAopMetaDataDeployer.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/BeansDeploymentAopMetaDataDeployer.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/BeansDeploymentAopMetaDataDeployer.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,62 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., 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.aop.asintegration.jboss5;
-
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-
-/**
- * Deployer for Aspects in a -beans.xml
- *
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- */
-public class BeansDeploymentAopMetaDataDeployer extends AbstractAopMetaDataDeployer<KernelDeployment>
-{
-   public BeansDeploymentAopMetaDataDeployer()
-   {
-      super(KernelDeployment.class);
-   }
-
-   @Override
-   public void deploy(VFSDeploymentUnit unit, KernelDeployment kernelDeployment) throws DeploymentException
-   {
-      super.deploy(unit, kernelDeployment);
-   }
-   
-   @Override
-   public void undeploy(VFSDeploymentUnit unit, KernelDeployment kernelDeployment)
-   {
-      super.undeploy(unit, kernelDeployment);
-   }
-
-
-   @Override
-   protected List<BeanMetaDataFactory> getFactories(KernelDeployment kernelDeployment)
-   {
-      return kernelDeployment.getBeanFactories();
-   }
-   
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScope.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScope.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScope.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,42 +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;
-
-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();
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeFactory.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeFactory.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeFactory.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,41 +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;
-
-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());
-   }
-
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeImpl.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeImpl.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ClassLoaderDomainScopeImpl.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,50 +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;
-
-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;
-   }
-
-}

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/DefaultTranslator.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/DefaultTranslator.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/DefaultTranslator.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -41,24 +41,10 @@
       this.manager = manager;
    }
 
-   public void setTranslate(boolean translate)
-   {
-      this.translate = translate;
-   }
-   
-   public boolean getTranslate()
-   {
-      return translate;
-   }
-   
-   public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined,
+   public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
          ProtectionDomain protectionDomain, byte[] classfileBuffer) throws Exception
    {
-      if (translate)
-      {
-         return manager.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
-      }
-      return classfileBuffer;   
+      return manager.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
    }
 
    public void unregisterClassLoader(ClassLoader loader)

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/IntegrationStrategy.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/IntegrationStrategy.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/IntegrationStrategy.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,41 +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;
-
-import java.io.File;
-
-import javassist.scopedpool.ScopedClassPoolFactory;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface IntegrationStrategy
-{
-   void start();
-   void stop();
-   ScopedClassPoolFactory createScopedClassPoolFactory(File tmpDir) throws Exception;
-   void attachDeprecatedTranslator();
-   void detachDeprecatedTranslator();
-
-}

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -72,7 +72,7 @@
       super.close();
    }
 
-   public Class toClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
+   public Class<?> toClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
    {
       lockInCache(cc);
       final ClassLoader myloader = getClassLoader();
@@ -105,7 +105,7 @@
                
             }
             
-            Class clazz = myloader.loadClass(cc.getName());
+            Class<?> clazz = myloader.loadClass(cc.getName());
 
             return clazz;
          }

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -48,7 +48,7 @@
    public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
    {      
       ClassPool parent = getCreateParentClassPools(cl, src, repository);
-      Map props = ExtraClassPoolFactoryParameters.peekThreadProperties();
+      Map<Object, Object> props = ExtraClassPoolFactoryParameters.peekThreadProperties();
       boolean isWebCl = props == null ? false : ((Boolean)props.get("IsWebCl")).booleanValue();
       if (!isWebCl && cl instanceof RealClassLoader)
       {

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -36,6 +36,7 @@
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
 import org.jboss.aop.asintegration.JBossIntegration;
+import org.jboss.classloader.spi.ClassLoaderSystem;
 import org.jboss.classloading.spi.RealClassLoader;
 
 /**
@@ -48,8 +49,6 @@
    /** The delegate classpool factory */
    private ScopedClassPoolFactory delegateClassPoolFactory;
    private AOPClassLoaderScopingPolicy policy = new VFSClassLoaderScopingPolicy();
-   private AspectManager manager = AspectManager.getTopLevelAspectManager();
-   DefaultTranslator translator = new DefaultTranslator(manager);
    
    private static final Set<ClassLoader> bootstrapLoaders;
    static 
@@ -74,12 +73,10 @@
 
    public void start()
    {
-      getIntegrationStrategy().start();
    }
 
    public void stop()
    {
-      getIntegrationStrategy().stop();
    }
    
    public boolean isValidClassLoader(ClassLoader loader)
@@ -115,7 +112,7 @@
    {
       if (delegateClassPoolFactory == null)
       {
-         delegateClassPoolFactory = getIntegrationStrategy().createScopedClassPoolFactory(tmpDir);
+         delegateClassPoolFactory = new JBoss5ClassPoolFactory();
       }
       return this;
    }
@@ -132,28 +129,11 @@
    
    public void attachDeprecatedTranslator()
    {
-      getIntegrationStrategy().attachDeprecatedTranslator();
+      ClassLoaderSystem.getInstance().setTranslator(new DefaultTranslator(AspectManager.getTopLevelAspectManager()));      
    }
 
    public void detachDeprecatedTranslator()
    {
-      getIntegrationStrategy().detachDeprecatedTranslator();
+      ClassLoaderSystem.getInstance().setTranslator(null);
    }
-   
-   private IntegrationStrategy integrationStrategy;
-   private synchronized IntegrationStrategy getIntegrationStrategy()
-   {
-      if (integrationStrategy == null)
-      {
-         if (policy.getClass().getName().endsWith("RepositoryClassLoaderScopingPolicy"))
-         {
-            integrationStrategy = new RepositoryIntegrationStrategy();
-         }
-         else
-         {
-            integrationStrategy = new VFSIntegrationStrategy(manager);
-         }
-      }
-      return integrationStrategy;
-   }
 }

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/MetaDataClassLoaderScopingPolicy.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/MetaDataClassLoaderScopingPolicy.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/MetaDataClassLoaderScopingPolicy.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,101 +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;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.Domain;
-import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.stack.MetaDataStack;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MetaDataClassLoaderScopingPolicy implements AOPClassLoaderScopingPolicy
-{
-   static Logger log = Logger.getLogger(MetaDataClassLoaderScopingPolicy.class);
-   
-   //Several loaders may share the same domain
-   private Map<ClassLoader, Domain> domainsByLoader = new WeakHashMap<ClassLoader, Domain>();
-   
-   public Domain getDomain(ClassLoader classLoader, AspectManager parent)
-   {
-      //Check metadata stack for domain to use
-      MetaData metaData = MetaDataStack.peek();
-      if (metaData != null)
-      {
-         //There is metadata on the stack, so check there. No domain in this case means use the main AM
-         Domain domain = metaData.getMetaData(Domain.class);
-         if (domain != null)
-         {
-            registerDomain(classLoader, domain);
-            return domain;
-         }
-      }      
-      
-      //Check the stored domains
-      Domain domain = getRegisteredDomain(classLoader);
-      if (domain != null)
-      {
-         return domain;
-      }
-      
-      return null;
-   }
-
-   public Domain getTopLevelDomain(AspectManager parent)
-   {
-      Thread.currentThread().getContextClassLoader();
-      return null;
-   }
-
-   public boolean isScoped(ClassLoader classLoader)
-   {
-      //TODO come up with something here?
-      return false;
-   }
-
-   private synchronized void registerDomain(ClassLoader cl, Domain domain)
-   {
-      Domain found = domainsByLoader.get(cl);
-      if (found == null)
-      {
-         domainsByLoader.put(cl, domain);
-      }
-      
-      if (found != domain)
-      {
-         log.warn("Several domains being used for a particular classloader");
-      }
-   }
-   
-   private synchronized Domain getRegisteredDomain(ClassLoader cl)
-   {
-      return domainsByLoader.get(cl);
-   }
-}

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/RepositoryIntegrationStrategy.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/RepositoryIntegrationStrategy.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/RepositoryIntegrationStrategy.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,122 +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;
-
-import java.io.File;
-
-import javax.management.Attribute;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.ReflectionException;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.asintegration.jboss4.JBossClassPoolFactory;
-import org.jboss.aop.deployment.AspectManagerService;
-import org.jboss.mx.util.MBeanServerLocator;
-
-import javassist.scopedpool.ScopedClassPoolFactory;
-
-/**
- * Takes care of the specifics in JBoss 5 when the RepositoryClassLoaders are used.
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class RepositoryIntegrationStrategy implements IntegrationStrategy
-{
-   public void start()
-   {
-   }
-   
-   public void stop()
-   {
-   }
-
-   public ScopedClassPoolFactory createScopedClassPoolFactory(File tmpDir) throws Exception
-   {
-      //This is the classpool factory from jboss-aop-jboss4-jdk50.jar
-      return new JBossClassPoolFactory(tmpDir);
-   }
-
-   public void attachDeprecatedTranslator()
-   {
-      AspectManager mgr = AspectManager.instance();
-      MBeanServer server = MBeanServerLocator.locateJBoss();
-      try
-      {
-         server.setAttribute(AspectManagerService.DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", mgr));
-      }
-      catch (InstanceNotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (AttributeNotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (InvalidAttributeValueException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (MBeanException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (ReflectionException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public void detachDeprecatedTranslator()
-   {
-      MBeanServer server = MBeanServerLocator.locateJBoss();
-      try
-      {
-         server.setAttribute(AspectManagerService.DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", null));
-      }
-      catch (InstanceNotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (AttributeNotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (InvalidAttributeValueException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (MBeanException e)
-      {
-         throw new RuntimeException(e);
-      }
-      catch (ReflectionException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-}

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -219,7 +219,7 @@
          //FIXME This needs revisiting/removing once the 
          ArrayList<ClassPool> noAnnotationURLClassLoaderPools = null;
                  
-         for(Iterator it = AspectManager.getRegisteredCLs().values().iterator() ; it.hasNext() ; )
+         for(Iterator<ClassPool> it = AspectManager.getRegisteredCLs().values().iterator() ; it.hasNext() ; )
          {
             AOPClassPool candidate = (AOPClassPool)it.next();
             if (candidate.isUnloadedClassLoader())
@@ -293,7 +293,7 @@
     */
    private boolean isInstanceOfNoAnnotationURLClassLoader(ClassLoader loader)
    {
-      Class parent = loader.getClass();
+      Class<?> parent = loader.getClass();
       while (parent != null)
       {
          if ("NoAnnotationURLClassLoader".equals(parent.getSimpleName()))

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -90,7 +90,7 @@
       aspect = super.getSuperPerVmAspect(def);
       if (aspect != null)
       {
-         Class superAspectClass = aspect.getClass();
+         Class<?> superAspectClass = aspect.getClass();
          ClassLoaderDomain loadingDomain = getAspectRepository(superAspectClass);
 
          ClassLoaderDomain myDomain = getClassLoaderDomain();
@@ -103,7 +103,7 @@
          else
          {
             //The class has been loaded by a parent domain, find out if we also have a copy
-            Class myAspectClazz = myDomain.loadClass(aspect.getClass().getName());
+            Class<?> myAspectClazz = myDomain.loadClass(aspect.getClass().getName());
             
             if (myAspectClazz == superAspectClass)
             {
@@ -125,7 +125,7 @@
    
    
    
-   private ClassLoaderDomain getAspectRepository(Class clazz)
+   private ClassLoaderDomain getAspectRepository(Class<?> clazz)
    {
       ClassLoader cl = clazz.getClassLoader();
       ClassLoaderDomain domain = registry.getClassLoaderDomainForLoader(cl);

Modified: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -49,7 +49,7 @@
    void registerClassLoader(Module module, boolean isWar, ClassLoader loader)
    {
       //Need to pass some data through to the classpoolfactory here
-      Map properties = new HashMap();
+      Map<Object, Object> properties = new HashMap<Object, Object>();
       //The module is needed by the JBoss5ClassPoolFactory, the legacy JBossClassPoolFactory will ignore this
       properties.put(Module.class, module);
       properties.put("IsWebCl", isWar ? Boolean.TRUE : Boolean.FALSE);

Deleted: projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSIntegrationStrategy.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/asintegration/jboss5/VFSIntegrationStrategy.java	2008-09-25 16:21:17 UTC (rev 78867)
+++ projects/aop/trunk/asintegration-mc/src/main/org/jboss/aop/asintegration/jboss5/VFSIntegrationStrategy.java	2008-09-25 17:10:56 UTC (rev 78868)
@@ -1,71 +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;
-
-import java.io.File;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-
-import javassist.scopedpool.ScopedClassPoolFactory;
-
-/**
- * Takes care of the specifics in JBoss 5 when the RepositoryClassLoaders are used.
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class VFSIntegrationStrategy implements IntegrationStrategy
-{
-   DefaultTranslator translator;
-
-   public VFSIntegrationStrategy(AspectManager manager)
-   {
-      this.translator = new DefaultTranslator(manager);
-   }
-   
-   public void start()
-   {
-      ClassLoaderSystem.getInstance().setTranslator(translator);      
-   }
-
-   public void stop()
-   {
-      ClassLoaderSystem.getInstance().setTranslator(null);
-   }
-
-   public ScopedClassPoolFactory createScopedClassPoolFactory(File tmpDir) throws Exception
-   {
-      return new JBoss5ClassPoolFactory();
-   }
-
-   public void attachDeprecatedTranslator()
-   {
-      translator.setTranslate(true);      
-   }
-
-   public void detachDeprecatedTranslator()
-   {
-      translator.setTranslate(false);      
-   }
-
-}




More information about the jboss-cvs-commits mailing list