/** * returns true if the {@link DeploymentUnit} is part of a weld deployment */ public static boolean isPartOfWeldDeployment(DeploymentUnit unit) { if (unit.getParent() == null) { return unit.getAttachment(MARKER) != null; } else { return unit.getParent().getAttachment(MARKER) != null; } }
private ServiceName getProfileServiceName(final DeploymentPhaseContext phaseContext) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parentDeploymentUnit = deploymentUnit.getParent(); if (parentDeploymentUnit != null) { return parentDeploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_REMOTING_PROFILE_SERVICE_NAME); } else { return deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_REMOTING_PROFILE_SERVICE_NAME); } }
/** * Add dependencies for modules required for ra deployments * * @param phaseContext the deployment unit context * @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (phaseContext.getDeploymentUnit().getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY) == null) { return; // Skip non ra deployments } CopyOnWriteArrayListMultiMap<String,ServiceName> resourceAdaptersMap = phaseContext.getDeploymentUnit().getAttachment(ResourceAdaptersSubsystemService.ATTACHMENT_KEY); String deploymentUnitPrefix = ""; if (deploymentUnit.getParent() != null) { deploymentUnitPrefix = deploymentUnit.getParent().getName() + "#"; } final String deploymentUnitName = deploymentUnitPrefix + deploymentUnit.getName(); if (resourceAdaptersMap != null && resourceAdaptersMap.get(deploymentUnitName) != null) { for (ServiceName serviceName : resourceAdaptersMap.get(deploymentUnitName)) { phaseContext.addDeploymentDependency(serviceName, AttachmentKey .create(ModifiableResourceAdapter.class)); } } }
@Override public synchronized void start(StartContext context) throws StartException { ApplicationSecurityDomain applicationSecurityDomain = getApplicationSecurityDomain(); BiFunction<String, ClassLoader, Registration> securityFunction = applicationSecurityDomain != null ? applicationSecurityDomain.getSecurityFunction() : null; if (securityFunction != null) { final String deploymentName = deploymentUnit.getParent() == null ? deploymentUnit.getName() : deploymentUnit.getParent().getName() + "." + deploymentUnit.getName(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final ClassLoader classLoader = module.getClassLoader(); registration = securityFunction.apply(deploymentName, classLoader); } }
private ServiceName getDiscoveryServiceName(final DeploymentPhaseContext phaseContext) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parentDeploymentUnit = deploymentUnit.getParent(); if (parentDeploymentUnit != null) { return DiscoveryService.BASE_NAME.append(parentDeploymentUnit.getName()); } else { return DiscoveryService.BASE_NAME.append(deploymentUnit.getName()); } }
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent(); if(JsfVersionMarker.isJsfDisabled(deploymentUnit)) { return; } if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) { WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent); extensions.registerExtensionInstance(new JSFPassivatingViewScopedCdiExtension(), parent); } }
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); } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); ServiceName namingStoreServiceName = support.getCapabilityServiceName(NamingService.CAPABILITY_NAME); //this will always be up but we need to make sure the naming service is //not shut down before the deployment is undeployed when the container is shut down phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, namingStoreServiceName); List<ServiceName> dependencies = deploymentUnit.getAttachmentList(Attachments.JNDI_DEPENDENCIES); final ServiceName serviceName = serviceName(deploymentUnit.getServiceName()); final ServiceBuilder<?> serviceBuilder = phaseContext.getServiceTarget().addService(serviceName, new RuntimeBindReleaseService()); for (final ServiceName dependency : dependencies) { serviceBuilder.requires(dependency); } if(deploymentUnit.getParent() != null) { for (final ServiceName jndiDependency : deploymentUnit.getParent().getAttachment(Attachments.JNDI_DEPENDENCIES)) { serviceBuilder.requires(jndiDependency); } } serviceBuilder.requires(namingStoreServiceName); serviceBuilder.install(); }
private ServiceName getEJBClientContextServiceName(final DeploymentPhaseContext phaseContext) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parentDeploymentUnit = deploymentUnit.getParent(); // The top level parent deployment unit will have the attachment containing the EJB client context // service name ServiceName serviceName; if (parentDeploymentUnit != null) { serviceName = parentDeploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_CLIENT_CONTEXT_SERVICE_NAME); } else { serviceName = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_CLIENT_CONTEXT_SERVICE_NAME); } if (serviceName != null) { return serviceName; } return EJBClientContextService.DEFAULT_SERVICE_NAME; }
/** * Try to obtain the security domain configured in jboss-app.xml at the ear level if available */ private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) { String securityDomain = null; DeploymentUnit parent = deploymentUnit.getParent(); if (parent != null) { final EarMetaData jbossAppMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA); if (jbossAppMetaData instanceof JBossAppMetaData) { securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain(); } } return securityDomain != null ? securityDomain.trim() : null; }
public JaccService<T> deploy(DeploymentUnit deploymentUnit) { T metaData = deploymentUnit.getAttachment(getMetaDataType()); String contextId = deploymentUnit.getName(); Boolean standalone = Boolean.FALSE; // check if it is top level if (deploymentUnit.getParent() == null) { standalone = Boolean.TRUE; } else { contextId = deploymentUnit.getParent().getName() + "!" + contextId; } return createService(contextId, metaData, standalone); }
@Override public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = context.getDeploymentUnit(); String contextID = deploymentUnit.getName(); if (deploymentUnit.getParent() != null) { contextID = deploymentUnit.getParent().getName() + "!" + contextID; } EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) description; final boolean securityRequired = isExplicitSecurityDomainConfigured(); ejbComponentDescription.setSecurityRequired(securityRequired); if (isSecurityDomainKnown()) { final HashMap<Integer, InterceptorFactory> elytronInterceptorFactories = getElytronInterceptorFactories(contextID, ejbComponentDescription.isEnableJacc(), false); elytronInterceptorFactories.forEach((priority, elytronInterceptorFactory) -> configuration.addPostConstructInterceptor(elytronInterceptorFactory, priority)); } else { configuration.addPostConstructInterceptor(new SecurityContextInterceptorFactory(securityRequired, false, contextID), InterceptorOrder.View.SECURITY_CONTEXT); } } });
/** * {@inheritDoc} */ @Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); AbstractSecurityDeployer<?> deployer = null; if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { deployer = new EarSecurityDeployer(); JaccService<?> service = deployer.deploy(deploymentUnit); if (service != null) { final ServiceName jaccServiceName = deploymentUnit.getServiceName().append(JaccService.SERVICE_NAME); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); ServiceBuilder<?> builder = serviceTarget.addService(jaccServiceName, service); if (deploymentUnit.getParent() != null) { // add dependency to parent policy final DeploymentUnit parentDU = deploymentUnit.getParent(); builder.addDependency(parentDU.getServiceName().append(JaccService.SERVICE_NAME), PolicyConfiguration.class, service.getParentPolicyInjector()); } builder.setInitialMode(Mode.ACTIVE).install(); } } }
@Override public void deploy(DeploymentPhaseContext context) { final DeploymentUnit deploymentUnit = context.getDeploymentUnit(); final String topLevelName; return; if (deploymentUnit.getParent() == null) { topLevelName = deploymentUnit.getName(); } else { topLevelName = deploymentUnit.getParent().getName(); for (ComponentDescription component : deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION).getComponentDescriptions()) { if (component instanceof EJBComponentDescription) { final String entryPoint = ENTRY_POINT_NAME + deploymentUnit.getName() + "." + component.getComponentName(); ControlPointService.install(context.getServiceTarget(), topLevelName, entryPoint); component.getConfigurators().add(new ComponentConfigurator() {
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry eeResourceReferenceProcessorRegistry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); if(eeResourceReferenceProcessorRegistry != null) { eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); } } }
private ServiceName getJaccServiceName(DeploymentUnit deploymentUnit){ final DeploymentUnit parentDU = deploymentUnit.getParent(); // EJBs maybe included directly in war deployment ServiceName jaccServiceName = deploymentUnit.getServiceName().append(JaccService.SERVICE_NAME).append("ejb"); //Qualify the service name properly with parent DU if(parentDU != null) { jaccServiceName = jaccServiceName.append(parentDU.getName()); } return jaccServiceName; } }
/** * Try to obtain the security domain configured in jboss-app.xml at the ear level if available * * @param deploymentUnit * @return */ private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) { String securityDomain = null; DeploymentUnit parent = deploymentUnit.getParent(); if (parent != null) { final EarMetaData jbossAppMetaData = parent.getAttachment(Attachments.EAR_METADATA); if (jbossAppMetaData instanceof JBossAppMetaData) { securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain(); } } return securityDomain; } }
public JaccService<T> deploy(DeploymentUnit deploymentUnit) { T metaData = deploymentUnit.getAttachment(getMetaDataType()); String contextId = deploymentUnit.getName(); Boolean standalone = Boolean.FALSE; // check if it is top level if (deploymentUnit.getParent() == null) { standalone = Boolean.TRUE; } else { contextId = deploymentUnit.getParent().getName() + "!" + contextId; } return createService(contextId, metaData, standalone); }