[jboss-cvs] JBossAS SVN: r57536 - in trunk: . aspects aspects/src/jdk15/org/jboss/aop aspects/src/jdk15/org/jboss/aop/deployers aspects/src/main/org/jboss/aop/deployment aspects/src/resources/META-INF build connector testsuite/imports/sections testsuite/src/jdk15/org/jboss/test/aop testsuite/src/jdk15/org/jboss/test/aop/deployers testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations testsuite/src/jdk15/org/jboss/test/aop/deployers/xml testsuite/src/jdk15/org/jboss/test/aop/test testsuite/src/resources/aop testsuite/src/resources/aop/deployers testsuite/src/resources/aop/deployers/META-INF testsuite/src/resources/aop/deployers/xml testsuite/src/resources/aop/deployers/xml/META-INF
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 10 11:17:55 EDT 2006
Author: kabir.khan at jboss.com
Date: 2006-10-10 11:17:43 -0400 (Tue, 10 Oct 2006)
New Revision: 57536
Added:
trunk/aspects/src/jdk15/org/jboss/aop/deployers/
trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectDeployer.java
trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectManager.java
trunk/aspects/src/resources/META-INF/aspect-deployers-beans.xml
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitor.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitorMBean.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations/
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations/POJO.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/POJO.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeAspect.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeInterceptor.java
trunk/testsuite/src/jdk15/org/jboss/test/aop/test/
trunk/testsuite/src/jdk15/org/jboss/test/aop/test/DeployersInitialTestCase.java
trunk/testsuite/src/resources/aop/deployers/
trunk/testsuite/src/resources/aop/deployers/META-INF/
trunk/testsuite/src/resources/aop/deployers/META-INF/jboss-service.xml
trunk/testsuite/src/resources/aop/deployers/xml/
trunk/testsuite/src/resources/aop/deployers/xml/META-INF/
trunk/testsuite/src/resources/aop/deployers/xml/META-INF/jboss-aop.xml
Modified:
trunk/
trunk/aspects/.classpath
trunk/aspects/build.xml
trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java
trunk/aspects/src/resources/META-INF/jboss-service.xml
trunk/build/build-distr.xml
trunk/connector/.classpath
trunk/testsuite/imports/sections/aop.xml
Log:
Create a basic AspectDeployer using the new deployers architecture - it can currently only deploy -aop.xml files.
For now, package the aspect deployer stuff in the lib/ folder with the deployer in the deployers/ folder.
Add fix to load up base-aop.xml from the conf/ folder
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
+ .metadata
Modified: trunk/aspects/.classpath
===================================================================
--- trunk/aspects/.classpath 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/.classpath 2006-10-10 15:17:43 UTC (rev 57536)
@@ -30,9 +30,10 @@
<classpathentry kind="lib" path="/thirdparty/jboss/security/lib/jbosssx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/security-spi/lib/jboss-security-spi.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
+ <classpathentry sourcepath="C:/cygwin/home/Kabir/sourcecontrol/microcontainer/deployers/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/pluggable-instrumentor.jar"/>
+ <classpathentry sourcepath="C:/cygwin/home/Kabir/sourcecontrol/microcontainer/container/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/aspects/build.xml
===================================================================
--- trunk/aspects/build.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/build.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -419,11 +419,12 @@
</jar>
<mkdir dir="${build.meta.inf}"/>
- <copy file="${source.resources}/META-INF/jboss-service.xml" todir="${build.meta.inf}" filtering="true">
+ <!--copy file="${source.resources}/META-INF/jboss-service.xml" todir="${build.meta.inf}" filtering="true">
<filterset>
<filter token="SERVICE_NAME" value="org.jboss.aop.deployment.AspectManagerServiceJDK5"/>
</filterset>
- </copy>
+ </copy-->
+ <copy file="${source.resources}/META-INF/aspect-deployers-beans.xml" todir="${build.meta.inf}"/>
<jar destfile="${build.lib}/jboss-aop-jdk50.deployer" manifest="${build.etc}/default.mf"
update="${jar.update}" index="${jar.index}">
<fileset file="${build.lib}/jboss-aspect-library-jdk50.jar"/>
@@ -432,7 +433,7 @@
<fileset file="${javassist.lib}/javassist.jar"/>
<fileset file="${trove.lib}/trove.jar"/>
<fileset dir="${module.output}">
- <include name="META-INF/jboss-service.xml"/>
+ <include name="META-INF/aspect-deployers-beans.xml"/>
</fileset>
</jar>
<delete dir="${build.meta.inf}"/>
Added: trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectDeployer.java
===================================================================
--- trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectDeployer.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectDeployer.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,134 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, Red Hat Middleware LLC., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.aop.deployers;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.logging.Logger;
+import org.w3c.dom.Document;
+
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * Deployer for Aspects
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ */
+public class AspectDeployer extends AbstractSimpleDeployer
+{
+ private static final Logger log = Logger.getLogger(AspectDeployer.class);
+ private static final String AOP_JAR_SUFFIX = ".aop";
+
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+// System.out.println("-------> ASPECT DEPLOYER!!!!!!!!!!!!!!!" + unit.getName());
+ List<VirtualFile> files = unit.getMetaDataFiles(null, "-aop.xml");//WILL THIS FIND THINGS LIKE jboss-aop.xml files in the root of a sar?
+
+ for (VirtualFile vf : files)
+ {
+// System.out.println("-------> FOUND VIRTUAL FILE " + vf);
+ try
+ {
+ log.info("************************************** deploying: " + vf.toURL());
+ InputStream is = vf.openStream();
+ try
+ {
+ Document doc = AspectXmlLoader.loadDocument(is);
+ AspectXmlLoader loader = new AspectXmlLoader();
+ loader.setManager(AspectManager.instance());
+ loader.deployXML(doc, vf.toURL(), unit.getClassLoader());
+
+
+
+ /* TODO need some way of handling annotations
+ if (!di.isXML)
+ {
+ Iterator it = ArchiveBrowser.getBrowser(di.localUrl, new ClassFileFilter());
+ AspectAnnotationLoader loader = new AspectAnnotationLoader(AspectManager.instance());
+ loader.deployInputStreamIterator(it);
+ }
+
+ AspectXmlLoader.deployXML(docURL, scl);
+ Notification msg = new Notification("AOP Deploy", this, getNextNotificationSequenceNumber());
+ sendNotification(msg);
+ */
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException(e);
+ }
+ }
+ }
+
+ public void undeploy(DeploymentUnit unit)
+ {
+ List<VirtualFile> files = unit.getMetaDataFiles(null, "-aop.xml");
+ for (VirtualFile vf : files)
+ {
+ try
+ {
+ log.info("************************************** undeploying: " + vf.toURL());
+ InputStream is = vf.openStream();
+ try
+ {
+ Document doc = AspectXmlLoader.loadDocument(is);
+ AspectXmlLoader loader = new AspectXmlLoader();
+ loader.setManager(AspectManager.instance());
+ loader.undeployXML(doc, vf.toURL());
+ /* TODO need some way of handling annotations
+ if (!di.isXML)
+ {
+ Iterator it = ArchiveBrowser.getBrowser(di.localUrl, new ClassFileFilter());
+ AspectAnnotationLoader loader = new AspectAnnotationLoader(AspectManager.instance());
+ loader.undeployInputStreamIterator(it);
+ }
+
+ Notification msg = new Notification("AOP Undeploy", this, getNextNotificationSequenceNumber());
+ sendNotification(msg);
+ */
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+}
Added: trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectManager.java
===================================================================
--- trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectManager.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/src/jdk15/org/jboss/aop/deployers/AspectManager.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,618 @@
+/*
+* 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.deployers;
+
+import java.io.File;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.JMException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.NotCompliantMBeanException;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
+import org.jboss.aop.deployment.AspectManagerServiceJDK5;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AspectManager
+{
+ AspectManagerServiceJDK5 delegate = new AspectManagerServiceJDK5();
+ MBeanServer server;
+
+ public void setMbeanServer(MBeanServer server)
+ {
+ if (server != null)
+ {
+ try
+ {
+ server.registerMBean(delegate, new ObjectName("jboss.aop:service=AspectManager"));
+ }
+ catch (Exception e)
+ {
+ // AutoGenerated
+ throw new RuntimeException("Problem registering jboss.aop:service=AspectManager with JMXServer", e);
+ }
+ }
+ else
+ {
+ if (this.server == null)
+ {
+ try
+ {
+ server.unregisterMBean(new ObjectName("jboss.aop:service=AspectManager"));
+ }
+ catch (Exception e)
+ {
+ // AutoGenerated
+ throw new RuntimeException("Problem unregistering jboss.aop:service=AspectManager with JMXServer", e);
+ }
+ }
+ }
+ this.server = server;
+ }
+
+ public MBeanServer getMbeanServer()
+ {
+ return server;
+ }
+
+ /**
+ * @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)
+ {
+ delegate.addNotificationListener(listener, filter, handback);
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#aspectDefinitions()
+ */
+ public String aspectDefinitions()
+ {
+ return delegate.aspectDefinitions();
+ }
+
+ /**
+ * @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()
+ */
+ public String bindings()
+ {
+ return delegate.bindings();
+ }
+
+ /**
+ * @throws Exception
+ * @see org.jboss.system.ServiceMBeanSupport#create()
+ */
+ public void create() throws Exception
+ {
+ delegate.create();
+ }
+
+ /**
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#destroy()
+ */
+ public void destroy()
+ {
+ delegate.destroy();
+ }
+
+ /**
+ * @param obj
+ * @return
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return delegate.equals(obj);
+ }
+
+ /**
+ * @return
+ * @throws JMException
+ * @see org.jboss.system.ServiceMBeanSupport#getDeploymentInfo()
+ */
+ public DeploymentInfo getDeploymentInfo() throws JMException
+ {
+ return delegate.getDeploymentInfo();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getEnableLoadtimeWeaving()
+ */
+ public boolean getEnableLoadtimeWeaving()
+ {
+ return delegate.getEnableLoadtimeWeaving();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getEnableTransformer()
+ */
+ public boolean getEnableTransformer()
+ {
+ return delegate.getEnableTransformer();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getExclude()
+ */
+ public String getExclude()
+ {
+ return delegate.getExclude();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getIgnore()
+ */
+ public String getIgnore()
+ {
+ return delegate.getIgnore();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getInclude()
+ */
+ public String getInclude()
+ {
+ return delegate.getInclude();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getInstrumentor()
+ */
+ public String getInstrumentor()
+ {
+ return delegate.getInstrumentor();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.system.ServiceMBeanSupport#getLog()
+ */
+ public Logger getLog()
+ {
+ return delegate.getLog();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.system.ServiceMBeanSupport#getName()
+ */
+ 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();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getPrune()
+ */
+ public boolean getPrune()
+ {
+ return delegate.getPrune();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.system.ServiceMBeanSupport#getServer()
+ */
+ 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();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getSuppressTransformationErrors()
+ */
+ public boolean getSuppressTransformationErrors()
+ {
+ return delegate.getSuppressTransformationErrors();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getTmpClassesDir()
+ */
+ public File getTmpClassesDir()
+ {
+ return delegate.getTmpClassesDir();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#getVerbose()
+ */
+ public boolean getVerbose()
+ {
+ return delegate.getVerbose();
+ }
+
+ /**
+ * @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()
+ */
+ public int hashCode()
+ {
+ return delegate.hashCode();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#interceptorFactories()
+ */
+ public String interceptorFactories()
+ {
+ return delegate.interceptorFactories();
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#introductions()
+ */
+ public String introductions()
+ {
+ return delegate.introductions();
+ }
+
+ /**
+ * @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()
+ */
+ 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)
+ */
+ public void setEnableLoadtimeWeaving(boolean enableTransformer)
+ {
+ delegate.setEnableLoadtimeWeaving(enableTransformer);
+ }
+
+ /**
+ * @param enableTransformer
+ * @see org.jboss.aop.deployment.AspectManagerService#setEnableTransformer(boolean)
+ */
+ public void setEnableTransformer(boolean enableTransformer)
+ {
+ delegate.setEnableTransformer(enableTransformer);
+ }
+
+ /**
+ * @param exclude
+ * @see org.jboss.aop.deployment.AspectManagerService#setExclude(java.lang.String)
+ */
+ public void setExclude(String exclude)
+ {
+ delegate.setExclude(exclude);
+ }
+
+ /**
+ * @param ignore
+ * @see org.jboss.aop.deployment.AspectManagerService#setIgnore(java.lang.String)
+ */
+ public void setIgnore(String ignore)
+ {
+ delegate.setIgnore(ignore);
+ }
+
+ /**
+ * @param include
+ * @see org.jboss.aop.deployment.AspectManagerService#setInclude(java.lang.String)
+ */
+ public void setInclude(String include)
+ {
+ delegate.setInclude(include);
+ }
+
+ /**
+ * @param instrumentor
+ * @see org.jboss.aop.deployment.AspectManagerService#setInstrumentor(java.lang.String)
+ */
+ public void setInstrumentor(String instrumentor)
+ {
+ delegate.setInstrumentor(instrumentor);
+ }
+
+ /**
+ * @param verbose
+ * @see org.jboss.aop.deployment.AspectManagerService#setOptimized(boolean)
+ */
+ public void setOptimized(boolean verbose)
+ {
+ delegate.setOptimized(verbose);
+ }
+
+ /**
+ * @param prune
+ * @see org.jboss.aop.deployment.AspectManagerService#setPrune(boolean)
+ */
+ public void setPrune(boolean prune)
+ {
+ delegate.setPrune(prune);
+ }
+
+ /**
+ * @param suppressReferenceErrors
+ * @see org.jboss.aop.deployment.AspectManagerService#setSuppressReferenceErrors(boolean)
+ */
+ public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
+ {
+ delegate.setSuppressReferenceErrors(suppressReferenceErrors);
+ }
+
+ /**
+ * @param suppressTransformationErrors
+ * @see org.jboss.aop.deployment.AspectManagerService#setSuppressTransformationErrors(boolean)
+ */
+ public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
+ {
+ delegate.setSuppressTransformationErrors(suppressTransformationErrors);
+ }
+
+ /**
+ * @param tmpClassesDir
+ * @see org.jboss.aop.deployment.AspectManagerService#setTmpClassesDir(java.io.File)
+ */
+ public void setTmpClassesDir(File tmpClassesDir)
+ {
+ delegate.setTmpClassesDir(tmpClassesDir);
+ }
+
+ /**
+ * @param verbose
+ * @see org.jboss.aop.deployment.AspectManagerService#setVerbose(boolean)
+ */
+ public void setVerbose(boolean verbose)
+ {
+ delegate.setVerbose(verbose);
+ }
+
+ /**
+ * @return
+ * @see org.jboss.aop.deployment.AspectManagerService#stacks()
+ */
+ public String stacks()
+ {
+ return delegate.stacks();
+ }
+
+ /**
+ * @throws Exception
+ * @see org.jboss.system.ServiceMBeanSupport#start()
+ */
+ public void start() throws Exception
+ {
+ delegate.start();
+ }
+
+ /**
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#stop()
+ */
+ public void stop()
+ {
+ delegate.stop();
+ }
+
+ /**
+ * @return
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return delegate.toString();
+ }
+
+
+}
Modified: trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/src/main/org/jboss/aop/deployment/AspectManagerService.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -134,16 +134,23 @@
protected void baseAop()
{
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL base = cl.getResource("base-aop.xml");
try
{
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- URL base = cl.getResource("base-aop.xml");
- AspectXmlLoader.deployXML(base);
+ if (base != null)
+ {
+ AspectXmlLoader.deployXML(base);
+ }
+ else
+ {
+ System.out.println("Could not find base-aop.xml file");
+ }
}
- catch (Exception ex)
+ catch (Exception e)
{
- ex.printStackTrace();
- }
+ System.out.println("Error loading base-aop.xml file" + e);
+ }
}
protected void attachDeprecatedTranslator()
Added: trunk/aspects/src/resources/META-INF/aspect-deployers-beans.xml
===================================================================
--- trunk/aspects/src/resources/META-INF/aspect-deployers-beans.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/src/resources/META-INF/aspect-deployers-beans.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Aspect Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="AspectManager" class="org.jboss.aop.deployers.AspectManager">
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="enableLoadtimeWeaving">false</property>
+ <!-- only relevant when EnableLoadtimeWeaving is true.
+ When transformer is on, every loaded class gets
+ transformed. If AOP can't find the class, then it
+ throws an exception. Sometimes, classes may not have
+ all the classes they reference. So, the Suppressing
+ is needed. (i.e. Jboss cache in the default configuration -->
+ <property name="suppressTransformationErrors">true</property>
+ <property name="prune">true</property>
+ <property name="include">org.jboss.test, org.jboss.injbossaop</property>
+ <property name="exclude">org.jboss.</property>
+ <!-- This avoids instrumentation of hibernate cglib enhanced proxies
+ <property name="ignore">*$$EnhancerByCGLIB$$*</property> -->
+ <property name="optimized">true</property>
+ <property name="verbose">false</property>
+ <!--
+ Available choices for this attribute are:
+ org.jboss.aop.instrument.ClassicInstrumentor (default)
+ org.jboss.aop.instrument.GeneratedAdvisorInstrumentor
+ <property name="instrumentor">org.jboss.aop.instrument.ClassicInstrumentor</property>
+ -->
+ </bean>
+
+
+
+ <!-- Aspect Deployment -->
+ <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter><this/></parameter>
+ </uninstall>
+ <depends>AspectManager</depends>
+ </bean>
+</deployment>
Modified: trunk/aspects/src/resources/META-INF/jboss-service.xml
===================================================================
--- trunk/aspects/src/resources/META-INF/jboss-service.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/aspects/src/resources/META-INF/jboss-service.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -43,10 +43,10 @@
<attribute name="Instrumentor">org.jboss.aop.instrument.ClassicInstrumentor</attribute>
-->
</mbean>
-
+<!--
<mbean code="org.jboss.aop.deployment.AspectDeployer"
name="jboss.aop:service=AspectDeployer">
<depends>jboss.system:service=MainDeployer</depends>
</mbean>
-
+-->
</server>
Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/build/build-distr.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -258,6 +258,25 @@
<mkdir dir="${install.server}/all/deploy/${aop.deployer}"/>
<unjar src="${_module.output}/lib/${aop.deployer}"
dest="${install.server}/all/deploy/${aop.deployer}" />
+
+ <!-- For JBoss 5 copy the aop stuff to the lib and conf directories for the time being -->
+ <copy todir="${install.server}/all/lib">
+ <fileset dir="${install.server}/all/deploy/${aop.deployer}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </copy>
+ <copy todir="${install.server}/all/conf">
+ <fileset dir="${install.server}/all/deploy/${aop.deployer}">
+ <include name="base-aop.xml"/>
+ </fileset>
+ </copy>
+ <copy todir="${install.server}/all/deployers">
+ <fileset dir="${install.server}/all/deploy/${aop.deployer}/META-INF">
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+ <delete dir="${install.server}/all/deploy/${aop.deployer}"/>
+
<!-- Copy across client jars -->
<mkdir dir="${install.client}"/>
Modified: trunk/connector/.classpath
===================================================================
--- trunk/connector/.classpath 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/connector/.classpath 2006-10-10 15:17:43 UTC (rev 57536)
@@ -20,7 +20,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
<classpathentry sourcepath="/home/svn/JBossMC/jbossmc/container/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar"/>
+ <classpathentry sourcepath="C:/cygwin/home/Kabir/sourcecontrol/microcontainer/dependency/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/imports/sections/aop.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -201,7 +201,30 @@
</fileset>
</jar>
+ <!-- Create jars for the simple deployer test -->
+ <jar destfile="${build.lib}/aop-deployertest.sar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/deployers/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/deployers">
+ <include name="META-INF/jboss-service.xml"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/aop-deployertest-xml.aop">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/deployers/xml/*.class"/>
+ </fileset>
+ <fileset dir="${build.resources}/aop/deployers/xml">
+ <include name="META-INF/jboss-aop.xml"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/aop-deployertest-annotations.aop">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/aop/deployers/annotations/*.class"/>
+ </fileset>
+ </jar>
+
<!-- jars for scoped test -->
<jar destfile="${build.lib}/aop-scopedtest1.aop">
<fileset dir="${build.classes}">
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitor.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitor.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitor.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,92 @@
+/*
+* 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.test.aop.deployers;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.AdviceBinding;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.advice.GenericAspectFactory;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeployersMonitor implements DeployersMonitorMBean
+{
+ AspectManager manager = AspectManager.instance();
+
+ public Map<String, String> getCurrentBindings()
+ {
+ Map<String, String> result = new TreeMap<String, String>();
+ Map bindings = manager.getBindings();
+ for (Object binding : bindings.values())
+ {
+ String key = ((AdviceBinding)binding).getName();
+ String poincut = ((AdviceBinding)binding).getPointcut().getExpr();
+ result.put(key, poincut);
+ }
+
+ return result;
+ }
+
+ public Map<String, String> getCurrentAspectDefinitions()
+ {
+ Map<String, String> result = new TreeMap();
+ Map definitions = manager.getAspectDefinitions();
+ for (Object def : definitions.values())
+ {
+ AspectFactory factory = ((AspectDefinition)def).getFactory();
+
+ if (factory instanceof GenericAspectFactory)
+ {
+ String key = ((AspectDefinition)def).getName();
+ String clazz = ((GenericAspectFactory)factory).getClassname();
+ result.put(key, clazz);
+ }
+ }
+
+ return result;
+ }
+
+ public void invokeXmlPOJO() throws Exception
+ {
+ org.jboss.test.aop.deployers.xml.POJO pojo = new org.jboss.test.aop.deployers.xml.POJO();
+ org.jboss.test.aop.deployers.xml.POJO.invoked = false;
+ org.jboss.test.aop.deployers.xml.SomeInterceptor.invoked = 0;
+ org.jboss.test.aop.deployers.xml.SomeAspect.invoked = 0;
+
+ pojo.someMethod();
+
+ if (org.jboss.test.aop.deployers.xml.SomeInterceptor.invoked != 2) throw new RuntimeException("SomeInterceptor should have intercepted 2 times not " + org.jboss.test.aop.deployers.xml.SomeInterceptor.invoked);
+ if (org.jboss.test.aop.deployers.xml.SomeAspect.invoked != 2) throw new RuntimeException("SomeAspect should have intercepted 2 times not " + org.jboss.test.aop.deployers.xml.SomeAspect.invoked);
+ if (!org.jboss.test.aop.deployers.xml.POJO.invoked) throw new RuntimeException("POJO was not called");
+ }
+
+ public void invokeAnnotationPOJO() throws Exception
+ {
+ }
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitorMBean.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitorMBean.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/DeployersMonitorMBean.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,37 @@
+/*
+* 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.test.aop.deployers;
+
+import java.util.Map;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeployersMonitorMBean
+{
+ Map<String, String> getCurrentBindings();
+ Map<String, String> getCurrentAspectDefinitions();
+ void invokeXmlPOJO() throws Exception;
+ void invokeAnnotationPOJO() throws Exception;
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations/POJO.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations/POJO.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/annotations/POJO.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,36 @@
+/*
+* 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.test.aop.deployers.annotations;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJO
+{
+ public static boolean invoked;
+ public void someMethod()
+ {
+ invoked = true;
+ }
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/POJO.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/POJO.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/POJO.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,36 @@
+/*
+* 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.test.aop.deployers.xml;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJO
+{
+ public static boolean invoked;
+ public void someMethod()
+ {
+ invoked = true;
+ }
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeAspect.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeAspect.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeAspect.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.deployers.xml;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SomeAspect
+{
+ public static int invoked;
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ invoked++;
+ return invocation.invokeNext();
+ }
+
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeInterceptor.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeInterceptor.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/deployers/xml/SomeInterceptor.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,46 @@
+/*
+* 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.test.aop.deployers.xml;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SomeInterceptor implements Interceptor
+{
+ public static int invoked;
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ invoked++;
+ return invocation.invokeNext();
+ }
+
+}
Added: trunk/testsuite/src/jdk15/org/jboss/test/aop/test/DeployersInitialTestCase.java
===================================================================
--- trunk/testsuite/src/jdk15/org/jboss/test/aop/test/DeployersInitialTestCase.java 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/jdk15/org/jboss/test/aop/test/DeployersInitialTestCase.java 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,178 @@
+/*
+* 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.test.aop.test;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test to see if things get deployed/undeployed correctly using the new deployers
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeployersInitialTestCase extends JBossTestCase
+{
+ final static ObjectName DEPLOYER_MONITOR;
+ static
+ {
+ try
+ {
+ DEPLOYER_MONITOR = new ObjectName("jboss.aop:service=DeployerMonitor");
+ }
+ catch (Exception e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+
+ public DeployersInitialTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testAddXMLBindings() throws Exception
+ {
+ Map<String, String> initialBindings = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentBindings");
+ Map<String, String> initialDefinitiona = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentAspectDefinitions");
+
+ try
+ {
+ deploy("aop-deployertest-xml.aop");
+
+ Map<String, String> deployedBindings = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentBindings");
+ Map<String, String> deployedDefinitiona = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentAspectDefinitions");
+
+ Map<String, String> newBindings = getInEndOnly(initialBindings, deployedBindings);
+ assertEquals("Wrong number of new bindings", 2, newBindings.size());
+
+ Map<String, String> newDefinitions = getInEndOnly(initialDefinitiona, deployedDefinitiona);
+ assertEquals("Wrong number of new aspect definitions", 4, newDefinitions.size());
+
+ HashSet<String> bindings = new HashSet<String>();
+ bindings.addAll(newBindings.values());
+ assertTrue("Could not find 'execution(* org.jboss.test.aop.deployers.xml.POJO->someMethod())'", bindings.remove("execution(* org.jboss.test.aop.deployers.xml.POJO->someMethod())"));
+ assertTrue("Could not find 'execution(void org.jboss.test.aop.deployers.xml.POJO->someMethod())'", bindings.remove("execution(void org.jboss.test.aop.deployers.xml.POJO->someMethod())"));
+
+ System.out.println("bindings " + newBindings);
+ System.out.println("definitions " + newDefinitions);
+
+ String name = "someinterceptor";
+ String clazz = newDefinitions.get(name);
+ assertNotNull("No clazz found for " + name, clazz);
+ assertEquals("Wrong clazz for " + name, "org.jboss.test.aop.deployers.xml.SomeInterceptor", clazz);
+ newDefinitions.remove(name);
+
+ name = "someaspect";
+ clazz = newDefinitions.get(name);
+ assertNotNull("No clazz found for " + name, clazz);
+ assertEquals("Wrong clazz for " + name, "org.jboss.test.aop.deployers.xml.SomeAspect", clazz);
+ newDefinitions.remove(name);
+
+ assertEquals(2, newDefinitions.size());
+
+ HashSet<String> definitions = new HashSet<String>();
+ definitions.addAll(newDefinitions.values());
+ assertTrue("Could not find 'org.jboss.test.aop.deployers.xml.SomeInterceptor'", definitions.remove("org.jboss.test.aop.deployers.xml.SomeInterceptor"));
+ assertTrue("Could not find 'org.jboss.test.aop.deployers.xml.SomeAspect'", definitions.remove("org.jboss.test.aop.deployers.xml.SomeAspect"));
+
+ getServer().invoke(DEPLOYER_MONITOR, "invokeXmlPOJO", new Object[0], new String[0]);
+
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ finally
+ {
+ undeploy("aop-deployertest-xml.aop");
+ }
+
+ Map<String, String> finalBindings = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentBindings");
+ Map<String, String> finalAspectDefinitiona = (Map<String, String>)getServer().getAttribute(DEPLOYER_MONITOR, "CurrentAspectDefinitions");
+
+ compareSame(initialBindings, finalBindings);
+ compareSame(initialDefinitiona, finalAspectDefinitiona);
+ }
+
+ public void testAddAnnotationBindings() throws Exception
+ {
+// try
+// {
+// deploy("aop-deployertest-annotations.aop");
+// }
+// catch(Exception e)
+// {
+// throw e;
+// }
+// finally
+// {
+// undeploy("aop-deployertest-annotations.aop");
+// }
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ private static void compareSame(Map<String, String> initial, Map<String, String> end) throws Exception
+ {
+ assertEquals("Length was not same", initial.size(), end.size());
+
+ for (String key : end.keySet())
+ {
+ String initialValue = initial.get(key);
+ assertNotNull("Value for " + key + " was null", initialValue);
+ assertEquals("Values should be the same", initialValue, end.get(key));
+ }
+ }
+
+ private static Map<String, String> getInEndOnly(Map<String, String> initial, Map<String, String> end) throws Exception
+ {
+ HashMap<String, String> endOnly = new HashMap<String, String>();
+
+ for (String key : end.keySet())
+ {
+ if (initial.get(key) == null)
+ {
+ endOnly.put(key, end.get(key));
+ }
+ }
+
+ return endOnly;
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(DeployersInitialTestCase.class));
+
+ AOPTestSetup setup = new AOPTestSetup(suite, "aop-deployertest.sar");
+ return setup;
+ }
+}
Added: trunk/testsuite/src/resources/aop/deployers/META-INF/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/aop/deployers/META-INF/jboss-service.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/resources/aop/deployers/META-INF/jboss-service.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,3 @@
+<server>
+ <mbean name="jboss.aop:service=DeployerMonitor" code="org.jboss.test.aop.deployers.DeployersMonitor"/>
+</server>
\ No newline at end of file
Added: trunk/testsuite/src/resources/aop/deployers/xml/META-INF/jboss-aop.xml
===================================================================
--- trunk/testsuite/src/resources/aop/deployers/xml/META-INF/jboss-aop.xml 2006-10-10 14:45:41 UTC (rev 57535)
+++ trunk/testsuite/src/resources/aop/deployers/xml/META-INF/jboss-aop.xml 2006-10-10 15:17:43 UTC (rev 57536)
@@ -0,0 +1,16 @@
+<aop>
+ <interceptor class="org.jboss.test.aop.deployers.xml.SomeInterceptor"/>
+ <interceptor name="someinterceptor" class="org.jboss.test.aop.deployers.xml.SomeInterceptor"/>
+ <aspect class="org.jboss.test.aop.deployers.xml.SomeAspect"/>
+ <interceptor name="someaspect" class="org.jboss.test.aop.deployers.xml.SomeAspect"/>
+
+ <bind pointcut="execution(* org.jboss.test.aop.deployers.xml.POJO->someMethod())">
+ <advice aspect="org.jboss.test.aop.deployers.xml.SomeAspect" name="invoke"/>
+ <interceptor-ref name="org.jboss.test.aop.deployers.xml.SomeInterceptor"/>
+ </bind>
+
+ <bind pointcut="execution(void org.jboss.test.aop.deployers.xml.POJO->someMethod())">
+ <advice aspect="someaspect" name="invoke"/>
+ <interceptor-ref name="someinterceptor"/>
+ </bind>
+</aop>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list