throws GadgetException {
Map<String,FeatureNode> featureMapBuilder = Maps.newHashMap();
try {
for (String location : resourceList) {
Uri uriLoc = getComponentUri(location);
if (uriLoc.getScheme() != null && uriLoc.getScheme().equals(RESOURCE_SCHEME)) {
List<String> resources = Lists.newArrayList();
// Load as resource using ResourceLoader.
location = uriLoc.getPath();
if (location.startsWith("/")) {
// Accommodate res:// URIs.
location = location.substring(1);
}
if (LOG.isLoggable(Level.INFO)) {
LOG.logp(Level.INFO, classname, "register",
MessageKeys.LOAD_RESOURCES_FROM, new Object[] {uriLoc.toString()});
}
if (location.endsWith(".txt")) {
// Text file contains a list of other resource files to load
for (String resource : CRLF_SPLITTER.split(resourceLoader.getResourceContent(location))) {
if (resource.charAt(0) != '#') {
// Skip commented lines.
resource = getComponentUri(resource).getPath();
resources.add(resource);
}
}
} else {
resources.add(location);
}
loadResources(resources, featureMapBuilder);
} else {
// Load files in directory structure.
if (LOG.isLoggable(Level.INFO)) {
LOG.logp(Level.INFO, classname, "register",
MessageKeys.LOAD_FILES_FROM, new Object[] {location});
}
loadFile(fileSystem.getFile(uriLoc.getPath()), featureMapBuilder);
}
}
return ImmutableMap.copyOf(featureMapBuilder);
} catch (IOException e) {
throw new GadgetException(GadgetException.Code.INVALID_PATH, e);