[jboss-cvs] JBossAS SVN: r95641 - 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
Tue Oct 27 21:40:58 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-27 21:40:57 -0400 (Tue, 27 Oct 2009)
New Revision: 95641
Modified:
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/DataSourcesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBLocalReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentEntriesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentRefsGroupMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/LifecycleCallbacksMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationsMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceContextReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceUnitReferencesMetaData.java
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/ResourceEnvironmentReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceInjectionMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceReferencesMetaData.java
projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ServiceReferencesMetaData.java
Log:
- Implement the Servlet 3.0 augment() meta data merge for EE elements.
- TODO for the data source annotation (which needs to exist in the API).
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/DataSourcesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/DataSourcesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/DataSourcesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -63,7 +63,21 @@
public void augment(DataSourcesMetaData webFragmentMetaData, DataSourcesMetaData webMetaData)
{
- // TODO
+ for (DataSourceMetaData dataSourceMetaData : webFragmentMetaData)
+ {
+ if (containsKey(dataSourceMetaData.getKey()))
+ {
+ if (webMetaData == null || !webMetaData.containsKey(dataSourceMetaData.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on data source named: "
+ + dataSourceMetaData.getKey());
+ }
+ }
+ else
+ {
+ add(dataSourceMetaData);
+ }
+ }
}
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBLocalReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBLocalReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBLocalReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class EJBLocalReferencesMetaData extends AbstractMappedMetaData<EJBLocalReferenceMetaData>
+ implements AugmentableMetaData<EJBLocalReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -7264371854666919529L;
@@ -65,4 +67,29 @@
{
super("ejb local ref name");
}
+
+ public void augment(EJBLocalReferencesMetaData augment, EJBLocalReferencesMetaData main)
+ {
+ for (EJBLocalReferenceMetaData ejbLocalReference : augment)
+ {
+ if (containsKey(ejbLocalReference.getKey()))
+ {
+ if (main == null || !main.containsKey(ejbLocalReference.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on ejb local reference named: "
+ + ejbLocalReference.getKey());
+ }
+ else
+ {
+ get(ejbLocalReference.getKey()).augment(ejbLocalReference,
+ (main != null) ? main.get(ejbLocalReference.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(ejbLocalReference);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EJBReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class EJBReferencesMetaData extends AbstractMappedMetaData<EJBReferenceMetaData>
+ implements AugmentableMetaData<EJBReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 605087131047162516L;
@@ -65,4 +67,29 @@
{
super("ejb ref name");
}
+
+ public void augment(EJBReferencesMetaData augment, EJBReferencesMetaData main)
+ {
+ for (EJBReferenceMetaData ejbReference : augment)
+ {
+ if (containsKey(ejbReference.getKey()))
+ {
+ if (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);
+ }
+ }
+ else
+ {
+ add(ejbReference);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentEntriesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentEntriesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentEntriesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -22,6 +22,7 @@
package org.jboss.metadata.javaee.spec;
import org.jboss.metadata.javaee.support.AbstractMappedMetaData;
+import org.jboss.metadata.javaee.support.AugmentableMetaData;
/**
* EnvironmentEntriesMetaData.
@@ -30,6 +31,7 @@
* @version $Revision: 1.1 $
*/
public class EnvironmentEntriesMetaData extends AbstractMappedMetaData<EnvironmentEntryMetaData>
+ implements AugmentableMetaData<EnvironmentEntriesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -7573363440492577599L;
@@ -41,4 +43,29 @@
{
super("env entry name");
}
+
+ public void augment(EnvironmentEntriesMetaData augment, EnvironmentEntriesMetaData main)
+ {
+ for (EnvironmentEntryMetaData envEntry : augment)
+ {
+ if (containsKey(envEntry.getKey()))
+ {
+ if (main == null || !main.containsKey(envEntry.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on environment entry named: "
+ + envEntry.getKey());
+ }
+ else
+ {
+ get(envEntry.getKey()).augment(envEntry,
+ (main != null) ? main.get(envEntry.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(envEntry);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentRefsGroupMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentRefsGroupMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/EnvironmentRefsGroupMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -191,12 +191,40 @@
super.augment(augment, main);
EnvironmentRefsGroupMetaData augmentE = (EnvironmentRefsGroupMetaData) augment;
EnvironmentRefsGroupMetaData mainE = (EnvironmentRefsGroupMetaData) main;
- // TODO
+
// Data sources
+ if (getDataSources() == null)
+ {
+ setDataSources(augmentE.getDataSources());
+ }
+ else if (augmentE.getDataSources() != null)
+ {
+ getDataSources().augment(augmentE.getDataSources(), (mainE != null) ? mainE.getDataSources() : null);
+ }
// EJB local references
+ if (getEjbLocalReferences() == null)
+ {
+ if (augmentE.getEjbLocalReferences() != null)
+ setEjbLocalReferences(augmentE.getEjbLocalReferences());
+ }
+ else if (augmentE.getEjbLocalReferences() != null)
+ {
+ getEjbLocalReferences().augment(augmentE.getEjbLocalReferences(),
+ (mainE != null) ? mainE.getEjbLocalReferences() : null);
+ }
// Persistence context refs
+ if (getPersistenceContextRefs() == null)
+ {
+ if (augmentE.getPersistenceContextRefs() != null)
+ setPersistenceContextRefs(augmentE.getPersistenceContextRefs());
+ }
+ else if (augmentE.getPersistenceContextRefs() != null)
+ {
+ getPersistenceContextRefs().augment(augmentE.getPersistenceContextRefs(),
+ (mainE != null) ? mainE.getPersistenceContextRefs() : null);
+ }
}
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/LifecycleCallbacksMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/LifecycleCallbacksMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/LifecycleCallbacksMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -29,6 +29,8 @@
import java.util.List;
import java.util.Set;
+import org.jboss.metadata.javaee.support.AugmentableMetaData;
+
/**
* LifecycleCallbacksMetaData.
*
@@ -36,6 +38,7 @@
* @version $Revision: 1.1 $
*/
public class LifecycleCallbacksMetaData extends ArrayList<LifecycleCallbackMetaData>
+ implements AugmentableMetaData<LifecycleCallbacksMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -3843612778667898679L;
@@ -120,4 +123,22 @@
throw new IllegalStateException("Failed to get callback method in class " + className + ": " + methodName, e);
}
}
+
+ public void augment(LifecycleCallbacksMetaData augment, LifecycleCallbacksMetaData main)
+ {
+ if (main != null && main.size() > 0)
+ {
+ // If main contains lifecycle callbacks, drop the all lifecycle callbacks
+ clear();
+ }
+ else
+ {
+ // Add injection targets
+ if (augment != null)
+ {
+ addAll(augment);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import org.jboss.metadata.javaee.support.AugmentableMetaData;
import org.jboss.metadata.javaee.support.MergeableMappedMetaData;
import org.jboss.metadata.javaee.support.NamedMetaDataWithDescriptionGroup;
@@ -34,7 +35,8 @@
* @version $Revision: 1.1 $
*/
@XmlType(name="message-destinationType", propOrder={"descriptionGroup", "messageDestinationName", "jndiName", "mappedName", "lookupName"})
-public class MessageDestinationMetaData extends NamedMetaDataWithDescriptionGroup implements MergeableMappedMetaData<MessageDestinationMetaData>
+public class MessageDestinationMetaData extends NamedMetaDataWithDescriptionGroup
+ implements MergeableMappedMetaData<MessageDestinationMetaData>, AugmentableMetaData<MessageDestinationMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 2129990191983873784L;
@@ -164,4 +166,36 @@
else if (original.lookupName != null)
setLookupName(original.lookupName);
}
+
+ public void augment(MessageDestinationMetaData augment,
+ MessageDestinationMetaData main)
+ {
+ // Mapped name
+ if (getMappedName() == null)
+ {
+ setMappedName(augment.getMappedName());
+ }
+ else if (augment.getMappedName() != null)
+ {
+ if (main != null && !getMappedName().equals(augment.getMappedName())
+ && main.getMappedName() == null)
+ {
+ throw new IllegalStateException("Unresolved conflict on mapped name: " + getMappedName());
+ }
+ }
+ // Lookup name
+ if (getLookupName() == null)
+ {
+ setLookupName(augment.getLookupName());
+ }
+ else if (augment.getLookupName() != null)
+ {
+ if (main != null && !getLookupName().equals(augment.getLookupName())
+ && main.getLookupName() == null)
+ {
+ throw new IllegalStateException("Unresolved conflict on lookup name: " + getLookupName());
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class MessageDestinationReferencesMetaData extends AbstractMappedMetaData<MessageDestinationReferenceMetaData>
+ implements AugmentableMetaData<MessageDestinationReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -5571423286458126147L;
@@ -66,4 +68,29 @@
{
super("message destination ref name");
}
+
+ public void augment(MessageDestinationReferencesMetaData augment, MessageDestinationReferencesMetaData main)
+ {
+ for (MessageDestinationReferenceMetaData messageDestinationRef : augment)
+ {
+ if (containsKey(messageDestinationRef.getKey()))
+ {
+ if (main == null || !main.containsKey(messageDestinationRef.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on message destination reference named: "
+ + messageDestinationRef.getKey());
+ }
+ else
+ {
+ get(messageDestinationRef.getKey()).augment(messageDestinationRef,
+ (main != null) ? main.get(messageDestinationRef.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(messageDestinationRef);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationsMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationsMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/MessageDestinationsMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -80,6 +80,17 @@
public void augment(MessageDestinationsMetaData augment,
MessageDestinationsMetaData main)
{
- // TODO
+ for (MessageDestinationMetaData messageDestinationMetaData : augment)
+ {
+ if (containsKey(messageDestinationMetaData.getKey()))
+ {
+ get(messageDestinationMetaData.getKey()).augment(messageDestinationMetaData,
+ (main != null) ? main.get(messageDestinationMetaData.getKey()) : null);
+ }
+ else
+ {
+ add(messageDestinationMetaData);
+ }
+ }
}
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceContextReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceContextReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceContextReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class PersistenceContextReferencesMetaData extends AbstractMappedMetaData<PersistenceContextReferenceMetaData>
+ implements AugmentableMetaData<PersistenceContextReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 75353633724235761L;
@@ -56,4 +58,29 @@
{
super("persistence-context-ref-name");
}
+
+ public void augment(PersistenceContextReferencesMetaData augment, PersistenceContextReferencesMetaData main)
+ {
+ for (PersistenceContextReferenceMetaData persistenceContextReference : augment)
+ {
+ if (containsKey(persistenceContextReference.getKey()))
+ {
+ if (main == null || !main.containsKey(persistenceContextReference.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on persistence context reference named: "
+ + persistenceContextReference.getKey());
+ }
+ else
+ {
+ get(persistenceContextReference.getKey()).augment(persistenceContextReference,
+ (main != null) ? main.get(persistenceContextReference.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(persistenceContextReference);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceUnitReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceUnitReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/PersistenceUnitReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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.merge.MergeUtil;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class PersistenceUnitReferencesMetaData extends AbstractMappedMetaData<PersistenceUnitReferenceMetaData>
+ implements AugmentableMetaData<PersistenceUnitReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 5762149182578142090L;
@@ -47,4 +49,29 @@
{
MergeUtil.merge(this, override, original);
}
+
+ public void augment(PersistenceUnitReferencesMetaData augment, PersistenceUnitReferencesMetaData main)
+ {
+ for (PersistenceUnitReferenceMetaData persistenceUnitRef : augment)
+ {
+ if (containsKey(persistenceUnitRef.getKey()))
+ {
+ if (main == null || !main.containsKey(persistenceUnitRef.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on persistence unit reference named: "
+ + persistenceUnitRef.getKey());
+ }
+ else
+ {
+ get(persistenceUnitRef.getKey()).augment(persistenceUnitRef,
+ (main != null) ? main.get(persistenceUnitRef.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(persistenceUnitRef);
+ }
+ }
+ }
+
}
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-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/RemoteEnvironmentRefsGroupMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -503,7 +503,104 @@
public void augment(RemoteEnvironmentRefsGroupMetaData augment, RemoteEnvironmentRefsGroupMetaData main)
{
- // TODO
+ // EJB references
+ if (getEjbReferences() == null)
+ {
+ if (augment.getEjbReferences() != null)
+ setEjbReferences(augment.getEjbReferences());
+ }
+ else if (augment.getEjbReferences() != null)
+ {
+ getEjbReferences().augment(augment.getEjbReferences(),
+ (main != null) ? main.getEjbReferences() : null);
+ }
+ // Environment entries
+ if (getEnvironmentEntries() == null)
+ {
+ if (augment.getEnvironmentEntries() != null)
+ setEnvironmentEntries(augment.getEnvironmentEntries());
+ }
+ else if (augment.getEnvironmentEntries() != null)
+ {
+ getEnvironmentEntries().augment(augment.getEnvironmentEntries(),
+ (main != null) ? main.getEnvironmentEntries() : null);
+ }
+ // Message destination references
+ if (getMessageDestinationReferences() == null)
+ {
+ if (augment.getMessageDestinationReferences() != null)
+ setMessageDestinationReferences(augment.getMessageDestinationReferences());
+ }
+ else if (augment.getMessageDestinationReferences() != null)
+ {
+ getMessageDestinationReferences().augment(augment.getMessageDestinationReferences(),
+ (main != null) ? main.getMessageDestinationReferences() : null);
+ }
+ // Persistence unit references
+ if (getPersistenceUnitRefs() == null)
+ {
+ if (augment.getPersistenceUnitRefs() != null)
+ setPersistenceUnitRefs(augment.getPersistenceUnitRefs());
+ }
+ else if (augment.getPersistenceUnitRefs() != null)
+ {
+ getPersistenceUnitRefs().augment(augment.getPersistenceUnitRefs(),
+ (main != null) ? main.getPersistenceUnitRefs() : null);
+ }
+ // Post construct
+ if (getPostConstructs() == null)
+ {
+ if (augment.getPostConstructs() != null)
+ setPostConstructs(augment.getPostConstructs());
+ }
+ else if (augment.getPostConstructs() != null)
+ {
+ getPostConstructs().augment(augment.getPostConstructs(),
+ (main != null) ? main.getPostConstructs() : null);
+ }
+ // Pre destroy
+ if (getPreDestroys() == null)
+ {
+ if (augment.getPreDestroys() != null)
+ setPreDestroys(augment.getPreDestroys());
+ }
+ else if (augment.getPreDestroys() != null)
+ {
+ getPreDestroys().augment(augment.getPreDestroys(),
+ (main != null) ? main.getPreDestroys() : null);
+ }
+ // Resource environment references
+ if (getResourceEnvironmentReferences() == null)
+ {
+ if (augment.getResourceEnvironmentReferences() != null)
+ setResourceEnvironmentReferences(augment.getResourceEnvironmentReferences());
+ }
+ else if (augment.getResourceEnvironmentReferences() != null)
+ {
+ getResourceEnvironmentReferences().augment(augment.getResourceEnvironmentReferences(),
+ (main != null) ? main.getResourceEnvironmentReferences() : null);
+ }
+ // Resource references
+ if (getResourceReferences() == null)
+ {
+ if (augment.getResourceReferences() != null)
+ setResourceReferences(augment.getResourceReferences());
+ }
+ else if (augment.getResourceReferences() != null)
+ {
+ getResourceReferences().augment(augment.getResourceReferences(),
+ (main != null) ? main.getResourceReferences() : null);
+ }
+ // Service reference
+ if (getServiceReferences() == null)
+ {
+ setServiceReferences(augment.getServiceReferences());
+ }
+ else if (augment.getServiceReferences() != null)
+ {
+ getServiceReferences().augment(augment.getServiceReferences(),
+ (main != null) ? main.getServiceReferences() : null);
+ }
}
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceEnvironmentReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceEnvironmentReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceEnvironmentReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class ResourceEnvironmentReferencesMetaData extends AbstractMappedMetaData<ResourceEnvironmentReferenceMetaData>
+ implements AugmentableMetaData<ResourceEnvironmentReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -1586023682859221620L;
@@ -63,4 +65,29 @@
{
super("resource env ref name");
}
+
+ public void augment(ResourceEnvironmentReferencesMetaData augment, ResourceEnvironmentReferencesMetaData main)
+ {
+ for (ResourceEnvironmentReferenceMetaData resourceEnvRef : augment)
+ {
+ if (containsKey(resourceEnvRef.getKey()))
+ {
+ if (main == null || !main.containsKey(resourceEnvRef.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on resource environment reference named: "
+ + resourceEnvRef.getKey());
+ }
+ else
+ {
+ get(resourceEnvRef.getKey()).augment(resourceEnvRef,
+ (main != null) ? main.get(resourceEnvRef.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(resourceEnvRef);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceInjectionMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceInjectionMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceInjectionMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -26,6 +26,7 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
+import org.jboss.metadata.javaee.support.AugmentableMetaData;
import org.jboss.metadata.javaee.support.NamedMetaData;
/**
@@ -35,6 +36,7 @@
* @version $Revision: 1.1 $
*/
public abstract class ResourceInjectionMetaData extends NamedMetaData
+ implements AugmentableMetaData<ResourceInjectionMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = 6333738851813890701L;
@@ -210,4 +212,26 @@
else if (original != null && original.injectionTargets != null)
setInjectionTargets(original.injectionTargets);
}
+
+ public void augment(ResourceInjectionMetaData augment, ResourceInjectionMetaData main)
+ {
+ if (main != null && main.getInjectionTargets() != null)
+ {
+ // If main contains injection target, drop the all injection targets
+ injectionTargets = null;
+ }
+ else
+ {
+ // Add injection targets
+ if (getInjectionTargets() == null)
+ {
+ injectionTargets = augment.getInjectionTargets();
+ }
+ else if (augment.getInjectionTargets() != null)
+ {
+ getInjectionTargets().addAll(augment.getInjectionTargets());
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ResourceReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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;
/**
@@ -31,6 +32,7 @@
* @version $Revision: 1.1 $
*/
public class ResourceReferencesMetaData extends AbstractMappedMetaData<ResourceReferenceMetaData>
+ implements AugmentableMetaData<ResourceReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -6067974868675929921L;
@@ -63,4 +65,29 @@
{
super("resource ref name");
}
+
+ public void augment(ResourceReferencesMetaData augment, ResourceReferencesMetaData main)
+ {
+ for (ResourceReferenceMetaData resourceRef : augment)
+ {
+ if (containsKey(resourceRef.getKey()))
+ {
+ if (main == null || !main.containsKey(resourceRef.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on resource reference named: "
+ + resourceRef.getKey());
+ }
+ else
+ {
+ get(resourceRef.getKey()).augment(resourceRef,
+ (main != null) ? main.get(resourceRef.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(resourceRef);
+ }
+ }
+ }
+
}
Modified: projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ServiceReferencesMetaData.java
===================================================================
--- projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ServiceReferencesMetaData.java 2009-10-28 00:20:38 UTC (rev 95640)
+++ projects/metadata/common/trunk/src/main/java/org/jboss/metadata/javaee/spec/ServiceReferencesMetaData.java 2009-10-28 01:40:57 UTC (rev 95641)
@@ -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 ServiceReferencesMetaData
extends AbstractMappedMetaData<ServiceReferenceMetaData>
+ implements AugmentableMetaData<ServiceReferencesMetaData>
{
/** The serialVersionUID */
private static final long serialVersionUID = -2667900705228419782L;
@@ -63,5 +65,29 @@
ServiceReferencesMetaData merged = new ServiceReferencesMetaData();
return JavaEEMetaDataUtil.merge(merged, overriden, override, "service-ref", overridenFile, overrideFile, true);
}
+
+ public void augment(ServiceReferencesMetaData augment, ServiceReferencesMetaData main)
+ {
+ for (ServiceReferenceMetaData serviceRef : augment)
+ {
+ if (containsKey(serviceRef.getKey()))
+ {
+ if (main == null || !main.containsKey(serviceRef.getKey()))
+ {
+ throw new IllegalStateException("Unresolved conflict on service reference named: "
+ + serviceRef.getKey());
+ }
+ else
+ {
+ get(serviceRef.getKey()).augment(serviceRef,
+ (main != null) ? main.get(serviceRef.getKey()) : null);
+ }
+ }
+ else
+ {
+ add(serviceRef);
+ }
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list