use of org.jboss.vfs.VirtualFileFilter in project wildfly by wildfly.
the class JdrTestCase method testWildcardFilterMiddleGlob.
@Test
public void testWildcardFilterMiddleGlob() throws Exception {
VirtualFileFilter filter = Filters.wildcard("/this*test.txt");
VirtualFile good = VFS.getChild("/this/is/a/test.txt");
VirtualFile bad1 = VFS.getChild("/that/is/a/test.txt");
VirtualFile bad2 = VFS.getChild("/this/is/a/test.xml");
VirtualFile win = VFS.getChild("/C:/this/is/a/test.txt");
VirtualFile winbad = VFS.getChild("/C:/this/is/a/test.xml");
assertTrue(filter.accepts(good));
assertTrue(filter.accepts(win));
assertFalse(filter.accepts(bad1));
assertFalse(filter.accepts(bad2));
assertFalse(filter.accepts(winbad));
}
use of org.jboss.vfs.VirtualFileFilter in project wildfly by wildfly.
the class KernelDeploymentParsingProcessor method parseDescriptors.
/**
* Find and parse -jboss-beans.xml files.
*
* @param unit the deployment unit
* @param root the root
* @throws DeploymentUnitProcessingException
* for any error
*/
protected void parseDescriptors(DeploymentUnit unit, VirtualFile root) throws DeploymentUnitProcessingException {
if (root == null || root.exists() == false)
return;
Collection<VirtualFile> beans;
final String name = root.getName();
if (name.endsWith("jboss-beans.xml")) {
beans = Collections.singleton(root);
} else {
VirtualFileFilter filter = new SuffixMatchFilter("jboss-beans.xml");
beans = new ArrayList<VirtualFile>();
try {
// try plain .jar/META-INF
VirtualFile metainf = root.getChild("META-INF");
if (metainf.exists())
beans.addAll(metainf.getChildren(filter));
// allow for WEB-INF/*-jboss-beans.xml
VirtualFile webinf = root.getChild("WEB-INF");
if (webinf.exists()) {
beans.addAll(webinf.getChildren(filter));
// allow WEB-INF/classes/META-INF
metainf = webinf.getChild("classes/META-INF");
if (metainf.exists())
beans.addAll(metainf.getChildren(filter));
}
} catch (IOException e) {
throw new DeploymentUnitProcessingException(e);
}
}
for (VirtualFile beansXmlFile : beans) parseDescriptor(unit, beansXmlFile);
}
Aggregations