Skip to content

Commit 7eaf6f5

Browse files
authored
Merge pull request #34 from aliyun/feature/release-v1.1.7
Feature/release v1.1.7
2 parents 47052c6 + a0f2297 commit 7eaf6f5

File tree

540 files changed

+42825
-6503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+42825
-6503
lines changed

README_zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ MigrationX 是一款基于 FlowSpec 规范的工作流迁移工具,它可以
429429

430430
## 整体架构
431431

432-
![image](docs/images/architecture.jpg)
432+
![image](docs/images/architecture-cn.jpg)
433433

434434
### 领域模型
435435

client/migrationx-common/pom.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@
2222
<parent>
2323
<artifactId>migrationx</artifactId>
2424
<groupId>com.aliyun.dataworks</groupId>
25-
<version>1.1.5</version>
25+
<version>1.1.7-1</version>
26+
<relativePath>../pom.xml</relativePath>
2627
</parent>
2728

2829
<artifactId>migrationx-common</artifactId>
29-
<version>1.1.5</version>
3030

31-
<properties>
32-
<maven.compiler.source>8</maven.compiler.source>
33-
<maven.compiler.target>8</maven.compiler.target>
34-
</properties>
3531

3632
<dependencies>
3733
<dependency>
@@ -42,13 +38,9 @@
4238
<groupId>com.google.guava</groupId>
4339
<artifactId>guava</artifactId>
4440
</dependency>
45-
<dependency>
46-
<groupId>org.apache.tomcat.embed</groupId>
47-
<artifactId>tomcat-embed-core</artifactId>
48-
</dependency>
4941
<dependency>
5042
<groupId>org.springframework</groupId>
51-
<artifactId>spring-web</artifactId>
43+
<artifactId>spring-core</artifactId>
5244
</dependency>
5345
<dependency>
5446
<groupId>org.hibernate.validator</groupId>
@@ -95,6 +87,18 @@
9587
<groupId>org.apache.commons</groupId>
9688
<artifactId>commons-lang3</artifactId>
9789
</dependency>
90+
<dependency>
91+
<groupId>com.fasterxml.jackson.core</groupId>
92+
<artifactId>jackson-core</artifactId>
93+
</dependency>
94+
<dependency>
95+
<groupId>com.fasterxml.jackson.core</groupId>
96+
<artifactId>jackson-annotations</artifactId>
97+
</dependency>
98+
<dependency>
99+
<groupId>com.fasterxml.jackson.core</groupId>
100+
<artifactId>jackson-databind</artifactId>
101+
</dependency>
98102
</dependencies>
99103

100104
<build>

client/migrationx-common/src/main/java/com/aliyun/migrationx/common/command/appbase/CommandAppEntrance.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,27 @@
1515

1616
package com.aliyun.migrationx.common.command.appbase;
1717

18+
import java.io.File;
19+
import java.io.IOException;
20+
import java.nio.charset.StandardCharsets;
21+
import java.util.Map;
22+
1823
import com.aliyun.migrationx.common.exception.BizException;
1924
import com.aliyun.migrationx.common.exception.ErrorCode;
2025
import com.aliyun.migrationx.common.utils.GsonUtils;
26+
2127
import com.google.common.base.Joiner;
2228
import com.google.gson.reflect.TypeToken;
2329
import lombok.extern.slf4j.Slf4j;
24-
import org.apache.commons.cli.*;
30+
import org.apache.commons.cli.CommandLine;
31+
import org.apache.commons.cli.CommandLineParser;
32+
import org.apache.commons.cli.DefaultParser;
33+
import org.apache.commons.cli.HelpFormatter;
34+
import org.apache.commons.cli.Options;
35+
import org.apache.commons.cli.ParseException;
2536
import org.apache.commons.collections4.MapUtils;
2637
import org.apache.commons.io.FileUtils;
2738

28-
import java.io.File;
29-
import java.io.IOException;
30-
import java.nio.charset.StandardCharsets;
31-
import java.util.Map;
32-
3339
/**
3440
* @author 聿剑
3541
* @date 2022/10/20
@@ -85,10 +91,10 @@ private static Map<AppType, Map<String, AppMeta>> loadApps(String conf) throws I
8591
appMeta.setName(appName);
8692
appMeta.setType(appType);
8793
log.info("register command app type: {}, name: {}, class: {}", appType, appName, appMeta.getAppClass());
88-
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>)Class.forName(appMeta.getAppClass()));
94+
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>) Class.forName(appMeta.getAppClass()));
8995
} catch (ClassNotFoundException e) {
9096
log.info("register command app failed, appType: {}, appName: {}, class: {}, error: {}",
91-
appType, appName, appMeta.getAppClass(), e.getMessage());
97+
appType, appName, appMeta.getAppClass(), e);
9298
}
9399
}));
94100

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.aliyun.migrationx.common.context;
2+
3+
import java.io.File;
4+
import java.io.FileNotFoundException;
5+
6+
import com.aliyun.migrationx.common.metrics.DolphinMetricsCollector;
7+
import com.aliyun.migrationx.common.metrics.MetricsCollector;
8+
import com.aliyun.migrationx.common.metrics.enums.CollectorType;
9+
10+
import org.apache.commons.lang3.StringUtils;
11+
12+
public class TransformerContext {
13+
private static final ThreadLocal<TransformerContext> threadLocal = new ThreadLocal<>();
14+
15+
private MetricsCollector metricsCollector;
16+
17+
private File checkpoint;
18+
private File load;
19+
20+
public File getCheckpoint() {
21+
return checkpoint;
22+
}
23+
24+
public void setCheckpoint(String checkpoint) throws FileNotFoundException {
25+
if (StringUtils.isNotEmpty(checkpoint)) {
26+
File file = new File(checkpoint);
27+
if (file.exists()) {
28+
this.checkpoint = file;
29+
} else {
30+
throw new FileNotFoundException(checkpoint);
31+
}
32+
}
33+
}
34+
35+
public File getLoad() {
36+
return load;
37+
}
38+
39+
public void setLoad(String load) throws FileNotFoundException {
40+
if (StringUtils.isNotEmpty(load)) {
41+
File file = new File(load);
42+
if (file.exists()) {
43+
this.load = file;
44+
} else {
45+
throw new FileNotFoundException(load);
46+
}
47+
}
48+
}
49+
50+
private TransformerContext() {
51+
}
52+
53+
public static void init(CollectorType type) {
54+
TransformerContext context = new TransformerContext();
55+
switch (type) {
56+
case DolphinScheduler:
57+
context.metricsCollector = new DolphinMetricsCollector();
58+
break;
59+
default:
60+
throw new UnsupportedOperationException(type.name());
61+
}
62+
threadLocal.set(context);
63+
}
64+
65+
public static TransformerContext getContext() {
66+
return threadLocal.get();
67+
}
68+
69+
public static MetricsCollector getCollector() {
70+
return threadLocal.get().metricsCollector;
71+
}
72+
73+
public static void clear() {
74+
threadLocal.remove();
75+
}
76+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.aliyun.migrationx.common.exception;
2+
3+
public class UnSupportedTypeException extends RuntimeException {
4+
private String type;
5+
6+
public UnSupportedTypeException(String type) {
7+
super("unsupported converter task type: " + type);
8+
this.type = type;
9+
}
10+
}

0 commit comments

Comments
 (0)