1. Adjust the directory hierarchy
[msb/apigateway.git] / apiroute / apiroute-service / src / main / java / org / openo / msb / wrapper / ApiRouteServiceWrapper.java
diff --git a/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java b/apiroute/apiroute-service/src/main/java/org/openo/msb/wrapper/ApiRouteServiceWrapper.java
deleted file mode 100644 (file)
index 6f0ed7d..0000000
+++ /dev/null
@@ -1,653 +0,0 @@
-/**\r
-* Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*/\r
-package org.openo.msb.wrapper;\r
-\r
-import java.io.File;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.net.URL;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.apache.commons.lang3.StringUtils;\r
-import org.openo.msb.api.ApiRouteInfo;\r
-import org.openo.msb.api.DiscoverInfo;\r
-import org.openo.msb.api.RouteServer;\r
-import org.openo.msb.api.exception.ExtendedInternalServerErrorException;\r
-import org.openo.msb.api.exception.ExtendedNotFoundException;\r
-import org.openo.msb.api.exception.ExtendedNotSupportedException;\r
-import org.openo.msb.wrapper.util.JedisUtil;\r
-import org.openo.msb.wrapper.util.RegExpTestUtil;\r
-import org.openo.msb.wrapper.util.RouteUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import redis.clients.jedis.Jedis;\r
-\r
-\r
-\r
-/**\r
- * @ClassName: ApiRouteServiceWrapper\r
- * @Description: TODO(ApiRoute服务类)\r
- * @author tanghua10186366\r
- * @date 2015年9月25日 上午9:44:04\r
- * \r
- */\r
-public class ApiRouteServiceWrapper {\r
-\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(ApiRouteServiceWrapper.class);\r
-\r
-\r
-    private static ApiRouteServiceWrapper instance = new ApiRouteServiceWrapper();\r
-\r
-    private ApiRouteServiceWrapper() {}\r
-\r
-    public static ApiRouteServiceWrapper getInstance() {\r
-        return instance;\r
-    }\r
-\r
-    /**\r
-     * @Title: getAllApiRouteInstances\r
-     * @Description: TODO(获取全部服务列表)\r
-     * @param: @return\r
-     * @return: ApiRouteInfoBean[]\r
-     */\r
-    public ApiRouteInfo[] getAllApiRouteInstances() {\r
-\r
-\r
-        Jedis jedis = null;\r
-        ApiRouteInfo[] apiRouteList = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis == null) {\r
-                throw new ExtendedInternalServerErrorException(\r
-                        "fetch from jedis pool failed,null object!");\r
-            }\r
-\r
-            // 获取全部服务列表\r
-            String routekey =\r
-                    RouteUtil\r
-                            .getPrefixedKey("", RouteUtil.APIROUTE, "*", RouteUtil.ROUTE_PATH_INFO);\r
-            Set<String> routeSet = jedis.keys(routekey);\r
-            apiRouteList = new ApiRouteInfo[routeSet.size()];\r
-\r
-            int i = 0;\r
-            for (String routePath : routeSet) {\r
-                String[] routePathArray = routePath.split(":");\r
-                ApiRouteInfo apiRoute =\r
-                        getApiRouteInstance(routePathArray[3], routePathArray[4], jedis);\r
-                apiRouteList[i] = apiRoute;\r
-                i++;\r
-            }\r
-\r
-\r
-        } catch (Exception e) {\r
-            LOGGER.error("call redis throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("call redis throw exception:"\r
-                    + e.getMessage());\r
-\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-        return apiRouteList;\r
-    }\r
-\r
-\r
-\r
-    public static boolean checkRedisConnect() {\r
-\r
-        Jedis jedis = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis != null) {\r
-                return true;\r
-            }\r
-        } catch (Exception e) {\r
-            LOGGER.error("call redis throw exception", e);\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-        return false;\r
-    }\r
-\r
-    /**\r
-     * @Title: getApiRouteInstance\r
-     * @Description: TODO(通过服务名+版本号获取单个服务对象信息)\r
-     * @param: @param serviceName\r
-     * @param: @param version\r
-     * @param: @return\r
-     * @return: ApiRouteInfo\r
-     */\r
-    public ApiRouteInfo getApiRouteInstance(String serviceName, String version) {\r
-\r
-        if (StringUtils.isBlank(serviceName)) {\r
-            throw new ExtendedNotSupportedException("serviceName  can't be empty");\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(version)) {\r
-            if (!RegExpTestUtil.versionRegExpTest(version)) {\r
-                throw new ExtendedNotSupportedException("version (" + version\r
-                        + ") is not a valid  format");\r
-            }\r
-        }\r
-\r
-\r
-        ApiRouteInfo apiRouteInfo = null;\r
-\r
-        Jedis jedis = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis == null) {\r
-                throw new ExtendedInternalServerErrorException(\r
-                        "fetch from jedis pool failed,null object!");\r
-            }\r
-\r
-            apiRouteInfo = getApiRouteInstance(serviceName, version, jedis);\r
-\r
-\r
-        } catch (Exception e) {\r
-            LOGGER.error("call redis throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("call redis throw exception:"\r
-                    + e.getMessage());\r
-\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-        if (null == apiRouteInfo) {\r
-            String errInfo =\r
-                    "ApiRouteInfo not found: serviceName-" + serviceName + " ,version-" + version;\r
-            LOGGER.warn(errInfo);\r
-            throw new ExtendedNotFoundException(errInfo);\r
-\r
-        }\r
-\r
-        return apiRouteInfo;\r
-\r
-    }\r
-\r
-    public ApiRouteInfo getApiRouteInstance(String serviceName, String version, Jedis jedis)\r
-            throws Exception {\r
-        if ("null".equals(version)) {\r
-            version = "";\r
-        }\r
-\r
-        ApiRouteInfo apiRouteInfo = null;\r
-\r
-\r
-        // 获取info信息\r
-        String routekey =\r
-                RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,\r
-                        RouteUtil.ROUTE_PATH_INFO);\r
-        Map<String, String> infomap = jedis.hgetAll(routekey);\r
-        if (!infomap.isEmpty()) {\r
-            apiRouteInfo = new ApiRouteInfo();\r
-            apiRouteInfo.setServiceName(serviceName);\r
-            apiRouteInfo.setVersion(version);\r
-            apiRouteInfo.setUrl(infomap.get("url"));\r
-            apiRouteInfo.setMetricsUrl(infomap.get("metricsUrl"));\r
-            apiRouteInfo.setApiJson(infomap.get("apijson"));\r
-            apiRouteInfo.setApiJsonType(infomap.get("apiJsonType"));\r
-            apiRouteInfo.setControl(infomap.get("control"));\r
-            apiRouteInfo.setStatus(infomap.get("status"));\r
-            apiRouteInfo.setVisualRange(infomap.get("visualRange"));\r
-            apiRouteInfo.setUseOwnUpstream(infomap.get("useOwnUpstream"));\r
-\r
-\r
-            // 获取负载均衡信息\r
-            String serviceLBkey =\r
-                    RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,\r
-                            RouteUtil.ROUTE_PATH_LOADBALANCE);\r
-            Set<String> serviceLBset = jedis.keys(serviceLBkey + ":*");\r
-            int serverNum = serviceLBset.size();\r
-            RouteServer[] apiRouteServerList = new RouteServer[serverNum];\r
-            int i = 0;\r
-            for (String serviceInfo : serviceLBset) {\r
-                Map<String, String> serviceLBmap = jedis.hgetAll(serviceInfo);\r
-                RouteServer server = new RouteServer();\r
-                server.setIp(serviceLBmap.get("ip"));\r
-                server.setPort(serviceLBmap.get("port"));\r
-                server.setWeight(Integer.parseInt(serviceLBmap.get("weight")));\r
-                apiRouteServerList[i] = server;\r
-                i++;\r
-            }\r
-\r
-            apiRouteInfo.setServers(apiRouteServerList);\r
-\r
-            // 获取生命周期信息\r
-\r
-//            ApiRouteLifeCycle lifeCycle = new ApiRouteLifeCycle();\r
-//            String serviceLifekey =\r
-//                    RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,\r
-//                            RouteUtil.APIROUTE_PATH_LIFE);\r
-//            Map<String, String> serviceLifeMap = jedis.hgetAll(serviceLifekey);\r
-//\r
-//            lifeCycle.setInstallPath(serviceLifeMap.get("path"));\r
-//            lifeCycle.setStartScript(serviceLifeMap.get("start"));\r
-//            lifeCycle.setStopScript(serviceLifeMap.get("stop"));\r
-//\r
-//            apiRouteInfo.setLifeCycle(lifeCycle);\r
-        }\r
-\r
-\r
-        return apiRouteInfo;\r
-    }\r
-\r
-    /**\r
-     * @Title: updateApiRouteInstance\r
-     * @Description: TODO(更新单个服务信息)\r
-     * @param: @param serviceName\r
-     * @param: @param version\r
-     * @param: @param apiRouteInfo\r
-     * @param: @return\r
-     * @return: ApiRouteInfo\r
-     */\r
-    public synchronized ApiRouteInfo updateApiRouteInstance(String serviceName, String version,\r
-            ApiRouteInfo apiRouteInfo, String serverPort) {\r
-\r
-        if ("null".equals(version)) {\r
-            version = "";\r
-        }\r
-        \r
-        if (StringUtils.isBlank(serviceName)) {\r
-            throw new ExtendedNotSupportedException("serviceName  can't be empty");\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(version)) {\r
-            if (!RegExpTestUtil.versionRegExpTest(version)) {\r
-                throw new ExtendedNotSupportedException("version (" + version\r
-                        + ") is not a valid  format");\r
-            }\r
-        }\r
-\r
-        \r
-\r
-\r
-        try {\r
-\r
-\r
-            if (serviceName.equals(apiRouteInfo.getServiceName())\r
-                    && version.equals(apiRouteInfo.getVersion())) {\r
-                // 删除已存在负载均衡服务器信息\r
-                deleteApiRoute(serviceName, version, RouteUtil.ROUTE_PATH_LOADBALANCE + "*",\r
-                        serverPort);\r
-\r
-            } else {\r
-                // 如果已修改服务名或者版本号,先删除此服务全部已有信息\r
-                deleteApiRoute(serviceName, version, "*", serverPort);\r
-            }\r
-\r
-\r
-            saveApiRouteInstance(apiRouteInfo, serverPort);\r
-\r
-\r
-        } catch (ExtendedNotSupportedException e) {\r
-            throw e;\r
-        } catch (Exception e) {\r
-            LOGGER.error("update ApiRoute throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("update apiRouteInfo throw exception"\r
-                    + e.getMessage());\r
-\r
-        }\r
-\r
-        return apiRouteInfo;\r
-\r
-    }\r
-\r
-    /**\r
-     * @Title updateApiRouteStatus\r
-     * @Description TODO(更新单个服务状态)\r
-     * @param serviceName\r
-     * @param version\r
-     * @param status\r
-     * @return\r
-     * @return RouteResult\r
-     */\r
-    public synchronized ApiRouteInfo updateApiRouteStatus(String serviceName, String version,\r
-            String status) {\r
-\r
-        if ("null".equals(version)) {\r
-            version = "";\r
-        }\r
-        \r
-        if (StringUtils.isBlank(serviceName)) {\r
-            throw new ExtendedNotSupportedException("serviceName  can't be empty");\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(version)) {\r
-            if (!RegExpTestUtil.versionRegExpTest(version)) {\r
-                throw new ExtendedNotSupportedException("version (" + version\r
-                        + ") is not a valid  format");\r
-            }\r
-        }\r
-\r
-        if (!RouteUtil.contain(RouteUtil.statusRangeMatches, status)) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save ApiRouteInfo  Status FAIL:status is wrong,value range:("\r
-                            + RouteUtil.show(RouteUtil.statusRangeMatches) + ")");\r
-        }\r
-\r
-        ApiRouteInfo new_apiRouteInfo = getApiRouteInstance(serviceName, version);\r
-\r
-\r
-        // 准备info信息\r
-        String serviceInfokey =\r
-                RouteUtil.getPrefixedKey("", RouteUtil.APIROUTE, serviceName, version,\r
-                        RouteUtil.ROUTE_PATH_INFO);\r
-        Map<String, String> serviceInfoMap = new HashMap<String, String>();\r
-        serviceInfoMap.put("status", status);\r
-\r
-\r
-        Jedis jedis = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis == null) {\r
-                throw new Exception("fetch from jedis pool failed,null object!");\r
-            }\r
-            // 保存info信息\r
-            jedis.hmset(serviceInfokey, serviceInfoMap);\r
-            new_apiRouteInfo.setStatus(status);\r
-\r
-\r
-        } catch (Exception e) {\r
-            LOGGER.error("update ApiRoute status throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("update ApiRoute status throw exception"\r
-                    + e.getMessage());\r
-\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-        return new_apiRouteInfo;\r
-    }\r
-\r
-\r
-    /**\r
-     * @Title: saveApiRouteInstance\r
-     * @Description: TODO(存储单个服务信息)\r
-     * @param: @param apiRouteInfo\r
-     * @param: @return\r
-     * @return: ApiRouteInfo\r
-     */\r
-    public synchronized ApiRouteInfo saveApiRouteInstance(ApiRouteInfo apiRouteInfo,\r
-            String serverPort) {\r
-\r
-       \r
-        \r
-        if (StringUtils.isBlank(apiRouteInfo.getServiceName())\r
-                || apiRouteInfo.getServers().length == 0) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save apiRouteInfo FAIL: Some required fields are empty");\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(apiRouteInfo.getVersion())) {\r
-            if (!RegExpTestUtil.versionRegExpTest(apiRouteInfo.getVersion())) {\r
-                throw new ExtendedNotSupportedException("version (" + apiRouteInfo.getVersion()\r
-                        + ") is not a valid  format");\r
-            }\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(apiRouteInfo.getUrl())) {\r
-            if (!RegExpTestUtil.urlRegExpTest(apiRouteInfo.getUrl())) {\r
-                throw new ExtendedNotSupportedException(\r
-                        "save apiRouteInfo FAIL:url is not a valid format(url must be begin with /)");\r
-    \r
-            }\r
-        }\r
-\r
-        if (!RouteUtil.contain(RouteUtil.visualRangeRange, apiRouteInfo.getVisualRange())) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save apiRouteInfo FAIL:VisualRange is wrong,value range:("\r
-                            + RouteUtil.show(RouteUtil.visualRangeMatches) + ")");\r
-        }\r
-\r
-        if (!RouteUtil.contain(RouteUtil.controlRangeMatches, apiRouteInfo.getControl())) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save apiRouteInfo FAIL:control is wrong,value range:("\r
-                            + RouteUtil.show(RouteUtil.controlRangeMatches) + ")");\r
-        }\r
-\r
-        if (!RouteUtil.contain(RouteUtil.statusRangeMatches, apiRouteInfo.getStatus())) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save apiRouteInfo FAIL:status is wrong,value range:("\r
-                            + RouteUtil.show(RouteUtil.statusRangeMatches) + ")");\r
-        }\r
-\r
-        if (!RouteUtil.contain(RouteUtil.useOwnUpstreamRangeMatches, apiRouteInfo.getUseOwnUpstream())) {\r
-            throw new ExtendedNotSupportedException(\r
-                    "save apiRouteInfo FAIL:useOwnUpstream is wrong,value range:("\r
-                            + RouteUtil.show(RouteUtil.useOwnUpstreamRangeMatches) + ")");\r
-        }\r
-\r
-        // 检查服务实例格式\r
-        RouteServer[] serverList = apiRouteInfo.getServers();\r
-        for (int i = 0; i < serverList.length; i++) {\r
-            RouteServer server = serverList[i];\r
-            if (!RegExpTestUtil.ipRegExpTest(server.getIp())) {\r
-                throw new ExtendedNotSupportedException("save apiRouteInfo FAIL:IP("\r
-                        + server.getIp() + ")is not a valid ip address");\r
-            }\r
-\r
-            if (!RegExpTestUtil.portRegExpTest(server.getPort())) {\r
-                throw new ExtendedNotSupportedException("save apiRouteInfo FAIL:Port("\r
-                        + server.getPort() + ")is not a valid Port address");\r
-            }\r
-        }\r
-\r
-        // 准备info信息\r
-        String serviceInfokey =\r
-                RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,\r
-                        apiRouteInfo.getServiceName().trim(), apiRouteInfo.getVersion().trim(),\r
-                        RouteUtil.ROUTE_PATH_INFO);\r
-        Map<String, String> serviceInfoMap = new HashMap<String, String>();\r
-        serviceInfoMap.put("url", "/".equals(apiRouteInfo.getUrl().trim()) ? "" : apiRouteInfo\r
-                .getUrl().trim());\r
-        serviceInfoMap.put("apijson", apiRouteInfo.getApiJson());\r
-        serviceInfoMap.put("apiJsonType", apiRouteInfo.getApiJsonType());\r
-        serviceInfoMap.put("metricsUrl", apiRouteInfo.getMetricsUrl());\r
-        serviceInfoMap.put("control", apiRouteInfo.getControl());\r
-        serviceInfoMap.put("status", apiRouteInfo.getStatus());\r
-        serviceInfoMap.put("visualRange", apiRouteInfo.getVisualRange());\r
-        serviceInfoMap.put("useOwnUpstream", apiRouteInfo.getUseOwnUpstream());\r
-\r
-        // 准备负载均衡信息\r
-        String serviceLBkey =\r
-                RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,\r
-                        apiRouteInfo.getServiceName(), apiRouteInfo.getVersion(),\r
-                        RouteUtil.ROUTE_PATH_LOADBALANCE);\r
-\r
-\r
-        Jedis jedis = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis == null) {\r
-                throw new ExtendedInternalServerErrorException(\r
-                        "fetch from jedis pool failed,null object!");\r
-            }\r
-            // 保存info信息\r
-            jedis.hmset(serviceInfokey, serviceInfoMap);\r
-\r
-            // 保存负载均衡信息\r
-            for (int i = 0; i < serverList.length; i++) {\r
-                Map<String, String> servermap = new HashMap<String, String>();\r
-                RouteServer server = serverList[i];\r
-\r
-                servermap.put("ip", server.getIp());\r
-                servermap.put("port", server.getPort());\r
-                servermap.put("weight", Integer.toString(server.getWeight()));\r
-\r
-                jedis.hmset(serviceLBkey + ":server" + (i + 1), servermap);\r
-            }\r
-            // 保存生命周期信息\r
-\r
-//            ApiRouteLifeCycle lifeCycle = apiRouteInfo.getLifeCycle();\r
-//            if (lifeCycle != null) {\r
-//                String serviceLifekey =\r
-//                        RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE,\r
-//                                apiRouteInfo.getServiceName(), apiRouteInfo.getVersion(),\r
-//                                RouteUtil.APIROUTE_PATH_LIFE);\r
-//                Map<String, String> serviceLifeMap = new HashMap<String, String>();\r
-//                serviceLifeMap.put("path", lifeCycle.getInstallPath());\r
-//                serviceLifeMap.put("start", lifeCycle.getStartScript());\r
-//                serviceLifeMap.put("stop", lifeCycle.getStopScript());\r
-//                jedis.hmset(serviceLifekey, serviceLifeMap);\r
-//            }\r
-\r
-\r
-\r
-        } catch (Exception e) {\r
-            LOGGER.error("call redis throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("call redis throw exception:"\r
-                    + e.getMessage());\r
-\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-        return apiRouteInfo;\r
-    }\r
-\r
-\r
-\r
-    /**\r
-     * @Title: deleteApiRoute\r
-     * @Description: TODO(删除单个服务信息)\r
-     * @param: @param type\r
-     * @param: @param serviceName\r
-     * @param: @param version\r
-     * @param: @param delKey\r
-     * @param: @return\r
-     * @return: void\r
-     */\r
-    public synchronized void deleteApiRoute(String serviceName, String version, String delKey,\r
-            String serverPort) {\r
-\r
-        if ("null".equals(version)) {\r
-            version = "";\r
-        }\r
-        \r
-        if (StringUtils.isBlank(serviceName)) {\r
-            throw new ExtendedNotSupportedException("serviceName  can't be empty");\r
-        }\r
-\r
-        if (StringUtils.isNotBlank(version)) {\r
-            if (!RegExpTestUtil.versionRegExpTest(version)) {\r
-                throw new ExtendedNotSupportedException("version (" + version\r
-                        + ") is not a valid  format");\r
-            }\r
-        }\r
-\r
-        \r
-        Jedis jedis = null;\r
-        try {\r
-            jedis = JedisUtil.borrowJedisInstance();\r
-            if (jedis == null) {\r
-                throw new ExtendedInternalServerErrorException(\r
-                        "fetch from jedis pool failed,null object!");\r
-            }\r
-\r
-            // 获取info信息\r
-            String routekey =\r
-                    RouteUtil.getPrefixedKey(serverPort, RouteUtil.APIROUTE, serviceName, version,\r
-                            delKey);\r
-            Set<String> infoSet = jedis.keys(routekey);\r
-\r
-            if (infoSet.isEmpty()) {\r
-                throw new ExtendedNotFoundException("delete ApiRoute FAIL:serviceName-"\r
-                        + serviceName + ",version:" + version + " not fond ");\r
-            }\r
-\r
-            String[] paths = new String[infoSet.size()];\r
-\r
-            // Set-->数组\r
-            infoSet.toArray(paths);\r
-\r
-            jedis.del(paths);\r
-\r
-\r
-        } catch (ExtendedNotFoundException e) {\r
-            throw e;\r
-        } catch (Exception e) {\r
-            LOGGER.error("delete ApiRoute throw exception", e);\r
-            throw new ExtendedInternalServerErrorException("delete ApiRoute throw exception:"\r
-                    + e.getMessage());\r
-        } finally {\r
-            JedisUtil.returnJedisInstance(jedis);\r
-        }\r
-\r
-\r
-    }\r
-\r
-    /**\r
-     * @Title: getAllApiDocs\r
-     * @Description: TODO(获取本地ext\initSwaggerJson目录的全部json文件目录)\r
-     * @param: @return\r
-     * @return: String[]\r
-     */\r
-    public String[] getAllApiDocs() {\r
-        URL apiDocsPath = ApiRouteServiceWrapper.class.getResource("/ext/initSwaggerJson");\r
-        if (apiDocsPath != null) {\r
-            String path = apiDocsPath.getPath();\r
-\r
-            try {\r
-                return readfile(path);\r
-            } catch (FileNotFoundException e) {\r
-                // TODO Auto-generated catch block\r
-                LOGGER.error("read  ApiDocs Files throw FileNotFoundException", e);\r
-                throw new ExtendedInternalServerErrorException("read  ApiDocs Files throw FileNotFoundException:"\r
-                        + e.getMessage());\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-                LOGGER.error("read  ApiDocs Files throw IOexception", e);\r
-                throw new ExtendedInternalServerErrorException("read  ApiDocs Files throw IOexception:"\r
-                        + e.getMessage());\r
-            }\r
-\r
-        }\r
-\r
-\r
-        return null;\r
-    }\r
-\r
-    /**\r
-     * 读取某个文件夹下的所有文件\r
-     */\r
-    public String[] readfile(String filepath) throws FileNotFoundException, IOException {\r
-        File file = new File(filepath);\r
-        if (file.isDirectory()) {\r
-            String[] filelist = file.list();\r
-            return filelist;\r
-        }\r
-        return null;\r
-    }\r
-\r
-    public String getApiGatewayPort() {\r
-        // return JedisUtil.serverIp+":"+JedisUtil.serverPort;\r
-        return System.getenv("APIGATEWAY_EXPOSE_PORT") == null ? String\r
-                .valueOf(JedisUtil.serverPort) : System.getenv("APIGATEWAY_EXPOSE_PORT");\r
-\r
-    }\r
-\r
-    public DiscoverInfo getServiceDiscoverInfo() {\r
-        return RouteUtil.discoverInfo;\r
-\r
-    }\r
-\r
-\r
-}\r