use of com.cubrid.cubridmanager.core.cubrid.database.task.ParamDumpTask 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.task.ParamDumpTask in project cubrid-manager by CUBRID.
the class ParamDumpDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
task = new ParamDumpTask(database.getServer().getServerInfo());
task.setDbName(database.getName());
task.setBoth(repairButton.getSelection() ? YesNoType.Y : YesNoType.N);
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.titleParamDumpDialog + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
}
super.buttonPressed(buttonId);
}
Aggregations