code: public Group getOrCreateGroup(JackrabbitSession session, UserManager userManager,
                                    String path)
              throws RepositoryException {
          String[] pathAndName = pathAndName(path);
          Group group = (Group) userManager.getAuthorizable(pathAndName[1]);
          LOG.debug("group.check: " + pathAndName[1] + " - " + group);
          if (group == null) {
              LOG.info("group.create: " + pathAndName[1]);
              group = userManager.createGroup(new NamePrincipal(pathAndName[1]), pathAndName[0]);
          }
          return group;
      }
docs: Retrieves a group by their name; if the group doesn't exist the group will be created.
  
  @param path the name of the group with an optional prepended intermediate path for group creation