// Wait to the last GateIn archive deployment unit install
// Then enumerate all the child components which should all be scheduled for startup at that point
// to get the dependencies for StartupService
if (GateInConfiguration.isGateInArchive(du)) {
final GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);
final ModuleIdentifier moduleId = du.getAttachment(Attachments.MODULE_IDENTIFIER);
if (isLastModuleStarting(config, moduleId)) {
final StartupService startup = new StartupService();
startup.setGateInModule(du.getAttachment(Attachments.MODULE));
final ServiceBuilder<StartupService> builder = phaseContext.getServiceTarget().addService(
StartupService.SERVICE_NAME, startup);
builder.addDependency(GateInExtension.deploymentUnitName(config.getGateInEarModule(), Phase.CLEANUP));
for (ModuleIdentifier id : config.getGateInExtModules()) {
builder.addDependency(GateInExtension.deploymentUnitName(id, Phase.CLEANUP));
}
// Looks like web archives are completely covered by jboss.web services
for (ServiceName svcName : config.getChildWars()) {
builder.addDependency(svcName);
}
// Subunit not necessary for web archives - but might be necessary for non-web
for (ServiceName svcName : config.getChildSubUnits()) {
builder.addDependency(svcName.append(Phase.CLEANUP.name()));
}
// Subcomponents not necessary for web archives - but might necessary for non-web
List<String> prefixes = config.getChildSubUnitComponentPrefixes();
for (ServiceName name : du.getServiceRegistry().getServiceNames()) {
for (String prefix : prefixes) {
if (name.getCanonicalName().startsWith(prefix)) {
builder.addDependency(name);
}