正在显示
21 个修改的文件
包含
392 行增加
和
917 行删除
| 1 | package com.crossoverjie.cim.client.client; | 1 | package com.crossoverjie.cim.client.client; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.crossoverjie.cim.client.init.CustomerHandleInitializer; | 4 | +import com.crossoverjie.cim.client.init.CIMClientHandleInitializer; |
| 5 | +import com.crossoverjie.cim.client.service.RouteRequest; | ||
| 5 | import com.crossoverjie.cim.client.vo.req.GoogleProtocolVO; | 6 | import com.crossoverjie.cim.client.vo.req.GoogleProtocolVO; |
| 6 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | 7 | +import com.crossoverjie.cim.client.vo.res.CIMServerResVO; |
| 7 | import com.crossoverjie.cim.common.pojo.CustomProtocol; | 8 | import com.crossoverjie.cim.common.pojo.CustomProtocol; |
| 9 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; | ||
| 8 | import io.netty.bootstrap.Bootstrap; | 10 | import io.netty.bootstrap.Bootstrap; |
| 9 | import io.netty.buffer.ByteBuf; | 11 | import io.netty.buffer.ByteBuf; |
| 10 | import io.netty.buffer.Unpooled; | 12 | import io.netty.buffer.Unpooled; |
| @@ -16,6 +18,7 @@ import io.netty.channel.socket.SocketChannel; | @@ -16,6 +18,7 @@ import io.netty.channel.socket.SocketChannel; | ||
| 16 | import io.netty.channel.socket.nio.NioSocketChannel; | 18 | import io.netty.channel.socket.nio.NioSocketChannel; |
| 17 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
| 21 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | import org.springframework.beans.factory.annotation.Value; | 22 | import org.springframework.beans.factory.annotation.Value; |
| 20 | import org.springframework.stereotype.Component; | 23 | import org.springframework.stereotype.Component; |
| 21 | 24 | ||
| @@ -44,17 +47,24 @@ public class CIMClient { | @@ -44,17 +47,24 @@ public class CIMClient { | ||
| 44 | 47 | ||
| 45 | private SocketChannel channel; | 48 | private SocketChannel channel; |
| 46 | 49 | ||
| 50 | + @Autowired | ||
| 51 | + private RouteRequest routeRequest ; | ||
| 52 | + | ||
| 47 | @PostConstruct | 53 | @PostConstruct |
| 48 | - public void start() throws InterruptedException { | 54 | + public void start() throws Exception { |
| 55 | + //获取可以使用的服务器 ip+port | ||
| 56 | + CIMServerResVO.ServerInfo cimServer = routeRequest.getCIMServer(); | ||
| 57 | + LOGGER.info("cimServer=[{}]",cimServer.toString()); | ||
| 58 | + | ||
| 49 | Bootstrap bootstrap = new Bootstrap(); | 59 | Bootstrap bootstrap = new Bootstrap(); |
| 50 | bootstrap.group(group) | 60 | bootstrap.group(group) |
| 51 | .channel(NioSocketChannel.class) | 61 | .channel(NioSocketChannel.class) |
| 52 | - .handler(new CustomerHandleInitializer()) | 62 | + .handler(new CIMClientHandleInitializer()) |
| 53 | ; | 63 | ; |
| 54 | 64 | ||
| 55 | - ChannelFuture future = bootstrap.connect(host, nettyPort).sync(); | 65 | + ChannelFuture future = bootstrap.connect(cimServer.getIp(), cimServer.getPort()).sync(); |
| 56 | if (future.isSuccess()) { | 66 | if (future.isSuccess()) { |
| 57 | - LOGGER.info("启动 Netty 成功"); | 67 | + LOGGER.info("启动 cim client 成功"); |
| 58 | } | 68 | } |
| 59 | channel = (SocketChannel) future.channel(); | 69 | channel = (SocketChannel) future.channel(); |
| 60 | } | 70 | } |
| @@ -91,7 +101,7 @@ public class CIMClient { | @@ -91,7 +101,7 @@ public class CIMClient { | ||
| 91 | */ | 101 | */ |
| 92 | public void sendGoogleProtocolMsg(GoogleProtocolVO googleProtocolVO) { | 102 | public void sendGoogleProtocolMsg(GoogleProtocolVO googleProtocolVO) { |
| 93 | 103 | ||
| 94 | - BaseRequestProto.RequestProtocol protocol = BaseRequestProto.RequestProtocol.newBuilder() | 104 | + CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder() |
| 95 | .setRequestId(googleProtocolVO.getRequestId()) | 105 | .setRequestId(googleProtocolVO.getRequestId()) |
| 96 | .setReqMsg(googleProtocolVO.getMsg()) | 106 | .setReqMsg(googleProtocolVO.getMsg()) |
| 97 | .build(); | 107 | .build(); |
| 1 | package com.crossoverjie.cim.client.config; | 1 | package com.crossoverjie.cim.client.config; |
| 2 | 2 | ||
| 3 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | 3 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; |
| 4 | import okhttp3.OkHttpClient; | 4 | import okhttp3.OkHttpClient; |
| 5 | import org.springframework.beans.factory.annotation.Value; | 5 | import org.springframework.beans.factory.annotation.Value; |
| 6 | import org.springframework.context.annotation.Bean; | 6 | import org.springframework.context.annotation.Bean; |
| @@ -27,8 +27,8 @@ public class BeanConfig { | @@ -27,8 +27,8 @@ public class BeanConfig { | ||
| 27 | * @return | 27 | * @return |
| 28 | */ | 28 | */ |
| 29 | @Bean(value = "heartBeat") | 29 | @Bean(value = "heartBeat") |
| 30 | - public BaseRequestProto.RequestProtocol heartBeat() { | ||
| 31 | - BaseRequestProto.RequestProtocol heart = BaseRequestProto.RequestProtocol.newBuilder() | 30 | + public CIMRequestProto.CIMReqProtocol heartBeat() { |
| 31 | + CIMRequestProto.CIMReqProtocol heart = CIMRequestProto.CIMReqProtocol.newBuilder() | ||
| 32 | .setRequestId(requestId) | 32 | .setRequestId(requestId) |
| 33 | .setReqMsg("ping") | 33 | .setReqMsg("ping") |
| 34 | .build(); | 34 | .build(); |
| 1 | package com.crossoverjie.cim.client.handle; | 1 | package com.crossoverjie.cim.client.handle; |
| 2 | 2 | ||
| 3 | import com.crossoverjie.cim.client.util.SpringBeanFactory; | 3 | import com.crossoverjie.cim.client.util.SpringBeanFactory; |
| 4 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | ||
| 5 | -import com.crossoverjie.cim.common.protocol.BaseResponseProto; | ||
| 6 | -import io.netty.channel.ChannelFutureListener; | 4 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; |
| 5 | +import com.crossoverjie.cim.common.protocol.CIMResponseProto; | ||
| 6 | +import io.netty.channel.ChannelHandler; | ||
| 7 | import io.netty.channel.ChannelHandlerContext; | 7 | import io.netty.channel.ChannelHandlerContext; |
| 8 | import io.netty.channel.SimpleChannelInboundHandler; | 8 | import io.netty.channel.SimpleChannelInboundHandler; |
| 9 | import io.netty.handler.timeout.IdleState; | 9 | import io.netty.handler.timeout.IdleState; |
| @@ -18,9 +18,10 @@ import org.slf4j.LoggerFactory; | @@ -18,9 +18,10 @@ import org.slf4j.LoggerFactory; | ||
| 18 | * Date: 16/02/2018 18:09 | 18 | * Date: 16/02/2018 18:09 |
| 19 | * @since JDK 1.8 | 19 | * @since JDK 1.8 |
| 20 | */ | 20 | */ |
| 21 | -public class EchoClientHandle extends SimpleChannelInboundHandler<BaseResponseProto.ResponseProtocol> { | 21 | +@ChannelHandler.Sharable |
| 22 | +public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProto.CIMResProtocol> { | ||
| 22 | 23 | ||
| 23 | - private final static Logger LOGGER = LoggerFactory.getLogger(EchoClientHandle.class); | 24 | + private final static Logger LOGGER = LoggerFactory.getLogger(CIMClientHandle.class); |
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | 27 | ||
| @@ -34,8 +35,8 @@ public class EchoClientHandle extends SimpleChannelInboundHandler<BaseResponsePr | @@ -34,8 +35,8 @@ public class EchoClientHandle extends SimpleChannelInboundHandler<BaseResponsePr | ||
| 34 | if (idleStateEvent.state() == IdleState.WRITER_IDLE){ | 35 | if (idleStateEvent.state() == IdleState.WRITER_IDLE){ |
| 35 | LOGGER.info("已经 10 秒没有发送信息!"); | 36 | LOGGER.info("已经 10 秒没有发送信息!"); |
| 36 | //向服务端发送消息 | 37 | //向服务端发送消息 |
| 37 | - BaseRequestProto.RequestProtocol heartBeat = SpringBeanFactory.getBean("heartBeat", BaseRequestProto.RequestProtocol.class); | ||
| 38 | - ctx.writeAndFlush(heartBeat).addListener(ChannelFutureListener.CLOSE_ON_FAILURE) ; | 38 | + CIMRequestProto.CIMReqProtocol heartBeat = SpringBeanFactory.getBean("heartBeat", CIMRequestProto.CIMReqProtocol.class); |
| 39 | + ctx.writeAndFlush(heartBeat) ; | ||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | 42 | ||
| @@ -48,11 +49,11 @@ public class EchoClientHandle extends SimpleChannelInboundHandler<BaseResponsePr | @@ -48,11 +49,11 @@ public class EchoClientHandle extends SimpleChannelInboundHandler<BaseResponsePr | ||
| 48 | public void channelActive(ChannelHandlerContext ctx) throws Exception { | 49 | public void channelActive(ChannelHandlerContext ctx) throws Exception { |
| 49 | 50 | ||
| 50 | //客户端和服务端建立连接时调用 | 51 | //客户端和服务端建立连接时调用 |
| 51 | - LOGGER.info("已经建立了联系。。"); | 52 | + LOGGER.info("cim server connect success"); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | @Override | 55 | @Override |
| 55 | - protected void channelRead0(ChannelHandlerContext channelHandlerContext, BaseResponseProto.ResponseProtocol responseProtocol) throws Exception { | 56 | + protected void channelRead0(ChannelHandlerContext channelHandlerContext, CIMResponseProto.CIMResProtocol responseProtocol) throws Exception { |
| 56 | 57 | ||
| 57 | //从服务端收到消息时被调用 | 58 | //从服务端收到消息时被调用 |
| 58 | //LOGGER.info("客户端收到消息={}",in.toString(CharsetUtil.UTF_8)) ; | 59 | //LOGGER.info("客户端收到消息={}",in.toString(CharsetUtil.UTF_8)) ; |
| 1 | package com.crossoverjie.cim.client.init; | 1 | package com.crossoverjie.cim.client.init; |
| 2 | 2 | ||
| 3 | -import com.crossoverjie.cim.client.handle.EchoClientHandle; | ||
| 4 | -import com.crossoverjie.cim.common.protocol.BaseResponseProto; | 3 | +import com.crossoverjie.cim.client.handle.CIMClientHandle; |
| 4 | +import com.crossoverjie.cim.common.protocol.CIMResponseProto; | ||
| 5 | import io.netty.channel.Channel; | 5 | import io.netty.channel.Channel; |
| 6 | import io.netty.channel.ChannelInitializer; | 6 | import io.netty.channel.ChannelInitializer; |
| 7 | import io.netty.handler.codec.protobuf.ProtobufDecoder; | 7 | import io.netty.handler.codec.protobuf.ProtobufDecoder; |
| @@ -17,7 +17,10 @@ import io.netty.handler.timeout.IdleStateHandler; | @@ -17,7 +17,10 @@ import io.netty.handler.timeout.IdleStateHandler; | ||
| 17 | * Date: 23/02/2018 22:47 | 17 | * Date: 23/02/2018 22:47 |
| 18 | * @since JDK 1.8 | 18 | * @since JDK 1.8 |
| 19 | */ | 19 | */ |
| 20 | -public class CustomerHandleInitializer extends ChannelInitializer<Channel> { | 20 | +public class CIMClientHandleInitializer extends ChannelInitializer<Channel> { |
| 21 | + | ||
| 22 | + private final CIMClientHandle cimClientHandle = new CIMClientHandle(); | ||
| 23 | + | ||
| 21 | @Override | 24 | @Override |
| 22 | protected void initChannel(Channel ch) throws Exception { | 25 | protected void initChannel(Channel ch) throws Exception { |
| 23 | ch.pipeline() | 26 | ch.pipeline() |
| @@ -30,14 +33,12 @@ public class CustomerHandleInitializer extends ChannelInitializer<Channel> { | @@ -30,14 +33,12 @@ public class CustomerHandleInitializer extends ChannelInitializer<Channel> { | ||
| 30 | // google Protobuf 编解码 | 33 | // google Protobuf 编解码 |
| 31 | //拆包解码 | 34 | //拆包解码 |
| 32 | .addLast(new ProtobufVarint32FrameDecoder()) | 35 | .addLast(new ProtobufVarint32FrameDecoder()) |
| 33 | - .addLast(new ProtobufDecoder(BaseResponseProto.ResponseProtocol.getDefaultInstance())) | 36 | + .addLast(new ProtobufDecoder(CIMResponseProto.CIMResProtocol.getDefaultInstance())) |
| 34 | // | 37 | // |
| 35 | //拆包编码 | 38 | //拆包编码 |
| 36 | .addLast(new ProtobufVarint32LengthFieldPrepender()) | 39 | .addLast(new ProtobufVarint32LengthFieldPrepender()) |
| 37 | .addLast(new ProtobufEncoder()) | 40 | .addLast(new ProtobufEncoder()) |
| 38 | - | ||
| 39 | - | ||
| 40 | - .addLast(new EchoClientHandle()) | 41 | + .addLast(cimClientHandle) |
| 41 | ; | 42 | ; |
| 42 | } | 43 | } |
| 43 | } | 44 | } |
| 1 | package com.crossoverjie.cim.client.service; | 1 | package com.crossoverjie.cim.client.service; |
| 2 | 2 | ||
| 3 | +import com.crossoverjie.cim.client.vo.res.CIMServerResVO; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * Function: | 6 | * Function: |
| 5 | * | 7 | * |
| @@ -15,4 +17,11 @@ public interface RouteRequest { | @@ -15,4 +17,11 @@ public interface RouteRequest { | ||
| 15 | * @throws Exception | 17 | * @throws Exception |
| 16 | */ | 18 | */ |
| 17 | void sendGroupMsg(String msg) throws Exception; | 19 | void sendGroupMsg(String msg) throws Exception; |
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 获取服务器 | ||
| 23 | + * @return 服务ip+port | ||
| 24 | + * @throws Exception | ||
| 25 | + */ | ||
| 26 | + CIMServerResVO.ServerInfo getCIMServer() throws Exception; | ||
| 18 | } | 27 | } |
| 1 | package com.crossoverjie.cim.client.service.impl; | 1 | package com.crossoverjie.cim.client.service.impl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.crossoverjie.cim.client.service.RouteRequest; | 5 | import com.crossoverjie.cim.client.service.RouteRequest; |
| 6 | +import com.crossoverjie.cim.client.vo.res.CIMServerResVO; | ||
| 7 | +import com.crossoverjie.cim.common.enums.StatusEnum; | ||
| 5 | import okhttp3.*; | 8 | import okhttp3.*; |
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.beans.factory.annotation.Value; | 12 | import org.springframework.beans.factory.annotation.Value; |
| 8 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| @@ -19,14 +24,18 @@ import java.io.IOException; | @@ -19,14 +24,18 @@ import java.io.IOException; | ||
| 19 | @Service | 24 | @Service |
| 20 | public class RouteRequestImpl implements RouteRequest { | 25 | public class RouteRequestImpl implements RouteRequest { |
| 21 | 26 | ||
| 27 | + private final static Logger LOGGER = LoggerFactory.getLogger(RouteRequestImpl.class); | ||
| 28 | + | ||
| 22 | @Autowired | 29 | @Autowired |
| 23 | private OkHttpClient okHttpClient ; | 30 | private OkHttpClient okHttpClient ; |
| 24 | 31 | ||
| 25 | - | ||
| 26 | private MediaType mediaType = MediaType.parse("application/json"); | 32 | private MediaType mediaType = MediaType.parse("application/json"); |
| 27 | 33 | ||
| 28 | - @Value("${cim.route.request.url}") | ||
| 29 | - private String routeRequestUrl ; | 34 | + @Value("${cim.group.route.request.url}") |
| 35 | + private String groupRouteRequestUrl; | ||
| 36 | + | ||
| 37 | + @Value("${cim.server.route.request.url}") | ||
| 38 | + private String serverRouteRequestUrl; | ||
| 30 | 39 | ||
| 31 | @Override | 40 | @Override |
| 32 | public void sendGroupMsg(String msg) throws Exception { | 41 | public void sendGroupMsg(String msg) throws Exception { |
| @@ -36,7 +45,7 @@ public class RouteRequestImpl implements RouteRequest { | @@ -36,7 +45,7 @@ public class RouteRequestImpl implements RouteRequest { | ||
| 36 | RequestBody requestBody = RequestBody.create(mediaType,jsonObject.toString()); | 45 | RequestBody requestBody = RequestBody.create(mediaType,jsonObject.toString()); |
| 37 | 46 | ||
| 38 | Request request = new Request.Builder() | 47 | Request request = new Request.Builder() |
| 39 | - .url(routeRequestUrl) | 48 | + .url(groupRouteRequestUrl) |
| 40 | .post(requestBody) | 49 | .post(requestBody) |
| 41 | .build(); | 50 | .build(); |
| 42 | 51 | ||
| @@ -45,4 +54,29 @@ public class RouteRequestImpl implements RouteRequest { | @@ -45,4 +54,29 @@ public class RouteRequestImpl implements RouteRequest { | ||
| 45 | throw new IOException("Unexpected code " + response); | 54 | throw new IOException("Unexpected code " + response); |
| 46 | } | 55 | } |
| 47 | } | 56 | } |
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public CIMServerResVO.ServerInfo getCIMServer() throws Exception { | ||
| 60 | + | ||
| 61 | + JSONObject jsonObject = new JSONObject(); | ||
| 62 | + RequestBody requestBody = RequestBody.create(mediaType,jsonObject.toString()); | ||
| 63 | + | ||
| 64 | + Request request = new Request.Builder() | ||
| 65 | + .url(serverRouteRequestUrl) | ||
| 66 | + .post(requestBody) | ||
| 67 | + .build(); | ||
| 68 | + | ||
| 69 | + Response response = okHttpClient.newCall(request).execute() ; | ||
| 70 | + if (!response.isSuccessful()){ | ||
| 71 | + throw new IOException("Unexpected code " + response); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + String json = response.body().string(); | ||
| 75 | + CIMServerResVO cimServerResVO = JSON.parseObject(json, CIMServerResVO.class); | ||
| 76 | + if (!cimServerResVO.getCode().equals(StatusEnum.SUCCESS.getCode())){ | ||
| 77 | + throw new RuntimeException("route server exception code=" + cimServerResVO.getCode()) ; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return cimServerResVO.getDataBody(); | ||
| 81 | + } | ||
| 48 | } | 82 | } |
| 1 | +package com.crossoverjie.cim.client.vo.res; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Function: | ||
| 7 | + * | ||
| 8 | + * @author crossoverJie | ||
| 9 | + * Date: 2018/12/23 00:43 | ||
| 10 | + * @since JDK 1.8 | ||
| 11 | + */ | ||
| 12 | +public class CIMServerResVO implements Serializable { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * code : 9000 | ||
| 16 | + * message : 成功 | ||
| 17 | + * reqNo : null | ||
| 18 | + * dataBody : {"ip":"127.0.0.1","port":8081} | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | + private String code; | ||
| 22 | + private String message; | ||
| 23 | + private Object reqNo; | ||
| 24 | + private ServerInfo dataBody; | ||
| 25 | + | ||
| 26 | + public String getCode() { | ||
| 27 | + return code; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setCode(String code) { | ||
| 31 | + this.code = code; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getMessage() { | ||
| 35 | + return message; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setMessage(String message) { | ||
| 39 | + this.message = message; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public Object getReqNo() { | ||
| 43 | + return reqNo; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setReqNo(Object reqNo) { | ||
| 47 | + this.reqNo = reqNo; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public ServerInfo getDataBody() { | ||
| 51 | + return dataBody; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setDataBody(ServerInfo dataBody) { | ||
| 55 | + this.dataBody = dataBody; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public static class ServerInfo { | ||
| 59 | + /** | ||
| 60 | + * ip : 127.0.0.1 | ||
| 61 | + * port : 8081 | ||
| 62 | + */ | ||
| 63 | + | ||
| 64 | + private String ip; | ||
| 65 | + private int port; | ||
| 66 | + | ||
| 67 | + public String getIp() { | ||
| 68 | + return ip; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setIp(String ip) { | ||
| 72 | + this.ip = ip; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public int getPort() { | ||
| 76 | + return port; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setPort(int port) { | ||
| 80 | + this.port = port; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public String toString() { | ||
| 85 | + return "DataBodyBean{" + | ||
| 86 | + "ip='" + ip + '\'' + | ||
| 87 | + ", port=" + port + | ||
| 88 | + '}'; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public String toString() { | ||
| 95 | + return "CIMServerResVO{" + | ||
| 96 | + "code='" + code + '\'' + | ||
| 97 | + ", message='" + message + '\'' + | ||
| 98 | + ", reqNo=" + reqNo + | ||
| 99 | + ", dataBody=" + dataBody + | ||
| 100 | + '}'; | ||
| 101 | + } | ||
| 102 | +} |
| @@ -11,8 +11,11 @@ netty.server.port=11211 | @@ -11,8 +11,11 @@ netty.server.port=11211 | ||
| 11 | 11 | ||
| 12 | logging.level.root=info | 12 | logging.level.root=info |
| 13 | 13 | ||
| 14 | -# 路由地址 | ||
| 15 | -cim.route.request.url=http://localhost:8083/groupRoute | 14 | +# 群发消息 |
| 15 | +cim.group.route.request.url=http://localhost:8083/groupRoute | ||
| 16 | + | ||
| 17 | +# 获取服务器ip+port | ||
| 18 | +cim.server.route.request.url=http://localhost:8083/getCIMServer | ||
| 16 | 19 | ||
| 17 | # 客户端唯一ID | 20 | # 客户端唯一ID |
| 18 | client.request.id=100 | 21 | client.request.id=100 |
| 1 | +package com.crossoverjie.cim.server.test; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.alibaba.fastjson.JSON; | ||
| 5 | +import com.crossoverjie.cim.client.vo.res.CIMServerResVO; | ||
| 6 | +import org.junit.Test; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Function: | ||
| 10 | + * | ||
| 11 | + * @author crossoverJie | ||
| 12 | + * Date: 22/05/2018 18:44 | ||
| 13 | + * @since JDK 1.8 | ||
| 14 | + */ | ||
| 15 | +public class CommonTest { | ||
| 16 | + | ||
| 17 | + @Test | ||
| 18 | + public void test() { | ||
| 19 | + | ||
| 20 | + String json = "{\"code\":\"9000\",\"message\":\"成功\",\"reqNo\":null,\"dataBody\":{\"ip\":\"127.0.0.1\",\"port\":8081}}" ; | ||
| 21 | + | ||
| 22 | + CIMServerResVO cimServerResVO = JSON.parseObject(json, CIMServerResVO.class); | ||
| 23 | + | ||
| 24 | + System.out.println(cimServerResVO.toString()); | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | +} |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | <version>1.0.0-SNAPSHOT</version> | 8 | <version>1.0.0-SNAPSHOT</version> |
| 9 | </parent> | 9 | </parent> |
| 10 | <modelVersion>4.0.0</modelVersion> | 10 | <modelVersion>4.0.0</modelVersion> |
| 11 | + <version>1.0.1-SNAPSHOT</version> | ||
| 11 | 12 | ||
| 12 | <artifactId>cim-common</artifactId> | 13 | <artifactId>cim-common</artifactId> |
| 13 | 14 |
| 1 | -// Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 2 | -// source: BaseProtoc.proto | ||
| 3 | - | ||
| 4 | -package com.crossoverjie.cim.common.protocol; | ||
| 5 | - | ||
| 6 | -public final class BaseProto { | ||
| 7 | - private BaseProto() {} | ||
| 8 | - public static void registerAllExtensions( | ||
| 9 | - com.google.protobuf.ExtensionRegistryLite registry) { | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - public static void registerAllExtensions( | ||
| 13 | - com.google.protobuf.ExtensionRegistry registry) { | ||
| 14 | - registerAllExtensions( | ||
| 15 | - (com.google.protobuf.ExtensionRegistryLite) registry); | ||
| 16 | - } | ||
| 17 | - public interface ProtocolOrBuilder extends | ||
| 18 | - // @@protoc_insertion_point(interface_extends:protocol.Protocol) | ||
| 19 | - com.google.protobuf.MessageOrBuilder { | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * <code>required int32 header = 2;</code> | ||
| 23 | - */ | ||
| 24 | - boolean hasHeader(); | ||
| 25 | - /** | ||
| 26 | - * <code>required int32 header = 2;</code> | ||
| 27 | - */ | ||
| 28 | - int getHeader(); | ||
| 29 | - | ||
| 30 | - /** | ||
| 31 | - * <code>required string msg = 1;</code> | ||
| 32 | - */ | ||
| 33 | - boolean hasMsg(); | ||
| 34 | - /** | ||
| 35 | - * <code>required string msg = 1;</code> | ||
| 36 | - */ | ||
| 37 | - String getMsg(); | ||
| 38 | - /** | ||
| 39 | - * <code>required string msg = 1;</code> | ||
| 40 | - */ | ||
| 41 | - com.google.protobuf.ByteString | ||
| 42 | - getMsgBytes(); | ||
| 43 | - } | ||
| 44 | - /** | ||
| 45 | - * Protobuf type {@code protocol.Protocol} | ||
| 46 | - */ | ||
| 47 | - public static final class Protocol extends | ||
| 48 | - com.google.protobuf.GeneratedMessageV3 implements | ||
| 49 | - // @@protoc_insertion_point(message_implements:protocol.Protocol) | ||
| 50 | - ProtocolOrBuilder { | ||
| 51 | - private static final long serialVersionUID = 0L; | ||
| 52 | - // Use Protocol.newBuilder() to construct. | ||
| 53 | - private Protocol(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { | ||
| 54 | - super(builder); | ||
| 55 | - } | ||
| 56 | - private Protocol() { | ||
| 57 | - header_ = 0; | ||
| 58 | - msg_ = ""; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - @Override | ||
| 62 | - public final com.google.protobuf.UnknownFieldSet | ||
| 63 | - getUnknownFields() { | ||
| 64 | - return this.unknownFields; | ||
| 65 | - } | ||
| 66 | - private Protocol( | ||
| 67 | - com.google.protobuf.CodedInputStream input, | ||
| 68 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 69 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 70 | - this(); | ||
| 71 | - if (extensionRegistry == null) { | ||
| 72 | - throw new NullPointerException(); | ||
| 73 | - } | ||
| 74 | - int mutable_bitField0_ = 0; | ||
| 75 | - com.google.protobuf.UnknownFieldSet.Builder unknownFields = | ||
| 76 | - com.google.protobuf.UnknownFieldSet.newBuilder(); | ||
| 77 | - try { | ||
| 78 | - boolean done = false; | ||
| 79 | - while (!done) { | ||
| 80 | - int tag = input.readTag(); | ||
| 81 | - switch (tag) { | ||
| 82 | - case 0: | ||
| 83 | - done = true; | ||
| 84 | - break; | ||
| 85 | - default: { | ||
| 86 | - if (!parseUnknownField( | ||
| 87 | - input, unknownFields, extensionRegistry, tag)) { | ||
| 88 | - done = true; | ||
| 89 | - } | ||
| 90 | - break; | ||
| 91 | - } | ||
| 92 | - case 10: { | ||
| 93 | - com.google.protobuf.ByteString bs = input.readBytes(); | ||
| 94 | - bitField0_ |= 0x00000002; | ||
| 95 | - msg_ = bs; | ||
| 96 | - break; | ||
| 97 | - } | ||
| 98 | - case 16: { | ||
| 99 | - bitField0_ |= 0x00000001; | ||
| 100 | - header_ = input.readInt32(); | ||
| 101 | - break; | ||
| 102 | - } | ||
| 103 | - } | ||
| 104 | - } | ||
| 105 | - } catch (com.google.protobuf.InvalidProtocolBufferException e) { | ||
| 106 | - throw e.setUnfinishedMessage(this); | ||
| 107 | - } catch (java.io.IOException e) { | ||
| 108 | - throw new com.google.protobuf.InvalidProtocolBufferException( | ||
| 109 | - e).setUnfinishedMessage(this); | ||
| 110 | - } finally { | ||
| 111 | - this.unknownFields = unknownFields.build(); | ||
| 112 | - makeExtensionsImmutable(); | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - public static final com.google.protobuf.Descriptors.Descriptor | ||
| 116 | - getDescriptor() { | ||
| 117 | - return BaseProto.internal_static_protocol_Protocol_descriptor; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - protected FieldAccessorTable | ||
| 121 | - internalGetFieldAccessorTable() { | ||
| 122 | - return BaseProto.internal_static_protocol_Protocol_fieldAccessorTable | ||
| 123 | - .ensureFieldAccessorsInitialized( | ||
| 124 | - Protocol.class, Builder.class); | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - private int bitField0_; | ||
| 128 | - public static final int HEADER_FIELD_NUMBER = 2; | ||
| 129 | - private int header_; | ||
| 130 | - /** | ||
| 131 | - * <code>required int32 header = 2;</code> | ||
| 132 | - */ | ||
| 133 | - public boolean hasHeader() { | ||
| 134 | - return ((bitField0_ & 0x00000001) == 0x00000001); | ||
| 135 | - } | ||
| 136 | - /** | ||
| 137 | - * <code>required int32 header = 2;</code> | ||
| 138 | - */ | ||
| 139 | - public int getHeader() { | ||
| 140 | - return header_; | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - public static final int MSG_FIELD_NUMBER = 1; | ||
| 144 | - private volatile Object msg_; | ||
| 145 | - /** | ||
| 146 | - * <code>required string msg = 1;</code> | ||
| 147 | - */ | ||
| 148 | - public boolean hasMsg() { | ||
| 149 | - return ((bitField0_ & 0x00000002) == 0x00000002); | ||
| 150 | - } | ||
| 151 | - /** | ||
| 152 | - * <code>required string msg = 1;</code> | ||
| 153 | - */ | ||
| 154 | - public String getMsg() { | ||
| 155 | - Object ref = msg_; | ||
| 156 | - if (ref instanceof String) { | ||
| 157 | - return (String) ref; | ||
| 158 | - } else { | ||
| 159 | - com.google.protobuf.ByteString bs = | ||
| 160 | - (com.google.protobuf.ByteString) ref; | ||
| 161 | - String s = bs.toStringUtf8(); | ||
| 162 | - if (bs.isValidUtf8()) { | ||
| 163 | - msg_ = s; | ||
| 164 | - } | ||
| 165 | - return s; | ||
| 166 | - } | ||
| 167 | - } | ||
| 168 | - /** | ||
| 169 | - * <code>required string msg = 1;</code> | ||
| 170 | - */ | ||
| 171 | - public com.google.protobuf.ByteString | ||
| 172 | - getMsgBytes() { | ||
| 173 | - Object ref = msg_; | ||
| 174 | - if (ref instanceof String) { | ||
| 175 | - com.google.protobuf.ByteString b = | ||
| 176 | - com.google.protobuf.ByteString.copyFromUtf8( | ||
| 177 | - (String) ref); | ||
| 178 | - msg_ = b; | ||
| 179 | - return b; | ||
| 180 | - } else { | ||
| 181 | - return (com.google.protobuf.ByteString) ref; | ||
| 182 | - } | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - private byte memoizedIsInitialized = -1; | ||
| 186 | - public final boolean isInitialized() { | ||
| 187 | - byte isInitialized = memoizedIsInitialized; | ||
| 188 | - if (isInitialized == 1) return true; | ||
| 189 | - if (isInitialized == 0) return false; | ||
| 190 | - | ||
| 191 | - if (!hasHeader()) { | ||
| 192 | - memoizedIsInitialized = 0; | ||
| 193 | - return false; | ||
| 194 | - } | ||
| 195 | - if (!hasMsg()) { | ||
| 196 | - memoizedIsInitialized = 0; | ||
| 197 | - return false; | ||
| 198 | - } | ||
| 199 | - memoizedIsInitialized = 1; | ||
| 200 | - return true; | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - public void writeTo(com.google.protobuf.CodedOutputStream output) | ||
| 204 | - throws java.io.IOException { | ||
| 205 | - if (((bitField0_ & 0x00000002) == 0x00000002)) { | ||
| 206 | - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, msg_); | ||
| 207 | - } | ||
| 208 | - if (((bitField0_ & 0x00000001) == 0x00000001)) { | ||
| 209 | - output.writeInt32(2, header_); | ||
| 210 | - } | ||
| 211 | - unknownFields.writeTo(output); | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - public int getSerializedSize() { | ||
| 215 | - int size = memoizedSize; | ||
| 216 | - if (size != -1) return size; | ||
| 217 | - | ||
| 218 | - size = 0; | ||
| 219 | - if (((bitField0_ & 0x00000002) == 0x00000002)) { | ||
| 220 | - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, msg_); | ||
| 221 | - } | ||
| 222 | - if (((bitField0_ & 0x00000001) == 0x00000001)) { | ||
| 223 | - size += com.google.protobuf.CodedOutputStream | ||
| 224 | - .computeInt32Size(2, header_); | ||
| 225 | - } | ||
| 226 | - size += unknownFields.getSerializedSize(); | ||
| 227 | - memoizedSize = size; | ||
| 228 | - return size; | ||
| 229 | - } | ||
| 230 | - | ||
| 231 | - @Override | ||
| 232 | - public boolean equals(final Object obj) { | ||
| 233 | - if (obj == this) { | ||
| 234 | - return true; | ||
| 235 | - } | ||
| 236 | - if (!(obj instanceof Protocol)) { | ||
| 237 | - return super.equals(obj); | ||
| 238 | - } | ||
| 239 | - Protocol other = (Protocol) obj; | ||
| 240 | - | ||
| 241 | - boolean result = true; | ||
| 242 | - result = result && (hasHeader() == other.hasHeader()); | ||
| 243 | - if (hasHeader()) { | ||
| 244 | - result = result && (getHeader() | ||
| 245 | - == other.getHeader()); | ||
| 246 | - } | ||
| 247 | - result = result && (hasMsg() == other.hasMsg()); | ||
| 248 | - if (hasMsg()) { | ||
| 249 | - result = result && getMsg() | ||
| 250 | - .equals(other.getMsg()); | ||
| 251 | - } | ||
| 252 | - result = result && unknownFields.equals(other.unknownFields); | ||
| 253 | - return result; | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | - @Override | ||
| 257 | - public int hashCode() { | ||
| 258 | - if (memoizedHashCode != 0) { | ||
| 259 | - return memoizedHashCode; | ||
| 260 | - } | ||
| 261 | - int hash = 41; | ||
| 262 | - hash = (19 * hash) + getDescriptor().hashCode(); | ||
| 263 | - if (hasHeader()) { | ||
| 264 | - hash = (37 * hash) + HEADER_FIELD_NUMBER; | ||
| 265 | - hash = (53 * hash) + getHeader(); | ||
| 266 | - } | ||
| 267 | - if (hasMsg()) { | ||
| 268 | - hash = (37 * hash) + MSG_FIELD_NUMBER; | ||
| 269 | - hash = (53 * hash) + getMsg().hashCode(); | ||
| 270 | - } | ||
| 271 | - hash = (29 * hash) + unknownFields.hashCode(); | ||
| 272 | - memoizedHashCode = hash; | ||
| 273 | - return hash; | ||
| 274 | - } | ||
| 275 | - | ||
| 276 | - public static Protocol parseFrom( | ||
| 277 | - java.nio.ByteBuffer data) | ||
| 278 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 279 | - return PARSER.parseFrom(data); | ||
| 280 | - } | ||
| 281 | - public static Protocol parseFrom( | ||
| 282 | - java.nio.ByteBuffer data, | ||
| 283 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 284 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 285 | - return PARSER.parseFrom(data, extensionRegistry); | ||
| 286 | - } | ||
| 287 | - public static Protocol parseFrom( | ||
| 288 | - com.google.protobuf.ByteString data) | ||
| 289 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 290 | - return PARSER.parseFrom(data); | ||
| 291 | - } | ||
| 292 | - public static Protocol parseFrom( | ||
| 293 | - com.google.protobuf.ByteString data, | ||
| 294 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 295 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 296 | - return PARSER.parseFrom(data, extensionRegistry); | ||
| 297 | - } | ||
| 298 | - public static Protocol parseFrom(byte[] data) | ||
| 299 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 300 | - return PARSER.parseFrom(data); | ||
| 301 | - } | ||
| 302 | - public static Protocol parseFrom( | ||
| 303 | - byte[] data, | ||
| 304 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 305 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 306 | - return PARSER.parseFrom(data, extensionRegistry); | ||
| 307 | - } | ||
| 308 | - public static Protocol parseFrom(java.io.InputStream input) | ||
| 309 | - throws java.io.IOException { | ||
| 310 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 311 | - .parseWithIOException(PARSER, input); | ||
| 312 | - } | ||
| 313 | - public static Protocol parseFrom( | ||
| 314 | - java.io.InputStream input, | ||
| 315 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 316 | - throws java.io.IOException { | ||
| 317 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 318 | - .parseWithIOException(PARSER, input, extensionRegistry); | ||
| 319 | - } | ||
| 320 | - public static Protocol parseDelimitedFrom(java.io.InputStream input) | ||
| 321 | - throws java.io.IOException { | ||
| 322 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 323 | - .parseDelimitedWithIOException(PARSER, input); | ||
| 324 | - } | ||
| 325 | - public static Protocol parseDelimitedFrom( | ||
| 326 | - java.io.InputStream input, | ||
| 327 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 328 | - throws java.io.IOException { | ||
| 329 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 330 | - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); | ||
| 331 | - } | ||
| 332 | - public static Protocol parseFrom( | ||
| 333 | - com.google.protobuf.CodedInputStream input) | ||
| 334 | - throws java.io.IOException { | ||
| 335 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 336 | - .parseWithIOException(PARSER, input); | ||
| 337 | - } | ||
| 338 | - public static Protocol parseFrom( | ||
| 339 | - com.google.protobuf.CodedInputStream input, | ||
| 340 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 341 | - throws java.io.IOException { | ||
| 342 | - return com.google.protobuf.GeneratedMessageV3 | ||
| 343 | - .parseWithIOException(PARSER, input, extensionRegistry); | ||
| 344 | - } | ||
| 345 | - | ||
| 346 | - public Builder newBuilderForType() { return newBuilder(); } | ||
| 347 | - public static Builder newBuilder() { | ||
| 348 | - return DEFAULT_INSTANCE.toBuilder(); | ||
| 349 | - } | ||
| 350 | - public static Builder newBuilder(Protocol prototype) { | ||
| 351 | - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); | ||
| 352 | - } | ||
| 353 | - public Builder toBuilder() { | ||
| 354 | - return this == DEFAULT_INSTANCE | ||
| 355 | - ? new Builder() : new Builder().mergeFrom(this); | ||
| 356 | - } | ||
| 357 | - | ||
| 358 | - @Override | ||
| 359 | - protected Builder newBuilderForType( | ||
| 360 | - BuilderParent parent) { | ||
| 361 | - Builder builder = new Builder(parent); | ||
| 362 | - return builder; | ||
| 363 | - } | ||
| 364 | - /** | ||
| 365 | - * Protobuf type {@code protocol.Protocol} | ||
| 366 | - */ | ||
| 367 | - public static final class Builder extends | ||
| 368 | - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements | ||
| 369 | - // @@protoc_insertion_point(builder_implements:protocol.Protocol) | ||
| 370 | - ProtocolOrBuilder { | ||
| 371 | - public static final com.google.protobuf.Descriptors.Descriptor | ||
| 372 | - getDescriptor() { | ||
| 373 | - return BaseProto.internal_static_protocol_Protocol_descriptor; | ||
| 374 | - } | ||
| 375 | - | ||
| 376 | - protected FieldAccessorTable | ||
| 377 | - internalGetFieldAccessorTable() { | ||
| 378 | - return BaseProto.internal_static_protocol_Protocol_fieldAccessorTable | ||
| 379 | - .ensureFieldAccessorsInitialized( | ||
| 380 | - Protocol.class, Builder.class); | ||
| 381 | - } | ||
| 382 | - | ||
| 383 | - // Construct using com.crossoverjie.netty.action.protocol.BaseProto.Protocol.newBuilder() | ||
| 384 | - private Builder() { | ||
| 385 | - maybeForceBuilderInitialization(); | ||
| 386 | - } | ||
| 387 | - | ||
| 388 | - private Builder( | ||
| 389 | - BuilderParent parent) { | ||
| 390 | - super(parent); | ||
| 391 | - maybeForceBuilderInitialization(); | ||
| 392 | - } | ||
| 393 | - private void maybeForceBuilderInitialization() { | ||
| 394 | - if (com.google.protobuf.GeneratedMessageV3 | ||
| 395 | - .alwaysUseFieldBuilders) { | ||
| 396 | - } | ||
| 397 | - } | ||
| 398 | - public Builder clear() { | ||
| 399 | - super.clear(); | ||
| 400 | - header_ = 0; | ||
| 401 | - bitField0_ = (bitField0_ & ~0x00000001); | ||
| 402 | - msg_ = ""; | ||
| 403 | - bitField0_ = (bitField0_ & ~0x00000002); | ||
| 404 | - return this; | ||
| 405 | - } | ||
| 406 | - | ||
| 407 | - public com.google.protobuf.Descriptors.Descriptor | ||
| 408 | - getDescriptorForType() { | ||
| 409 | - return BaseProto.internal_static_protocol_Protocol_descriptor; | ||
| 410 | - } | ||
| 411 | - | ||
| 412 | - public Protocol getDefaultInstanceForType() { | ||
| 413 | - return Protocol.getDefaultInstance(); | ||
| 414 | - } | ||
| 415 | - | ||
| 416 | - public Protocol build() { | ||
| 417 | - Protocol result = buildPartial(); | ||
| 418 | - if (!result.isInitialized()) { | ||
| 419 | - throw newUninitializedMessageException(result); | ||
| 420 | - } | ||
| 421 | - return result; | ||
| 422 | - } | ||
| 423 | - | ||
| 424 | - public Protocol buildPartial() { | ||
| 425 | - Protocol result = new Protocol(this); | ||
| 426 | - int from_bitField0_ = bitField0_; | ||
| 427 | - int to_bitField0_ = 0; | ||
| 428 | - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { | ||
| 429 | - to_bitField0_ |= 0x00000001; | ||
| 430 | - } | ||
| 431 | - result.header_ = header_; | ||
| 432 | - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { | ||
| 433 | - to_bitField0_ |= 0x00000002; | ||
| 434 | - } | ||
| 435 | - result.msg_ = msg_; | ||
| 436 | - result.bitField0_ = to_bitField0_; | ||
| 437 | - onBuilt(); | ||
| 438 | - return result; | ||
| 439 | - } | ||
| 440 | - | ||
| 441 | - public Builder clone() { | ||
| 442 | - return (Builder) super.clone(); | ||
| 443 | - } | ||
| 444 | - public Builder setField( | ||
| 445 | - com.google.protobuf.Descriptors.FieldDescriptor field, | ||
| 446 | - Object value) { | ||
| 447 | - return (Builder) super.setField(field, value); | ||
| 448 | - } | ||
| 449 | - public Builder clearField( | ||
| 450 | - com.google.protobuf.Descriptors.FieldDescriptor field) { | ||
| 451 | - return (Builder) super.clearField(field); | ||
| 452 | - } | ||
| 453 | - public Builder clearOneof( | ||
| 454 | - com.google.protobuf.Descriptors.OneofDescriptor oneof) { | ||
| 455 | - return (Builder) super.clearOneof(oneof); | ||
| 456 | - } | ||
| 457 | - public Builder setRepeatedField( | ||
| 458 | - com.google.protobuf.Descriptors.FieldDescriptor field, | ||
| 459 | - int index, Object value) { | ||
| 460 | - return (Builder) super.setRepeatedField(field, index, value); | ||
| 461 | - } | ||
| 462 | - public Builder addRepeatedField( | ||
| 463 | - com.google.protobuf.Descriptors.FieldDescriptor field, | ||
| 464 | - Object value) { | ||
| 465 | - return (Builder) super.addRepeatedField(field, value); | ||
| 466 | - } | ||
| 467 | - public Builder mergeFrom(com.google.protobuf.Message other) { | ||
| 468 | - if (other instanceof Protocol) { | ||
| 469 | - return mergeFrom((Protocol)other); | ||
| 470 | - } else { | ||
| 471 | - super.mergeFrom(other); | ||
| 472 | - return this; | ||
| 473 | - } | ||
| 474 | - } | ||
| 475 | - | ||
| 476 | - public Builder mergeFrom(Protocol other) { | ||
| 477 | - if (other == Protocol.getDefaultInstance()) return this; | ||
| 478 | - if (other.hasHeader()) { | ||
| 479 | - setHeader(other.getHeader()); | ||
| 480 | - } | ||
| 481 | - if (other.hasMsg()) { | ||
| 482 | - bitField0_ |= 0x00000002; | ||
| 483 | - msg_ = other.msg_; | ||
| 484 | - onChanged(); | ||
| 485 | - } | ||
| 486 | - this.mergeUnknownFields(other.unknownFields); | ||
| 487 | - onChanged(); | ||
| 488 | - return this; | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - public final boolean isInitialized() { | ||
| 492 | - if (!hasHeader()) { | ||
| 493 | - return false; | ||
| 494 | - } | ||
| 495 | - if (!hasMsg()) { | ||
| 496 | - return false; | ||
| 497 | - } | ||
| 498 | - return true; | ||
| 499 | - } | ||
| 500 | - | ||
| 501 | - public Builder mergeFrom( | ||
| 502 | - com.google.protobuf.CodedInputStream input, | ||
| 503 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 504 | - throws java.io.IOException { | ||
| 505 | - Protocol parsedMessage = null; | ||
| 506 | - try { | ||
| 507 | - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); | ||
| 508 | - } catch (com.google.protobuf.InvalidProtocolBufferException e) { | ||
| 509 | - parsedMessage = (Protocol) e.getUnfinishedMessage(); | ||
| 510 | - throw e.unwrapIOException(); | ||
| 511 | - } finally { | ||
| 512 | - if (parsedMessage != null) { | ||
| 513 | - mergeFrom(parsedMessage); | ||
| 514 | - } | ||
| 515 | - } | ||
| 516 | - return this; | ||
| 517 | - } | ||
| 518 | - private int bitField0_; | ||
| 519 | - | ||
| 520 | - private int header_ ; | ||
| 521 | - /** | ||
| 522 | - * <code>required int32 header = 2;</code> | ||
| 523 | - */ | ||
| 524 | - public boolean hasHeader() { | ||
| 525 | - return ((bitField0_ & 0x00000001) == 0x00000001); | ||
| 526 | - } | ||
| 527 | - /** | ||
| 528 | - * <code>required int32 header = 2;</code> | ||
| 529 | - */ | ||
| 530 | - public int getHeader() { | ||
| 531 | - return header_; | ||
| 532 | - } | ||
| 533 | - /** | ||
| 534 | - * <code>required int32 header = 2;</code> | ||
| 535 | - */ | ||
| 536 | - public Builder setHeader(int value) { | ||
| 537 | - bitField0_ |= 0x00000001; | ||
| 538 | - header_ = value; | ||
| 539 | - onChanged(); | ||
| 540 | - return this; | ||
| 541 | - } | ||
| 542 | - /** | ||
| 543 | - * <code>required int32 header = 2;</code> | ||
| 544 | - */ | ||
| 545 | - public Builder clearHeader() { | ||
| 546 | - bitField0_ = (bitField0_ & ~0x00000001); | ||
| 547 | - header_ = 0; | ||
| 548 | - onChanged(); | ||
| 549 | - return this; | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - private Object msg_ = ""; | ||
| 553 | - /** | ||
| 554 | - * <code>required string msg = 1;</code> | ||
| 555 | - */ | ||
| 556 | - public boolean hasMsg() { | ||
| 557 | - return ((bitField0_ & 0x00000002) == 0x00000002); | ||
| 558 | - } | ||
| 559 | - /** | ||
| 560 | - * <code>required string msg = 1;</code> | ||
| 561 | - */ | ||
| 562 | - public String getMsg() { | ||
| 563 | - Object ref = msg_; | ||
| 564 | - if (!(ref instanceof String)) { | ||
| 565 | - com.google.protobuf.ByteString bs = | ||
| 566 | - (com.google.protobuf.ByteString) ref; | ||
| 567 | - String s = bs.toStringUtf8(); | ||
| 568 | - if (bs.isValidUtf8()) { | ||
| 569 | - msg_ = s; | ||
| 570 | - } | ||
| 571 | - return s; | ||
| 572 | - } else { | ||
| 573 | - return (String) ref; | ||
| 574 | - } | ||
| 575 | - } | ||
| 576 | - /** | ||
| 577 | - * <code>required string msg = 1;</code> | ||
| 578 | - */ | ||
| 579 | - public com.google.protobuf.ByteString | ||
| 580 | - getMsgBytes() { | ||
| 581 | - Object ref = msg_; | ||
| 582 | - if (ref instanceof String) { | ||
| 583 | - com.google.protobuf.ByteString b = | ||
| 584 | - com.google.protobuf.ByteString.copyFromUtf8( | ||
| 585 | - (String) ref); | ||
| 586 | - msg_ = b; | ||
| 587 | - return b; | ||
| 588 | - } else { | ||
| 589 | - return (com.google.protobuf.ByteString) ref; | ||
| 590 | - } | ||
| 591 | - } | ||
| 592 | - /** | ||
| 593 | - * <code>required string msg = 1;</code> | ||
| 594 | - */ | ||
| 595 | - public Builder setMsg( | ||
| 596 | - String value) { | ||
| 597 | - if (value == null) { | ||
| 598 | - throw new NullPointerException(); | ||
| 599 | - } | ||
| 600 | - bitField0_ |= 0x00000002; | ||
| 601 | - msg_ = value; | ||
| 602 | - onChanged(); | ||
| 603 | - return this; | ||
| 604 | - } | ||
| 605 | - /** | ||
| 606 | - * <code>required string msg = 1;</code> | ||
| 607 | - */ | ||
| 608 | - public Builder clearMsg() { | ||
| 609 | - bitField0_ = (bitField0_ & ~0x00000002); | ||
| 610 | - msg_ = getDefaultInstance().getMsg(); | ||
| 611 | - onChanged(); | ||
| 612 | - return this; | ||
| 613 | - } | ||
| 614 | - /** | ||
| 615 | - * <code>required string msg = 1;</code> | ||
| 616 | - */ | ||
| 617 | - public Builder setMsgBytes( | ||
| 618 | - com.google.protobuf.ByteString value) { | ||
| 619 | - if (value == null) { | ||
| 620 | - throw new NullPointerException(); | ||
| 621 | - } | ||
| 622 | - bitField0_ |= 0x00000002; | ||
| 623 | - msg_ = value; | ||
| 624 | - onChanged(); | ||
| 625 | - return this; | ||
| 626 | - } | ||
| 627 | - public final Builder setUnknownFields( | ||
| 628 | - final com.google.protobuf.UnknownFieldSet unknownFields) { | ||
| 629 | - return super.setUnknownFields(unknownFields); | ||
| 630 | - } | ||
| 631 | - | ||
| 632 | - public final Builder mergeUnknownFields( | ||
| 633 | - final com.google.protobuf.UnknownFieldSet unknownFields) { | ||
| 634 | - return super.mergeUnknownFields(unknownFields); | ||
| 635 | - } | ||
| 636 | - | ||
| 637 | - | ||
| 638 | - // @@protoc_insertion_point(builder_scope:protocol.Protocol) | ||
| 639 | - } | ||
| 640 | - | ||
| 641 | - // @@protoc_insertion_point(class_scope:protocol.Protocol) | ||
| 642 | - private static final Protocol DEFAULT_INSTANCE; | ||
| 643 | - static { | ||
| 644 | - DEFAULT_INSTANCE = new Protocol(); | ||
| 645 | - } | ||
| 646 | - | ||
| 647 | - public static Protocol getDefaultInstance() { | ||
| 648 | - return DEFAULT_INSTANCE; | ||
| 649 | - } | ||
| 650 | - | ||
| 651 | - @Deprecated public static final com.google.protobuf.Parser<Protocol> | ||
| 652 | - PARSER = new com.google.protobuf.AbstractParser<Protocol>() { | ||
| 653 | - public Protocol parsePartialFrom( | ||
| 654 | - com.google.protobuf.CodedInputStream input, | ||
| 655 | - com.google.protobuf.ExtensionRegistryLite extensionRegistry) | ||
| 656 | - throws com.google.protobuf.InvalidProtocolBufferException { | ||
| 657 | - return new Protocol(input, extensionRegistry); | ||
| 658 | - } | ||
| 659 | - }; | ||
| 660 | - | ||
| 661 | - public static com.google.protobuf.Parser<Protocol> parser() { | ||
| 662 | - return PARSER; | ||
| 663 | - } | ||
| 664 | - | ||
| 665 | - @Override | ||
| 666 | - public com.google.protobuf.Parser<Protocol> getParserForType() { | ||
| 667 | - return PARSER; | ||
| 668 | - } | ||
| 669 | - | ||
| 670 | - public Protocol getDefaultInstanceForType() { | ||
| 671 | - return DEFAULT_INSTANCE; | ||
| 672 | - } | ||
| 673 | - | ||
| 674 | - } | ||
| 675 | - | ||
| 676 | - private static final com.google.protobuf.Descriptors.Descriptor | ||
| 677 | - internal_static_protocol_Protocol_descriptor; | ||
| 678 | - private static final | ||
| 679 | - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable | ||
| 680 | - internal_static_protocol_Protocol_fieldAccessorTable; | ||
| 681 | - | ||
| 682 | - public static com.google.protobuf.Descriptors.FileDescriptor | ||
| 683 | - getDescriptor() { | ||
| 684 | - return descriptor; | ||
| 685 | - } | ||
| 686 | - private static com.google.protobuf.Descriptors.FileDescriptor | ||
| 687 | - descriptor; | ||
| 688 | - static { | ||
| 689 | - String[] descriptorData = { | ||
| 690 | - "\n\020BaseProtoc.proto\022\010protocol\"\'\n\010Protocol" + | ||
| 691 | - "\022\016\n\006header\030\002 \002(\005\022\013\n\003msg\030\001 \002(\tB3\n&com.cro" + | ||
| 692 | - "ssoverjie.netty.action.protocolB\tBasePro" + | ||
| 693 | - "to" | ||
| 694 | - }; | ||
| 695 | - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = | ||
| 696 | - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { | ||
| 697 | - public com.google.protobuf.ExtensionRegistry assignDescriptors( | ||
| 698 | - com.google.protobuf.Descriptors.FileDescriptor root) { | ||
| 699 | - descriptor = root; | ||
| 700 | - return null; | ||
| 701 | - } | ||
| 702 | - }; | ||
| 703 | - com.google.protobuf.Descriptors.FileDescriptor | ||
| 704 | - .internalBuildGeneratedFileFrom(descriptorData, | ||
| 705 | - new com.google.protobuf.Descriptors.FileDescriptor[] { | ||
| 706 | - }, assigner); | ||
| 707 | - internal_static_protocol_Protocol_descriptor = | ||
| 708 | - getDescriptor().getMessageTypes().get(0); | ||
| 709 | - internal_static_protocol_Protocol_fieldAccessorTable = new | ||
| 710 | - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( | ||
| 711 | - internal_static_protocol_Protocol_descriptor, | ||
| 712 | - new String[] { "Header", "Msg", }); | ||
| 713 | - } | ||
| 714 | - | ||
| 715 | - // @@protoc_insertion_point(outer_class_scope) | ||
| 716 | -} |
| @@ -3,8 +3,8 @@ | @@ -3,8 +3,8 @@ | ||
| 3 | 3 | ||
| 4 | package com.crossoverjie.cim.common.protocol; | 4 | package com.crossoverjie.cim.common.protocol; |
| 5 | 5 | ||
| 6 | -public final class BaseRequestProto { | ||
| 7 | - private BaseRequestProto() {} | 6 | +public final class CIMRequestProto { |
| 7 | + private CIMRequestProto() {} | ||
| 8 | public static void registerAllExtensions( | 8 | public static void registerAllExtensions( |
| 9 | com.google.protobuf.ExtensionRegistryLite registry) { | 9 | com.google.protobuf.ExtensionRegistryLite registry) { |
| 10 | } | 10 | } |
| @@ -14,8 +14,8 @@ public final class BaseRequestProto { | @@ -14,8 +14,8 @@ public final class BaseRequestProto { | ||
| 14 | registerAllExtensions( | 14 | registerAllExtensions( |
| 15 | (com.google.protobuf.ExtensionRegistryLite) registry); | 15 | (com.google.protobuf.ExtensionRegistryLite) registry); |
| 16 | } | 16 | } |
| 17 | - public interface RequestProtocolOrBuilder extends | ||
| 18 | - // @@protoc_insertion_point(interface_extends:protocol.RequestProtocol) | 17 | + public interface CIMReqProtocolOrBuilder extends |
| 18 | + // @@protoc_insertion_point(interface_extends:protocol.CIMReqProtocol) | ||
| 19 | com.google.protobuf.MessageOrBuilder { | 19 | com.google.protobuf.MessageOrBuilder { |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| @@ -42,18 +42,18 @@ public final class BaseRequestProto { | @@ -42,18 +42,18 @@ public final class BaseRequestProto { | ||
| 42 | getReqMsgBytes(); | 42 | getReqMsgBytes(); |
| 43 | } | 43 | } |
| 44 | /** | 44 | /** |
| 45 | - * Protobuf type {@code protocol.RequestProtocol} | 45 | + * Protobuf type {@code protocol.CIMReqProtocol} |
| 46 | */ | 46 | */ |
| 47 | - public static final class RequestProtocol extends | 47 | + public static final class CIMReqProtocol extends |
| 48 | com.google.protobuf.GeneratedMessageV3 implements | 48 | com.google.protobuf.GeneratedMessageV3 implements |
| 49 | - // @@protoc_insertion_point(message_implements:protocol.RequestProtocol) | ||
| 50 | - RequestProtocolOrBuilder { | 49 | + // @@protoc_insertion_point(message_implements:protocol.CIMReqProtocol) |
| 50 | + CIMReqProtocolOrBuilder { | ||
| 51 | private static final long serialVersionUID = 0L; | 51 | private static final long serialVersionUID = 0L; |
| 52 | - // Use RequestProtocol.newBuilder() to construct. | ||
| 53 | - private RequestProtocol(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { | 52 | + // Use CIMReqProtocol.newBuilder() to construct. |
| 53 | + private CIMReqProtocol(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { | ||
| 54 | super(builder); | 54 | super(builder); |
| 55 | } | 55 | } |
| 56 | - private RequestProtocol() { | 56 | + private CIMReqProtocol() { |
| 57 | requestId_ = 0; | 57 | requestId_ = 0; |
| 58 | reqMsg_ = ""; | 58 | reqMsg_ = ""; |
| 59 | } | 59 | } |
| @@ -63,7 +63,7 @@ public final class BaseRequestProto { | @@ -63,7 +63,7 @@ public final class BaseRequestProto { | ||
| 63 | getUnknownFields() { | 63 | getUnknownFields() { |
| 64 | return this.unknownFields; | 64 | return this.unknownFields; |
| 65 | } | 65 | } |
| 66 | - private RequestProtocol( | 66 | + private CIMReqProtocol( |
| 67 | com.google.protobuf.CodedInputStream input, | 67 | com.google.protobuf.CodedInputStream input, |
| 68 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 68 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 69 | throws com.google.protobuf.InvalidProtocolBufferException { | 69 | throws com.google.protobuf.InvalidProtocolBufferException { |
| @@ -114,14 +114,14 @@ public final class BaseRequestProto { | @@ -114,14 +114,14 @@ public final class BaseRequestProto { | ||
| 114 | } | 114 | } |
| 115 | public static final com.google.protobuf.Descriptors.Descriptor | 115 | public static final com.google.protobuf.Descriptors.Descriptor |
| 116 | getDescriptor() { | 116 | getDescriptor() { |
| 117 | - return BaseRequestProto.internal_static_protocol_RequestProtocol_descriptor; | 117 | + return CIMRequestProto.internal_static_protocol_CIMReqProtocol_descriptor; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | protected FieldAccessorTable | 120 | protected FieldAccessorTable |
| 121 | internalGetFieldAccessorTable() { | 121 | internalGetFieldAccessorTable() { |
| 122 | - return BaseRequestProto.internal_static_protocol_RequestProtocol_fieldAccessorTable | 122 | + return CIMRequestProto.internal_static_protocol_CIMReqProtocol_fieldAccessorTable |
| 123 | .ensureFieldAccessorsInitialized( | 123 | .ensureFieldAccessorsInitialized( |
| 124 | - RequestProtocol.class, Builder.class); | 124 | + CIMReqProtocol.class, Builder.class); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | private int bitField0_; | 127 | private int bitField0_; |
| @@ -233,10 +233,10 @@ public final class BaseRequestProto { | @@ -233,10 +233,10 @@ public final class BaseRequestProto { | ||
| 233 | if (obj == this) { | 233 | if (obj == this) { |
| 234 | return true; | 234 | return true; |
| 235 | } | 235 | } |
| 236 | - if (!(obj instanceof RequestProtocol)) { | 236 | + if (!(obj instanceof CIMReqProtocol)) { |
| 237 | return super.equals(obj); | 237 | return super.equals(obj); |
| 238 | } | 238 | } |
| 239 | - RequestProtocol other = (RequestProtocol) obj; | 239 | + CIMReqProtocol other = (CIMReqProtocol) obj; |
| 240 | 240 | ||
| 241 | boolean result = true; | 241 | boolean result = true; |
| 242 | result = result && (hasRequestId() == other.hasRequestId()); | 242 | result = result && (hasRequestId() == other.hasRequestId()); |
| @@ -273,69 +273,69 @@ public final class BaseRequestProto { | @@ -273,69 +273,69 @@ public final class BaseRequestProto { | ||
| 273 | return hash; | 273 | return hash; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | - public static RequestProtocol parseFrom( | 276 | + public static CIMReqProtocol parseFrom( |
| 277 | java.nio.ByteBuffer data) | 277 | java.nio.ByteBuffer data) |
| 278 | throws com.google.protobuf.InvalidProtocolBufferException { | 278 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 279 | return PARSER.parseFrom(data); | 279 | return PARSER.parseFrom(data); |
| 280 | } | 280 | } |
| 281 | - public static RequestProtocol parseFrom( | 281 | + public static CIMReqProtocol parseFrom( |
| 282 | java.nio.ByteBuffer data, | 282 | java.nio.ByteBuffer data, |
| 283 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 283 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 284 | throws com.google.protobuf.InvalidProtocolBufferException { | 284 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 285 | return PARSER.parseFrom(data, extensionRegistry); | 285 | return PARSER.parseFrom(data, extensionRegistry); |
| 286 | } | 286 | } |
| 287 | - public static RequestProtocol parseFrom( | 287 | + public static CIMReqProtocol parseFrom( |
| 288 | com.google.protobuf.ByteString data) | 288 | com.google.protobuf.ByteString data) |
| 289 | throws com.google.protobuf.InvalidProtocolBufferException { | 289 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 290 | return PARSER.parseFrom(data); | 290 | return PARSER.parseFrom(data); |
| 291 | } | 291 | } |
| 292 | - public static RequestProtocol parseFrom( | 292 | + public static CIMReqProtocol parseFrom( |
| 293 | com.google.protobuf.ByteString data, | 293 | com.google.protobuf.ByteString data, |
| 294 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 294 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 295 | throws com.google.protobuf.InvalidProtocolBufferException { | 295 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 296 | return PARSER.parseFrom(data, extensionRegistry); | 296 | return PARSER.parseFrom(data, extensionRegistry); |
| 297 | } | 297 | } |
| 298 | - public static RequestProtocol parseFrom(byte[] data) | 298 | + public static CIMReqProtocol parseFrom(byte[] data) |
| 299 | throws com.google.protobuf.InvalidProtocolBufferException { | 299 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 300 | return PARSER.parseFrom(data); | 300 | return PARSER.parseFrom(data); |
| 301 | } | 301 | } |
| 302 | - public static RequestProtocol parseFrom( | 302 | + public static CIMReqProtocol parseFrom( |
| 303 | byte[] data, | 303 | byte[] data, |
| 304 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 304 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 305 | throws com.google.protobuf.InvalidProtocolBufferException { | 305 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 306 | return PARSER.parseFrom(data, extensionRegistry); | 306 | return PARSER.parseFrom(data, extensionRegistry); |
| 307 | } | 307 | } |
| 308 | - public static RequestProtocol parseFrom(java.io.InputStream input) | 308 | + public static CIMReqProtocol parseFrom(java.io.InputStream input) |
| 309 | throws java.io.IOException { | 309 | throws java.io.IOException { |
| 310 | return com.google.protobuf.GeneratedMessageV3 | 310 | return com.google.protobuf.GeneratedMessageV3 |
| 311 | .parseWithIOException(PARSER, input); | 311 | .parseWithIOException(PARSER, input); |
| 312 | } | 312 | } |
| 313 | - public static RequestProtocol parseFrom( | 313 | + public static CIMReqProtocol parseFrom( |
| 314 | java.io.InputStream input, | 314 | java.io.InputStream input, |
| 315 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 315 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 316 | throws java.io.IOException { | 316 | throws java.io.IOException { |
| 317 | return com.google.protobuf.GeneratedMessageV3 | 317 | return com.google.protobuf.GeneratedMessageV3 |
| 318 | .parseWithIOException(PARSER, input, extensionRegistry); | 318 | .parseWithIOException(PARSER, input, extensionRegistry); |
| 319 | } | 319 | } |
| 320 | - public static RequestProtocol parseDelimitedFrom(java.io.InputStream input) | 320 | + public static CIMReqProtocol parseDelimitedFrom(java.io.InputStream input) |
| 321 | throws java.io.IOException { | 321 | throws java.io.IOException { |
| 322 | return com.google.protobuf.GeneratedMessageV3 | 322 | return com.google.protobuf.GeneratedMessageV3 |
| 323 | .parseDelimitedWithIOException(PARSER, input); | 323 | .parseDelimitedWithIOException(PARSER, input); |
| 324 | } | 324 | } |
| 325 | - public static RequestProtocol parseDelimitedFrom( | 325 | + public static CIMReqProtocol parseDelimitedFrom( |
| 326 | java.io.InputStream input, | 326 | java.io.InputStream input, |
| 327 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 327 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 328 | throws java.io.IOException { | 328 | throws java.io.IOException { |
| 329 | return com.google.protobuf.GeneratedMessageV3 | 329 | return com.google.protobuf.GeneratedMessageV3 |
| 330 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); | 330 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); |
| 331 | } | 331 | } |
| 332 | - public static RequestProtocol parseFrom( | 332 | + public static CIMReqProtocol parseFrom( |
| 333 | com.google.protobuf.CodedInputStream input) | 333 | com.google.protobuf.CodedInputStream input) |
| 334 | throws java.io.IOException { | 334 | throws java.io.IOException { |
| 335 | return com.google.protobuf.GeneratedMessageV3 | 335 | return com.google.protobuf.GeneratedMessageV3 |
| 336 | .parseWithIOException(PARSER, input); | 336 | .parseWithIOException(PARSER, input); |
| 337 | } | 337 | } |
| 338 | - public static RequestProtocol parseFrom( | 338 | + public static CIMReqProtocol parseFrom( |
| 339 | com.google.protobuf.CodedInputStream input, | 339 | com.google.protobuf.CodedInputStream input, |
| 340 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 340 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 341 | throws java.io.IOException { | 341 | throws java.io.IOException { |
| @@ -347,7 +347,7 @@ public final class BaseRequestProto { | @@ -347,7 +347,7 @@ public final class BaseRequestProto { | ||
| 347 | public static Builder newBuilder() { | 347 | public static Builder newBuilder() { |
| 348 | return DEFAULT_INSTANCE.toBuilder(); | 348 | return DEFAULT_INSTANCE.toBuilder(); |
| 349 | } | 349 | } |
| 350 | - public static Builder newBuilder(RequestProtocol prototype) { | 350 | + public static Builder newBuilder(CIMReqProtocol prototype) { |
| 351 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); | 351 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); |
| 352 | } | 352 | } |
| 353 | public Builder toBuilder() { | 353 | public Builder toBuilder() { |
| @@ -362,25 +362,25 @@ public final class BaseRequestProto { | @@ -362,25 +362,25 @@ public final class BaseRequestProto { | ||
| 362 | return builder; | 362 | return builder; |
| 363 | } | 363 | } |
| 364 | /** | 364 | /** |
| 365 | - * Protobuf type {@code protocol.RequestProtocol} | 365 | + * Protobuf type {@code protocol.CIMReqProtocol} |
| 366 | */ | 366 | */ |
| 367 | public static final class Builder extends | 367 | public static final class Builder extends |
| 368 | com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements | 368 | com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements |
| 369 | - // @@protoc_insertion_point(builder_implements:protocol.RequestProtocol) | ||
| 370 | - RequestProtocolOrBuilder { | 369 | + // @@protoc_insertion_point(builder_implements:protocol.CIMReqProtocol) |
| 370 | + CIMReqProtocolOrBuilder { | ||
| 371 | public static final com.google.protobuf.Descriptors.Descriptor | 371 | public static final com.google.protobuf.Descriptors.Descriptor |
| 372 | getDescriptor() { | 372 | getDescriptor() { |
| 373 | - return BaseRequestProto.internal_static_protocol_RequestProtocol_descriptor; | 373 | + return CIMRequestProto.internal_static_protocol_CIMReqProtocol_descriptor; |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | protected FieldAccessorTable | 376 | protected FieldAccessorTable |
| 377 | internalGetFieldAccessorTable() { | 377 | internalGetFieldAccessorTable() { |
| 378 | - return BaseRequestProto.internal_static_protocol_RequestProtocol_fieldAccessorTable | 378 | + return CIMRequestProto.internal_static_protocol_CIMReqProtocol_fieldAccessorTable |
| 379 | .ensureFieldAccessorsInitialized( | 379 | .ensureFieldAccessorsInitialized( |
| 380 | - RequestProtocol.class, Builder.class); | 380 | + CIMReqProtocol.class, Builder.class); |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | - // Construct using com.crossoverjie.netty.action.protocol.BaseRequestProto.RequestProtocol.newBuilder() | 383 | + // Construct using com.crossoverjie.cim.common.protocol.CIMRequestProto.CIMReqProtocol.newBuilder() |
| 384 | private Builder() { | 384 | private Builder() { |
| 385 | maybeForceBuilderInitialization(); | 385 | maybeForceBuilderInitialization(); |
| 386 | } | 386 | } |
| @@ -406,23 +406,23 @@ public final class BaseRequestProto { | @@ -406,23 +406,23 @@ public final class BaseRequestProto { | ||
| 406 | 406 | ||
| 407 | public com.google.protobuf.Descriptors.Descriptor | 407 | public com.google.protobuf.Descriptors.Descriptor |
| 408 | getDescriptorForType() { | 408 | getDescriptorForType() { |
| 409 | - return BaseRequestProto.internal_static_protocol_RequestProtocol_descriptor; | 409 | + return CIMRequestProto.internal_static_protocol_CIMReqProtocol_descriptor; |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | - public RequestProtocol getDefaultInstanceForType() { | ||
| 413 | - return RequestProtocol.getDefaultInstance(); | 412 | + public CIMReqProtocol getDefaultInstanceForType() { |
| 413 | + return CIMReqProtocol.getDefaultInstance(); | ||
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | - public RequestProtocol build() { | ||
| 417 | - RequestProtocol result = buildPartial(); | 416 | + public CIMReqProtocol build() { |
| 417 | + CIMReqProtocol result = buildPartial(); | ||
| 418 | if (!result.isInitialized()) { | 418 | if (!result.isInitialized()) { |
| 419 | throw newUninitializedMessageException(result); | 419 | throw newUninitializedMessageException(result); |
| 420 | } | 420 | } |
| 421 | return result; | 421 | return result; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | - public RequestProtocol buildPartial() { | ||
| 425 | - RequestProtocol result = new RequestProtocol(this); | 424 | + public CIMReqProtocol buildPartial() { |
| 425 | + CIMReqProtocol result = new CIMReqProtocol(this); | ||
| 426 | int from_bitField0_ = bitField0_; | 426 | int from_bitField0_ = bitField0_; |
| 427 | int to_bitField0_ = 0; | 427 | int to_bitField0_ = 0; |
| 428 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) { | 428 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) { |
| @@ -465,16 +465,16 @@ public final class BaseRequestProto { | @@ -465,16 +465,16 @@ public final class BaseRequestProto { | ||
| 465 | return (Builder) super.addRepeatedField(field, value); | 465 | return (Builder) super.addRepeatedField(field, value); |
| 466 | } | 466 | } |
| 467 | public Builder mergeFrom(com.google.protobuf.Message other) { | 467 | public Builder mergeFrom(com.google.protobuf.Message other) { |
| 468 | - if (other instanceof RequestProtocol) { | ||
| 469 | - return mergeFrom((RequestProtocol)other); | 468 | + if (other instanceof CIMReqProtocol) { |
| 469 | + return mergeFrom((CIMReqProtocol)other); | ||
| 470 | } else { | 470 | } else { |
| 471 | super.mergeFrom(other); | 471 | super.mergeFrom(other); |
| 472 | return this; | 472 | return this; |
| 473 | } | 473 | } |
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | - public Builder mergeFrom(RequestProtocol other) { | ||
| 477 | - if (other == RequestProtocol.getDefaultInstance()) return this; | 476 | + public Builder mergeFrom(CIMReqProtocol other) { |
| 477 | + if (other == CIMReqProtocol.getDefaultInstance()) return this; | ||
| 478 | if (other.hasRequestId()) { | 478 | if (other.hasRequestId()) { |
| 479 | setRequestId(other.getRequestId()); | 479 | setRequestId(other.getRequestId()); |
| 480 | } | 480 | } |
| @@ -502,11 +502,11 @@ public final class BaseRequestProto { | @@ -502,11 +502,11 @@ public final class BaseRequestProto { | ||
| 502 | com.google.protobuf.CodedInputStream input, | 502 | com.google.protobuf.CodedInputStream input, |
| 503 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 503 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 504 | throws java.io.IOException { | 504 | throws java.io.IOException { |
| 505 | - RequestProtocol parsedMessage = null; | 505 | + CIMReqProtocol parsedMessage = null; |
| 506 | try { | 506 | try { |
| 507 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); | 507 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); |
| 508 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { | 508 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { |
| 509 | - parsedMessage = (RequestProtocol) e.getUnfinishedMessage(); | 509 | + parsedMessage = (CIMReqProtocol) e.getUnfinishedMessage(); |
| 510 | throw e.unwrapIOException(); | 510 | throw e.unwrapIOException(); |
| 511 | } finally { | 511 | } finally { |
| 512 | if (parsedMessage != null) { | 512 | if (parsedMessage != null) { |
| @@ -635,49 +635,49 @@ public final class BaseRequestProto { | @@ -635,49 +635,49 @@ public final class BaseRequestProto { | ||
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | 637 | ||
| 638 | - // @@protoc_insertion_point(builder_scope:protocol.RequestProtocol) | 638 | + // @@protoc_insertion_point(builder_scope:protocol.CIMReqProtocol) |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | - // @@protoc_insertion_point(class_scope:protocol.RequestProtocol) | ||
| 642 | - private static final RequestProtocol DEFAULT_INSTANCE; | 641 | + // @@protoc_insertion_point(class_scope:protocol.CIMReqProtocol) |
| 642 | + private static final CIMReqProtocol DEFAULT_INSTANCE; | ||
| 643 | static { | 643 | static { |
| 644 | - DEFAULT_INSTANCE = new RequestProtocol(); | 644 | + DEFAULT_INSTANCE = new CIMReqProtocol(); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | - public static RequestProtocol getDefaultInstance() { | 647 | + public static CIMReqProtocol getDefaultInstance() { |
| 648 | return DEFAULT_INSTANCE; | 648 | return DEFAULT_INSTANCE; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | - @Deprecated public static final com.google.protobuf.Parser<RequestProtocol> | ||
| 652 | - PARSER = new com.google.protobuf.AbstractParser<RequestProtocol>() { | ||
| 653 | - public RequestProtocol parsePartialFrom( | 651 | + @Deprecated public static final com.google.protobuf.Parser<CIMReqProtocol> |
| 652 | + PARSER = new com.google.protobuf.AbstractParser<CIMReqProtocol>() { | ||
| 653 | + public CIMReqProtocol parsePartialFrom( | ||
| 654 | com.google.protobuf.CodedInputStream input, | 654 | com.google.protobuf.CodedInputStream input, |
| 655 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 655 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 656 | throws com.google.protobuf.InvalidProtocolBufferException { | 656 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 657 | - return new RequestProtocol(input, extensionRegistry); | 657 | + return new CIMReqProtocol(input, extensionRegistry); |
| 658 | } | 658 | } |
| 659 | }; | 659 | }; |
| 660 | 660 | ||
| 661 | - public static com.google.protobuf.Parser<RequestProtocol> parser() { | 661 | + public static com.google.protobuf.Parser<CIMReqProtocol> parser() { |
| 662 | return PARSER; | 662 | return PARSER; |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | @Override | 665 | @Override |
| 666 | - public com.google.protobuf.Parser<RequestProtocol> getParserForType() { | 666 | + public com.google.protobuf.Parser<CIMReqProtocol> getParserForType() { |
| 667 | return PARSER; | 667 | return PARSER; |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | - public RequestProtocol getDefaultInstanceForType() { | 670 | + public CIMReqProtocol getDefaultInstanceForType() { |
| 671 | return DEFAULT_INSTANCE; | 671 | return DEFAULT_INSTANCE; |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | private static final com.google.protobuf.Descriptors.Descriptor | 676 | private static final com.google.protobuf.Descriptors.Descriptor |
| 677 | - internal_static_protocol_RequestProtocol_descriptor; | 677 | + internal_static_protocol_CIMReqProtocol_descriptor; |
| 678 | private static final | 678 | private static final |
| 679 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable | 679 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
| 680 | - internal_static_protocol_RequestProtocol_fieldAccessorTable; | 680 | + internal_static_protocol_CIMReqProtocol_fieldAccessorTable; |
| 681 | 681 | ||
| 682 | public static com.google.protobuf.Descriptors.FileDescriptor | 682 | public static com.google.protobuf.Descriptors.FileDescriptor |
| 683 | getDescriptor() { | 683 | getDescriptor() { |
| @@ -687,10 +687,10 @@ public final class BaseRequestProto { | @@ -687,10 +687,10 @@ public final class BaseRequestProto { | ||
| 687 | descriptor; | 687 | descriptor; |
| 688 | static { | 688 | static { |
| 689 | String[] descriptorData = { | 689 | String[] descriptorData = { |
| 690 | - "\n\026BaseRequestProto.proto\022\010protocol\"4\n\017Re" + | ||
| 691 | - "questProtocol\022\021\n\trequestId\030\002 \002(\005\022\016\n\006reqM" + | ||
| 692 | - "sg\030\001 \002(\tB:\n&com.crossoverjie.netty.actio" + | ||
| 693 | - "n.protocolB\020BaseRequestProto" | 690 | + "\n\026BaseRequestProto.proto\022\010protocol\"3\n\016CI" + |
| 691 | + "MReqProtocol\022\021\n\trequestId\030\002 \002(\005\022\016\n\006reqMs" + | ||
| 692 | + "g\030\001 \002(\tB7\n$com.crossoverjie.cim.common.p" + | ||
| 693 | + "rotocolB\017CIMRequestProto" | ||
| 694 | }; | 694 | }; |
| 695 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = | 695 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = |
| 696 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { | 696 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { |
| @@ -704,11 +704,11 @@ public final class BaseRequestProto { | @@ -704,11 +704,11 @@ public final class BaseRequestProto { | ||
| 704 | .internalBuildGeneratedFileFrom(descriptorData, | 704 | .internalBuildGeneratedFileFrom(descriptorData, |
| 705 | new com.google.protobuf.Descriptors.FileDescriptor[] { | 705 | new com.google.protobuf.Descriptors.FileDescriptor[] { |
| 706 | }, assigner); | 706 | }, assigner); |
| 707 | - internal_static_protocol_RequestProtocol_descriptor = | 707 | + internal_static_protocol_CIMReqProtocol_descriptor = |
| 708 | getDescriptor().getMessageTypes().get(0); | 708 | getDescriptor().getMessageTypes().get(0); |
| 709 | - internal_static_protocol_RequestProtocol_fieldAccessorTable = new | 709 | + internal_static_protocol_CIMReqProtocol_fieldAccessorTable = new |
| 710 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( | 710 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( |
| 711 | - internal_static_protocol_RequestProtocol_descriptor, | 711 | + internal_static_protocol_CIMReqProtocol_descriptor, |
| 712 | new String[] { "RequestId", "ReqMsg", }); | 712 | new String[] { "RequestId", "ReqMsg", }); |
| 713 | } | 713 | } |
| 714 | 714 |
| @@ -3,8 +3,8 @@ | @@ -3,8 +3,8 @@ | ||
| 3 | 3 | ||
| 4 | package com.crossoverjie.cim.common.protocol; | 4 | package com.crossoverjie.cim.common.protocol; |
| 5 | 5 | ||
| 6 | -public final class BaseResponseProto { | ||
| 7 | - private BaseResponseProto() {} | 6 | +public final class CIMResponseProto { |
| 7 | + private CIMResponseProto() {} | ||
| 8 | public static void registerAllExtensions( | 8 | public static void registerAllExtensions( |
| 9 | com.google.protobuf.ExtensionRegistryLite registry) { | 9 | com.google.protobuf.ExtensionRegistryLite registry) { |
| 10 | } | 10 | } |
| @@ -14,8 +14,8 @@ public final class BaseResponseProto { | @@ -14,8 +14,8 @@ public final class BaseResponseProto { | ||
| 14 | registerAllExtensions( | 14 | registerAllExtensions( |
| 15 | (com.google.protobuf.ExtensionRegistryLite) registry); | 15 | (com.google.protobuf.ExtensionRegistryLite) registry); |
| 16 | } | 16 | } |
| 17 | - public interface ResponseProtocolOrBuilder extends | ||
| 18 | - // @@protoc_insertion_point(interface_extends:protocol.ResponseProtocol) | 17 | + public interface CIMResProtocolOrBuilder extends |
| 18 | + // @@protoc_insertion_point(interface_extends:protocol.CIMResProtocol) | ||
| 19 | com.google.protobuf.MessageOrBuilder { | 19 | com.google.protobuf.MessageOrBuilder { |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| @@ -42,18 +42,18 @@ public final class BaseResponseProto { | @@ -42,18 +42,18 @@ public final class BaseResponseProto { | ||
| 42 | getResMsgBytes(); | 42 | getResMsgBytes(); |
| 43 | } | 43 | } |
| 44 | /** | 44 | /** |
| 45 | - * Protobuf type {@code protocol.ResponseProtocol} | 45 | + * Protobuf type {@code protocol.CIMResProtocol} |
| 46 | */ | 46 | */ |
| 47 | - public static final class ResponseProtocol extends | 47 | + public static final class CIMResProtocol extends |
| 48 | com.google.protobuf.GeneratedMessageV3 implements | 48 | com.google.protobuf.GeneratedMessageV3 implements |
| 49 | - // @@protoc_insertion_point(message_implements:protocol.ResponseProtocol) | ||
| 50 | - ResponseProtocolOrBuilder { | 49 | + // @@protoc_insertion_point(message_implements:protocol.CIMResProtocol) |
| 50 | + CIMResProtocolOrBuilder { | ||
| 51 | private static final long serialVersionUID = 0L; | 51 | private static final long serialVersionUID = 0L; |
| 52 | - // Use ResponseProtocol.newBuilder() to construct. | ||
| 53 | - private ResponseProtocol(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { | 52 | + // Use CIMResProtocol.newBuilder() to construct. |
| 53 | + private CIMResProtocol(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { | ||
| 54 | super(builder); | 54 | super(builder); |
| 55 | } | 55 | } |
| 56 | - private ResponseProtocol() { | 56 | + private CIMResProtocol() { |
| 57 | responseId_ = 0; | 57 | responseId_ = 0; |
| 58 | resMsg_ = ""; | 58 | resMsg_ = ""; |
| 59 | } | 59 | } |
| @@ -63,7 +63,7 @@ public final class BaseResponseProto { | @@ -63,7 +63,7 @@ public final class BaseResponseProto { | ||
| 63 | getUnknownFields() { | 63 | getUnknownFields() { |
| 64 | return this.unknownFields; | 64 | return this.unknownFields; |
| 65 | } | 65 | } |
| 66 | - private ResponseProtocol( | 66 | + private CIMResProtocol( |
| 67 | com.google.protobuf.CodedInputStream input, | 67 | com.google.protobuf.CodedInputStream input, |
| 68 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 68 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 69 | throws com.google.protobuf.InvalidProtocolBufferException { | 69 | throws com.google.protobuf.InvalidProtocolBufferException { |
| @@ -114,14 +114,14 @@ public final class BaseResponseProto { | @@ -114,14 +114,14 @@ public final class BaseResponseProto { | ||
| 114 | } | 114 | } |
| 115 | public static final com.google.protobuf.Descriptors.Descriptor | 115 | public static final com.google.protobuf.Descriptors.Descriptor |
| 116 | getDescriptor() { | 116 | getDescriptor() { |
| 117 | - return BaseResponseProto.internal_static_protocol_ResponseProtocol_descriptor; | 117 | + return CIMResponseProto.internal_static_protocol_CIMResProtocol_descriptor; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | protected FieldAccessorTable | 120 | protected FieldAccessorTable |
| 121 | internalGetFieldAccessorTable() { | 121 | internalGetFieldAccessorTable() { |
| 122 | - return BaseResponseProto.internal_static_protocol_ResponseProtocol_fieldAccessorTable | 122 | + return CIMResponseProto.internal_static_protocol_CIMResProtocol_fieldAccessorTable |
| 123 | .ensureFieldAccessorsInitialized( | 123 | .ensureFieldAccessorsInitialized( |
| 124 | - ResponseProtocol.class, Builder.class); | 124 | + CIMResProtocol.class, Builder.class); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | private int bitField0_; | 127 | private int bitField0_; |
| @@ -233,10 +233,10 @@ public final class BaseResponseProto { | @@ -233,10 +233,10 @@ public final class BaseResponseProto { | ||
| 233 | if (obj == this) { | 233 | if (obj == this) { |
| 234 | return true; | 234 | return true; |
| 235 | } | 235 | } |
| 236 | - if (!(obj instanceof ResponseProtocol)) { | 236 | + if (!(obj instanceof CIMResProtocol)) { |
| 237 | return super.equals(obj); | 237 | return super.equals(obj); |
| 238 | } | 238 | } |
| 239 | - ResponseProtocol other = (ResponseProtocol) obj; | 239 | + CIMResProtocol other = (CIMResProtocol) obj; |
| 240 | 240 | ||
| 241 | boolean result = true; | 241 | boolean result = true; |
| 242 | result = result && (hasResponseId() == other.hasResponseId()); | 242 | result = result && (hasResponseId() == other.hasResponseId()); |
| @@ -273,69 +273,69 @@ public final class BaseResponseProto { | @@ -273,69 +273,69 @@ public final class BaseResponseProto { | ||
| 273 | return hash; | 273 | return hash; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | - public static ResponseProtocol parseFrom( | 276 | + public static CIMResProtocol parseFrom( |
| 277 | java.nio.ByteBuffer data) | 277 | java.nio.ByteBuffer data) |
| 278 | throws com.google.protobuf.InvalidProtocolBufferException { | 278 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 279 | return PARSER.parseFrom(data); | 279 | return PARSER.parseFrom(data); |
| 280 | } | 280 | } |
| 281 | - public static ResponseProtocol parseFrom( | 281 | + public static CIMResProtocol parseFrom( |
| 282 | java.nio.ByteBuffer data, | 282 | java.nio.ByteBuffer data, |
| 283 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 283 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 284 | throws com.google.protobuf.InvalidProtocolBufferException { | 284 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 285 | return PARSER.parseFrom(data, extensionRegistry); | 285 | return PARSER.parseFrom(data, extensionRegistry); |
| 286 | } | 286 | } |
| 287 | - public static ResponseProtocol parseFrom( | 287 | + public static CIMResProtocol parseFrom( |
| 288 | com.google.protobuf.ByteString data) | 288 | com.google.protobuf.ByteString data) |
| 289 | throws com.google.protobuf.InvalidProtocolBufferException { | 289 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 290 | return PARSER.parseFrom(data); | 290 | return PARSER.parseFrom(data); |
| 291 | } | 291 | } |
| 292 | - public static ResponseProtocol parseFrom( | 292 | + public static CIMResProtocol parseFrom( |
| 293 | com.google.protobuf.ByteString data, | 293 | com.google.protobuf.ByteString data, |
| 294 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 294 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 295 | throws com.google.protobuf.InvalidProtocolBufferException { | 295 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 296 | return PARSER.parseFrom(data, extensionRegistry); | 296 | return PARSER.parseFrom(data, extensionRegistry); |
| 297 | } | 297 | } |
| 298 | - public static ResponseProtocol parseFrom(byte[] data) | 298 | + public static CIMResProtocol parseFrom(byte[] data) |
| 299 | throws com.google.protobuf.InvalidProtocolBufferException { | 299 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 300 | return PARSER.parseFrom(data); | 300 | return PARSER.parseFrom(data); |
| 301 | } | 301 | } |
| 302 | - public static ResponseProtocol parseFrom( | 302 | + public static CIMResProtocol parseFrom( |
| 303 | byte[] data, | 303 | byte[] data, |
| 304 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 304 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 305 | throws com.google.protobuf.InvalidProtocolBufferException { | 305 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 306 | return PARSER.parseFrom(data, extensionRegistry); | 306 | return PARSER.parseFrom(data, extensionRegistry); |
| 307 | } | 307 | } |
| 308 | - public static ResponseProtocol parseFrom(java.io.InputStream input) | 308 | + public static CIMResProtocol parseFrom(java.io.InputStream input) |
| 309 | throws java.io.IOException { | 309 | throws java.io.IOException { |
| 310 | return com.google.protobuf.GeneratedMessageV3 | 310 | return com.google.protobuf.GeneratedMessageV3 |
| 311 | .parseWithIOException(PARSER, input); | 311 | .parseWithIOException(PARSER, input); |
| 312 | } | 312 | } |
| 313 | - public static ResponseProtocol parseFrom( | 313 | + public static CIMResProtocol parseFrom( |
| 314 | java.io.InputStream input, | 314 | java.io.InputStream input, |
| 315 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 315 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 316 | throws java.io.IOException { | 316 | throws java.io.IOException { |
| 317 | return com.google.protobuf.GeneratedMessageV3 | 317 | return com.google.protobuf.GeneratedMessageV3 |
| 318 | .parseWithIOException(PARSER, input, extensionRegistry); | 318 | .parseWithIOException(PARSER, input, extensionRegistry); |
| 319 | } | 319 | } |
| 320 | - public static ResponseProtocol parseDelimitedFrom(java.io.InputStream input) | 320 | + public static CIMResProtocol parseDelimitedFrom(java.io.InputStream input) |
| 321 | throws java.io.IOException { | 321 | throws java.io.IOException { |
| 322 | return com.google.protobuf.GeneratedMessageV3 | 322 | return com.google.protobuf.GeneratedMessageV3 |
| 323 | .parseDelimitedWithIOException(PARSER, input); | 323 | .parseDelimitedWithIOException(PARSER, input); |
| 324 | } | 324 | } |
| 325 | - public static ResponseProtocol parseDelimitedFrom( | 325 | + public static CIMResProtocol parseDelimitedFrom( |
| 326 | java.io.InputStream input, | 326 | java.io.InputStream input, |
| 327 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 327 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 328 | throws java.io.IOException { | 328 | throws java.io.IOException { |
| 329 | return com.google.protobuf.GeneratedMessageV3 | 329 | return com.google.protobuf.GeneratedMessageV3 |
| 330 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); | 330 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry); |
| 331 | } | 331 | } |
| 332 | - public static ResponseProtocol parseFrom( | 332 | + public static CIMResProtocol parseFrom( |
| 333 | com.google.protobuf.CodedInputStream input) | 333 | com.google.protobuf.CodedInputStream input) |
| 334 | throws java.io.IOException { | 334 | throws java.io.IOException { |
| 335 | return com.google.protobuf.GeneratedMessageV3 | 335 | return com.google.protobuf.GeneratedMessageV3 |
| 336 | .parseWithIOException(PARSER, input); | 336 | .parseWithIOException(PARSER, input); |
| 337 | } | 337 | } |
| 338 | - public static ResponseProtocol parseFrom( | 338 | + public static CIMResProtocol parseFrom( |
| 339 | com.google.protobuf.CodedInputStream input, | 339 | com.google.protobuf.CodedInputStream input, |
| 340 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 340 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 341 | throws java.io.IOException { | 341 | throws java.io.IOException { |
| @@ -347,7 +347,7 @@ public final class BaseResponseProto { | @@ -347,7 +347,7 @@ public final class BaseResponseProto { | ||
| 347 | public static Builder newBuilder() { | 347 | public static Builder newBuilder() { |
| 348 | return DEFAULT_INSTANCE.toBuilder(); | 348 | return DEFAULT_INSTANCE.toBuilder(); |
| 349 | } | 349 | } |
| 350 | - public static Builder newBuilder(ResponseProtocol prototype) { | 350 | + public static Builder newBuilder(CIMResProtocol prototype) { |
| 351 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); | 351 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); |
| 352 | } | 352 | } |
| 353 | public Builder toBuilder() { | 353 | public Builder toBuilder() { |
| @@ -362,25 +362,25 @@ public final class BaseResponseProto { | @@ -362,25 +362,25 @@ public final class BaseResponseProto { | ||
| 362 | return builder; | 362 | return builder; |
| 363 | } | 363 | } |
| 364 | /** | 364 | /** |
| 365 | - * Protobuf type {@code protocol.ResponseProtocol} | 365 | + * Protobuf type {@code protocol.CIMResProtocol} |
| 366 | */ | 366 | */ |
| 367 | public static final class Builder extends | 367 | public static final class Builder extends |
| 368 | com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements | 368 | com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements |
| 369 | - // @@protoc_insertion_point(builder_implements:protocol.ResponseProtocol) | ||
| 370 | - ResponseProtocolOrBuilder { | 369 | + // @@protoc_insertion_point(builder_implements:protocol.CIMResProtocol) |
| 370 | + CIMResProtocolOrBuilder { | ||
| 371 | public static final com.google.protobuf.Descriptors.Descriptor | 371 | public static final com.google.protobuf.Descriptors.Descriptor |
| 372 | getDescriptor() { | 372 | getDescriptor() { |
| 373 | - return BaseResponseProto.internal_static_protocol_ResponseProtocol_descriptor; | 373 | + return CIMResponseProto.internal_static_protocol_CIMResProtocol_descriptor; |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | protected FieldAccessorTable | 376 | protected FieldAccessorTable |
| 377 | internalGetFieldAccessorTable() { | 377 | internalGetFieldAccessorTable() { |
| 378 | - return BaseResponseProto.internal_static_protocol_ResponseProtocol_fieldAccessorTable | 378 | + return CIMResponseProto.internal_static_protocol_CIMResProtocol_fieldAccessorTable |
| 379 | .ensureFieldAccessorsInitialized( | 379 | .ensureFieldAccessorsInitialized( |
| 380 | - ResponseProtocol.class, Builder.class); | 380 | + CIMResProtocol.class, Builder.class); |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | - // Construct using com.crossoverjie.netty.action.protocol.BaseResponseProto.ResponseProtocol.newBuilder() | 383 | + // Construct using com.crossoverjie.cim.common.protocol.CIMResponseProto.CIMResProtocol.newBuilder() |
| 384 | private Builder() { | 384 | private Builder() { |
| 385 | maybeForceBuilderInitialization(); | 385 | maybeForceBuilderInitialization(); |
| 386 | } | 386 | } |
| @@ -406,23 +406,23 @@ public final class BaseResponseProto { | @@ -406,23 +406,23 @@ public final class BaseResponseProto { | ||
| 406 | 406 | ||
| 407 | public com.google.protobuf.Descriptors.Descriptor | 407 | public com.google.protobuf.Descriptors.Descriptor |
| 408 | getDescriptorForType() { | 408 | getDescriptorForType() { |
| 409 | - return BaseResponseProto.internal_static_protocol_ResponseProtocol_descriptor; | 409 | + return CIMResponseProto.internal_static_protocol_CIMResProtocol_descriptor; |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | - public ResponseProtocol getDefaultInstanceForType() { | ||
| 413 | - return ResponseProtocol.getDefaultInstance(); | 412 | + public CIMResProtocol getDefaultInstanceForType() { |
| 413 | + return CIMResProtocol.getDefaultInstance(); | ||
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | - public ResponseProtocol build() { | ||
| 417 | - ResponseProtocol result = buildPartial(); | 416 | + public CIMResProtocol build() { |
| 417 | + CIMResProtocol result = buildPartial(); | ||
| 418 | if (!result.isInitialized()) { | 418 | if (!result.isInitialized()) { |
| 419 | throw newUninitializedMessageException(result); | 419 | throw newUninitializedMessageException(result); |
| 420 | } | 420 | } |
| 421 | return result; | 421 | return result; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | - public ResponseProtocol buildPartial() { | ||
| 425 | - ResponseProtocol result = new ResponseProtocol(this); | 424 | + public CIMResProtocol buildPartial() { |
| 425 | + CIMResProtocol result = new CIMResProtocol(this); | ||
| 426 | int from_bitField0_ = bitField0_; | 426 | int from_bitField0_ = bitField0_; |
| 427 | int to_bitField0_ = 0; | 427 | int to_bitField0_ = 0; |
| 428 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) { | 428 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) { |
| @@ -465,16 +465,16 @@ public final class BaseResponseProto { | @@ -465,16 +465,16 @@ public final class BaseResponseProto { | ||
| 465 | return (Builder) super.addRepeatedField(field, value); | 465 | return (Builder) super.addRepeatedField(field, value); |
| 466 | } | 466 | } |
| 467 | public Builder mergeFrom(com.google.protobuf.Message other) { | 467 | public Builder mergeFrom(com.google.protobuf.Message other) { |
| 468 | - if (other instanceof ResponseProtocol) { | ||
| 469 | - return mergeFrom((ResponseProtocol)other); | 468 | + if (other instanceof CIMResProtocol) { |
| 469 | + return mergeFrom((CIMResProtocol)other); | ||
| 470 | } else { | 470 | } else { |
| 471 | super.mergeFrom(other); | 471 | super.mergeFrom(other); |
| 472 | return this; | 472 | return this; |
| 473 | } | 473 | } |
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | - public Builder mergeFrom(ResponseProtocol other) { | ||
| 477 | - if (other == ResponseProtocol.getDefaultInstance()) return this; | 476 | + public Builder mergeFrom(CIMResProtocol other) { |
| 477 | + if (other == CIMResProtocol.getDefaultInstance()) return this; | ||
| 478 | if (other.hasResponseId()) { | 478 | if (other.hasResponseId()) { |
| 479 | setResponseId(other.getResponseId()); | 479 | setResponseId(other.getResponseId()); |
| 480 | } | 480 | } |
| @@ -502,11 +502,11 @@ public final class BaseResponseProto { | @@ -502,11 +502,11 @@ public final class BaseResponseProto { | ||
| 502 | com.google.protobuf.CodedInputStream input, | 502 | com.google.protobuf.CodedInputStream input, |
| 503 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 503 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 504 | throws java.io.IOException { | 504 | throws java.io.IOException { |
| 505 | - ResponseProtocol parsedMessage = null; | 505 | + CIMResProtocol parsedMessage = null; |
| 506 | try { | 506 | try { |
| 507 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); | 507 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); |
| 508 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { | 508 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { |
| 509 | - parsedMessage = (ResponseProtocol) e.getUnfinishedMessage(); | 509 | + parsedMessage = (CIMResProtocol) e.getUnfinishedMessage(); |
| 510 | throw e.unwrapIOException(); | 510 | throw e.unwrapIOException(); |
| 511 | } finally { | 511 | } finally { |
| 512 | if (parsedMessage != null) { | 512 | if (parsedMessage != null) { |
| @@ -635,49 +635,49 @@ public final class BaseResponseProto { | @@ -635,49 +635,49 @@ public final class BaseResponseProto { | ||
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | 637 | ||
| 638 | - // @@protoc_insertion_point(builder_scope:protocol.ResponseProtocol) | 638 | + // @@protoc_insertion_point(builder_scope:protocol.CIMResProtocol) |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | - // @@protoc_insertion_point(class_scope:protocol.ResponseProtocol) | ||
| 642 | - private static final ResponseProtocol DEFAULT_INSTANCE; | 641 | + // @@protoc_insertion_point(class_scope:protocol.CIMResProtocol) |
| 642 | + private static final CIMResProtocol DEFAULT_INSTANCE; | ||
| 643 | static { | 643 | static { |
| 644 | - DEFAULT_INSTANCE = new ResponseProtocol(); | 644 | + DEFAULT_INSTANCE = new CIMResProtocol(); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | - public static ResponseProtocol getDefaultInstance() { | 647 | + public static CIMResProtocol getDefaultInstance() { |
| 648 | return DEFAULT_INSTANCE; | 648 | return DEFAULT_INSTANCE; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | - @Deprecated public static final com.google.protobuf.Parser<ResponseProtocol> | ||
| 652 | - PARSER = new com.google.protobuf.AbstractParser<ResponseProtocol>() { | ||
| 653 | - public ResponseProtocol parsePartialFrom( | 651 | + @Deprecated public static final com.google.protobuf.Parser<CIMResProtocol> |
| 652 | + PARSER = new com.google.protobuf.AbstractParser<CIMResProtocol>() { | ||
| 653 | + public CIMResProtocol parsePartialFrom( | ||
| 654 | com.google.protobuf.CodedInputStream input, | 654 | com.google.protobuf.CodedInputStream input, |
| 655 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) | 655 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
| 656 | throws com.google.protobuf.InvalidProtocolBufferException { | 656 | throws com.google.protobuf.InvalidProtocolBufferException { |
| 657 | - return new ResponseProtocol(input, extensionRegistry); | 657 | + return new CIMResProtocol(input, extensionRegistry); |
| 658 | } | 658 | } |
| 659 | }; | 659 | }; |
| 660 | 660 | ||
| 661 | - public static com.google.protobuf.Parser<ResponseProtocol> parser() { | 661 | + public static com.google.protobuf.Parser<CIMResProtocol> parser() { |
| 662 | return PARSER; | 662 | return PARSER; |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | @Override | 665 | @Override |
| 666 | - public com.google.protobuf.Parser<ResponseProtocol> getParserForType() { | 666 | + public com.google.protobuf.Parser<CIMResProtocol> getParserForType() { |
| 667 | return PARSER; | 667 | return PARSER; |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | - public ResponseProtocol getDefaultInstanceForType() { | 670 | + public CIMResProtocol getDefaultInstanceForType() { |
| 671 | return DEFAULT_INSTANCE; | 671 | return DEFAULT_INSTANCE; |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | private static final com.google.protobuf.Descriptors.Descriptor | 676 | private static final com.google.protobuf.Descriptors.Descriptor |
| 677 | - internal_static_protocol_ResponseProtocol_descriptor; | 677 | + internal_static_protocol_CIMResProtocol_descriptor; |
| 678 | private static final | 678 | private static final |
| 679 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable | 679 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
| 680 | - internal_static_protocol_ResponseProtocol_fieldAccessorTable; | 680 | + internal_static_protocol_CIMResProtocol_fieldAccessorTable; |
| 681 | 681 | ||
| 682 | public static com.google.protobuf.Descriptors.FileDescriptor | 682 | public static com.google.protobuf.Descriptors.FileDescriptor |
| 683 | getDescriptor() { | 683 | getDescriptor() { |
| @@ -687,10 +687,10 @@ public final class BaseResponseProto { | @@ -687,10 +687,10 @@ public final class BaseResponseProto { | ||
| 687 | descriptor; | 687 | descriptor; |
| 688 | static { | 688 | static { |
| 689 | String[] descriptorData = { | 689 | String[] descriptorData = { |
| 690 | - "\n\027BaseResponseProto.proto\022\010protocol\"6\n\020R" + | ||
| 691 | - "esponseProtocol\022\022\n\nresponseId\030\002 \002(\005\022\016\n\006r" + | ||
| 692 | - "esMsg\030\001 \002(\tB;\n&com.crossoverjie.netty.ac" + | ||
| 693 | - "tion.protocolB\021BaseResponseProto" | 690 | + "\n\027BaseResponseProto.proto\022\010protocol\"4\n\016C" + |
| 691 | + "IMResProtocol\022\022\n\nresponseId\030\002 \002(\005\022\016\n\006res" + | ||
| 692 | + "Msg\030\001 \002(\tB8\n$com.crossoverjie.cim.common" + | ||
| 693 | + ".protocolB\020CIMResponseProto" | ||
| 694 | }; | 694 | }; |
| 695 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = | 695 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = |
| 696 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { | 696 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { |
| @@ -704,11 +704,11 @@ public final class BaseResponseProto { | @@ -704,11 +704,11 @@ public final class BaseResponseProto { | ||
| 704 | .internalBuildGeneratedFileFrom(descriptorData, | 704 | .internalBuildGeneratedFileFrom(descriptorData, |
| 705 | new com.google.protobuf.Descriptors.FileDescriptor[] { | 705 | new com.google.protobuf.Descriptors.FileDescriptor[] { |
| 706 | }, assigner); | 706 | }, assigner); |
| 707 | - internal_static_protocol_ResponseProtocol_descriptor = | 707 | + internal_static_protocol_CIMResProtocol_descriptor = |
| 708 | getDescriptor().getMessageTypes().get(0); | 708 | getDescriptor().getMessageTypes().get(0); |
| 709 | - internal_static_protocol_ResponseProtocol_fieldAccessorTable = new | 709 | + internal_static_protocol_CIMResProtocol_fieldAccessorTable = new |
| 710 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( | 710 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( |
| 711 | - internal_static_protocol_ResponseProtocol_descriptor, | 711 | + internal_static_protocol_CIMResProtocol_descriptor, |
| 712 | new String[] { "ResponseId", "ResMsg", }); | 712 | new String[] { "ResponseId", "ResMsg", }); |
| 713 | } | 713 | } |
| 714 | 714 |
| @@ -12,14 +12,14 @@ import com.google.protobuf.InvalidProtocolBufferException; | @@ -12,14 +12,14 @@ import com.google.protobuf.InvalidProtocolBufferException; | ||
| 12 | public class ProtocolUtil { | 12 | public class ProtocolUtil { |
| 13 | 13 | ||
| 14 | public static void main(String[] args) throws InvalidProtocolBufferException { | 14 | public static void main(String[] args) throws InvalidProtocolBufferException { |
| 15 | - BaseRequestProto.RequestProtocol protocol = BaseRequestProto.RequestProtocol.newBuilder() | 15 | + CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder() |
| 16 | .setRequestId(123) | 16 | .setRequestId(123) |
| 17 | .setReqMsg("你好啊") | 17 | .setReqMsg("你好啊") |
| 18 | .build(); | 18 | .build(); |
| 19 | 19 | ||
| 20 | byte[] encode = encode(protocol); | 20 | byte[] encode = encode(protocol); |
| 21 | 21 | ||
| 22 | - BaseRequestProto.RequestProtocol parseFrom = decode(encode); | 22 | + CIMRequestProto.CIMReqProtocol parseFrom = decode(encode); |
| 23 | 23 | ||
| 24 | System.out.println(protocol.toString()); | 24 | System.out.println(protocol.toString()); |
| 25 | System.out.println(protocol.toString().equals(parseFrom.toString())); | 25 | System.out.println(protocol.toString().equals(parseFrom.toString())); |
| @@ -30,7 +30,7 @@ public class ProtocolUtil { | @@ -30,7 +30,7 @@ public class ProtocolUtil { | ||
| 30 | * @param protocol | 30 | * @param protocol |
| 31 | * @return | 31 | * @return |
| 32 | */ | 32 | */ |
| 33 | - public static byte[] encode(BaseRequestProto.RequestProtocol protocol){ | 33 | + public static byte[] encode(CIMRequestProto.CIMReqProtocol protocol){ |
| 34 | return protocol.toByteArray() ; | 34 | return protocol.toByteArray() ; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| @@ -40,7 +40,7 @@ public class ProtocolUtil { | @@ -40,7 +40,7 @@ public class ProtocolUtil { | ||
| 40 | * @return | 40 | * @return |
| 41 | * @throws InvalidProtocolBufferException | 41 | * @throws InvalidProtocolBufferException |
| 42 | */ | 42 | */ |
| 43 | - public static BaseRequestProto.RequestProtocol decode(byte[] bytes) throws InvalidProtocolBufferException { | ||
| 44 | - return BaseRequestProto.RequestProtocol.parseFrom(bytes); | 43 | + public static CIMRequestProto.CIMReqProtocol decode(byte[] bytes) throws InvalidProtocolBufferException { |
| 44 | + return CIMRequestProto.CIMReqProtocol.parseFrom(bytes); | ||
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| @@ -80,7 +80,7 @@ public class ServerCache { | @@ -80,7 +80,7 @@ public class ServerCache { | ||
| 80 | public String selectServer() { | 80 | public String selectServer() { |
| 81 | List<String> all = getAll(); | 81 | List<String> all = getAll(); |
| 82 | if (all.size() == 0) { | 82 | if (all.size() == 0) { |
| 83 | - throw new RuntimeException("路由列表为空"); | 83 | + throw new RuntimeException("CIM 服务器可用服务列表为空"); |
| 84 | } | 84 | } |
| 85 | Long position = index.incrementAndGet() % all.size(); | 85 | Long position = index.incrementAndGet() % all.size(); |
| 86 | if (position < 0) { | 86 | if (position < 0) { |
| @@ -22,7 +22,7 @@ public class AppConfiguration { | @@ -22,7 +22,7 @@ public class AppConfiguration { | ||
| 22 | @Value("${app.zk.switch}") | 22 | @Value("${app.zk.switch}") |
| 23 | private boolean zkSwitch; | 23 | private boolean zkSwitch; |
| 24 | 24 | ||
| 25 | - @Value("${server.port}") | 25 | + @Value("${netty.server.port}") |
| 26 | private int port; | 26 | private int port; |
| 27 | 27 | ||
| 28 | public int getPort() { | 28 | public int getPort() { |
| @@ -24,7 +24,7 @@ public class SwaggerConfig { | @@ -24,7 +24,7 @@ public class SwaggerConfig { | ||
| 24 | return new Docket(DocumentationType.SWAGGER_2) | 24 | return new Docket(DocumentationType.SWAGGER_2) |
| 25 | .apiInfo(apiInfo()) | 25 | .apiInfo(apiInfo()) |
| 26 | .select() | 26 | .select() |
| 27 | - .apis(RequestHandlerSelectors.basePackage("com.crossoverjie.netty.action.controller")) | 27 | + .apis(RequestHandlerSelectors.basePackage("com.crossoverjie.cim.server.controller")) |
| 28 | .paths(PathSelectors.any()) | 28 | .paths(PathSelectors.any()) |
| 29 | .build(); | 29 | .build(); |
| 30 | } | 30 | } |
| 1 | package com.crossoverjie.cim.server.handle; | 1 | package com.crossoverjie.cim.server.handle; |
| 2 | 2 | ||
| 3 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | ||
| 4 | -import com.crossoverjie.cim.common.protocol.BaseResponseProto; | 3 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; |
| 4 | +import com.crossoverjie.cim.common.protocol.CIMResponseProto; | ||
| 5 | import com.crossoverjie.cim.server.util.NettySocketHolder; | 5 | import com.crossoverjie.cim.server.util.NettySocketHolder; |
| 6 | +import io.netty.channel.ChannelHandler; | ||
| 6 | import io.netty.channel.ChannelHandlerContext; | 7 | import io.netty.channel.ChannelHandlerContext; |
| 7 | import io.netty.channel.SimpleChannelInboundHandler; | 8 | import io.netty.channel.SimpleChannelInboundHandler; |
| 8 | import io.netty.channel.socket.nio.NioSocketChannel; | 9 | import io.netty.channel.socket.nio.NioSocketChannel; |
| @@ -16,9 +17,10 @@ import org.slf4j.LoggerFactory; | @@ -16,9 +17,10 @@ import org.slf4j.LoggerFactory; | ||
| 16 | * Date: 17/05/2018 18:52 | 17 | * Date: 17/05/2018 18:52 |
| 17 | * @since JDK 1.8 | 18 | * @since JDK 1.8 |
| 18 | */ | 19 | */ |
| 19 | -public class ServerHandle extends SimpleChannelInboundHandler<BaseRequestProto.RequestProtocol> { | 20 | +@ChannelHandler.Sharable |
| 21 | +public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto.CIMReqProtocol> { | ||
| 20 | 22 | ||
| 21 | - private final static Logger LOGGER = LoggerFactory.getLogger(ServerHandle.class); | 23 | + private final static Logger LOGGER = LoggerFactory.getLogger(CIMServerHandle.class); |
| 22 | 24 | ||
| 23 | 25 | ||
| 24 | /** | 26 | /** |
| @@ -28,6 +30,7 @@ public class ServerHandle extends SimpleChannelInboundHandler<BaseRequestProto.R | @@ -28,6 +30,7 @@ public class ServerHandle extends SimpleChannelInboundHandler<BaseRequestProto.R | ||
| 28 | */ | 30 | */ |
| 29 | @Override | 31 | @Override |
| 30 | public void channelInactive(ChannelHandlerContext ctx) throws Exception { | 32 | public void channelInactive(ChannelHandlerContext ctx) throws Exception { |
| 33 | + LOGGER.info("客户端断开"); | ||
| 31 | NettySocketHolder.remove((NioSocketChannel) ctx.channel()); | 34 | NettySocketHolder.remove((NioSocketChannel) ctx.channel()); |
| 32 | } | 35 | } |
| 33 | 36 | ||
| @@ -37,11 +40,11 @@ public class ServerHandle extends SimpleChannelInboundHandler<BaseRequestProto.R | @@ -37,11 +40,11 @@ public class ServerHandle extends SimpleChannelInboundHandler<BaseRequestProto.R | ||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | @Override | 42 | @Override |
| 40 | - protected void channelRead0(ChannelHandlerContext ctx, BaseRequestProto.RequestProtocol msg) throws Exception { | 43 | + protected void channelRead0(ChannelHandlerContext ctx, CIMRequestProto.CIMReqProtocol msg) throws Exception { |
| 41 | LOGGER.info("收到msg={}", msg.getReqMsg()); | 44 | LOGGER.info("收到msg={}", msg.getReqMsg()); |
| 42 | 45 | ||
| 43 | if (999 == msg.getRequestId()){ | 46 | if (999 == msg.getRequestId()){ |
| 44 | - BaseResponseProto.ResponseProtocol responseProtocol = BaseResponseProto.ResponseProtocol.newBuilder() | 47 | + CIMResponseProto.CIMResProtocol responseProtocol = CIMResponseProto.CIMResProtocol.newBuilder() |
| 45 | .setResponseId(1000) | 48 | .setResponseId(1000) |
| 46 | .setResMsg("服务端响应") | 49 | .setResMsg("服务端响应") |
| 47 | .build(); | 50 | .build(); |
| 1 | package com.crossoverjie.cim.server.init; | 1 | package com.crossoverjie.cim.server.init; |
| 2 | 2 | ||
| 3 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | ||
| 4 | -import com.crossoverjie.cim.server.handle.ServerHandle; | 3 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; |
| 4 | +import com.crossoverjie.cim.server.handle.CIMServerHandle; | ||
| 5 | import io.netty.channel.Channel; | 5 | import io.netty.channel.Channel; |
| 6 | import io.netty.channel.ChannelInitializer; | 6 | import io.netty.channel.ChannelInitializer; |
| 7 | import io.netty.handler.codec.protobuf.ProtobufDecoder; | 7 | import io.netty.handler.codec.protobuf.ProtobufDecoder; |
| @@ -16,9 +16,9 @@ import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; | @@ -16,9 +16,9 @@ import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; | ||
| 16 | * Date: 17/05/2018 18:51 | 16 | * Date: 17/05/2018 18:51 |
| 17 | * @since JDK 1.8 | 17 | * @since JDK 1.8 |
| 18 | */ | 18 | */ |
| 19 | -public class HeartbeatInitializer extends ChannelInitializer<Channel> { | 19 | +public class CIMServerInitializer extends ChannelInitializer<Channel> { |
| 20 | 20 | ||
| 21 | - private final ServerHandle serverHandle = new ServerHandle(); | 21 | + private final CIMServerHandle cimServerHandle = new CIMServerHandle() ; |
| 22 | 22 | ||
| 23 | @Override | 23 | @Override |
| 24 | protected void initChannel(Channel ch) throws Exception { | 24 | protected void initChannel(Channel ch) throws Exception { |
| @@ -26,9 +26,9 @@ public class HeartbeatInitializer extends ChannelInitializer<Channel> { | @@ -26,9 +26,9 @@ public class HeartbeatInitializer extends ChannelInitializer<Channel> { | ||
| 26 | ch.pipeline() | 26 | ch.pipeline() |
| 27 | // google Protobuf 编解码 | 27 | // google Protobuf 编解码 |
| 28 | .addLast(new ProtobufVarint32FrameDecoder()) | 28 | .addLast(new ProtobufVarint32FrameDecoder()) |
| 29 | - .addLast(new ProtobufDecoder(BaseRequestProto.RequestProtocol.getDefaultInstance())) | 29 | + .addLast(new ProtobufDecoder(CIMRequestProto.CIMReqProtocol.getDefaultInstance())) |
| 30 | .addLast(new ProtobufVarint32LengthFieldPrepender()) | 30 | .addLast(new ProtobufVarint32LengthFieldPrepender()) |
| 31 | .addLast(new ProtobufEncoder()) | 31 | .addLast(new ProtobufEncoder()) |
| 32 | - .addLast(serverHandle); | 32 | + .addLast(cimServerHandle); |
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 1 | package com.crossoverjie.cim.server.server; | 1 | package com.crossoverjie.cim.server.server; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.crossoverjie.cim.common.protocol.BaseRequestProto; | 4 | +import com.crossoverjie.cim.common.pojo.CustomProtocol; |
| 5 | +import com.crossoverjie.cim.common.protocol.CIMRequestProto; | ||
| 6 | +import com.crossoverjie.cim.server.init.CIMServerInitializer; | ||
| 5 | import com.crossoverjie.cim.server.util.NettySocketHolder; | 7 | import com.crossoverjie.cim.server.util.NettySocketHolder; |
| 6 | import com.crossoverjie.cim.server.vo.req.SendMsgReqVO; | 8 | import com.crossoverjie.cim.server.vo.req.SendMsgReqVO; |
| 7 | -import com.crossoverjie.cim.common.pojo.CustomProtocol; | ||
| 8 | -import com.crossoverjie.cim.server.init.HeartbeatInitializer; | ||
| 9 | import io.netty.bootstrap.ServerBootstrap; | 9 | import io.netty.bootstrap.ServerBootstrap; |
| 10 | import io.netty.buffer.Unpooled; | 10 | import io.netty.buffer.Unpooled; |
| 11 | import io.netty.channel.ChannelFuture; | 11 | import io.netty.channel.ChannelFuture; |
| @@ -60,7 +60,7 @@ public class CIMServer { | @@ -60,7 +60,7 @@ public class CIMServer { | ||
| 60 | .localAddress(new InetSocketAddress(nettyPort)) | 60 | .localAddress(new InetSocketAddress(nettyPort)) |
| 61 | //保持长连接 | 61 | //保持长连接 |
| 62 | .childOption(ChannelOption.SO_KEEPALIVE, true) | 62 | .childOption(ChannelOption.SO_KEEPALIVE, true) |
| 63 | - .childHandler(new HeartbeatInitializer()); | 63 | + .childHandler(new CIMServerInitializer()); |
| 64 | 64 | ||
| 65 | ChannelFuture future = bootstrap.bind().sync(); | 65 | ChannelFuture future = bootstrap.bind().sync(); |
| 66 | if (future.isSuccess()) { | 66 | if (future.isSuccess()) { |
| @@ -107,7 +107,7 @@ public class CIMServer { | @@ -107,7 +107,7 @@ public class CIMServer { | ||
| 107 | if (null == socketChannel) { | 107 | if (null == socketChannel) { |
| 108 | throw new NullPointerException("没有[" + sendMsgReqVO.getId() + "]的socketChannel"); | 108 | throw new NullPointerException("没有[" + sendMsgReqVO.getId() + "]的socketChannel"); |
| 109 | } | 109 | } |
| 110 | - BaseRequestProto.RequestProtocol protocol = BaseRequestProto.RequestProtocol.newBuilder() | 110 | + CIMRequestProto.CIMReqProtocol protocol = CIMRequestProto.CIMReqProtocol.newBuilder() |
| 111 | .setRequestId((int) sendMsgReqVO.getId()) | 111 | .setRequestId((int) sendMsgReqVO.getId()) |
| 112 | .setReqMsg(sendMsgReqVO.getMsg()) | 112 | .setReqMsg(sendMsgReqVO.getMsg()) |
| 113 | .build(); | 113 | .build(); |
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | <version>1.0.0-SNAPSHOT</version> | 6 | <version>1.0.0-SNAPSHOT</version> |
| 7 | <packaging>pom</packaging> | 7 | <packaging>pom</packaging> |
| 8 | 8 | ||
| 9 | - <name>netty-action</name> | 9 | + <name>cim</name> |
| 10 | <description>Spring Boot</description> | 10 | <description>Spring Boot</description> |
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
| 53 | <dependency> | 53 | <dependency> |
| 54 | <groupId>com.crossoverjie.netty</groupId> | 54 | <groupId>com.crossoverjie.netty</groupId> |
| 55 | <artifactId>cim-common</artifactId> | 55 | <artifactId>cim-common</artifactId> |
| 56 | - <version>1.0.0-SNAPSHOT</version> | 56 | + <version>1.0.1-SNAPSHOT</version> |
| 57 | </dependency> | 57 | </dependency> |
| 58 | 58 | ||
| 59 | <dependency> | 59 | <dependency> |
-
请 注册 或 登录 后发表评论