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