in src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java [73:129]
private boolean checkPath(final String rootPath,
final String resourceType,
Integer prio) {
int count = 0;
final Iterator<String> configPaths = resourceProvider.getChildren(rootPath);
if ( configPaths != null ) {
final int hintPos = rootPath.lastIndexOf('/');
final String hint = rootPath.substring(hintPos + 1);
while (configPaths.hasNext()) {
String path = configPaths.next();
if ( path.endsWith("/") ) {
path = path.substring(0, path.length() - 1);
}
if ( !checkPath(path, resourceType, prio) ) {
count++;
final URL url = resourceProvider.getResource(path);
if(url == null){
logger.debug("Launchpad ignoring path '{}' due to null URL", path);
continue;
}
Dictionary<String, Object> dict = null;
if ( InstallableResource.TYPE_FILE.equals(resourceType) ) {
dict = new Hashtable<String, Object>();
if ( !hint.startsWith(INSTALL_NAME) ) {
dict.put(InstallableResource.INSTALLATION_HINT, hint);
}
try {
dict.put(InstallableResource.RESOURCE_URI_HINT, url.toURI().toString());
} catch (final URISyntaxException e) {
// we just ignore this
}
} else if ( !hint.equals(CONFIG_NAME) ) {
final int activeModes = isActive(hint);
if ( activeModes == 0 ) {
logger.debug("Launchpad ignoring {} : {} due to unactivated run mode: {}", new Object[] {resourceType, path, hint});
continue;
}
prio = PRIORITY + PRIORITY_BOOST * activeModes;
}
long lastModified = -1;
try {
lastModified = url.openConnection().getLastModified();
} catch (final IOException e) {
// we ignore this
}
logger.debug("Launchpad {} will be registered: {}", resourceType, path);
final String digest = (lastModified > 0 ? String.valueOf(lastModified) : null);
final InputStream stream = resourceProvider.getResourceAsStream(path);
installables.add(new InstallableResource(path, stream, dict, digest, resourceType, prio));
}
}
}
return count > 0;
}