Class ResourceServiceManager

  • All Implemented Interfaces:
    ResourceServiceManagerMBean, DynamicMBean, MBeanRegistration, org.osgi.service.event.EventHandler

    public abstract class ResourceServiceManager
    extends com.adobe.granite.jmx.annotation.AnnotatedStandardMBean
    implements ResourceServiceManagerMBean, org.osgi.service.event.EventHandler
    Base class for services to extend which want to manage other services based on repository configurations.
    • Method Detail

      • activate

        @Activate
        public void activate​(org.osgi.service.component.ComponentContext context)
                      throws org.apache.sling.api.resource.LoginException
        Throws:
        org.apache.sling.api.resource.LoginException
      • deactivate

        @Deactivate
        public void deactivate​(org.osgi.service.component.ComponentContext context)
                        throws org.apache.sling.api.resource.LoginException
        Throws:
        org.apache.sling.api.resource.LoginException
      • getBundleContext

        public org.osgi.framework.BundleContext getBundleContext()
      • getRegisteredServices

        public Map<String,​org.osgi.framework.ServiceRegistration> getRegisteredServices()
      • getResourceResolver

        protected abstract org.apache.sling.api.resource.ResourceResolver getResourceResolver()
        Get a resource resolver to access the Sling Repository.
        Returns:
        the resource resolver
      • getRootPath

        public abstract String getRootPath()
        Get the root path for the instance of the ResourceServiceManager, the configuration should be cq:Page children of the resource at this path.
        Returns:
        the configuration root
      • handleEvent

        public void handleEvent​(org.osgi.service.event.Event event)
        Specified by:
        handleEvent in interface org.osgi.service.event.EventHandler
      • isServiceUpdated

        protected abstract boolean isServiceUpdated​(org.apache.sling.api.resource.Resource config,
                                                    org.osgi.framework.ServiceReference reference)
        Checks whether or not the specified ServiceReference is up to date with the configuration resource.
        Parameters:
        config - the configuration resource
        reference - the service reference to check
        Returns:
        true if the ServiceReference is up to date with the resource, false otherwise
      • registerServiceObject

        protected abstract org.osgi.framework.ServiceRegistration registerServiceObject​(org.apache.sling.api.resource.Resource config,
                                                                                        Hashtable<String,​Object> props)
        Register the service with the OSGi Container based on the configuration.
        Parameters:
        config - the configuration resource
        props - the default properties
        Returns:
        the ServiceRegistration from registering the service