in src/main/java/org/apache/sling/feature/apiregions/impl/RegionConfiguration.java [382:409]
private URI getDataFileURI(BundleContext ctx, String name) throws IOException, URISyntaxException {
String fn = ctx.getProperty(RegionConstants.PROPERTIES_RESOURCE_PREFIX + name);
if (fn == null) {
String loc = ctx.getProperty(RegionConstants.PROPERTIES_FILE_LOCATION);
if (loc != null) {
fn = loc + "/" + name;
}
}
if (fn == null)
throw new IOException("API Region Enforcement enabled, but no configuration found to find "
+ "region definition resource: " + name);
if (fn.contains(":")) {
if (fn.startsWith(RegionConstants.CLASSLOADER_PSEUDO_PROTOCOL)) {
// It's using the 'classloader:' protocol looks up the location from the classloader
String loc = fn.substring(RegionConstants.CLASSLOADER_PSEUDO_PROTOCOL.length());
if (!loc.startsWith("/"))
loc = "/" + loc;
fn = getClass().getResource(loc).toString();
}
// It's already a URL
return new URI(fn);
} else {
// It's a file location
return new File(fn).toURI();
}
}