public String[] listGroups(String username, String userca) throws RemoteException, VOMSException {

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

      Set groups = (Set) ListUserGroupsOperation.instance(username, userca).execute();

      HibernateFactory.commitTransaction();

      return ServiceUtils.groupsToStringArray(groups);

    } catch (RuntimeException e) {

      ServiceExceptionHelper.handleServiceException(log, e);
      throw e;
    }
  }
  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;
    }
  }