[jboss-cvs] JBossAS SVN: r72792 - in projects/microcontainer/trunk/aop-mc-int: src/main/org/jboss/aop/microcontainer/beans and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 28 14:15:03 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-04-28 14:15:03 -0400 (Mon, 28 Apr 2008)
New Revision: 72792
Added:
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleRepository.java
projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.xml
projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.xml
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect2.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspectFactory.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableClassMetaDataLoader.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableDynamicCflow.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor2.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptorFactory.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.java
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableTest.java
Modified:
projects/microcontainer/trunk/aop-mc-int/.classpath
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ClassMetaDataLoader.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DelegatingBeanAspectFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DynamicCFlowDef.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/GenericBeanAspectFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DynamicCflowBeanMetaDataFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/InterceptorBeanMetaDataFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataBeanMetaDataFactory.java
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataLoaderBeanMetaDataFactory.java
projects/microcontainer/trunk/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd
projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/
projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/
Log:
[JBAOP-468] Add support for XmlLoadable
Modified: projects/microcontainer/trunk/aop-mc-int/.classpath
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/.classpath 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/.classpath 2008-04-28 18:15:03 UTC (rev 72792)
@@ -1,30 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main"/>
- <classpathentry kind="src" path="src/resources/main" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/resources/tests" output="target/tests-classes" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/tests" output="target/tests-classes"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
- <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR8/jboss-aop-2.0.0.CR8.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.4.GA/jboss-common-core-2.2.4.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.4.GA/jboss-common-core-2.2.4.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
- <classpathentry kind="src" path="/jboss-dependency"/>
- <classpathentry kind="src" path="/jboss-kernel"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta14/jboss-mdr-2.0.0.Beta14.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta14/jboss-mdr-2.0.0.Beta14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar" sourcepath="M2_REPO/qdox/qdox/1.6/qdox-1.6-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/trove/trove/2.1.1/trove-2.1.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
-</classpath>
\ No newline at end of file
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/resources/main"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/tests-classes" path="src/resources/tests"/>
+ <classpathentry kind="src" output="target/tests-classes" path="src/tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.7.1.GA/javassist-3.7.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar" sourcepath="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR8/jboss-aop-2.0.0.CR8.jar" sourcepath="/M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR8/jboss-aop-2.0.0.CR8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.4.GA/jboss-common-core-2.2.4.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.4.GA/jboss-common-core-2.2.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="src" path="/jboss-dependency"/>
+ <classpathentry kind="src" path="/jboss-kernel"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.Beta12/jboss-managed-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta14/jboss-mdr-2.0.0.Beta14.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.Beta14/jboss-mdr-2.0.0.Beta14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.Beta12/jboss-metatype-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.Beta12/jboss-reflect-2.0.0.Beta12-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-test/1.0.5.GA/jboss-test-1.0.5.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR8/jbossxb-2.0.0.CR8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar" sourcepath="M2_REPO/qdox/qdox/1.6/qdox-1.6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/trove/trove/2.1.1/trove-2.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Property changes on: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans
___________________________________________________________________
Name: svn:ignore
+ LifecycleRepository.java
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/Aspect.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -38,6 +38,7 @@
import org.jboss.kernel.spi.dependency.ConfigureKernelControllerContextAware;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.logging.Logger;
+import org.w3c.dom.Element;
/**
* An Aspect.
@@ -77,7 +78,7 @@
/**
* The name of the beanfactory representing the advice. This should be used if the advice has dependencies,
* in which case we have no real dependency on the beanfactory. If the advice has no dependencies we need
- * to use advice instead;
+ * to use advice instead;
*/
protected String adviceBean;
@@ -99,6 +100,11 @@
protected Map<String, Binding> bindings = new LinkedHashMap<String, Binding>();
/**
+ * The element representing the interceptor in case we need to load xml
+ */
+ private Element element;
+
+ /**
* Get the adviceName.
*
* @return the adviceName.
@@ -229,6 +235,11 @@
this.context = null;
}
+ public void setElement(Element element)
+ {
+ this.element = element;
+ }
+
public void install(GenericBeanFactory factory) throws Exception
{
this.advice = factory;
@@ -283,21 +294,21 @@
protected ManagedAspectDefinition getAspectDefinitionNoDependencies()
{
AspectFactory factory = this.factory ?
- new DelegatingBeanAspectFactory(myname, advice) : new GenericBeanAspectFactory(myname, advice);
+ new DelegatingBeanAspectFactory(myname, advice, element) : new GenericBeanAspectFactory(myname, advice, element);
return new ManagedAspectDefinition(aspectDefName, scope, factory);
}
protected ManagedAspectDefinition getAspectDefintionDependencies()
{
AspectFactory factory = this.factory ?
- new DelegatingBeanAspectFactory(aspectDefName, advice) : new GenericBeanAspectFactory(aspectDefName, advice);
+ new DelegatingBeanAspectFactory(aspectDefName, advice, element) : new GenericBeanAspectFactory(aspectDefName, advice, element);
return new ManagedAspectDefinition(aspectDefName, scope, factory, false);
}
protected ManagedAspectDefinition getAspectDefinitionPlainAspectFactory()
{
AspectFactory factory = this.factory ?
- new AspectFactoryDelegator(myname, null) : new GenericAspectFactory(myname, null);
+ new AspectFactoryDelegator(myname, null) : new GenericAspectFactory(myname, element);
return new ManagedAspectDefinition(aspectDefName, scope, factory);
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ClassMetaDataLoader.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ClassMetaDataLoader.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ClassMetaDataLoader.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -22,6 +22,8 @@
package org.jboss.aop.microcontainer.beans;
import org.jboss.aop.AspectManager;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
/**
*
@@ -33,6 +35,7 @@
AspectManager manager;
String tag;
String className;
+ Element element;
public AspectManager getManager()
{
@@ -64,6 +67,16 @@
this.className = className;
}
+ public Element getElement()
+ {
+ return element;
+ }
+
+ public void setElement(Element element)
+ {
+ this.element = element;
+ }
+
public void start()
{
if (manager == null)
@@ -80,6 +93,11 @@
Class<?> clazz = cl.loadClass(className);
org.jboss.aop.metadata.ClassMetaDataLoader loader = (org.jboss.aop.metadata.ClassMetaDataLoader)clazz.newInstance();
+ if (loader instanceof XmlLoadable)
+ {
+ ((XmlLoadable) loader).importXml(element);
+ }
+
manager.addClassMetaDataLoader(tag, loader);
}
catch (Exception e)
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DelegatingBeanAspectFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DelegatingBeanAspectFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DelegatingBeanAspectFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -28,6 +28,8 @@
import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
import org.jboss.beans.metadata.spi.factory.BeanFactory;
import org.jboss.logging.Logger;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
/**
*
@@ -42,10 +44,13 @@
protected String name;
- public DelegatingBeanAspectFactory(String name, BeanFactory factory)
+ protected Element element;
+
+ public DelegatingBeanAspectFactory(String name, BeanFactory factory, Element element)
{
this.name = name;
this.factory = factory;
+ this.element = element;
}
public void setBeanFactory(GenericBeanFactory factory)
@@ -93,12 +98,16 @@
try
{
log.debug("Creating advice " + name);
- return (AspectFactory)factory.createBean();
+ AspectFactory fac = (AspectFactory)factory.createBean();
+ if (fac instanceof XmlLoadable)
+ {
+ ((XmlLoadable)fac).importXml(element);
+ }
+ return fac;
}
catch (Throwable throwable)
{
throw new RuntimeException(throwable);
}
}
-
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DynamicCFlowDef.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DynamicCFlowDef.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/DynamicCFlowDef.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -23,6 +23,7 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.advice.DynamicCFlowDefinition;
+import org.w3c.dom.Element;
/**
* Bean to install a DynamicCFlow
@@ -46,7 +47,14 @@
* The name of the class implementing the dynamic cflow
*/
private String className;
+
+ Element element;
+ public void setElement(Element element)
+ {
+ this.element = element;
+ }
+
public AspectManager getManager()
{
return manager;
@@ -86,7 +94,7 @@
if (manager == null)
throw new IllegalArgumentException("Null manager");
- DynamicCFlowDefinition dynamic = new DynamicCFlowDefinition(null, className, name);
+ DynamicCFlowDefinition dynamic = new DynamicCFlowDefinition(element, className, name);
manager.addDynamicCFlow(name, dynamic);
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/GenericBeanAspectFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/GenericBeanAspectFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/GenericBeanAspectFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -24,10 +24,13 @@
import org.jboss.aop.Advisor;
import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.advice.GenericAspectFactory;
import org.jboss.aop.joinpoint.Joinpoint;
import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
import org.jboss.beans.metadata.spi.factory.BeanFactory;
import org.jboss.logging.Logger;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
/**
* A GenericBeanAspectFactory.
@@ -35,7 +38,7 @@
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision$
*/
-public class GenericBeanAspectFactory implements AspectFactory
+public class GenericBeanAspectFactory extends GenericAspectFactory
{
private static final Logger log = Logger.getLogger(GenericBeanAspectFactory.class);
@@ -43,10 +46,14 @@
protected String name;
- public GenericBeanAspectFactory(String name, BeanFactory factory)
+ protected Element element;
+
+ public GenericBeanAspectFactory(String name, BeanFactory factory, Element element)
{
+ super(null, element);
this.name = name;
this.factory = factory;
+ this.element = element;
}
public void setBeanFactory(GenericBeanFactory factory)
@@ -61,35 +68,41 @@
public Object createPerVM()
{
- return doCreate();
+ return doCreate(null, null, null);
}
public Object createPerClass(Advisor advisor)
{
- return doCreate();
+ return doCreate(advisor, null, null);
}
public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
{
- return doCreate();
+ return doCreate(advisor, instanceAdvisor, null);
}
public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
{
- return doCreate();
+ return doCreate(advisor, null, jp);
}
public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
{
- return doCreate();
+ return doCreate(advisor, instanceAdvisor, jp);
}
- protected Object doCreate()
+ protected Object doCreate(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
{
try
{
log.debug("Creating advice " + name);
- return factory.createBean();
+ Object object = factory.createBean();
+ if (object instanceof XmlLoadable)
+ {
+ ((XmlLoadable)object).importXml(element);
+ }
+ configureInstance(object, advisor, instanceAdvisor, jp);
+ return object;
}
catch (Throwable throwable)
{
Added: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleRepository.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleRepository.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/LifecycleRepository.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,56 @@
+/*
+* 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.microcontainer.beans;
+
+/**
+ * This does not interact with the AspectManager. It is picked up by the deployers in AS
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LifecycleRepository
+{
+ private String name;
+ private String repositoryName;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getRepositoryName()
+ {
+ return repositoryName;
+ }
+
+ public void setRepositoryName(String repositoryName)
+ {
+ this.repositoryName = repositoryName;
+ }
+
+
+}
Property changes on: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata
___________________________________________________________________
Name: svn:ignore
+ LoaderRepositoryBeanMetaDataFactory.java
XmlLoadableRootElementUtil.java
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AOPDeployment.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -72,6 +72,7 @@
@XmlElement(name="lifecycle-instantiate", type=InstantiateLifecycleBeanMetaDataFactory.class),
@XmlElement(name="lifecycle-preinstall", type=PreInstallLifecycleBeanMetaDataFactory.class),
@XmlElement(name="lifecycle-start", type=StartLifecycleBeanMetaDataFactory.class),
+ @XmlElement(name="loader-repository", type=LoaderRepositoryBeanMetaDataFactory.class),
@XmlElement(name="metadata", type=MetaDataBeanMetaDataFactory.class),
@XmlElement(name="metadata-loader", type=MetaDataLoaderBeanMetaDataFactory.class),
@XmlElement(name="pointcut", type=NamedPointcutBeanMetaDataFactory.class),
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/AspectBeanMetaDataFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -22,9 +22,11 @@
package org.jboss.aop.microcontainer.beans.metadata;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
@@ -37,6 +39,7 @@
import org.jboss.beans.metadata.spi.ValueMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.xb.annotations.JBossXmlSchema;
+import org.w3c.dom.Element;
/**
* AspectBeanMetaDataFactory.
@@ -55,10 +58,12 @@
private String factory;
- String aspectName;
+ private String aspectName;
- boolean initialisedName;
+ private boolean initialisedName;
+ private List<Element> elements;
+
@XmlAttribute
public void setScope(String scope)
{
@@ -98,6 +103,17 @@
super.setBean(bean);
}
+ public List<Element> getElements()
+ {
+ return elements;
+ }
+
+ @XmlAnyElement(lax=true)
+ public void setElements(List<Element> elements)
+ {
+ this.elements = elements;
+ }
+
@Override
public List<BeanMetaData> getBeans()
{
@@ -127,6 +143,22 @@
//Add the Aspect
BeanMetaDataBuilder aspectBuilder = BeanMetaDataBuilder.createBuilder(aspectName, Aspect.class.getName());
aspectBuilder.addPropertyMetaData("scope", scope);
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("name", name);
+ if (factory != null)
+ {
+ attributes.put("factory", this.factory);
+ }
+ else
+ {
+ attributes.put("class", bean);
+ }
+ attributes.put("scope", scope);
+ if (elements != null && elements.size() > 0)
+ {
+ aspectBuilder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, getTagName(), attributes));
+ }
+
setAspectManagerProperty(aspectBuilder);
if (this.factory != null)
@@ -194,4 +226,9 @@
}
}
}
+
+ protected String getTagName()
+ {
+ return "aspect";
+ }
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DynamicCflowBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DynamicCflowBeanMetaDataFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/DynamicCflowBeanMetaDataFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -22,8 +22,10 @@
package org.jboss.aop.microcontainer.beans.metadata;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
@@ -32,6 +34,7 @@
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.xb.annotations.JBossXmlSchema;
+import org.w3c.dom.Element;
/**
*
@@ -44,7 +47,9 @@
{
private static final long serialVersionUID = 1L;
- String clazz;
+ private String clazz;
+
+ private List<Element> elements;
public String getClazz()
{
@@ -57,6 +62,17 @@
this.clazz = clazz;
}
+ public List<Element> getElements()
+ {
+ return elements;
+ }
+
+ @XmlAnyElement(lax=true)
+ public void setElements(List<Element> elements)
+ {
+ this.elements = elements;
+ }
+
@Override
public List<BeanMetaData> getBeans()
{
@@ -65,6 +81,15 @@
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, DynamicCFlowDef.class.getName());
builder.addPropertyMetaData("name", name);
builder.addPropertyMetaData("className", clazz);
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("name", name);
+ attributes.put("class", clazz);
+ if (elements != null && elements.size() > 0)
+ {
+ builder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, "dynamic-cflow", attributes));
+ }
+
+
setAspectManagerProperty(builder);
result.add(builder.getBeanMetaData());
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/InterceptorBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/InterceptorBeanMetaDataFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/InterceptorBeanMetaDataFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -36,4 +36,10 @@
public class InterceptorBeanMetaDataFactory extends AspectBeanMetaDataFactory
{
private static final long serialVersionUID = 1L;
+
+ @Override
+ protected String getTagName()
+ {
+ return "interceptor";
+ }
}
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataBeanMetaDataFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataBeanMetaDataFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -21,9 +21,8 @@
*/
package org.jboss.aop.microcontainer.beans.metadata;
-import java.io.BufferedWriter;
-import java.io.StringWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
@@ -36,9 +35,7 @@
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.util.id.GUID;
-import org.jboss.util.xml.DOMWriter;
import org.jboss.xb.annotations.JBossXmlSchema;
-import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
/**
@@ -63,8 +60,6 @@
//way, but what if we have a custom metadata loader that expects elements with the same names?
List<Element> elements;
- String fullDocument;
-
public String getTag()
{
return tag;
@@ -109,43 +104,16 @@
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ClassMetaData.class.getName());
builder.addPropertyMetaData("tag", tag);
builder.addPropertyMetaData("className", clazz);
- builder.addPropertyMetaData("element", getRootElement());
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("tag", tag);
+ attributes.put("class", clazz);
+ builder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, "metadata", attributes));
setAspectManagerProperty(builder);
beans.add(builder.getBeanMetaData());
return beans;
}
-
- private String getRootElement()
- {
- try
- {
- StringWriter writer = new StringWriter();
- StringBuffer contents = writer.getBuffer();
- contents.append("<metadata ");
- contents.append("tag=\"" + tag + "\" ");
- contents.append("class=\"" + clazz + "\"");
- contents.append(">");
-
- DOMWriter domWriter = new DOMWriter(new BufferedWriter(writer));
- for (Element child : elements)
- {
- domWriter.print(child);
- }
-
- contents.append("</metadata>");
-
- fullDocument = writer.getBuffer().toString();
- System.out.println(fullDocument);
- return fullDocument;
- }
- catch (DOMException e)
- {
- e.printStackTrace();
- throw e;
- }
- }
-
+
/**
* Here to match the @XMLType.propOrder
* @param ignored ???
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataLoaderBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataLoaderBeanMetaDataFactory.java 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/metadata/MetaDataLoaderBeanMetaDataFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -22,8 +22,10 @@
package org.jboss.aop.microcontainer.beans.metadata;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
@@ -33,6 +35,7 @@
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.util.id.GUID;
import org.jboss.xb.annotations.JBossXmlSchema;
+import org.w3c.dom.Element;
/**
*
@@ -45,10 +48,12 @@
{
private static final long serialVersionUID = 1L;
- String tag;
+ private String tag;
- String clazz;
+ private String clazz;
+ private List<Element> elements;
+
public String getTag()
{
return tag;
@@ -70,7 +75,18 @@
{
this.clazz = clazz;
}
+
+ public List<Element> getElements()
+ {
+ return elements;
+ }
+ @XmlAnyElement(lax=true)
+ public void setElements(List<Element> elements)
+ {
+ this.elements = elements;
+ }
+
@Override
public List<BeanMetaData> getBeans()
{
@@ -82,7 +98,14 @@
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(name, ClassMetaDataLoader.class.getName());
builder.addPropertyMetaData("tag", tag);
builder.addPropertyMetaData("className", clazz);
-
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("tag", tag);
+ attributes.put("name", name);
+ if (elements != null && elements.size() > 0)
+ {
+ builder.addPropertyMetaData("element", XmlLoadableRootElementUtil.getRootElementString(elements, "metadata-loader", attributes));
+ }
+
setAspectManagerProperty(builder);
beans.add(builder.getBeanMetaData());
return beans;
Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd 2008-04-28 16:27:24 UTC (rev 72791)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/main/schema/aop-beans_1_0.xsd 2008-04-28 18:15:03 UTC (rev 72792)
@@ -271,6 +271,7 @@
<xsd:element name="dynamic-cflow" type="dynamicCflowStackType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="interceptor" type="aspectOrInterceptorType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="introduction" type="introductionType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="loader-repository" type="loaderRepositoryType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="metadata" type="metadataType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="metadata-loader" type="metadataLoaderType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="pointcut" type="pointcutType" minOccurs="0" maxOccurs="unbounded"/>
@@ -370,7 +371,7 @@
</xsd:complexContent>
</xsd:complexType>
- <xsd:complexType name="aspectOrInterceptorType">
+ <xsd:complexType name="aspectOrInterceptorType" mixed="true">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
@@ -380,6 +381,10 @@
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="aopBeanfactoryType">
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:any namespace="##other" processContents="strict" minOccurs="0">
+ </xsd:any>
+ </xsd:choice>
<xsd:attribute name="scope" type="xsd:string" use="optional"/>
<xsd:attribute name="factory" type="xsd:string" use="optional"/>
<xsd:attribute name="manager-bean" type="xsd:string" use="optional"/>
@@ -947,6 +952,10 @@
]]>
</xsd:documentation>
</xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="1">
+ <xsd:any namespace="##other" processContents="strict" minOccurs="0">
+ </xsd:any>
+ </xsd:choice>
<xsd:attribute name="tag" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="class" type="xsd:string" use="required"></xsd:attribute>
</xsd:complexType>
@@ -1098,4 +1107,26 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
+
+ <xsd:element name="loader-repository">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ Which loader repository to attach to
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:simpleType name="loaderRepositoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The name of the loader repository to attach to
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ </xsd:restriction>
+ </xsd:simpleType>
</xsd:schema>
Property changes on: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test
___________________________________________________________________
Name: svn:ignore
+ XmlLoadableAopTestCase.xml
XmlLoadableTest.xml
Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.xml 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <loader-repository>Here to check the parser still works</loader-repository>
+
+ <metadata-loader tag="xxx" class="org.jboss.test.microcontainer.beans.XmlLoadableClassMetaDataLoader">
+ <somexml>hello</somexml>
+ </metadata-loader>
+
+ <dynamic-cflow name="DynamicCFlow" class="org.jboss.test.microcontainer.beans.XmlLoadableDynamicCflow">
+ <shouldinvoke>true</shouldinvoke>
+ </dynamic-cflow>
+
+ <aspect class="org.jboss.test.microcontainer.beans.XmlLoadableAspect">
+ <somexml>hello</somexml>
+ <attribute name="IntAttr">12</attribute>
+ <!-- <property name="property">Test1</property> -->
+ </aspect>
+
+ <interceptor class="org.jboss.test.microcontainer.beans.XmlLoadableInterceptor">
+ <somexml>hello</somexml>
+ <attribute name="IntAttr">13</attribute>
+ <!-- <property name="property">Test2</property> -->
+ </interceptor>
+
+ <aspect factory="org.jboss.test.microcontainer.beans.XmlLoadableAspectFactory">
+ <somexml>hi</somexml>
+ </aspect>
+
+ <interceptor factory="org.jboss.test.microcontainer.beans.XmlLoadableInterceptorFactory">
+ <somexml>hi</somexml>
+ </interceptor>
+
+ <bind pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*())" cflow="DynamicCFlow">
+ <advice aspect="org.jboss.test.microcontainer.beans.XmlLoadableAspect" name="invoke"/>
+ <interceptor-ref name="org.jboss.test.microcontainer.beans.XmlLoadableInterceptor"/>
+ <advice aspect="org.jboss.test.microcontainer.beans.XmlLoadableAspectFactory" name="invoke"/>
+ <interceptor-ref name="org.jboss.test.microcontainer.beans.XmlLoadableInterceptorFactory"/>
+ </bind>
+
+ <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
+
+</aop>
Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.xml 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+ <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+ </bean>
+
+ <loader-repository xmlns="urn:jboss:aop-beans:1.0">Here to check the parser still works</loader-repository>
+
+ <metadata-loader xmlns="urn:jboss:aop-beans:1.0" tag="xxx" class="org.jboss.test.microcontainer.beans.XmlLoadableClassMetaDataLoader">
+ <somexml>hello</somexml>
+ </metadata-loader>
+
+ <dynamic-cflow xmlns="urn:jboss:aop-beans:1.0" name="DynamicCFlow" class="org.jboss.test.microcontainer.beans.XmlLoadableDynamicCflow">
+ <shouldinvoke>true</shouldinvoke>
+ </dynamic-cflow>
+
+ <aspect xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.XmlLoadableAspect">
+ <somexml>hello</somexml>
+ <attribute name="IntAttr">12</attribute>
+ <!-- <property name="property">Test1</property> -->
+ </aspect>
+
+ <interceptor xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.XmlLoadableInterceptor">
+ <somexml>hello</somexml>
+ <attribute name="IntAttr">13</attribute>
+ <!-- <property name="property">Test2</property> -->
+ </interceptor>
+
+ <aspect xmlns="urn:jboss:aop-beans:1.0" factory="org.jboss.test.microcontainer.beans.XmlLoadableAspectFactory">
+ <somexml>hi</somexml>
+ </aspect>
+
+ <interceptor xmlns="urn:jboss:aop-beans:1.0" factory="org.jboss.test.microcontainer.beans.XmlLoadableInterceptorFactory">
+ <somexml>hi</somexml>
+ </interceptor>
+
+ <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*())" cflow="DynamicCFlow">
+ <advice aspect="org.jboss.test.microcontainer.beans.XmlLoadableAspect" name="invoke"/>
+ <interceptor-ref name="org.jboss.test.microcontainer.beans.XmlLoadableInterceptor"/>
+ <advice aspect="org.jboss.test.microcontainer.beans.XmlLoadableAspectFactory" name="invoke"/>
+ <interceptor-ref name="org.jboss.test.microcontainer.beans.XmlLoadableInterceptorFactory"/>
+ </bind>
+
+ <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
+
+</deployment>
Property changes on: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans
___________________________________________________________________
Name: svn:ignore
+ XmlLoadableAspect.java
XmlLoadableAspect2.java
XmlLoadableAspectFactory.java
XmlLoadableClassMetaDataLoader.java
XmlLoadableDynamicCflow.java
XmlLoadableInterceptor.java
XmlLoadableInterceptor2.java
XmlLoadableInterceptorFactory.java
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,67 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableAspect implements XmlLoadable
+{
+ private Element element;
+ public static boolean intercepted;
+ public static Element interceptedElement;
+ public static int intAttr;
+ public static String mcProperty;
+
+ public void setIntAttr(int i)
+ {
+ intAttr = i;
+ }
+
+ public void setProperty(String property)
+ {
+ mcProperty = property;
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ interceptedElement = element;
+ return invocation.invokeNext();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect2.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect2.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspect2.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,55 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableAspect2 implements XmlLoadable
+{
+ private Element element;
+ public static boolean intercepted;
+ public static Element interceptedElement;
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ interceptedElement = element;
+ return invocation.invokeNext();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
\ No newline at end of file
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspectFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspectFactory.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableAspectFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,76 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.joinpoint.Joinpoint;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableAspectFactory implements AspectFactory, XmlLoadable
+{
+ Element element;
+
+ public Object createPerClass(Advisor advisor)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerVM()
+ {
+ XmlLoadableAspect2 aspect = new XmlLoadableAspect2();
+ aspect.importXml(element);
+ return aspect;
+ }
+
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableClassMetaDataLoader.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableClassMetaDataLoader.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableClassMetaDataLoader.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,73 @@
+/*
+* 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.microcontainer.beans;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMethod;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.ClassMetaDataLoader;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableClassMetaDataLoader implements ClassMetaDataLoader, XmlLoadable
+{
+ Element element;
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+
+ public void bind(Advisor advisor, ClassMetaDataBinding data, CtMethod[] methods, CtField[] fields,
+ CtConstructor[] constructors) throws Exception
+ {
+ }
+
+ public void bind(Advisor advisor, ClassMetaDataBinding data, Method[] methods, Field[] fields,
+ Constructor<?>[] constructors) throws Exception
+ {
+ }
+
+ public ClassMetaDataBinding importMetaData(Element element, String name, String tag, String classExpr)
+ throws Exception
+ {
+ return null;
+ }
+
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableDynamicCflow.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableDynamicCflow.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableDynamicCflow.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,69 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.pointcut.DynamicCFlow;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableDynamicCflow implements DynamicCFlow, XmlLoadable
+{
+ Element element;
+
+ public boolean shouldExecute(Invocation invocation)
+ {
+ try
+ {
+ if (element != null)
+ {
+ NodeList list = element.getElementsByTagName("shouldinvoke");
+ if (list != null)
+ {
+ if (list.getLength() > 0)
+ {
+ Element child = (Element)list.item(0);
+ String s = child.getTextContent();
+ boolean b = Boolean.valueOf(s);
+ return b;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,73 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableInterceptor implements Interceptor, XmlLoadable
+{
+ private Element element;
+ public static boolean intercepted;
+ public static Element interceptedElement;
+ public static int intAttr;
+ public static String mcProperty;
+
+ public void setIntAttr(int i)
+ {
+ intAttr = i;
+ }
+
+ public void setProperty(String property)
+ {
+ mcProperty = property;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ interceptedElement = element;
+ return invocation.invokeNext();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor2.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor2.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptor2.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,61 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableInterceptor2 implements Interceptor, XmlLoadable
+{
+ private Element element;
+ public static boolean intercepted;
+ public static Element interceptedElement;
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ intercepted = true;
+ interceptedElement = element;
+ return invocation.invokeNext();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptorFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptorFactory.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/XmlLoadableInterceptorFactory.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,76 @@
+/*
+* 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.microcontainer.beans;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.advice.AspectFactory;
+import org.jboss.aop.joinpoint.Joinpoint;
+import org.jboss.util.xml.XmlLoadable;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableInterceptorFactory implements AspectFactory, XmlLoadable
+{
+ Element element;
+
+ public Object createPerClass(Advisor advisor)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
+ {
+ throw new RuntimeException("PER_VM only");
+ }
+
+ public Object createPerVM()
+ {
+ XmlLoadableInterceptor2 icptr = new XmlLoadableInterceptor2();
+ icptr.importXml(element);
+ return icptr;
+ }
+
+ public String getName()
+ {
+ return this.getClass().getName();
+ }
+
+ public void importXml(Element element)
+ {
+ this.element = element;
+ }
+}
Property changes on: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test
___________________________________________________________________
Name: svn:ignore
+ XmlLoadableAopTestCase.java
XmlLoadableTest.java
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableAopTestCase.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,44 @@
+/*
+* 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.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableAopTestCase extends XmlLoadableTest
+{
+
+ public XmlLoadableAopTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(XmlLoadableAopTestCase.class);
+ }
+
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableDeploymentTestCase.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,44 @@
+/*
+* 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.microcontainer.beans.test;
+
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlLoadableDeploymentTestCase extends XmlLoadableTest
+{
+
+ public XmlLoadableDeploymentTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(XmlLoadableDeploymentTestCase.class);
+ }
+
+}
Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableTest.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableTest.java (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/XmlLoadableTest.java 2008-04-28 18:15:03 UTC (rev 72792)
@@ -0,0 +1,103 @@
+/*
+* 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.microcontainer.beans.test;
+
+import java.util.Map;
+
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.metadata.ClassMetaDataLoader;
+import org.jboss.test.aop.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.beans.POJO;
+import org.jboss.test.microcontainer.beans.XmlLoadableAspect;
+import org.jboss.test.microcontainer.beans.XmlLoadableAspect2;
+import org.jboss.test.microcontainer.beans.XmlLoadableClassMetaDataLoader;
+import org.jboss.test.microcontainer.beans.XmlLoadableInterceptor;
+import org.jboss.test.microcontainer.beans.XmlLoadableInterceptor2;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public /*abstract*/ class XmlLoadableTest extends AOPMicrocontainerTest
+{
+ public XmlLoadableTest(String name)
+ {
+ super(name);
+ }
+
+ public void testClassMetaDataLoader()
+ {
+ Map<String, ClassMetaDataLoader> loaders = AspectManager.instance().getClassMetaDataLoaders();
+ assertNotNull(loaders);
+ assertEquals(1, loaders.size());
+ ClassMetaDataLoader loader = loaders.get("xxx");
+ assertNotNull(loader);
+ assertInstanceOf(loader, XmlLoadableClassMetaDataLoader.class);
+ Element element = ((XmlLoadableClassMetaDataLoader)loader).getElement();
+
+ checkXml(element, "metadata-loader", "somexml", "hello");
+ }
+
+ public void testAspectInterceptorAndDynamicCFlow()
+ {
+ POJO pojo = (POJO)getBean("Bean");
+ pojo.defaultMethod();
+ assertTrue(XmlLoadableAspect.intercepted);
+ assertTrue(XmlLoadableInterceptor.intercepted);
+
+ Element element = XmlLoadableAspect.interceptedElement;
+ checkXml(element, "aspect", "somexml", "hello");
+ assertEquals(12, XmlLoadableAspect.intAttr);
+ //assertEquals("Test1", XmlLoadableAspect.mcProperty);
+
+ element = XmlLoadableInterceptor.interceptedElement;
+ checkXml(element, "interceptor", "somexml", "hello");
+ assertEquals(13, XmlLoadableInterceptor.intAttr);
+ //assertEquals("Test2", XmlLoadableInterceptor.mcProperty);
+
+ element = XmlLoadableAspect2.interceptedElement;
+ checkXml(element, "aspect", "somexml", "hi");
+
+ element = XmlLoadableInterceptor2.interceptedElement;
+ checkXml(element, "interceptor", "somexml", "hi");
+
+ assertEquals(12, XmlLoadableAspect.intAttr);
+ assertEquals(13, XmlLoadableInterceptor.intAttr);
+ }
+
+ private void checkXml(Element element, String rootName, String childName, String childContent)
+ {
+ assertNotNull(element);
+ assertEquals(rootName, element.getTagName());
+ NodeList list = element.getElementsByTagName(childName);
+ assertNotNull(list);
+ assertEquals(1, list.getLength());
+ Element child = (Element)list.item(0);
+ String s = child.getTextContent();
+ assertEquals(childContent, s);
+ }
+}
More information about the jboss-cvs-commits
mailing list