public class FileRoleManager extends Object implements RoleManager
RoleManager
responsible for managing roles stored in a file. The file is
read on construction and written to on the call to #close()
.Constructor and Description |
---|
FileRoleManager(FileServiceAccessor fileServiceAccessor,
boolean isReadOnly) |
Modifier and Type | Method and Description |
---|---|
void |
createRole(RoleDetails roleDetails)
Create a new role with the specified
roleDetails . |
void |
deleteRole(String role)
Delete an existing role represented by the specified
role . |
RoleDetails |
getRole(String role)
Retrieve the role details by
role . |
boolean |
isReadOnly()
Indicates that this manager is for read-only purposes, and that any invocation of a
destructive operation will throw an
AccessDeniedException . |
Map<String,RoleDetails> |
mapRoles()
Returns a map containing mapping between role and role-details.
|
boolean |
roleExists(String role)
Queries for presence of a role by role.
|
void |
updateRole(RoleDetails roleDetails)
Updates the role details, excluding the role which must remain the same.
|
public FileRoleManager(FileServiceAccessor fileServiceAccessor, boolean isReadOnly)
public boolean isReadOnly()
RoleManager
AccessDeniedException
.isReadOnly
in interface RoleManager
true
if read-only access is allowed.public void createRole(RoleDetails roleDetails) throws RoleAlreadyExistsException, RoleDataAccessException, AccessDeniedException
RoleManager
roleDetails
.createRole
in interface RoleManager
roleDetails
- new role details to store.RoleAlreadyExistsException
- if the role details represent a non-unique roleRoleDataAccessException
- if could not store the specified role details.AccessDeniedException
- if read-only access is allowed.public void deleteRole(String role) throws RoleNotFoundException, RoleDataAccessException, AccessDeniedException
RoleManager
role
.deleteRole
in interface RoleManager
role
- an existing role name.RoleNotFoundException
- if the role was not found.RoleDataAccessException
- if could not delete the specified role details.AccessDeniedException
- if read-only access is allowed.public RoleDetails getRole(String role) throws RoleNotFoundException, RoleDataAccessException
RoleManager
role
.getRole
in interface RoleManager
role
- an existing role to retrieve.RoleNotFoundException
- if the role was not found.RoleDataAccessException
- if could not retrieve the specified role details.public Map<String,RoleDetails> mapRoles() throws RoleDataAccessException
RoleManager
mapRoles
in interface RoleManager
RoleDataAccessException
- if could not retrieve role-details to map.public boolean roleExists(String role) throws RoleDataAccessException
RoleManager
roleExists
in interface RoleManager
role
- the role to check existence for.true
if the role exists; false
otherwise.RoleDataAccessException
- if could not query for the specified role.public void updateRole(RoleDetails roleDetails) throws RoleNotFoundException, RoleDataAccessException, AccessDeniedException
RoleManager
updateRole
in interface RoleManager
roleDetails
- the role details to update.RoleNotFoundException
- if the role was not found.RoleDataAccessException
- if could not update the role details.AccessDeniedException
- if read-only access is allowed.Copyright © GigaSpaces.