@Override
  public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit du = phaseContext.getDeploymentUnit();

    if (GateInConfiguration.isGateInArchive(du)) {
      log.info("Module is on GateIn Extension modules list");
      final GateInConfiguration config = du.getAttachment(GateInConfigurationKey.KEY);

      final ServiceName initSvcName =
          GateInExtension.deploymentUnitName(config.getGateInEarModule(), "gatein", "init");
      final ServiceTarget target = phaseContext.getServiceTarget();

      if (du.getAttachment(GateInEarKey.KEY) != null) {
        // Install InitService with dependency on all the deployment modules reaching POST_MODULE
        // TODO: we are starting up InitService before child modules (jboss.deployment.subunit.*)
        // have gone through POST_MODULE
        final ServiceBuilder<InitService> builder =
            target
                .addService(initSvcName, new InitService(config))
                .addDependency(
                    GateInExtension.deploymentUnitName(
                        config.getGateInEarModule(), Phase.POST_MODULE));

        for (ModuleIdentifier module : config.getGateInExtModules()) {
          builder.addDependency(GateInExtension.deploymentUnitName(module, Phase.POST_MODULE));
        }
        builder.install();
        log.info("Installed " + initSvcName);
      }
      // all gatein deployment modules use InitService as barrier on POST_MODULE to ensure
      // they are all available on the classpath when init time resource loading takes place
      phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, initSvcName);
      log.info("Added NEXT_PHASE_DEP on " + initSvcName);
    }
  }
  @Override
  public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();

    final CompositeIndex index =
        deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);

    for (final JaxrsAnnotations annotation : JaxrsAnnotations.values()) {
      if (!index.getAnnotations(annotation.getDotName()).isEmpty()) {
        JaxrsDeploymentMarker.mark(deploymentUnit);
        phaseContext.addToAttachmentList(
            Attachments.NEXT_PHASE_DEPS, Services.JBOSS_MODULE_INDEX_SERVICE);
        return;
      }
    }
  }
 /** {@inheritDoc} */
 public void deploy(final DeploymentPhaseContext phaseContext)
     throws DeploymentUnitProcessingException {
   final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
   final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
   for (ResourceRoot resourceRoot : resourceRoots) {
     final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST);
     if (manifest == null) {
       // no class path to process!
       continue;
     }
     final Attributes mainAttributes = manifest.getMainAttributes();
     final String extensionListString = mainAttributes.getValue(EXTENSION_LIST);
     if (extensionListString == null) {
       // no entry
       continue;
     }
     final String[] items = extensionListString.split("\\s+");
     boolean added = false;
     for (String item : items) {
       final String extensionName = mainAttributes.getValue(item + "-" + EXTENSION_NAME);
       if (extensionName == null) {
         ServerLogger.DEPLOYMENT_LOGGER.extensionMissingManifestAttribute(
             item, item, EXTENSION_NAME);
         continue;
       }
       final String specificationVersion =
           mainAttributes.getValue(item + "-" + SPECIFICATION_VERSION);
       final String implementationVersion =
           mainAttributes.getValue(item + "-" + IMPLEMENTATION_VERSION);
       final String implementationVendorId =
           mainAttributes.getValue(item + "-" + IMPLEMENTATION_VENDOR_ID);
       final String implementationUrl = mainAttributes.getValue(item + "-" + IMPLEMENTATION_URL);
       URI implementationUri = null;
       if (implementationUrl == null) {
         ServerLogger.DEPLOYMENT_LOGGER.debugf(
             "Extension %s is missing the required manifest attribute %s-%s",
             item, item, IMPLEMENTATION_URL);
       } else {
         try {
           implementationUri = new URI(implementationUrl);
         } catch (URISyntaxException e) {
           ServerLogger.DEPLOYMENT_LOGGER.invalidExtensionURI(item, e);
         }
       }
       resourceRoot.addToAttachmentList(
           Attachments.EXTENSION_LIST_ENTRIES,
           new ExtensionListEntry(
               item,
               extensionName,
               specificationVersion,
               implementationVersion,
               implementationVendorId,
               implementationUri));
       added = true;
     }
     if (added) {
       // Require the extension list before we proceed
       phaseContext.addToAttachmentList(
           Attachments.NEXT_PHASE_DEPS, Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX);
     }
   }
 }