Skip to content

Commit

Permalink
Merge pull request #34 from aliyun/feature/release-v1.1.7
Browse files Browse the repository at this point in the history
Feature/release v1.1.7
  • Loading branch information
Garfier authored Sep 4, 2024
2 parents 47052c6 + a0f2297 commit 7eaf6f5
Show file tree
Hide file tree
Showing 540 changed files with 42,825 additions and 6,503 deletions.
2 changes: 1 addition & 1 deletion README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ MigrationX 是一款基于 FlowSpec 规范的工作流迁移工具,它可以

## 整体架构

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

### 领域模型

Expand Down
26 changes: 15 additions & 11 deletions client/migrationx-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
<parent>
<artifactId>migrationx</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.5</version>
<version>1.1.7-1</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>migrationx-common</artifactId>
<version>1.1.5</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
Expand All @@ -42,13 +38,9 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
Expand Down Expand Up @@ -95,6 +87,18 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@

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

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;

import com.aliyun.migrationx.common.exception.BizException;
import com.aliyun.migrationx.common.exception.ErrorCode;
import com.aliyun.migrationx.common.utils.GsonUtils;

import com.google.common.base.Joiner;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.cli.*;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
* @author 聿剑
* @date 2022/10/20
Expand Down Expand Up @@ -85,10 +91,10 @@ private static Map<AppType, Map<String, AppMeta>> loadApps(String conf) throws I
appMeta.setName(appName);
appMeta.setType(appType);
log.info("register command app type: {}, name: {}, class: {}", appType, appName, appMeta.getAppClass());
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>)Class.forName(appMeta.getAppClass()));
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>) Class.forName(appMeta.getAppClass()));
} catch (ClassNotFoundException e) {
log.info("register command app failed, appType: {}, appName: {}, class: {}, error: {}",
appType, appName, appMeta.getAppClass(), e.getMessage());
appType, appName, appMeta.getAppClass(), e);
}
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.aliyun.migrationx.common.context;

import java.io.File;
import java.io.FileNotFoundException;

import com.aliyun.migrationx.common.metrics.DolphinMetricsCollector;
import com.aliyun.migrationx.common.metrics.MetricsCollector;
import com.aliyun.migrationx.common.metrics.enums.CollectorType;

import org.apache.commons.lang3.StringUtils;

public class TransformerContext {
private static final ThreadLocal<TransformerContext> threadLocal = new ThreadLocal<>();

private MetricsCollector metricsCollector;

private File checkpoint;
private File load;

public File getCheckpoint() {
return checkpoint;
}

public void setCheckpoint(String checkpoint) throws FileNotFoundException {
if (StringUtils.isNotEmpty(checkpoint)) {
File file = new File(checkpoint);
if (file.exists()) {
this.checkpoint = file;
} else {
throw new FileNotFoundException(checkpoint);
}
}
}

public File getLoad() {
return load;
}

public void setLoad(String load) throws FileNotFoundException {
if (StringUtils.isNotEmpty(load)) {
File file = new File(load);
if (file.exists()) {
this.load = file;
} else {
throw new FileNotFoundException(load);
}
}
}

private TransformerContext() {
}

public static void init(CollectorType type) {
TransformerContext context = new TransformerContext();
switch (type) {
case DolphinScheduler:
context.metricsCollector = new DolphinMetricsCollector();
break;
default:
throw new UnsupportedOperationException(type.name());
}
threadLocal.set(context);
}

public static TransformerContext getContext() {
return threadLocal.get();
}

public static MetricsCollector getCollector() {
return threadLocal.get().metricsCollector;
}

public static void clear() {
threadLocal.remove();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.aliyun.migrationx.common.exception;

public class UnSupportedTypeException extends RuntimeException {
private String type;

public UnSupportedTypeException(String type) {
super("unsupported converter task type: " + type);
this.type = type;
}
}
Loading

0 comments on commit 7eaf6f5

Please sign in to comment.