Class SimpleUserSystemServiceHelper


  • public class SimpleUserSystemServiceHelper
    extends Object
    Utility class for loading users definition from a file using the Wildfly roles.properties definition file format. i.e. user1=group1,group2 user1=group2,group3

    and additionally facilitates the reading of user attributes like skills and affinities in a similar format. e.g. skills.properties: user1=skill1,skill2 user2=skill3

    e.g. affinities.properties user1=affinity1,affinity2

    When configured, the users skills will be loaded in the SKILLS_ATTRIBUTE_NAME. Following the example above user.getAttributes().get(SKILLS_ATTRIBUTE_NAME) will return the String "skill1,skill2");

    When configured, the users affinities will be loaded in the AFFINITIES_ATTRIBUTE_NAME. Following the example above user1.getAttributes().get(AFFINITIES_ATTRIBUTE_NAME) will return the String "affinity1,affinity2"); and user2.getAttributes().get(AFFINITIES_ATTRIBUTE_NAME) will return null.

    • Method Detail

      • buildInfo

        public static SimpleUserSystemServiceHelper.UserGroupInfo buildInfo​(Path users,
                                                                            Path skills,
                                                                            Path affinities)
                                                                     throws IOException
        Reads the users definitions from a file using the Wildfly roles.properties definition file format. See class comments. Additionally loads the users skills and affinities if present.
        Parameters:
        users - a path to the user + roles file in the WF format.
        skills - an optional path to the users skills file.
        affinities - an optional path to the users affinities file.
        Returns:
        a UserGroupInfo instance with the Users and Groups loaded.
        Throws:
        IOException - if an I/O error occurs
      • buildInfo

        public static SimpleUserSystemServiceHelper.UserGroupInfo buildInfo​(InputStream usersIn,
                                                                            InputStream skillsIn,
                                                                            InputStream affinitiesIn)
                                                                     throws IOException
        Reads the users definitions for a file in the Wildfly roles.properties definition file format. See class comments. Additionally loads the users skills and affinities if present.
        Parameters:
        usersIn - InputStream with the user + roles file in the WF format.
        skillsIn - InputStream with the users skills.
        affinitiesIn - InputStream with the users affinities.
        Returns:
        a UserGroupInfo instance with the Users and Groups loaded.
        Throws:
        IOException - if an I/O error occurs