当前位置: 首页>>代码示例>>Java>>正文


Java PathFilters类代码示例

本文整理汇总了Java中org.jboss.modules.filter.PathFilters的典型用法代码示例。如果您正苦于以下问题:Java PathFilters类的具体用法?Java PathFilters怎么用?Java PathFilters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PathFilters类属于org.jboss.modules.filter包,在下文中一共展示了PathFilters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getModuleFilter

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private PathFilter getModuleFilter(JarFile jar) {
    Set<String> paths = new HashSet<>();

    Enumeration<JarEntry> jarEntries = jar.entries();

    while (jarEntries.hasMoreElements()) {
        JarEntry jarEntry = jarEntries.nextElement();
        if (!jarEntry.isDirectory()) {
            String name = jarEntry.getName();
            if (name.endsWith("/module.xml")) {
                paths.add(name);
            }
        }
    }
    return PathFilters.in(paths);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:BootstrapModuleFinder.java

示例2: calculateModuleIndex

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException {
    final Indexer indexer = new Indexer();
    final PathFilter filter = PathFilters.getDefaultImportFilter();
    final Iterator<Resource> iterator = module.iterateResources(filter);
    while (iterator.hasNext()) {
        Resource resource = iterator.next();
        if(resource.getName().endsWith(".class")) {
            try (InputStream in = resource.openStream()) {
                indexer.index(in);
            } catch (Exception e) {
                ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e);
            }
        }
    }
    return indexer.complete();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:CompositeIndexProcessor.java

示例3: parseSet

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private static void parseSet(final XMLStreamReader reader, final boolean include, final List<FilterSpecification> filters)
        throws XMLStreamException {
    final Set<String> set = new HashSet<String>();
    // xsd:choice
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                filters.add(new FilterSpecification(PathFilters.in(set), include));
                return;
            }
            case XMLStreamConstants.START_ELEMENT: {
                switch (Element.of(reader.getName())) {
                    case PATH:
                        parsePathName(reader, set);
                        break;
                }
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:JBossDeploymentStructureParser10.java

示例4: addResourceRoot

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void addResourceRoot(final ModuleSpec.Builder specBuilder, final ResourceRoot resource, final List<PermissionFactory> permFactories)
        throws DeploymentUnitProcessingException {
    try {
        final VirtualFile root = resource.getRoot();
        if (resource.getExportFilters().isEmpty()) {
            specBuilder.addResourceRoot(ResourceLoaderSpec.createResourceLoaderSpec(new VFSResourceLoader(resource
                    .getRootName(), root, resource.isUsePhysicalCodeSource())));
        } else {
            final MultiplePathFilterBuilder filterBuilder = PathFilters.multiplePathFilterBuilder(true);
            for (final FilterSpecification filter : resource.getExportFilters()) {
                filterBuilder.addFilter(filter.getPathFilter(), filter.isInclude());
            }
            specBuilder.addResourceRoot(ResourceLoaderSpec.createResourceLoaderSpec(new VFSResourceLoader(resource
                    .getRootName(), root, resource.isUsePhysicalCodeSource()), filterBuilder.create()));
        }
        // start with the root
        permFactories.add(new ImmediatePermissionFactory(
                new VirtualFilePermission(root.getPathName(), VirtualFilePermission.FLAG_READ)));
        // also include all children, recursively
        permFactories.add(new ImmediatePermissionFactory(
                new VirtualFilePermission(root.getChild("-").getPathName(), VirtualFilePermission.FLAG_READ)));
    } catch (IOException e) {
        throw ServerLogger.ROOT_LOGGER.failedToCreateVFSResourceLoader(resource.getRootName(), e);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:ModuleSpecProcessor.java

示例5: get

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
@Override
public ModuleSpec get(ModuleLoader loader, ModuleIdentifier id)
{
   if (getId().equals(id))
   {
      Builder builder = ModuleSpec.build(id);
      builder.addDependency(DependencySpec.createClassLoaderDependencySpec(PathFilters.acceptAll(),
               PathFilters.acceptAll(), AbstractModuleSpecProvider.class.getClassLoader(), getPaths()));
      builder.addDependency(DependencySpec.createClassLoaderDependencySpec(PathFilters.acceptAll(),
               PathFilters.acceptAll(), ClassLoader.getSystemClassLoader(), getPaths()));

      configure(loader, builder);

      return builder.create();
   }
   return null;
}
 
开发者ID:forge,项目名称:furnace,代码行数:18,代码来源:AbstractModuleSpecProvider.java

示例6: addAddonDependency

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void addAddonDependency(Set<AddonView> views, AddonId found, Builder builder,
         AddonDependencyEntry dependency)
{
   AddonId addonId = stateManager.resolveAddonId(views, dependency.getName());
   ModuleIdentifier moduleId = null;
   if (addonId != null)
   {
      Addon addon = lifecycleManager.getAddon(views, addonId);
      moduleId = findCompatibleInstalledModule(addonId);
      if (moduleId != null)
      {
         builder.addDependency(DependencySpec.createModuleDependencySpec(
                  PathFilters.not(PathFilters.getMetaInfFilter()),
                  dependency.isExported() ? PathFilters.acceptAll() : PathFilters.rejectAll(),
                  this,
                  moduleCache.getModuleId(addon),
                  dependency.isOptional()));
      }
   }

   if (!dependency.isOptional() && (addonId == null || moduleId == null))
      throw new ContainerException("Dependency [" + dependency + "] could not be loaded for addon [" + found
               + "]");
}
 
开发者ID:forge,项目名称:furnace,代码行数:25,代码来源:AddonModuleLoader.java

示例7: addAddonDependency

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void addAddonDependency(Set<AddonView> views, AddonId found, Builder builder, AddonDependencyEntry dependency)
{
   AddonId addonId = stateManager.resolveAddonId(views, dependency.getName());
   ModuleIdentifier moduleId = null;
   if (addonId != null)
   {
      Addon addon = lifecycleManager.getAddon(views, addonId);
      moduleId = findCompatibleInstalledModule(addonId);
      if (moduleId != null)
      {
         builder.addDependency(DependencySpec.createModuleDependencySpec(
                  PathFilters.not(PathFilters.getMetaInfFilter()),
                  dependency.isExported() ? PathFilters.acceptAll() : PathFilters.rejectAll(),
                  this,
                  moduleCache.getModuleId(addon),
                  dependency.isOptional()));
      }
   }

   if (!dependency.isOptional() && (addonId == null || moduleId == null))
      throw new ContainerException("Dependency [" + dependency + "] could not be loaded for addon [" + found
               + "]");
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:24,代码来源:AddonModuleLoader.java

示例8: apply

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
@Override
void apply(ModuleSpec.Builder builder) {
    builder.addDependency(
            DependencySpec.createModuleDependencySpec(
                    PathFilters.acceptAll(),
                    PathFilters.acceptAll(),
                    PathFilters.acceptAll(),
                    PathFilters.acceptAll(),
                    ClassFilters.acceptAll(),
                    ClassFilters.acceptAll(),
                    null,
                    ModuleIdentifier.create(this.name, this.slot), false));
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:14,代码来源:WildFlySwarmApplicationConf.java

示例9: parsePath

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private static void parsePath(final XMLStreamReader reader, final boolean include, final List<FilterSpecification> filters)
        throws XMLStreamException {
    String path = null;
    final Set<Attribute> required = EnumSet.of(Attribute.PATH);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        required.remove(attribute);
        switch (attribute) {
            case PATH:
                path = reader.getAttributeValue(i);
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }

    final boolean literal = path.indexOf('*') == -1 && path.indexOf('?') == -1;
    if (literal) {
        if (path.charAt(path.length() - 1) == '/') {
            filters.add(new FilterSpecification(PathFilters.isChildOf(path), include));
        } else {
            filters.add(new FilterSpecification(PathFilters.is(path), include));
        }
    } else {
        filters.add(new FilterSpecification(PathFilters.match(path), include));
    }

    // consume remainder of element
    parseNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:35,代码来源:JBossDeploymentStructureParser10.java

示例10: parsePath

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private static void parsePath(final XMLStreamReader reader, final boolean include, final MultiplePathFilterBuilder builder) throws XMLStreamException {
    String path = null;
    final Set<Attribute> required = EnumSet.of(Attribute.PATH);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        required.remove(attribute);
        switch (attribute) {
            case PATH:
                path = reader.getAttributeValue(i);
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }

    final boolean literal = path.indexOf('*') == -1 && path.indexOf('?') == -1;
    if (literal) {
        if (path.charAt(path.length() - 1) == '/') {
            builder.addFilter(PathFilters.isChildOf(path), include);
        } else {
            builder.addFilter(PathFilters.is(path), include);
        }
    } else {
        builder.addFilter(PathFilters.match(path), include);
    }

    // consume remainder of element
    parseNoContent(reader);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:34,代码来源:JBossDeploymentStructureParser13.java

示例11: accepts

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
@Override
public boolean accepts(VirtualFile file) {
    for (String filter : filterOnName) {
        PathFilter matchFilter = PathFilters.match(filter);
        if (matchFilter.accept(file.getPathName())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:wildfly-extras,项目名称:db-bootstrap,代码行数:11,代码来源:FilenameContainFilter.java

示例12: configure

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
@Override
protected void configure(ModuleLoader loader, Builder builder)
{
   builder.addDependency(DependencySpec.createSystemDependencySpec(
            PathFilters.acceptAll(),
            PathFilters.all(
                     PathFilters.not(PathFilters.any(
                              PathFilters.is("org/jboss/forge/furnace/impl"),
                              PathFilters.isChildOf("org/jboss/forge/furnace/impl"))),

                     PathFilters.any(Arrays.asList(
                              PathFilters.is("org/jboss/forge/furnace/proxy/javassist"),
                              PathFilters.isChildOf("org/jboss/forge/furnace/proxy/javassist"),
                              PathFilters.is("META-INF/services"),
                              PathFilters.is("org/jboss/forge/furnace"),
                              PathFilters.is("org/jboss/forge/furnace/addons"),
                              PathFilters.is("org/jboss/forge/furnace/event"),
                              PathFilters.is("org/jboss/forge/furnace/exception"),
                              PathFilters.is("org/jboss/forge/furnace/lifecycle"),
                              PathFilters.is("org/jboss/forge/furnace/lock"),
                              PathFilters.is("org/jboss/forge/furnace/repositories"),
                              PathFilters.is("org/jboss/forge/furnace/services"),
                              PathFilters.is("org/jboss/forge/furnace/spi"),
                              PathFilters.is("org/jboss/forge/furnace/util"),
                              PathFilters.is("org/jboss/forge/furnace/versions"),
                              PathFilters.is("org/jboss/forge/furnace/proxy")
                              ))),
            getPaths()));
}
 
开发者ID:forge,项目名称:furnace,代码行数:30,代码来源:FurnaceContainerSpec.java

示例13: addLocalResources

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void addLocalResources(AddonRepository repository, AddonId found, Builder builder, ModuleIdentifier id)
{
   List<File> resources = repository.getAddonResources(found);
   for (File file : resources)
   {
      try
      {
         if (file.isDirectory())
         {
            builder.addResourceRoot(
                     ResourceLoaderSpec.createResourceLoaderSpec(
                              ResourceLoaders.createFileResourceLoader(file.getName(), file),
                              PathFilters.acceptAll()));
         }
         else if (file.length() > 0)
         {
            JarFile jarFile = new JarFile(file);
            moduleJarFileCache.addJarFileReference(id, jarFile);
            builder.addResourceRoot(
                     ResourceLoaderSpec.createResourceLoaderSpec(
                              ResourceLoaders.createJarResourceLoader(file.getName(), jarFile),
                              PathFilters.acceptAll()));
         }
      }
      catch (IOException e)
      {
         throw new ContainerException("Could not load resources from [" + file.getAbsolutePath() + "]", e);
      }
   }
}
 
开发者ID:forge,项目名称:furnace,代码行数:31,代码来源:AddonModuleLoader.java

示例14: processBlackList

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
    for (String blackListed : blackList) {
        PathFilter filter = PathFilters.match(blackListed);
        for (ResourceRoot root : jars) {
            VirtualFile jar = root.getRoot();
            SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));

            if (filter.accept(jar.getName())) {
                SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
            }
        }

    }

}
 
开发者ID:ctomc,项目名称:wildfly-sdd,代码行数:16,代码来源:ClassBlackListDetectorProcessor.java

示例15: processBlackList

import org.jboss.modules.filter.PathFilters; //导入依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
    for (String blackListed : blackList) {
        PathFilter filter = PathFilters.match(blackListed);
        for (ResourceRoot root : jars) {
            VirtualFile jar = root.getRoot();
            SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));

            if (filter.accept(jar.getName())) {
                SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
            }
        }
    }
}
 
开发者ID:ctomc,项目名称:wildfly-sdd,代码行数:14,代码来源:JarBlackListDetectorProcessor.java


注:本文中的org.jboss.modules.filter.PathFilters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。