[jboss-user] [Microcontainer] - Re: Retrieve all metadata from a deployment unit.
beve
do-not-reply at jboss.com
Fri Apr 24 02:22:36 EDT 2009
In our case the file we are looking of is in a subdirectory and I think this is the problem.
getMetaDataFiles does not look for files recursively in all metadata locations.
// Look in the meta data location
| List<VirtualFile> results = new ArrayList<VirtualFile>();
| for (VirtualFile location : metaDataLocations)
| {
| List<VirtualFile> result = location.getChildren(new MetaDataMatchFilter(name, suffix));
| if (result != null && result.isEmpty() == false)
| {
| ...
There is another constructor for MetaDataMatcher that takes VisitorAttributes. When using the constructor with name and suffix the attributes will be set to VisitorAttributes.LEAVES_ONLY:
| if (attributes == null)
| attributes = VisitorAttributes.LEAVES_ONLY;
Using the second constructor and setting VisitorAttributes.RECURSE_LEAVES_ONLY does what we want:
| List<VirtualFile> results = new ArrayList<VirtualFile>();
| for (VirtualFile location : metaDataLocations)
| {
| List<VirtualFile> result = location.getChildren(new MetaDataMatchFilter(name, suffix, VisitorAttributes.RECURSE_LEAVES_ONLY));
| if (result != null && result.isEmpty() == false)
| {
| ...
This might be by design but is there a way for us to accomplish this?
Thanks,
/Daniel
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226477#4226477
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226477
More information about the jboss-user
mailing list