[jboss-cvs] JBossAS SVN: r76427 - in branches/JBPAPP_4_2_0_GA_CP/ejb3: src/main/org/jboss/ejb3 and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 29 10:48:18 EDT 2008
Author: wolfc
Date: 2008-07-29 10:48:17 -0400 (Tue, 29 Jul 2008)
New Revision: 76427
Added:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/application.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/ejb-jar.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/jboss-app.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/Greeter.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/GreeterBean.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/SimpleInterceptor.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/unit/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/unit/SimpleInterceptorUnitTestCase.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java
Log:
JBPAPP-999: using deployment class loader for interceptors
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml 2008-07-29 13:59:46 UTC (rev 76426)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml 2008-07-29 14:48:17 UTC (rev 76427)
@@ -2071,6 +2071,32 @@
<build-simple-jar name="jbas4489"/>
</target>
+ <target name="jbpapp999" depends="compile-classes">
+ <mkdir dir="${build.lib}"/>
+
+ <jar jarfile="${build.lib}/jbpapp999-ejb.jar">
+ <metainf dir="${build.resources}/test/jbpapp999">
+ <include name="ejb-jar.xml"/>
+ </metainf>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/jbpapp999/Greeter*.class"/>
+ </fileset>
+ </jar>
+
+ <jar jarfile="${build.lib}/jbpapp999-lib.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/jbpapp999/*Interceptor.class"/>
+ </fileset>
+ </jar>
+
+ <ear earfile="${build.lib}/jbpapp999.ear" appxml="${build.resources}/test/jbpapp999/application.xml">
+ <metainf dir="${build.resources}/test/jbpapp999">
+ <include name="jboss-app.xml"/>
+ </metainf>
+ <fileset dir="${build.lib}" includes="jbpapp999-*.jar"/>
+ </ear>
+ </target>
+
<target name="jaxws"
description="Builds a simple jar."
depends="compile-classes">
@@ -3760,6 +3786,7 @@
ejbthree959, ejbthree963, ejbthree994, ejbthree1023, ejbthree1025, ejbthree1062,
ejbthree1109,
ejbthree1239,
+ jbpapp999,
jbas4489, epcpropagation, jaccpropagation,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
pkg, securitydomain, enventry, externalpersistenceunit,
@@ -4389,6 +4416,9 @@
<antcall target="test" inheritRefs="true">
<param name="test" value="jbas4489"/>
</antcall>
+ <antcall target="test" inheritRefs="true">
+ <param name="test" value="jbpapp999"/>
+ </antcall>
</target>
<target name="entity-tests" depends="init" description="Execute all tests">
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java 2008-07-29 13:59:46 UTC (rev 76426)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -22,7 +22,6 @@
package org.jboss.ejb3;
import java.io.File;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
@@ -52,12 +51,13 @@
protected static final Logger log = Logger.getLogger(JmxDeploymentUnit.class);
private DeploymentInfo deploymentInfo;
- InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository();
+ InterceptorInfoRepository interceptorInfoRepository;
// private VirtualFile vfsRoot;
public JmxDeploymentUnit(DeploymentInfo deploymentInfo)
{
this.deploymentInfo = deploymentInfo;
+ this.interceptorInfoRepository = new InterceptorInfoRepository(getClassLoader());
// try
// {
// VFS vfs = VFS.getVFS(deploymentInfo.url);
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java 2008-07-29 13:59:46 UTC (rev 76426)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -21,12 +21,22 @@
*/
package org.jboss.ejb3.interceptor;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.metamodel.EjbJarDD;
-import org.jboss.ejb3.metamodel.Interceptor;
-import org.jboss.ejb3.metamodel.InterceptorBinding;
-import org.jboss.ejb3.metamodel.Interceptors;
-import org.jboss.logging.Logger;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -37,14 +47,14 @@
import javax.interceptor.ExcludeClassInterceptors;
import javax.interceptor.ExcludeDefaultInterceptors;
import javax.interceptor.InvocationContext;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.rmi.RemoteException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.metamodel.EjbJarDD;
+import org.jboss.ejb3.metamodel.Interceptor;
+import org.jboss.ejb3.metamodel.InterceptorBinding;
+import org.jboss.ejb3.metamodel.Interceptors;
+import org.jboss.logging.Logger;
+
/**
* A repository of interceptor details shared amongst all containers in this deployment.
* Interceptors differ from other ejb 3 artifacts in that we can have annotations on the
@@ -75,8 +85,17 @@
private InterceptorSorter sorter = new InterceptorSorter();
- public InterceptorInfoRepository()
+ private ClassLoader classLoader;
+
+ /**
+ *
+ * @param cl the class loader for loading interceptor classes
+ */
+ public InterceptorInfoRepository(ClassLoader cl)
{
+ assert cl != null : "cl is null";
+
+ this.classLoader = cl;
}
public void initialise(EjbJarDD dd)
@@ -502,7 +521,7 @@
{
try
{
- return Thread.currentThread().getContextClassLoader().loadClass(name);
+ return classLoader.loadClass(name);
}
catch (Exception e)
{
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/application.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/application.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/application.xml 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+ "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+ <display-name>EJB3 JBPAPP-999 test</display-name>
+
+ <module>
+ <ejb>jbpapp999-ejb.jar</ejb>
+ </module>
+ <module>
+ <java>jbpapp999-lib.jar</java>
+ </module>
+</application>
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/ejb-jar.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/ejb-jar.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/ejb-jar.xml 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.ejb3.test.jbpapp999.SimpleInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.ejb3.test.jbpapp999.SimpleInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/jboss-app.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/jboss-app.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp999/jboss-app.xml 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,3 @@
+<jboss-app>
+ <loader-repository>ejb3.jboss.org:loader=jbpapp999</loader-repository>
+</jboss-app>
\ No newline at end of file
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/Greeter.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/Greeter.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/Greeter.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.test.jbpapp999;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface Greeter
+{
+ String sayHi(String name);
+}
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/GreeterBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/GreeterBean.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/GreeterBean.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.test.jbpapp999;
+
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+public class GreeterBean implements Greeter
+{
+ public String sayHi(String name)
+ {
+ return "Hi " + name;
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/SimpleInterceptor.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/SimpleInterceptor.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/SimpleInterceptor.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.test.jbpapp999;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleInterceptor
+{
+ @AroundInvoke
+ public Object aroundInvoke(InvocationContext ctx) throws Exception
+ {
+ return "Intercepted " + ctx.proceed();
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/unit/SimpleInterceptorUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/unit/SimpleInterceptorUnitTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp999/unit/SimpleInterceptorUnitTestCase.java 2008-07-29 14:48:17 UTC (rev 76427)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejb3.test.jbpapp999.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.jbpapp999.Greeter;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test whether we can define an interceptor in the descriptor which is
+ * packaged in a java module of an ear.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SimpleInterceptorUnitTestCase extends JBossTestCase
+{
+ public SimpleInterceptorUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ serverFound();
+ }
+
+ public void test1() throws Exception
+ {
+ Greeter bean = (Greeter) getInitialContext().lookup("jbpapp999/GreeterBean/remote");
+
+ String actual = bean.sayHi("jbpapp999");
+
+ assertEquals("Intercepted Hi jbpapp999", actual);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(SimpleInterceptorUnitTestCase.class, "jbpapp999.ear");
+ }
+}
More information about the jboss-cvs-commits
mailing list