}
if(localdp == null)
return null;
FSDirectory dir = localdp.getDirectory();
File indexRoot = dir.getFile();
if (key == null) {
File[] subIndex = indexRoot.listFiles();
for (File sub : subIndex) {
localDirectoryToMap(sub.getName());
}
return localdp;
}
DirectoryProvider dp = providerMap.get(key);
if (dp != null)
return dp;
File indexFile = new File(indexRoot, key);
String indexName = "";
boolean create = !indexFile.exists();
FSDirectory directory = null;
try {
indexName = indexFile.getCanonicalPath();
directory = FSDirectory.getDirectory(indexName);
if (create) {
log.debug("Initialize index: '" + indexFile + "'");