use of org.apache.sling.testing.mock.sling.spi.ResourceResolverTypeAdapter in project sling by apache.
the class MockSling method newResourceResolverFactory.
/**
* Creates new sling resource resolver factory instance.
* @param type Type of underlying repository.
* @param bundleContext Bundle context
* @return Resource resolver factory instance
*/
public static ResourceResolverFactory newResourceResolverFactory(final ResourceResolverType type, final BundleContext bundleContext) {
ResourceResolverTypeAdapter adapter = getResourceResolverTypeAdapter(type);
ResourceResolverFactory factory = adapter.newResourceResolverFactory();
if (factory == null) {
SlingRepository repository = adapter.newSlingRepository();
factory = ResourceResolverFactoryInitializer.setUp(repository, bundleContext, type.getNodeTypeMode());
} else {
bundleContext.registerService(ResourceResolverFactory.class.getName(), factory, null);
}
return factory;
}
Aggregations