org.apache.felix.useradmin

## Interface RoleRepositoryStore

    public interface RoleRepositoryStore

Provides an abstraction to store and retrieve a role repository.

The role object returned by this backend can be a different implementation than `org.apache.felix.useradmin.impl.role.RoleImpl`, in which case the backend is made fully responsible for keeping track of the changes in the role object and persisting them!

### Method Summary

All Methods Instance Methods Abstract Methods
`org.osgi.service.useradmin.Role` `addRole(String roleName, int type)` Adds a given role to this backend.
`org.osgi.service.useradmin.Role` `getRoleByName(String roleName)` Returns a `Role` by its name.
`org.osgi.service.useradmin.Role[]` `getRoles(String filter)` Returns all roles in this backend matching the given filter criteria.
`org.osgi.service.useradmin.Role` `removeRole(String roleName)` Removes a given role from this backend.

### Method Detail

#### addRole

    org.osgi.service.useradmin.Role addRole(String roleName,
                                            int type)
                                     throws Exception

Adds a given role to this backend.

If the given role is already contained by this backed, this method should not do anything and return `null` to denote this.

Parameters:
  `roleName` - the name of the role to add, cannot be `null`;
  `type` - the type of role to add, either `Role.USER` or `Role.GROUP`.
Returns:
  the role added, or `null` in case the role already exists.
Throws:
  `IllegalArgumentException` - in case the given name was `null`;
  `Exception` - in case of problems adding the role.

#### getRoles

    org.osgi.service.useradmin.Role[] getRoles(String filter)
                                        throws Exception

Returns all roles in this backend matching the given filter criteria.

Parameters:
  `filter` - the (optional) filter to apply, can be `null` in which case all roles will be returned.
Returns:
  an array with all roles, never `null`, but can be empty.
Throws:
  `Exception` - in case of problems retrieving the set of roles.

#### getRoleByName

    org.osgi.service.useradmin.Role getRoleByName(String roleName)
                                           throws Exception

Returns a `Role` by its name.

Parameters:
  `roleName` - the name of the role to return, cannot be `null`.
Returns:
  the role with the given name, or `null` if no such role exists.
Throws:
  `IllegalArgumentException` - in case the given argument was `null`;
  `Exception` - in case of problems retrieving the requested role.

#### removeRole

    org.osgi.service.useradmin.Role removeRole(String roleName)
                                        throws Exception

Removes a given role from this backend.

If the given role is not contained by this backed, this method should not do anything and return `null` to denote this.

Parameters:
  `roleName` - the name of the role to remove, cannot be `null`.
Returns:
  the removed role, if it was successfully removed from this backend, or `null` if the role was not contained by this backend or could not be removed.
Throws:
  `IllegalArgumentException` - in case the given argument was `null`;
  `Exception` - in case of problems removing the requested role.