/**
  * Creates a user if it does not exists already.
  *
  * @param proxy The user management webservice.
  */
 private static void createUser(final UserManagementPortTypeProxy proxy) {
   final AuthenticationToken token = Settings.getAuthToken();
   final User user;
   try {
     user = proxy.getUser(USER_NAME, token);
     if (user == null) {
       final User newUser =
           proxy.createUser(USER_NAME, PASSWORD, GROUP_NAMES, CHANNELS, ROLES, token);
       LOG.info(
           "User [name="
               + newUser.getName()
               + ", groups="
               + Arrays.toString(populateGroupsNames(newUser.getGroups()))
               + ", channels="
               + Arrays.toString(newUser.getChannels())
               + ", roles="
               + Arrays.toString(newUser.getRoles())
               + "] created.");
     } else {
       LOG.info(
           "User [name="
               + user.getName()
               + ", groups="
               + Arrays.toString(populateGroupsNames(user.getGroups()))
               + ", channels="
               + Arrays.toString(user.getChannels())
               + ", roles="
               + Arrays.toString(user.getRoles())
               + "] already exists.");
     }
   } catch (final RemoteException e) {
     LOG.error(null, e);
   }
 }
  /**
   * Deletes a user if possible.
   *
   * @param proxy The user management webservice.
   */
  private static void deleteUser(final UserManagementPortTypeProxy proxy) {
    final AuthenticationToken token = Settings.getAuthToken();
    try {
      final User user = proxy.getUser(USER_NAME, token);
      if (user == null) {
        LOG.info("User [name=" + USER_NAME + "] not deleted because it does not exist");
      } else {
        proxy.deleteUser(USER_NAME, token);
        LOG.info(
            "User [name="
                + user.getName()
                + ", groups="
                + Arrays.toString(populateGroupsNames(user.getGroups()))
                + ", channels="
                + Arrays.toString(user.getChannels())
                + ", roles="
                + Arrays.toString(user.getRoles())
                + "] deleted.");
      }

    } catch (final RemoteException e) {
      LOG.error(null, e);
    }
  }