AbstractSlingRepositoryManager
and
AbstractSlingRepository2
instead.@Deprecated public abstract class AbstractSlingRepository extends AbstractNamespaceMappingRepository implements SlingRepository, Runnable
AbstractSlingRepository
is an abstract implementation of the
SlingRepository
interface which provides default support for attached
repositories as well as ensuring live repository connection, reconnecting if
needed. Implementations of the SlingRepository
interface may
wish to extend this class to benefit from a default implementation.
As of version 2.2 (bundle version 2.2.0) the registration of repository
services based on this abstract base class works differently. To be able to
know the calling bundle to implement the
loginService(String, String)
method the service is registered as a
service factory. Yet this component is registered as a non-service component
with Declarative Services handling its registration itself so the the
ServiceFactory
cannot simply create instances of this class. The
solution is for the service factory to create a proxy to the actual component
object. All method calls are just routed through with the exception of the
loginService(String, String)
method which is routed to a new
internal method taking the calling bundle as an additional argument.
The changes to support this new registration mechanism are as follows:
registerService()
method is now final.getServiceRegistrationInterfaces()
and
getServiceRegistrationProperties()
methods have been added and can
be overwritten by implementations of this class. The
registerService()
method calls these new methods to get the
interfaces and properties for the service registration.registerService()
method must replace this overwritten method with overwriting the new
getServiceRegistrationInterfaces()
and/or
getServiceRegistrationProperties()
methods.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ADMIN_PASS
Deprecated.
|
static String |
DEFAULT_ADMIN_USER
Deprecated.
|
static String |
DEFAULT_ANONYMOUS_PASS
Deprecated.
|
static String |
DEFAULT_ANONYMOUS_USER
Deprecated.
|
static boolean |
DEFAULT_LOGIN_ADMIN_ENABLED
Deprecated.
|
static int |
DEFAULT_POLL_ACTIVE
Deprecated.
The default value for the number of seconds to wait between two
consecutive checks while the repository is active (value is 10).
|
static int |
DEFAULT_POLL_INACTIVE
Deprecated.
The default value for the number of seconds to wait between two
consecutive checks while the repository is not active (value is 10).
|
static int |
MIN_POLL
Deprecated.
The minimum number of seconds allowed for any of the two poll times
|
static String |
PROPERTY_ADMIN_PASS
Deprecated.
|
static String |
PROPERTY_ADMIN_USER
Deprecated.
|
static String |
PROPERTY_ANONYMOUS_PASS
Deprecated.
|
static String |
PROPERTY_ANONYMOUS_USER
Deprecated.
|
static String |
PROPERTY_DEFAULT_WORKSPACE
Deprecated.
|
static String |
PROPERTY_LOGIN_ADMIN_ENABLED
Deprecated.
|
static String |
PROPERTY_POLL_ACTIVE
Deprecated.
|
static String |
PROPERTY_POLL_INACTIVE
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
String |
getDefaultWorkspace()
Deprecated.
Returns the default workspace, which may be
null meaning
to use the repository provided default workspace. |
String |
getDescriptor(String name)
Deprecated.
|
String[] |
getDescriptorKeys()
Deprecated.
|
Value |
getDescriptorValue(String key)
Deprecated.
|
Value[] |
getDescriptorValues(String key)
Deprecated.
|
boolean |
isSingleValueDescriptor(String key)
Deprecated.
|
boolean |
isStandardDescriptor(String key)
Deprecated.
|
Session |
login()
Deprecated.
Logs in as an anonymous user.
|
Session |
login(Credentials credentials)
Deprecated.
|
Session |
login(Credentials credentials,
String workspace)
Deprecated.
|
Session |
login(String workspace)
Deprecated.
|
Session |
loginAdministrative(String workspace)
Deprecated.
Returns a session to the given workspace which has administrative powers.
|
Session |
loginService(String subServiceName,
String workspace)
Deprecated.
This method always throws
LoginException because it does
not directly have the calling bundle at its disposition to decide
on the required service name. |
void |
run()
Deprecated.
|
public static final String DEFAULT_ANONYMOUS_USER
public static final String DEFAULT_ANONYMOUS_PASS
public static final String DEFAULT_ADMIN_USER
public static final String DEFAULT_ADMIN_PASS
public static final boolean DEFAULT_LOGIN_ADMIN_ENABLED
public static final String PROPERTY_DEFAULT_WORKSPACE
public static final String PROPERTY_ANONYMOUS_USER
public static final String PROPERTY_ANONYMOUS_PASS
public static final String PROPERTY_ADMIN_USER
public static final String PROPERTY_ADMIN_PASS
public static final String PROPERTY_LOGIN_ADMIN_ENABLED
public static final int DEFAULT_POLL_ACTIVE
public static final int DEFAULT_POLL_INACTIVE
public static final String PROPERTY_POLL_ACTIVE
public static final String PROPERTY_POLL_INACTIVE
public static final int MIN_POLL
public final String getDefaultWorkspace()
null
meaning
to use the repository provided default workspace. Declared final to make
sure the SLING-256 rule is enforced.getDefaultWorkspace
in interface SlingRepository
public Session login() throws LoginException, RepositoryException
login(Credentials, String)
LoginException
RepositoryException
public final Session loginAdministrative(String workspace) throws RepositoryException
SlingRepository
NOTE: This method is intended for use by infrastructure bundles to
access the repository and provide general services. This method MUST not
be used to handle client requests of whatever kinds. To handle client
requests a regular authenticated session retrieved through
#login(javax.jcr.Credentials, String)
or
Session#impersonate(javax.jcr.Credentials)
must be used.
This method is deprecated. Services running in the Sling system should
use the SlingRepository.loginService(String serviceInfo, String workspace)
method instead. Implementations of this method must throw
javax.jcr.LoginException
if they don't support it.
loginAdministrative
in interface SlingRepository
workspace
- The name of the workspace to which to get an
administrative session. If null
the
SlingRepository.getDefaultWorkspace()
default workspace is assumed.RepositoryException
- If an error occurrs creating the
administrative sessionpublic final Session loginService(String subServiceName, String workspace) throws LoginException, RepositoryException
LoginException
because it does
not directly have the calling bundle at its disposition to decide
on the required service name.
This method is final and cannot be overwritten by extensions. See the class comments for full details on how this works.
loginService
in interface SlingRepository
subServiceName
- Optional Subservice Name to specialize account
selection for the service. This may be null
.workspace
- The name of the workspace to which to get an
administrative session. If null
the
SlingRepository.getDefaultWorkspace()
default workspace is assumed.LoginException
- If there is no service account defined for the
calling bundle or the defined service account does not exist.RepositoryException
- if an error occurrs.public Session login(Credentials credentials) throws LoginException, RepositoryException
LoginException
RepositoryException
public Session login(String workspace) throws LoginException, NoSuchWorkspaceException, RepositoryException
LoginException
NoSuchWorkspaceException
RepositoryException
public Session login(Credentials credentials, String workspace) throws LoginException, NoSuchWorkspaceException, RepositoryException
LoginException
NoSuchWorkspaceException
RepositoryException
public String[] getDescriptorKeys()
public Value getDescriptorValue(String key)
public Value[] getDescriptorValues(String key)
public boolean isSingleValueDescriptor(String key)
public boolean isStandardDescriptor(String key)
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"