// FIXME This should all be in a seperate deployer
@Override
protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
{
EarMetaData specMetaData = unit.getAttachment(EarMetaData.class);
JBossAppMetaData metaData = unit.getAttachment(JBossAppMetaData.class); // from ear contents deployer
// do parse
super.createMetaData(unit, name, suffix);
// new parsed metadata
JBossAppMetaData parsed = unit.getAttachment(JBossAppMetaData.class);
if (metaData != null && parsed != null)
{
ModulesMetaData mmd = metaData.getModules();
if (mmd != null && mmd.isEmpty() == false)
{
ModulesMetaData parsedMMD = parsed.getModules();
if (parsedMMD == null)
{
parsedMMD = new ModulesMetaData();
parsed.setModules(parsedMMD);
}
parsedMMD.merge(parsedMMD, mmd);
}
}
// parsed is the one we use after merged modules
metaData = parsed;
if(specMetaData == null && metaData == null)
return;
// If there no JBossMetaData was created from a jboss-app.xml, create one
if (metaData == null)
metaData = new JBossAppMetaData();
// Create a merged view
JBossAppMetaData mergedMetaData = new JBossAppMetaData();
mergedMetaData.merge(metaData, specMetaData);
// Set the merged as the output
unit.getTransientManagedObjects().addAttachment(JBossAppMetaData.class, mergedMetaData);
// Keep the raw parsed metadata as well
unit.addAttachment("Raw"+JBossAppMetaData.class.getName(), metaData, JBossAppMetaData.class);
// Pass the ear callByValue setting