final List<ResourceRoot> roots = deploymentUnit.getAttachmentList(org.jboss.as.server.deployment.Attachments.RESOURCE_ROOTS); if(roots != null) for(ResourceRoot root : roots) { if(SubDeploymentMarker.isSubDeployment(root)) { final ResourceRoot parentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final String relativePath = root.getRoot().getPathNameRelativeTo(parentRoot.getRoot());
if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) { if (isClassesRoot(resourceRoot)) { continue; // this is handled below
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { final VirtualFile rootFile = resourceRoot.getRoot(); if (!SubDeploymentMarker.isSubDeployment(resourceRoot)) { final VirtualFile sarDescriptor = rootFile .getChild(ServiceDeploymentParsingProcessor.SERVICE_DESCRIPTOR_PATH); if (sarDescriptor.exists()) { SubDeploymentMarker.mark(resourceRoot); ModuleRootMarker.mark(resourceRoot); } } } }
List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : structure) { if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) { if (resourceRoot.getRootName().equals("classes")) {
if (! SubDeploymentMarker.isSubDeployment(r)) { resources.add(r);
private static void handleEarDeployment(DeploymentPhaseContext phaseContext, boolean startEarly, Platform platform) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (isEarDeployment(deploymentUnit) && JPADeploymentMarker.isJPADeployment(deploymentUnit)) { // handle META-INF/persistence.xml final List<ResourceRoot> deploymentRoots = DeploymentUtils.allResourceRoots(deploymentUnit); for (final ResourceRoot root : deploymentRoots) { if (!SubDeploymentMarker.isSubDeployment(root)) { PersistenceUnitMetadataHolder holder; ArrayList<PersistenceUnitMetadataHolder> puList = new ArrayList<PersistenceUnitMetadataHolder>(1); if (root != null && (holder = root.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS)) != null && holder.getPersistenceUnits().size() > 0) { // assemble and install the PU service puList.add(holder); } ROOT_LOGGER.tracef("install persistence unit definitions for ear %s", root.getRootName()); addPuService(phaseContext, puList, startEarly, platform); } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.hasAttachment(Attachments.MODULE) && deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_ROOT)) { // don't process sub-deployments final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (SubDeploymentMarker.isSubDeployment(root)) return; if (!processDeploymentLogging(deploymentUnit, root)) { processLoggingProfiles(deploymentUnit, root); } } }
private static void handleEarDeployment(DeploymentPhaseContext phaseContext, boolean startEarly, Platform platform) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (isEarDeployment(deploymentUnit) && JPADeploymentMarker.isJPADeployment(deploymentUnit)) { // handle META-INF/persistence.xml final List<ResourceRoot> deploymentRoots = DeploymentUtils.allResourceRoots(deploymentUnit); for (final ResourceRoot root : deploymentRoots) { if (!SubDeploymentMarker.isSubDeployment(root)) { PersistenceUnitMetadataHolder holder; ArrayList<PersistenceUnitMetadataHolder> puList = new ArrayList<PersistenceUnitMetadataHolder>(1); if (root != null && (holder = root.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS)) != null && holder.getPersistenceUnits().size() > 0) { // assemble and install the PU service puList.add(holder); } ROOT_LOGGER.tracef("install persistence unit definitions for ear %s", root.getRootName()); addPuService(phaseContext, puList, startEarly, platform); } } } }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
@Override public void undeploy(DeploymentUnit deploymentUnit) { final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (!SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName()); final ServiceController<?> serviceController = serviceRegistry.getService(serviceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } } } }
@Override public final void undeploy(final DeploymentUnit context) { // don't process sub-deployments as they are processed by processing methods final ResourceRoot root = context.getAttachment(Attachments.DEPLOYMENT_ROOT); if (SubDeploymentMarker.isSubDeployment(root)) return; // Remove any log context selector references final Module module = context.getAttachment(Attachments.MODULE); // Remove either the default log context or a defined log context. It's safe to attempt to remove a // nonexistent context. unregisterLogContext(context, DEFAULT_LOG_CONTEXT_KEY, module); unregisterLogContext(context, LOG_CONTEXT_KEY, module); // Unregister all sub-deployments final List<DeploymentUnit> subDeployments = getSubDeployments(context); for (DeploymentUnit subDeployment : subDeployments) { final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE); // Sub-deployment should never have a default log context unregisterLogContext(subDeployment, LOG_CONTEXT_KEY, subDeploymentModule); } }
@Override public void undeploy(DeploymentUnit deploymentUnit) { final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (!SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName()); final ServiceController<?> serviceController = serviceRegistry.getService(serviceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } } } }
@Override public void undeploy(final DeploymentUnit deploymentUnit) { final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (!SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName()); final ServiceController<?> serviceController = serviceRegistry.getService(serviceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } } deploymentUnit.removeAttachment(Attachments.SUB_DEPLOYMENTS); } }
@Override public final void undeploy(final DeploymentUnit context) { // don't process sub-deployments as they are processed by processing methods final ResourceRoot root = context.getAttachment(Attachments.DEPLOYMENT_ROOT); if (SubDeploymentMarker.isSubDeployment(root)) return; // Remove any log context selector references final Module module = context.getAttachment(Attachments.MODULE); // Remove either the default log context or a defined log context. It's safe to attempt to remove a // nonexistent context. unregisterLogContext(context, DEFAULT_LOG_CONTEXT_KEY, module); unregisterLogContext(context, LOG_CONTEXT_KEY, module); // Unregister all sub-deployments final List<DeploymentUnit> subDeployments = getSubDeployments(context); for (DeploymentUnit subDeployment : subDeployments) { final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE); // Sub-deployment should never have a default log context unregisterLogContext(subDeployment, LOG_CONTEXT_KEY, subDeploymentModule); } }
@Override public void undeploy(final DeploymentUnit deploymentUnit) { final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (!SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName()); final ServiceController<?> serviceController = serviceRegistry.getService(serviceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } } deploymentUnit.removeAttachment(Attachments.SUB_DEPLOYMENTS); } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final ServiceVerificationHandler serviceVerificationHandler = deploymentUnit.getAttachment(Attachments.SERVICE_VERIFICATION_HANDLER); if(deploymentResourceRoot.getRoot().isDirectory()) { ExplodedDeploymentMarker.markAsExplodedDeployment(deploymentUnit); } final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (childRoot == deploymentResourceRoot || !SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final Resource resource = DeploymentModelUtils.createSubDeployment(childRoot.getRootName(), deploymentUnit); final ImmutableManagementResourceRegistration registration = deploymentUnit.getAttachment(DeploymentModelUtils.REGISTRATION_ATTACHMENT); final ManagementResourceRegistration mutableRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT); final AbstractVaultReader vaultReader = deploymentUnit.getAttachment(Attachments.VAULT_READER_ATTACHMENT_KEY); final SubDeploymentUnitService service = new SubDeploymentUnitService(childRoot, deploymentUnit, registration, mutableRegistration, resource, serviceVerificationHandler, vaultReader); final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName()); serviceTarget.addService(serviceName, service) .addDependency(Services.JBOSS_DEPLOYMENT_CHAINS, DeployerChains.class, service.getDeployerChainsInjector()) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); phaseContext.addDeploymentDependency(serviceName, Attachments.SUB_DEPLOYMENTS); //we also need a dep on the first phase of the sub deployments phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, serviceName.append(ServiceName.of(Phase.STRUCTURE.name()))); } }
@Override public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // If the log context is already defined, skip the rest of the processing if (!hasRegisteredLogContext(deploymentUnit)) { if (deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_ROOT)) { // don't process sub-deployments as they are processed by processing methods final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (SubDeploymentMarker.isSubDeployment(root)) return; processDeployment(phaseContext, deploymentUnit, root); // If we still don't have a context registered on the root deployment, register the current context. // This is done to avoid any logging from the root deployment to have access to a sub-deployments log // context. For example any library logging from a EAR/lib should use the EAR's configured log context, // not a log context from a WAR or EJB library. if (!hasRegisteredLogContext(deploymentUnit) && !deploymentUnit.hasAttachment(DEFAULT_LOG_CONTEXT_KEY)) { // Register the current log context as this could be an embedded server or overridden another way registerLogContext(deploymentUnit, DEFAULT_LOG_CONTEXT_KEY, deploymentUnit.getAttachment(Attachments.MODULE), LogContext.getLogContext()); } } } }