コード例 #1
0
  public void deleteUser(String username, String userca) throws RemoteException, VOMSException {

    log.info("deleteUser(" + StringUtils.join(new Object[] {username, userca}, ',') + ");");

    try {

      DeleteUserOperation.instance(username, userca).execute();
      HibernateFactory.commitTransaction();

    } catch (RuntimeException e) {
      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #2
0
  public void createCapability(String capability) throws RemoteException, VOMSException {

    log.info("createCapability(" + StringUtils.join(new Object[] {capability}, ',') + ");");

    try {

      throw new UnimplementedFeatureException("createCapability(String s)");

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #3
0
  public String getVOName() throws RemoteException, VOMSException {

    log.info("getVOName(" + StringUtils.join(new Object[] {}, ',') + ");");

    try {

      return "/" + VOMSConfiguration.instance().getVOName();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #4
0
  public void deleteRole(String rolename) throws RemoteException, VOMSException {

    log.info("deleteRole(" + StringUtils.join(new Object[] {rolename}, ',') + ");");

    try {
      if (PathNamingScheme.isRole(rolename)) rolename = PathNamingScheme.getRoleName(rolename);

      DeleteRoleOperation.instance(rolename).execute();
      HibernateFactory.commitTransaction();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #5
0
  public String[] listCAs() throws RemoteException, VOMSException {

    log.info("listCAs();");

    try {

      List cas = (List) ListCaOperation.instance().execute();

      HibernateFactory.commitTransaction();
      return ServiceUtils.casToStringArray(cas);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #6
0
  public String[] listRoles(String username, String userca) throws RemoteException, VOMSException {

    log.info("listRoles(" + StringUtils.join(new Object[] {username, userca}, ',') + ");");
    try {

      Set roles = (Set) ListUserRolesOperation.instance(username, userca).execute();

      HibernateFactory.commitTransaction();

      return ServiceUtils.toStringArray(roles);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #7
0
  public void deleteGroup(String groupname) throws RemoteException, VOMSException {

    log.info("deleteGroup(" + StringUtils.join(new Object[] {groupname}, ',') + ");");

    try {

      if (!groupname.startsWith("/")) groupname = "/" + groupname;

      DeleteGroupOperation.instance(groupname).execute();
      HibernateFactory.commitTransaction();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #8
0
  public User getUser(String username, String userca) throws RemoteException, VOMSException {

    log.info("getUser(" + StringUtils.join(new Object[] {username, userca}, ',') + ");");

    try {

      VOMSUser u = (VOMSUser) FindUserOperation.instance(username, userca).execute();

      if (u == null) return null;
      else return u.asUser();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);

      throw e;
    }
  }
コード例 #9
0
  public void createGroup(String parentname, String groupname)
      throws RemoteException, VOMSException {

    log.info("createGroup(" + StringUtils.join(new Object[] {parentname, groupname}, ',') + ");");

    if (!groupname.startsWith("/")) groupname = "/" + groupname;

    try {

      Validator.validateInputString(groupname, "Invalid characters in group name!");
      CreateGroupOperation.instance(groupname).execute();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);

      throw e;
    }
  }
コード例 #10
0
  public String[] getGroupPath(String groupname) throws RemoteException, VOMSException {

    log.info("getGroupPath(" + StringUtils.join(new Object[] {groupname}, ',') + ");");

    try {

      String[] parentChain = PathNamingScheme.getParentGroupChain(groupname);
      String[] result = new String[parentChain.length + 1];

      result[0] = groupname;
      System.arraycopy(parentChain, 0, result, 1, parentChain.length);

      return result;

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #11
0
  public void createUser(User user) throws RemoteException, VOMSException {

    log.info(
        "createUser(" + StringUtils.join(new Object[] {user.getDN(), user.getCA()}, ',') + ");");

    try {

      Validator.validateUser(user);
      CreateUserOperation.instance(
              user.getDN(), user.getCA(), user.getCN(), user.getCertUri(), user.getMail())
          .execute();

      HibernateFactory.commitTransaction();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #12
0
  public User[] listMembers(String groupname) throws RemoteException, VOMSException {

    log.info("listMembers(" + StringUtils.join(new Object[] {groupname}, ',') + ");");

    if (groupname == null || groupname.equals(""))
      groupname = "/" + VOMSConfiguration.instance().getVOName();

    try {

      List<VOMSUser> members = (List<VOMSUser>) ListMembersOperation.instance(groupname).execute();

      HibernateFactory.commitTransaction();

      return VOMSUser.collectionAsUsers(members);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #13
0
  public User[] listUsersWithRole(String groupname, String rolename)
      throws RemoteException, VOMSException {

    log.info(
        "listUsersWithRole(" + StringUtils.join(new Object[] {groupname, rolename}, ',') + ");");
    try {

      if (!PathNamingScheme.isRole(rolename)) rolename = "Role=" + rolename;

      String contextString = groupname + "/" + rolename;

      List members = (List) ListMembersOperation.instance(contextString).execute();

      HibernateFactory.commitTransaction();
      return VOMSUser.collectionAsUsers(members);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #14
0
  public void assignRole(String groupname, String rolename, String username, String userca)
      throws RemoteException, VOMSException {

    log.info(
        "assignRole("
            + StringUtils.join(new Object[] {groupname, rolename, username, userca}, ',')
            + ");");

    if (PathNamingScheme.isRole(rolename)) rolename = PathNamingScheme.getRoleName(rolename);

    try {

      AssignRoleOperation.instance(groupname, rolename, username, userca).execute();

      HibernateFactory.commitTransaction();

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
コード例 #15
0
  public String[] listSubGroups(String groupname) throws RemoteException, VOMSException {

    log.info("listSubGroups(" + StringUtils.join(new Object[] {groupname}, ',') + ");");

    try {

      List childrenGroups;

      if (groupname == null) {

        VOMSContext ctxt = VOMSContext.getVoContext();
        childrenGroups = (List) ListChildrenGroupsOperation.instance(ctxt.getGroup()).execute();
      } else childrenGroups = (List) ListChildrenGroupsOperation.instance(groupname).execute();

      HibernateFactory.commitTransaction();
      return ServiceUtils.groupsToStringArray(childrenGroups);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }