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(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); String deploymentName = deploymentUnit.getName().toLowerCase(Locale.ENGLISH); if (deploymentName.endsWith(".war")) { DeploymentTypeMarker.setType(DeploymentType.WAR, deploymentUnit); } }
/** * 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)); } } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final String deploymentUnitName = deploymentUnit.getName(); final String moduleName; if (deploymentUnitName.endsWith(".war") || deploymentUnitName.endsWith(".jar") || deploymentUnitName.endsWith(".ear") || deploymentUnitName.endsWith(".rar")) { moduleName = deploymentUnitName.substring(0, deploymentUnitName.length() - 4); } else { moduleName = deploymentUnitName; } final String appName; final String earApplicationName = deploymentUnit.getAttachment(Attachments.EAR_APPLICATION_NAME); //the ear application name takes into account the name set in application.xml //if this is non-null this is always the one we want to use if(earApplicationName != null) { appName = earApplicationName; } else { //an appname of null means use the module name appName = null; } deploymentUnit.putAttachment(Attachments.EE_MODULE_DESCRIPTION, new EEModuleDescription(appName, moduleName, earApplicationName, appClient)); }
protected static EjbJarDescription getEjbJarDescription(final DeploymentUnit deploymentUnit) { EjbJarDescription ejbJarDescription = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION); final EEApplicationClasses applicationClassesDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); if (ejbJarDescription == null) { final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); ejbJarDescription = new EjbJarDescription(moduleDescription, deploymentUnit.getName().endsWith(".war")); deploymentUnit.putAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION, ejbJarDescription); } return ejbJarDescription; }
@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); } }
final DeploymentUnit deploymentUnit = DeploymentUnit.class.cast(deploymentUnitServiceController.getValue()); final String appName = cleanName(deploymentUnit.getName()); 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()); final ServiceName subDeploymentServiceName = Services.deploymentUnitName(deploymentUnit.getName(), relativePath); final ServiceController<?> subDeploymentController = serviceRegistry.getService(subDeploymentServiceName); if(subDeploymentController != null) {
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { if (phaseContext.getAttachment(Attachments.DEPLOYMENT_TYPE) == DeploymentType.EAR) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // Make sure the next phase of this EAR depends on this phase of not just the EAR but also all subdeployments for (DeploymentUnit subdeployment : deploymentUnit.getAttachmentList(SUB_DEPLOYMENTS)) { phaseContext.addToAttachmentList(NEXT_PHASE_DEPS, Services.deploymentUnitName(deploymentUnit.getName(), subdeployment.getName(), phaseContext.getPhase())); } } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final List<DeploymentUnit> subDeployments = deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS); final Set<String> moduleNames = new HashSet<String>(); final Set<String> moduleConflicts = new HashSet<String>(); //look for modules with the same name // for(DeploymentUnit deployment : subDeployments) { final EEModuleDescription module = deployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if(module != null) { if(moduleNames.contains(module.getModuleName())) { moduleConflicts.add(module.getModuleName()); } moduleNames.add(module.getModuleName()); } } for(DeploymentUnit deployment : subDeployments) { final EEModuleDescription module = deployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if(module != null) { if(moduleConflicts.contains(module.getModuleName())) { module.setModuleName(deployment.getName()); } } } }
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (module != null && servicesAttachment != null) { final ModuleClassLoader classLoader = module.getClassLoader(); Integer.valueOf(minorVersion)); String driverName = deploymentUnit.getName(); if ((driverName.contains(".") && ! driverName.endsWith(".jar")) || driverNames.size() != 1) { driverName += "_" + driverClassName + "_" + majorVersion + "_" + minorVersion;
static String pathNameOfDeployment(final DeploymentUnit deploymentUnit, final JBossWebMetaData metaData) { String pathName; if (metaData.getContextRoot() == null) { final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if (description != null) { // if there is an EEModuleDescription we need to take into account that the module name may have been overridden pathName = "/" + description.getModuleName(); } else { pathName = "/" + deploymentUnit.getName().substring(0, deploymentUnit.getName().length() - 4); } } else { pathName = metaData.getContextRoot(); if (pathName.length() > 0 && pathName.charAt(0) != '/') { pathName = "/" + pathName; } } return pathName; }
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // Make sure this is an EAR deployment String deploymentName = deploymentUnit.getName().toLowerCase(Locale.ENGLISH); if (deploymentName.endsWith(EAR_EXTENSION)) { // Let other processors know this is an EAR deployment DeploymentTypeMarker.setType(DeploymentType.EAR, deploymentUnit); } }
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); } } });
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final boolean legacySecurityPresent = phaseContext.getDeploymentUnit().hasAttachment(SecurityAttachments.SECURITY_ENABLED); ConnectorLogger.DS_DEPLOYER_LOGGER.driversElementNotSupported(deploymentUnit.getName());
@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(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.hasAttachment(Attachments.MODULE) && !DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit) && deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_ROOT)) { BatchLogger.LOGGER.tracef("Processing deployment '%s' for the batch deployment resources.", deploymentUnit.getName()); final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); // Add the job operator service used interact with a deployments batch job final WildFlyJobOperator jobOperator = deploymentUnit.getAttachment(BatchAttachments.JOB_OPERATOR); // Process each job XML file for (String jobName : jobOperator.getAllJobNames()) { try { // Add the job information to the service BatchLogger.LOGGER.debugf("Added job %s to allowed jobs for deployment %s", jobName, deploymentUnit.getName()); // Register the a resource for each job found final PathAddress jobAddress = PathAddress.pathAddress(BatchJobResourceDefinition.JOB, jobName); if (!deploymentResourceSupport.hasDeploymentSubModel(subsystemName, jobAddress)) { deploymentResourceSupport.registerDeploymentSubResource(subsystemName, jobAddress, new BatchJobExecutionResource(jobOperator, jobName)); } } catch (Exception e) { // The deployment shouldn't fail in this case, just the specific resource registration should be skipped // Log a debug message so the error is not lost BatchLogger.LOGGER.debugf(e, "Batch jobs as an error occurred will not be registered for runtime views on the deployment (%s).", jobName, deploymentUnit.getName()); } } } }
private String addEarPrefixIfRelativeName(final String configuredName, final DeploymentUnit deploymentUnit, final Class<?> componentClass) throws DeploymentUnitProcessingException { if (!configuredName.startsWith("#")) { return configuredName; } final DeploymentUnit parent = deploymentUnit.getParent(); if (parent == null) { throw EjbLogger.ROOT_LOGGER.relativeResourceAdapterNameInStandaloneModule(deploymentUnit.getName(), componentClass.getName(), configuredName); } return new StringBuilder().append(parent.getName()).append(configuredName).toString(); } }