@ProviderType public abstract class AbstractSlingRepositoryManager extends NamespaceMappingSupport
AbstractSlingRepositoryManageris the basis for controlling the JCR repository instances used by Sling. As a manager it starts and stops the actual repository instance, manages service registration and hands out
SlingRepositoryinstances to be used by the consumers.
This base class controls the livecycle of repository instance whereas implementations of this class provide actual integration into the runtime context. The livecycle of the repository instance is defined as follows:
To start the repository instance, the implemetation calls the
start(BundleContext, String, boolean)method which goes through the
steps of instantiating the repository, setting things up, and registering the
repository as an OSGi service:
To stop the repository instance, the implementation calls the
method which goes through the setps of unregistering the OSGi service,
tearing all special settings down and finally shutting down the repository:
Instances of this class manage a single repository instance backing the OSGi service instances. Each consuming bundle, though, gets its own service instance backed by the single actual repository instance managed by this class.
|Constructor and Description|
|Modifier and Type||Method and Description|
Creates the backing JCR repository instances.
Creates an instance of the
Disposes off the given
Returns the default workspace, which may be
Returns the repository underlying this instance or
Returns the service types to be used to register the repository service in
Return the service registration properties to be used to register the repository service in
Returns whether to disable the
This method actually starts the backing repository instannce and registeres the repository service.
This method must be called if overwritten by implementations !!
Unregisters the service represented by the
getNamespaceAwareSession, getNamespaceMapperServices, setup, tearDown
public final String getDefaultWorkspace()
nullmeaning to use the repository provided default workspace.
nullindicating the repository's default workspace is actually used.
public final boolean isDisableLoginAdministrative()
SlingRepository.loginAdministrativemethod or not.
protected abstract ServiceUserMapper getServiceUserMapper()
ServiceUserMapperservice to map the service name to a service user name.
ServiceUserMapper is used to implement the
AbstractSlingRepository2.loginService(String, String) method used
to replace the
AbstractSlingRepository2.loginAdministrative(String) method. If
this method returns
null and hence the
ServiceUserMapperService is not available, the
loginService method is not able to login.
nullif not available.
protected abstract javax.jcr.Repository acquireRepository()
This method does not throw any
Throwable but instead just
null if not repository is available. Any problems
trying to acquire the repository must be caught and logged as
nullif not repository can be acquired.
start(BundleContext, String, boolean)
protected final org.osgi.framework.ServiceRegistration registerService()
getServiceRegistrationInterfaces()method and properties provided by the
The repository is actually registered as an OSGi
create(Bundle) method is called to create an actual
AbstractSlingRepository2 repository instance for a calling
(using) bundle. When the bundle is done using the repository instance,
destroy(AbstractSlingRepository2) method is called to clean
protected abstract Dictionary<String,Object> getServiceRegistrationProperties()
protected String getServiceRegistrationInterfaces()
registerService(). All interfaces returned must be accessible to the class loader of the class of this instance.
This method may be overwritten to return additional types but the types
returned from this base implementation,
Repository, must always be included.
protected abstract AbstractSlingRepository2 create(org.osgi.framework.Bundle usingBundle)
AbstractSlingRepository2implementation for use by the given
This method is called when the repository service is requested from within the using bundle for the first time.
This method is expected to return a new instance on every call.
protected abstract void destroy(AbstractSlingRepository2 repositoryServiceInstance)
AbstractSlingRepository2instance previously created by the
protected final javax.jcr.Repository getRepository()
nullif no repository is currently being available.
protected final void unregisterService(org.osgi.framework.ServiceRegistration serviceRegistration)
serviceRegistration- The service to unregister
protected abstract void disposeRepository(javax.jcr.Repository repository)
repository- The repository to be disposed off which is the same as the one returned from
protected final boolean start(org.osgi.framework.BundleContext bundleContext, String defaultWorkspace, boolean disableLoginAdministrative)
Multiple subsequent calls to this method without calling
first have no effect.
BundleContextto register the repository service (and optionally more services required to operate the repository)
defaultWorkspace- The name of the default workspace to use to login. This may be
nullto have the actual repository instance define its own default
disableLoginAdministrative- Whether to disable the
SlingRepository.loginAdministrativemethod or not.
trueif the repository has been started and the service is registered.
protected final void stop()
Copyright © 2015 The Apache Software Foundation. All rights reserved.