private void loadFile(File file, Map<String,FeatureNode> featureMapBuilder) throws GadgetException, IOException { if (!file.exists() || !file.canRead()) { throw new GadgetException(GadgetException.Code.INVALID_CONFIG, "Feature file '" + file.getPath() + "' doesn't exist or can't be read"); } File[] toLoad = file.isDirectory() ? file.listFiles() : new File[] { file }; for (File featureFile : toLoad) { if (featureFile.isDirectory()) { // Traverse into subdirectories. loadFile(featureFile, featureMapBuilder); } else if (featureFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".xml")) { String content = ResourceLoader.getContent(featureFile); Uri parent = Uri.fromJavaUri(featureFile.toURI()); loadFeature(parent, content, featureMapBuilder); } else { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(featureFile.getAbsolutePath() + " doesn't seem to be an XML file."); } } } }
private void loadFile(File file, Map<String,FeatureNode> featureMapBuilder) throws GadgetException, IOException { if (!file.exists() || !file.canRead()) { throw new GadgetException(GadgetException.Code.INVALID_CONFIG, "Feature file '" + file.getPath() + "' doesn't exist or can't be read"); } File[] toLoad = file.isDirectory() ? file.listFiles() : new File[] { file }; for (File featureFile : toLoad) { if (featureFile.isDirectory()) { // Traverse into subdirectories. loadFile(featureFile, featureMapBuilder); } else if (featureFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".xml")) { String content = ResourceLoader.getContent(featureFile); Uri parent = Uri.fromJavaUri(featureFile.toURI()); loadFeature(parent, content, featureMapBuilder); } else { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(featureFile.getAbsolutePath() + " doesn't seem to be an XML file."); } } } }
private void loadResources(List<String> resources, Map<String,FeatureNode> featureMapBuilder) throws GadgetException { try { for (String resource : resources) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Processing resource: " + resource); } String content = getResourceContent(resource); Uri parent = new UriBuilder().setScheme(RESOURCE_SCHEME).setPath(resource).toUri(); loadFeature(parent, content, featureMapBuilder); } } catch (IOException e) { throw new GadgetException(GadgetException.Code.INVALID_PATH, e); } }
private void loadResources(List<String> resources, Map<String,FeatureNode> featureMapBuilder) throws GadgetException { try { for (String resource : resources) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Processing resource: " + resource); } String content = getResourceContent(resource); Uri parent = new UriBuilder().setScheme(RESOURCE_SCHEME).setPath(resource).toUri(); loadFeature(parent, content, featureMapBuilder); } } catch (IOException e) { throw new GadgetException(GadgetException.Code.INVALID_PATH, e); } }
private void loadResources(List<String> resources, Map<String,FeatureNode> featureMapBuilder) throws GadgetException { try { for (String resource : resources) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Processing resource: " + resource); } String content = resourceLoader.getResourceContent(resource); Uri parent = new UriBuilder().setScheme(RESOURCE_SCHEME).setPath(resource).toUri(); loadFeature(parent, content, featureMapBuilder); } } catch (IOException e) { throw new GadgetException(GadgetException.Code.INVALID_PATH, e); } }
private void loadFile(FeatureFile file, Map<String,FeatureNode> featureMapBuilder) throws GadgetException, IOException { if (!file.exists() || !file.canRead()) { throw new GadgetException(GadgetException.Code.INVALID_CONFIG, "Feature file '" + file.getPath() + "' doesn't exist or can't be read"); } FeatureFile[] toLoad = file.isDirectory() ? file.listFiles() : new FeatureFile[] { file }; for (FeatureFile featureFile : toLoad) { if (featureFile.isDirectory()) { // Traverse into subdirectories. loadFile(featureFile, featureMapBuilder); } else if (featureFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".xml")) { String content = featureFile.getContent(); Uri parent = Uri.fromJavaUri(featureFile.toURI()); loadFeature(parent, content, featureMapBuilder); } else { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(featureFile.getAbsolutePath() + " doesn't seem to be an XML file."); } } } }