资产展示的测试代码
parent
6f41f53152
commit
91feeae686
|
@ -0,0 +1,23 @@
|
|||
//package com.muyu.source.access.data.base;
|
||||
//
|
||||
///**
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:42
|
||||
// * @ Version:1.0
|
||||
// * @ Description:数据接入抽象类
|
||||
// * @author Lenovo
|
||||
// */
|
||||
//public abstract class BaseDataAbsSource implements BaseDataSource{
|
||||
//
|
||||
// public void setQuery(BaseQuery baseQuery){
|
||||
// BaseQueryHandler.set(baseQuery);
|
||||
// }
|
||||
//
|
||||
// public <T> T getQuery(){
|
||||
// return BaseQueryHandler.get();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -0,0 +1,22 @@
|
|||
//package com.muyu.source.access.data.base;
|
||||
//
|
||||
//import com.muyu.source.core.DataValue;
|
||||
//
|
||||
///**
|
||||
// * @author Lenovo
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:27
|
||||
// * @ Version:1.0
|
||||
// * @ Description:数据源基准
|
||||
// */
|
||||
//public interface BaseDataSource {
|
||||
//
|
||||
// public void setQuery(BaseQuery baseQuery);
|
||||
//
|
||||
// public <T> T getQuery();
|
||||
//
|
||||
// public DataValue getDataValue();
|
||||
// DataValue[] getRow();
|
||||
// DataValue[][] getRows();
|
||||
//}
|
|
@ -0,0 +1,16 @@
|
|||
//package com.muyu.source.access.data.base;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//
|
||||
///**
|
||||
// * @author Lenovo
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:36
|
||||
// * @ Version:1.0
|
||||
// * @ Description:基础查询
|
||||
// */
|
||||
//@Data
|
||||
//public class BaseQuery {
|
||||
//
|
||||
//}
|
|
@ -0,0 +1,24 @@
|
|||
//package com.muyu.source.access.data.base;
|
||||
//
|
||||
///**
|
||||
// * @author Lenovo
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:38
|
||||
// * @ Version:1.0
|
||||
// * @ Description:基础查询
|
||||
// */
|
||||
//public class BaseQueryHandler {
|
||||
//
|
||||
//
|
||||
// private static final ThreadLocal<BaseQuery> BASE_QUERY_THREAD_LOCAL=new ThreadLocal<>();
|
||||
//
|
||||
// public static void set(BaseQuery baseQuery){
|
||||
// BASE_QUERY_THREAD_LOCAL.set(baseQuery);
|
||||
// }
|
||||
//
|
||||
// public static <T> T get(){
|
||||
// return (T)BASE_QUERY_THREAD_LOCAL.get();
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -0,0 +1,31 @@
|
|||
//package com.muyu.source.access.data.mysql;
|
||||
//
|
||||
//import com.muyu.source.access.data.base.BaseDataAbsSource;
|
||||
//import com.muyu.source.core.DataValue;
|
||||
//
|
||||
///**
|
||||
// * @author Lenovo
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:33
|
||||
// * @ Version:1.0
|
||||
// * @ Description:数据源
|
||||
// */
|
||||
//public class MySqlDataSource extends BaseDataAbsSource {
|
||||
//
|
||||
// @Override
|
||||
// public DataValue getDataValue() {
|
||||
// Object query = getQuery();
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DataValue[] getRow() {
|
||||
// return new DataValue[0];
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DataValue[][] getRows() {
|
||||
// return new DataValue[0][];
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,31 @@
|
|||
//package com.muyu.source.access.data.mysql;
|
||||
//
|
||||
//import com.muyu.source.access.data.base.BaseQuery;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Data;
|
||||
//import lombok.EqualsAndHashCode;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//import lombok.experimental.SuperBuilder;
|
||||
//
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @author Lenovo
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:36
|
||||
// * @ Version:1.0
|
||||
// * @ Description:mysql查询
|
||||
// */
|
||||
//
|
||||
//@Data
|
||||
//@SuperBuilder
|
||||
//@AllArgsConstructor
|
||||
//@NoArgsConstructor
|
||||
//@EqualsAndHashCode(callSuper = true)
|
||||
//public class MySqlQuery extends BaseQuery {
|
||||
//
|
||||
// private String sql;
|
||||
//
|
||||
// private Map<String,Object> params;
|
||||
//}
|
|
@ -0,0 +1,29 @@
|
|||
//package com.muyu.source.access.data.redis;
|
||||
//
|
||||
//import com.muyu.source.access.data.base.BaseDataAbsSource;
|
||||
//import com.muyu.source.core.DataValue;
|
||||
//
|
||||
///**
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-30-10:35
|
||||
// * @ Version:1.0
|
||||
// * @ Description:redis
|
||||
// * @author Lenovo
|
||||
// */
|
||||
//public class RedisDataSource extends BaseDataAbsSource {
|
||||
// @Override
|
||||
// public DataValue getDataValue() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DataValue[] getRow() {
|
||||
// return new DataValue[0];
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DataValue[][] getRows() {
|
||||
// return new DataValue[0][];
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.source.core;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-30-10:03
|
||||
* @ Version:1.0
|
||||
* @ Description:数据类型枚举
|
||||
*/
|
||||
public enum DataType {
|
||||
INT("int", Integer.class),
|
||||
BIGINT("bigint", Long.class),
|
||||
DECIMAL("decimal", Double.class),
|
||||
DATE("date", Date.class),
|
||||
TIMESTAMP("timestamp", Date.class),
|
||||
BOOLEAN("boolean", Boolean.class),
|
||||
TEXT("text", String.class),
|
||||
VERCHAR("varchar", String.class);
|
||||
private final String sourceType;
|
||||
private final Class<?> targetType;
|
||||
|
||||
DataType(String sourceType, Class<?> targetType) {
|
||||
this.sourceType = sourceType;
|
||||
this.targetType = targetType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.source.core;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-30-10:01
|
||||
* @ Version:1.0
|
||||
* @ Description:数据值
|
||||
* @author Lenovo
|
||||
*/
|
||||
|
||||
public class DataValue {
|
||||
private String label;
|
||||
private String key;
|
||||
private String value;
|
||||
private String type;
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
package com.muyu.source.pool;//package com.muyu.etl.property.pool;
|
||||
//
|
||||
//import com.muyu.etl.property.domain.EtlDataScore;
|
||||
//import com.muyu.etl.property.pool.exeption.RedisConnException;
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//
|
||||
//import java.util.Queue;
|
||||
//import java.util.concurrent.LinkedBlockingQueue;
|
||||
//import java.util.concurrent.atomic.AtomicInteger;
|
||||
//
|
||||
///**
|
||||
// * @Author:作者姓名
|
||||
// * @Package:com.muyu.etl.property.pool
|
||||
// * @Project:cloud-etl-property
|
||||
// * @name:RedisPool
|
||||
// * @Date:2024/8/26 9:12
|
||||
// */
|
||||
//@Log4j2
|
||||
//public class RedisPool implements BasePool<Jedis>{
|
||||
//
|
||||
// /**
|
||||
// * 空闲队列
|
||||
// */
|
||||
// private Queue<Jedis> jedisBaseConnQueue = null;
|
||||
//
|
||||
// /**
|
||||
// * 活动队列
|
||||
// */
|
||||
// private Queue<Jedis> jedisActiveConnQueue = null;
|
||||
//
|
||||
// /**
|
||||
// * 总连接数
|
||||
// */
|
||||
// private AtomicInteger count=null;
|
||||
//
|
||||
// /**
|
||||
// * redisPoolConfig
|
||||
// */
|
||||
//
|
||||
// private EtlDataScore etlDataScore=null;
|
||||
//
|
||||
// /**
|
||||
// * 实例化
|
||||
// * @param etlDataScore
|
||||
// */
|
||||
// public RedisPool(EtlDataScore etlDataScore) {
|
||||
// log.info("redis连接池实例化完成");
|
||||
// this.etlDataScore = etlDataScore;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void init() {
|
||||
//
|
||||
// Integer maxCount = this.etlDataScore.getMaxCount();
|
||||
//
|
||||
// this.jedisBaseConnQueue = new LinkedBlockingQueue<Jedis>(maxCount);
|
||||
// this.jedisActiveConnQueue = new LinkedBlockingQueue<Jedis>(maxCount);
|
||||
//
|
||||
// this.count = new AtomicInteger();
|
||||
//
|
||||
// Integer initCount = this.etlDataScore.getInitCount();
|
||||
//
|
||||
//
|
||||
// for (Integer i = 0; i < initCount; i++) {
|
||||
// this.jedisBaseConnQueue.offer(createConn());
|
||||
// count.incrementAndGet();
|
||||
// }
|
||||
// log.info("redis连接池初始化完成!");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Jedis getConn() {
|
||||
// long startTime = System.currentTimeMillis();
|
||||
//
|
||||
//
|
||||
// while (true){
|
||||
// Jedis jedis = this.jedisBaseConnQueue.poll();
|
||||
// if (jedis!=null){
|
||||
// this.jedisActiveConnQueue.offer(jedis);
|
||||
// return jedis;
|
||||
// }
|
||||
//
|
||||
// if (count.get()<this.etlDataScore.getMaxCount()){
|
||||
// jedis = createConn();
|
||||
// this.jedisActiveConnQueue.offer(jedis);
|
||||
// count.incrementAndGet();
|
||||
// return jedis;
|
||||
// }
|
||||
//
|
||||
// if (System.currentTimeMillis() -startTime > this.dataSources.getMaxTime()){
|
||||
// throw new RedisConnException("redis获取连接超时!");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void replease(Jedis conn) {
|
||||
// if (this.jedisActiveConnQueue.remove(conn)){
|
||||
// this.jedisBaseConnQueue.offer(conn);
|
||||
// }else {
|
||||
// count.decrementAndGet();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Jedis createConn() {
|
||||
// String ip = this.etlDataScore.getHost();
|
||||
// String port = this.etlDataScore.getPort();
|
||||
// Jedis jedis = new Jedis(ip, Integer.parseInt(port));
|
||||
// log.info("初始化了一个redis的连接,{ip:"+ip+" port:"+port+"}");
|
||||
// return jedis;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void closeConn() {
|
||||
// closeJedisBaseConn();
|
||||
// closeJedisActiveConn();
|
||||
// }
|
||||
//
|
||||
// public void closeJedisBaseConn(){
|
||||
// Jedis jedis = this.jedisBaseConnQueue.poll();
|
||||
//
|
||||
// if (jedis!=null){
|
||||
// try {
|
||||
// jedis.close();
|
||||
// } catch (Exception e) {
|
||||
// if (!jedis.isConnected()){
|
||||
// this.jedisBaseConnQueue.offer(jedis);
|
||||
// }
|
||||
// throw new RuntimeException(e);
|
||||
// }finally {
|
||||
// closeJedisBaseConn();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public void closeJedisActiveConn(){
|
||||
// Jedis jedis = this.jedisActiveConnQueue.poll();
|
||||
//
|
||||
// if (jedis!=null){
|
||||
// try {
|
||||
// jedis.close();
|
||||
// } catch (Exception e) {
|
||||
// if (!jedis.isConnected()){
|
||||
// this.jedisActiveConnQueue.offer(jedis);
|
||||
// }
|
||||
// throw new RuntimeException(e);
|
||||
// }finally {
|
||||
// closeJedisActiveConn();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
Loading…
Reference in New Issue