Author: rareddy
Date: 2011-04-28 12:02:26 -0400 (Thu, 28 Apr 2011)
New Revision: 3127
Modified:
trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
Log:
TEIID-1553: Enabling the VDB deployer to scan all the directories including
sub-directories, this enable the function model to be found and which is located under a
folder.
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-04-28 02:55:13
UTC (rev 3126)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2011-04-28 16:02:26
UTC (rev 3127)
@@ -62,9 +62,7 @@
List<VirtualFile> children = file.getChildren();
for (VirtualFile child:children) {
- if (!child.isLeaf()) {
- scanDirs.add(child.getName());
- }
+ addAllDirs(child, scanDirs, null);
}
createContext(structureContext, scanDirs.toArray(new String[scanDirs.size()]));
return true;
@@ -75,5 +73,25 @@
}
return false;
}
+
+ private void addAllDirs(VirtualFile file, List<String> scanDirs, String
parentName) throws IOException {
+ if (!file.isLeaf()) {
+ if (parentName != null) {
+ scanDirs.add(parentName + "/" + file.getName()); //$NON-NLS-1$
+ }
+ else {
+ scanDirs.add(file.getName());
+ }
+ List<VirtualFile> children = file.getChildren();
+ for (VirtualFile child:children) {
+ if (parentName == null) {
+ addAllDirs(child, scanDirs, file.getName());
+ }
+ else {
+ addAllDirs(child, scanDirs, parentName + "/" +file.getName());
//$NON-NLS-1$
+ }
+ }
+ }
+ }
}
Show replies by date