public abstract class AbstractPrincipalProvider extends Object implements PrincipalProvider
Principal
s from their source, the caching of the principals is done
by this implementation.
The PrincipalProvider
methods that that involve searching like
PrincipalProvider.getGroupMembership(Principal)
are not cached.
Modifier and Type | Field and Description |
---|---|
static String |
MAXSIZE_KEY
Option name for the max size of the cache to use
|
static String |
NEGATIVE_ENTRY_KEY
Option name to enable negative cache entries (see JCR-2672)
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractPrincipalProvider()
Create a new instance of
AbstractPrincipalProvider . |
Modifier and Type | Method and Description |
---|---|
protected void |
addToCache(Principal principal)
Add an entry to the principal cache.
|
protected void |
checkInitialized()
Check if the instance has been closed
close() . |
protected void |
clearCache()
Clear the principal cache.
|
void |
close()
Clears the cache and calls the implementation to close their resources
|
Principal |
getPrincipal(String principalName)
Returns the principal with the given name if is known to this provider
|
void |
init(Properties options)
Initialize this provider.
|
protected abstract Principal |
providePrincipal(String principalName)
Called if the cache does not contain the principal requested.
Implementations should return a Principal from their source,
if it contains one for the given name or null . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canReadPrincipal, findPrincipals, findPrincipals, getGroupMembership, getPrincipals
public static final String MAXSIZE_KEY
public static final String NEGATIVE_ENTRY_KEY
protected AbstractPrincipalProvider()
AbstractPrincipalProvider
.
Initialization and cache are set up upon init(Properties)
protected void checkInitialized()
close()
.IllegalStateException
- if this instance was closed.protected void clearCache()
protected void addToCache(Principal principal)
principal
- to be cached.protected abstract Principal providePrincipal(String principalName)
Principal
from their source,
if it contains one for the given name or null
.principalName
- Name of the principal to be returned.getPrincipal(String)
public Principal getPrincipal(String principalName)
providePrincipal(String)
is called, if no matching entry
is present in the cache.NEGATIVE_ENTRY_KEY
configuration option), the cache will also
store negative matches (as null
values) in the principal cache.getPrincipal
in interface PrincipalProvider
principalName
- the name of the principal to retrievenull
public void init(Properties options)
PrincipalProvider
init
in interface PrincipalProvider
options
- the options that are setPrincipalProvider.init(java.util.Properties)
public void close()
close
in interface PrincipalProvider
PrincipalProvider.close()
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.