Change comments to English 05/8005/1
authorHuabingZhao <zhao.huabing@zte.com.cn>
Fri, 18 Aug 2017 09:27:07 +0000 (17:27 +0800)
committerHuabingZhao <zhao.huabing@zte.com.cn>
Fri, 18 Aug 2017 09:27:34 +0000 (17:27 +0800)
Issue_Id: MSB-22
Change-Id: I9cc5eee1adeb3c271f543ff6a8ff717764ccd5a7
Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
example/src/main/java/org/onap/msb/sdk/example/client/AnimalServiceClient.java
example/src/main/java/org/onap/msb/sdk/example/client/ExampleClient.java
example/src/main/java/org/onap/msb/sdk/example/server/ExampleApp.java
example/src/main/java/org/onap/msb/sdk/example/server/MsbHelper.java
src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceFullInfo.java
src/main/java/org/onap/msb/sdk/httpclient/RetrofitServiceCreater.java
src/main/java/org/onap/msb/sdk/httpclient/conf/HttpClientConf.java
src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerContext.java
src/main/java/org/onap/msb/sdk/httpclient/handler/RetrofitServiceHandlerFactory.java
src/main/java/org/onap/msb/sdk/httpclient/msb/MSBServiceClient.java [moved from src/main/java/org/onap/msb/sdk/httpclient/msb/MSBServiceWrapperClient.java with 60% similarity]

index 8600241..7cd1654 100644 (file)
@@ -20,11 +20,6 @@ import retrofit2.Call;
 import retrofit2.http.GET;
 import retrofit2.http.Path;
 
-/**
- * @author hu.rui
- *
- */
-
 @ServiceHttpEndPoint(serviceName = "animals", serviceVersion = "v1")
 public interface AnimalServiceClient {
 
index 59263f1..2bcbae1 100644 (file)
@@ -11,9 +11,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  ******************************************************************************/
-/**
- * 
- */
 package org.onap.msb.sdk.example.client;
 
 import java.io.IOException;
@@ -21,7 +18,7 @@ import java.io.IOException;
 import org.onap.msb.sdk.example.common.Animal;
 import org.onap.msb.sdk.httpclient.RetrofitServiceCreater;
 import org.onap.msb.sdk.httpclient.conf.HttpClientConf;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
 
 public class ExampleClient {
@@ -35,7 +32,7 @@ public class ExampleClient {
     int MSB_Port=10081;
     
     HttpClientConf globalHttpClientConf = new HttpClientConf();
-    MSBServiceWrapperClient msbClient = new MSBServiceWrapperClient(MSB_IP, MSB_Port);
+    MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
 
     RetrofitServiceCreater retrofitServiceCreater =
         new RetrofitServiceCreater(globalHttpClientConf, msbClient);
index b93875f..76827c5 100644 (file)
@@ -14,7 +14,7 @@
 package org.onap.msb.sdk.example.server;
 
 import org.onap.msb.sdk.example.server.resources.AnimalResource;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
 import io.dropwizard.Application;
 import io.dropwizard.setup.Environment;
@@ -44,7 +44,7 @@ public class ExampleApp extends Application<Config> {
     
     environment.jersey().register(new AnimalResource());
 
-    MSBServiceWrapperClient msbClient = new MSBServiceWrapperClient(MSB_IP, MSB_Port);
+    MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
 
     MsbHelper helper = new MsbHelper(msbClient);
     helper.registerMsb();
index 7b0c79d..bd49a9b 100644 (file)
@@ -20,20 +20,13 @@ import java.util.Set;
 import org.jvnet.hk2.annotations.Service;
 import org.onap.msb.sdk.discovery.entity.MicroServiceInfo;
 import org.onap.msb.sdk.discovery.entity.Node;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
-/**
- * @author hu.rui
- *
- */
-@Service
 public class MsbHelper {
 
-  private MSBServiceWrapperClient msbClient;
+  private MSBServiceClient msbClient;
 
-
-
-  public MsbHelper(MSBServiceWrapperClient msbClient) {
+  public MsbHelper(MSBServiceClient msbClient) {
     super();
     this.msbClient = msbClient;
   }
index 698092e..e874962 100644 (file)
@@ -24,7 +24,7 @@ public class MicroServiceFullInfo extends Service<NodeInfo> implements Serializa
 
   private Set<NodeInfo> nodes;
 
-  // 状态 0:不可用 1:可用,预留
+  //Reserved
   private String status = "1";
 
   public Set<NodeInfo> getNodes() {
index 413189c..fba8518 100644 (file)
@@ -24,22 +24,18 @@ import java.util.List;
 import org.onap.msb.sdk.httpclient.conf.HttpClientConf;
 import org.onap.msb.sdk.httpclient.handler.RetrofitServiceHandlerContext;
 import org.onap.msb.sdk.httpclient.handler.RetrofitServiceHandlerFactory;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
-/**
- * @author 10071214
- *
- */
 public class RetrofitServiceCreater {
 
 
   private RetrofitServiceHandlerFactory factory = new RetrofitServiceHandlerFactory();
 
-  private MSBServiceWrapperClient msbClient;
+  private MSBServiceClient msbClient;
 
 
   public RetrofitServiceCreater(HttpClientConf globalHttpClientConf,
-      MSBServiceWrapperClient msbClient) {
+      MSBServiceClient msbClient) {
 
     RetrofitServiceHandlerContext.setGlobalHttpClientConf(globalHttpClientConf);
     this.msbClient = msbClient;
index f3e5006..3e6b491 100644 (file)
@@ -18,10 +18,6 @@ package org.onap.msb.sdk.httpclient.conf;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-/**
- * @author 10071214
- *
- */
 public class HttpClientConf {
 
   @JsonProperty
index 68ee16c..713d0f6 100644 (file)
@@ -23,7 +23,7 @@ import org.onap.msb.sdk.httpclient.conf.HttpClientConf;
 import org.onap.msb.sdk.httpclient.convert.IConverterFactoryBuilder;
 import org.onap.msb.sdk.httpclient.lb.ILoadBalanceStrategy;
 import org.onap.msb.sdk.httpclient.metric.MetricManager;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
 
 /**
@@ -65,7 +65,7 @@ public class RetrofitServiceHandlerContext {
 
   private HttpClientConf httpClientConf;
 
-  private MSBServiceWrapperClient msbClient;
+  private MSBServiceClient msbClient;
 
 
 
@@ -79,11 +79,11 @@ public class RetrofitServiceHandlerContext {
 
 
 
-  public MSBServiceWrapperClient getMsbClient() {
+  public MSBServiceClient getMsbClient() {
     return msbClient;
   }
 
-  public void setMsbClient(MSBServiceWrapperClient msbClient) {
+  public void setMsbClient(MSBServiceClient msbClient) {
     this.msbClient = msbClient;
   }
 
index fb78820..1d65661 100644 (file)
@@ -28,7 +28,7 @@ import org.onap.msb.sdk.httpclient.handler.impl.LBBuilder;
 import org.onap.msb.sdk.httpclient.handler.impl.MetricmanagerBuilder;
 import org.onap.msb.sdk.httpclient.handler.impl.RetrofitHandlerContextBuilder;
 import org.onap.msb.sdk.httpclient.handler.impl.ServiceHttpEndPointBeanObjectBuilder;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceWrapperClient;
+import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
 
 import com.google.common.collect.Lists;
 
@@ -89,7 +89,7 @@ public class RetrofitServiceHandlerFactory {
 
   public InvocationHandler buildInvocationHandler(Class<?> retrofitSrvInterfaceClazz,
       ServiceHttpEndPointBeanObject serviceHttpEndPointBeanObject, HttpClientConf httpClientConf,
-      MSBServiceWrapperClient msbClient) {
+      MSBServiceClient msbClient) {
 
     RetrofitServiceHandlerContext ctx = new RetrofitServiceHandlerContext();
     ctx.setRetrofitSrvInterfaceClazz(retrofitSrvInterfaceClazz);
@@ -25,31 +25,24 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class MSBServiceWrapperClient {
+public class MSBServiceClient {
 
-  private static final Logger logger = LoggerFactory.getLogger(MSBServiceWrapperClient.class);
+  private static final Logger logger = LoggerFactory.getLogger(MSBServiceClient.class);
 
   private String msbSvrAddress;
 
   private MSBService msbService = new MSBService();
 
-  private String nameSpace;
-
-  public MSBServiceWrapperClient(String msbSvrIp, int msbSvrPort) {
+  public MSBServiceClient(String msbSvrIp, int msbSvrPort) {
     super();
     this.msbSvrAddress = msbSvrIp + ":" + msbSvrPort;
 
-    logger.info("msb service info:msbSvrAddress:{},nameSpace:{}", this.msbSvrAddress,
-        this.nameSpace);
-
+    logger.info("msb service info:msbSvrAddress:{}", this.msbSvrAddress);
   }
 
   public MicroServiceFullInfo queryMicroServiceInfo(String serviceName, String version)
       throws RouteException {
-
     return invokeMsb(() -> msbService.queryMicroServiceInfo(msbSvrAddress, serviceName, version));
-
-
   }
 
   private <V> V invokeMsb(Callable<V> callable) throws RouteException {
@@ -67,13 +60,6 @@ public class MSBServiceWrapperClient {
   }
 
 
-  /**
-   * 注册微服务-默认追加方式,在msb上注册服务信息,服务的信息都可以填充在MicroServiceInfo上,包括:租户的信息等
-   * 
-   * @param microServiceInfo 微服务注册实体类
-   * @throws RouteException
-   * @return MicroServiceFullInfo
-   */
   public MicroServiceFullInfo registerMicroServiceInfo(MicroServiceInfo msinfo)
       throws RouteException {
 
@@ -82,14 +68,6 @@ public class MSBServiceWrapperClient {
 
 
 
-  /**
-   * 注册微服务,在msb上注册服务信息,服务的信息都可以填充在MicroServiceInfo上,包括:租户的信息等
-   * 
-   * @param microServiceInfo 微服务注册实体类
-   * @param createOrUpdate true:新增或追加更新 ,false:重新添加
-   * @throws RouteException
-   * @return MicroServiceFullInfo
-   */
   public MicroServiceFullInfo registerMicroServiceInfo(MicroServiceInfo msinfo,
       boolean createOrUpdate) throws RouteException {
 
@@ -100,12 +78,7 @@ public class MSBServiceWrapperClient {
 
 
   /**
-   * @Title cancelMicroServiceInfo
-   * @Description TODO(注销全部微服务)
-   * @param serviceName 服务名[必填,若自定义服务名包含/,用*代替]
-   * @param version 版本号[若无版本号,传空字符串]
-   * @throws RouteException
-   * @return RouteResult
+   * unregister all the instances of a service
    */
   public RouteResult cancelMicroServiceInfo(String serviceName, String version)
       throws RouteException {
@@ -115,14 +88,7 @@ public class MSBServiceWrapperClient {
 
 
   /**
-   * 注销单个微服务
-   * 
-   * @param serviceName 服务名[必填,若自定义服务名包含/,用*代替]
-   * @param version 版本号[若无版本号,传空字符串]
-   * @param ip
-   * @param port
-   * @throws RouteException
-   * @return RouteResult
+   * unregister the specified instance of a service
    */
 
   public RouteResult cancelMicroServiceInfo(String serviceName, String version, String ip,
@@ -137,26 +103,4 @@ public class MSBServiceWrapperClient {
     return msbSvrAddress;
   }
 
-
-
-  /**
-   * 请求服务实例TTL健康检查,默认使用本租户的信息
-   * 
-   * @param serviceName 服务名
-   * @param version 版本号[若无版本号,传空字符串]
-   * @param ip 实例IP
-   * @param port 实例端口
-   * @throws RouteException
-   * @return CheckNode
-   */
-  public NodeAddress healthCheckbyTTL(String serviceName, String version, String ip, String port)
-      throws RouteException {
-
-    return invokeMsb(
-        () -> msbService.healthCheckbyTTL(msbSvrAddress, serviceName, version, ip, port));
-
-  }
-
-
-
 }