in src/main/java/org/apache/sling/installer/provider/file/impl/Installer.java [138:181]
private InstallableResource createResource(final File file) {
try {
// check for run modes
final String name = file.getAbsolutePath().substring(this.prefix.length()).replace(File.separatorChar, '/');
boolean isActive = true;
Integer prio = null;
final int pos = name.indexOf('/');
if ( pos != -1 && name.startsWith("install.") ) {
final String runModes = name.substring(8, pos);
final int activeModes = slingSettings.getBestRunModeMatchCountFromSpec(runModes);
if ( activeModes > 0 ) {
prio = InstallableResource.DEFAULT_PRIORITY + activeModes;
} else {
isActive = false;
}
}
if ( isActive ) {
final InputStream is = new FileInputStream(file);
final String digest = String.valueOf(file.lastModified());
// if this is a bundle check for start level directory!
final Dictionary<String, Object> dict = new Hashtable<String, Object>();
if ( file.getName().endsWith(".jar") || file.getName().endsWith(".war") ) {
final String parentName = file.getParentFile().getName();
try {
final int startLevel = Integer.valueOf(parentName);
if ( startLevel > 0 ) {
dict.put(InstallableResource.BUNDLE_START_LEVEL, startLevel);
}
} catch (NumberFormatException nfe) {
// ignore this
}
}
dict.put(InstallableResource.RESOURCE_URI_HINT, file.toURI().toString());
return new InstallableResource(file.getAbsolutePath(), is, dict, digest,
null, prio);
} else {
logger.info("Ignoring inactive resource at {}", file);
}
} catch (IOException io) {
logger.error("Unable to read file " + file, io);
}
return null;
}