Package lcmc.drbd.ui.resource

Examples of lcmc.drbd.ui.resource.ResourceInfo


        }
    }

    @Override
    protected JComponent getInputPane() {
        final ResourceInfo dri = getDrbdVolumeInfo().getDrbdResourceInfo();
        final JPanel inputPane = new JPanel();
        inputPane.setLayout(new BoxLayout(inputPane, BoxLayout.LINE_AXIS));

        final JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.PAGE_AXIS));
        /* common options */
        final Map<String, Value> commonPreferredValue = new HashMap<String, Value>();
        commonPreferredValue.put(DrbdXml.PROTOCOL_PARAM, DrbdXml.PROTOCOL_C);
        commonPreferredValue.put(DEGR_WFC_TIMEOUT_PARAM, new StringValue("0"));
        commonPreferredValue.put(CRAM_HMAC_ALG_PARAM, new StringValue("sha1"));
        commonPreferredValue.put(SHARED_SECRET_PARAM, new StringValue(getRandomSecret()));
        commonPreferredValue.put(ON_IO_ERROR_PARAM, new StringValue("detach"));
        commonPreferredValue.put(PROXY_MEMLIMIT_PARAM, new StringValue("100", DrbdXml.getUnitMiBytes("")));
        commonPreferredValue.put(PROXY_PLUGIN_ZLIB_PARAM, new StringValue("level 9"));
        final GlobalInfo globalInfo = dri.getBrowser().getGlobalInfo();
        final boolean protocolInNetSection = globalInfo.atLeastVersion("8.4");
        if (globalInfo.getDrbdResources().size() <= 1) {
            for (final String commonP : COMMON_PARAMS) {
                if (!protocolInNetSection && DrbdXml.PROTOCOL_PARAM.equals(commonP)) {
                    continue;
                }
                final Widget widget = globalInfo.getWidget(commonP, null);
                if (widget == null) {
                    LOG.appError("widget for param: " + commonP + " was not created");
                    return new JPanel();
                }
                /* for the first resource set common options. */
                final Value commonValue = globalInfo.getResource().getValue(commonP);
                if (commonPreferredValue.containsKey(commonP)) {
                    final Value defaultValue = globalInfo.getParamDefault(commonP);
                    if (Tools.areEqual(defaultValue, commonValue)) {
                        widget.setValue(commonPreferredValue.get(commonP));
                        dri.getResource().setValue(commonP, commonPreferredValue.get(commonP));
                    } else {
                        dri.getResource().setValue(commonP, commonValue);
                    }
                }
            }
        } else {
            /* resource options, if not defined in common section. */
            for (final String commonP : COMMON_PARAMS) {
                final Value commonValue = globalInfo.getResource().getValue(commonP);
                if (commonValue == null || commonValue.isNothingSelected()
                    && commonPreferredValue.containsKey(commonP)) {
                    dri.getResource().setValue(commonP, commonPreferredValue.get(commonP));
                }
            }
        }

        /* address combo boxes */
        dri.addHostAddresses(optionsPanel,
                             application.getServiceLabelWidth(),
                             application.getServiceFieldWidth() << 1,
                             true,
                             buttonClass(nextButton()));
        dri.addWizardParams(optionsPanel,
                            PARAMS,
                            buttonClass(nextButton()),
                            application.getDefaultSize("Dialog.DrbdConfig.Resource.LabelWidth"),
                            application.getDefaultSize("Dialog.DrbdConfig.Resource.FieldWidth") << 1,
                            null);
View Full Code Here


                t.start();
            }
        });
        panel.add(btn);

        final ResourceInfo dri = getDrbdVolumeInfo().getDrbdResourceInfo();
        for (final Host h : dri.getCluster().getProxyHosts()) {
            panel.add(new JLabel(h.getName()));
        }
        return panel;
    }
View Full Code Here

                final Application.RunMode runMode = Application.RunMode.LIVE;

                /* apply */
                final VolumeInfo dvi = getDrbdVolumeInfo();
                globalInfo.apply(runMode);
                final ResourceInfo dri = dvi.getDrbdResourceInfo();
                application.invokeAndWait(new Runnable() {
                    @Override
                    public void run() {
                        dri.getInfoPanel();
                    }
                });
                dri.waitForInfoPanel();
                dri.apply(runMode);

                application.invokeAndWait(new Runnable() {
                    @Override
                    public void run() {
                        dvi.getInfoPanel();
View Full Code Here

TOP

Related Classes of lcmc.drbd.ui.resource.ResourceInfo

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.