Package com.sun.grid.jgdi.configuration

Examples of com.sun.grid.jgdi.configuration.UserSet


        if (o instanceof ComplexEntryImpl) {
            ComplexEntry ce = ((ComplexEntryImpl)o);
            return ce.getName()+"="+ce.getStringval();
        }
        if (o instanceof UserSetImpl) {
            UserSet us = ((UserSetImpl)o);
            return us.getName();
        }
        if (o instanceof String) {
            String str = (String) o;
            if (str.trim().length()==0) {
                return null;
View Full Code Here


    @OptionAnnotation(value = "-au", min = 2, extra = MAX_ARG_VALUE)
    public void addUserSet(final OptionInfo oi) throws JGDIException {
        List<JGDIAnswer> answer = new LinkedList<JGDIAnswer>();
        final List<String> setList = oi.getLastOriginalArgList();
        final List<String> userList = oi.getArgs();
        UserSet obj;
        //This is the only call we want to make
        oi.optionDone();
        if (userList.size() == 0) {
            //We are missing the set list and used usernames as sets
            String msg = getErrorMessage("LessArguments", oi.getOd().getOption(), new ArrayList(setList));
            throw new JGDIException(msg, getCustomExitCode("LessArguments", oi.getOd().getOption()));
        }
        boolean isNew;
        //We add all the users to all the usersets
        for (String set : setList) {
            obj = jgdi.getUserSet(set);
            isNew = false;
            if (obj == null) {
                obj = new UserSetImpl(true);
                obj.setName(set);
                isNew = true;
            }
            for (String user: userList) {
                //TODO LP: CR XXXXXX addEntries curently add already existing elements
                //Missing messages added user to set
                obj.addEntries(user);
            }
            if (isNew) {
                jgdi.addUserSetWithAnswer(obj, answer);
            } else {
                jgdi.updateUserSetWithAnswer(obj, answer);
View Full Code Here

    @OptionAnnotation(value = "-du", min = 2, extra = MAX_ARG_VALUE)
    public void deleteUserSet(final OptionInfo oi) throws JGDIException {
        List<JGDIAnswer> answer = new LinkedList<JGDIAnswer>();
        final List<String> setList = oi.getLastOriginalArgList();
        final List<String> userList = oi.getArgs();
        UserSet obj;
       
        //This is the only call we want to make
        oi.optionDone();
        if (userList.size() == 0) {
            //We are missing the set list and used usernames as sets
            String msg = getErrorMessage("LessArguments", oi.getOd().getOption(), new ArrayList(setList));
            throw new JGDIException(msg, getCustomExitCode("LessArguments", oi.getOd().getOption()));
        }
        //We delete form all the sets
        for (String set : setList) {
            obj = jgdi.getUserSetWithAnswer(set, answer);
            printAnswers(answer);
            answer.clear();
            if (obj == null) {
                err.println(getErrorMessage("InvalidObjectArgument", oi.getOd().getOption(), set));
                setExitCode(getCustomExitCode("InvalidObjectArgument", oi.getOd().getOption()));
                //TODO LP: Missing message about invalid name
                continue;
            }
            for (String user: userList) {
                //TODO LP: CR XXXXXX addEntries curently add already existing elements
                //Also messages are coming from the client!
                //user "user3" is not in access list "set1"
                //deleted user "user3" from access list "set2"
                obj.removeEntries(user);
            }
            jgdi.updateUserSetWithAnswer(obj, answer);
            printAnswers(answer);
            answer.clear();
        }
View Full Code Here

    //-dul
    @OptionAnnotation(value = "-dul", min = 1, extra = MAX_ARG_VALUE)
    public void deleteUserSetList(final OptionInfo oi) throws JGDIException {
        List<JGDIAnswer> answer = new LinkedList<JGDIAnswer>();
        final String setName = oi.getFirstArg();
        UserSet obj = jgdi.getUserSetWithAnswer(setName, answer);
        printAnswers(answer);
        if (obj == null) {
            err.println(getErrorMessage("InvalidObjectArgument", oi.getOd().getOption(), setName));
            setExitCode(getCustomExitCode("InvalidObjectArgument", oi.getOd().getOption()));
            return;
View Full Code Here

        hg1 = new HostgroupImpl("@hgroup1");
        if ((hg = jgdi.getHostgroup(hg1.getName())) != null) {
            jgdi.deleteHostgroup(hg);
        }
       
        UserSet us;
        us1 = new UserSetImpl("user1");
        us2 = new UserSetImpl("user2");
        us3 = new UserSetImpl("user3");
        if ((us = jgdi.getUserSet("user1")) != null) {
            jgdi.deleteUserSet(us);
View Full Code Here

    public void testQueueUserFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            ClusterQueueSummaryOptions options = new ClusterQueueSummaryOptions();
            UserSet userSet = ConfigurationFactory.createUserSet();
            userSet.setName("NoAccessUsers");
            userSet.addEntries("noaccess");
            jgdi.addUserSet(userSet);
            try {
                ClusterQueue cq = ConfigurationFactory.createClusterQueueWithDefaults();
                cq.setName("testQueueUserFilter");
                UserFilter uf = new UserFilter();
View Full Code Here

TOP

Related Classes of com.sun.grid.jgdi.configuration.UserSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.