in src/main/java/org/apache/sling/i18n/impl/LocatorPathsTracker.java [51:94]
public Set<LocatorPaths> addingBundle(Bundle bundle, BundleEvent event) {
log.debug("Considering bundle for registering resource bundle locator paths: {}", bundle.getSymbolicName());
Set<LocatorPaths> pathsSet = null;
String provideCapability = bundle.getHeaders().get(Constants.PROVIDE_CAPABILITY);
if (provideCapability != null) {
ManifestHeader header = ManifestHeader.parse(provideCapability);
for (Entry entry : header.getEntries()) {
if (CAPABILITY_I18N_RESOURCEBUNDLE_LOCATOR.equals(entry.getValue())) {
String paths = entry.getAttributeValue(ATTR_PATHS);
if (paths != null) {
if (pathsSet == null) {
pathsSet = new HashSet<>();
}
// use optional depth value if supplied (or 1 by default)
int traversalDepth = 1;
String depth = entry.getAttributeValue(ATTR_DEPTH);
if (depth != null && !depth.isEmpty()) {
traversalDepth = Integer.parseInt(depth);
}
// treat paths value as a csv
String[] items = paths.split(",");
for (String path : items) {
path = path.trim(); // ignore surrounding spaces
if (!path.isEmpty()) {
pathsSet.add(new LocatorPaths(path, traversalDepth, bundle.getBundleId()));
}
}
}
}
}
if (pathsSet != null) {
log.info(
"Registered {} resource bundle locator paths for bundle: {}",
pathsSet.size(),
bundle.getSymbolicName());
this.rbp.registerLocatorPaths(pathsSet);
}
}
return pathsSet;
}