Browse Source
* commit 'fdf29340a770451dd8bcb527a070a3facd6ed707': KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 KERNEL-418 更新升级重构 KERNEL-418 更新升级重构research/11.0
Bryant
5 years ago
7 changed files with 121 additions and 134 deletions
@ -0,0 +1,79 @@
|
||||
package com.fr.design.update.actions; |
||||
|
||||
import com.fr.decision.update.backup.Recover; |
||||
import com.fr.decision.update.data.UpdateConstants; |
||||
import com.fr.decision.update.exception.UpdateException; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.CommonUtils; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
import com.fr.workspace.WorkContext; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author Bryant |
||||
* @version 10.0 |
||||
* Created by Bryant on 2019-10-09 |
||||
*/ |
||||
public class RecoverForDesigner implements Recover { |
||||
|
||||
@Override |
||||
public boolean recover() { |
||||
try{ |
||||
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH), |
||||
StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME)); |
||||
return true; |
||||
} catch (IOException ignore) { |
||||
FineLoggerFactory.getLogger().error("Recover error for designer"); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean backup() { |
||||
String installHome = StableUtils.getInstallHome(); |
||||
//jar包备份文件的目录为"backup/"+jar包当前版本号
|
||||
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO())); |
||||
backupFilesFromInstallEnv(todayBackupDir); |
||||
backupFilesFromInstallLib(installHome, todayBackupDir); |
||||
try { |
||||
File file = new File(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOADPATH)); |
||||
CommonUtils.mkdirs(file); |
||||
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(installHome, UpdateConstants.DESIGNERBACKUPPATH)); |
||||
return true; |
||||
}catch (IOException e) { |
||||
UpdateException exception = new UpdateException("Backup Exception for designer" + e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage(),exception); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
private void backupFilesFromInstallEnv(String todayBackupDir) { |
||||
try { |
||||
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH))); |
||||
IOUtils.copyFilesInDirByPath( |
||||
StableUtils.pathJoin(WorkContext.getCurrent().getPath(),ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH)); |
||||
} catch (IOException e) { |
||||
UpdateException exception = new UpdateException(e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in env failed"); |
||||
} |
||||
} |
||||
|
||||
private void backupFilesFromInstallLib(String installHome, String todayBackupDir) { |
||||
try { |
||||
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH))); |
||||
IOUtils.copyFilesInDirByPath( |
||||
StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME), |
||||
StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH)); |
||||
} catch (IOException e) { |
||||
UpdateException exception = new UpdateException(e.getMessage()); |
||||
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in install failed"); |
||||
} |
||||
} |
||||
} |
@ -1,56 +0,0 @@
|
||||
package com.fr.design.update.domain; |
||||
|
||||
/** |
||||
* Created by XINZAI on 2018/8/21. |
||||
*/ |
||||
|
||||
|
||||
import java.awt.Color; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 更新升级的常量 |
||||
*/ |
||||
public interface UpdateConstants { |
||||
|
||||
String APPS_FOLDER_NAME = "webapps"; |
||||
|
||||
int CONNECTION_TIMEOUT = 1000 * 5; |
||||
Color BAR_COLOR = new Color(0x3384F0); |
||||
|
||||
String CHANGELOG_X_START = "2018-07-11"; |
||||
|
||||
String DEFAULT_APP_NAME = "FineReport"; |
||||
String DESIGNER_BACKUP_DIR = "designerbackup"; |
||||
|
||||
String UPDATE_CACHE_CONFIG_X = "updateCacheConfig10"; |
||||
String UPDATE_CACHE_INFO_X = "updateCacheInfo10"; |
||||
|
||||
String JXBROWSER = "jxbrowser"; |
||||
|
||||
List<String> JARS_FOR_SERVER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"fine-activator-10.0.jar", |
||||
"fine-core-10.0.jar", |
||||
"fine-report-engine-10.0.jar", |
||||
"fine-decision-10.0.jar", |
||||
"fine-decision-report-10.0.jar", |
||||
"fine-schedule-10.0.jar", |
||||
"fine-schedule-report-10.0.jar", |
||||
"fine-swift-log-adaptor-10.0.jar", |
||||
"fine-webui-10.0.jar", |
||||
"fine-datasource-10.0.jar", |
||||
"fine-third-10.0.jar", |
||||
"fine-accumulator-10.0.jar" |
||||
})); |
||||
|
||||
List<String> JARS_FOR_DESIGNER_X = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"fine-report-designer-10.0.jar", |
||||
"aspectjrt.jar" |
||||
})); |
||||
List<String> LOG_TYPE = Collections.unmodifiableList(Arrays.asList(new String[]{ |
||||
"REPORT", "MOBILE", "CHART", "PFC", "BI" |
||||
})); |
||||
|
||||
} |
Loading…
Reference in new issue