Package com.composum.sling.core
Class BeanContext.Service
- java.lang.Object
-
- org.apache.sling.api.adapter.SlingAdaptable
-
- com.composum.sling.core.BeanContext.AbstractContext
-
- com.composum.sling.core.BeanContext.AbstractScriptContext
-
- com.composum.sling.core.BeanContext.Map
-
- com.composum.sling.core.BeanContext.Service
-
- All Implemented Interfaces:
BeanContext
,Cloneable
,org.apache.sling.api.adapter.Adaptable
- Enclosing interface:
- BeanContext
public static class BeanContext.Service extends BeanContext.Map
a Service based implementation for a background service or a job execution
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.composum.sling.core.BeanContext
BeanContext.AbstractContext, BeanContext.AbstractScriptContext, BeanContext.Map, BeanContext.Page, BeanContext.Scope, BeanContext.Service, BeanContext.Servlet, BeanContext.Wrapper
-
-
Field Summary
-
Fields inherited from class com.composum.sling.core.BeanContext.Map
request, resolver, resource
-
Fields inherited from class com.composum.sling.core.BeanContext.AbstractScriptContext
scriptHelper, slingBindings
-
Fields inherited from class com.composum.sling.core.BeanContext.AbstractContext
locale
-
Fields inherited from interface com.composum.sling.core.BeanContext
ATTR_LOCALE, ATTR_REQUEST, ATTR_RESOLVER, ATTR_RESOURCE, ATTR_RESPONSE
-
-
Constructor Summary
Constructors Constructor Description Service()
Service(org.apache.sling.api.resource.ResourceResolver resolver)
Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource)
Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource, org.apache.sling.api.resource.ResourceResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.osgi.framework.BundleContext
getBundleContext()
<T> T[]
getServices(Class<T> serviceType, String filter)
retrieves a set of services appropriate to the filter<T> T
retrieveService(Class<T> type)
BeanContext.Service
withResource(org.apache.sling.api.resource.Resource resource)
Returns a clone of this context with the resource overridden, orthis
if it already had this resource.-
Methods inherited from class com.composum.sling.core.BeanContext.Map
getAttribute, getRequest, getResolver, getResource, getResponse, setAttribute
-
Methods inherited from class com.composum.sling.core.BeanContext.AbstractScriptContext
getScriptHelper, getSlingBindings
-
Methods inherited from class com.composum.sling.core.BeanContext.AbstractContext
adaptTo, cloneContext, getLocale, getService, getType, tryToInstantiateSlingBean, typeFits, withLocale
-
-
-
-
Constructor Detail
-
Service
public Service()
-
Service
public Service(org.apache.sling.api.resource.ResourceResolver resolver)
-
Service
public Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
-
Service
public Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource)
-
Service
public Service(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.Resource resource, org.apache.sling.api.resource.ResourceResolver resolver)
-
-
Method Detail
-
withResource
public BeanContext.Service withResource(org.apache.sling.api.resource.Resource resource)
Description copied from interface:BeanContext
Returns a clone of this context with the resource overridden, orthis
if it already had this resource. All other internal structures of this will be referenced by the copy, too.- Specified by:
withResource
in interfaceBeanContext
- Overrides:
withResource
in classBeanContext.Map
- Parameters:
resource
- the resource- Returns:
- a context with the
BeanContext.getResource()
resource
, everything else (except possibly resolver) unchanged. Might bethis
.
-
retrieveService
public <T> T retrieveService(Class<T> type)
- Overrides:
retrieveService
in classBeanContext.AbstractScriptContext
-
getServices
public <T> T[] getServices(Class<T> serviceType, String filter)
Description copied from interface:BeanContext
retrieves a set of services appropriate to the filter- Specified by:
getServices
in interfaceBeanContext
- Overrides:
getServices
in classBeanContext.AbstractScriptContext
-
getBundleContext
protected org.osgi.framework.BundleContext getBundleContext()
-
-