Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import java.util.HashMap;
import java.util.Map;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(service = EventHandler.class, property = {
EventConstants.EVENT_TOPIC + "=com/adobe/fmdita/postprocess/complete", EventConstants.EVENT_FILTER
+ "=(|(operation=org/apache/sling/api/resource/Resource/ADDED)(operation=org/apache/sling/api/resource/Resource/CHANGED))" })
public class SamplePostProcessListener implements EventHandler {
private static final Logger LOG = LoggerFactory.getLogger(SamplePostProcessListener.class);
private ResourceResolverFactory resolverFactory;
public void handleEvent(Event event) {
String path = (String) event.getProperty("path");
// Fetch resource resolver
Map<String, Object> serviceParams = new HashMap<>();
serviceParams.put(ResourceResolverFactory.SUBSERVICE, "someServiceUser");
ResourceResolver resolver = null;
try {
resolver = resolverFactory.getServiceResourceResolver(serviceParams);"path of DITA Asset: {} ", path);
} catch (LoginException e) {
LOG.error("Exception while acessing info about DITA asset ", e);
} finally {
if (resolver != null) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment