Merge "Remove the dependency of jackson databind."
[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
28   private String version = "";
29   
30   private String url = "";
31   
32   //REST、UI
33   private String protocol = "";
34   //0: External 1: Internal
35   private String visualRange = "1";
36
37   private String lb_policy = "";
38
39   private String path = "";
40
41   private Set<T> nodes;
42
43   private List<KeyVaulePair> metadata;
44
45   public String getPath() {
46     return path;
47   }
48
49   /**
50    * The customized publish path of this service.
51    * If this parameter is specified when registering the service, the service will be published to api gateway under this path.
52    * Otherwise, the service will be published to api gateway using a fixed format: api/{serviceName} /{version}.
53    * Do not specific a path unless you know what you're doing.
54    * @param path
55    */
56   public void setPath(String path) {
57     this.path = path;
58   }
59
60   /**
61    * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
62    * @return
63    */
64   public String getLb_policy() {
65     return lb_policy;
66   }
67
68   /**
69    * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
70    * @param lb_policy (round-robin,ip_hash)
71    * @return void
72    */
73   public void setLb_policy(String lb_policy) {
74     this.lb_policy = lb_policy;
75   }
76
77   public List<KeyVaulePair> getMetadata() {
78     return metadata;
79   }
80
81   public void setMetadata(List<KeyVaulePair> metadata) {
82     this.metadata = metadata;
83   }
84
85   /**
86    * The service instance nodes
87    */
88   public Set<T> getNodes() {
89     return nodes;
90   }
91
92   /**
93    * The service instance nodes
94    * @param nodes
95    * @return void
96    */
97   public void setNodes(Set<T> nodes) {
98     this.nodes = nodes;
99   }
100
101   /**
102    * An unique name of the service, it should be constant so the service consumer can access the service.
103    */
104   public String getServiceName() {
105     return serviceName;
106   }
107
108   /**
109    * An unique name of the service, it should be constant so the service consumer can access the service.
110    * @param serviceName
111    */
112   public void setServiceName(String serviceName) {
113     this.serviceName = serviceName;
114   }
115
116   /**
117    * Service version. Only the major version of service is used in the URI.
118    * @return
119    */
120   public String getVersion() {
121     return version;
122   }
123
124   /**
125    * Service version. Only the major version of service is used in the URI.
126    * @param version
127    */
128   public void setVersion(String version) {
129     this.version = version;
130   }
131
132   /**
133    * The actual URL of the service to be registered.
134    * @return
135    */
136   public String getUrl() {
137     return url;
138   }
139
140   /**
141    * The actual URL of the service to be registered.
142    * @param url
143    * @return void
144    */
145   public void setUrl(String url) {
146     this.url = url;
147   }
148
149   /**
150    * supported protocols: 'REST', 'UI'
151    * @return
152    */
153   public String getProtocol() {
154     return protocol;
155   }
156
157   /**
158    * supported protocols: 'REST', 'UI'
159    * @param protocol
160    */
161   public void setProtocol(String protocol) {
162     this.protocol = protocol;
163   }
164
165   /**
166    * Visibility of the service. 
167    * External(can be accessed by external systems):0
168    * Internal(can only be accessed by ONAP microservices):1
169    */
170   public String getVisualRange() {
171     return visualRange;
172   }
173
174   /**
175    * Visibility of the service. 
176    * External(can be accessed by external systems):0
177    * Internal(can only be accessed by ONAP microservices):1
178    * @param visualRange
179    */
180   public void setVisualRange(String visualRange) {
181     this.visualRange = visualRange;
182   }
183
184 }