resource-env-ref/resource-env-ref-name.
*/
if(specEnv != null)
{
ResourceEnvironmentReferencesMetaData specEnvRefs = specEnv.getResourceEnvironmentReferences();
MessageDestinationReferencesMetaData specMsgRefs = specEnv.getMessageDestinationReferences();
MessageDestinationReferencesMetaData msgRefs = jndiEnvironmentRefsGroup.getMessageDestinationReferences();
if(msgRefs == null)
{
msgRefs = new MessageDestinationReferencesMetaData();
jndiEnvironmentRefsGroup.setMessageDestinationReferences(msgRefs);
}
if(specMsgRefs != null)
for(MessageDestinationReferenceMetaData ref : specMsgRefs)
{
ref = (MessageDestinationReferenceMetaData)ref.clone();
String link = ref.getLink();
if (link != null)
{
ArrayList<MessageDestinationReferenceMetaData> linkedRefs = resourceEnvReferenceLinks.get(link);
if (linkedRefs == null)
{
linkedRefs = new ArrayList<MessageDestinationReferenceMetaData>();
resourceEnvReferenceLinks.put(link, linkedRefs);
}
linkedRefs.add(ref);
}
if(msgRefs.contains(ref) == false)
msgRefs.add(ref);
else
{
MessageDestinationReferenceMetaData existingRef = msgRefs.get(ref.getMessageDestinationRefName());
existingRef.merge(null, ref);
}
}
// Merge the spec resource-env-refs
if(resEnvRefs != null && specEnvRefs != null)
for(ResourceEnvironmentReferenceMetaData ref : resEnvRefs)
{
String resRefName = ref.getResourceEnvRefName();
ResourceEnvironmentReferenceMetaData specRef = specEnvRefs.get(resRefName);
if (specRef == null)
{
// Try the resourceEnvReferenceLinks
ArrayList<MessageDestinationReferenceMetaData> linkedRefs = resourceEnvReferenceLinks.get(resRefName);
if (linkedRefs != null)
{
for(MessageDestinationReferenceMetaData mref : linkedRefs)
{
// Need to make sure this is the ref in the map
MessageDestinationReferenceMetaData existingRef = msgRefs.get(mref.getMessageDestinationRefName());
if(existingRef.getIgnoreDependency() != null)
ref.setIgnoreDependency(mref.getIgnoreDependency());
if(existingRef.getType() != null)
ref.setType(mref.getType());
existingRef.setMappedName(ref.getMappedName());
}
}
else if(msgRefs.containsKey(resRefName))
{
MessageDestinationReferenceMetaData mref = msgRefs.get(resRefName);
mref.setMappedName(ref.getMappedName());
}
else
{
throw new IllegalStateException("resource-env-ref " + resRefName + " found in jboss-client.xml but not in application-client.xml");