Package lcmc.common.domain

Examples of lcmc.common.domain.StringValue


        return true;
    }

    @Override
    public Value getParamDefault(final String param) {
        return new StringValue("default");
    }
View Full Code Here


    @Override
    protected Value[] getParamPossibleChoices(final String param) {
        if (DRBD_MD_PARAM.equals(param)) {
            /* meta disk */
            final Value internalMetaDisk =
                                    new StringValue("internal", Tools.getString("HostBrowser.MetaDisk.Internal"));
            final Value defaultMetaDiskString = internalMetaDisk;
            getBrowser().lockBlockDevInfosRead();
            final Value[] blockDevices = getAvailableBlockDevicesForMetaDisk(
            internalMetaDisk,
            getName(),
            getBrowser().getSortedBlockDevInfos());
            getBrowser().unlockBlockDevInfosRead();

            getBlockDevice().setDefaultValue(DRBD_MD_PARAM,
            defaultMetaDiskString);
            return blockDevices;
        } else if (DRBD_MD_INDEX_PARAM.equals(param)) {
            final Value dmdiValue = getBlockDevice().getValue(DRBD_MD_INDEX_PARAM);
            String defaultMetaDiskIndex;
            if (dmdiValue == null) {
                defaultMetaDiskIndex = null;
            } else {
                defaultMetaDiskIndex = dmdiValue.getValueForConfig();
            }

            if ("internal".equals(defaultMetaDiskIndex)) {
                defaultMetaDiskIndex = Tools.getString("HostBrowser.MetaDisk.Internal");
            }

            int index = 0;
            if (defaultMetaDiskIndex == null) {
                defaultMetaDiskIndex = DRBD_MD_TYPE_FLEXIBLE.getValueForConfig();
            } else if (!DRBD_MD_TYPE_FLEXIBLE.getValueForConfig().equals(defaultMetaDiskIndex)) {
                index = Integer.valueOf(defaultMetaDiskIndex) - 5;
                if (index < 0) {
                    index = 0;
                }
            }

            final Value[] indeces = new Value[11];
            indeces[0] = DRBD_MD_TYPE_FLEXIBLE;
            for (int i = 1; i < 11; i++) {
                indeces[i] = new StringValue(Integer.toString(index));
                index++;
            }

            getBlockDevice().setDefaultValue(DRBD_MD_INDEX_PARAM,
            DRBD_MD_TYPE_FLEXIBLE);
View Full Code Here

                    final BlockDevInfo mdI = drbdGraph.findBlockDevInfo(hostName, metaDisk);
                    if (mdI != null) {
                        getBlockDevice().setMetaDisk(mdI.getBlockDevice());
                    }
                }
                value = new StringValue(metaDisk);
            } else if (DRBD_MD_INDEX_PARAM.equals(param)) {
                value = new StringValue(dxml.getMetaDiskIndex(hostName, resName, volumeNr));
            }
            final Value defaultValue = getParamDefault(param);
            if (value == null) {
                value = defaultValue;
            }
View Full Code Here

                                             createdFs = cdi.getLastCreatedFs();
                                         } else {
                                             createdFs = selectedValue;
                                         }
                                         if (createdFs != null && !createdFs.isEmpty()) {
                                             fstypeParamWidget.setValue(new StringValue(createdFs));
                                         }
                                     }
                                 }
                             });
    }
View Full Code Here

            if (selectedInfo != null) {
                selectedValue = selectedInfo;
            }
            Value defaultValue = null;
            if (selectedValue.isNothingSelected()) {
                defaultValue =  new StringValue() {
                                   @Override
                                   public String getNothingSelected() {
                                       return Tools.getString("ClusterBrowser.SelectBlockDevice");
                                   }
                               };
            }
            final Value[] commonBlockDevInfos = getCommonBlockDevInfos(defaultValue, getName());
            blockDeviceParamWidget = widgetFactory.createInstance(
                                   Widget.GUESS_TYPE,
                                   selectedValue,
                                   commonBlockDevInfos,
                                   Widget.NO_REGEXP,
                                   width,
                                   Widget.NO_ABBRV,
                                   new AccessMode(getAccessType(param), isEnabledOnlyInAdvancedMode(param)),
                                   Widget.NO_BUTTON);
            blockDeviceParamWidget.setAlwaysEditable(true);
            paramWi = blockDeviceParamWidget;
            addParamComboListeners(paramWi);
            widgetAdd(param, prefix, paramWi);
        } else if ("fstype".equals(param)) {
            final Value defaultValue =
              new StringValue() {
                  @Override
                  public String getNothingSelected() {
                      return Tools.getString("ClusterBrowser.SelectFilesystem");
                  }
              };

            Value selectedValue = getPreviouslySelected(param, prefix);
            if (selectedValue == null) {
                selectedValue = getParamSaved(param);
            }
            if (selectedValue == null || selectedValue.isNothingSelected()) {
                selectedValue = defaultValue;
            }

            paramWi = widgetFactory.createInstance(
                              Widget.GUESS_TYPE,
                              selectedValue,
                              getBrowser().getCommonFileSystems(defaultValue),
                              Widget.NO_REGEXP,
                              width,
                              Widget.NO_ABBRV,
                              new AccessMode(getAccessType(param), isEnabledOnlyInAdvancedMode(param)),
                              Widget.NO_BUTTON);
            fstypeParamWidget = paramWi;

            widgetAdd(param, prefix, paramWi);
            paramWi.setEditable(false);
        } else if ("directory".equals(param)) {
            final String[] cmp = getBrowser().getCommonMountPoints();
            final Value[] items = new Value[cmp.length + 1];
            final Value defaultValue = new StringValue() {
                              @Override
                              public String getNothingSelected() {
                                  return Tools.getString("ClusterBrowser.SelectMountPoint");
                              }
                          };
            items[0] = defaultValue;
            int i = 1;
            for (final String c : cmp) {
                items[i] = new StringValue(c);
                i++;
            }

            getResource().setPossibleChoices(param, items);
            Value selectedValue = getPreviouslySelected(param, prefix);
View Full Code Here

        } else {
            selectedValue = selectedInfo;
        }
        Value defaultValue = null;
        if (selectedValue == null || selectedValue.isNothingSelected()) {
            defaultValue = new StringValue() {
                              @Override
                              public String getNothingSelected() {
                                  return Tools.getString("ClusterBrowser.SelectBlockDevice");
                              }
                          };
View Full Code Here

    public Value[] getCommonFileSystems(final Value defaultValue) {
        final Value[] cfs =  new Value[commonFileSystems.length + 2];
        cfs[0] = defaultValue;
        int i = 1;
        for (final String cf : commonFileSystems) {
            cfs[i] = new StringValue(cf);
            i++;
        }
        cfs[i] = new StringValue("none");
        return cfs;
    }
View Full Code Here

        this.host = host;
        final Value[] booleanValues = PCMK_BOOLEAN_VALUES;
        final Value hbBooleanTrue = booleanValues[0];
        final Value hbBooleanFalse = booleanValues[1];
        /* hostlist choices for stonith */
        stonithHostlistChoices.add(new StringValue());
        final String[] hosts = host.getCluster().getHostNames();
        if (hosts != null && hosts.length < 8) {
            stonithHostlistChoices.add(new StringValue(Tools.join(" ", hosts)));
            for (final String h : hosts) {
                stonithHostlistChoices.add(new StringValue(h));
            }
        }
        /* clones */
        cloneResourceAgent = new ResourceAgent(Application.PM_CLONE_SET_NAME, "", "clone");
        cloneResourceAgent.setMetaDataLoaded(true);
        addMetaAttributeToResourceAgent(cloneResourceAgent, MASTER_MAX_META_ATTR, null, true);
        addMetaAttributeToResourceAgent(cloneResourceAgent, MASTER_NODE_MAX_META_ATTR, null, true);
        addMetaAttributeToResourceAgent(cloneResourceAgent, CLONE_MAX_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(cloneResourceAgent, CLONE_NODE_MAX_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(cloneResourceAgent, NOTIFY_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(cloneResourceAgent, GLOBALLY_UNIQUE_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(cloneResourceAgent, ORDERED_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(cloneResourceAgent, INTERLEAVE_META_ATTR, null, false);

        addMetaAttributeToResourceAgent(groupResourceAgent, GROUP_ORDERED_META_ATTR, null, false);
        addMetaAttributeToResourceAgent(groupResourceAgent, GROUP_COLLOCATED_META_ATTR, null, false);
        /* groups */
        final Map<String, String> maParams = getMetaAttrParameters();
        for (final String metaAttr : maParams.keySet()) {
            addMetaAttributeToResourceAgent(cloneResourceAgent, metaAttr, maParams.get(metaAttr), false);
            addMetaAttributeToResourceAgent(groupResourceAgent, metaAttr, maParams.get(metaAttr), false);
        }

        /* Hardcoding global params */
        /* symmetric cluster */
        globalParams.add("symmetric-cluster");
        globalShortDescMap.put("symmetric-cluster", "Symmetric Cluster");
        globalLongDescMap.put("symmetric-cluster", "Symmetric Cluster");
        globalTypeMap.put("symmetric-cluster", PARAM_TYPE_BOOLEAN);
        globalDefaultMap.put("symmetric-cluster", hbBooleanFalse);
        globalComboBoxChoices.put("symmetric-cluster", booleanValues);
        globalRequiredParams.add("symmetric-cluster");
        globalNotAdvancedParams.add("symmetric-cluster");

        /* stonith enabled */
        globalParams.add("stonith-enabled");
        globalShortDescMap.put("stonith-enabled", "Stonith Enabled");
        globalLongDescMap.put("stonith-enabled", "Stonith Enabled");
        globalTypeMap.put("stonith-enabled", PARAM_TYPE_BOOLEAN);
        globalDefaultMap.put("stonith-enabled", hbBooleanTrue);
        globalComboBoxChoices.put("stonith-enabled", booleanValues);
        globalRequiredParams.add("stonith-enabled");
        globalNotAdvancedParams.add("stonith-enabled");

        /* transition timeout */
        globalParams.add("default-action-timeout");
        globalShortDescMap.put("default-action-timeout", "Transition Timeout");
        globalLongDescMap.put("default-action-timeout", "Transition Timeout");
        globalTypeMap.put("default-action-timeout", PARAM_TYPE_INTEGER);
        globalDefaultMap.put("default-action-timeout", new StringValue("20"));
        globalComboBoxChoices.put("default-action-timeout", INTEGER_VALUES);
        globalRequiredParams.add("default-action-timeout");

        /* resource stickiness */
        /* special case: is advanced parameter if not set. */
        globalParams.add("default-resource-stickiness");
        globalShortDescMap.put("default-resource-stickiness", "Resource Stickiness");
        globalLongDescMap.put("default-resource-stickiness", "Resource Stickiness");
        globalTypeMap.put("default-resource-stickiness", PARAM_TYPE_INTEGER);
        globalComboBoxChoices.put("default-resource-stickiness", INTEGER_VALUES);
        globalDefaultMap.put("default-resource-stickiness", new StringValue("0"));
        globalRequiredParams.add("default-resource-stickiness");

        /* no quorum policy */
        globalParams.add("no-quorum-policy");
        globalShortDescMap.put("no-quorum-policy", "No Quorum Policy");
        globalLongDescMap.put("no-quorum-policy", "No Quorum Policy");
        globalTypeMap.put("no-quorum-policy", PARAM_TYPE_STRING);
        globalDefaultMap.put("no-quorum-policy", new StringValue("stop"));
        globalComboBoxChoices.put("no-quorum-policy", new Value[]{new StringValue("ignore"),
                new StringValue("stop"),
                new StringValue("freeze"),
                new StringValue("suicide")});
        globalRequiredParams.add("no-quorum-policy");
        globalNotAdvancedParams.add("no-quorum-policy");

        /* resource failure stickiness */
        globalParams.add("default-resource-failure-stickiness");
        globalShortDescMap.put("default-resource-failure-stickiness", "Resource Failure Stickiness");
        globalLongDescMap.put("default-resource-failure-stickiness", "Resource Failure Stickiness");
        globalTypeMap.put("default-resource-failure-stickiness", PARAM_TYPE_INTEGER);
        globalComboBoxChoices.put("default-resource-failure-stickiness", INTEGER_VALUES);
        globalDefaultMap.put("default-resource-failure-stickiness", new StringValue("0"));
        globalRequiredParams.add("default-resource-failure-stickiness");

        globalComboBoxChoices.put("placement-strategy", new Value[]{new StringValue("default"),
                new StringValue("utilization"),
                new StringValue("minimal"),
                new StringValue("balanced")});

        final String hbV = host.getHeartbeatVersion();
        final String pcmkV = host.getPacemakerVersion();
        try {
            if (pcmkV != null || Tools.compareVersions(hbV, "2.1.3") >= 0) {
                String clusterRecheckInterval = "cluster-recheck-interval";
                String dcDeadtime = "dc-deadtime";
                String electionTimeout = "election-timeout";
                String shutdownEscalation = "shutdown-escalation";
                if (Tools.versionBeforePacemaker(host)) {
                    clusterRecheckInterval = "cluster_recheck_interval";
                    dcDeadtime = "dc_deadtime";
                    electionTimeout = "election_timeout";
                    shutdownEscalation = "shutdown_escalation";
                }
                final String[] params = {"stonith-action",
                                         "is-managed-default",
                                         "cluster-delay",
                                         "batch-limit",
                                         "stop-orphan-resources",
                                         "stop-orphan-actions",
                                         "remove-after-stop",
                                         "pe-error-series-max",
                                         "pe-warn-series-max",
                                         "pe-input-series-max",
                                         "startup-fencing",
                                         "start-failure-is-fatal",
                                         dcDeadtime,
                                         clusterRecheckInterval,
                                         electionTimeout,
                                         shutdownEscalation,
                                         "crmd-integration-timeout",
                                         "crmd-finalization-timeout",
                                         "expected-quorum-votes",
                                         "maintenance-mode",
                };
                globalParams.add("dc-version");
                globalShortDescMap.put("dc-version", "DC Version");
                globalTypeMap.put("dc-version", PARAM_TYPE_LABEL);
                paramGlobalAccessTypes.put("dc-version", AccessMode.NEVER);
                globalParams.add("cluster-infrastructure");
                globalShortDescMap.put("cluster-infrastructure", "Cluster Infrastructure");
                globalTypeMap.put("cluster-infrastructure", PARAM_TYPE_LABEL);
                paramGlobalAccessTypes.put("cluster-infrastructure", AccessMode.NEVER);

                globalNotAdvancedParams.add("no-quorum-policy");
                globalNotAdvancedParams.add("maintenance-mode");
                paramGlobalAccessTypes.put("maintenance-mode", AccessMode.OP);
                globalNotAdvancedParams.add(clusterRecheckInterval);

                for (final String param : params) {
                    globalParams.add(param);
                    final String[] parts = param.split("[-_]");
                    for (int i = 0; i < parts.length; i++) {
                        if ("dc".equals(parts[i])) {
                            parts[i] = "DC";
                        }
                        if ("crmd".equals(parts[i])) {
                            parts[i] = "CRMD";
                        } else {
                            parts[i] = Tools.ucfirst(parts[i]);
                        }
                    }
                    final String name = Tools.join(" ", parts);
                    globalShortDescMap.put(param, name);
                    globalLongDescMap.put(param, name);
                    globalTypeMap.put(param, PARAM_TYPE_STRING);
                    globalDefaultMap.put(param, new StringValue());
                }
                globalDefaultMap.put("stonith-action", new StringValue("reboot"));
                globalComboBoxChoices.put("stonith-action", new Value[]{new StringValue("reboot"),
                        new StringValue("poweroff")});

                globalTypeMap.put("is-managed-default", PARAM_TYPE_BOOLEAN);
                globalDefaultMap.put("is-managed-default", hbBooleanFalse);
                globalComboBoxChoices.put("is-managed-default", booleanValues);

View Full Code Here

     * the true and false values.
     */
    private Value[] getCheckBoxChoices(final String paramDefault) {
        if (paramDefault != null) {
            if ("yes".equals(paramDefault) || "no".equals(paramDefault)) {
                return new Value[]{new StringValue("yes"), new StringValue("no")};
            } else if ("Yes".equals(paramDefault) || "No".equals(paramDefault)) {
                return new Value[]{new StringValue("Yes"), new StringValue("No")};
            } else if (PCMK_TRUE_VALUE.getValueForConfig().equals(paramDefault)
                       || PCMK_FALSE_VALUE.getValueForConfig().equals(paramDefault)) {
                return PCMK_BOOLEAN_VALUES.clone();
            } else if ("True".equals(paramDefault) || "False".equals(paramDefault)) {
                return new Value[]{new StringValue("True"), new StringValue("False")};
            }
        }
        return PCMK_BOOLEAN_VALUES.clone();
    }
View Full Code Here

                               final boolean required,
                               final boolean metaAttr,
                               final String param,
                               Value value) {
        if (metaAttr && isRscDefaultsInteger(param) && DISABLED_IN_COMBOBOX.equals(value)) {
            value = new StringValue();
        }
        boolean correctValue = true;
        if (PARAM_TYPE_BOOLEAN.equals(type)) {
            if (!PCMK_YES.equals(value) && !PCMK_NO.equals(value)
                && !PCMK_TRUE_VALUE.equals(value)
View Full Code Here

TOP

Related Classes of lcmc.common.domain.StringValue

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.