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);
}
}
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;
}
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();
}
}
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);
}
}
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);
}
Aggregations