Examples of ExecCommandConfig


Examples of lcmc.cluster.service.ssh.ExecCommandConfig

        // TODO: disable buttons if disconnected?
        final MyButton procDrbdButton = widgetFactory.createButton("Show Proxy Info");
        procDrbdButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                host.execCommand(new ExecCommandConfig().commandString("DRBD.showProxyInfo")
                                                        .execCallback(execCallback));
            }
        });
        host.registerEnableOnConnect(procDrbdButton);

        final JPanel mainPanel = new JPanel();
        mainPanel.setBackground(HostBrowser.PANEL_BACKGROUND);
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));

        final JPanel buttonPanel = new JPanel(new BorderLayout());
        buttonPanel.setBackground(HostBrowser.BUTTON_PANEL_BACKGROUND);
        buttonPanel.setMinimumSize(new Dimension(0, application.scaled(50)));
        buttonPanel.setPreferredSize(new Dimension(0, application.scaled(50)));
        buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, application.scaled(50)));
        mainPanel.add(buttonPanel);

        /* Actions */
        buttonPanel.add(getActionsButton(), BorderLayout.LINE_END);
        final JPanel p = new JPanel(new SpringLayout());
        p.setBackground(HostBrowser.BUTTON_PANEL_BACKGROUND);

        p.add(procDrbdButton);
        SpringUtilities.makeCompactGrid(p, 1, 1// rows, cols
                                           1, 1// initX, initY
                                           1, 1); // xPad, yPad
        mainPanel.setMinimumSize(new Dimension(
                application.getDefaultSize("HostBrowser.ResourceInfoArea.Width"),
                application.getDefaultSize("HostBrowser.ResourceInfoArea.Height")));
        mainPanel.setPreferredSize(new Dimension(
                application.getDefaultSize("HostBrowser.ResourceInfoArea.Width"),
                application.getDefaultSize("HostBrowser.ResourceInfoArea.Height")));
        buttonPanel.add(p);
        mainPanel.add(new JScrollPane(ta));
        host.execCommand(new ExecCommandConfig().commandString("DRBD.showProxyInfo")
                                                .execCallback(execCallback));
        return mainPanel;
    }
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

                crmConfigureCommitButton.setEnabled(false);
                String command = "HostBrowser.getHostInfo";
                if (!host.hasCorosyncInitScript()) {
                    command = "HostBrowser.getHostInfoHeartbeat";
                }
                host.execCommand(new ExecCommandConfig().commandString(command)
                                                        .execCallback(execCallback)
                                                        .silentCommand()
                                                        .silentOutput()
                                                        .sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
            }
        });
        host.registerEnableOnConnect(hostInfoButton);

        crmConfigureShowButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                registerComponentEditAccessMode(ta, new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL));
                updateAdvancedPanels();
                crmShowInProgress = true;
                crmInfoShowing = false;
                crmConfigureShowButton.setEnabled(false);
                crmConfigureCommitButton.setEnabled(false);
                host.execCommand(new ExecCommandConfig().commandString("HostBrowser.getCrmConfigureShow")
                                                        .execCallback(execCallback)
                                                        .sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
            }
        });
        final CrmGraph crmg = getBrowser().getClusterBrowser().getCrmGraph();
        final Document taDocument = ta.getDocument();
        taDocument.addDocumentListener(new DocumentListener() {
            private void update() {
                if (!crmShowInProgress && !crmInfoShowing) {
                    crmConfigureCommitButton.setEnabled(true);
                }
            }

            @Override
            public void changedUpdate(final DocumentEvent e) {
                update();
            }

            @Override
            public void insertUpdate(final DocumentEvent e) {
                update();
            }

            @Override
            public void removeUpdate(final DocumentEvent e) {
                update();
            }
        });

        final ButtonCallback buttonCallback = new ButtonCallback() {
            private volatile boolean mouseStillOver = false;

            @Override
            public boolean isEnabled() {
                return !Tools.versionBeforePacemaker(host);
            }

            @Override
            public void mouseOut(final ComponentWithTest component) {
                if (!isEnabled()) {
                    return;
                }
                mouseStillOver = false;
                crmg.stopTestAnimation((JComponent) component);
                component.setToolTipText("");
            }

            @Override
            public void mouseOver(final ComponentWithTest component) {
                if (!isEnabled()) {
                    return;
                }
                mouseStillOver = true;
                component.setToolTipText(ClusterBrowser.STARTING_PTEST_TOOLTIP);
                component.setToolTipBackground(Tools.getDefaultColor("ClusterBrowser.Test.Tooltip.Background"));
                Tools.sleep(250);
                if (!mouseStillOver) {
                    return;
                }
                mouseStillOver = false;
                final CountDownLatch startTestLatch = new CountDownLatch(1);
                crmg.startTestAnimation((JComponent) component, startTestLatch);
                final Host dcHost = getBrowser().getClusterBrowser().getDCHost();
                getBrowser().getClusterBrowser().ptestLockAcquire();
                try {
                    final ClusterStatus clStatus = getBrowser().getClusterBrowser().getClusterStatus();
                    clStatus.setPtestResult(null);
                    CRM.crmConfigureCommit(host, ta.getText(), Application.RunMode.TEST);
                    final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
                    component.setToolTipText(ptestData.getToolTip());
                    clStatus.setPtestResult(ptestData);
                } finally {
                    getBrowser().getClusterBrowser().ptestLockRelease();
                }
                startTestLatch.countDown();
            }
        };
        addMouseOverListener(crmConfigureCommitButton, buttonCallback);
        crmConfigureCommitButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                crmConfigureCommitButton.setEnabled(false);
                final Thread thread = new Thread(
                    new Runnable() {
                        @Override
                        public void run() {
                            getBrowser().getClusterBrowser().clStatusLock();
                            try {
                                CRM.crmConfigureCommit(host, ta.getText(), Application.RunMode.LIVE);
                            } finally {
                                getBrowser().getClusterBrowser().clStatusUnlock();
                            }
                        }
                    }
                );
                thread.start();
            }
        });

        final JPanel mainPanel = new JPanel();
        mainPanel.setBackground(HostBrowser.PANEL_BACKGROUND);
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));

        final JPanel buttonPanel = new JPanel(new BorderLayout());
        buttonPanel.setBackground(HostBrowser.BUTTON_PANEL_BACKGROUND);
        buttonPanel.setMinimumSize(new Dimension(0, 50));
        buttonPanel.setPreferredSize(new Dimension(0, 50));
        buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50));
        mainPanel.add(buttonPanel);

        /* Actions */
        buttonPanel.add(getActionsButton(), BorderLayout.LINE_END);
        final JPanel p = new JPanel(new SpringLayout());
        p.setBackground(HostBrowser.BUTTON_PANEL_BACKGROUND);

        p.add(hostInfoButton);
        p.add(crmConfigureShowButton);
        p.add(crmConfigureCommitButton);

        p.add(new JLabel(""));
        SpringUtilities.makeCompactGrid(p, 1, 3// rows, cols
                1, 1// initX, initY
                1, 1); // xPad, yPad
        mainPanel.setMinimumSize(new Dimension(application.getDefaultSize("HostBrowser.ResourceInfoArea.Width"),
                                               application.getDefaultSize("HostBrowser.ResourceInfoArea.Height")));
        mainPanel.setPreferredSize(new Dimension(application.getDefaultSize("HostBrowser.ResourceInfoArea.Width"),
                                                 application.getDefaultSize("HostBrowser.ResourceInfoArea.Height")));
        buttonPanel.add(p);
        mainPanel.add(new JLabel(Tools.getString("HostInfo.crmShellInfo")));
        mainPanel.add(new JScrollPane(ta));
        String command = "HostBrowser.getHostInfo";
        if (!host.hasCorosyncInitScript()) {
            command = "HostBrowser.getHostInfoHeartbeat";
        }
        host.execCommand(new ExecCommandConfig().commandString(command)
                                                .execCallback(execCallback)
                                                .silentCommand()
                                                .silentOutput()
                                                .sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
        return mainPanel;
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

    public final void updateInfo(final JEditorPane ep) {
        final Runnable runnable = new Runnable() {
            @Override
            public void run() {
                final Host host = getBrowser().getHost();
                final SshOutput ret = host.captureCommand(new ExecCommandConfig()
                                                              .command("/sbin/ip a l " + getName()));
                ep.setText(ret.getOutput());
            }
        };
        final Thread thread = new Thread(runnable);
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

        final Runnable runnable = new Runnable() {
            @Override
            public void run() {
                if (cachedModinfoOutput == null) {
                    final Host host = getBrowser().getHost();
                    final SshOutput ret = host.captureCommand(new ExecCommandConfig()
                                                                  .command("/sbin/modinfo " + getName()));
                    cachedModinfoOutput = ret.getOutput();
                }
                ep.setText("<html><pre>" + cachedModinfoOutput + "</html></pre>");
            }
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

        t.start();
    }

    protected final void getAllInfo() {
        final ExecCommandThread t = getHost().execCommand(
                         new ExecCommandConfig().commandString("GetHostAllInfo")
                         .progressBar(getProgressBar())
                         .execCallback(new ExecCallback() {
                             @Override
                             public void done(final String answer) {
                                 checkAnswer(answer);
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

        int i = 0;
        final String stacktrace = Tools.getStackTrace();
        for (final Host host : hosts) {
            final int index = i;
            final String command = host.getDistCommand(logFileCommand(), replaceHash);
            threads[index] = host.execCommand(new ExecCommandConfig()
                                                   .command(command)
                                                   .execCallback(new ExecCallback() {
                                                       @Override
                                                       public void done(final String answer) {
                                                           texts[index] = answer;
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

        }
        final String configFile = cf;
        int i = 0;
        for (final Host h : hosts) {
            final int index = i;
            ts[i] = h.execCommand(new ExecCommandConfig()
                                      .commandString(command)
                                      .execCallback(new ExecCallback() {
                                          @Override
                                          public void done(final String answer) {
                                              configs[index] = answer;
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

                    });
                }
            }
        );

        getHost().execCommand(new ExecCommandConfig().commandString("DrbdCheck.version")
                                                     .progressBar(getProgressBar())
                                                     .execCallback(new ExecCallback() {
                                                         @Override
                                                         public void done(final String answer) {
                                                             checkDrbd(answer);
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

                        checkingDrbdIcon.setIcon(ALREADY_INSTALLED_ICON);
                    }
                }
            });
        }
        getHost().execCommand(new ExecCommandConfig().commandString("HbCheck.version")
                                                     .progressBar(getProgressBar())
                                                     .execCallback(new ExecCallback() {
                                                         @Override
                                                         public void done(final String answer) {
                                                             checkAisHbPm(answer);
View Full Code Here

Examples of lcmc.cluster.service.ssh.ExecCommandConfig

    @Override
    protected void initDialogAfterVisible() {
        getProgressBar().start(50000);

        getHost().execCommand(new ExecCommandConfig().commandString("DrbdInst.mkdir")
                          .progressBar(getProgressBar())
                          .execCallback(new ExecCallback() {
                              @Override
                              public void done(final String answer) {
                                 checkFile(answer);
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.