From 8c195cc5a2f26d1996b01fc36fbb7f85c220d5c2 Mon Sep 17 00:00:00 2001 From: hengboy Date: Tue, 28 May 2024 10:14:26 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=8F=92=E4=BB=B6=E6=94=AF=E6=8C=81=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=ACssh-agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api-boot-mybatis-enhance-maven-codegen/pom.xml | 1 + .../codegen/ApiBootMybatisEnhanceCodegen.java | 14 +++++++++++--- .../api-boot-starter-ssh-agent/pom.xml | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/pom.xml b/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/pom.xml index 086d9fe..e89b2ec 100644 --- a/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/pom.xml +++ b/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/pom.xml @@ -75,6 +75,7 @@ org.minbox.framework ssh-agent + ${ssh-agent.version} true diff --git a/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/src/main/java/org/minbox/framework/api/boot/maven/plugin/mybatis/enhance/codegen/ApiBootMybatisEnhanceCodegen.java b/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/src/main/java/org/minbox/framework/api/boot/maven/plugin/mybatis/enhance/codegen/ApiBootMybatisEnhanceCodegen.java index 32fae6b..4278560 100644 --- a/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/src/main/java/org/minbox/framework/api/boot/maven/plugin/mybatis/enhance/codegen/ApiBootMybatisEnhanceCodegen.java +++ b/api-boot-project/api-boot-maven-plugins/api-boot-mybatis-enhance-maven-codegen/src/main/java/org/minbox/framework/api/boot/maven/plugin/mybatis/enhance/codegen/ApiBootMybatisEnhanceCodegen.java @@ -43,7 +43,9 @@ import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.tools.CamelTools; import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.writer.JavaClassWriter; import org.minbox.framework.ssh.agent.AgentConnection; -import org.minbox.framework.ssh.agent.DefaultAgentConnection; +import org.minbox.framework.ssh.agent.AgentSupport; +import org.minbox.framework.ssh.agent.apache.ApacheMinaSshdAgentConnection; +import org.minbox.framework.ssh.agent.config.AgentConfig; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -171,6 +173,11 @@ public class ApiBootMybatisEnhanceCodegen extends AbstractMojo { */ @Parameter private boolean enableSshProxy = false; + /** + * ssh代理连接方式,默认为Apache Mina + */ + @Parameter + private AgentSupport sshProxySupport = AgentSupport.mina; /** * Ssh Proxy代理参数设置 */ @@ -211,7 +218,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("The entity class corresponding to the " + tableNames.size() + " tables will be generated,and the table name list: " + JSON.toJSONString(tableNames)); } - tableNames.stream().forEach(tableName -> { + tableNames.forEach(tableName -> { LocalDateTime startGetInfoTime = LocalDateTime.now(); // get table Table table = dataBase.getTable(tableName); @@ -297,7 +304,8 @@ public void execute() throws MojoExecutionException, MojoFailureException { private AgentConnection startingSshProxy(SshProxySetting setting) { AgentConnection connection = null; try { - connection = new DefaultAgentConnection(setting); + this.sshProxySupport = this.sshProxySupport == null ? AgentSupport.mina : this.sshProxySupport; + connection = (AgentConnection) Class.forName(this.sshProxySupport.getClassName()).getDeclaredConstructor(AgentConfig.class).newInstance(setting); connection.connect(); } catch (Exception e) { getLog().error("SSH Connection:" + setting.getServerIp() + ":" + setting.getForwardTargetPort() + ",try agent failure.", e); diff --git a/api-boot-project/api-boot-starters/api-boot-starter-ssh-agent/pom.xml b/api-boot-project/api-boot-starters/api-boot-starter-ssh-agent/pom.xml index a4d4715..db42439 100644 --- a/api-boot-project/api-boot-starters/api-boot-starter-ssh-agent/pom.xml +++ b/api-boot-project/api-boot-starters/api-boot-starter-ssh-agent/pom.xml @@ -34,6 +34,7 @@ org.minbox.framework ssh-agent + ${ssh-agent.version}