[jboss-cvs] JBossAS SVN: r97902 - in projects/aop/branches/classpool_JBAOP-742: asintegration-jmx and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 16 13:12:50 EST 2009
Author: flavia.rainone at jboss.com
Date: 2009-12-16 13:12:49 -0500 (Wed, 16 Dec 2009)
New Revision: 97902
Removed:
projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java
projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerServiceMBean.java
Modified:
projects/aop/branches/classpool_JBAOP-742/asintegration-core/pom.xml
projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml
projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectManagerService.java
projects/aop/branches/classpool_JBAOP-742/asintegration-mc/pom.xml
Log:
[JBAOP-754] Ported changes from Branch 2_1.
Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-core/pom.xml
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-core/pom.xml 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-core/pom.xml 2009-12-16 18:12:49 UTC (rev 97902)
@@ -110,14 +110,14 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-main</artifactId>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
@@ -125,12 +125,12 @@
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-test</artifactId>
- <scope>compile</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>compile</scope>
+ <scope>test</scope>
</dependency>
</dependencies>
Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/pom.xml 2009-12-16 18:12:49 UTC (rev 97902)
@@ -148,6 +148,16 @@
<groupId>org.jboss.classpool</groupId>
<artifactId>jboss-classpool-ucl</artifactId>
</dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java 2009-12-16 18:12:49 UTC (rev 97902)
@@ -1,335 +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;
-
-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 -------------------------------------------------
- /**
- * This constructor shouuld only get called when used in JBoss 4.x.x, not in JBoss 5.
- */
- 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);
-
- //Default
- delegate.setUseBaseXml(true);
- }
-
- /**
- * This constructor should only get called when used in JBoss 5 by JBossAspectLibrary.
- */
- public AbstractAspectManagerService(AspectManagerServiceDelegate delegate)
- {
- this.delegate = delegate;
- }
-
-
- protected AspectManagerServiceDelegate createDelegate()
- {
- throw new RuntimeException("Should not use this class directly");
- }
-
- // Public -------------------------------------------------------
-
- public void setJBossIntegrationWrapper(JBossIntegrationWrapperMBean integration)
- {
- JBossIntegration intgr = integration != null ? integration.getIntegration() : null;
- delegate.setJBossIntegration(intgr);
- }
-
- 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 pointcuts()
- {
- return delegate.pointcuts();
- }
-
- 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);
- }
-
- public boolean getUseBaseXml()
- {
- return delegate.getUseBaseXml();
- }
-
- public synchronized void setUseBaseXml(boolean useBaseXml)
- {
- delegate.setUseBaseXml(useBaseXml);
- }
-
-}
Deleted: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerServiceMBean.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerServiceMBean.java 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerServiceMBean.java 2009-12-16 18:12:49 UTC (rev 97902)
@@ -1,146 +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 AbstractAspectManagerServiceMBean 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() ;
-
- java.lang.String pointcuts();
-
- /**
- * 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);
-
- /**
- * Whether or not tu use base-aop.xml
- */
- boolean getUseBaseXml();
-
- /**
- * Whether or not tu use base-aop.xml
- */
- void setUseBaseXml(boolean useBaseXml);
-
- /**
- * Sets the MBean containing the JBossIntegration implementation
- */
- void setJBossIntegrationWrapper(JBossIntegrationWrapperMBean integration);
-}
Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectManagerService.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectManagerService.java 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectManagerService.java 2009-12-16 18:12:49 UTC (rev 97902)
@@ -21,8 +21,18 @@
*/
package org.jboss.aop.deployment;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.management.JMException;
+import javax.management.ListenerNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
import org.jboss.aop.asintegration.core.AspectManagerServiceDelegateJRockit;
+import org.jboss.mx.notification.ListenerRegistration;
+import org.jboss.mx.notification.ListenerRegistry;
/**
* AspectManager service meant for use with JRockit or JDK 1.4
@@ -32,9 +42,88 @@
*/
public class AspectManagerService extends AbstractAspectManagerService
{
+ /** Sequence number for jmx notifications we send out */
+ private AtomicLong sequenceNumber = new AtomicLong();
+
+ /** The registered listeners */
+ private ListenerRegistry registry = new ListenerRegistry();
+
+
protected AspectManagerServiceDelegate createDelegate()
{
return new AspectManagerServiceDelegateJRockit();
}
+ public void attachClass(String classname)
+ {
+ Notification msg = new Notification("AOP class attached", this, sequenceNumber.incrementAndGet());
+ msg.setUserData(classname);
+ sendNotification(msg);
+ }
+
+ public void addNotificationListener(NotificationListener listener,
+ NotificationFilter filter,
+ Object handback)
+ {
+ try
+ {
+ registry.add(listener, filter, handback);
+ }
+ catch (JMException e)
+ {
+ // This shouldn't happen?
+ throw new RuntimeException(e.toString());
+ }
+ }
+
+ public void removeNotificationListener(NotificationListener listener)
+ throws ListenerNotFoundException
+ {
+ registry.remove(listener);
+ }
+
+ public void removeNotificationListener(NotificationListener listener,
+ NotificationFilter filter,
+ Object handback)
+ throws ListenerNotFoundException
+ {
+ registry.remove(listener, filter, handback);
+ }
+
+
+ public void sendNotification(Notification notification)
+ {
+ ListenerRegistry.ListenerRegistrationIterator iterator = registry.iterator();
+ while (iterator.hasNext())
+ {
+ ListenerRegistration registration = iterator.nextRegistration();
+ NotificationFilter filter = registration.getFilter();
+ if (filter == null)
+ handleNotification(registration.getListener(), notification, registration.getHandback());
+ else if (filter.isNotificationEnabled(notification))
+ handleNotification(registration.getListener(), notification, registration.getHandback());
+ }
+ }
+
+
+ /**
+ * Handle the notification, the default implementation is to synchronously invoke the listener.
+ *
+ * @param listener the listener to notify
+ * @param notification the notification
+ * @param handback the handback object
+ */
+ public void handleNotification(NotificationListener listener,
+ Notification notification,
+ Object handback)
+ {
+ try
+ {
+ listener.handleNotification(notification, handback);
+ }
+ catch (Throwable ignored)
+ {
+ log.debug("Ignored unhandled throwable from listener", ignored);
+ }
+ }
}
Modified: projects/aop/branches/classpool_JBAOP-742/asintegration-mc/pom.xml
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/asintegration-mc/pom.xml 2009-12-16 17:14:55 UTC (rev 97901)
+++ projects/aop/branches/classpool_JBAOP-742/asintegration-mc/pom.xml 2009-12-16 18:12:49 UTC (rev 97902)
@@ -169,7 +169,11 @@
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloader</artifactId>
</dependency>
- <dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.classpool</groupId>
<artifactId>jboss-classpool-jbosscl</artifactId>
</dependency>
More information about the jboss-cvs-commits
mailing list