Yvan
4 years ago
13 changed files with 208 additions and 72 deletions
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器生命周期接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/26 |
||||
*/ |
||||
public interface DesignerLifecycleMonitor { |
||||
|
||||
String MARK_STRING = "DesignerLifecycleMonitor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 设计器启动之前 |
||||
*/ |
||||
void beforeStart(); |
||||
|
||||
/** |
||||
* 设计器启动完成 界面出现之后 |
||||
*/ |
||||
void afterStart(); |
||||
|
||||
/** |
||||
* 设计器关闭退出之前 |
||||
*/ |
||||
void beforeStop(); |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器所有端口获取 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/18 |
||||
*/ |
||||
public interface DesignerPortProvider { |
||||
|
||||
String MARK_STRING = "DesignerPortProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
|
||||
/** |
||||
* 设计器自身端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int messagePort(); |
||||
|
||||
/** |
||||
* 内置服务器端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int embeddedServerPort(); |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.monitor; |
||||
|
||||
import com.fr.design.fun.DesignerLifecycleMonitor; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/27 |
||||
*/ |
||||
public class DesignerLifecycleMonitorContext { |
||||
|
||||
private static DesignerLifecycleMonitor monitor; |
||||
|
||||
static { |
||||
DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class); |
||||
if (designerLifecycleMonitor != null) { |
||||
monitor = designerLifecycleMonitor; |
||||
} else { |
||||
monitor = new EmptyDesignerLifecycleMonitor(); |
||||
} |
||||
} |
||||
|
||||
public static DesignerLifecycleMonitor getMonitor() { |
||||
return monitor; |
||||
} |
||||
|
||||
static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor { |
||||
|
||||
@Override |
||||
public void beforeStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop() { |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.port; |
||||
|
||||
import com.fr.design.fun.DesignerPortProvider; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/27 |
||||
*/ |
||||
public class DesignerPortContext { |
||||
|
||||
private static int messagePort = -1; |
||||
|
||||
private static int embeddedServerPort = -1; |
||||
|
||||
static { |
||||
DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); |
||||
if (designerPortProvider != null) { |
||||
messagePort = designerPortProvider.messagePort(); |
||||
embeddedServerPort = designerPortProvider.embeddedServerPort(); |
||||
} |
||||
} |
||||
|
||||
public static int getMessagePort() { |
||||
return messagePort; |
||||
} |
||||
|
||||
public static int getEmbeddedServerPort() { |
||||
return embeddedServerPort; |
||||
} |
||||
} |
Loading…
Reference in new issue