Browse Source

REPORT-42550 注册RPC接口

feature/big-screen
kerry 4 years ago
parent
commit
d00625eee6
  1. 1
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 49
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  3. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

1
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -126,7 +126,6 @@ public class EnvChangeEntrance {
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
DesignUtils.checkDesignerEnvMatch();
DesignTableDataManager.fireDSChanged(new HashMap<String, String>());
if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray

49
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -6,7 +6,6 @@ import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
@ -16,19 +15,20 @@ import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.predefined.PredefinedStyleOperator;
import org.jetbrains.annotations.NotNull;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
@ -69,6 +69,16 @@ public class DesignUtils {
private static boolean designerEnvMatch = true;
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
designerEnvMatch = checkDesignerEnvMatch();
}
});
}
private DesignUtils() {
}
@ -429,26 +439,17 @@ public class DesignUtils {
return true;
}
/**
* check下设计器jar包版本和当前envjar包版本是否匹配设计器启动后和环境切换成功后调用
*/
public static void checkDesignerEnvMatch(){
if (WorkContext.getCurrent().isLocal()){
designerEnvMatch = true;
return;
}
String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
DesignerWorkspaceInfo selectedEnv = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (Exception e) {
designerEnvMatch = false;
return;
public static boolean checkDesignerEnvMatch() {
if (WorkContext.getCurrent().isLocal()) {
return true;
}
designerEnvMatch = localBranch.contains("#") && localBranch.equals(remoteBranch);
return WorkContext.getCurrent().get(PredefinedStyleOperator.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
FineLoggerFactory.getLogger().error(exceptionInfo.getException().getMessage(), exceptionInfo.getException());
return false;
}
}).allowPredefinedSetting();
}
}

2
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -6,7 +6,6 @@ import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -60,7 +59,6 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
} else {
WorkContext.switchTo(workspace);
DesignUtils.checkDesignerEnvMatch();
//在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可
final DesignerWorkspaceInfo selectEnv = workspaceInfo;
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {

Loading…
Cancel
Save