MemoryGroup (Apache Tomcat 7.0.104 API Documentation)

org.apache.catalina.users

## Class MemoryGroup

- java.lang.Object
- - org.apache.catalina.users.AbstractGroup
  - - org.apache.catalina.users.MemoryGroup

- All Implemented Interfaces:
    Principal, Group

      public class MemoryGroup
      extends AbstractGroup

  Concrete implementation of `Group` for the `MemoryUserDatabase` implementation of `UserDatabase`.

  Since:
    4.1
  Author:
    Craig R. McClanahan

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MemoryUserDatabase` | `database` The `MemoryUserDatabase` that owns this group.
    `protected ArrayList<Role>` | `roles` The set of `Role`s associated with this group.

    - ### Fields inherited from class org.apache.catalina.users.AbstractGroup

      `description, groupname`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRole(Role role)` Add a new `Role` to those assigned specifically to this group.
    `Iterator<Role>` | `getRoles()` Return the set of `Role`s assigned specifically to this group.
    `UserDatabase` | `getUserDatabase()` Return the `UserDatabase` within which this Group is defined.
    `Iterator<User>` | `getUsers()` Return the set of `User`s that are members of this group.
    `boolean` | `isInRole(Role role)` Is this group specifically assigned the specified `Role`?
    `void` | `removeRole(Role role)` Remove a `Role` from those assigned to this group.
    `void` | `removeRoles()` Remove all `Role`s from those assigned to this group.
    `String` | `toString()` Return a String representation of this group in XML format.

    - ### Methods inherited from class org.apache.catalina.users.AbstractGroup

      `getDescription, getGroupname, getName, setDescription, setGroupname`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `equals, hashCode`

- - ### Field Detail

    - #### database

          protected MemoryUserDatabase database

      The `MemoryUserDatabase` that owns this group.

    - #### roles

          protected ArrayList<Role> roles

      The set of `Role`s associated with this group.

  - ### Method Detail

    - #### getRoles

          public Iterator<Role> getRoles()

      Return the set of `Role`s assigned specifically to this group.
      Specified by:
        `getRoles` in interface `Group`
      Specified by:
        `getRoles` in class `AbstractGroup`
      Returns:
        the set of `Role`s assigned specifically to this group.

    - #### getUserDatabase

          public UserDatabase getUserDatabase()

      Return the `UserDatabase` within which this Group is defined.
      Specified by:
        `getUserDatabase` in interface `Group`
      Specified by:
        `getUserDatabase` in class `AbstractGroup`
      Returns:
        the `UserDatabase` within which this Group is defined.

    - #### getUsers

          public Iterator<User> getUsers()

      Return the set of `User`s that are members of this group.
      Specified by:
        `getUsers` in interface `Group`
      Specified by:
        `getUsers` in class `AbstractGroup`
      Returns:
        the set of `User`s that are members of this group.

    - #### addRole

          public void addRole(Role role)

      Add a new `Role` to those assigned specifically to this group.
      Specified by:
        `addRole` in interface `Group`
      Specified by:
        `addRole` in class `AbstractGroup`
      Parameters:
        `role` - The new role

    - #### isInRole

          public boolean isInRole(Role role)

      Is this group specifically assigned the specified `Role`?
      Specified by:
        `isInRole` in interface `Group`
      Specified by:
        `isInRole` in class `AbstractGroup`
      Parameters:
        `role` - The role to check
      Returns:
        `true` if the group is assigned to the specified role otherwise `false`

    - #### removeRole

          public void removeRole(Role role)

      Remove a `Role` from those assigned to this group.
      Specified by:
        `removeRole` in interface `Group`
      Specified by:
        `removeRole` in class `AbstractGroup`
      Parameters:
        `role` - The old role

    - #### removeRoles

          public void removeRoles()

      Remove all `Role`s from those assigned to this group.
      Specified by:
        `removeRoles` in interface `Group`
      Specified by:
        `removeRoles` in class `AbstractGroup`

    - #### toString

          public String toString()

      Return a String representation of this group in XML format.

      Specified by:
        `toString` in interface `Principal`
      Overrides:
        `toString` in class `Object`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.