[jboss-cvs] JBossAS SVN: r59338 - projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 4 06:15:35 EST 2007
Author: kabir.khan at jboss.com
Date: 2007-01-04 06:15:32 -0500 (Thu, 04 Jan 2007)
New Revision: 59338
Modified:
projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPJoinpointFactory.java
Log:
Reintroduce the checks for if the AOPConstructorJoinpoint class has been deployed yet when running in jboss
Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPJoinpointFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPJoinpointFactory.java 2007-01-04 11:09:00 UTC (rev 59337)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPJoinpointFactory.java 2007-01-04 11:15:32 UTC (rev 59338)
@@ -50,6 +50,73 @@
public ConstructorJoinpoint getConstructorJoinpoint(ConstructorInfo constructorInfo) throws JoinpointException
{
- return new AOPConstructorJoinpoint(constructorInfo);
+ ConstructorInfo info = getAOPJoinpointConstructorInfo(constructorInfo);
+
+ if (info != null)
+ {
+ return createAOPConstructorJoinpoint(info, constructorInfo);
+ }
+ else
+ {
+ return super.getConstructorJoinpoint(constructorInfo);
+ }
}
+
+ private synchronized ConstructorInfo getAOPJoinpointConstructorInfo(ConstructorInfo currentConstructorInfo) throws JoinpointException
+ {
+ if (ctorInfo != null)
+ {
+ return ctorInfo;
+ }
+
+ Class clazz = AOPDeployedChecker.getClassIfExists(
+ classInfo.getType().getClassLoader(),
+ "org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint");
+
+ if (clazz == null)
+ {
+ return null;
+ }
+
+ TypeInfoFactory factory = new IntrospectionTypeInfoFactory();
+ ClassInfo info = (ClassInfo)factory.getTypeInfo(clazz);
+ ConstructorInfo[] ctors = info.getDeclaredConstructors();
+ for (int i = 0 ; i < ctors.length ; i++)
+ {
+ if (ctors[i].getParameterTypes().length == 2)
+ {
+ if (ctors[i].getParameterTypes()[0].getName().equals(ConstructorInfo.class.getName()) == false)
+ {
+ continue;
+ }
+
+ if (ctors[i].getParameterTypes()[1].getName().equals(MetaDataContext.class.getName()) == false)
+ {
+ continue;
+ }
+ ctorInfo = ctors[i];
+ break;
+ }
+ }
+
+ if (ctorInfo == null)
+ {
+ throw new JoinpointException("No constructor found with the reqiured signature AOPConstructorJoinpoint(ConstructorInfo, MetadataContext)");
+ }
+ return ctorInfo;
+ }
+
+ private ConstructorJoinpoint createAOPConstructorJoinpoint(ConstructorInfo info, ConstructorInfo aopCtorInfo) throws JoinpointException
+ {
+ ConstructorJoinpoint jp = new BasicConstructorJoinPoint(info);
+ jp.setArguments(new Object[] {aopCtorInfo, metaDataContext});
+ try
+ {
+ return (ConstructorJoinpoint)jp.dispatch();
+ }
+ catch (Throwable e)
+ {
+ throw new JoinpointException("Error calling AOPConstructorJoinpoint constructor", e);
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list