Search in sources :

Example 91 with ServerInfo

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

the class ServerConfigPropertyPage method initial.

/**
	 * initial the page content
	 */
private void initial() {
    CubridServer server = node.getServer();
    ServerInfo serverInfo = server == null ? null : server.getServerInfo();
    if (server != null && serverInfo != null) {
        hostNameInfoLabel.setText(server.getLabel());
        hostAddressInfoLabel.setText(server.getHostAddress());
        portInfoLabel.setText(server.getMonPort());
        userNameInfoLabel.setText(server.getUserName());
        jdbcInfoLabel.setText(server.getJdbcDriverVersion());
        ServerType serverType = serverInfo.getServerType();
        String type = "server,broker";
        if (serverType == ServerType.BROKER) {
            type = "broker";
        } else if (serverType == ServerType.DATABASE) {
            type = "server";
        }
        serverTypeInfoLabel.setText(type);
    }
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 92 with ServerInfo

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

the class CompactDatabaseAction method isSupported.

public boolean isSupported(Object obj) {
    if (!ActionSupportUtil.hasAdminPermission(obj)) {
        return false;
    }
    ISchemaNode node = (ISchemaNode) obj;
    CubridDatabase database = node.getDatabase();
    if (database == null) {
        return false;
    }
    ServerInfo serverInfo = database.getServer() == null ? null : database.getServer().getServerInfo();
    if (serverInfo == null) {
        return false;
    }
    boolean canOnlineCompactDb = CompatibleUtil.isSupportOnlineCompactDb(serverInfo);
    boolean isOnline = database.getRunningType() == DbRunningType.CS;
    boolean isOffline = database.getRunningType() == DbRunningType.STANDALONE;
    return isOffline || isOnline && canOnlineCompactDb;
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 93 with ServerInfo

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

the class LoadDatabaseAction method run.

public void run() {
    Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        setEnabled(false);
        return;
    }
    ISchemaNode node = (ISchemaNode) obj[0];
    final CubridDatabase database = node.getDatabase();
    final LoadDatabaseDialog dialog = new LoadDatabaseDialog(getShell());
    dialog.setDatabase(database);
    final Shell shell = getShell();
    TaskExecutor taskExcutor = new TaskExecutor() {

        public boolean exec(final IProgressMonitor monitor) {
            if (monitor.isCanceled()) {
                return false;
            }
            monitor.beginTask(Messages.loadDbUnloadInfoTaskName, IProgressMonitor.UNKNOWN);
            for (ITask task : taskList) {
                task.execute();
                final String msg = task.getErrorMsg();
                if (openErrorBox(shell, msg, monitor)) {
                    return false;
                }
                if (monitor.isCanceled()) {
                    return false;
                }
                if (task instanceof GetDbUnloadInfoTask) {
                    GetDbUnloadInfoTask getDbUnloadInfoTask = (GetDbUnloadInfoTask) task;
                    List<DbUnloadInfo> dbUnloadInfoList = getDbUnloadInfoTask.getDbUnloadInfoList();
                    dialog.setDbUnloadInfoList(dbUnloadInfoList);
                }
            }
            return true;
        }
    };
    ServerInfo serverInfo = database.getServer().getServerInfo();
    GetDbUnloadInfoTask task = new GetDbUnloadInfoTask(serverInfo);
    taskExcutor.addTask(task);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        dialog.open();
    }
}
Also used : ITask(com.cubrid.common.core.task.ITask) LoadDatabaseDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.LoadDatabaseDialog) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) DbUnloadInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DbUnloadInfo) GetDbUnloadInfoTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDbUnloadInfoTask) Shell(org.eclipse.swt.widgets.Shell) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 94 with ServerInfo

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

the class GeneralInfoPage method createGenericVolumeGroup.

/**
	 * Create generic volume information group
	 *
	 * @param parent the parent composite
	 */
private void createGenericVolumeGroup(Composite parent) {
    Group genericVolumeGroup = new Group(parent, SWT.NONE);
    genericVolumeGroup.setText(Messages.grpGenericVolInfo);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    genericVolumeGroup.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    genericVolumeGroup.setLayoutData(gridData);
    Label genericSizeLabel = new Label(genericVolumeGroup, SWT.LEFT | SWT.WRAP);
    genericSizeLabel.setText(Messages.lblVolSize);
    gridData = new GridData();
    gridData.widthHint = 150;
    genericSizeLabel.setLayoutData(gridData);
    genericVolumeSizeText = new Text(genericVolumeGroup, SWT.BORDER);
    genericVolumeSizeText.setTextLimit(20);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    genericVolumeSizeText.setLayoutData(gridData);
    genericVolumeSizeText.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent event) {
            genericVolumeSizeText.addModifyListener(GeneralInfoPage.this);
        }

        public void focusLost(FocusEvent event) {
            genericVolumeSizeText.removeModifyListener(GeneralInfoPage.this);
        }
    });
    Label genericVolumePathLabel = new Label(genericVolumeGroup, SWT.LEFT | SWT.WRAP);
    genericVolumePathLabel.setText(Messages.lblGenericVolPath);
    gridData = new GridData();
    gridData.widthHint = 150;
    genericVolumePathLabel.setLayoutData(gridData);
    genericVolumePathText = new Text(genericVolumeGroup, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    genericVolumePathText.setLayoutData(gridData);
    Button selectDirectoryButton = new Button(genericVolumeGroup, SWT.NONE);
    selectDirectoryButton.setText(Messages.btnBrowse);
    selectDirectoryButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
    selectDirectoryButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            DirectoryDialog dlg = new DirectoryDialog(getShell());
            if (databasePath != null && databasePath.trim().length() > 0) {
                dlg.setFilterPath(databasePath);
            }
            dlg.setText(Messages.msgSelectDir);
            dlg.setMessage(Messages.msgSelectDir);
            String dir = dlg.open();
            if (dir != null) {
                genericVolumePathText.setText(dir);
            }
        }
    });
    ServerInfo serverInfo = server.getServerInfo();
    if (serverInfo != null && !serverInfo.isLocalServer()) {
        selectDirectoryButton.setEnabled(false);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 95 with ServerInfo

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

the class GeneralInfoPage method initial.

private void initial() {
    String[] pageSizeItem = CompatibleUtil.getSupportedPageSize(server.getServerInfo());
    pageSizeCombo.setItems(pageSizeItem);
    pageSizeCombo.setText(CompatibleUtil.getDefaultPageSize(server.getServerInfo()));
    if (logPageSizeCombo != null) {
        logPageSizeCombo.setItems(pageSizeItem);
        logPageSizeCombo.setText(CompatibleUtil.getDefaultPageSize(server.getServerInfo()));
    }
    /*if (charsetCombo != null) {
			charsetCombo.setItems(charsetItem);
			charsetCombo.setText(DEFAULT);
		}*/
    EnvInfo envInfo = server.getServerInfo().getEnvInfo();
    if (envInfo != null) {
        databasePath = envInfo.getDatabaseDir();
        ServerInfo serverInfo = server.getServerInfo();
        if (serverInfo != null) {
            databasePath = FileUtil.changeSeparatorByOS(databasePath, serverInfo.getServerOsInfo());
        }
        genericVolumePathText.setText(databasePath);
        logVolumePathText.setText(databasePath);
    }
    genericVolumeSizeText.setText(ConfConstants.DEFAULT_DATA_VOLUME_SIZE);
    defaultDatVolumeSize = ConfConstants.DEFAULT_DATA_VOLUME_SIZE;
    /*If Configed Generic Volume Size is not null*/
    String genericVolumeSize = CompatibleUtil.getConfigGenericVolumeSize(server.getServerInfo(), null);
    if (!StringUtil.isEmpty(genericVolumeSize)) {
        Long bytes = StringUtil.getByteNumber(genericVolumeSize);
        if (bytes > -1) {
            double value = StringUtil.convertToM(bytes);
            String strValue = getIntSizeString(value, 20);
            genericVolumeSizeText.setText(strValue);
            defaultDatVolumeSize = strValue;
        }
    }
    logVolumeSizeText.setText(ConfConstants.DEFAULT_DATA_VOLUME_SIZE);
    /*If Config Log Volume Size is not null*/
    String logValueSize = CompatibleUtil.getConfigLogVolumeSize(server.getServerInfo(), null);
    if (!StringUtil.isEmpty(logValueSize)) {
        Long bytes = StringUtil.getByteNumber(logValueSize);
        if (bytes > -1) {
            double value = StringUtil.convertToM(bytes);
            logVolumeSizeText.setText(getIntSizeString(value, 20));
        }
    }
    databaseNameText.addModifyListener(this);
    genericVolumePathText.addModifyListener(this);
    logVolumePathText.addModifyListener(this);
}
Also used : ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) EnvInfo(com.cubrid.cubridmanager.core.common.model.EnvInfo)

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