master
zhang chengzhi 2024-09-10 08:52:33 +08:00
parent 4d86154f8c
commit c26b0a3284
12 changed files with 0 additions and 192 deletions

Binary file not shown.

View File

@ -1,24 +0,0 @@
package com.muyu.etl.basic;
import com.muyu.etl.domain.DataValue;
public interface DataValueBasic extends TaskBasic{
/**
*
* @return
*/
public DataValue getDataStructure();
/**
*
* @return
*/
public DataValue[] getRow();
/**
*
* @return
*/
public DataValue[][] getRows();
}

Binary file not shown.

View File

@ -1,11 +0,0 @@
package com.muyu.etl.basic;
import com.muyu.etl.scope.TaskScopeBasic;
import com.muyu.etl.scope.TaskScopeConfig;
public interface TaskBasic {
public default TaskScopeConfig getScopeConfig(){
return TaskScopeBasic.get();
}
}

Binary file not shown.

View File

@ -1,30 +0,0 @@
package com.muyu.etl.domain;
import com.muyu.etl.enums.DataType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DataValue {
/**
*
*/
private String key;
/**
*
*/
private DataType type;
/**
*
*/
private String label;
/**
*
*/
private Object value;
}

Binary file not shown.

View File

@ -1,73 +0,0 @@
package com.muyu.etl.enums;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Authorzhangzhihao
* @nameDataType
* @Date2024/8/28 18:38
*
*/
public enum DataType {
VARCHAR("varchar",String.class,"String"),
BIGINT("bigint", Long.class,"Long"),
INT("int", Integer.class,"Integer"),
DECIMAL("decimal", BigDecimal.class,"BigDecimal"),
DATETIME("datetime", Date.class,"Date"),
TEXT("text", String.class,"String"),
DOUBLE("double", Double.class,"Double");
private final String sourceType;
private final Class<?> targetType;
private final String javaType;
public String getSourceType() {
return sourceType;
}
public Class<?> getTargetType() {
return targetType;
}
public String getJavaType() {
return javaType;
}
public static Class convertType(String type){
for (DataType dataType : DataType.values()) {
if (dataType.sourceType.equalsIgnoreCase(type)){
return dataType.targetType;
}
}
return String.class;
}
public static DataType findBySqlType(String sqlType){
for (DataType dataType : DataType.values()) {
if (dataType.getSourceType().equalsIgnoreCase(sqlType)){
return dataType;
}
}
return VARCHAR;
}
public static String convertTypeString(String type){
for (DataType dataType : DataType.values()) {
if (dataType.sourceType.equalsIgnoreCase(type)){
return dataType.javaType;
}
}
return "String";
}
DataType(String sourceType, Class<?> targetType, String javaType) {
this.sourceType = sourceType;
this.targetType = targetType;
this.javaType = javaType;
}
}

Binary file not shown.

View File

@ -1,18 +0,0 @@
package com.muyu.etl.scope;
public class TaskScopeBasic {
private static final ThreadLocal<TaskScopeConfig> localScope = new ThreadLocal<>();
public static void set(final TaskScopeConfig handler) {
localScope.set(handler);
}
public static TaskScopeConfig get() {
return localScope.get();
}
public static void remove(){
localScope.remove();
}
}

Binary file not shown.

View File

@ -1,36 +0,0 @@
package com.muyu.etl.scope;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.concurrent.LinkedBlockingDeque;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaskScopeConfig {
/**
* ID
*/
private String taskId;
private LinkedBlockingDeque taskNodeQueue = new LinkedBlockingDeque();
public void addTaskNode(Object obj){
this.taskNodeQueue.add(obj);
}
public boolean hashTaskNodeNext(){
return !taskNodeQueue.isEmpty();
}
private <T> T nextTaskNode(){
return (T) taskNodeQueue.poll();
}
}