|
43 | 43 | import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.tools.CamelTools;
|
44 | 44 | import org.minbox.framework.api.boot.maven.plugin.mybatis.enhance.codegen.writer.JavaClassWriter;
|
45 | 45 | import org.minbox.framework.ssh.agent.AgentConnection;
|
46 |
| -import org.minbox.framework.ssh.agent.DefaultAgentConnection; |
| 46 | +import org.minbox.framework.ssh.agent.AgentSupport; |
| 47 | +import org.minbox.framework.ssh.agent.apache.ApacheMinaSshdAgentConnection; |
| 48 | +import org.minbox.framework.ssh.agent.config.AgentConfig; |
47 | 49 | import org.springframework.util.ObjectUtils;
|
48 | 50 | import org.springframework.util.StringUtils;
|
49 | 51 |
|
@@ -171,6 +173,11 @@ public class ApiBootMybatisEnhanceCodegen extends AbstractMojo {
|
171 | 173 | */
|
172 | 174 | @Parameter
|
173 | 175 | private boolean enableSshProxy = false;
|
| 176 | + /** |
| 177 | + * ssh代理连接方式,默认为Apache Mina |
| 178 | + */ |
| 179 | + @Parameter |
| 180 | + private AgentSupport sshProxySupport = AgentSupport.mina; |
174 | 181 | /**
|
175 | 182 | * Ssh Proxy代理参数设置
|
176 | 183 | */
|
@@ -211,7 +218,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
211 | 218 | getLog().info("The entity class corresponding to the " + tableNames.size() + " tables will be generated,and the table name list: " +
|
212 | 219 | JSON.toJSONString(tableNames));
|
213 | 220 | }
|
214 |
| - tableNames.stream().forEach(tableName -> { |
| 221 | + tableNames.forEach(tableName -> { |
215 | 222 | LocalDateTime startGetInfoTime = LocalDateTime.now();
|
216 | 223 | // get table
|
217 | 224 | Table table = dataBase.getTable(tableName);
|
@@ -297,7 +304,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
297 | 304 | private AgentConnection startingSshProxy(SshProxySetting setting) {
|
298 | 305 | AgentConnection connection = null;
|
299 | 306 | try {
|
300 |
| - connection = new DefaultAgentConnection(setting); |
| 307 | + this.sshProxySupport = this.sshProxySupport == null ? AgentSupport.mina : this.sshProxySupport; |
| 308 | + connection = (AgentConnection) Class.forName(this.sshProxySupport.getClassName()).getDeclaredConstructor(AgentConfig.class).newInstance(setting); |
301 | 309 | connection.connect();
|
302 | 310 | } catch (Exception e) {
|
303 | 311 | getLog().error("SSH Connection:" + setting.getServerIp() + ":" + setting.getForwardTargetPort() + ",try agent failure.", e);
|
|
0 commit comments