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 void addJSFInjection(String jsfVersion, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) throws DeploymentUnitProcessingException { if (jsfVersion.equals(JsfVersionMarker.WAR_BUNDLES_JSF_IMPL)) return; ModuleIdentifier jsfInjectionModule = moduleIdFactory.getInjectionModId(jsfVersion); ModuleDependency jsfInjectionDependency = new ModuleDependency(moduleLoader, jsfInjectionModule, false, true, true, false); try { if (isJSF12(jsfInjectionDependency, jsfInjectionModule.toString())) { JSFLogger.ROOT_LOGGER.loadingJsf12(); jsfInjectionDependency.addImportFilter(PathFilters.is("META-INF/faces-config.xml"), false); jsfInjectionDependency.addImportFilter(PathFilters.is("META-INF/1.2/faces-config.xml"), true); } else { JSFLogger.ROOT_LOGGER.loadingJsf2x(); jsfInjectionDependency.addImportFilter(PathFilters.getMetaInfFilter(), true); // Exclude JSF 1.2 faces-config.xml to make extra sure it won't interfere with JSF 2.0 deployments jsfInjectionDependency.addImportFilter(PathFilters.is("META-INF/1.2/faces-config.xml"), false); } } catch (ModuleLoadException e) { throw JSFLogger.ROOT_LOGGER.jsfInjectionFailed(jsfVersion); } moduleSpecification.addSystemDependency(jsfInjectionDependency); }
/** * Add the EE APIs as a dependency to all deployments * * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException * */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); //add jboss-invocation classes needed by the proxies ModuleDependency invocation = new ModuleDependency(moduleLoader, JBOSS_INVOCATION_ID, false, false, false, false); invocation.addImportFilter(PathFilters.is("org/jboss/invocation/proxy/classloading"), true); invocation.addImportFilter(PathFilters.acceptAll(), false); moduleSpecification.addSystemDependency(invocation); ModuleDependency ee = new ModuleDependency(moduleLoader, JBOSS_AS_EE, false, false, false, false); ee.addImportFilter(PathFilters.is("org/jboss/as/ee/component/serialization"), true); ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent"), true); ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent/handle"), true); ee.addImportFilter(PathFilters.acceptAll(), false); moduleSpecification.addSystemDependency(ee); // add dep for naming permission moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.wildfly.naming"), false, false, false, false)); //we always add all Java EE API modules, as the platform spec requires them to always be available //we do not just add the javaee.api module, as this breaks excludes for (final ModuleIdentifier moduleIdentifier : JAVA_EE_API_MODULES) { moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, true, false, true, false)); } }
/** * Add dependencies for modules required for weld deployments, if managed weld configurations are attached to the deployment * */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); addDependency(moduleSpecification, moduleLoader, JAVAX_ENTERPRISE_API); addDependency(moduleSpecification, moduleLoader, JAVAX_INJECT_API); if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) { return; // Skip if there are no beans.xml files in the deployment } addDependency(moduleSpecification, moduleLoader, JAVAX_PERSISTENCE_API_ID); addDependency(moduleSpecification, moduleLoader, WELD_CORE_ID); addDependency(moduleSpecification, moduleLoader, WELD_PROBE_ID, true); addDependency(moduleSpecification, moduleLoader, WELD_API_ID); addDependency(moduleSpecification, moduleLoader, WELD_SPI_ID); ModuleDependency weldSubsystemDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_ID, false, false, false, false); weldSubsystemDependency.addImportFilter(PathFilters.getMetaInfFilter(), true); weldSubsystemDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/injection"), true); weldSubsystemDependency.addImportFilter(PathFilters.acceptAll(), false); weldSubsystemDependency.addExportFilter(PathFilters.getMetaInfFilter(), true); moduleSpecification.addSystemDependency(weldSubsystemDependency); // Due to serialization of EJBs ModuleDependency weldEjbDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_EJB_ID, true, false, false, false); weldEjbDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/ejb"), true); weldEjbDependency.addImportFilter(PathFilters.acceptAll(), false); moduleSpecification.addSystemDependency(weldEjbDependency); }
deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.getMetaInfFilter(), true)); deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.getMetaInfSubdirectoriesFilter(), true)); deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.acceptAll(), false)); ModuleRootMarker.mark(deploymentResourceRoot, true);
/** * Get a class filter which uses a resource path filter to filter classes. * * @param resourcePathFilter the resource path filter * @return the class filter */ public static ClassFilter fromResourcePathFilter(final PathFilter resourcePathFilter) { return resourcePathFilter == PathFilters.acceptAll() ? acceptAll() : new PathClassFilter(resourcePathFilter); } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final List<GlobalModule> globalMods = this.globalModules; for (final GlobalModule module : globalMods) { final ModuleDependency dependency = new ModuleDependency(Module.getBootModuleLoader(), module.getModuleIdentifier(), false, false, module.isServices(), false); if (module.isMetaInf()) { dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true); dependency.addImportFilter(PathFilters.getMetaInfFilter(), true); } if(module.isAnnotations()) { deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, module.getModuleIdentifier()); } moduleSpecification.addSystemDependency(dependency); } }
/** * Add POJO module if we have any bean factories. * * @param phaseContext the deployment unit context * @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException */ @Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); final List<KernelDeploymentXmlDescriptor> kdXmlDescriptors = unit.getAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY); if (kdXmlDescriptors == null || kdXmlDescriptors.isEmpty()) return; for (KernelDeploymentXmlDescriptor kdxd : kdXmlDescriptors) { if (kdxd.getBeanFactoriesCount() > 0) { final ModuleSpecification moduleSpecification = unit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); ModuleDependency dependency = new ModuleDependency(moduleLoader, POJO_MODULE, false, false, false, false); PathFilter filter = PathFilters.isChildOf(BaseBeanFactory.class.getPackage().getName()); dependency.addImportFilter(filter, true); dependency.addImportFilter(PathFilters.rejectAll(), false); moduleSpecification.addSystemDependency(dependency); return; } } }
/** * Construct a new instance. * * @param repoRoots the repository roots to use */ public LocalModuleFinder(final File[] repoRoots) { this(repoRoots, PathFilters.acceptAll()); }
/** {@inheritDoc} */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, PICKETBOX_ID, false, false, false, false)); //add the remoting login module final ModuleDependency remoting = new ModuleDependency(moduleLoader, REMOTING_LOGIN_MODULE, false, false, false, false); remoting.addImportFilter(PathFilters.is(RemotingLoginModule.class.getName().replace(".","/")), true); moduleSpecification.addSystemDependency(remoting); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACC_API, false, false, true, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, AUTH_MESSAGE_API, false, false, true, false)); }
/** * Get a path filter which is {@code true} when the given filter is {@code false}, and vice-versa. * * @param filter the filter * @return the inverting filter */ public static PathFilter not(PathFilter filter) { if (filter instanceof BooleanPathFilter) { return booleanFilter(!((BooleanPathFilter) filter).getResult()); } else if (filter instanceof InvertingPathFilter) { return ((InvertingPathFilter) filter).getDelegate(); } else { return new InvertingPathFilter(filter); } }
public boolean accept(final String path) { final int len = filters.length; for (int i = 0; i < len; i++) { if (filters[i].accept(path)) return includeFlag[i]; } return defaultVal; }
/** * Get a path filter which returns {@code true} if any of the given filters return {@code true}. * * @param filters the filters * @return the "any" filter */ public static PathFilter any(PathFilter... filters) { return new AggregatePathFilter(true, filters); }
/** * Construct a new instance. * * @param glob the path glob to match */ GlobPathFilter(final String glob) { pattern = getGlobPattern(glob); this.glob = glob; }
/** * Get a builder for a multiple-path filter. Such a filter contains multiple filters, each associated * with a flag which indicates that matching paths should be included or excluded. * * @param defaultValue the value to return if none of the nested filters match * @return the builder */ public static MultiplePathFilterBuilder multiplePathFilterBuilder(boolean defaultValue) { return new MultiplePathFilterBuilder(defaultValue); }
/** * Get a class filter which uses a resource path filter to filter classes. * * @param resourcePathFilter the resource path filter * @return the class filter */ public static ClassFilter fromResourcePathFilter(final PathFilter resourcePathFilter) { return resourcePathFilter == PathFilters.acceptAll() ? acceptAll() : new PathClassFilter(resourcePathFilter); } }
public boolean accept(final String path) { final int len = filters.length; for (int i = 0; i < len; i++) { if (filters[i].accept(path)) return includeFlag[i]; } return defaultVal; }