You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/07/16 02:59:18 UTC
svn commit: r1147351 - in /openejb/trunk/openejb3:
container/openejb-core/src/main/java/org/apache/openejb/config/
container/openejb-core/src/main/resources/org/apache/openejb/config/rules/
tck/cdi-embedded/src/test/resources/
Author: dblevins
Date: Sat Jul 16 00:59:17 2011
New Revision: 1147351
URL: http://svn.apache.org/viewvc?rev=1147351&view=rev
Log:
OPENEJB-1600: EJB Specialization
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/all-failing.xml
openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/failing.xml
openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/passing.xml
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1147351&r1=1147350&r2=1147351&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Sat Jul 16 00:59:17 2011
@@ -1209,15 +1209,29 @@ public class AnnotationDeployer implemen
for (Class<?> specializingClass : sortClassesParentFirst(new ArrayList<Class<?>>(specializingClasses))) {
+
+ final Class<?> parent = specializingClass.getSuperclass();
+
+ if (parent == null || parent.equals(Object.class)) {
+ ejbModule.getValidation().fail(specializingClass.getSimpleName(), "specializes.extendsNothing", specializingClass.getName());
+ }
+
+ boolean found = false;
+
for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
final String ejbClass = enterpriseBean.getEjbClass();
- if (ejbClass != null && ejbClass.equals(specializingClass.getSuperclass().getName())) {
+ if (ejbClass != null && ejbClass.equals(parent.getName())) {
managedClasses.remove(ejbClass);
enterpriseBean.setEjbClass(specializingClass.getName());
+ found = true;
}
}
+
+ if (!found) {
+ ejbModule.getValidation().fail(specializingClass.getSimpleName(), "specializes.extendsSimpleBean", specializingClass.getName());
+ }
}
AssemblyDescriptor assemblyDescriptor = ejbModule.getEjbJar().getAssemblyDescriptor();
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties?rev=1147351&r1=1147350&r2=1147351&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/config/rules/Messages.properties Sat Jul 16 00:59:17 2011
@@ -863,4 +863,12 @@ public interface {0} extends {2}'{}'
1.ambiguousInterfaces = Ambiguous interface usage.
2.ambiguousInterfaces = Ambiguous interface usage. Apply @LocalBean to bean class or @Local or @Remote explicitly to at least one interface
-3.ambiguousInterfaces = Beans with multiple interfaces must explicitly indicate which type of view is required. At least one of the interface classes must be directly annotated @Local or @Remote or the bean class itself must be annotated @LocalBean. When in doubt annotate the bean class with @LocalBean.
\ No newline at end of file
+3.ambiguousInterfaces = Beans with multiple interfaces must explicitly indicate which type of view is required. At least one of the interface classes must be directly annotated @Local or @Remote or the bean class itself must be annotated @LocalBean. When in doubt annotate the bean class with @LocalBean.
+
+1.specializes.extendsNothing = @Specializes class extends nothing
+2.specializes.extendsNothing = @Specializes class extends nothing: {0}
+3.specializes.extendsNothing = Class annotated with @Specializes must extend another bean. The concept of specialization is a step beyond Java inheritance in that an @Specializes bean fully replaces another beans role in the system, inheriting all its meta-data in the process. The @Specializes bean must directly subclass the bean it replaces. Please fix class {0}.
+
+1.specializes.extendsSimpleBean = @Specializes EJB extends non-EJB
+2.specializes.extendsSimpleBean = @Specializes EJB extends non-EJB {0}
+3.specializes.extendsSimpleBean = EJB class annotated with @Specializes must extend another EJB. The concept of specialization is a step beyond Java inheritance in that an @Specializes bean fully replaces another beans role in the system, inheriting all its meta-data in the process. The @Specializes EJB must directly subclass the bean it replaces and that bean must also be an EJB. Please fix class {0}.
Modified: openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/all-failing.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/all-failing.xml?rev=1147351&r1=1147350&r2=1147351&view=diff
==============================================================================
--- openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/all-failing.xml (original)
+++ openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/all-failing.xml Sat Jul 16 00:59:17 2011
@@ -43,9 +43,6 @@
<class name="org.jboss.jsr299.tck.tests.implementation.simple.resource.env.EnvInjectionTest"/>
<class name="org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext.PersistenceContextInjectionTest"/>
<class name="org.jboss.jsr299.tck.tests.implementation.simple.resource.resource.InjectionOfResourceTest"/>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsNothing.DirectlyExtendsNothingTest"/>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsSimpleBean.DirectlyExtendsSimpleBeanTest"/>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.implementInterfaceAndExtendsNothing.ImplementsInterfaceAndExtendsNothingTest"/>
<class name="org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer.ClientProxyTest"/>
<class name="org.jboss.jsr299.tck.tests.lookup.el.ResolutionByNameTest"/>
<class name="org.jboss.jsr299.tck.tests.lookup.el.integration.IntegrationWithUnifiedELTest"/>
Modified: openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/failing.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/failing.xml?rev=1147351&r1=1147350&r2=1147351&view=diff
==============================================================================
--- openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/failing.xml (original)
+++ openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/failing.xml Sat Jul 16 00:59:17 2011
@@ -26,12 +26,12 @@
<!--<package name="org.jboss.jsr299.tck.interceptors.tests.*"/>-->
<!--</packages>-->
<classes>
- <class name="org.jboss.jsr299.tck.tests.context.session.SessionContextTest"/>
- <class name="org.jboss.jsr299.tck.tests.deployment.packaging.bundledLibrary.LibraryInEarTest"/>
+ <!--<class name="org.jboss.jsr299.tck.tests.context.session.SessionContextTest"/>-->
+ <!--<class name="org.jboss.jsr299.tck.tests.deployment.packaging.bundledLibrary.LibraryInEarTest"/>-->
<class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsNothing.DirectlyExtendsNothingTest"/>
<class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsSimpleBean.DirectlyExtendsSimpleBeanTest"/>
<class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.implementInterfaceAndExtendsNothing.ImplementsInterfaceAndExtendsNothingTest"/>
- <class name="org.jboss.jsr299.tck.tests.lookup.el.integration.IntegrationWithUnifiedELTest"/>
+ <!--<class name="org.jboss.jsr299.tck.tests.lookup.el.integration.IntegrationWithUnifiedELTest"/>-->
</classes>
</test>
</suite>
Modified: openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/passing.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/passing.xml?rev=1147351&r1=1147350&r2=1147351&view=diff
==============================================================================
--- openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/passing.xml (original)
+++ openejb/trunk/openejb3/tck/cdi-embedded/src/test/resources/passing.xml Sat Jul 16 00:59:17 2011
@@ -149,21 +149,6 @@
<exclude name="testProduceResourceProxy"/>
</methods>
</class>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsNothing.DirectlyExtendsNothingTest">
- <methods>
- <exclude name="testSpecializingClassDirectlyExtendsNothing"/>
- </methods>
- </class>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.directlyExtendsSimpleBean.DirectlyExtendsSimpleBeanTest">
- <methods>
- <exclude name="testSpecializingClassDirectlyExtendsSimpleBean"/>
- </methods>
- </class>
- <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.broken.implementInterfaceAndExtendsNothing.ImplementsInterfaceAndExtendsNothingTest">
- <methods>
- <exclude name="testSpecializingClassImplementsInterfaceAndExtendsNothing"/>
- </methods>
- </class>
<class name="org.jboss.jsr299.tck.tests.lookup.clientProxy.incontainer.ClientProxyTest">
<methods>
<exclude name="testInvocationIsProcessedOnCurrentInstance"/>