msb discovery java client
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / discovery / entity / Service.java
1 /*******************************************************************************
2  * Copyright 2017 ZTE, Inc. and others.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  * 
7  * http://www.apache.org/licenses/LICENSE-2.0
8  * 
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  ******************************************************************************/
14 package org.onap.msb.sdk.discovery.entity;
15
16 import java.io.Serializable;
17 import java.util.List;
18 import java.util.Set;
19
20 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
21
22 @JsonIgnoreProperties(ignoreUnknown = true)
23 public class Service<T> implements Serializable {
24   private static final long serialVersionUID = 1L;
25   // 服务名[必填]
26   private String serviceName;
27   // 版本号 ( 格式:v(小写)+数字)
28   private String version = "";
29   // 服务url (格式:url地址以/开头,不能以/结尾)
30   private String url = "";
31   // 服务对应协议,比如REST、UI、HTTP、MQ、FTP、SNMP、TCP、UDP
32   private String protocol = "";
33   // 服务的可见范围 0:系统间 1:系统内
34   private String visualRange = "1";
35
36   // 负载均衡策略类型
37   private String lb_policy = "";
38
39
40   private String host = "";
41
42   private String path = "";
43
44   private Set<T> nodes;
45
46   // 服务自身属性的键值对
47   private List<KeyVaulePair> metadata;
48
49   public String getHost() {
50     return host;
51   }
52
53   public void setHost(String host) {
54     this.host = host;
55   }
56
57   public String getPath() {
58     return path;
59   }
60
61   public void setPath(String path) {
62     this.path = path;
63   }
64
65   public String getLb_policy() {
66     return lb_policy;
67   }
68
69   /**
70    * @Title setLb_policy
71    * @Description TODO(针对协议为TCP或UDP的服务选择负载均衡策略)
72    * @param lb_policy (可选策略:round-robin,ip_hash)
73    * @return void
74    */
75   public void setLb_policy(String lb_policy) {
76     this.lb_policy = lb_policy;
77   }
78
79   public List<KeyVaulePair> getMetadata() {
80     return metadata;
81   }
82
83   /**
84    * @Title setMetadata
85    * @Description TODO(配置服务特有的附加属性键值对)
86    * @param metadata
87    * @return void
88    */
89   public void setMetadata(List<KeyVaulePair> metadata) {
90     this.metadata = metadata;
91   }
92
93   public Set<T> getNodes() {
94     return nodes;
95   }
96
97   /**
98    * @Title setNodes
99    * @Description TODO(配置服务的服务器实例列表)
100    * @param nodes
101    * @return void
102    */
103   public void setNodes(Set<T> nodes) {
104     this.nodes = nodes;
105   }
106
107   public String getServiceName() {
108     return serviceName;
109   }
110
111   /**
112    * 
113    * @Title setServiceName
114    * @Description TODO(服务名[必填])
115    * @param serviceName
116    * @return void
117    */
118   public void setServiceName(String serviceName) {
119     this.serviceName = serviceName;
120   }
121
122   public String getVersion() {
123     return version;
124   }
125
126   /**
127    * 
128    * @Title setVersion
129    * @Description TODO(版本号 ( 格式:v(小写)+数字))
130    * @param version
131    * @return void
132    */
133   public void setVersion(String version) {
134     this.version = version;
135   }
136
137   public String getUrl() {
138     return url;
139   }
140
141   /**
142    * @Title setUrl
143    * @Description TODO(目标服务URL地址 (格式:url地址以/开头,不能以/结尾))
144    * @param url
145    * @return void
146    */
147   public void setUrl(String url) {
148     this.url = url;
149   }
150
151   public String getProtocol() {
152     return protocol;
153   }
154
155   /**
156    * @Title setProtocol
157    * @Description TODO(服务对应协议,比如REST、MQ、FTP、SNMP[必填])
158    * @param protocol
159    * @return void
160    */
161   public void setProtocol(String protocol) {
162     this.protocol = protocol;
163   }
164
165
166   public String getVisualRange() {
167     return visualRange;
168   }
169
170   /**
171    * @Title setVisualRange
172    * @Description TODO(服务的可见范围 系统间:0 系统内:1 ,多个可见范围用 "|"分隔,如"0|1" )
173    * @param visualRange
174    * @return void
175    */
176   public void setVisualRange(String visualRange) {
177     this.visualRange = visualRange;
178   }
179
180 }