Browse Source

Merge pull request #917 in DESIGN/design from ~ZACK/design:feature/10.0 to feature/10.0

* commit '2a74a9103b20a4561c06757f666762a00b8dfa1d':
  依赖
  代码规范
  移包
  REPORT-15183 设计器sdk模块
research/10.0
zack 6 years ago
parent
commit
c0829555b0
  1. 1
      designer-form/build.form.gradle
  2. 5
      designer-sdk/.gitignore
  3. 26
      designer-sdk/pom.xml
  4. 80
      designer-sdk/src/main/java/com/fr/sdk/designer/FineDesignUtils.java
  5. 7
      designer-sdk/src/test/java/com/fr/sdk/FineDesignUtilsTest.java
  6. 1
      pom.xml

1
designer-form/build.form.gradle

@ -41,6 +41,7 @@ ant{
mkdir(dir:"src/main/java")
move(todir:"src/main/java"){
fileset(dir:"../designer-realize/src",includes:"com/**")
fileset(dir:"../designer-sdk/src",includes:"com/**")
fileset(dir:"src",includes:"com/**")
}
}

5
designer-sdk/.gitignore vendored

@ -0,0 +1,5 @@
*.iml
.idea/
.DS_Store
.classpath
.project

26
designer-sdk/pom.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fr.report</groupId>
<artifactId>design</artifactId>
<version>10.0</version>
</parent>
<groupId>com.fr.report</groupId>
<artifactId>designer-sdk</artifactId>
<version>10.0</version>
<dependencies>
<dependency>
<groupId>com.fr.report</groupId>
<artifactId>designer-realize</artifactId>
<version>10.0</version>
</dependency>
<dependency>
<groupId>com.fr.report</groupId>
<artifactId>sdk-base</artifactId>
<version>10.0</version>
</dependency>
</dependencies>
</project>

80
designer-sdk/src/main/java/com/fr/sdk/designer/FineDesignUtils.java

@ -0,0 +1,80 @@
package com.fr.sdk.designer;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.RestrictionActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.sdk.server.shell.ModuleShell;
import com.fr.serialization.SerializationActivator;
import com.fr.stable.StringUtils;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
/**
* 设计器SDK模块工具类用来放一些设计器相关插件开发过程中常用的工具函数
*/
public class FineDesignUtils {
/**
* 创建一个连接远程服务器的模块
* @param remoteUrl 远程服务器地址
* @param username 用户名
* @param password 密码
* @return 模块代理对象 使用ModuleShell的start和stop控制模块启停
*/
public static ModuleShell createRemoteServerModule(String remoteUrl, String username, String password) {
return createRemoteServerModule(remoteUrl, username, password, StringUtils.EMPTY, StringUtils.EMPTY);
}
/**
* 创建一个连接远程服务器的模块
* @param remoteUrl 远程服务器地址
* @param username 用户名
* @param password 密码
* @param certPath https证书路径
* @param certSecretKey 证书秘钥
* @return 模块代理对象 使用ModuleShell的start和stop控制模块启停
*/
public static ModuleShell createRemoteServerModule(final String remoteUrl, final String username, final String password, final String certPath, final String certSecretKey) {
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new SerializationActivator(),
new Activator() {
@Override
public void start() {
WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo(remoteUrl, username, password, certPath, certSecretKey);
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(RemoteDesignerWorkspaceInfo.create(connectionInfo)));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(),e);
}
}
@Override
public void stop() {
}
},
new ConfigurationActivator(),
new StateServerActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister()
);
return new ModuleShell(module);
}
}

7
designer-sdk/src/test/java/com/fr/sdk/FineDesignUtilsTest.java

@ -0,0 +1,7 @@
package com.fr.sdk;
import junit.framework.TestCase;
public class FineDesignUtilsTest extends TestCase {
}

1
pom.xml

@ -16,6 +16,7 @@
<module>designer-chart</module>
<module>designer-form</module>
<module>designer-realize</module>
<module>designer-sdk</module>
</modules>
<groupId>com.fr.report</groupId>
<artifactId>design</artifactId>

Loading…
Cancel
Save