use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.
the class StopBrokerEnvAction method run.
/**
* Override the run method in order to complete stopping broker environment
*/
public void run() {
if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
return;
}
final Object[] obj = this.getSelectedObj();
CubridBrokerFolder selection = (CubridBrokerFolder) obj[0];
if (null == selection) {
return;
}
ServerInfo serverInfo = selection.getServer().getServerInfo();
StopBrokerEnvTask task = new StopBrokerEnvTask(serverInfo);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopBrokerEnvTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
selection.setRunning(false);
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, selection);
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.
the class VolumeSizeValidator method createVolumeGroup.
/**
*
* Create volume group area
*
* @param parent the parent composite
*/
private void createVolumeGroup(Composite parent) {
Group volumeGroup = new Group(parent, SWT.NONE);
volumeGroup.setText(Messages.grpAddtionalVolInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
volumeGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
volumeGroup.setLayout(layout);
Label volumeNameLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeNameLabel.setText(Messages.lblVolName);
volumeNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeNameText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeNameText.setLayoutData(gridData);
volumeNameText.setEditable(false);
Label volumePathLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumePathLabel.setText(Messages.lblVolPath);
volumePathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumePathText = new Text(volumeGroup, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
volumePathText.setLayoutData(gridData);
Button selectDirectoryButton = new Button(volumeGroup, 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) {
volumePathText.setText(dir);
}
}
});
ServerInfo serverInfo = server.getServerInfo();
if (serverInfo != null && !serverInfo.isLocalServer()) {
selectDirectoryButton.setEnabled(false);
}
Label volumeTypeLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
volumeTypeLabel.setText(Messages.lblVolType);
volumeTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeTypeCombo = new Combo(volumeGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeTypeCombo.setLayoutData(gridData);
volumeTypeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
changeVolumeName();
}
});
Label sizeOfPageLabel = new Label(volumeGroup, SWT.LEFT | SWT.WRAP);
sizeOfPageLabel.setText(Messages.lblVolSize);
sizeOfPageLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
volumeSizeText = new Text(volumeGroup, SWT.BORDER);
volumeSizeText.setTextLimit(20);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
volumeSizeText.setLayoutData(gridData);
volumeSizeText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent event) {
volumeSizeText.addModifyListener(VolumeInfoPage.this);
}
public void focusLost(FocusEvent event) {
volumeSizeText.removeModifyListener(VolumeInfoPage.this);
}
});
}
use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.
the class VolumeSizeValidator method initial.
private void initial() {
volumeTypeCombo.setItems(VOLUME_TYPES);
volumeTypeCombo.select(0);
EnvInfo envInfo = server.getServerInfo().getEnvInfo();
if (envInfo != null) {
databasePath = envInfo.getDatabaseDir();
ServerInfo serverInfo = server.getServerInfo();
if (serverInfo != null) {
databasePath = FileUtil.changeSeparatorByOS(databasePath, serverInfo.getServerOsInfo());
}
}
volumeNameText.addModifyListener(this);
volumePathText.addModifyListener(this);
}
use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.
the class LoginDatabaseTaskExecutor method exec.
/**
* Execute to login database
*
* @param monitor the IProgressMonitor
* @return <code>true</code> if successful;<code>false</code>otherwise;
*/
public boolean exec(final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return false;
}
String taskName = Messages.bind(Messages.loginDbTaskName, dbName);
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
DbUserInfo dbUserInfo = null;
DatabaseInfo dbInfo = serverInfo.getLoginedUserInfo().getDatabaseInfo(dbName);
DbUserInfo preDbUserInfo = dbInfo.getAuthLoginedDbUserInfo();
boolean isOldLogined = dbInfo.isLogined();
for (ITask task : taskList) {
if (task instanceof UpdateCMUserTask) {
UpdateCMUserTask updateCMUserTask = (UpdateCMUserTask) task;
ServerInfo serverInfo = dbInfo.getServerInfo();
if (serverInfo != null && serverInfo.isConnected()) {
ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
updateCMUserTask.setCasAuth(userInfo.getCasAuth().getText());
updateCMUserTask.setDbCreator(userInfo.getDbCreateAuthType().getText());
updateCMUserTask.setStatusMonitorAuth(userInfo.getStatusMonitorAuth().getText());
List<String> dbNameList = new ArrayList<String>();
List<String> dbUserList = new ArrayList<String>();
List<String> dbPasswordList = new ArrayList<String>();
List<String> dbBrokerPortList = new ArrayList<String>();
List<DatabaseInfo> authDatabaseList = userInfo.getDatabaseInfoList();
for (int i = 0; authDatabaseList != null && i < authDatabaseList.size(); i++) {
DatabaseInfo databaseInfo = authDatabaseList.get(i);
dbNameList.add(databaseInfo.getDbName());
dbUserList.add(databaseInfo.getAuthLoginedDbUserInfo().getName());
dbBrokerPortList.add(QueryOptions.getBrokerIp(databaseInfo) + "," + databaseInfo.getBrokerPort());
String password = databaseInfo.getAuthLoginedDbUserInfo().getNoEncryptPassword();
dbPasswordList.add(password == null ? "" : password);
}
String[] dbNameArr = new String[dbNameList.size()];
String[] dbUserArr = new String[dbUserList.size()];
String[] dbPasswordArr = new String[dbPasswordList.size()];
String[] dbBrokerPortArr = new String[dbBrokerPortList.size()];
updateCMUserTask.setDbAuth(dbNameList.toArray(dbNameArr), dbUserList.toArray(dbUserArr), dbPasswordList.toArray(dbPasswordArr), dbBrokerPortList.toArray(dbBrokerPortArr));
}
}
task.execute();
final String msg = task.getErrorMsg();
if (showErrMsg) {
if (openErrorBox(shell, msg, monitor)) {
dbInfo.setLogined(isOldLogined);
dbInfo.setAuthLoginedDbUserInfo(preDbUserInfo);
// LOGGER.error("loggin failed task : " + infoMessage);
return false;
}
} else if (!monitor.isCanceled()) {
setErrMsg(msg);
dbInfo.setLogined(isOldLogined);
dbInfo.setAuthLoginedDbUserInfo(preDbUserInfo);
return false;
}
if (monitor.isCanceled()) {
return false;
}
if (task instanceof LoginDatabaseTask) {
dbUserInfo = ((LoginDatabaseTask) task).getLoginedDbUserInfo();
dbInfo.setLogined(true);
dbUserInfo.setNoEncryptPassword(dbPassword);
dbInfo.setAuthLoginedDbUserInfo(dbUserInfo);
}
}
return true;
}
use of com.cubrid.cubridmanager.core.common.model.ServerInfo in project cubrid-manager by CUBRID.
the class EditQueryPlanDialog method getConnection.
private Connection getConnection() throws SQLException {
// Can Check UserInfo
if (canCheckConnection()) {
String dbName = database.getDatabaseInfo().getDbName();
ServerInfo serverInfo = database.getDatabaseInfo().getServerInfo();
String brokerIP = database.getDatabaseInfo().getBrokerIP();
String brokerPort = database.getDatabaseInfo().getBrokerPort();
String charset = database.getDatabaseInfo().getCharSet();
String driverVersion = serverInfo.getJdbcDriverVersion();
String jdbcAttrs = database.getDatabaseInfo().getJdbcAttrs();
boolean isShard = database.getDatabaseInfo().isShard();
String userName = userText.getText();
String password = pwdTxt.getText();
return JDBCConnectionManager.getConnection(brokerIP, brokerPort, dbName, userName, password, charset, jdbcAttrs, driverVersion, false, isShard);
} else {
return JDBCConnectionManager.getConnection(database.getDatabaseInfo(), false);
}
}
Aggregations