Modify Example code
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / discovery / entity / Service.java
index a89ded9..306e59b 100644 (file)
@@ -22,54 +22,52 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class Service<T> implements Serializable {
   private static final long serialVersionUID = 1L;
-  // 服务名[必填]
   private String serviceName;
-  // 版本号 ( 格式:v(小写)+数字)
+
   private String version = "";
-  // 服务url (格式:url地址以/开头,不能以/结尾)
+  
   private String url = "";
-  // 服务对应协议,比如REST、UI、HTTP、MQ、FTP、SNMP、TCP、UDP
+  
+  //REST、UI
   private String protocol = "";
-  // 服务的可见范围 0:系统间 1:系统内
+  //0: External 1: Internal
   private String visualRange = "1";
 
-  // 负载均衡策略类型
   private String lb_policy = "";
 
-
-  private String host = "";
-
   private String path = "";
 
   private Set<T> nodes;
 
-  // 服务自身属性的键值对
   private List<KeyVaulePair> metadata;
 
-  public String getHost() {
-    return host;
-  }
-
-  public void setHost(String host) {
-    this.host = host;
-  }
-
   public String getPath() {
     return path;
   }
 
+  /**
+   * The customized publish path of this service.
+   * If this parameter is specified when registering the service, the service will be published to api gateway under this path.
+   * Otherwise, the service will be published to api gateway using a fixed format: api/{serviceName} /{version}.
+   * Do not specific a path unless you know what you're doing.
+   * @param path
+   */
   public void setPath(String path) {
     this.path = path;
   }
 
+  /**
+   * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
+   * @return
+   */
   public String getLb_policy() {
     return lb_policy;
   }
 
   /**
-   * @Title setLb_policy
-   * @Description TODO(针对协议为TCP或UDP的服务选择负载均衡策略)
-   * @param lb_policy (可选策略:round-robin,ip_hash)
+   * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
+   * @param lb_policy (round-robin,ip_hash)
    * @return void
    */
   public void setLb_policy(String lb_policy) {
@@ -80,23 +78,19 @@ public class Service<T> implements Serializable {
     return metadata;
   }
 
-  /**
-   * @Title setMetadata
-   * @Description TODO(配置服务特有的附加属性键值对)
-   * @param metadata
-   * @return void
-   */
   public void setMetadata(List<KeyVaulePair> metadata) {
     this.metadata = metadata;
   }
 
+  /**
+   * The service instance nodes
+   */
   public Set<T> getNodes() {
     return nodes;
   }
 
   /**
-   * @Title setNodes
-   * @Description TODO(配置服务的服务器实例列表)
+   * The service instance nodes
    * @param nodes
    * @return void
    */
@@ -104,43 +98,47 @@ public class Service<T> implements Serializable {
     this.nodes = nodes;
   }
 
+  /**
+   * An unique name of the service, it should be constant so the service consumer can access the service.
+   */
   public String getServiceName() {
     return serviceName;
   }
 
   /**
-   * 
-   * @Title setServiceName
-   * @Description TODO(服务名[必填])
+   * An unique name of the service, it should be constant so the service consumer can access the service.
    * @param serviceName
-   * @return void
    */
   public void setServiceName(String serviceName) {
     this.serviceName = serviceName;
   }
 
+  /**
+   * Service version. Only the major version of service is used in the URI.
+   * @return
+   */
   public String getVersion() {
     return version;
   }
 
   /**
-   * 
-   * @Title setVersion
-   * @Description TODO(版本号 ( 格式:v(小写)+数字))
+   * Service version. Only the major version of service is used in the URI.
    * @param version
-   * @return void
    */
   public void setVersion(String version) {
     this.version = version;
   }
 
+  /**
+   * The actual URL of the service to be registered.
+   * @return
+   */
   public String getUrl() {
     return url;
   }
 
   /**
-   * @Title setUrl
-   * @Description TODO(目标服务URL地址 (格式:url地址以/开头,不能以/结尾))
+   * The actual URL of the service to be registered.
    * @param url
    * @return void
    */
@@ -148,30 +146,36 @@ public class Service<T> implements Serializable {
     this.url = url;
   }
 
+  /**
+   * supported protocols: 'REST', 'UI'
+   * @return
+   */
   public String getProtocol() {
     return protocol;
   }
 
   /**
-   * @Title setProtocol
-   * @Description TODO(服务对应协议,比如REST、MQ、FTP、SNMP[必填])
+   * supported protocols: 'REST', 'UI'
    * @param protocol
-   * @return void
    */
   public void setProtocol(String protocol) {
     this.protocol = protocol;
   }
 
-
+  /**
+   * Visibility of the service. 
+   * External(can be accessed by external systems):0
+   * Internal(can only be accessed by ONAP microservices):1
+   */
   public String getVisualRange() {
     return visualRange;
   }
 
   /**
-   * @Title setVisualRange
-   * @Description TODO(服务的可见范围 系统间:0 系统内:1 ,多个可见范围用 "|"分隔,如"0|1" )
+   * Visibility of the service. 
+   * External(can be accessed by external systems):0
+   * Internal(can only be accessed by ONAP microservices):1
    * @param visualRange
-   * @return void
    */
   public void setVisualRange(String visualRange) {
     this.visualRange = visualRange;