Ales Justin [
http://community.jboss.org/people/alesj] replied to the discussion
"Is it possible to add classloader root with wildcard pattern?"
To view the discussion, visit:
http://community.jboss.org/message/552495#552495
--------------------------------------------------------------
Feel free to suggest a proper patch which would handle this wildcard
matching.
List<VirtualFile> vfsRoots = new ArrayList<VirtualFile>();
for (String root : roots)
{
int wc = root.lastIndexOf("*"); // is it wildcard
if (wc >= 0)
{
final String wcString = root.substring(wc + 1);
VirtualFile start;
if (wc > 0) // some more path before
{
start = VFS.getChild(root.substring(0, wc));
}
else
{
start = VFS.getRootVirtualFile();
}
try
{
List<VirtualFile> children = start.getChildren(new
VirtualFileFilter()
{
public boolean accepts(VirtualFile file)
{
String name = file.getName();
return name.endsWith(wcString);
}
});
vfsRoots.addAll(children);
}
catch (IOException e)
{
throw new RuntimeException("Error creating VFS files for " +
root, e);
}
}
else
{
try
{
URI uri = new URI(root);
vfsRoots.add(VFS.getChild(uri));
}
catch (URISyntaxException e)
{
throw new RuntimeException("Error creating VFS file for " +
root, e);
}
}
}
this.vfsRoots = vfsRoots.toArray(new VirtualFile[vfsRoots.size()]);
This would do it for wildcard.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/552495#552495]
Start a new discussion in JBoss Microcontainer at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]