Browse Source

Merge pull request #103 in DESIGN/design from ~ABEL.CHEN/design:feature/10.0 to feature/10.0

* commit 'dd08160aef03ab2daee1684a68f0fdba4d20f5e3':
  设计器监听服务端配置修改
master
superman 7 years ago
parent
commit
1537a8cc90
  1. 14
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

14
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.loghandler.socketio; package com.fr.design.mainframe.loghandler.socketio;
import com.fr.config.ConfigEvent;
import com.fr.config.Configuration;
import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvConstants; import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext; import com.fr.core.env.EnvContext;
@ -79,6 +81,18 @@ public class DesignerSocketIO {
socketIO = Optional.of(IO.socket(new URI(uri))); socketIO = Optional.of(IO.socket(new URI(uri)));
socketIO.get().on(EnvConstants.WS_LOGRECORD, printLog); socketIO.get().on(EnvConstants.WS_LOGRECORD, printLog);
socketIO.get().on(EnvConstants.CONFIG, new Emitter.Listener() {
@Override
public void call(Object... objects) {
if (objects == null || objects.length != 1) {
throw new IllegalArgumentException("config should have only one param");
}
Object param = objects[0];
if (param instanceof Class) {
EventDispatcher.fire(ConfigEvent.EDIT, (Class<? extends Configuration>) param);
}
}
});
socketIO.get().connect(); socketIO.get().connect();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save