use of com.cubrid.cubridmanager.core.cubrid.serial.task.GetSerialInfoListTask in project cubrid-manager by CUBRID.
the class ExportSchemaThread method exportSerial.
/**
* exportSerial
*
* @param serialFilePath
* @throws Exception
*/
private void exportSerial(String serialFilePath) throws Exception {
// FIXME move this logic to core module
BufferedWriter fs = null;
boolean hasSerial = false;
File serialFile = null;
try {
fs = FileUtil.getBufferedWriter(serialFilePath, exportConfig.getFileCharset());
if (exportConfig.isExportSerial()) {
GetSerialInfoListTask task = new GetSerialInfoListTask(dbInfo);
task.execute();
for (SerialInfo serial : task.getSerialInfoList()) {
fs.write(createSerialSQLScript(serial, dbInfo));
fs.write(StringUtil.NEWLINE);
hasSerial = true;
}
fs.flush();
}
} finally {
try {
if (fs != null) {
fs.close();
}
} catch (IOException e) {
LOGGER.error("", e);
}
if (!hasSerial) {
if (serialFile != null) {
serialFile.delete();
}
}
}
}
use of com.cubrid.cubridmanager.core.cubrid.serial.task.GetSerialInfoListTask in project cubrid-manager by CUBRID.
the class CubridSerialFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setSerialInfoList(null);
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetSerialInfoListTask task = new GetSerialInfoListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
List<SerialInfo> serialInfoList = task.getSerialInfoList();
List<SerialInfo> authSerialInfoList = new ArrayList<SerialInfo>();
if (serialInfoList != null && !serialInfoList.isEmpty()) {
for (SerialInfo serialInfo : serialInfoList) {
authSerialInfoList.add(serialInfo);
String id = parent.getId() + NODE_SEPARATOR + serialInfo.getName();
ICubridNode serialNode = createSerialNode(id, serialInfo);
parent.addChild(serialNode);
}
}
databaseInfo.setSerialInfoList(authSerialInfoList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.cubridmanager.core.cubrid.serial.task.GetSerialInfoListTask in project cubrid-manager by CUBRID.
the class OpenSerialDetailInfoPartProgress method run.
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final GetSerialInfoListTask task = new GetSerialInfoListTask(database.getDatabaseInfo());
task.execute();
if (!(task.isSuccess())) {
LOGGER.error(task.getErrorMsg());
return;
}
serialList = task.getSerialInfoList();
success = true;
}
Aggregations