[jboss-cvs] JBossAS SVN: r95829 - projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 30 10:31:10 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-30 10:31:09 -0400 (Fri, 30 Oct 2009)
New Revision: 95829
Modified:
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/AnnotatedEJBReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/RemoteEnvironmentRefsGroupMetaData.java
Log:
- Annotations for EJB are a separate structure. EJB really IS special ... Hopefully this will still
comply with the ordering, which should only add injection targets.
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/AnnotatedEJBReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/AnnotatedEJBReferencesMetaData.java 2009-10-30 14:09:56 UTC (rev 95828)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/AnnotatedEJBReferencesMetaData.java 2009-10-30 14:31:09 UTC (rev 95829)
@@ -22,6 +22,7 @@
package org.jboss.metadata.javaee.spec;
import org.jboss.metadata.javaee.support.AbstractMappedMetaData;
+import org.jboss.metadata.javaee.support.AugmentableMetaData;
import org.jboss.metadata.javaee.support.JavaEEMetaDataUtil;
/**
@@ -32,6 +33,7 @@
*/
public class AnnotatedEJBReferencesMetaData
extends AbstractMappedMetaData<AnnotatedEJBReferenceMetaData>
+ implements AugmentableMetaData<AnnotatedEJBReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 1;
@@ -102,4 +104,29 @@
{
super("ejb local ref name");
}
+
+ public void augment(AnnotatedEJBReferencesMetaData augment, AnnotatedEJBReferencesMetaData main, boolean resolveConflicts)
+ {
+ for (AnnotatedEJBReferenceMetaData ejbReference : augment)
+ {
+ if (containsKey(ejbReference.getKey()))
+ {
+ if (!resolveConflicts && (main == null || !main.containsKey(ejbReference.getKey())))
+ {
+ throw new IllegalStateException("Unresolved conflict on EJB reference named: "
+ + ejbReference.getKey());
+ }
+ else
+ {
+ get(ejbReference.getKey()).augment(ejbReference,
+ (main != null) ? main.get(ejbReference.getKey()) : null, resolveConflicts);
+ }
+ }
+ else
+ {
+ add(ejbReference);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/RemoteEnvironmentRefsGroupMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/RemoteEnvironmentRefsGroupMetaData.java 2009-10-30 14:09:56 UTC (rev 95828)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/RemoteEnvironmentRefsGroupMetaData.java 2009-10-30 14:31:09 UTC (rev 95829)
@@ -601,6 +601,20 @@
getServiceReferences().augment(augment.getServiceReferences(),
(main != null) ? main.getServiceReferences() : null, resolveConflicts);
}
+ // EJB annotated references
+ // Note: Normally, this should be merged into regular EJB meta data, otherwise
+ // it will not respect the order. It should still work however, as it merely adds
+ // injection targets.
+ if (getAnnotatedEjbReferences() == null)
+ {
+ if (augment.getAnnotatedEjbReferences() != null)
+ setAnnotatedEjbReferences(augment.getAnnotatedEjbReferences());
+ }
+ else if (augment.getAnnotatedEjbReferences() != null)
+ {
+ getAnnotatedEjbReferences().augment(augment.getAnnotatedEjbReferences(),
+ (main != null) ? main.getAnnotatedEjbReferences() : null, resolveConflicts);
+ }
}
}
More information about the jboss-cvs-commits
mailing list