use of com.cubrid.cubridmanager.core.cubrid.database.model.ParamDumpInfo in project cubrid-manager by CUBRID.
the class ParamDumpTask method getContent.
/**
* get result from the response.
*
* @return LogContentInfo
*/
public ParamDumpInfo getContent() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
ParamDumpInfo paramDumpInfo = new ParamDumpInfo();
String dbName = response.getValue("dbname");
paramDumpInfo.setDbName(dbName);
int pos1 = 0;
int pos2 = 0;
for (int i = 0; i < response.childrenSize(); i++) {
TreeNode node = response.getChildren().get(i);
if (node != null && node.getValue("open") != null && node.getValue("open").equals("client")) {
paramDumpInfo.setClientData(node.getValueByMap());
paramDumpInfo.getClientData().remove("service");
pos1 = node.getValues("service")[0].lastIndexOf(":");
pos2 = node.getValues("service")[1].lastIndexOf(":");
paramDumpInfo.addClientData("service" + node.getValues("service")[0].substring(0, pos1), node.getValues("service")[0].substring(pos1 + 1));
paramDumpInfo.addClientData("service" + node.getValues("service")[1].substring(0, pos2), node.getValues("service")[1].substring(pos2 + 1));
}
if (node != null && node.getValue("open") != null && node.getValue("open").equals("server")) {
paramDumpInfo.setServerData(node.getValueByMap());
paramDumpInfo.getServerData().remove("service");
pos1 = node.getValues("service")[0].lastIndexOf(":");
pos2 = node.getValues("service")[1].lastIndexOf(":");
paramDumpInfo.addServerData("service" + node.getValues("service")[0].substring(0, pos1), node.getValues("service")[0].substring(pos1 + 1));
paramDumpInfo.addServerData("service" + node.getValues("service")[1].substring(0, pos2), node.getValues("service")[1].substring(pos2 + 1));
}
}
return paramDumpInfo;
}
use of com.cubrid.cubridmanager.core.cubrid.database.model.ParamDumpInfo in project cubrid-manager by CUBRID.
the class CubridDatabaseLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(final ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = (CubridDatabase) parent;
database.getDatabaseInfo().clear();
if (!database.isLogined()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
//when refresh,firstly check whether this database exist
ServerInfo serverInfo = parent.getServer().getServerInfo();
final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
ParamDumpTask paramDumpTask = null;
if (CompatibleUtil.isSupportGetParamDump(serverInfo)) {
paramDumpTask = new ParamDumpTask(serverInfo);
paramDumpTask.setDbName(database.getLabel());
paramDumpTask.setBoth(YesNoType.N);
}
monitorCancel(monitor, new ITask[] { getDatabaseListTask, paramDumpTask });
getDatabaseListTask.execute();
if (!checkResult(getDatabaseListTask, monitor)) {
parent.removeAllChild();
return;
}
List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
ParamDumpInfo paraDumpInfo = null;
if (paramDumpTask != null) {
paramDumpTask.execute();
if (!checkResult(paramDumpTask, monitor)) {
parent.removeAllChild();
return;
}
paraDumpInfo = paramDumpTask.getContent();
}
String databaseName = database.getLabel();
boolean isExist = false;
for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
DatabaseInfo dbInfo = databaseInfoList.get(i);
if (dbInfo.getDbName().equalsIgnoreCase(databaseName)) {
database.setRunningType(dbInfo.getRunningType());
isExist = true;
}
}
if (!isExist) {
Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(Messages.errDatabaseNoExist);
CubridNavigatorView navigatorView = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
TreeViewer treeViewer = navigatorView == null ? null : navigatorView.getViewer();
if (treeViewer != null) {
CommonUITool.refreshNavigatorTree(treeViewer, parent.getParent());
}
}
});
setLoaded(true);
return;
}
if (!loadReplication(parent, monitor)) {
setLoaded(true);
return;
}
// add tables folder
addTableFolder(monitor, database);
// add views folder
addViewFolder(monitor, database);
// add serials folder
addSerialFolder(monitor, database);
// add user folder
addUserFolder(monitor, database);
// add triggers folder
addTriggerFolder(monitor, database);
// add stored procedure folder
addProcedureFolder(monitor, database);
// add job automation folder
addJobAutoFolder(monitor, database);
// add database space folder
addSpaceFolder(monitor, database);
// set parameter dump information
database.getDatabaseInfo().setParaDumpInfo(paraDumpInfo);
// set charset info
setDbCollation(database);
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.core.cubrid.database.model.ParamDumpInfo in project cubrid-manager by CUBRID.
the class ParamDumpDialog method completeAll.
/**
* @see com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor#completeAll()
*/
public void completeAll() {
ParamDumpInfo result = (ParamDumpInfo) task.getContent();
ParamDumpResultDialog paramDumpResultDialog = new ParamDumpResultDialog(getShell());
paramDumpResultDialog.setResult(result);
paramDumpResultDialog.setClientItem(repairButton.getSelection());
paramDumpResultDialog.open();
}
Aggregations