msb discovery java client
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / discovery / common / RouteConst.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.common;
15
16 public class RouteConst {
17   public static final int SC_OK = 200;
18   public static final int SC_POST_OK = 201;
19   public static final int SC_DEL_OK = 204;
20   public static final int SC_NOTFOND = 404;
21   public static final String MSB_ROUTE_URL = "/api/microservices/v1/services";
22   public static final String REQUEST_SUCCESS = "SUCCESS";
23   public static final String REQUEST_FAIL = "FAIL";
24
25   public static final String LB_POLICY_LIST = "round-robin,ip_hash,least_conn";
26   public static final String LB_PARAMS_LIST = "weight,max_fails,fail_timeout";
27   public static final String SERVER_TYPE_LIST = "api,iui,custom,p2p";
28   public static final String CHECK_TYPE_LIST = "HTTP,TCP,TTL";
29   public static final String APIGATEWAY_NAME = "apigateway";
30   public static final String VISUAL_RANGE_IN = "1";
31
32
33
34   public enum Protocol {
35     REST, HTTP, MQ, FTP, SNMP, TCP, UDP, UI
36   }
37
38   public static boolean checkExistProtocol(String value) {
39     for (Protocol protocol : Protocol.values()) {
40       if (protocol.name().equals(value)) {
41         return true;
42       }
43     }
44     return false;
45   }
46
47
48   public static boolean checkExist(String list, String value) {
49     String[] listArray = list.split(",");
50     for (int i = 0; i < listArray.length; i++) {
51       if (value.equals(listArray[i]))
52         return true;
53     }
54     return false;
55   }
56
57   public static String listProtocol() {
58     String list = "";
59     for (Protocol protocol : Protocol.values()) {
60       list += protocol.name() + " | ";
61     }
62     return list;
63   }
64
65 }