public static Set<PaxmlResource> findResources(String base, Set<String> includes, Set<String> excludes) { if (includes == null) { includes = new HashSet<String>(1); includes.add("**/*.*"); } if (excludes == null) { excludes = Collections.EMPTY_SET; } if (StringUtils.isEmpty(base)) { base = PaxmlUtils.getCurrentDir().getAbsolutePath(); } File f = new File(base); if (f.isDirectory()) { f = new File(f, "fake.file"); } Resource baseRes = new FileSystemResource(f).getSpringResource(); Set<PaxmlResource> include = new LinkedHashSet<PaxmlResource>(0); Set<PaxmlResource> exclude = new LinkedHashSet<PaxmlResource>(0); ResourceMatcher matcher = new ResourceMatcher(includes, excludes); for (String pattern : matcher.include) { include.addAll(ResourceLocator.findResources(pattern, baseRes)); } for (String pattern : matcher.exclude) { exclude.addAll(ResourceLocator.findResources(pattern, baseRes)); } include.removeAll(exclude); return include; }
private void buildResources(OMElement root, boolean detach) { for (OMElement ele : AxiomUtils.getElements(root, "resource")) { ResourceMatcher matcher = parseIncludeAndExclude(ele); Set<PaxmlResource> include = new LinkedHashSet<PaxmlResource>(0); Set<PaxmlResource> exclude = new LinkedHashSet<PaxmlResource>(0); for (String pattern : matcher.include) { include.addAll(ResourceLocator.findResources(pattern, planFile)); } for (String pattern : matcher.exclude) { exclude.addAll(ResourceLocator.findResources(pattern, planFile)); } include.removeAll(exclude); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } include.remove(planFileResource); model.getConfig().getResources().addAll(include); if (detach) { ele.detach(); } } }
private void buildResources(OMElement root, boolean detach) { for (OMElement ele : AxiomUtils.getElements(root, "resource")) { ResourceMatcher matcher = parseIncludeAndExclude(ele); Set<PaxmlResource> include = new LinkedHashSet<PaxmlResource>(0); Set<PaxmlResource> exclude = new LinkedHashSet<PaxmlResource>(0); for (String pattern : matcher.include) { include.addAll(ResourceLocator.findResources(pattern, planFile)); } for (String pattern : matcher.exclude) { exclude.addAll(ResourceLocator.findResources(pattern, planFile)); } include.removeAll(exclude); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } include.remove(planFileResource); model.getConfig().getResources().addAll(include); if (detach) { ele.detach(); } } }