Package org.apache.sling.testing.mock.sling.spi

# Interface ResourceResolverTypeAdapter

public interface ResourceResolverTypeAdapter
SPI interface for resource resolver type implementations to provide a mock resource resolver factory.

Supported constructors for implementing classes:

- Empty constructor
- Constructor with `BundleContext` parameter

## Method Summary

Modifier and Type
Method
Description
`@Nullable org.apache.sling.api.resource.ResourceResolverFactory`
`newResourceResolverFactory()`
Gets resource resolver factory instance.
`@Nullable org.apache.sling.jcr.api.SlingRepository`
`newSlingRepository()`
Get SlingRepository instance.
`default org.apache.sling.jcr.api.SlingRepository`
`newSlingRepositoryFromSnapshot(Object snapshot)`
Get a SlingRepository instance based on a snapshot taken from another repository.
`default @Nullable Object`
`snapshot(org.apache.sling.jcr.api.SlingRepository repository)`
Make a snapshot of the current state of the given repository, or return null if snapshots are not supported.

## Method Details

### newResourceResolverFactory

@Nullable @Nullable org.apache.sling.api.resource.ResourceResolverFactory newResourceResolverFactory()
Gets resource resolver factory instance. Can be null if only a SlingRepository is provided, in this case the method `newSlingRepository()` has to return a value.

Returns:
  Resource resolver factory instance or null

### newSlingRepository

@Nullable @Nullable org.apache.sling.jcr.api.SlingRepository newSlingRepository()
Get SlingRepository instance. Can be null if a resource resolver factory is provided, in this case the method `newResourceResolverFactory()` has to return a value.

Returns:
  Sling repository instance or null

### snapshot

@Nullable default @Nullable Object snapshot(org.apache.sling.jcr.api.SlingRepository repository)
Make a snapshot of the current state of the given repository, or return null if snapshots are not supported. Returning non-null implies that calling `newSlingRepositoryFromSnapshot(Object)` with the same object will succeed when called on objects of the same implementation type. The returned object must capture the whole state of the repository, and must not reflect any future changes made to the repository after this method returns.

Parameters:
  `repository` - The repository to snapshot.
Returns:
  A snapshot object.

### newSlingRepositoryFromSnapshot

default org.apache.sling.jcr.api.SlingRepository newSlingRepositoryFromSnapshot(Object snapshot)
Get a SlingRepository instance based on a snapshot taken from another repository.

Parameters:
  `snapshot` - A snapshot object, returned by an earlier call to `snapshot(SlingRepository)`.
Returns:
  A Sling repository instance.