[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Parsing more than one file
alesj
do-not-reply at jboss.com
Mon Mar 31 11:42:42 EDT 2008
"alesj" wrote :
| Is there a default impl we want/can do with these two new methods - handling multiple names in AbstractParsingDeployerWithOutput:
|
| | protected T parse(DeploymentUnit unit, Set<String> names, T root) throws Exception
| | {
| | return null;
| | }
| |
This one is no brainer. :-)
| protected T parse(DeploymentUnit unit, Set<String> names, T root) throws Exception
| {
| if (names == null || names.isEmpty())
| throw new IllegalArgumentException("Null or empty names.");
|
| VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
|
| Set<VirtualFile> files = new HashSet<VirtualFile>();
| Set<String> missingFiles = new HashSet<String>();
|
| for (String name : names)
| {
| VirtualFile file = vfsDeploymentUnit.getMetaDataFile(name);
| if (file != null)
| files.add(file);
| else
| missingFiles.add(name);
| }
|
| if (missingFiles.size() == names.size())
| return null;
|
| return mergeFiles(files, missingFiles);
| }
|
| /**
| * Merge files into one piece of metatdata
| *
| * @param files matching meta files
| * @param missingFiles file names that are missing matching file
| * @return merged metadata
| */
| private T mergeFiles(Set<VirtualFile> files, Set<String> missingFiles)
| {
| return null;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140209#4140209
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140209
More information about the jboss-dev-forums
mailing list