diff options
13 files changed, 66 insertions, 88 deletions
diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java index 61c66c3..6c70e7b 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -17,7 +17,7 @@ import java.io.Serializable; /** * @ClassName: MicroServiceInfo Bean - * @Description:微服务信息实体类 + * @Description * @author 10188044 * @date 2016-1-19 */ diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/Node.java b/src/main/java/org/onap/msb/sdk/discovery/entity/Node.java index f630528..7f101c4 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/Node.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/Node.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017-2018 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -28,7 +28,6 @@ public class Node implements Serializable { private String ttl = ""; - // 健康检查参数 // health check type, allowableValues = "HTTP,TCP, TTL", example = "HTTP") private String checkType = ""; // health check url, example for http "http://192.168.0.2:80/heallth", example for tcp diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/NodeInfo.java b/src/main/java/org/onap/msb/sdk/discovery/entity/NodeInfo.java index 316b548..43555a3 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/NodeInfo.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/NodeInfo.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -25,7 +25,7 @@ public class NodeInfo extends Node { private String nodeId; - private String status; // 实例健康检查状态 + private String status; @JsonSerialize(using = CustomDateSerializer.class) private Date expiration; diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/RouteResult.java b/src/main/java/org/onap/msb/sdk/discovery/entity/RouteResult.java index 9e266fa..d5d668d 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/RouteResult.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/RouteResult.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -15,10 +15,10 @@ package org.onap.msb.sdk.discovery.entity; /** * @ClassName: ApiRouteResult - * @Description: TODO(ApiRoute操作返回类) + * @Description * @author tanghua10186366 - * @date 2015年9月25日 上午11:24:42 - * + * @date 2015/9/25 + * */ public class RouteResult { private String result; diff --git a/src/main/java/org/onap/msb/sdk/discovery/util/JacksonJsonUtil.java b/src/main/java/org/onap/msb/sdk/discovery/util/JacksonJsonUtil.java index aac256a..27b6f0d 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/util/JacksonJsonUtil.java +++ b/src/main/java/org/onap/msb/sdk/discovery/util/JacksonJsonUtil.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -40,9 +40,8 @@ public class JacksonJsonUtil { private static ObjectMapper mapper; /** - * 获取ObjectMapper实例 - * - * @param createNew 方式:true,新实例;false,存在的mapper实例 + * + * @param createNew create a new instanse if truer, otherwise return the existing instance * @return */ public static synchronized ObjectMapper getMapperInstance() { @@ -53,10 +52,10 @@ public class JacksonJsonUtil { } /** - * 将java对象转换成json字符串 - * - * @param obj 准备转换的对象 - * @return json字符串 + * conver java object to json + * + * @param obj + * @return * @throws Exception */ public static String beanToJson(Object obj) throws RouteException { @@ -73,10 +72,10 @@ public class JacksonJsonUtil { /** - * 将json字符串转换成java对象 - * - * @param json 准备转换的json字符串 - * @param cls 准备转换的类 + * convert json string to java object + * + * @param json + * @param cls * @return * @throws Exception */ diff --git a/src/main/java/org/onap/msb/sdk/discovery/util/MsbUtil.java b/src/main/java/org/onap/msb/sdk/discovery/util/MsbUtil.java index c54a51c..10cbbc2 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/util/MsbUtil.java +++ b/src/main/java/org/onap/msb/sdk/discovery/util/MsbUtil.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -23,17 +23,17 @@ import org.onap.msb.sdk.discovery.entity.NodeInfo; /** * @ClassName: MsbUtil - * @Description: TODO(msb功能工具方法类) + * @Description: Utils for MSB * @author tanghua10186366 - * @date 2017年6月26日 - * + * @date 2017/6/26 + * */ public class MsbUtil { /** * @Title getConsulServiceName - * @Description TODO(通过服务名和命名空间组装conusl存储名,用于服务变化监听) + * @Description * @param serviceName * @param namespace * @return String @@ -64,7 +64,6 @@ public class MsbUtil { } public static String checkVersion(String version) throws RouteException{ - // 版本号格式检查 if (StringUtils.isNotBlank(version)) { if (!RegExpTestUtil.versionRegExpTest(version)) { throw new RouteException("version is not a valid format", "DATA_FORMAT_ERROR"); @@ -77,7 +76,6 @@ public class MsbUtil { } public static void checkHost(String ip,String port) throws RouteException{ - // HOST空值和格式检查 if (StringUtils.isBlank(ip)) { throw new RouteException("ip can't be empty", "DATA_FORMAT_ERROR"); diff --git a/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java b/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java index 0e5968d..113df15 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/ProxyRetrofitCall.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -63,7 +63,6 @@ public class ProxyRetrofitCall<T extends Object> implements Call<T> { logger.warn("first invoke httpclient error,endPoint:{},method:{},msg:{}", endPoint, method, e.getMessage()); - // 清理残留的endpoint记录 handler.clean(); try { return ((Call) handler.reInvoke(proxy, method, args, endPoint)).execute(); diff --git a/src/main/java/org/onap/msb/sdk/httpclient/ServiceHttpEndPointBeanObject.java b/src/main/java/org/onap/msb/sdk/httpclient/ServiceHttpEndPointBeanObject.java index 4e36a83..f52f705 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/ServiceHttpEndPointBeanObject.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/ServiceHttpEndPointBeanObject.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -15,23 +15,17 @@ package org.onap.msb.sdk.httpclient; public class ServiceHttpEndPointBeanObject { - // 在MSB上注册的服务名 private String serviceName; - // 在MSB注册的版本号 private String serviceVersion; - // 在通过msb转发时,所用的协议 private String msbProtocl = "https"; - // 服务间点对点访问时,所用的协议 private String clientProtocl = "http"; - // 服务所在的租户名 private String nameSpace = ""; - // 服务的可见范围,系统间:“0”,系统内:“1”(默认),可配置多个,以 | 分隔 + // The visibility of service: '0' if the service can be accessed outside, '1' if it can only be accessed within the system, default '1' private String visualRange = "0"; - // 在MSB上注册的服务类型 private String serverType = "api"; diff --git a/src/main/java/org/onap/msb/sdk/httpclient/annotaion/ServiceHttpEndPoint.java b/src/main/java/org/onap/msb/sdk/httpclient/annotaion/ServiceHttpEndPoint.java index 1764503..7d15b43 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/annotaion/ServiceHttpEndPoint.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/annotaion/ServiceHttpEndPoint.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -19,8 +19,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * 服务名和版本号不同,接口名就需要不同 - * + * * @author hu.rui * */ @@ -28,25 +27,19 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface ServiceHttpEndPoint { - // 在MSB上注册的服务名 String serviceName(); - // 在MSB注册的版本号 String serviceVersion(); - // 在通过msb转发时,所用的协议 String msbProtocl() default "https"; - // 服务间点对点访问时,所用的协议 String clientProtocl() default "http"; - // 服务所在的租户名 String nameSpace() default ""; - // 服务的可见范围,系统间:“0”,系统内:“1”(默认),可配置多个,以 | 分隔 + // The visibility of service: '0' if the service can be accessed outside, '1' if it can only be accessed within the system, default '1' String visualRange() default "1"; - // 在MSB上注册的服务类型 String serverType() default "api"; } diff --git a/src/main/java/org/onap/msb/sdk/httpclient/builder/impl/ClientRetrofitObjectBuilder.java b/src/main/java/org/onap/msb/sdk/httpclient/builder/impl/ClientRetrofitObjectBuilder.java index 7b7c6af..1b5ef17 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/builder/impl/ClientRetrofitObjectBuilder.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/builder/impl/ClientRetrofitObjectBuilder.java @@ -1,18 +1,18 @@ /******************************************************************************* * Copyright 2017-2018 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. ******************************************************************************/ /** - * + * */ package org.onap.msb.sdk.httpclient.builder.impl; @@ -52,7 +52,7 @@ public class ClientRetrofitObjectBuilder implements IRetrofitObjectBuilder { /* * (non-Javadoc) - * + * * @see * com.zte.ums.zenap.httpclient.retrofit.builder.IRetrofitObjectBuilder#buildRetrofitObject( * java. util.concurrent.atomic.AtomicReference) @@ -87,7 +87,6 @@ public class ClientRetrofitObjectBuilder implements IRetrofitObjectBuilder { srvhttpEndPointBeanObject.getServiceName(), srvhttpEndPointBeanObject.getServiceVersion(), nodeInfo, cloneFullInfo); - // 目前支持http String baseUrl = null; if (fullInfo.getUrl() == null || fullInfo.getUrl().trim().length() == 0 || fullInfo.getUrl().equals("/")) { diff --git a/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/ServiceHttpEndPointBeanObjectBuilder.java b/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/ServiceHttpEndPointBeanObjectBuilder.java index 5d4bdde..163ba8c 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/ServiceHttpEndPointBeanObjectBuilder.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/handler/impl/ServiceHttpEndPointBeanObjectBuilder.java @@ -1,18 +1,18 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. ******************************************************************************/ /** - * + * */ package org.onap.msb.sdk.httpclient.handler.impl; @@ -30,7 +30,7 @@ public class ServiceHttpEndPointBeanObjectBuilder implements HandlerContextBuild /* * (non-Javadoc) - * + * * @see * com.zte.ums.zenap.versey.rpc.retrofit2.service.impl.handler.HandlerContextBuilder#build(com.zte * .ums.zenap.versey.rpc.retrofit2.service.impl.handler.RetrofitServiceHandlerContext) @@ -39,7 +39,6 @@ public class ServiceHttpEndPointBeanObjectBuilder implements HandlerContextBuild public void build(RetrofitServiceHandlerContext ctx) throws RetrofitServiceRuntimeException { if (ctx.getServiceHttpEndPointBeanObject() == null) { - // 从注解上构建 ServiceHttpEndPointBeanObject beanObject = buildBeanObjectFromClassAnnotion(ctx.getRetrofitSrvInterfaceClazz()); ctx.setServiceHttpEndPointBeanObject(beanObject); diff --git a/src/main/java/org/onap/msb/sdk/httpclient/lb/ILoadBalanceStrategy.java b/src/main/java/org/onap/msb/sdk/httpclient/lb/ILoadBalanceStrategy.java index 94ccd67..aa5f50c 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/lb/ILoadBalanceStrategy.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/lb/ILoadBalanceStrategy.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -16,8 +16,7 @@ package org.onap.msb.sdk.httpclient.lb; import org.onap.msb.sdk.httpclient.ServiceHttpEndPointObject; /** - * 每个实际的策略对象在运行中会保持单例 - * + * * @author hu.rui * */ diff --git a/src/main/java/org/onap/msb/sdk/httpclient/lb/LoadBalanceContext.java b/src/main/java/org/onap/msb/sdk/httpclient/lb/LoadBalanceContext.java index ee46de5..dee6ea2 100644 --- a/src/main/java/org/onap/msb/sdk/httpclient/lb/LoadBalanceContext.java +++ b/src/main/java/org/onap/msb/sdk/httpclient/lb/LoadBalanceContext.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright 2017 ZTE, Inc. and others. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under @@ -24,7 +24,6 @@ import org.onap.msb.sdk.httpclient.ServiceHttpEndPointObject; */ public class LoadBalanceContext { - // 从msb上查询到的全部endPoint信息 private List<ServiceHttpEndPointObject> endPoints; private Object[] args; |