String relPath = getInstallableResourceId(path, bundleResource);
String name = FilenameUtils.getName(relPath);
if (name == null || name.isEmpty()) {
return null; //ignore directories!
}
InstallableResource resource;
try {
/*
* Notes:
* - use <relativepath> as id
* - parse null as type to enable autodetection for configs as
* implemented by InternalReseouce.create(..)
* - we use the symbolic name and the modification date of the bundle as digest
* - the Dictionary will be ignored if an input stream is present
* so it is best to parse null
* - No idea how the priority is used by the Sling Installer. For
* now parse null than the default priority is used.
*/
resource = new InstallableResource(relPath,
bundleResource.openStream(), null,
String.valueOf(bundle.getSymbolicName()+bundle.getLastModified()), null, null);
log.info(" ... found installable resource " + bundleResource);
} catch (IOException e) {
log.error(String.format("Unable to process configuration File %s from Bundle %s",