Interface DatabaseAdapter
- All Known Implementing Classes:
JDBCDatabaseAdapter
public interface DatabaseAdapter
This class is responsible for storing the groups plugin options.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a group to the database if it doesn't exist already.boolean
addGroupMember
(Membership membership) Adds or updates the givengroupMember#member
to the givengroupMember#group
.void
close()
Closes the connection to the database.boolean
deleteGroup
(String name) Deleted the group with the specifiedname
.Deletes all stale memberships from all groups and returns the deleted members.Returns the group with the specifiedname
ornull
if it could not be found.getGroupMembers
(String name) Returns the members of the groupname
as set.Lists all groups.boolean
removeGroupMember
(IdentityPublicKey member, String groupName) Removes themember
from the givengroup
.boolean
updateGroup
(Group group) Updates the specifiedgroup
.
-
Method Details
-
addGroup
Adds a group to the database if it doesn't exist already.- Parameters:
group
- the group that should be added- Returns:
true
if the group was added,false
if it already exist- Throws:
DatabaseException
- if an error occurs during the execution
-
addGroupMember
Adds or updates the givengroupMember#member
to the givengroupMember#group
.- Parameters:
membership
- the entry that should be added or updated- Returns:
true
if the member was inserted and not updated- Throws:
DatabaseException
- if an error occurs during the execution
-
getGroup
Returns the group with the specifiedname
ornull
if it could not be found.- Parameters:
name
- the name of the group- Returns:
- group or
null
if it could not be found - Throws:
DatabaseException
- if an error occurs during the deletion
-
getGroups
Lists all groups.- Returns:
- List with all groups
- Throws:
DatabaseException
- if an error occurs during the execution
-
deleteGroup
Deleted the group with the specifiedname
.- Parameters:
name
- the name of the group- Returns:
true
if group was deleted. Otherwisefalse
.- Throws:
DatabaseException
- if an error occurs during removal
-
updateGroup
Updates the specifiedgroup
.- Parameters:
group
- the new desired group state (name is unchangeable)- Returns:
true
if group was updated. Otherwisefalse
.- Throws:
DatabaseException
- if an error occurs during update
-
getGroupMembers
Returns the members of the groupname
as set.- Parameters:
name
- the group name- Returns:
- members of the group as set
- Throws:
DatabaseException
- if an error occurs during the execution
-
removeGroupMember
Removes themember
from the givengroup
.- Parameters:
member
- the member to removegroupName
- the group- Returns:
true
if memberships was deleted. Otherwisefalse
.- Throws:
DatabaseException
- if an exception occurs during removal
-
close
Closes the connection to the database.- Throws:
DatabaseException
- if an error occurs during closing
-
deleteStaleMemberships
Deletes all stale memberships from all groups and returns the deleted members.- Throws:
DatabaseException
- if an error occurred during deletion
-