Disable component on specific run mode
Hi everyone,
we have two special components in an OSGi Bundle. One should only run on the author instance and the other only on publish. Does anyone of you know how to disable each component on author/publish while activating the bundle?
We've tried this so far:
private static final String AUTHOR_RUN_MODE = "author"; @Activate public void activate(final ComponentContext context) throws Exception { @SuppressWarnings("rawtypes") final Dictionary properties = context.getProperties(); if (!slingSettingsService.getRunModes().contains(AUTHOR_RUN_MODE)) { final String componentName = (String) properties.get(ComponentConstants.COMPONENT_NAME); context.disableComponent(componentName); } }Thanks in advance!
