Examples of ParamModel


Examples of org.glassfish.api.admin.CommandModel.ParamModel

            if (doUpload) {
                outboundPayload = PayloadImpl.Outbound.newInstance();
            }

            StringBuilder uriString = getCommandURI();
            ParamModel operandParam = null;
            for (ParamModel opt : commandModel.getParameters()) {
                if (opt.getParam().primary()) {
                    operandParam = opt;
                    continue;
                }
                String paramName = opt.getName();
               
                List<String> paramValues = new ArrayList<String>(options.get(paramName.toLowerCase(Locale.ENGLISH)));
                if (!opt.getParam().alias().isEmpty() &&
                        !paramName.equalsIgnoreCase(opt.getParam().alias())){
                    paramValues.addAll(options.get(opt.getParam().alias().toLowerCase(Locale.ENGLISH)));
                }
                if (!opt.getParam().multiple() && paramValues.size() > 1) {
                    throw new CommandException(strings.get("tooManyOptions",
                            paramName));
                }
                if (paramValues.isEmpty()) {
                    // perhaps it's set in the environment?
                    String envValue = getFromEnvironment(paramName);
                    if (envValue != null) {
                        paramValues.add(envValue);
                    }
                }
                if (paramValues.isEmpty()) {
                    /*
                     * Option still not set.  Note that we ignore the default
                     * value and don't send it explicitly on the assumption
                     * that the server will supply the default value itself.
                     *
                     * If the missing option is required, that's an error,
                     * which should never happen here because validate()
                     * should check it first.
                     */
                    if (!opt.getParam().optional()) {
                        throw new CommandException(strings.get("missingOption",
                                paramName));
                    }
                    // optional param not set, skip it
                    continue;
                }
                for (String paramValue : paramValues) {
                    if (opt.getType() == File.class ||
                            opt.getType() == File[].class) {
                        addFileOption(uriString, paramName, paramValue);
                    } else if (opt.getParam().password()) {
                        addPasswordOption(uriString, paramName, paramValue);
                    } else {
                        addStringOption(uriString, paramName, paramValue);
                    }
                }
            }

            // add operands
            for (String operand : operands) {
                if (operandParam.getType() == File.class ||
                        operandParam.getType() == File[].class) {
                    addFileOption(uriString, "DEFAULT", operand);
                } else {
                    addStringOption(uriString, "DEFAULT", operand);
                }
            }
View Full Code Here

Examples of org.jsynthlib.xmldevice.ParamModel

                setSender(midiSenderX, node.getSenderX());
            }
            xParam.setMin(node.getMinX());
            xParam.setName(node.getNameX());
            if (node.getPmodelX() != null) {
                ParamModel paramModelX = xParam.addNewParamModel();
                setParamModel(paramModelX, node.getPmodelX());
            }
            xParam.setUuid(generateUuid());

            yParam.setBase(node.getBaseY());
            yParam.setMax(node.getMaxY());
            if (node.getSenderY() != null) {
                MidiSender midiSenderY = yParam.addNewMidiSender();
                setSender(midiSenderY, node.getSenderY());
            }
            yParam.setMin(node.getMinY());
            yParam.setName(node.getNameY());
            if (node.getPmodelY() != null) {
                ParamModel paramModelY = yParam.addNewParamModel();
                setParamModel(paramModelY, node.getPmodelY());
            }
            yParam.setUuid(generateUuid());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.