Problem:
An OSGi component is disabled by default, need to enable it programmatically in AEM6.x.Solution:
Use SCR API to enable it. Sample code here:
Complete code can be found here:
for (Bundle bundle : bundleContext.getBundles()) { ComponentDescriptionDTO dto = scr.getComponentDescriptionDTO(bundle, componentName); if (dto != null && !scr.isComponentEnabled(dto)) { LOGGER.info("Component {} disabled by configuration.", dto.implementationClass); scr.enableComponent(dto); } }
Use Case:
Sample use case is to enable "com.day.cq.dam.core.impl.MissingMetadataNotificationJob" component in https://helpx.adobe.com/experience-manager/6-3/assets/using/metadata-schemas.html#Definemandatorymetadata
No comments:
Post a Comment