InputStream stream = factory.lookupFile(resourcePathOrJsonContentString, Thread.currentThread().getContextClassLoader());
if (stream == null) {
stream = factory.lookupFile(resourcePathOrJsonContentString, RepositoryConfiguration.class.getClassLoader());
}
if (stream != null) {
Document doc = Json.read(stream);
return new RepositoryConfiguration(doc, withoutExtension(resourcePathOrJsonContentString));
}
// Try a file ...
File file = new File(resourcePathOrJsonContentString);
if (file.exists() && file.isFile()) {
return read(file);
}
String content = resourcePathOrJsonContentString.trim();
if (content.startsWith("{")) {
// Try to parse the document ...
Document doc = Json.read(content);
return new RepositoryConfiguration(doc, null);
}
throw new FileNotFoundException(resourcePathOrJsonContentString);
}