code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
package zack.gateway.center.domain.operation.model.vo;
/**
* @author zack
* @description 应用服务 VO
*/
public class ApplicationSystemDataVO {
/** 系统标识 */
private String systemId;
/** 系统名称 */
private String systemName;
/** 系统类型;RPC、HTTP*/
private String systemType;
/** 注册中心;zookeeper://... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/model/vo/ApplicationSystemDataVO.java | Java | mit | 1,295 |
package zack.gateway.center.domain.operation.model.vo;
import java.util.Date;
/**
* @author zack
* @description 网关分配
*/
public class GatewayDistributionDataVO {
/** 自增主键 */
private Integer id;
/** 分组标识 */
private String groupId;
/** 网关标识 */
private String gatewayId;
/** 系统标识 */
... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/model/vo/GatewayDistributionDataVO.java | Java | mit | 1,818 |
package zack.gateway.center.domain.operation.model.vo;
/**
* @author zack
* @description 网关服务
*/
public class GatewayServerDataVO {
/** 自增主键 */
private Integer id;
/** 分组标识 */
private String groupId;
/** 分组名称 */
private String groupName;
public Integer getId() {
return id;
... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/model/vo/GatewayServerDataVO.java | Java | mit | 734 |
package zack.gateway.center.domain.operation.model.vo;
import java.util.Date;
/**
* @author zack
* @description 网关服务明细
*/
public class GatewayServerDetaiDatalVO {
/** 自增ID */
private Integer id;
/** 分组标识 */
private String groupId;
/** 网关标识 */
private String gatewayId;
/** 网关名称 */
... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/model/vo/GatewayServerDetaiDatalVO.java | Java | mit | 2,064 |
package zack.gateway.center.domain.operation.repository;
import zack.gateway.center.domain.operation.model.vo.*;
import zack.gateway.center.infrastructure.common.OperationRequest;
import java.util.List;
/**
* @author zack
* @description 运营数据查询仓储服务
*/
public interface IDataOperationManageRepository {
List... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/repository/IDataOperationManageRepository.java | Java | mit | 1,682 |
package zack.gateway.center.domain.operation.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import zack.gateway.center.application.IDataOperationManageService;
import zack.gateway.center.domain.operation.model.vo.*;
import zack.gateway.center.domain.op... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/operation/service/DataOperationManageService.java | Java | mit | 3,210 |
package zack.gateway.center.domain.register.model.vo;
/**
* @author zack
* @description 接口方法 VO
*/
public class ApplicationInterfaceMethodVO {
/** 系统标识 */
private String systemId;
/** 接口标识 */
private String interfaceId;
/** 方法标识 */
private String methodId;
/** 方法名称 */
private St... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/register/model/vo/ApplicationInterfaceMethodVO.java | Java | mit | 2,048 |
package zack.gateway.center.domain.register.model.vo;
/**
* @author zack
* @description 应用接口 VO
*/
public class ApplicationInterfaceVO {
/** 系统标识 */
private String systemId;
/** 接口标识 */
private String interfaceId;
/** 接口名称 */
private String interfaceName;
/** 接口版本 */
private Str... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/register/model/vo/ApplicationInterfaceVO.java | Java | mit | 1,097 |
package zack.gateway.center.domain.register.model.vo;
/**
* @author zack
* @description 应用服务 VO
*/
public class ApplicationSystemVO {
/** 系统标识 */
private String systemId;
/** 系统名称 */
private String systemName;
/** 系统类型;RPC、HTTP*/
private String systemType;
/** 注册中心;zookeeper://127.0... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/register/model/vo/ApplicationSystemVO.java | Java | mit | 1,092 |
package zack.gateway.center.domain.register.repository;
import zack.gateway.center.domain.register.model.vo.ApplicationInterfaceMethodVO;
import zack.gateway.center.domain.register.model.vo.ApplicationInterfaceVO;
import zack.gateway.center.domain.register.model.vo.ApplicationSystemVO;
/**
* @author zack
* @desc... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/register/repository/IRegisterManageRepository.java | Java | mit | 671 |
package zack.gateway.center.domain.register.service;
import org.springframework.stereotype.Service;
import zack.gateway.center.application.IRegisterManageService;
import zack.gateway.center.domain.register.model.vo.ApplicationInterfaceMethodVO;
import zack.gateway.center.domain.register.model.vo.ApplicationInterface... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/register/service/IRegisterManageServiceImpl.java | Java | mit | 1,353 |
/**
* @description 应用管理
* @author zack
*/
package zack.gateway.center.domain.utilize; | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/domain/utilize/package-info.java | Java | mit | 100 |
package zack.gateway.center.infrastructure.common;
/**
* @author zack
* @description 基础信息
*/
public class Constants {
public static final class GatewayStatus {
// 0;不可用
public static final Integer NotAvailable = 0;
// 1; 可使用
public static final Integer Available = 1;
}
... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/common/Constants.java | Java | mit | 344 |
package zack.gateway.center.infrastructure.common;
import org.apache.commons.lang3.StringUtils;
public class OperationRequest<T> {
private int pageStart = 0; //开始 limit 第一个参数
private int pageEnd = 0; //结束 limit 第二个参数
private int pageIndex; //页数
private int pageSize; //行数
private T data... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/common/OperationRequest.java | Java | mit | 2,144 |
package zack.gateway.center.infrastructure.common;
import java.util.List;
public class OperationResult<T> {
private int pageTotal;
private List<T> list;
public OperationResult() {
}
public OperationResult(int pageTotal, List<T> list) {
this.pageTotal = pageTotal;
this.list = li... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/common/OperationResult.java | Java | mit | 619 |
package zack.gateway.center.infrastructure.common;
/**
* @author zack
* @description 错误码
*/
public enum ResponseCode {
SUCCESS("0000", "成功"),
UN_ERROR("0001", "未知失败"),
ILLEGAL_PARAMETER("0002", "非法参数"),
INDEX_DUP("0003", "主键冲突"),
NO_UPDATE("0004", "SQL操作无更新");
private String code;
... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/common/ResponseCode.java | Java | mit | 608 |
package zack.gateway.center.infrastructure.common;
import com.alibaba.fastjson.JSON;
import java.io.Serializable;
/**
* @author zack
* @description 统一返回对象中,Code码、Info描述
*/
public class Result<T> implements Serializable {
private static final long serialVersionUID = -3826891916021780628L;
private Stri... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/common/Result.java | Java | mit | 801 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.domain.operation.model.vo.ApplicationInterfaceDataVO;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.po.ApplicationInterface;
import zac... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IApplicationInterfaceDao.java | Java | mit | 1,069 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.domain.manage.repository.InterfaceKey;
import zack.gateway.center.domain.operation.model.vo.ApplicationInterfaceMethodDataVO;
import zack.gateway.center.infrastructure.common.OperationRequest;
impor... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IApplicationInterfaceMethodDao.java | Java | mit | 1,084 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.domain.operation.model.vo.ApplicationSystemDataVO;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.po.ApplicationSystem;
import java.uti... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IApplicationSystemDao.java | Java | mit | 875 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.domain.operation.model.vo.GatewayDistributionDataVO;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.po.GatewayDistribution;
import java.... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IGatewayDistributionDao.java | Java | mit | 865 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.po.GatewayServer;
import java.util.List;
/**
* @author zack
* @description
*/
@Mapper
public interface IGat... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IGatewayServerDao.java | Java | mit | 560 |
package zack.gateway.center.infrastructure.dao;
import org.apache.ibatis.annotations.Mapper;
import zack.gateway.center.domain.operation.model.vo.GatewayServerDetaiDatalVO;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.po.GatewayServerDetail;
import java... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/dao/IGatewayServerDetailDao.java | Java | mit | 946 |
package zack.gateway.center.infrastructure.po;
import java.util.Date;
/**
* @author zack
* @description 应用接口
*/
public class ApplicationInterface {
/** 自增ID */
private Integer id;
/** 系统标识 */
private String systemId;
/** 接口标识 */
private String interfaceId;
/** 接口名称 */
private S... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/ApplicationInterface.java | Java | mit | 1,703 |
package zack.gateway.center.infrastructure.po;
import java.util.Date;
/**
* @author zack
* @description 应用接口方法
*/
public class ApplicationInterfaceMethod {
/** 自增ID */
private Integer id;
/** 系统标识 */
private String systemId;
/** 接口标识 */
private String interfaceId;
/** 方法标识 */
p... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/ApplicationInterfaceMethod.java | Java | mit | 2,660 |
package zack.gateway.center.infrastructure.po;
import java.util.Date;
/**
* @author zack
* @description 应用系统
*/
public class ApplicationSystem {
/** 自增ID */
private Integer id;
/** 系统标识 */
private String systemId;
/** 系统名称 */
private String systemName;
/** 系统类型;RPC、HTTP*/
priva... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/ApplicationSystem.java | Java | mit | 1,698 |
package zack.gateway.center.infrastructure.po;
import java.util.Date;
/**
* @author zack
* @description 网关分配
*/
public class GatewayDistribution {
/** 自增主键 */
private Integer id;
/** 分组标识 */
private String groupId;
/** 网关标识 */
private String gatewayId;
/** 系统标识 */
private Strin... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/GatewayDistribution.java | Java | mit | 1,608 |
package zack.gateway.center.infrastructure.po;
/**
* @author zack
* @description 网关服务
*/
public class GatewayServer {
/** 自增主键 */
private Integer id;
/** 分组标识 */
private String groupId;
/** 分组名称 */
private String groupName;
public Integer getId() {
return id;
}
pub... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/GatewayServer.java | Java | mit | 720 |
package zack.gateway.center.infrastructure.po;
import java.util.Date;
/**
* @author zack
* @description 网关服务明细
*/
public class GatewayServerDetail {
/** 自增ID */
private Integer id;
/** 分组标识 */
private String groupId;
/** 网关标识 */
private String gatewayId;
/** 网关名称 */
private Str... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/po/GatewayServerDetail.java | Java | mit | 1,855 |
package zack.gateway.center.infrastructure.repository;
import org.springframework.stereotype.Component;
import zack.gateway.center.domain.manage.model.vo.GatewayServerDetailVO;
import zack.gateway.center.domain.manage.model.vo.GatewayServerVO;
import zack.gateway.center.domain.manage.repository.IConfigManageReposito... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/repository/ConfigManageRepository.java | Java | mit | 10,670 |
package zack.gateway.center.infrastructure.repository;
import zack.gateway.center.domain.operation.model.vo.*;
import zack.gateway.center.domain.operation.repository.IDataOperationManageRepository;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.dao.*;
impor... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/repository/DataOperationManageRepository.java | Java | mit | 9,714 |
package zack.gateway.center.infrastructure.repository;
import org.springframework.stereotype.Component;
import zack.gateway.center.domain.register.model.vo.ApplicationInterfaceMethodVO;
import zack.gateway.center.domain.register.model.vo.ApplicationInterfaceVO;
import zack.gateway.center.domain.register.model.vo.Appli... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/infrastructure/repository/RegisterManageRepository.java | Java | mit | 3,480 |
package zack.gateway.center.interfaces;
import zack.gateway.center.application.IDataOperationManageService;
import zack.gateway.center.domain.operation.model.vo.*;
import zack.gateway.center.infrastructure.common.OperationRequest;
import zack.gateway.center.infrastructure.common.OperationResult;
import com.alibaba.fas... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/interfaces/DataOperationManage.java | Java | mit | 8,834 |
package zack.gateway.center.interfaces;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.*;
import zack.gateway.center.application.IConfigManageService;
import zack.gateway.center.application.ILoadBalancingSer... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/interfaces/GatewayConfigManage.java | Java | mit | 7,765 |
package zack.gateway.center.interfaces;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
imp... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/interfaces/LoadBalancingMange.java | Java | mit | 2,390 |
package zack.gateway.center.interfaces;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotati... | 2301_82000044/my-api-gateway | my-api-gateway-center/src/main/java/zack/gateway/center/interfaces/RpcRegisterManage.java | Java | mit | 7,617 |
docker run -p 8001:8001 \
-v /mnt/c/javaData/git_test/my-api-gateway-center/docs/data/nginx:/data/nginx \
-v /var/run/docker.sock:/var/run/docker.sock \
--name api-gateway-center \
-d \
my-api-gateway-center:1.0 CP4-LISTEN:8001,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock TCP4-LISTEN:8001,fork,reuseaddr UNIX-C... | 2301_82000044/my-api-gateway | my-api-gateway-center/start.sh | Shell | mit | 348 |
package zack.gateway.core.authorization;
import io.jsonwebtoken.Claims;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.Autho... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/authorization/GatewayAuthorizingRealm.java | Java | mit | 1,415 |
package zack.gateway.core.authorization;
import org.apache.shiro.authc.AuthenticationToken;
/** 网关认证token
* @author A1793
*/
public class GatewayAuthorizingToken implements AuthenticationToken {
private static final long serialVersionUID = 1L;
private String uid;
private String jwt;
public Gateway... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/authorization/GatewayAuthorizingToken.java | Java | mit | 816 |
package zack.gateway.core.authorization;
/**认证服务接口
* @author A1793
*/
public interface IAuth {
public boolean validate(String id,String token);
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/authorization/IAuth.java | Java | mit | 166 |
package zack.gateway.core.authorization;
import com.alibaba.fastjson2.JSON;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author A1793
*/
public ... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/authorization/JwtUtil.java | Java | mit | 1,478 |
package zack.gateway.core.authorization.auth;
import zack.gateway.core.authorization.GatewayAuthorizingToken;
import zack.gateway.core.authorization.IAuth;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.config.IniSecurityManagerFactory;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shi... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/authorization/auth/AuthService.java | Java | mit | 1,119 |
package zack.gateway.core.bind;
import zack.gateway.core.executor.result.SessionResult;
import java.util.Map;
/**统一泛化调用接口
* @author A1793
*/
public interface IGenericReference {
public SessionResult $invoke(Map<String,Object> args);
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/bind/IGenericReference.java | Java | mit | 262 |
package zack.gateway.core.bind;
import zack.gateway.core.mapping.HttpCommandType;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySession;
import java.lang.reflect.Method;
import java.util.Map;
/**绑定映射方法,最底层走session会话,session中调用rpc服务
* @author A1793
*/
public class MapperMet... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/bind/MapperMethod.java | Java | mit | 1,242 |
package zack.gateway.core.bind;
import zack.gateway.core.session.GatewaySession;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;
import java.util.Map;
/**映射代理
* @author A1793
*/
public class MapperProxy implements MethodInterceptor {
private... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/bind/MapperProxy.java | Java | mit | 812 |
package zack.gateway.core.bind;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.session.GatewaySession;
import net.sf.cglib.core.Signature;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.InterfaceMaker;
import org.objectweb.asm.Type;
import java.util.HashMap;
import java.util.M... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/bind/MapperProxyFactory.java | Java | mit | 1,397 |
package zack.gateway.core.bind;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySession;
import java.util.HashMap;
import java.util.Map;
/**泛化调用注册机,一个uri对应一个代理工厂
* @author A1793
*/
public class MapperRegistry {
private Conf... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/bind/MapperRegistry.java | Java | mit | 1,438 |
package zack.gateway.core.datasource;
/**连接
* @author A1793
*/
public interface Connection {
Object execute(String methodName,String[] parameterTypes,String[] parameterNames, Object[] args) ;
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/Connection.java | Java | mit | 206 |
package zack.gateway.core.datasource;
/**数据源(可以是rpc泛化调用,也是其他的数据源)
* @author A1793
*/
public interface DataSource {
Connection getConnection();
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/DataSource.java | Java | mit | 194 |
package zack.gateway.core.datasource;
import zack.gateway.core.session.Configuration;
/**数据源工厂
* @author A1793
*/
public interface DataSourceFactory {
public void setProperties(Configuration configuration,String uri);
DataSource getDataSource();
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/DataSourceFactory.java | Java | mit | 272 |
package zack.gateway.core.datasource;
/**数据源类型
* @author A1793
*/
public enum DataSourceType {
DUBBO,
HTTP;
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/DataSourceType.java | Java | mit | 133 |
package zack.gateway.core.datasource.connection;
import zack.gateway.core.datasource.Connection;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.du... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/connection/DubboConnection.java | Java | mit | 1,254 |
package zack.gateway.core.datasource.connection;
import zack.gateway.core.datasource.Connection;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
/**封装http的POST请求
* @author A1793
*/
public class HTTPConnection implements Connection {
HttpClient httpClie... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/connection/HTTPConnection.java | Java | mit | 1,566 |
package zack.gateway.core.datasource.unpooled;
import zack.gateway.core.datasource.Connection;
import zack.gateway.core.datasource.DataSource;
import zack.gateway.core.datasource.DataSourceType;
import zack.gateway.core.datasource.connection.DubboConnection;
import zack.gateway.core.mapping.HttpStatement;
import zack.... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/unpooled/UnpooledDataSource.java | Java | mit | 1,826 |
package zack.gateway.core.datasource.unpooled;
import zack.gateway.core.datasource.DataSource;
import zack.gateway.core.datasource.DataSourceFactory;
import zack.gateway.core.datasource.DataSourceType;
import zack.gateway.core.session.Configuration;
/**默认网关会话工厂,创建session
* @author A1793
*/
public class UnpooledData... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/datasource/unpooled/UnpooledDataSourceFactory.java | Java | mit | 893 |
package zack.gateway.core.executor;
import zack.gateway.core.datasource.Connection;
import zack.gateway.core.executor.result.SessionResult;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.type.SimpleTypeRegistry;
import org.slf4j.Logger;
import o... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/executor/BaseExecutor.java | Java | mit | 1,624 |
package zack.gateway.core.executor;
import zack.gateway.core.executor.result.SessionResult;
import zack.gateway.core.mapping.HttpStatement;
import java.util.Map;
/**执行器,负责rpc连接,将rpc泛化调用与网关会话抽离
* @author A1793
*/
public interface Executor {
public SessionResult exec(HttpStatement httpStatement, Map<String,Obje... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/executor/Executor.java | Java | mit | 381 |
package zack.gateway.core.executor;
import zack.gateway.core.datasource.Connection;
import zack.gateway.core.session.Configuration;
/**
* @author A1793
*/
public class SimpleExecutor extends BaseExecutor {
public SimpleExecutor(Connection connection,Configuration configuration) {
super(connection,config... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/executor/SimpleExecutor.java | Java | mit | 545 |
package zack.gateway.core.executor.result;
/**执行结构
* @author A1793
*/
public class SessionResult {
private String code;
private String info;
private Object data;
public SessionResult(String code, String info, Object data) {
this.code = code;
this.info = info;
this.data = dat... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/executor/result/SessionResult.java | Java | mit | 983 |
package zack.gateway.core.mapping;
/**http请求类型
* @author A1793
*/
public enum HttpCommandType {
UNKNOWN,
GET,
POST,
PUT,
DELETE;
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/mapping/HttpCommandType.java | Java | mit | 163 |
package zack.gateway.core.mapping;
/**网关接口映射信息
* @author A1793
*/
public class HttpStatement {
/** 应用名称; */
private String application;
/** 服务接口;RPC、其他 */
private String interfaceName;
/** 服务方法;RPC#method */
private String methodName;
/** 参数类型(RPC 限定单参数注册);new String[]{"java.lang.String"}... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/mapping/HttpStatement.java | Java | mit | 1,644 |
package zack.gateway.core.session;
import zack.gateway.core.authorization.IAuth;
import zack.gateway.core.authorization.auth.AuthService;
import zack.gateway.core.bind.IGenericReference;
import zack.gateway.core.bind.MapperRegistry;
import zack.gateway.core.datasource.Connection;
import zack.gateway.core.executor.Exec... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/session/Configuration.java | Java | mit | 7,928 |
package zack.gateway.core.session;
import zack.gateway.core.bind.IGenericReference;
import java.util.Map;
/**用户处理http请求
* @author A1793
*/
public interface GatewaySession {
//http的get请求转为rpc
Object get(String methodName, Map<String,Object> parameter);
//http的post请求转为rpc
Object post(String methodNam... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/session/GatewaySession.java | Java | mit | 463 |
package zack.gateway.core.session;
import java.util.concurrent.ExecutionException;
/**泛化调用会话工厂接口
* @author A1793
*/
public interface GatewaySessionFactory {
public GatewaySession openSession(String uri) throws ExecutionException, InterruptedException;
}
| 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/session/GatewaySessionFactory.java | Java | mit | 283 |
package zack.gateway.core.session.defaults;
import zack.gateway.core.bind.IGenericReference;
import zack.gateway.core.executor.Executor;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySession;
import java.util.Map;
/**默认网关会话实现类,... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/session/defaults/DefaultGatewaySession.java | Java | mit | 1,566 |
package zack.gateway.core.session.defaults;
import zack.gateway.core.datasource.DataSource;
import zack.gateway.core.datasource.unpooled.UnpooledDataSourceFactory;
import zack.gateway.core.executor.Executor;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySession;
import zack.ga... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/session/defaults/DefaultGatewaySessionFactory.java | Java | mit | 1,520 |
package zack.gateway.core.socket;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.concurrent.ExecutionException;
/**会话基类
* @author A1793
*/
public abstract class BaseHandler<T> extends SimpleChannelInboundHandler<... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/BaseHandler.java | Java | mit | 689 |
package zack.gateway.core.socket;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySessionFactory;
import zack.gateway.core.session.defaults.DefaultGatewaySessionFactory;
import zack.gateway.core.socket.handlers.AuthorizationHandler;
import zack.gateway.core.socket.handlers.Gate... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/GatewayChannelInitializer.java | Java | mit | 1,797 |
package zack.gateway.core.socket;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.session.GatewaySessionFactory;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.Eve... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/GatewaySocketServer.java | Java | mit | 2,615 |
package zack.gateway.core.socket.agreement;
import zack.gateway.core.mapping.HttpStatement;
import io.netty.util.AttributeKey;
/**协议参数常量
* @author A1793
*/
public class AgreementConstants {
//AttributeKey是 Netty 提供的用于在Channel或ChannelHandlerContext上绑定自定义属性的工具类。
// 通过它可以在 Channel 的生命周期内存储和读取数据,实现不同 Handler 之间... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/agreement/AgreementConstants.java | Java | mit | 2,222 |
package zack.gateway.core.socket.agreement;
/**网关结果消息
* @author A1793
*/
public class GatewayResultMessage {
String code;
String info;
String node;
Object data;
public GatewayResultMessage(String code, String info, Object data) {
this.code = code;
this.info = info;
this.... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/agreement/GatewayResultMessage.java | Java | mit | 994 |
package zack.gateway.core.socket.agreement;
import com.alibaba.fastjson2.JSON;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.handler.codec.http.multipart.Attribute... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/agreement/RequestParser.java | Java | mit | 3,318 |
package zack.gateway.core.socket.agreement;
import com.alibaba.fastjson.JSON;
import io.netty.handler.codec.http.*;
/**响应结果封装
* @author A1793
*/
public class ResponseParser {
public DefaultFullHttpResponse parse(Object result) {
// 返回信息处理
DefaultFullHttpResponse response = new DefaultFullHttpRes... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/agreement/ResponseParser.java | Java | mit | 1,309 |
package zack.gateway.core.socket.handlers;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.socket.BaseHandler;
import zack.gateway.core.socket.agreement.AgreementConstants;
import zack.gateway.core.socket.agreement.GatewayResultMessage;
import za... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/handlers/AuthorizationHandler.java | Java | mit | 2,815 |
package zack.gateway.core.socket.handlers;
import zack.gateway.core.mapping.HttpStatement;
import zack.gateway.core.socket.BaseHandler;
import zack.gateway.core.session.Configuration;
import zack.gateway.core.socket.agreement.AgreementConstants;
import zack.gateway.core.socket.agreement.GatewayResultMessage;
import za... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/handlers/GatewayServerHandler.java | Java | mit | 2,047 |
package zack.gateway.core.socket.handlers;
import zack.gateway.core.executor.result.SessionResult;
import zack.gateway.core.session.GatewaySession;
import zack.gateway.core.session.GatewaySessionFactory;
import zack.gateway.core.session.defaults.DefaultGatewaySessionFactory;
import zack.gateway.core.socket.BaseHandler... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/socket/handlers/ProtocolDataHandler.java | Java | mit | 2,597 |
package zack.gateway.core.type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**基本类型注册表
* @author A1793
*/
public class SimpleTypeRegistry {
public final static Set<String> SIMPLE_TYPE_SET = new HashSet<String>();
static {... | 2301_82000044/my-api-gateway | my-api-gateway-core/src/main/java/zack/gateway/core/type/SimpleTypeRegistry.java | Java | mit | 1,184 |
# 基础镜像
FROM openjdk:8-jre-slim
# 作者
MAINTAINER zack
# 配置
ENV PARAMS=""
# 时区
ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 添加应用
ADD target/my-api-gateway-engine.jar /my-api-gateway-engine.jar
# 执行镜像
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /my-api-gateway-engine.jar $PARA... | 2301_82000044/my-api-gateway | my-api-gateway-engine/Dockerfile | Dockerfile | mit | 360 |
docker build -f ./Dockerfile -t zackzky/my-api-gateway-engine:1.3 . | 2301_82000044/my-api-gateway | my-api-gateway-engine/build.sh | Shell | mit | 67 |
#!/bin/bash
# https://cr.console.aliyun.com/cn-hangzhou/instance/credentials
# Ensure the script exits if any command fails
set -e
# Define variables for the registry and image
ALIYUN_REGISTRY="crpi-f2fnckn7fe4gfuf0.cn-hangzhou.personal.cr.aliyuncs.com"
NAMESPACE="zackzky"
IMAGE_NAME="my-api-gateway-engine"
IMAGE_TA... | 2301_82000044/my-api-gateway | my-api-gateway-engine/push.sh | Shell | mit | 1,407 |
package zack;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude = { Dat... | 2301_82000044/my-api-gateway | my-api-gateway-engine/src/main/java/zack/Main.java | Java | mit | 489 |
docker run -p 8902:8902 -p 7397:7397 \
-e PARAMS="
--sever.port=8902
--api-gateway.address=http://192.168.1.102:8901
--api-gateway.groupId=10001
--api-gateway.gatewayId=api-gateway-g4
--api-gateway.gatewayName=电商配送网关
--api-gateway.gatewayAddress=192.168.1.102:7397" \
--name api-gateway-e... | 2301_82000044/my-api-gateway | my-api-gateway-engine/start-01.sh | Shell | mit | 368 |
docker run -p 8903:8903 -p 7398:7398 \
-e PARAMS="
--sever.port=8903
--api-gateway.address=http://192.168.1.102:8901
--api-gateway.groupId=10001
--api-gateway.gatewayId=api-gateway-g4
--api-gateway.gatewayName=电商配送网关
--api-gateway.gatewayAddress=192.168.1.102:7398" \
--name api-gateway-e... | 2301_82000044/my-api-gateway | my-api-gateway-engine/start-02.sh | Shell | mit | 368 |
docker run -p 8904:8904 -p 7399:7399 \
-e PARAMS="
--sever.port=8904
--api-gateway.address=http://192.168.1.102:8901
--api-gateway.groupId=10001
--api-gateway.gatewayId=api-gateway-g4
--api-gateway.gatewayName=电商配送网关
--api-gateway.gatewayAddress=192.168.1.102:7399" \
--name api-gateway-e... | 2301_82000044/my-api-gateway | my-api-gateway-engine/start-03.sh | Shell | mit | 368 |
docker run -p 8007:8007 -p 7399:7399 --name api-gateway-engine -d zackzky/my-api-gateway-engine:1.0 | 2301_82000044/my-api-gateway | my-api-gateway-engine/start.sh | Shell | mit | 99 |
package zack.gateway.sdk;
public class GatewayException extends RuntimeException {
public GatewayException(String msg) {
super(msg);
}
public GatewayException(String msg, Throwable cause) {
super(msg, cause);
}
}
| 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/GatewayException.java | Java | mit | 250 |
package zack.gateway.sdk.annotations;
import java.lang.annotation.*;
/**
* @author A1793
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ApiProducerClazz {
public String interfaceName() default " ";
public String interfaceVersion() default " ";
}
| 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/annotations/ApiProducerClazz.java | Java | mit | 306 |
package zack.gateway.sdk.annotations;
import java.lang.annotation.*;
/**
* @author A1793
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ApiProducerMethod {
String methodName() default "";
String uri() default "";
String httpCommandType() default "GET";
... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/annotations/ApiProducerMethod.java | Java | mit | 348 |
package zack.gateway.sdk.application;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import zack.gateway.sdk.GatewayException;
import zack.gateway.sdk.annotati... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/application/GatewaySDKApplication.java | Java | mit | 4,955 |
package zack.gateway.sdk.common;
/**
* @author A1793
*/
public class Result<T> {
String code;
String info;
T data;
public Result(String code, String info, T data) {
this.code = code;
this.info = info;
this.data = data;
}
public String getCode() {
return code;... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/common/Result.java | Java | mit | 651 |
package zack.gateway.sdk.config;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
im... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/config/GatewaySDKAutoConfig.java | Java | mit | 1,204 |
package zack.gateway.sdk.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author A1793
*/
@ConfigurationProperties("api-gateway-sdk")
public class GatewaySDKProperties {
private String enable;
private String address;
private String systemId;
private String s... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/config/GatewaySDKProperties.java | Java | mit | 1,168 |
package zack.gateway.sdk.domain.service;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import zack.gateway.sdk.GatewayException;
import zack.gateway.sdk.common.Result;
import java.util.HashMap;
impo... | 2301_82000044/my-api-gateway | my-api-gateway-sdk/src/main/java/zack/gateway/sdk/domain/service/GatewayCenterService.java | Java | mit | 5,735 |
# 基础镜像
FROM openjdk:8-jre-slim
# 作者
MAINTAINER zackzky
# 配置
ENV PARAMS=""
# 时区
ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 添加应用
ADD /target/my-api-gateway-test.jar /my-api-gateway-test.jar
## 在镜像运行为容器后执行的命令
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /my-api-gateway-test.... | 2301_82000044/my-api-gateway | my-api-gateway-test/Dockerfile | Dockerfile | mit | 389 |
docker build -f ./Dockerfile -t zackzky/my-api-gateway-test:1.6 . | 2301_82000044/my-api-gateway | my-api-gateway-test/build.sh | Shell | mit | 65 |
#!/bin/bash
# https://cr.console.aliyun.com/cn-hangzhou/instance/credentials
# Ensure the script exits if any command fails
set -e
# Define variables for the registry and image
ALIYUN_REGISTRY="crpi-f2fnckn7fe4gfuf0.cn-hangzhou.personal.cr.aliyuncs.com"
NAMESPACE="zackzky"
IMAGE_NAME="my-api-gateway-test"
IMAGE_TAG=... | 2301_82000044/my-api-gateway | my-api-gateway-test/push.sh | Shell | mit | 1,405 |
package zack.gateway;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@Configurable
@En... | 2301_82000044/my-api-gateway | my-api-gateway-test/src/main/java/zack/gateway/RpcApplication.java | Java | mit | 474 |
package zack.gateway.interfaces;
import com.alibaba.fastjson.JSON;
import org.apache.dubbo.config.annotation.Service;
import zack.gateway.rpc.IActivityBooth;
import zack.gateway.rpc.dto.XReq;
import zack.gateway.sdk.annotations.ApiProducerClazz;
import zack.gateway.sdk.annotations.ApiProducerMethod;
@Service(versio... | 2301_82000044/my-api-gateway | my-api-gateway-test/src/main/java/zack/gateway/interfaces/ActivityBooth.java | Java | mit | 1,231 |
package zack.gateway.rpc;
import zack.gateway.rpc.dto.XReq;
public interface IActivityBooth {
String sayHi(String str);
String insert(XReq req);
String test(String str, XReq req);
}
| 2301_82000044/my-api-gateway | my-api-gateway-test/src/main/java/zack/gateway/rpc/IActivityBooth.java | Java | mit | 200 |
package zack.gateway.rpc.dto;
public class XReq {
private String uid;
private String name;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getName() {
return name;
}
public void setName(String name)... | 2301_82000044/my-api-gateway | my-api-gateway-test/src/main/java/zack/gateway/rpc/dto/XReq.java | Java | mit | 357 |