// Get at the MainDeployer
Object mainDeployer = Ejb3RegistrarLocator.locateRegistrar().lookup(MC_BEAN_NAME_MAIN_DEPLOYER);
assert mainDeployer instanceof DeployerClient && mainDeployer instanceof MainDeployerStructure : "Obtained Main Deployer is not of expected type";
DeployerClient dc = (DeployerClient) mainDeployer;
MainDeployerStructure mds = (MainDeployerStructure) mainDeployer;
// Loop through each Deployment
for (Deployment d : dc.getTopLevel())
{
// Get the associated DU
DeploymentUnit du = mds.getDeploymentUnit(d.getName());
// Ensure it's an EJB3 DU (by looking for the metadata)
JBossMetaData metadata = du.getAttachment(JBossMetaData.class);
if (metadata != null && metadata.isEJB3x())
{