2 * Copyright 2016 2015-2016 ZTE, Inc. and others. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openo.msb.wrapper.util;
18 import org.apache.commons.lang3.StringUtils;
19 import org.openo.msb.api.DiscoverInfo;
22 public class RouteUtil {
24 public static String IUI_ROOT_PATH="iui";
26 public static String API_ROOT_PATH="api";
28 public static final String ROUTE_PATH="msb:routing";
30 public static final String APIROUTE="api";
32 public static final String IUIROUTE="iui";
34 public static final String CUSTOMROUTE="custom";
36 public static final String P2PROUTE="p2p";
39 public static final String ROUTE_PATH_INFO="info";
41 public static final String ROUTE_PATH_LOADBALANCE="lb";
43 public static final String APIROUTE_PATH_LIFE="life";
46 public static final String REQUEST_SUCCESS = "SUCCESS";
48 public static final String REQUEST_FAIL = "FAIL";
50 public static String PROTOCOL_LIST="REST,UI,MQ,FTP,SNMP,TCP,UDP";
52 public static DiscoverInfo discoverInfo=new DiscoverInfo();
55 public static String[] visualRangeRange={"0","1"};
57 public static String[] controlRangeMatches={"0","1","2"};
59 public static String[] statusRangeMatches={"0","1"};
61 public static String[] useOwnUpstreamRangeMatches={"0","1"};
63 public static String[] visualRangeMatches={"1"};
66 * @Title: getPrefixedKey
67 * @Description: TODO(Add base path prefix radis assembly path)
68 * @param: @param serviceName
69 * @param: @param version
75 public static String getPrefixedKey(String...paths){
76 StringBuffer sb= new StringBuffer();
78 if(paths[0].trim().equals("") || paths[0].equals(String.valueOf(JedisUtil.serverPort))){
79 sb.append(ROUTE_PATH);
85 for (int i = 1; i < paths.length; i++) {
93 public static Object[] concat(Object[] a, Object[] b) {
94 Object[] c= new Object[a.length+b.length];
95 System.arraycopy(a, 0, c, 0, a.length);
96 System.arraycopy(b, 0, c, a.length, b.length);
100 public static boolean contain(String[] array,String str){
101 for(int i=0;i<array.length;i++){
102 if(array[i].equals(str)){
110 public static boolean contain(String[] array,String value[]){
111 for(int i=0;i<array.length;i++){
112 for(int n=0;n<value.length;n++){
113 if(array[i].equals(value[n])){
122 public static String show(String[] array){
124 return StringUtils.join(array, "|");
128 public static void main(String[] args) {
129 String array[]={"1","2"};
130 System.out.println(StringUtils.join(array, "|"));