@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CORBA_ID, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAVAX_RMI_API_ID, false, false, false, false)); //we need to add iiop, as the orb is initialized from the context class loader of the deployment moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IIOP_OPENJDK_ID, false, false, false, false)); }
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ServiceModuleLoader loader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER); if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { return; // Skip non web deployments WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); assert warMetaData != null; final Module module = deploymentUnit.getAttachment(Attachments.MODULE); throw UndertowLogger.ROOT_LOGGER.failedToResolveModule(deploymentUnit); final ClassLoader classLoader = module.getClassLoader(); ScisMetaData scisMetaData = deploymentUnit.getAttachment(ScisMetaData.ATTACHMENT_KEY); if (scisMetaData == null) { for (ModuleDependency dependency : moduleSpecification.getAllDependencies()) { if (!dependency.isImportServices()) { continue; Module depModule = loader.loadModule(dependency.getIdentifier()); ServiceLoader<ServletContainerInitializer> serviceLoader = depModule.loadService(ServletContainerInitializer.class); for (ServletContainerInitializer service : serviceLoader) { if(sciClasses.add(service.getClass())) { if (!dependency.isOptional()) { throw UndertowLogger.ROOT_LOGGER.errorLoadingSCIFromModule(dependency.getIdentifier().toString(), e);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // we only process .ear if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); // set the default ear subdeployment isolation value moduleSpecification.setSubDeploymentModulesIsolated(earSubDeploymentsIsolated); }
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; } final List<DeploymentUnit> deploymentUnits = new ArrayList<DeploymentUnit>(); deploymentUnits.add(deploymentUnit); deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS)); for (DeploymentUnit unit : deploymentUnits) { final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (mainRoot == null) continue; VirtualFile root = mainRoot.getRoot(); for (String path : SEAM_FILES) { if (root.getChild(path).exists()) { final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false, false)); moduleSpecification.addResourceLoader(getSeamIntResourceLoader()); return; } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); if (deploymentUnit.hasAttachment(Attachments.RESOURCE_ROOTS)) { final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot root : resourceRoots) { VirtualFile child = root.getRoot().getChild(SERVICE_FILE_NAME); if (child.exists()) { moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JTA, false, false, false, false)); break; } } } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final ServiceModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER); if (deploymentUnit.getParent() != null) { if (deploymentRoot.hasAttachment(SUB_DEPLOYMENT_STRUCTURE)) { final ModuleSpecification subModuleSpec = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); Set<ModuleIdentifier> additionalModules = new HashSet<>(); additionalModules.add(i.getModuleIdentifier()); handleDeployment(phaseContext, deploymentUnit, subModuleSpec, deploymentRoot.getAttachment(SUB_DEPLOYMENT_STRUCTURE), additionalModules); final VirtualFile file = deploymentRoot.getRoot().getChild(loc); if (file.exists()) { deploymentFile = file; if (result.getEarSubDeploymentsIsolated() != null) { moduleSpec.setSubDeploymentModulesIsolated(result.getEarSubDeploymentsIsolated()); moduleSpec.setExclusionsCascadedToSubDeployments(result.getEarExclusionsCascadedToSubDeployments()); if(moduleSpec.isExclusionsCascadedToSubDeployments() && rootDeploymentSpecification != null) { for(ModuleIdentifier exclusion : rootDeploymentSpecification.getExclusions()) { spec.getExclusions().add(exclusion);
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpec = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE_SPECIFICATION); final Map<ModuleIdentifier, DeploymentUnit> deployments = new HashMap<ModuleIdentifier, DeploymentUnit>(); //local classes are always first deploymentUnit.addToAttachmentList(Attachments.ACCESSIBLE_SUB_DEPLOYMENTS, deploymentUnit); buildModuleMap(deploymentUnit, deployments); for (final ModuleDependency dependency : moduleSpec.getAllDependencies()) { final DeploymentUnit sub = deployments.get(dependency.getIdentifier()); if (sub != null) { deploymentUnit.addToAttachmentList(Attachments.ACCESSIBLE_SUB_DEPLOYMENTS, sub); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent(); final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); final JBossWebMetaData webdata = warMetaData.getMergedJBossWebMetaData(); if (moduleSpec != null && attachmentMap != null) { final Set<ModuleIdentifier> identifiers = new HashSet<ModuleIdentifier>(); for (ModuleDependency dep : moduleSpec.getAllDependencies()) { if (!identifiers.contains(dep.getIdentifier())) { identifiers.add(dep.getIdentifier()); if (attachmentMap.containsKey(dep.getIdentifier())) { additionalData.add(attachmentMap.get(dep.getIdentifier()));
logger.debug("Creating module: " + moduleIdentifier); final ModuleSpec.Builder specBuilder = ModuleSpec.build(moduleIdentifier); for (final DependencySpec dep : moduleSpecification.getModuleSystemDependencies()) { specBuilder.addDependency(dep); final List<ModuleDependency> dependencies = moduleSpecification.getSystemDependencies(); final List<ModuleDependency> localDependencies = moduleSpecification.getLocalDependencies(); final List<ModuleDependency> userDependencies = moduleSpecification.getUserDependencies(); final List<PermissionFactory> permFactories = moduleSpecification.getPermissionFactories(); for (final ResourceLoaderSpec resourceLoaderSpec : moduleSpecification.getResourceLoaders()) { logger.debug("Adding resource loader " + resourceLoaderSpec + " to module " + moduleIdentifier); specBuilder.addResourceRoot(resourceLoaderSpec); createDependencies(specBuilder, userDependencies, false); if (moduleSpecification.isLocalLast()) { createDependencies(specBuilder, localDependencies, moduleSpecification.isLocalDependenciesTransitive()); specBuilder.addDependency(DependencySpec.createLocalDependencySpec()); } else { specBuilder.addDependency(DependencySpec.createLocalDependencySpec()); createDependencies(specBuilder, localDependencies, moduleSpecification.isLocalDependenciesTransitive()); ModuleDefinition moduleDefinition = new ModuleDefinition(moduleIdentifier, new HashSet<>(moduleSpecification.getAllDependencies()), moduleSpec); allDependencies.addAll(userDependencies);
private void installAliases(final ModuleSpecification moduleSpecification, final ModuleIdentifier moduleIdentifier, final DeploymentUnit deploymentUnit, final DeploymentPhaseContext phaseContext) { ModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER); for (final ModuleIdentifier alias : moduleSpecification.getAliases()) { final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(alias); final ModuleSpec spec = ModuleSpec.buildAlias(alias, moduleIdentifier).create(); HashSet<ModuleDependency> dependencies = new HashSet<>(moduleSpecification.getAllDependencies()); //we need to add the module we are aliasing as a dependency, to make sure that it will be resolved dependencies.add(new ModuleDependency(moduleLoader, moduleIdentifier, false, false, false, false)); ModuleDefinition moduleDefinition = new ModuleDefinition(alias, dependencies, spec); final ValueService<ModuleDefinition> moduleSpecService = new ValueService<>(new ImmediateValue<>(moduleDefinition)); final ServiceBuilder sb = phaseContext.getServiceTarget().addService(moduleSpecServiceName, moduleSpecService); sb.requires(deploymentUnit.getServiceName()); sb.requires(phaseContext.getPhaseServiceName()); sb.setInitialMode(Mode.ON_DEMAND); sb.install(); ModuleLoadService.installService(phaseContext.getServiceTarget(), alias, Collections.singletonList(moduleIdentifier)); ModuleResolvePhaseService.installService(phaseContext.getServiceTarget(), moduleDefinition); } }
logger.debug("Creating module: " + moduleIdentifier); final ModuleSpec.Builder specBuilder = ModuleSpec.build(moduleIdentifier); for (final DependencySpec dep : moduleSpecification.getModuleSystemDependencies()) { specBuilder.addDependency(dep); final List<ModuleDependency> dependencies = moduleSpecification.getSystemDependencies(); final List<ModuleDependency> localDependencies = moduleSpecification.getLocalDependencies(); final List<ModuleDependency> userDependencies = moduleSpecification.getUserDependencies(); for (final ResourceLoaderSpec resourceLoaderSpec : moduleSpecification.getResourceLoaders()) { logger.debug("Adding resource loader " + resourceLoaderSpec + " to module " + moduleIdentifier); specBuilder.addResourceRoot(resourceLoaderSpec); createDependencies(specBuilder, dependencies, moduleSpecification.isRequiresTransitiveDependencies()); createDependencies(specBuilder, userDependencies, moduleSpecification.isRequiresTransitiveDependencies()); if (moduleSpecification.isLocalLast()) { createDependencies(specBuilder, localDependencies, moduleSpecification.isRequiresTransitiveDependencies()); specBuilder.addDependency(DependencySpec.createLocalDependencySpec()); } else { specBuilder.addDependency(DependencySpec.createLocalDependencySpec()); createDependencies(specBuilder, localDependencies, moduleSpecification.isRequiresTransitiveDependencies()); allDependencies.add(new ModuleDependency(null, module.getModuleIdentifier(), false, false, false, false)); return ModuleLoadService.install(phaseContext.getServiceTarget(), moduleIdentifier, allDependencies);
private void addDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, ModuleIdentifier moduleIdentifier, boolean optional) { moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, optional, false, true, false)); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent(); final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); final JBossWebMetaData webdata = warMetaData.getMergedJBossWebMetaData(); if (moduleSpec != null && attachmentMap != null) { final Set<ModuleIdentifier> identifiers = new HashSet<ModuleIdentifier>(); for (ModuleDependency dep : moduleSpec.getAllDependencies()) { if (!identifiers.contains(dep.getIdentifier())) { identifiers.add(dep.getIdentifier()); if (attachmentMap.containsKey(dep.getIdentifier())) { additionalData.add(attachmentMap.get(dep.getIdentifier()));
@SuppressWarnings({ "unchecked", "rawtypes" }) private void markDeploymentWithModuleDependency(ModuleIdentifier moduleIdentifier, AttachmentKey attachment, DeploymentUnit deployment) { ModuleSpecification moduleSpecification = deployment.getAttachment(Attachments.MODULE_SPECIFICATION); for (ModuleDependency deploymentDependency : moduleSpecification.getUserDependencies()) { if (deploymentDependency.getIdentifier().equals(moduleIdentifier)) { deployment.putAttachment(attachment, Boolean.TRUE); return; } } }
private void addJSFImpl(String jsfVersion, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) { if (jsfVersion.equals(JsfVersionMarker.WAR_BUNDLES_JSF_IMPL)) return; ModuleIdentifier jsfModule = moduleIdFactory.getImplModId(jsfVersion); ModuleDependency jsfImpl = new ModuleDependency(moduleLoader, jsfModule, false, false, true, false); jsfImpl.addImportFilter(PathFilters.getMetaInfFilter(), true); moduleSpecification.addSystemDependency(jsfImpl); }
private static boolean hasCxfModuleDependency(DeploymentUnit unit) { final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION); for (ModuleDependency dep : moduleSpec.getUserDependencies()) { final String id = dep.getIdentifier().getName(); if (cxfExportingModules.contains(id)) { return true; } } return false; }
private void installAliases(final ModuleSpecification moduleSpecification, final ModuleIdentifier moduleIdentifier, final DeploymentUnit deploymentUnit, final DeploymentPhaseContext phaseContext) { for (final ModuleIdentifier alias : moduleSpecification.getAliases()) { final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(alias); final ModuleSpec spec = ModuleSpec.buildAlias(alias, moduleIdentifier).create(); ModuleDefinition moduleDefinition = new ModuleDefinition(alias, new HashSet<>(moduleSpecification.getAllDependencies()), spec); final ValueService<ModuleDefinition> moduleSpecService = new ValueService<>(new ImmediateValue<>(moduleDefinition)); phaseContext.getServiceTarget().addService(moduleSpecServiceName, moduleSpecService).addDependencies( deploymentUnit.getServiceName()).addDependencies(phaseContext.getPhaseServiceName()).setInitialMode( Mode.ON_DEMAND).install(); ModuleLoadService.installService(phaseContext.getServiceTarget(), alias, Collections.singletonList(moduleIdentifier)); ModuleResolvePhaseService.installService(phaseContext.getServiceTarget(), moduleDefinition); } }
ModuleSpecification moduleSpecification = deployment.getAttachment(BundleDeploymentProcessor.MODULE_SPECIFICATION_KEY); if (moduleSpecification != null) { List<ModuleDependency> dependencies = moduleSpecification.getAllDependencies(); LOGGER.debugf("Adding integration dependencies: %d", dependencies.size()); for (ModuleDependency moduleDep : dependencies) { ModuleIdentifier moduleId = moduleDep.getIdentifier(); if (moduleDependencies.get(moduleId) != null) { LOGGER.debugf(" -dependency on %s (skipped)", moduleId); for (FilterSpecification filter : moduleDep.getImportFilters()) { importBuilder.addFilter(filter.getPathFilter(), filter.isInclude()); for (FilterSpecification filter : moduleDep.getExportFilters()) { importBuilder.addFilter(filter.getPathFilter(), filter.isInclude());
/** * Gives any additional modules the same dependencies and permissions as the primary module. * <p/> * This makes sure they can access all API classes etc. * * @param moduleSpecification The primary module spec * @param module The additional module */ private void addAllDependenciesAndPermissions(final ModuleSpecification moduleSpecification, final AdditionalModuleSpecification module) { module.addSystemDependencies(moduleSpecification.getSystemDependencies()); module.addLocalDependencies(moduleSpecification.getLocalDependencies()); for(ModuleDependency dep : moduleSpecification.getUserDependencies()) { if(!dep.getIdentifier().equals(module.getModuleIdentifier())) { module.addUserDependency(dep); } } for(PermissionFactory factory : moduleSpecification.getPermissionFactories()) { module.addPermissionFactory(factory); } }
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS)); final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (mainRoot == null) continue; VirtualFile root = mainRoot.getRoot(); for (String path : SEAM_FILES) { if (root.getChild(path).exists()) { final ModuleSpecification moduleSpecification = deploymentUnit .getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false, false)); // for VFS scanner getSeamIntResourceRoot().getRoot().getPathName())); moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader)); } catch (Exception e) { throw new DeploymentUnitProcessingException(e);