Class ProxyDirectoryBackend
- java.lang.Object
-
- technology.openpool.ldap.adapter.backend.ProxyDirectoryBackend
-
- All Implemented Interfaces:
DirectoryBackend,NestedDirectoryBackend
- Direct Known Subclasses:
CachedDirectoryBackend,LockingDirectoryBackend,MirroredCrowdDirectoryBackend
public abstract class ProxyDirectoryBackend extends Object implements NestedDirectoryBackend
-
-
Field Summary
Fields Modifier and Type Field Description protected ServerConfigurationconfigprotected NestedDirectoryBackenddirectoryBackend
-
Constructor Summary
Constructors Modifier Constructor Description protectedProxyDirectoryBackend(ServerConfiguration config, NestedDirectoryBackend directoryBackend)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddropAllGroups()To reset the cache all group entities are dropped.voiddropAllUsers()To reset the cache all user entities are dropped.voiddropGroup(String id)To keep the cache up-to-date a group entity is dropped.voiddropMembership(MembershipEntity membership)To keep the cache up-to-date a membership entity is dropped.voiddropUser(String id)To keep the cache up-to-date an user entity is dropped.Set<GroupEntity>getAllGroups()Gets all groups.Set<GroupEntity>getAllGroups(int startIndex, int maxResults)Gets all groups.Set<UserEntity>getAllUsers()Gets all users.Set<UserEntity>getAllUsers(int startIndex, int maxResults)Gets all users.UserEntitygetAuthenticatedUser(String id, String password)Gets info from authenticated user.Set<GroupEntity>getDirectChildGroupsOfGroup(String id)Gets direct child groups of group.Set<GroupEntity>getDirectGroupsOfUser(String id)Gets direct groups of user.Set<GroupEntity>getDirectParentGroupsOfGroup(String id)Gets direct parent groups of group.Set<UserEntity>getDirectUsersOfGroup(String id)Gets direct users of group.GroupEntitygetGroup(String id)Gets group info.StringgetId()Gets backend ID.MappableCursor<MembershipEntity>getMemberships()Returns a cursor for membership entities.Set<GroupEntity>getTransitiveChildGroupsOfGroup(String id)Gets transitive child groups of group.Set<GroupEntity>getTransitiveGroupsOfUser(String id)Gets transitive groups of user.Set<GroupEntity>getTransitiveParentGroupsOfGroup(String id)Gets transitive parent groups of group.Set<UserEntity>getTransitiveUsersOfGroup(String id)Gets transitive users of group.UserEntitygetUser(String id)Gets user info.booleanrequireReset()Check if the caches need a reset.MappableCursor<Row>runQueryExpression(String txId, org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager, QueryExpression expression, EntityType entityType)Runs a query expression.voidshutdown()Shutdown method.voidstartup()Startup method.intupsertAllGroups()To keep the cache up-to-date all group entities are updated or inserted.intupsertAllGroups(int startIndex, int maxResults)To keep the cache up-to-date all group entities are updated or inserted.intupsertAllUsers()To keep the cache up-to-date all user entities are updated or inserted.intupsertAllUsers(int startIndex, int maxResults)To keep the cache up-to-date all user entities are updated or inserted.voidupsertGroup(String id)To keep the cache up-to-date a group entity is updated or inserted.voidupsertMembership(MembershipEntity membership)To keep the cache up-to-date a membership entity is updated or inserted.voidupsertUser(String id)To keep the cache up-to-date an user entity is updated or inserted.voidupsertUser(String id, String idOther)To keep the cache up-to-date an user entity is updated or inserted.voidwithReadAccess(Runnable block)Check if the caches need a reset.<T> TwithReadAccess(Supplier<T> block)Check if the caches need a reset.voidwithWriteAccess(Runnable block)Check if the caches need a reset.<T> TwithWriteAccess(Supplier<T> block)Check if the caches need a reset.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface technology.openpool.ldap.adapter.api.directory.NestedDirectoryBackend
acquireDbLock, releaseDbLock
-
-
-
-
Field Detail
-
config
protected final ServerConfiguration config
-
directoryBackend
protected final NestedDirectoryBackend directoryBackend
-
-
Constructor Detail
-
ProxyDirectoryBackend
protected ProxyDirectoryBackend(ServerConfiguration config, NestedDirectoryBackend directoryBackend)
-
-
Method Detail
-
withReadAccess
public <T> T withReadAccess(Supplier<T> block)
Description copied from interface:NestedDirectoryBackendCheck if the caches need a reset.- Specified by:
withReadAccessin interfaceNestedDirectoryBackend- Parameters:
block- the supplier object executed within the session- Returns:
- the result of the supplier code block
-
withReadAccess
public void withReadAccess(Runnable block)
Description copied from interface:NestedDirectoryBackendCheck if the caches need a reset.- Specified by:
withReadAccessin interfaceNestedDirectoryBackend- Parameters:
block- the runnable object executed within the session
-
withWriteAccess
public <T> T withWriteAccess(Supplier<T> block)
Description copied from interface:NestedDirectoryBackendCheck if the caches need a reset.- Specified by:
withWriteAccessin interfaceNestedDirectoryBackend- Parameters:
block- the supplier object executed within the session- Returns:
- the result of the supplier code block
-
withWriteAccess
public void withWriteAccess(Runnable block)
Description copied from interface:NestedDirectoryBackendCheck if the caches need a reset.- Specified by:
withWriteAccessin interfaceNestedDirectoryBackend- Parameters:
block- the runnable object executed within the session
-
getId
public String getId()
Description copied from interface:DirectoryBackendGets backend ID.- Specified by:
getIdin interfaceDirectoryBackend- Returns:
- the backend ID
-
startup
public void startup()
Description copied from interface:DirectoryBackendStartup method.- Specified by:
startupin interfaceDirectoryBackend
-
shutdown
public void shutdown()
Description copied from interface:DirectoryBackendShutdown method.- Specified by:
shutdownin interfaceDirectoryBackend
-
requireReset
public boolean requireReset()
Description copied from interface:NestedDirectoryBackendCheck if the caches need a reset.- Specified by:
requireResetin interfaceNestedDirectoryBackend- Returns:
- the boolean
-
upsertGroup
public void upsertGroup(String id)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date a group entity is updated or inserted.- Specified by:
upsertGroupin interfaceNestedDirectoryBackend- Parameters:
id- the group ID
-
upsertAllGroups
public int upsertAllGroups(int startIndex, int maxResults)Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date all group entities are updated or inserted.- Specified by:
upsertAllGroupsin interfaceNestedDirectoryBackend- Parameters:
startIndex- the start index for paginationmaxResults- the maximum number of results for pagination- Returns:
- the number of handled entities
-
upsertAllGroups
public int upsertAllGroups()
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date all group entities are updated or inserted.- Specified by:
upsertAllGroupsin interfaceNestedDirectoryBackend- Returns:
- the number of handled entities
-
upsertUser
public void upsertUser(String id)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date an user entity is updated or inserted.- Specified by:
upsertUserin interfaceNestedDirectoryBackend- Parameters:
id- the user ID
-
upsertUser
public void upsertUser(String id, String idOther)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date an user entity is updated or inserted. The user inherits the groups of another user- Specified by:
upsertUserin interfaceNestedDirectoryBackend- Parameters:
id- the user IDidOther- the user ID of an existing user
-
upsertAllUsers
public int upsertAllUsers(int startIndex, int maxResults)Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date all user entities are updated or inserted.- Specified by:
upsertAllUsersin interfaceNestedDirectoryBackend- Parameters:
startIndex- the start index for paginationmaxResults- the maximum number of results for pagination- Returns:
- the number of handled entities
-
upsertAllUsers
public int upsertAllUsers()
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date all user entities are updated or inserted.- Specified by:
upsertAllUsersin interfaceNestedDirectoryBackend- Returns:
- the number of handled entities
-
upsertMembership
public void upsertMembership(MembershipEntity membership)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date a membership entity is updated or inserted.- Specified by:
upsertMembershipin interfaceNestedDirectoryBackend- Parameters:
membership- the membership entity
-
dropGroup
public void dropGroup(String id)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date a group entity is dropped.- Specified by:
dropGroupin interfaceNestedDirectoryBackend- Parameters:
id- the group ID
-
dropAllGroups
public void dropAllGroups()
Description copied from interface:NestedDirectoryBackendTo reset the cache all group entities are dropped.- Specified by:
dropAllGroupsin interfaceNestedDirectoryBackend
-
dropUser
public void dropUser(String id)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date an user entity is dropped.- Specified by:
dropUserin interfaceNestedDirectoryBackend- Parameters:
id- the user ID
-
dropAllUsers
public void dropAllUsers()
Description copied from interface:NestedDirectoryBackendTo reset the cache all user entities are dropped.- Specified by:
dropAllUsersin interfaceNestedDirectoryBackend
-
dropMembership
public void dropMembership(MembershipEntity membership)
Description copied from interface:NestedDirectoryBackendTo keep the cache up-to-date a membership entity is dropped.- Specified by:
dropMembershipin interfaceNestedDirectoryBackend- Parameters:
membership- the membership entity
-
runQueryExpression
public MappableCursor<Row> runQueryExpression(String txId, org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager, QueryExpression expression, EntityType entityType)
Description copied from interface:DirectoryBackendRuns a query expression.- Specified by:
runQueryExpressionin interfaceDirectoryBackend- Parameters:
txId- the transaction IDschemaManager- the schema managerexpression- the query expressionentityType- the entity type- Returns:
- the query generator
-
getGroup
public GroupEntity getGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets group info.- Specified by:
getGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the group
- Throws:
EntityNotFoundException- the entry not found exception
-
getUser
public UserEntity getUser(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets user info.- Specified by:
getUserin interfaceDirectoryBackend- Parameters:
id- the user ID- Returns:
- the user
- Throws:
EntityNotFoundException- the entry not found exception
-
getAuthenticatedUser
public UserEntity getAuthenticatedUser(String id, String password) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets info from authenticated user.- Specified by:
getAuthenticatedUserin interfaceDirectoryBackend- Parameters:
id- the user IDpassword- the password- Returns:
- the authenticated user
- Throws:
EntityNotFoundException- the entry not found exception
-
getAllGroups
public Set<GroupEntity> getAllGroups()
Description copied from interface:DirectoryBackendGets all groups.- Specified by:
getAllGroupsin interfaceDirectoryBackend- Returns:
- the groups
-
getAllGroups
public Set<GroupEntity> getAllGroups(int startIndex, int maxResults)
Description copied from interface:DirectoryBackendGets all groups.- Specified by:
getAllGroupsin interfaceDirectoryBackend- Returns:
- the groups
-
getAllUsers
public Set<UserEntity> getAllUsers()
Description copied from interface:DirectoryBackendGets all users.- Specified by:
getAllUsersin interfaceDirectoryBackend- Returns:
- the users
-
getAllUsers
public Set<UserEntity> getAllUsers(int startIndex, int maxResults)
Description copied from interface:DirectoryBackendGets all users.- Specified by:
getAllUsersin interfaceDirectoryBackend- Returns:
- the users
-
getDirectUsersOfGroup
public Set<UserEntity> getDirectUsersOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets direct users of group.- Specified by:
getDirectUsersOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the direct users of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getDirectGroupsOfUser
public Set<GroupEntity> getDirectGroupsOfUser(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets direct groups of user.- Specified by:
getDirectGroupsOfUserin interfaceDirectoryBackend- Parameters:
id- the user ID- Returns:
- the direct groups of user
- Throws:
EntityNotFoundException- the entry not found exception
-
getTransitiveUsersOfGroup
public Set<UserEntity> getTransitiveUsersOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets transitive users of group.- Specified by:
getTransitiveUsersOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the transitive users of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getTransitiveGroupsOfUser
public Set<GroupEntity> getTransitiveGroupsOfUser(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets transitive groups of user.- Specified by:
getTransitiveGroupsOfUserin interfaceDirectoryBackend- Parameters:
id- the user ID- Returns:
- the transitive groups of user
- Throws:
EntityNotFoundException- the entry not found exception
-
getDirectChildGroupsOfGroup
public Set<GroupEntity> getDirectChildGroupsOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets direct child groups of group.- Specified by:
getDirectChildGroupsOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the direct child groups of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getDirectParentGroupsOfGroup
public Set<GroupEntity> getDirectParentGroupsOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets direct parent groups of group.- Specified by:
getDirectParentGroupsOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the direct parent groups of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getTransitiveChildGroupsOfGroup
public Set<GroupEntity> getTransitiveChildGroupsOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets transitive child groups of group.- Specified by:
getTransitiveChildGroupsOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the transitive child groups of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getTransitiveParentGroupsOfGroup
public Set<GroupEntity> getTransitiveParentGroupsOfGroup(String id) throws EntityNotFoundException
Description copied from interface:DirectoryBackendGets transitive parent groups of group.- Specified by:
getTransitiveParentGroupsOfGroupin interfaceDirectoryBackend- Parameters:
id- the group ID- Returns:
- the transitive parent groups of group
- Throws:
EntityNotFoundException- the entry not found exception
-
getMemberships
public MappableCursor<MembershipEntity> getMemberships()
Description copied from interface:NestedDirectoryBackendReturns a cursor for membership entities.- Specified by:
getMembershipsin interfaceNestedDirectoryBackend- Returns:
- the cursor with membership elements
-
-