Package com.adobe.acs.commons.util
Class ResourceServiceManager
- java.lang.Object
-
- javax.management.StandardMBean
-
- com.adobe.granite.jmx.annotation.AnnotatedStandardMBean
-
- com.adobe.acs.commons.util.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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATION_ID_KEYstatic StringSERVICE_OWNER_KEY
-
Constructor Summary
Constructors Modifier Constructor Description protectedResourceServiceManager(Class<?> mbeanInterface)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivate(org.osgi.service.component.ComponentContext context)voiddeactivate(org.osgi.service.component.ComponentContext context)org.osgi.framework.BundleContextgetBundleContext()List<String>getRegisteredConfigurations()Map<String,org.osgi.framework.ServiceRegistration>getRegisteredServices()protected abstract org.apache.sling.api.resource.ResourceResolvergetResourceResolver()Get a resource resolver to access the Sling Repository.abstract StringgetRootPath()Get the root path for the instance of the ResourceServiceManager, the configuration should be cq:Page children of the resource at this path.voidhandleEvent(org.osgi.service.event.Event event)protected abstract booleanisServiceUpdated(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.voidrefreshCache()protected abstract org.osgi.framework.ServiceRegistrationregisterServiceObject(org.apache.sling.api.resource.Resource config, Hashtable<String,Object> props)Register the service with the OSGi Container based on the configuration.-
Methods inherited from class com.adobe.granite.jmx.annotation.AnnotatedStandardMBean
getAnnotation, getConstructor, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getMethod, getParamAnnotation, getParamAnnotation, getParameterName, getParameterName, getReadMethod, getWriteMethod
-
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getDescription, getDescription, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
-
-
-
-
Field Detail
-
SERVICE_OWNER_KEY
public static final String SERVICE_OWNER_KEY
- See Also:
- Constant Field Values
-
CONFIGURATION_ID_KEY
public static final String CONFIGURATION_ID_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceServiceManager
protected ResourceServiceManager(Class<?> mbeanInterface) throws NotCompliantMBeanException
- Throws:
NotCompliantMBeanException
-
-
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()
-
getRegisteredConfigurations
public List<String> getRegisteredConfigurations()
- Specified by:
getRegisteredConfigurationsin interfaceResourceServiceManagerMBean
-
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:
handleEventin interfaceorg.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 resourcereference- the service reference to check- Returns:
- true if the ServiceReference is up to date with the resource, false otherwise
-
refreshCache
public void refreshCache()
- Specified by:
refreshCachein interfaceResourceServiceManagerMBean
-
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 resourceprops- the default properties- Returns:
- the ServiceRegistration from registering the service
-
-