Package org.apache.sling.servlets.resolver.internal.resolution

# Class ResolutionCache

java.lang.Object
org.apache.sling.servlets.resolver.internal.resolution.ResolutionCache

All Implemented Interfaces:
  `EventListener`, `org.apache.sling.api.resource.observation.ExternalResourceChangeListener`, `org.apache.sling.api.resource.observation.ResourceChangeListener`, `org.osgi.framework.ServiceListener`, `org.osgi.service.event.EventHandler`

public class ResolutionCache extends Object implements org.osgi.service.event.EventHandler, org.apache.sling.api.resource.observation.ResourceChangeListener, org.apache.sling.api.resource.observation.ExternalResourceChangeListener, org.osgi.framework.ServiceListener
Cache for script resolution

## Field Summary

### Fields inherited from interface org.apache.sling.api.resource.observation.ResourceChangeListener

`CHANGE_ADDED, CHANGE_CHANGED, CHANGE_PROVIDER_ADDED, CHANGE_PROVIDER_REMOVED, CHANGE_REMOVED, CHANGES, PATHS, PROPERTY_NAMES_HINT`

## Constructor Summary

Constructors
Constructor
Description
`ResolutionCache()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`activate(org.osgi.framework.BundleContext context, org.apache.sling.servlets.resolver.internal.ResolverConfig config)`
Activate this component.
`protected void`
`deactivate(org.osgi.framework.BundleContext context)`
Deactivate this component.
`void`
`flushCache()`
`javax.servlet.Servlet`
`get(AbstractResourceCollector context)`
`long`
`getGeneration()`
`List<String>`
`getScriptEngineExtensions()`
Get the list of script engine extensions
`void`
`handleEvent(org.osgi.service.event.Event event)`
`protected void`
`modified(org.osgi.framework.BundleContext context, org.apache.sling.servlets.resolver.internal.ResolverConfig config)`
`void`
`onChange(List<org.apache.sling.api.resource.observation.ResourceChange> changes)`
`void`
`put(long generation, AbstractResourceCollector context, javax.servlet.Servlet candidate)`
Caches the candidate unless the cache has been flushed since `generation` was obtained, i.e. the resolution that produced the candidate may be based on stale data.
`void`
`serviceChanged(org.osgi.framework.ServiceEvent event)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ResolutionCache

public ResolutionCache()

## Method Details

### activate

protected void activate(org.osgi.framework.BundleContext context, org.apache.sling.servlets.resolver.internal.ResolverConfig config) throws org.osgi.framework.InvalidSyntaxException
Activate this component.

Throws:
  `org.osgi.framework.InvalidSyntaxException`

### modified

protected void modified(org.osgi.framework.BundleContext context, org.apache.sling.servlets.resolver.internal.ResolverConfig config) throws org.osgi.framework.InvalidSyntaxException

Throws:
  `org.osgi.framework.InvalidSyntaxException`

### deactivate

protected void deactivate(org.osgi.framework.BundleContext context)
Deactivate this component.

### getScriptEngineExtensions

public List<String> getScriptEngineExtensions()
Get the list of script engine extensions

Returns:
  The list of script engine extensions

### handleEvent

public void handleEvent(org.osgi.service.event.Event event)

Specified by:
  `handleEvent` in interface `org.osgi.service.event.EventHandler`
See Also:
  - `EventHandler.handleEvent(org.osgi.service.event.Event)`

### serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)

Specified by:
  `serviceChanged` in interface `org.osgi.framework.ServiceListener`

### flushCache

public void flushCache()

### onChange

public void onChange(List<org.apache.sling.api.resource.observation.ResourceChange> changes)

Specified by:
  `onChange` in interface `org.apache.sling.api.resource.observation.ResourceChangeListener`

### get

public javax.servlet.Servlet get(AbstractResourceCollector context)

### getGeneration

public long getGeneration()

Returns:
  the current cache generation, to be passed to `put(long, AbstractResourceCollector, Servlet)`

### put

public void put(long generation, AbstractResourceCollector context, javax.servlet.Servlet candidate)
Caches the candidate unless the cache has been flushed since `generation` was obtained, i.e. the resolution that produced the candidate may be based on stale data.