Search in sources :

Example 46 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class EditCubridConfigEditor method init.

/**
	 * @see com.cubrid.common.ui.spi.part.CubridEditorPart#init(org.eclipse.ui.IEditorSite,
	 *      org.eclipse.ui.IEditorInput)
	 * @param site the editor site
	 * @param input the editor input
	 * @exception PartInitException if this editor was not initialized
	 *            successfully
	 */
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    if (input instanceof ConfEditInput) {
        editorInput = (ConfEditInput) input;
        ServerInfo serverInfo = editorInput.getServerInfo();
        contents = ConfigParaHelp.performGetCubridConf(serverInfo);
    }
}
Also used : ConfEditInput(com.cubrid.cubridmanager.ui.host.action.ConfEditInput) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo)

Example 47 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class EditHAConfigEditor method init.

/**
	 * @see com.cubrid.common.ui.spi.part.CubridEditorPart#init(org.eclipse.ui.IEditorSite,
	 *      org.eclipse.ui.IEditorInput)
	 * @param site the editor site
	 * @param input the editor input
	 * @exception PartInitException if this editor was not initialized
	 *            successfully
	 */
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    if (input instanceof ConfEditInput) {
        editorInput = (ConfEditInput) input;
        ServerInfo serverInfo = editorInput.getServerInfo();
        contents = ConfigParaHelp.performGetHAConf(serverInfo);
    }
}
Also used : ConfEditInput(com.cubrid.cubridmanager.ui.host.action.ConfEditInput) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo)

Example 48 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class SetHostInfoPage method getNextPage.

/**
	 * Get next page
	 * 
	 * @return The IWizardPage
	 */
public IWizardPage getNextPage() {
    if (!isCanFinished()) {
        return null;
    }
    AddHostAndDbWizard wizard = ((AddHostAndDbWizard) getWizard());
    int type = wizard.getAddedType();
    ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(ipText.getText(), Integer.parseInt(portText.getText()), userNameText.getText());
    if ((type == 0 || type == 2) && serverInfo.getServerType() == ServerType.BROKER) {
        return wizard.getSelectBrokerPage();
    } else {
        return (type == 0 || type == 1) ? wizard.getSelectDbPage() : null;
    }
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo)

Example 49 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class SetHostInfoPage method createControl.

/**
	 * Create the control for this page
	 * 
	 * @param parent Composite
	 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gridData);
    Group cmServerInfoGroup = new Group(composite, SWT.NONE);
    cmServerInfoGroup.setText(Messages.grpHostInfo);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cmServerInfoGroup.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    cmServerInfoGroup.setLayout(layout);
    Label nickNameLable = new Label(cmServerInfoGroup, SWT.LEFT);
    nickNameLable.setText(Messages.lblNickName);
    nickNameLable.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    nickNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    nickNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    Label ipLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    ipLabel.setText(Messages.lblIPAddress);
    ipLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ipText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    ipText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    ipText.addModifyListener(this);
    Label portNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    portNameLabel.setText(Messages.lblPort);
    portNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    portText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    portText.setTextLimit(5);
    portText.setText("8001");
    portText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    portText.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            portText.selectAll();
            portText.setFocus();
        }
    });
    portText.addModifyListener(this);
    Label userNameLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    userNameLabel.setText(Messages.lblUserName);
    userNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    userNameText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.BORDER);
    userNameText.setText("admin");
    userNameText.setEnabled(false);
    userNameText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
    userNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    Label passwordLabel = new Label(cmServerInfoGroup, SWT.LEFT);
    passwordLabel.setText(Messages.lblPassword);
    passwordLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    passwordText = new Text(cmServerInfoGroup, SWT.LEFT | SWT.PASSWORD | SWT.BORDER);
    passwordText.setTextLimit(ValidateUtil.MAX_NAME_LENGTH);
    passwordText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    passwordText.addModifyListener(this);
    passwordText.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            passwordText.selectAll();
            passwordText.setFocus();
        }
    });
    Composite btnComposite = new Composite(composite, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.spacing = 5;
    btnComposite.setLayout(rowLayout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalAlignment = GridData.END;
    btnComposite.setLayoutData(gridData);
    connectHostButton = new Button(btnComposite, SWT.NONE);
    connectHostButton.setText(Messages.btnConnect);
    connectHostButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            String address = ipText.getText();
            String port = portText.getText();
            String userName = userNameText.getText();
            String password = passwordText.getText();
            String nickName = nickNameText.getText();
            if (nickName.trim().length() == 0) {
                nickNameText.setText(address + ":" + port);
            }
            ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(address, Integer.parseInt(port), userName);
            if (serverInfo == null) {
                serverInfo = new ServerInfo();
                serverInfo.setServerName(address);
                serverInfo.setHostAddress(address);
                serverInfo.setHostMonPort(Integer.parseInt(port));
                serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
                serverInfo.setUserName(userName);
                serverInfo.setUserPassword(password);
                serverInfo.setJdbcDriverVersion(ServerJdbcVersionMapping.JDBC_SELF_ADAPTING_VERSION);
            }
            heartbeatNodeInfoTask = new GetHeartbeatNodeInfoTask(serverInfo);
            heartbeatNodeInfoTask.setAllDb(false);
            heartbeatNodeInfoTask.setDbList(new ArrayList<String>());
            TaskExecutor executor = null;
            if (serverInfo.isConnected()) {
                if (CompatibleUtil.isSupportHA(serverInfo)) {
                    executor = new CommonTaskExec(null);
                    executor.addTask(heartbeatNodeInfoTask);
                }
            } else {
                executor = new ConnectHostExecutor(getShell(), serverInfo, true);
                executor.addTask(heartbeatNodeInfoTask);
            }
            if (executor != null) {
                new ExecTaskWithProgress(executor).exec(true, true);
            }
            changeBtnStatus();
        }
    });
    connectHostButton.setEnabled(false);
    init();
    nickNameText.setFocus();
    setTitle(Messages.titileHostInfoPage);
    setMessage(Messages.msgHostInfoPage);
    setControl(composite);
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) Composite(org.eclipse.swt.widgets.Composite) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) GetHeartbeatNodeInfoTask(com.cubrid.cubridmanager.core.mondashboard.task.GetHeartbeatNodeInfoTask) GridLayout(org.eclipse.swt.layout.GridLayout) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) ConnectHostExecutor(com.cubrid.cubridmanager.ui.host.dialog.ConnectHostExecutor)

Example 50 with ServerInfo

use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.

the class SetHostInfoPage method getHostNode.

/**
	 * 
	 * Get Host Node
	 * 
	 * @return The HostNode
	 */
public HostNode getHostNode() {
    HostNode hostNode = new HostNode();
    String nickName = nickNameText.getText();
    if (nickName.trim().length() == 0) {
        nickName = ipText.getText() + ":" + portText.getText();
    }
    hostNode.setName(nickName);
    hostNode.setIp(ipText.getText());
    hostNode.setPort(portText.getText());
    hostNode.setUserName(userNameText.getText());
    hostNode.setPassword(passwordText.getText());
    hostNode.setConnected(true);
    HAHostStatusInfo hostStatusInfo = null;
    if (heartbeatNodeInfoTask != null) {
        hostStatusInfo = heartbeatNodeInfoTask.getHostStatusInfo(ipText.getText());
    }
    if (hostStatusInfo == null) {
        hostStatusInfo = getHostStatusInfo(ipText.getText(), portText.getText());
    }
    if (hostStatusInfo == null) {
        ServerInfo serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(ipText.getText(), Integer.parseInt(portText.getText()), userNameText.getText());
        hostStatusInfo = HAUtil.getHAHostStatusInfo(serverInfo);
    }
    hostNode.setHostStatusInfo(hostStatusInfo);
    return hostNode;
}
Also used : HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Aggregations

ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)255 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)40 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)40 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)39 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)37 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)35 ArrayList (java.util.ArrayList)30 EnvInfo (com.cubrid.cubridmanager.core.common.model.EnvInfo)29 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)28 TreeViewer (org.eclipse.jface.viewers.TreeViewer)27 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)24 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)24 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)24 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)21 SelectionEvent (org.eclipse.swt.events.SelectionEvent)20 GridData (org.eclipse.swt.layout.GridData)17 GridLayout (org.eclipse.swt.layout.GridLayout)17 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 ITask (com.cubrid.common.core.task.ITask)15