[jboss-cvs] JBossAS SVN: r78670 - in projects/aop/trunk/asintegration: src/main/org/jboss/aop/asintegration and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 18 07:15:54 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-09-18 07:15:54 -0400 (Thu, 18 Sep 2008)
New Revision: 78670

Added:
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJDK5.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJRockit.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AbstractAspectManagerService.java
Removed:
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceMBean.java
Modified:
   projects/aop/trunk/asintegration/build.xml
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJDK5.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJRockit.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerService.java
   projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceJDK5.java
Log:
[JBAS-5970] remove dependency of AOP on ServiceMBeanSupport by creating a 'core' aspectmanager service that can be wrapped in either mc bean or mbean

Modified: projects/aop/trunk/asintegration/build.xml
===================================================================
--- projects/aop/trunk/asintegration/build.xml	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/build.xml	2008-09-18 11:15:54 UTC (rev 78670)
@@ -195,7 +195,8 @@
          update="${jar.update}" index="${jar.index}">
          <fileset dir="${build.classes}">
             <!-- Include everything else -->
-			   <include name="org/jboss/aop/asintegration/*"/>
+            <include name="org/jboss/aop/asintegration/*"/>
+            <include name="org/jboss/aop/asintegration/core/*"/>
             <include name="org/jboss/aop/classpool/**"/>
             <include name="org/jboss/aop/deploy*/**"/>
             <include name="org/jboss/aop/domain/**"/>
@@ -209,6 +210,7 @@
          <fileset dir="${build.classes}">
             <!-- Include everything else -->
 			   <include name="org/jboss/aop/asintegration/*"/>
+            <include name="org/jboss/aop/asintegration/core/*"/>
             <include name="org/jboss/aop/classpool/**"/>
             <include name="org/jboss/aop/deploy*/**"/>
             <include name="org/jboss/aop/domain/**"/>

Added: projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java	                        (rev 0)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -0,0 +1,690 @@
+/*
+* 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.core;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javassist.ClassPool;
+import javassist.scopedpool.ScopedClassPoolFactory;
+
+import javax.management.ObjectName;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.aop.ClassLoaderValidation;
+import org.jboss.aop.ClassicWeavingStrategy;
+import org.jboss.aop.Deployment;
+import org.jboss.aop.SuperClassesFirstWeavingStrategy;
+import org.jboss.aop.advice.AdviceBinding;
+import org.jboss.aop.advice.AdviceStack;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.InterceptorFactory;
+import org.jboss.aop.annotation.PortableAnnotationElement;
+import org.jboss.aop.asintegration.JBossIntegration;
+import org.jboss.aop.asintegration.jboss4.JBoss4Integration;
+import org.jboss.aop.hook.JDK14Transformer;
+import org.jboss.aop.hook.JDK14TransformerManager;
+import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.aop.instrument.TransformerCommon;
+import org.jboss.aop.introduction.InterfaceIntroduction;
+import org.jboss.logging.Logger;
+import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
+import org.jboss.mx.server.ServerConstants;
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.system.server.ServerConfig;
+import org.w3c.dom.Document;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AspectManagerServiceDelegate
+{
+   Logger log = Logger.getLogger(AspectManagerServiceDelegate.class);
+   
+   static {
+      //pre-load necessary classes so that we avoid NoClassDefFoundErrors on JRockit when using the RepositoryClassloader hook
+      //When AspectManager.translate() is called the first time, these classes have not been loaded yet, and this is what causes
+      //JRockit to get confused
+      @SuppressWarnings("unused")
+      Class<?> clazz = TransformerCommon.class;
+      clazz = SuperClassesFirstWeavingStrategy.class;
+      clazz = ClassicWeavingStrategy.class;
+      clazz = HeirarchicalLoaderRepository3.class;
+   }
+
+   public static final ObjectName DEFAULT_LOADER_REPOSITORY = ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
+
+   // Attributes ---------------------------------------------------
+
+   boolean created = false;
+   protected File tmpClassesDir;
+   protected boolean enableTransformer = false;
+   protected boolean enableLoadtimeWeaving = false;
+   protected boolean suppressTransformationErrors = true;
+   protected boolean suppressReferenceErrors = true;
+   protected String exclude;
+   protected String include;
+   protected String ignore;
+   protected String includedInvisibleAnnotations;
+   
+   /**
+    * A string containing xml to be deployed first thing when this service is created
+    */
+   private String bootstrapXml;
+   /**
+    * The name of the file used to deploy the core aspects
+    */
+   private String baseXml = "base-aop.xml";
+   
+   //When running with JBoss 5 registration with MBeanServer happens after the service has been started
+   boolean registerHappensAfterStart;
+   boolean hasBeenStarted;
+   
+   /** The encapsulation of the integration */
+   private JBossIntegration integration;
+   
+   private AtomicBoolean started = new AtomicBoolean();
+   
+   private AspectManager manager;
+   
+   
+   // Static -------------------------------------------------------
+
+   // Constructors -------------------------------------------------
+   public AspectManagerServiceDelegate()
+   {
+      
+   }
+
+   public void setBootstrapXml(String bootstrapXml)
+   {
+      this.bootstrapXml = bootstrapXml;
+   }
+   
+   public void setBaseXml(String baseXml)
+   {
+      this.baseXml = baseXml;
+   }
+   
+   public void setRegisterHappensAfterStart(boolean registerHappensAfterStart)
+   {
+      this.registerHappensAfterStart = registerHappensAfterStart;
+   }
+
+   /**
+    * This needs setting to true in AS 4
+    */
+   public void setAspectManagerMaintainAdvisorInterceptors(boolean maintain)
+   {
+      AspectManager.maintainAdvisorMethodInterceptors = maintain;
+   }
+   
+   public void setAspectManager(AspectManager manager)
+   {
+      this.manager = manager;
+   }
+   
+   public AspectManager getAspectManager()
+   {
+      return manager;
+   }
+
+   // Public -------------------------------------------------------
+
+   /**
+    * Get the integration
+    * 
+    * @return the integration
+    */
+   public JBossIntegration getJBossIntegration()
+   {
+      return integration;
+   }
+   
+   /**
+    * Set the integration
+    * 
+    * @param integration the integration 
+    */
+   public void setJBossIntegration(JBossIntegration integration)
+   {
+      this.integration = integration;
+   }
+
+   public ScopedClassPoolFactory createFactory() throws Exception
+   {
+      return initIntegration().createScopedClassPoolFactory(tmpClassesDir);
+   }
+   
+   public ClassLoaderValidation createClassLoaderValidation()
+   {
+      return initIntegration();
+   }
+
+   /**
+    * Initialize the integration if not alreday done so
+    * 
+    * @return the integration
+    */
+   protected JBossIntegration initIntegration()
+   {
+      // Default to old JBoss4 integration when not configured
+      if (integration == null)
+         integration = new JBoss4Integration();
+      return integration;
+   }
+   
+   public void create()
+           throws Exception
+   {
+      initIntegration();
+      if (hasBeenStarted)
+      {
+         return;
+      }
+      
+      
+      // Set a default tmp classes dir to the jboss tmp dir/aopclasses
+      if (tmpClassesDir == null)
+      {
+         String jbossTmpDir = System.getProperty(ServerConfig.SERVER_TEMP_DIR);
+         if (jbossTmpDir == null)
+            jbossTmpDir = System.getProperty("java.io.tmpdir");
+         tmpClassesDir = new File(jbossTmpDir, "aopdynclasses");
+      }
+      // Validate the the tmp dir exists
+      if (tmpClassesDir.exists() == false && tmpClassesDir.mkdirs() == false)
+         throw new FileNotFoundException("Failed to create tmpClassesDir: " + tmpClassesDir.getAbsolutePath());
+      AspectManager.setClassPoolFactory(createFactory());
+
+      AspectManager.classLoaderValidator = createClassLoaderValidation();
+      // Add the tmp classes dir to our UCL classpath
+
+      Deployment.searchClasspath = false; // turn off dynamic finding of DDs
+      AspectManager.suppressTransformationErrors = suppressTransformationErrors;
+      if (enableTransformer && enableLoadtimeWeaving) throw new RuntimeException("Cannot set both EnableTransformer and EnableLoadtimeWeaving");
+      if (enableTransformer)
+      {
+         attachDeprecatedTranslator();
+      }
+      if (enableLoadtimeWeaving)
+      {
+         attachTranslator();
+      }
+      created = true;
+      AspectManager.setClassLoaderScopingPolicy(integration.createAOPClassLoaderScopingPolicy());
+
+      bootstrapXml();
+      baseXml();
+   }
+   
+   public void start() throws Exception
+   {
+      started.set(true);
+   }
+
+   public void stop()
+   {
+      started.set(false);
+   }
+   
+   public void destroy()
+   {
+      //TODO remove baseAop stuff
+      try
+      {
+         if (bootstrapXml != null)
+         {
+            InputStream in = new BufferedInputStream(new ByteArrayInputStream(bootstrapXml.getBytes()));
+            try
+            {
+               Document doc = AspectXmlLoader.loadDocument(new BufferedInputStream(in));
+               AspectXmlLoader loader = new AspectXmlLoader();
+               loader.setManager(manager);
+               PortableAnnotationElement.setClosingDownManager(true);
+               loader.undeployXML(doc, null);
+            }
+            finally
+            {
+               if (in != null)
+               {
+                  in.close();
+               }
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Problem destroying AspectManager", e);
+      }
+   }
+   
+   protected void baseXml()
+   {
+      if (baseXml == null)
+      {
+         return;
+      }
+      baseXml(baseXml);
+   }
+
+   public void baseXml(String xml)
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      URL base = cl.getResource(xml);
+      try
+      {
+         if (base != null)
+         {
+            AspectXmlLoader.deployXML(base);
+         }
+         else
+         {
+            log.warn("Could not find " + xml + " file in the resources of " + cl);
+         }
+      }
+      catch (Exception e)
+      {
+         System.out.println("Error loading " + xml + " file" + e);
+      }
+   }
+   
+   public void bootstrapXml()
+   {
+      try
+      {
+         if (bootstrapXml != null && bootstrapXml.trim().length() > 0)
+         {
+            InputStream in = new BufferedInputStream(new ByteArrayInputStream(bootstrapXml.getBytes()));
+            try
+            {
+               Document doc = AspectXmlLoader.loadDocument(new BufferedInputStream(in));
+               AspectXmlLoader loader = new AspectXmlLoader();
+               loader.setManager(manager);
+               loader.deployXML(doc, null);
+            }
+            finally
+            {
+               if (in != null)
+               {
+                  in.close();
+               }
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         // AutoGenerated
+         throw new RuntimeException("Problem starting AspectManager", e);
+      }
+   }
+   
+   protected void attachDeprecatedTranslator()
+   {
+      log.warn("EnableTransformer has been deprecated, please use EnableLoadtimeWeaving.  See docs for more details");
+      initIntegration().attachDeprecatedTranslator();
+   }
+
+   protected void detachDeprecatedTranslator()
+   {
+      initIntegration().detachDeprecatedTranslator();
+   }
+
+   /*
+    * Despite its name, this is also used for the JRockit transformer
+    */
+   protected void attachTranslator()
+   {
+      //Despite its name, this is also used for the JRockit transformer
+      JDK14TransformerManager.transformer = new JDK14Transformer()
+      {
+         public byte[] transform(ClassLoader loader, String classname, byte[] classBytes)
+         {
+            try
+            {
+               //Make sure that we use the correct classloader, in order to get the correct domain if it is a scoped loader
+               return AspectManager.instance(loader).translate(classname, loader, classBytes);
+            }
+            catch (Exception e)
+            {
+               throw new RuntimeException("Error converting " + classname + " on " + loader, e);
+            }
+         }
+      };
+   }
+
+   protected void detachTranslator()
+   {
+      JDK14TransformerManager.transformer = null;
+   }
+
+   public boolean getPrune()
+   {
+      return AspectManager.getPrune();
+   }
+
+   public void setPrune(boolean prune)
+   {
+      AspectManager.setPrune(prune);
+   }
+
+   public String getExclude()
+   {
+      return exclude;
+   }
+
+   public void setExclude(String exclude)
+   {
+      this.exclude = exclude;
+      ArrayList<String> list = new ArrayList<String>();
+      if (exclude != null)
+      {
+         StringTokenizer tokenizer = new StringTokenizer(exclude, ",");
+         while (tokenizer.hasMoreTokens())
+         {
+            list.add(tokenizer.nextToken().trim());
+         }
+      }
+      manager.setExclude(list);
+   }
+
+   public String getInclude()
+   {
+      return include;
+   }
+
+   public void setInclude(String include)
+   {
+      this.include = include;
+      ArrayList<String> list = new ArrayList<String>();
+      if (include != null)
+      {
+         StringTokenizer tokenizer = new StringTokenizer(include, ",");
+         while (tokenizer.hasMoreTokens())
+         {
+            list.add(tokenizer.nextToken().trim());
+         }
+      }
+      manager.setInclude(list);
+   }
+
+   public String getIgnore()
+   {
+      return ignore;
+   }
+
+   public void setIgnore(String ignore)
+   {
+      this.ignore = ignore;
+      ArrayList<String> list = new ArrayList<String>();
+      if (ignore != null)
+      {
+         StringTokenizer tokenizer = new StringTokenizer(ignore, ",");
+         while (tokenizer.hasMoreTokens())
+         {
+            list.add(tokenizer.nextToken().trim());
+         }
+      }
+      manager.setIgnore(list);
+   }
+   
+   public String getIncludedInvisibleAnnotations()
+   {
+      return includedInvisibleAnnotations;
+   }
+   
+   public void setIncludedInvisibleAnnotations(String ia)
+   {
+      List<String> iiaList = new ArrayList<String>();
+      if(ia != null)
+      {
+         for(String inc : ia.split(","))
+           iiaList.add(inc.trim());
+      }
+      manager.setIncludedInvisibleAnnotations(iiaList);
+   }
+
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public File getTmpClassesDir()
+   {
+      return tmpClassesDir;
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public void setTmpClassesDir(File tmpClassesDir)
+   {
+      this.tmpClassesDir = tmpClassesDir;
+   }
+
+   /**
+    * Set the verbosity of aop logging.  It doesn't use log4j
+    */
+   public boolean getVerbose()
+   {
+      return AspectManager.verbose;
+   }
+
+   /**
+    * Set the verbosity of aop logging.  It doesn't use log4j
+    */
+   public void setVerbose(boolean verbose)
+   {
+      AspectManager.verbose = verbose;
+   }
+
+   /**
+    * Use aop optimizations.  Optional just in case there is a bug
+    */
+   public boolean getOptimized()
+   {
+      return AspectManager.optimize;
+   }
+
+   /**
+    * Use aop optimizations.  Optional just in case there is a bug
+    */
+   public void setOptimized(boolean verbose)
+   {
+      AspectManager.optimize = verbose;
+   }
+
+   public boolean getSuppressTransformationErrors()
+   {
+      return suppressTransformationErrors;
+   }
+
+   public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
+   {
+      this.suppressTransformationErrors = suppressTransformationErrors;
+      AspectManager.suppressTransformationErrors = suppressTransformationErrors;
+   }
+
+   public boolean getSuppressReferenceErrors()
+   {
+      return suppressReferenceErrors;
+   }
+
+   public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
+   {
+      this.suppressReferenceErrors = suppressReferenceErrors;
+      AspectManager.suppressReferenceErrors = suppressReferenceErrors;
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public boolean getEnableTransformer()
+   {
+      return enableTransformer;
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public String interceptorFactories()
+   {
+      Map<String, InterceptorFactory> factories = manager.getInterceptorFactories();
+      StringBuffer buffer = new StringBuffer("");
+      for (String name : factories.keySet())
+      {
+         buffer.append(name + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public String aspectDefinitions()
+   {
+      Map<String, AspectDefinition> factories = manager.getAspectDefinitions();
+      StringBuffer buffer = new StringBuffer("");
+      for (String name : factories.keySet())
+      {
+         buffer.append(name + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   public String introductions()
+   {
+      Map<String, InterfaceIntroduction> factories = manager.getInterfaceIntroductions();
+      StringBuffer buffer = new StringBuffer("");
+      for (String name : factories.keySet())
+      {
+         buffer.append(name + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   public String stacks()
+   {
+      Map<String, AdviceStack> factories = manager.getInterceptorStacks();
+      StringBuffer buffer = new StringBuffer("");
+      for (String name : factories.keySet())
+      {
+         buffer.append(name + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   public String bindings()
+   {
+      Map<String, AdviceBinding> factories = manager.getBindings();
+      StringBuffer buffer = new StringBuffer("");
+      for (String name : factories.keySet())
+      {
+         buffer.append(name + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   public String registeredClassLoaders()
+   {
+      Map<ClassLoader, ClassPool> loaders = AspectManager.getRegisteredCLs();
+      StringBuffer buffer = new StringBuffer("");
+      for (ClassLoader loader : loaders.keySet())
+      {
+         buffer.append(loader + "<br>");
+      }
+      return buffer.toString();
+   }
+
+   public void setEnableTransformer(boolean enableTransformer)
+   {
+      // Testsuite uses enableTransformer, we may be testing new loadtime features though.
+
+      if (enableLoadtimeWeaving)
+      {
+         log.warn("enabledLoadtimeWeaving alread set");
+         return;
+      }
+      if (this.enableTransformer == enableTransformer) return;
+      if (started.get() == true)
+      {
+         if (enableTransformer)
+         {
+            attachDeprecatedTranslator();
+         }
+         else
+         {
+            detachDeprecatedTranslator();
+         }
+      }
+      this.enableTransformer = enableTransformer;
+   }
+
+   public boolean getEnableLoadtimeWeaving()
+   {
+      return enableLoadtimeWeaving;
+   }
+
+   public void setEnableLoadtimeWeaving(boolean enableTransformer)
+   {
+      if (this.enableLoadtimeWeaving == enableTransformer) return;
+      if (started.get() == true)
+      {
+         if (enableTransformer)
+         {
+            attachTranslator();
+         }
+         else
+         {
+            detachTranslator();
+         }
+      }
+      this.enableLoadtimeWeaving = enableTransformer;
+   }
+
+   public String getInstrumentor()
+   {
+      return InstrumentorFactory.getInstrumentorName();
+   }
+
+   public void setInstrumentor(String instrumentor)
+   {
+      InstrumentorFactory.initialise(instrumentor);
+   }
+
+   
+   public Logger getLog()
+   {
+      return log;
+   }
+}

Added: projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJDK5.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJDK5.java	                        (rev 0)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJDK5.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -0,0 +1,49 @@
+/*
+* 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.core;
+
+import org.jboss.aop.standalone.AOPTransformer;
+import org.jboss.aop.standalone.PluggableInstrumentor;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AspectManagerServiceDelegateJDK5 extends AspectManagerServiceDelegate
+{
+   protected AOPTransformer transformer = new AOPTransformer();
+
+   public AspectManagerServiceDelegateJDK5()
+   {
+   }
+
+   protected void attachTranslator()
+   {
+      PluggableInstrumentor.getInstrumentor().addTransformer(transformer);
+   }
+
+   protected void detachTranslator()
+   {
+      PluggableInstrumentor.getInstrumentor().removeTransformer(transformer);
+   }
+}

Added: projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJRockit.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJRockit.java	                        (rev 0)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJRockit.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -0,0 +1,32 @@
+/*
+* 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.core;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AspectManagerServiceDelegateJRockit extends AspectManagerServiceDelegate
+{
+
+}

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -23,25 +23,28 @@
 
 import java.io.File;
 
+import javassist.ClassPool;
+import javassist.scopedpool.ScopedClassPool;
+import javassist.scopedpool.ScopedClassPoolFactory;
+import javassist.scopedpool.ScopedClassPoolRepository;
+
 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.ObjectName;
 import javax.management.ReflectionException;
 
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
 import org.jboss.aop.AspectManager;
+import org.jboss.aop.asintegration.JBossIntegration;
 import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.deployment.AspectManagerService;
-import org.jboss.aop.asintegration.JBossIntegration;
+import org.jboss.aop.domain.ScopedRepositoryClassLoaderDomain;
 import org.jboss.mx.loading.RepositoryClassLoader;
+import org.jboss.mx.server.ServerConstants;
 import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ObjectNameFactory;
 
 /**
  * JBoss4Integration.<p>
@@ -65,6 +68,8 @@
  */
 public class JBoss4Integration implements JBossIntegration, ScopedClassPoolFactory
 {
+   static final ObjectName DEFAULT_LOADER_REPOSITORY = ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
+   
    /** The delegate classpool factory */
    private ScopedClassPoolFactory delegateClassPoolFactory;
    
@@ -101,7 +106,7 @@
       MBeanServer server = MBeanServerLocator.locateJBoss();
       try
       {
-         server.setAttribute(AspectManagerService.DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", mgr));
+         server.setAttribute(DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", mgr));
       }
       catch (InstanceNotFoundException e)
       {
@@ -130,7 +135,7 @@
       MBeanServer server = MBeanServerLocator.locateJBoss();
       try
       {
-         server.setAttribute(AspectManagerService.DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", null));
+         server.setAttribute(DEFAULT_LOADER_REPOSITORY, new Attribute("Translator", null));
       }
       catch (InstanceNotFoundException e)
       {

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -21,28 +21,12 @@
 */ 
 package org.jboss.aop.deployers;
 
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.InputStream;
 
-import javax.management.JMException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
 import org.jboss.aop.AspectManager;
-import org.jboss.aop.AspectXmlLoader;
-import org.jboss.aop.annotation.PortableAnnotationElement;
 import org.jboss.aop.asintegration.JBossIntegration;
-import org.jboss.aop.deployment.AspectManagerService;
-import org.jboss.deployment.DeploymentInfo;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
 import org.jboss.logging.Logger;
-import org.w3c.dom.Document;
 
 /**
  * 
@@ -52,33 +36,33 @@
 public abstract class AbstractAspectManager
 {
    final static String BASE_ASPECTS_XML = "base-aspects.xml";
-   AspectManagerService delegate = null;
-   String bootstrapXml;
+   final static boolean REGISTER_AFTER_START = true;
    
+   private AspectManagerServiceDelegate delegate = null;
+
    public AbstractAspectManager(String bootstrapXml)
    {
-      this.bootstrapXml = bootstrapXml;
+      delegate = createDelegate();
+      delegate.setAspectManager(AspectManager.getTopLevelAspectManager());
+      delegate.setBootstrapXml(bootstrapXml);
+      delegate.setBaseXml(BASE_ASPECTS_XML);
+      delegate.setRegisterHappensAfterStart(REGISTER_AFTER_START);
    }
-
+   
    public AspectManager getAspectManager()
    {
       return AspectManager.getTopLevelAspectManager();
    }
    
-   /**
-    * @param listener
-    * @param filter
-    * @param handback
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
-    */
-   public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+   protected abstract AspectManagerServiceDelegate createDelegate();
+   
+   AspectManagerServiceDelegate getDelegate()
    {
-      delegate.addNotificationListener(listener, filter, handback);
+      return delegate;
    }
-
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#aspectDefinitions()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#aspectDefinitions()
     */
    public String aspectDefinitions()
    {
@@ -86,17 +70,8 @@
    }
 
    /**
-    * @param classname
-    * @see org.jboss.aop.deployment.AspectManagerService#attachClass(java.lang.String)
-    */
-   public void attachClass(String classname)
-   {
-      delegate.attachClass(classname);
-   }
-
-   /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#bindings()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#bindings()
     */
    public String bindings()
    {
@@ -109,32 +84,6 @@
     */
    public void create() throws Exception
    {
-      try
-      {
-         if (bootstrapXml != null && bootstrapXml.trim().length() > 0)
-         {
-            InputStream in = new BufferedInputStream(new ByteArrayInputStream(bootstrapXml.getBytes()));
-            try
-            {
-               Document doc = AspectXmlLoader.loadDocument(new BufferedInputStream(in));
-               AspectXmlLoader loader = new AspectXmlLoader();
-               loader.setManager(getAspectManager());
-               loader.deployXML(doc, null);
-            }
-            finally
-            {
-               if (in != null)
-               {
-                  in.close();
-               }
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         // AutoGenerated
-         throw new RuntimeException("Problem starting AspectManager", e);
-      }
       delegate.create();
    }
 
@@ -158,32 +107,6 @@
     */
    public void destroy()
    {
-      try
-      {
-         if (bootstrapXml != null)
-         {
-            InputStream in = new BufferedInputStream(new ByteArrayInputStream(bootstrapXml.getBytes()));
-            try
-            {
-               Document doc = AspectXmlLoader.loadDocument(new BufferedInputStream(in));
-               AspectXmlLoader loader = new AspectXmlLoader();
-               loader.setManager(getAspectManager());
-               PortableAnnotationElement.setClosingDownManager(true);
-               loader.undeployXML(doc, null);
-            }
-            finally
-            {
-               if (in != null)
-               {
-                  in.close();
-               }
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Problem destroying AspectManager", e);
-      }
       delegate.destroy();
    }
 
@@ -199,18 +122,8 @@
 
    /**
     * @return
-    * @throws JMException
-    * @see org.jboss.system.ServiceMBeanSupport#getDeploymentInfo()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getEnableLoadtimeWeaving()
     */
-   public DeploymentInfo getDeploymentInfo() throws JMException
-   {
-      return delegate.getDeploymentInfo();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getEnableLoadtimeWeaving()
-    */
    public boolean getEnableLoadtimeWeaving()
    {
       return delegate.getEnableLoadtimeWeaving();
@@ -218,7 +131,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getEnableTransformer()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getEnableTransformer()
     */
    public boolean getEnableTransformer()
    {
@@ -227,7 +140,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getExclude()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getExclude()
     */
    public String getExclude()
    {
@@ -236,7 +149,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getIgnore()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getIgnore()
     */
    public String getIgnore()
    {
@@ -245,7 +158,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getInclude()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getInclude()
     */
    public String getInclude()
    {
@@ -254,7 +167,7 @@
    
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getIncludedInvisibleAnnotations()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getIncludedInvisibleAnnotations()
     */
    public String getIncludedInvisibleAnnotations()
    {
@@ -263,7 +176,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getInstrumentor()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getInstrumentor()
     */
    public String getInstrumentor()
    {
@@ -272,7 +185,7 @@
 
    /**
     * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getLog()
+    * @see org.jboss.aop.core.AspectManagerServiceDelegat#getLog()
     */
    public Logger getLog()
    {
@@ -281,26 +194,8 @@
 
    /**
     * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getName()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getOptimized()
     */
-   public String getName()
-   {
-      return delegate.getName();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#getNotificationInfo()
-    */
-   public MBeanNotificationInfo[] getNotificationInfo()
-   {
-      return delegate.getNotificationInfo();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getOptimized()
-    */
    public boolean getOptimized()
    {
       return delegate.getOptimized();
@@ -308,7 +203,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getPrune()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getPrune()
     */
    public boolean getPrune()
    {
@@ -317,44 +212,8 @@
 
    /**
     * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getServer()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getSuppressReferenceErrors()
     */
-   public MBeanServer getServer()
-   {
-      return delegate.getServer();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getServiceName()
-    */
-   public ObjectName getServiceName()
-   {
-      return delegate.getServiceName();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getState()
-    */
-   public int getState()
-   {
-      return delegate.getState();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.system.ServiceMBeanSupport#getStateString()
-    */
-   public String getStateString()
-   {
-      return delegate.getStateString();
-   }
-
-   /**
-    * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getSuppressReferenceErrors()
-    */
    public boolean getSuppressReferenceErrors()
    {
       return delegate.getSuppressReferenceErrors();
@@ -362,7 +221,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getSuppressTransformationErrors()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getSuppressTransformationErrors()
     */
    public boolean getSuppressTransformationErrors()
    {
@@ -371,7 +230,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getTmpClassesDir()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getTmpClassesDir()
     */
    public File getTmpClassesDir()
    {
@@ -380,7 +239,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getVerbose()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getVerbose()
     */
    public boolean getVerbose()
    {
@@ -388,17 +247,6 @@
    }
 
    /**
-    * @param listener
-    * @param notification
-    * @param handback
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object)
-    */
-   public void handleNotification(NotificationListener listener, Notification notification, Object handback)
-   {
-      delegate.handleNotification(listener, notification, handback);
-   }
-
-   /**
     * @return
     * @see java.lang.Object#hashCode()
     */
@@ -409,7 +257,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#interceptorFactories()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#interceptorFactories()
     */
    public String interceptorFactories()
    {
@@ -418,7 +266,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#introductions()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#introductions()
     */
    public String introductions()
    {
@@ -426,106 +274,17 @@
    }
 
    /**
-    * @param method
-    * @throws Exception
-    * @see org.jboss.system.ServiceMBeanSupport#jbossInternalLifecycle(java.lang.String)
-    */
-   public void jbossInternalLifecycle(String method) throws Exception
-   {
-      delegate.jbossInternalLifecycle(method);
-   }
-
-   /**
     * @return
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#nextNotificationSequenceNumber()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#registeredClassLoaders()
     */
-   public long nextNotificationSequenceNumber()
-   {
-      return delegate.nextNotificationSequenceNumber();
-   }
-
-   /**
-    * 
-    * @see org.jboss.system.ServiceMBeanSupport#postDeregister()
-    */
-   public void postDeregister()
-   {
-      delegate.postDeregister();
-   }
-
-   /**
-    * @param registrationDone
-    * @see org.jboss.system.ServiceMBeanSupport#postRegister(java.lang.Boolean)
-    */
-   public void postRegister(Boolean registrationDone)
-   {
-      delegate.postRegister(registrationDone);
-   }
-
-   /**
-    * @throws Exception
-    * @see org.jboss.system.ServiceMBeanSupport#preDeregister()
-    */
-   public void preDeregister() throws Exception
-   {
-      delegate.preDeregister();
-   }
-
-   /**
-    * @param server
-    * @param name
-    * @return
-    * @throws Exception
-    * @see org.jboss.system.ServiceMBeanSupport#preRegister(javax.management.MBeanServer, javax.management.ObjectName)
-    */
-   public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
-   {
-      return delegate.preRegister(server, name);
-   }
-
-   /**
-    * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#registeredClassLoaders()
-    */
    public String registeredClassLoaders()
    {
       return delegate.registeredClassLoaders();
    }
 
    /**
-    * @param listener
-    * @param filter
-    * @param handback
-    * @throws ListenerNotFoundException
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
-    */
-   public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
-   {
-      delegate.removeNotificationListener(listener, filter, handback);
-   }
-
-   /**
-    * @param listener
-    * @throws ListenerNotFoundException
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#removeNotificationListener(javax.management.NotificationListener)
-    */
-   public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
-   {
-      delegate.removeNotificationListener(listener);
-   }
-
-   /**
-    * @param notification
-    * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#sendNotification(javax.management.Notification)
-    */
-   public void sendNotification(Notification notification)
-   {
-      delegate.sendNotification(notification);
-   }
-
-   /**
     * @param enableTransformer
-    * @see org.jboss.aop.deployment.AspectManagerService#setEnableLoadtimeWeaving(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setEnableLoadtimeWeaving(boolean)
     */
    public void setEnableLoadtimeWeaving(boolean enableTransformer)
    {
@@ -534,7 +293,7 @@
 
    /**
     * @param enableTransformer
-    * @see org.jboss.aop.deployment.AspectManagerService#setEnableTransformer(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setEnableTransformer(boolean)
     */
    public void setEnableTransformer(boolean enableTransformer)
    {
@@ -543,7 +302,7 @@
 
    /**
     * @param exclude
-    * @see org.jboss.aop.deployment.AspectManagerService#setExclude(java.lang.String)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setExclude(java.lang.String)
     */
    public void setExclude(String exclude)
    {
@@ -552,7 +311,7 @@
 
    /**
     * @param ignore
-    * @see org.jboss.aop.deployment.AspectManagerService#setIgnore(java.lang.String)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setIgnore(java.lang.String)
     */
    public void setIgnore(String ignore)
    {
@@ -561,7 +320,7 @@
 
    /**
     * @param include
-    * @see org.jboss.aop.deployment.AspectManagerService#setInclude(java.lang.String)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setInclude(java.lang.String)
     */
    public void setInclude(String include)
    {
@@ -570,7 +329,7 @@
    
    /**
     * @param include
-    * @see org.jboss.aop.deployment.AspectManagerService#setIncludedInvisibleAnnotations(java.lang.String)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setIncludedInvisibleAnnotations(java.lang.String)
     */
    public void setIncludedInvisibleAnnotations(String iia)
    {
@@ -579,7 +338,7 @@
 
    /**
     * @param instrumentor
-    * @see org.jboss.aop.deployment.AspectManagerService#setInstrumentor(java.lang.String)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setInstrumentor(java.lang.String)
     */
    public void setInstrumentor(String instrumentor)
    {
@@ -588,7 +347,7 @@
 
    /**
     * @param verbose
-    * @see org.jboss.aop.deployment.AspectManagerService#setOptimized(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setOptimized(boolean)
     */
    public void setOptimized(boolean verbose)
    {
@@ -597,7 +356,7 @@
 
    /**
     * @param prune
-    * @see org.jboss.aop.deployment.AspectManagerService#setPrune(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setPrune(boolean)
     */
    public void setPrune(boolean prune)
    {
@@ -606,7 +365,7 @@
 
    /**
     * @param suppressReferenceErrors
-    * @see org.jboss.aop.deployment.AspectManagerService#setSuppressReferenceErrors(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setSuppressReferenceErrors(boolean)
     */
    public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
    {
@@ -615,7 +374,7 @@
 
    /**
     * @param suppressTransformationErrors
-    * @see org.jboss.aop.deployment.AspectManagerService#setSuppressTransformationErrors(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setSuppressTransformationErrors(boolean)
     */
    public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
    {
@@ -624,7 +383,7 @@
 
    /**
     * @param tmpClassesDir
-    * @see org.jboss.aop.deployment.AspectManagerService#setTmpClassesDir(java.io.File)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setTmpClassesDir(java.io.File)
     */
    public void setTmpClassesDir(File tmpClassesDir)
    {
@@ -633,7 +392,7 @@
 
    /**
     * @param verbose
-    * @see org.jboss.aop.deployment.AspectManagerService#setVerbose(boolean)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setVerbose(boolean)
     */
    public void setVerbose(boolean verbose)
    {
@@ -642,7 +401,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#stacks()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#stacks()
     */
    public String stacks()
    {
@@ -651,7 +410,7 @@
 
    public void deployBaseAspects()
    {
-      delegate.baseAop(BASE_ASPECTS_XML);
+      delegate.baseXml(BASE_ASPECTS_XML);
    }
 
    /**
@@ -665,7 +424,7 @@
 
    /**
     * @return
-    * @see org.jboss.aop.deployment.AspectManagerService#getJBossIntegration()
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#getJBossIntegration()
     */
    public JBossIntegration getJbossIntegration()
    {
@@ -674,7 +433,7 @@
 
    /**
     * @param integration
-    * @see org.jboss.aop.deployment.AspectManagerService#setJBossIntegration(org.jboss.asintegration.JBossIntegration)
+    * @see org.jboss.aop.asintegration.core.AspectManagerServiceDelegate#setJBossIntegration(org.jboss.asintegration.JBossIntegration)
     */
    public void setJbossIntegration(JBossIntegration integration)
    {

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJDK5.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJDK5.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJDK5.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -21,7 +21,8 @@
 */ 
 package org.jboss.aop.deployers;
 
-import org.jboss.aop.deployment.AspectManagerServiceJDK5;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegateJDK5;
 
 /**
  * AspectManager service to be used with JDK 5 and the -javaagent:pluggable-instrumentor.jar switch
@@ -34,6 +35,11 @@
    public AspectManagerJDK5(String bootstrapXml)
    {
       super(bootstrapXml);
-      super.delegate = new AspectManagerServiceJDK5(null);
    }
+
+   @Override
+   protected AspectManagerServiceDelegate createDelegate()
+   {
+      return new AspectManagerServiceDelegateJDK5();
+   }
 }

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJMXRegistrar.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -25,7 +25,8 @@
 import javax.management.ObjectName;
 import javax.management.StandardMBean;
 
-import org.jboss.aop.deployment.AspectManagerServiceMBean;
+import org.jboss.aop.deployment.AbstractAspectManagerService;
+import org.jboss.aop.deployment.AbstractAspectManagerServiceMBean;
 import org.jboss.logging.Logger;
 
 /**
@@ -56,7 +57,7 @@
       try
       {
          log.debug("Registering AspectManagerService in JMX under: " + ASPECTMANAGER_OBJECTNAME);
-         server.registerMBean(new StandardMBean(aspectManager.delegate, AspectManagerServiceMBean.class), new ObjectName(ASPECTMANAGER_OBJECTNAME));
+         server.registerMBean(new StandardMBean(new AbstractAspectManagerService(aspectManager.getDelegate()), AbstractAspectManagerServiceMBean.class), new ObjectName(ASPECTMANAGER_OBJECTNAME));
       }
       catch (Exception e)
       {

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJRockit.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJRockit.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AspectManagerJRockit.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -21,7 +21,8 @@
 */ 
 package org.jboss.aop.deployers;
 
-import org.jboss.aop.deployment.AspectManagerService;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegateJRockit;
 
 /**
  * AspectManager service to be used with JRockit and the -Xmanagement:class=org.jboss.aop.hook.JRockitPluggableClassPreProcessor switch
@@ -35,6 +36,11 @@
    public AspectManagerJRockit(String bootstrapXml)
    {
       super(bootstrapXml);
-      super.delegate = new AspectManagerService(null);
    }
+
+   @Override
+   protected AspectManagerServiceDelegate createDelegate()
+   {
+      return new AspectManagerServiceDelegateJRockit();
+   }
 }

Added: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AbstractAspectManagerService.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AbstractAspectManagerService.java	                        (rev 0)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AbstractAspectManagerService.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -0,0 +1,343 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.deployment;
+
+import java.io.File;
+
+import javassist.scopedpool.ScopedClassPoolFactory;
+
+import javax.management.Notification;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectNotificationHandler;
+import org.jboss.aop.ClassLoaderValidation;
+import org.jboss.aop.asintegration.JBossIntegration;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.logging.Logger;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author adrian at jboss.org
+ * @version $Revision: 70855 $
+ */
+public class AbstractAspectManagerService
+        extends ServiceMBeanSupport
+        implements AbstractAspectManagerServiceMBean, AspectNotificationHandler
+{
+
+   Logger log = Logger.getLogger(AbstractAspectManagerService.class);
+   
+   private static final String BASE_XML = "base-aop.xml";
+   
+   //private boolean registerHappensAfterStart;
+   
+   private AspectManagerServiceDelegate delegate;
+   
+   // Static -------------------------------------------------------
+
+   // Constructors -------------------------------------------------
+   public AbstractAspectManagerService()
+   {
+      //Initialise the manager and delegate
+      delegate = createDelegate();
+      delegate.setBaseXml(BASE_XML);
+      delegate.setAspectManager(AspectManager.getTopLevelAspectManager());
+
+      //This constructor shouuld only get called when used in JBoss 4.x.x, not in JBoss 5.
+      //In JBoss 4 we need to maintain this field
+      delegate.setAspectManagerMaintainAdvisorInterceptors(true);
+   }
+
+   public AbstractAspectManagerService(AspectManagerServiceDelegate delegate)
+   {
+      this.delegate = delegate;
+//      this.registerHappensAfterStart = registerHappensAfterStart;
+   }
+   
+   protected AspectManagerServiceDelegate createDelegate()
+   {
+      throw new RuntimeException("Should not use this class directly");
+   }
+
+   // Public -------------------------------------------------------
+
+   /**
+    * Get the integration
+    * 
+    * @return the integration
+    */
+   public JBossIntegration getJBossIntegration()
+   {
+      return delegate.getJBossIntegration();
+   }
+   
+   /**
+    * Set the integration
+    * 
+    * @param integration the integration 
+    */
+   public void setJBossIntegration(JBossIntegration integration)
+   {
+      delegate.setJBossIntegration(integration);
+   }
+
+   protected ScopedClassPoolFactory createFactory() throws Exception
+   {
+      return delegate.createFactory();
+   }
+   
+   protected ClassLoaderValidation createClassLoaderValidation()
+   {
+      return delegate.createClassLoaderValidation();
+   }
+
+   @Override
+   protected void createService()
+           throws Exception
+   {
+      delegate.create();
+      AspectManager.notificationHandler = this;
+   }
+   
+   @Override
+   protected void destroyService() throws Exception
+   {
+      delegate.destroy();
+   }
+
+   @Override
+   protected void startService() throws Exception
+   {
+      delegate.start();
+   }
+
+   @Override
+   protected void stopService() throws Exception
+   {
+      delegate.stop();
+   }
+
+   public void attachClass(String classname)
+   {
+      Notification msg = new Notification("AOP class attached", this, getNextNotificationSequenceNumber());
+      msg.setUserData(classname);
+      sendNotification(msg);
+   }
+
+   public boolean getPrune()
+   {
+      return delegate.getPrune();
+   }
+
+   public void setPrune(boolean prune)
+   {
+      delegate.setPrune(prune);
+   }
+
+   public String getExclude()
+   {
+      return delegate.getExclude();
+   }
+
+   public void setExclude(String exclude)
+   {
+      delegate.setExclude(exclude);
+   }
+
+   public String getInclude()
+   {
+      return delegate.getInclude();
+   }
+
+   public void setInclude(String include)
+   {
+      delegate.setInclude(include);
+   }
+
+   public String getIgnore()
+   {
+      return delegate.getIgnore();
+   }
+
+   public void setIgnore(String ignore)
+   {
+      delegate.setIgnore(ignore);
+   }
+   
+   public String getIncludedInvisibleAnnotations()
+   {
+      return delegate.getIncludedInvisibleAnnotations();
+   }
+   
+   public void setIncludedInvisibleAnnotations(String ia)
+   {
+      delegate.setIncludedInvisibleAnnotations(ia);
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public File getTmpClassesDir()
+   {
+      return delegate.getTmpClassesDir();
+   }
+
+   /**
+    * The temporary directory to which dyn class files are written
+    */
+   public void setTmpClassesDir(File tmpClassesDir)
+   {
+      delegate.setTmpClassesDir(tmpClassesDir);
+   }
+
+   /**
+    * Set the verbosity of aop logging.  It doesn't use log4j
+    */
+   public boolean getVerbose()
+   {
+      return delegate.getVerbose();
+   }
+
+   /**
+    * Set the verbosity of aop logging.
+    */
+   public void setVerbose(boolean verbose)
+   {
+      delegate.setVerbose(verbose);
+   }
+
+   /**
+    * Use aop optimizations.  Optional just in case there is a bug
+    */
+   public boolean getOptimized()
+   {
+      return delegate.getOptimized();
+   }
+
+   /**
+    * Use aop optimizations.  Optional just in case there is a bug
+    */
+   public void setOptimized(boolean verbose)
+   {
+      delegate.setOptimized(verbose);
+   }
+
+   public boolean getSuppressTransformationErrors()
+   {
+      return delegate.getSuppressReferenceErrors();
+   }
+
+   public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
+   {
+      delegate.setSuppressTransformationErrors(suppressTransformationErrors);
+   }
+
+   public boolean getSuppressReferenceErrors()
+   {
+      return delegate.getSuppressReferenceErrors();
+   }
+
+   public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
+   {
+      delegate.setSuppressReferenceErrors(suppressReferenceErrors);
+   }
+
+   public boolean getEnableTransformer()
+   {
+      return delegate.getEnableTransformer();
+   }
+
+   public String interceptorFactories()
+   {
+      return delegate.interceptorFactories();
+   }
+
+   public String aspectDefinitions()
+   {
+      return delegate.aspectDefinitions();
+   }
+
+   public String introductions()
+   {
+      return delegate.introductions();
+   }
+
+   public String stacks()
+   {
+      return delegate.stacks();
+   }
+
+   public String bindings()
+   {
+      return delegate.bindings();
+   }
+
+   public String registeredClassLoaders()
+   {
+      return delegate.registeredClassLoaders();
+   }
+
+   public void setEnableTransformer(boolean enableTransformer)
+   {
+      delegate.setEnableTransformer(enableTransformer);
+   }
+
+   public boolean getEnableLoadtimeWeaving()
+   {
+      return delegate.getEnableLoadtimeWeaving();
+   }
+
+   public void setEnableLoadtimeWeaving(boolean enableTransformer)
+   {
+      delegate.setEnableLoadtimeWeaving(enableTransformer);
+   }
+
+   public String getInstrumentor()
+   {
+      return delegate.getInstrumentor();
+   }
+
+   public void setInstrumentor(String instrumentor)
+   {
+      delegate.setInstrumentor(instrumentor);
+   }
+
+//   @Override
+//   public void postRegister(Boolean done)
+//   {
+//      super.postRegister(done);
+//      if (registerHappensAfterStart)
+//      {
+//         try
+//         {
+//            super.create();
+//            super.start();
+//         }
+//         catch (Exception e)
+//         {
+//            throw new RuntimeException(e);
+//         }
+//      }
+//   }
+   
+}

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerService.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerService.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerService.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -1,8 +1,8 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
+* 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
@@ -18,585 +18,23 @@
 * 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.deployment;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegateJRockit;
 
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-
-import javax.management.Notification;
-import javax.management.ObjectName;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.AspectNotificationHandler;
-import org.jboss.aop.AspectXmlLoader;
-import org.jboss.aop.ClassLoaderValidation;
-import org.jboss.aop.ClassicWeavingStrategy;
-import org.jboss.aop.Deployment;
-import org.jboss.aop.SuperClassesFirstWeavingStrategy;
-import org.jboss.aop.hook.JDK14Transformer;
-import org.jboss.aop.hook.JDK14TransformerManager;
-import org.jboss.aop.instrument.InstrumentorFactory;
-import org.jboss.aop.instrument.TransformerCommon;
-import org.jboss.aop.introduction.InterfaceIntroduction;
-import org.jboss.aop.advice.AdviceBinding;
-import org.jboss.aop.advice.AdviceStack;
-import org.jboss.aop.advice.AspectDefinition;
-import org.jboss.aop.advice.InterceptorFactory;
-import org.jboss.aop.asintegration.JBossIntegration;
-import org.jboss.aop.asintegration.jboss4.JBoss4Integration;
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.server.ServerConstants;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.system.ServiceMBeanSupport;
-import org.jboss.system.server.ServerConfig;
-
 /**
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
+ * AspectManager service meant for use with JRockit or JDK 1.4
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision$
  */
-public class AspectManagerService
-        extends ServiceMBeanSupport
-        implements AspectManagerServiceMBean, AspectNotificationHandler
+public class AspectManagerService extends AbstractAspectManagerService
 {
-
-   Logger log = Logger.getLogger(AspectManagerService.class);
-   
-   static {
-      //pre-load necessary classes so that we avoid NoClassDefFoundErrors on JRockit when using the RepositoryClassloader hook
-      //When AspectManager.translate() is called the first time, these classes have not been loaded yet, and this is what causes
-      //JRockit to get confused
-      @SuppressWarnings("unused")
-      Class<?> clazz = TransformerCommon.class;
-      clazz = SuperClassesFirstWeavingStrategy.class;
-      clazz = ClassicWeavingStrategy.class;
-      clazz = HeirarchicalLoaderRepository3.class;
-   }
-
-   public static final ObjectName DEFAULT_LOADER_REPOSITORY = ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
-
-   // Attributes ---------------------------------------------------
-
-   boolean created = false;
-   protected File tmpClassesDir;
-   protected boolean enableTransformer = false;
-   protected boolean enableLoadtimeWeaving = false;
-   protected boolean suppressTransformationErrors = true;
-   protected boolean suppressReferenceErrors = true;
-   protected String exclude;
-   protected String include;
-   protected String ignore;
-   protected String includedInvisibleAnnotations;
-   private String baseXml = "base-aop.xml";
-   //When running with JBoss 5 registration with MBeanServer happens after the service has been started
-   boolean registerHappensAfterStart;
-   boolean hasBeenStarted;
-   
-   /** The encapsulation of the integration */
-   private JBossIntegration integration;
-
-   // Static -------------------------------------------------------
-
-   // Constructors -------------------------------------------------
-   public AspectManagerService()
+   protected AspectManagerServiceDelegate createDelegate()
    {
-      //This constructor shouuld only get called when used in JBoss 4.x.x, not in JBoss 5.
-      //In JBoss 4 we need tomaintain this field
-      
-      //Initialise the manager
-      @SuppressWarnings("unused")
-      AspectManager manager = AspectManager.instance();
-      AspectManager.maintainAdvisorMethodInterceptors = true;
+      return new AspectManagerServiceDelegateJRockit();
    }
 
-   /**
-    * Ctor called wehen running in JBoss 5. In JBoss 5 we take control of registering this service in JMX ourselves
-    * 
-    * @param baseXml the base xml for aspects
-    */
-   public AspectManagerService(String baseXml)
-   {
-      this.baseXml = baseXml;
-      this.registerHappensAfterStart = true;
-   }
-
-   // Public -------------------------------------------------------
-
-   /**
-    * Get the integration
-    * 
-    * @return the integration
-    */
-   public JBossIntegration getJBossIntegration()
-   {
-      return integration;
-   }
-   
-   /**
-    * Set the integration
-    * 
-    * @param integration the integration 
-    */
-   public void setJBossIntegration(JBossIntegration integration)
-   {
-      this.integration = integration;
-   }
-
-   protected ScopedClassPoolFactory createFactory() throws Exception
-   {
-      return initIntegration().createScopedClassPoolFactory(tmpClassesDir);
-   }
-   
-   protected ClassLoaderValidation createClassLoaderValidation()
-   {
-      return initIntegration();
-   }
-
-   /**
-    * Initialize the integration if not alreday done so
-    * 
-    * @return the integration
-    */
-   protected JBossIntegration initIntegration()
-   {
-      // Default to old JBoss4 integration when not configured
-      if (integration == null)
-         integration = new JBoss4Integration();
-      return integration;
-   }
-   
-   protected void createService()
-           throws Exception
-   {
-      initIntegration();
-      if (hasBeenStarted)
-      {
-         return;
-      }
-      // Set a default tmp classes dir to the jboss tmp dir/aopclasses
-      if (tmpClassesDir == null)
-      {
-         String jbossTmpDir = System.getProperty(ServerConfig.SERVER_TEMP_DIR);
-         if (jbossTmpDir == null)
-            jbossTmpDir = System.getProperty("java.io.tmpdir");
-         tmpClassesDir = new File(jbossTmpDir, "aopdynclasses");
-      }
-      // Validate the the tmp dir exists
-      if (tmpClassesDir.exists() == false && tmpClassesDir.mkdirs() == false)
-         throw new FileNotFoundException("Failed to create tmpClassesDir: " + tmpClassesDir.getAbsolutePath());
-      AspectManager.setClassPoolFactory(createFactory());
-
-      AspectManager.classLoaderValidator = createClassLoaderValidation();
-      // Add the tmp classes dir to our UCL classpath
-
-      Deployment.searchClasspath = false; // turn off dynamic finding of DDs
-      AspectManager.suppressTransformationErrors = suppressTransformationErrors;
-      if (enableTransformer && enableLoadtimeWeaving) throw new RuntimeException("Cannot set both EnableTransformer and EnableLoadtimeWeaving");
-      if (enableTransformer)
-      {
-         attachDeprecatedTranslator();
-      }
-      if (enableLoadtimeWeaving)
-      {
-         attachTranslator();
-      }
-      created = true;
-      AspectManager.notificationHandler = this;
-
-      AspectManager.setClassLoaderScopingPolicy(integration.createAOPClassLoaderScopingPolicy());
-
-      baseAop();
-   }
-
-   protected void baseAop()
-   {
-      if (baseXml == null)
-      {
-         return;
-      }
-      baseAop(baseXml);
-   }
-
-   public void baseAop(String xml)
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      URL base = cl.getResource(xml);
-      try
-      {
-         if (base != null)
-         {
-            AspectXmlLoader.deployXML(base);
-         }
-         else
-         {
-            log.warn("Could not find " + xml + " file in the resources of " + cl);
-         }
-      }
-      catch (Exception e)
-      {
-         System.out.println("Error loading " + xml + " file" + e);
-      }
-   }
-   
-   protected void attachDeprecatedTranslator()
-   {
-      log.warn("EnableTransformer has been deprecated, please use EnableLoadtimeWeaving.  See docs for more details");
-      initIntegration().attachDeprecatedTranslator();
-   }
-
-   protected void detachDeprecatedTranslator()
-   {
-      initIntegration().detachDeprecatedTranslator();
-   }
-
-   protected void attachTranslator()
-   {
-      JDK14TransformerManager.transformer = new JDK14Transformer()
-      {
-         public byte[] transform(ClassLoader loader, String classname, byte[] classBytes)
-         {
-            try
-            {
-               //Make sure that we use the correct classloader, in order to get the correct domain if it is a scoped loader
-               return AspectManager.instance(loader).translate(classname, loader, classBytes);
-            }
-            catch (Exception e)
-            {
-               throw new RuntimeException("Error converting " + classname + " on " + loader, e);
-            }
-         }
-      };
-   }
-
-   protected void detachTranslator()
-   {
-      JDK14TransformerManager.transformer = null;
-   }
-
-   public void attachClass(String classname)
-   {
-      Notification msg = new Notification("AOP class attached", this, getNextNotificationSequenceNumber());
-      msg.setUserData(classname);
-      sendNotification(msg);
-   }
-
-   public boolean getPrune()
-   {
-      return AspectManager.getPrune();
-   }
-
-   public void setPrune(boolean prune)
-   {
-      AspectManager.setPrune(prune);
-   }
-
-   public String getExclude()
-   {
-      return exclude;
-   }
-
-   public void setExclude(String exclude)
-   {
-      this.exclude = exclude;
-      ArrayList<String> list = new ArrayList<String>();
-      if (exclude != null)
-      {
-         StringTokenizer tokenizer = new StringTokenizer(exclude, ",");
-         while (tokenizer.hasMoreTokens())
-         {
-            list.add(tokenizer.nextToken().trim());
-         }
-      }
-      AspectManager.instance().setExclude(list);
-   }
-
-   public String getInclude()
-   {
-      return include;
-   }
-
-   public void setInclude(String include)
-   {
-      this.include = include;
-      ArrayList<String> list = new ArrayList<String>();
-      if (include != null)
-      {
-         StringTokenizer tokenizer = new StringTokenizer(include, ",");
-         while (tokenizer.hasMoreTokens())
-         {
-            list.add(tokenizer.nextToken().trim());
-         }
-      }
-      AspectManager.instance().setInclude(list);
-   }
-
-   public String getIgnore()
-   {
-      return ignore;
-   }
-
-   public void setIgnore(String ignore)
-   {
-      this.ignore = ignore;
-      ArrayList<String> list = new ArrayList<String>();
-      if (ignore != null)
-      {
-         StringTokenizer tokenizer = new StringTokenizer(ignore, ",");
-         while (tokenizer.hasMoreTokens())
-         {
-            list.add(tokenizer.nextToken().trim());
-         }
-      }
-      AspectManager.instance().setIgnore(list);
-   }
-   
-   public String getIncludedInvisibleAnnotations()
-   {
-      return includedInvisibleAnnotations;
-   }
-   
-   public void setIncludedInvisibleAnnotations(String ia)
-   {
-      List<String> iiaList = new ArrayList<String>();
-      if(ia != null)
-      {
-         for(String inc : ia.split(","))
-           iiaList.add(inc.trim());
-      }
-      AspectManager.instance().setIncludedInvisibleAnnotations(iiaList);
-   }
-
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   public File getTmpClassesDir()
-   {
-      return tmpClassesDir;
-   }
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   public void setTmpClassesDir(File tmpClassesDir)
-   {
-      this.tmpClassesDir = tmpClassesDir;
-   }
-
-   /**
-    * Set the verbosity of aop logging.  It doesn't use log4j
-    */
-   public boolean getVerbose()
-   {
-      return AspectManager.verbose;
-   }
-
-   /**
-    * Set the verbosity of aop logging.  It doesn't use log4j
-    */
-   public void setVerbose(boolean verbose)
-   {
-      AspectManager.verbose = verbose;
-   }
-
-   /**
-    * Use aop optimizations.  Optional just in case there is a bug
-    */
-   public boolean getOptimized()
-   {
-      return AspectManager.optimize;
-   }
-
-   /**
-    * Use aop optimizations.  Optional just in case there is a bug
-    */
-   public void setOptimized(boolean verbose)
-   {
-      AspectManager.optimize = verbose;
-   }
-
-   public boolean getSuppressTransformationErrors()
-   {
-      return suppressTransformationErrors;
-   }
-
-   public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
-   {
-      this.suppressTransformationErrors = suppressTransformationErrors;
-      AspectManager.suppressTransformationErrors = suppressTransformationErrors;
-   }
-
-   public boolean getSuppressReferenceErrors()
-   {
-      return suppressReferenceErrors;
-   }
-
-   public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
-   {
-      this.suppressReferenceErrors = suppressReferenceErrors;
-      AspectManager.suppressReferenceErrors = suppressReferenceErrors;
-   }
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   public boolean getEnableTransformer()
-   {
-      return enableTransformer;
-   }
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   public String interceptorFactories()
-   {
-      Map<String, InterceptorFactory> factories = AspectManager.instance().getInterceptorFactories();
-      StringBuffer buffer = new StringBuffer("");
-      for (String name : factories.keySet())
-      {
-         buffer.append(name + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   public String aspectDefinitions()
-   {
-      Map<String, AspectDefinition> factories = AspectManager.instance().getAspectDefinitions();
-      StringBuffer buffer = new StringBuffer("");
-      for (String name : factories.keySet())
-      {
-         buffer.append(name + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   public String introductions()
-   {
-      Map<String, InterfaceIntroduction> factories = AspectManager.instance().getInterfaceIntroductions();
-      StringBuffer buffer = new StringBuffer("");
-      for (String name : factories.keySet())
-      {
-         buffer.append(name + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   public String stacks()
-   {
-      Map<String, AdviceStack> factories = AspectManager.instance().getInterceptorStacks();
-      StringBuffer buffer = new StringBuffer("");
-      for (String name : factories.keySet())
-      {
-         buffer.append(name + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   public String bindings()
-   {
-      Map<String, AdviceBinding> factories = AspectManager.instance().getBindings();
-      StringBuffer buffer = new StringBuffer("");
-      for (String name : factories.keySet())
-      {
-         buffer.append(name + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   public String registeredClassLoaders()
-   {
-      Map<ClassLoader, ClassPool> loaders = AspectManager.getRegisteredCLs();
-      StringBuffer buffer = new StringBuffer("");
-      for (ClassLoader loader : loaders.keySet())
-      {
-         buffer.append(loader + "<br>");
-      }
-      return buffer.toString();
-   }
-
-   public void setEnableTransformer(boolean enableTransformer)
-   {
-      // Testsuite uses enableTransformer, we may be testing new loadtime features though.
-
-      if (enableLoadtimeWeaving)
-      {
-         log.warn("enabledLoadtimeWeaving alread set");
-         return;
-      }
-      if (this.enableTransformer == enableTransformer) return;
-      if (this.getState() == STARTED)
-      {
-         if (enableTransformer)
-         {
-            attachDeprecatedTranslator();
-         }
-         else
-         {
-            detachDeprecatedTranslator();
-         }
-      }
-      this.enableTransformer = enableTransformer;
-   }
-
-   public boolean getEnableLoadtimeWeaving()
-   {
-      return enableLoadtimeWeaving;
-   }
-
-   public void setEnableLoadtimeWeaving(boolean enableTransformer)
-   {
-      if (this.enableLoadtimeWeaving == enableTransformer) return;
-      if (this.getState() == STARTED)
-      {
-         if (enableTransformer)
-         {
-            attachTranslator();
-         }
-         else
-         {
-            detachTranslator();
-         }
-      }
-      this.enableLoadtimeWeaving = enableTransformer;
-   }
-
-   public String getInstrumentor()
-   {
-      return InstrumentorFactory.getInstrumentorName();
-   }
-
-   public void setInstrumentor(String instrumentor)
-   {
-      InstrumentorFactory.initialise(instrumentor);
-   }
-
-   @Override
-   public void postRegister(Boolean done)
-   {
-      super.postRegister(done);
-      if (registerHappensAfterStart)
-      {
-         try
-         {
-            super.start();
-         }
-         catch (Exception e)
-         {
-            throw new RuntimeException(e);
-         }
-      }
-   }
 }

Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceJDK5.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceJDK5.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceJDK5.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -21,34 +21,21 @@
   */
 package org.jboss.aop.deployment;
 
-import org.jboss.aop.standalone.AOPTransformer;
-import org.jboss.aop.standalone.PluggableInstrumentor;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.aop.asintegration.core.AspectManagerServiceDelegateJDK5;
 
 /**
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision: 57692 $
  */
-public class AspectManagerServiceJDK5 extends AspectManagerService
+public class AspectManagerServiceJDK5 extends AbstractAspectManagerService
 {
    public AspectManagerServiceJDK5()
    {
    }
 
-   public AspectManagerServiceJDK5(String baseXml)
+   protected AspectManagerServiceDelegate createDelegate()
    {
-      super(baseXml);
+      return new AspectManagerServiceDelegateJDK5();
    }
-   
-   protected AOPTransformer transformer = new AOPTransformer();
-
-   protected void attachTranslator()
-   {
-      PluggableInstrumentor.getInstrumentor().addTransformer(transformer);
-   }
-
-   protected void detachTranslator()
-   {
-      PluggableInstrumentor.getInstrumentor().removeTransformer(transformer);
-   }
-
 }

Deleted: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceMBean.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceMBean.java	2008-09-18 08:36:07 UTC (rev 78669)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployment/AspectManagerServiceMBean.java	2008-09-18 11:15:54 UTC (rev 78670)
@@ -1,131 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.aop.deployment;
-
-/**
- * MBean interface.
- */
-public interface AspectManagerServiceMBean extends org.jboss.system.ServiceMBean {
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.io.File getTmpClassesDir() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  void setTmpClassesDir(java.io.File tmpClassesDir) ;
-
-   /**
-    * Set the verbosity of aop logging. It doesn't use log4j
-    */
-  boolean getVerbose() ;
-
-   /**
-    * Set the verbosity of aop logging. It doesn't use log4j
-    */
-  void setVerbose(boolean verbose) ;
-
-   /**
-    * Use aop optimizations. Optional just in case there is a bug
-    */
-  boolean getOptimized() ;
-
-   /**
-    * Use aop optimizations. Optional just in case there is a bug
-    */
-  void setOptimized(boolean verbose) ;
-
-  boolean getSuppressTransformationErrors() ;
-
-  void setSuppressTransformationErrors(boolean suppressTransformationErrors) ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  boolean getEnableTransformer() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  boolean getEnableLoadtimeWeaving() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.lang.String interceptorFactories() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.lang.String aspectDefinitions() ;
-
-  java.lang.String introductions() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.lang.String stacks() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.lang.String bindings() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-  java.lang.String registeredClassLoaders() ;
-
-   /**
-    * The temporary directory to which dyn class files are written
-    */
-   void setEnableTransformer(boolean enableTransformer) ;
-   void setEnableLoadtimeWeaving(boolean enableTransformer) ;
-
-   String getExclude();
-
-   void setExclude(String exclude);
-
-   String getInclude();
-
-   void setInclude(String include);
-   
-   String getIncludedInvisibleAnnotations();
-   
-   void setIncludedInvisibleAnnotations(String ia);
-
-   boolean getPrune();
-
-   void setPrune(boolean prune);
-   
-   String getIgnore();
-
-   void setIgnore(String ignore);
-   
-   String getInstrumentor();
-   
-   void setInstrumentor(String instrumentor);
-   
-   
-}




More information about the jboss-cvs-commits mailing list