protected Map<String, RestxSpec> buildSpecsMap(boolean searchInSources) { Map<String, RestxSpec> specsMap = Maps.newLinkedHashMap(); Map<String, URL> specs = MoreResources.findResources("", Pattern.compile(".*\\.spec\\.yaml"), searchInSources); for (final Map.Entry<String, URL> spec : specs.entrySet()) { try { specsMap.put(spec.getKey(), specLoader.load(spec.getKey(), new CharSource() { @Override public Reader openStream() throws IOException { return new InputStreamReader(spec.getValue().openStream(), Charsets.UTF_8); } })); } catch (Exception e) { logger.warn("exception while loading restx spec " + spec + ": " + e, e); } } return specsMap; }
public static Archetype buildArchetype(String packageName) { Map<String,URL> resources = MoreResources.findResources(packageName, Pattern.compile(".*"), true); ImmutableList.Builder<ArchetypeEntry> builder = ImmutableList.builder(); for (String r : resources.keySet()) { if (r.substring(r.lastIndexOf('/') + 1).startsWith("_")) { builder.add(buildTemplate(packageName.replace('.', '/') + '/', r.substring(packageName.length() + 1))); } else { builder.add(new StaticArchetypeEntry(r.substring(packageName.length() + 1), Resources.asByteSource(Resources.getResource(r)))); } } return new Archetype(builder.build()); }
protected Map<String, RestxSpec> buildSpecsMap(boolean searchInSources) { Map<String, RestxSpec> specsMap = Maps.newLinkedHashMap(); Map<String, URL> specs = MoreResources.findResources("", Pattern.compile(".*\\.spec\\.yaml"), searchInSources); for (final Map.Entry<String, URL> spec : specs.entrySet()) { try { specsMap.put(spec.getKey(), specLoader.load(spec.getKey(), new CharSource() { @Override public Reader openStream() throws IOException { return new InputStreamReader(spec.getValue().openStream(), Charsets.UTF_8); } })); } catch (Exception e) { logger.warn("exception while loading restx spec " + spec + ": " + e, e); } } return specsMap; }
public static Archetype buildArchetype(String packageName) { Map<String,URL> resources = MoreResources.findResources(packageName, Pattern.compile(".*"), true); ImmutableList.Builder<ArchetypeEntry> builder = ImmutableList.builder(); for (String r : resources.keySet()) { if (r.substring(r.lastIndexOf('/') + 1).startsWith("_")) { builder.add(buildTemplate(packageName.replace('.', '/') + '/', r.substring(packageName.length() + 1))); } else { builder.add(new StaticArchetypeEntry(r.substring(packageName.length() + 1), Resources.asByteSource(Resources.getResource(r)))); } } return new Archetype(builder.build()); }