diff options
Diffstat (limited to 'apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao')
15 files changed, 274 insertions, 418 deletions
diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOConstants.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOConstants.java index 8cf2c04..876d5d6 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOConstants.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOConstants.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao; diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOFactory.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOFactory.java index 5836fc1..21d452c 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOFactory.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/DAOFactory.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao; @@ -24,10 +22,11 @@ public class DAOFactory { private static final IRouteDAO routeDAO = new RouteDAOImpl(); private static final IServiceDAO serviceDAO = new ServiceDAOImpl(); - public static IRouteDAO getRouteDAO(){ + public static IRouteDAO getRouteDAO() { return routeDAO; } - public static IServiceDAO getServiceDAO(){ + + public static IServiceDAO getServiceDAO() { return serviceDAO; } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/RedisAccessWrapper.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/RedisAccessWrapper.java index a789c0a..db74a42 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/RedisAccessWrapper.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/RedisAccessWrapper.java @@ -1,46 +1,45 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.onap.msb.apiroute.wrapper.util.JedisUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import redis.clients.jedis.Jedis; import redis.clients.jedis.ScanParams; import redis.clients.jedis.ScanResult; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - public class RedisAccessWrapper { private static final Logger LOGGER = LoggerFactory.getLogger(RedisAccessWrapper.class); - //An iteration starts when the cursor is set to 0 + // An iteration starts when the cursor is set to 0 private static final String REDIS_SCAN_POINTER_NEW_ITERATION = "0"; - //An iteration terminated when the cursor returned by the server is 0 + // An iteration terminated when the cursor returned by the server is 0 private static final String REDIS_SCAN_POINTER_ITERATION_END = "0"; private static final int REDIS_SCAN_COUNT = 50; - public static void save(String key,String value) throws Exception { + public static void save(String key, String value) throws Exception { Jedis jedis = null; try { jedis = JedisUtil.borrowJedisInstance(); - jedis.set(key,value); + jedis.set(key, value); } finally { JedisUtil.returnJedisInstance(jedis); } @@ -52,7 +51,7 @@ public class RedisAccessWrapper { try { jedis = JedisUtil.borrowJedisInstance(); value = jedis.get(key); - }finally { + } finally { JedisUtil.returnJedisInstance(jedis); } return value; @@ -88,9 +87,9 @@ public class RedisAccessWrapper { Jedis jedis = null; try { jedis = JedisUtil.borrowJedisInstance(); - for(String key : keySet){ + for (String key : keySet) { String value = jedis.get(key); - if(value !=null && !"".equals(value)){ + if (value != null && !"".equals(value)) { valueList.add(value); } } @@ -106,7 +105,7 @@ public class RedisAccessWrapper { Jedis jedis = null; try { jedis = JedisUtil.borrowJedisInstance(); - for(String key : keySet){ + for (String key : keySet) { long reply = jedis.del(key); replySum = replySum + reply; } @@ -117,12 +116,13 @@ public class RedisAccessWrapper { } /** - * filter the keys according to the given pattern - * using "scan" instead of using "keys", incrementally iterate the keys space + * filter the keys according to the given pattern using "scan" instead of using "keys", + * incrementally iterate the keys space + * * @param pattern the input filter pattern * @return the matched keys set */ - public static Set<String> filterKeys(String pattern) throws Exception{ + public static Set<String> filterKeys(String pattern) throws Exception { long start = System.currentTimeMillis(); Jedis jedis = null; Set<String> filteredKeys = new HashSet<>(); @@ -131,17 +131,17 @@ public class RedisAccessWrapper { scanParams.count(REDIS_SCAN_COUNT); try { jedis = JedisUtil.borrowJedisInstance(); - ScanResult<String> scanResult = jedis.scan(REDIS_SCAN_POINTER_NEW_ITERATION,scanParams); + ScanResult<String> scanResult = jedis.scan(REDIS_SCAN_POINTER_NEW_ITERATION, scanParams); filteredKeys.addAll(scanResult.getResult()); - while(!scanResult.getStringCursor().equals(REDIS_SCAN_POINTER_ITERATION_END)){ - scanResult = jedis.scan(scanResult.getStringCursor(),scanParams); + while (!scanResult.getStringCursor().equals(REDIS_SCAN_POINTER_ITERATION_END)) { + scanResult = jedis.scan(scanResult.getStringCursor(), scanParams); filteredKeys.addAll(scanResult.getResult()); } } finally { JedisUtil.returnJedisInstance(jedis); } long end = System.currentTimeMillis(); - long costTime = end-start; + long costTime = end - start; LOGGER.info("filterKeys " + pattern + " count:" + filteredKeys.size() + " cost: " + costTime); return filteredKeys; } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/IRouteDAO.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/IRouteDAO.java index b4157d4..7a1c310 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/IRouteDAO.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/IRouteDAO.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route; diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java index 29e8066..c365c8c 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/RouteDAOImpl.java @@ -1,22 +1,18 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route; -import com.fasterxml.jackson.core.JsonProcessingException; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -25,17 +21,19 @@ import org.onap.msb.apiroute.wrapper.dao.RedisAccessWrapper; import org.onap.msb.apiroute.wrapper.dao.route.bean.RouteInfo; import org.onap.msb.apiroute.wrapper.util.Jackson; -public class RouteDAOImpl implements IRouteDAO{ +import com.fasterxml.jackson.core.JsonProcessingException; + +public class RouteDAOImpl implements IRouteDAO { public void saveRoute(String key, RouteInfo routeInfo) throws Exception { String routeInfoStr = null; // change orginal url from “/” to empty string accord to the rewrite rule while forwarding - if("/".equals(routeInfo.getSpec().getUrl())){ + if ("/".equals(routeInfo.getSpec().getUrl())) { routeInfo.getSpec().setUrl(""); } try { routeInfoStr = Jackson.MAPPER.writeValueAsString(routeInfo); } catch (JsonProcessingException e) { - throw new Exception("error occurred while parsing RouteInfo to json data",e); + throw new Exception("error occurred while parsing RouteInfo to json data", e); } RedisAccessWrapper.save(key, routeInfoStr); } @@ -48,7 +46,7 @@ public class RouteDAOImpl implements IRouteDAO{ try { routeInfo = Jackson.MAPPER.readValue(routeInfoStr, RouteInfo.class); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to RouteInfo",e); + throw new Exception("error occurred while parsing the redis json data to RouteInfo", e); } return routeInfo; } @@ -62,7 +60,7 @@ public class RouteDAOImpl implements IRouteDAO{ routeInfo = Jackson.MAPPER.readValue(routeInfoStr, RouteInfo.class); routeInfoList.add(routeInfo); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to RouteInfo",e); + throw new Exception("error occurred while parsing the redis json data to RouteInfo", e); } } return routeInfoList; @@ -72,7 +70,7 @@ public class RouteDAOImpl implements IRouteDAO{ return RedisAccessWrapper.delete(key); } - public long deleteMultiRoute(String keyPattern) throws Exception{ + public long deleteMultiRoute(String keyPattern) throws Exception { return RedisAccessWrapper.deleteMultiKeys(keyPattern); } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Metadata.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Metadata.java index 0e0aa7f..3a30d28 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Metadata.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Metadata.java @@ -1,63 +1,55 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route.bean; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + import com.fasterxml.jackson.annotation.JsonFormat; + import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Metadata { private String name; private String namespace; private String uid = ""; - //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - //private Date creationTimestamp; + // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + // private Date creationTimestamp; @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX") private Date updateTimestamp; private Map labels = new HashMap(); private String[] annotations = null; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Metadata metadata = (Metadata) o; - return Objects.equals(name, metadata.name) && - Objects.equals(namespace, metadata.namespace) && - Objects.equals(uid, metadata.uid) && - //Objects.equals(creationTimestamp, metadata.creationTimestamp) && - Objects.equals(updateTimestamp, metadata.updateTimestamp) && - Objects.equals(labels, metadata.labels) && - Objects.equals(annotations, metadata.annotations); - } - - @Override - public int hashCode() { - //return Objects.hash(name, namespace, uid, creationTimestamp, updateTimestamp, labels, annotations); - return Objects.hash(name, namespace, uid, updateTimestamp, labels, annotations); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Metadata metadata = (Metadata) o; return + * Objects.equals(name, metadata.name) && Objects.equals(namespace, metadata.namespace) && + * Objects.equals(uid, metadata.uid) && //Objects.equals(creationTimestamp, + * metadata.creationTimestamp) && Objects.equals(updateTimestamp, metadata.updateTimestamp) && + * Objects.equals(labels, metadata.labels) && Objects.equals(annotations, metadata.annotations); + * } + * + * @Override public int hashCode() { //return Objects.hash(name, namespace, uid, + * creationTimestamp, updateTimestamp, labels, annotations); return Objects.hash(name, + * namespace, uid, updateTimestamp, labels, annotations); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Node.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Node.java index d33898f..45a3827 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Node.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Node.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route.bean; @@ -22,26 +20,18 @@ import lombok.Setter; @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Node { private String ip; private int port; - private int weight=0; + private int weight = 0; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Node node = (Node) o; - return Objects.equals(port, node.port) && - Objects.equals(weight, node.weight) && - Objects.equals(ip, node.ip); - } - - @Override - public int hashCode() { - return Objects.hash(ip, port, weight); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Node node = (Node) o; return Objects.equals(port, + * node.port) && Objects.equals(weight, node.weight) && Objects.equals(ip, node.ip); } + * + * @Override public int hashCode() { return Objects.hash(ip, port, weight); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/RouteInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/RouteInfo.java index bd329c1..622c471 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/RouteInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/RouteInfo.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route.bean; @@ -34,61 +32,24 @@ public class RouteInfo { private Spec spec; /** - Example route: - { - "kind" : "route", - "apiVersion" : "v1", - "status" : "1" - "metadata" : { - "name" : "kubernetes", - "namespace" : "default", - "uid" : "0b6f198e-c6ab-11e6-86aa-fa163ee2118b", - "creationTimestamp" : "2016-12-20T11:54:21Z", - "updateTimestamp" : "", - "labels" : { - "component" : "apiserver", - "provider" : "kubernetes" - }, - "annotations" : {} - }, - "spec" : { - "visualRange" : 0, - "url" : "", - "publish_port" : "", - "host" : "", - "apijson" : "", - "apijsontype" : "" - "metricsUrl" : "" - "consulServiceName" : "" - "useOwnUpstream" : "" //是否使用该服务独立的upstream转发 - "publishProtocol" : "", //发布地址使用http还是http协议 - "enable_ssl" : "0|1", //转发时,使用http还是http转发。http:0/https:1 - "controll" : "", //是否可以修改 - "nodes" : [{ - "ip" : 10.10.10.2, - "port" : 8080, - "weight" : "" - } - ], - } -} + * Example route: { "kind" : "route", "apiVersion" : "v1", "status" : "1" "metadata" : { "name" + * : "kubernetes", "namespace" : "default", "uid" : "0b6f198e-c6ab-11e6-86aa-fa163ee2118b", + * "creationTimestamp" : "2016-12-20T11:54:21Z", "updateTimestamp" : "", "labels" : { + * "component" : "apiserver", "provider" : "kubernetes" }, "annotations" : {} }, "spec" : { + * "visualRange" : 0, "url" : "", "publish_port" : "", "host" : "", "apijson" : "", + * "apijsontype" : "" "metricsUrl" : "" "consulServiceName" : "" "useOwnUpstream" : "" + * //是否使用该服务独立的upstream转发 "publishProtocol" : "", //发布地址使用http还是http协议 "enable_ssl" : "0|1", + * //转发时,使用http还是http转发。http:0/https:1 "controll" : "", //是否可以修改 "nodes" : [{ "ip" : 10.10.10.2, + * "port" : 8080, "weight" : "" } ], } } + */ + /* + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; RouteInfo that = (RouteInfo) o; return + * Objects.equals(kind, that.kind) && Objects.equals(apiVersion, that.apiVersion) && + * Objects.equals(status, that.status) && Objects.equals(metadata, that.metadata) && + * Objects.equals(spec, that.spec); } + * + * @Override public int hashCode() { return Objects.hash(kind, apiVersion, status, metadata, + * spec); } */ - /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RouteInfo that = (RouteInfo) o; - return Objects.equals(kind, that.kind) && - Objects.equals(apiVersion, that.apiVersion) && - Objects.equals(status, that.status) && - Objects.equals(metadata, that.metadata) && - Objects.equals(spec, that.spec); - } - - @Override - public int hashCode() { - return Objects.hash(kind, apiVersion, status, metadata, spec); - } - */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Spec.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Spec.java index a2bb3d3..d9445c1 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Spec.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/route/bean/Spec.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.route.bean; @@ -22,7 +20,8 @@ import lombok.Setter; @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Spec { private String visualRange = ""; private String url = ""; @@ -39,29 +38,19 @@ public class Spec { private Node[] nodes; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Spec spec = (Spec) o; - return Objects.equals(enable_ssl, spec.enable_ssl) && - Objects.equals(visualRange, spec.visualRange) && - Objects.equals(url, spec.url) && - Objects.equals(publish_port, spec.publish_port) && - Objects.equals(host, spec.host) && - Objects.equals(apijson, spec.apijson) && - Objects.equals(apijsontype, spec.apijsontype) && - Objects.equals(metricsUrl, spec.metricsUrl) && - Objects.equals(consulServiceName, spec.consulServiceName) && - Objects.equals(useOwnUpstream, spec.useOwnUpstream) && - Objects.equals(publish_protocol, spec.publish_protocol) && - Objects.equals(control, spec.control) && - Arrays.equals(nodes, spec.nodes); - } - - @Override - public int hashCode() { - return Objects.hash(visualRange, url, publish_port, host, apijson, apijsontype, metricsUrl, consulServiceName, useOwnUpstream, publish_protocol, enable_ssl, control, nodes); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Spec spec = (Spec) o; return + * Objects.equals(enable_ssl, spec.enable_ssl) && Objects.equals(visualRange, spec.visualRange) + * && Objects.equals(url, spec.url) && Objects.equals(publish_port, spec.publish_port) && + * Objects.equals(host, spec.host) && Objects.equals(apijson, spec.apijson) && + * Objects.equals(apijsontype, spec.apijsontype) && Objects.equals(metricsUrl, spec.metricsUrl) + * && Objects.equals(consulServiceName, spec.consulServiceName) && + * Objects.equals(useOwnUpstream, spec.useOwnUpstream) && Objects.equals(publish_protocol, + * spec.publish_protocol) && Objects.equals(control, spec.control) && Arrays.equals(nodes, + * spec.nodes); } + * + * @Override public int hashCode() { return Objects.hash(visualRange, url, publish_port, host, + * apijson, apijsontype, metricsUrl, consulServiceName, useOwnUpstream, publish_protocol, + * enable_ssl, control, nodes); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/IServiceDAO.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/IServiceDAO.java index cd17057..1de2c2c 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/IServiceDAO.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/IServiceDAO.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service; diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/ServiceDAOImpl.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/ServiceDAOImpl.java index 9ed0455..950963b 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/ServiceDAOImpl.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/ServiceDAOImpl.java @@ -1,22 +1,18 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service; -import com.fasterxml.jackson.core.JsonProcessingException; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -25,13 +21,15 @@ import org.onap.msb.apiroute.wrapper.dao.RedisAccessWrapper; import org.onap.msb.apiroute.wrapper.dao.service.bean.ServiceInfo; import org.onap.msb.apiroute.wrapper.util.Jackson; -public class ServiceDAOImpl implements IServiceDAO{ +import com.fasterxml.jackson.core.JsonProcessingException; + +public class ServiceDAOImpl implements IServiceDAO { public void saveService(String key, ServiceInfo serviceInfo) throws Exception { String serviceInfoStr = null; try { serviceInfoStr = Jackson.MAPPER.writeValueAsString(serviceInfo); } catch (JsonProcessingException e) { - throw new Exception("error occurred while parsing ServiceInfo to json data",e); + throw new Exception("error occurred while parsing ServiceInfo to json data", e); } RedisAccessWrapper.save(key, serviceInfoStr); } @@ -44,7 +42,7 @@ public class ServiceDAOImpl implements IServiceDAO{ try { serviceInfo = Jackson.MAPPER.readValue(serviceInfoStr, ServiceInfo.class); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to ServiceInfo",e); + throw new Exception("error occurred while parsing the redis json data to ServiceInfo", e); } return serviceInfo; } @@ -58,7 +56,7 @@ public class ServiceDAOImpl implements IServiceDAO{ serviceInfo = Jackson.MAPPER.readValue(serviceInfoStr, ServiceInfo.class); routeInfoList.add(serviceInfo); } catch (IOException e) { - throw new Exception("error occurred while parsing the redis json data to ServiceInfo",e); + throw new Exception("error occurred while parsing the redis json data to ServiceInfo", e); } } return routeInfoList; @@ -68,7 +66,7 @@ public class ServiceDAOImpl implements IServiceDAO{ return RedisAccessWrapper.delete(key); } - public long deleteMultiService(String keyPattern) throws Exception{ + public long deleteMultiService(String keyPattern) throws Exception { return RedisAccessWrapper.deleteMultiKeys(keyPattern); } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Metadata.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Metadata.java index ec22592..687c58e 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Metadata.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Metadata.java @@ -1,65 +1,57 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service.bean; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + import com.fasterxml.jackson.annotation.JsonFormat; + import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Metadata { private String name; private String namespace; private String uid = ""; - //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - //private Date creationTimestamp; - // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + // private Date creationTimestamp; + // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX") private Date updateTimestamp; private Map labels = new HashMap(); - //private String[] annotations = new String[]{}; + // private String[] annotations = new String[]{}; private String[] annotations = null; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Metadata metadata = (Metadata) o; - return Objects.equals(name, metadata.name) && - Objects.equals(namespace, metadata.namespace) && - Objects.equals(uid, metadata.uid) && - //Objects.equals(creationTimestamp, metadata.creationTimestamp) && - Objects.equals(updateTimestamp, metadata.updateTimestamp) && - Objects.equals(labels, metadata.labels) && - Objects.equals(annotations, metadata.annotations); - } - - @Override - public int hashCode() { - //return Objects.hash(name, namespace, uid, creationTimestamp, updateTimestamp, labels, annotations); - return Objects.hash(name, namespace, uid, updateTimestamp, labels, annotations); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Metadata metadata = (Metadata) o; return + * Objects.equals(name, metadata.name) && Objects.equals(namespace, metadata.namespace) && + * Objects.equals(uid, metadata.uid) && //Objects.equals(creationTimestamp, + * metadata.creationTimestamp) && Objects.equals(updateTimestamp, metadata.updateTimestamp) && + * Objects.equals(labels, metadata.labels) && Objects.equals(annotations, metadata.annotations); + * } + * + * @Override public int hashCode() { //return Objects.hash(name, namespace, uid, + * creationTimestamp, updateTimestamp, labels, annotations); return Objects.hash(name, + * namespace, uid, updateTimestamp, labels, annotations); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Node.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Node.java index 02c2991..72c8da7 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Node.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Node.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service.bean; @@ -22,26 +20,18 @@ import lombok.Setter; @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Node { private String ip; private String port; - private int ttl=-1; + private int ttl = -1; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Node node = (Node) o; - return Objects.equals(port, node.port) && - Objects.equals(ttl, node.ttl) && - Objects.equals(ip, node.ip); - } - - @Override - public int hashCode() { - return Objects.hash(ip, port, ttl); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Node node = (Node) o; return Objects.equals(port, + * node.port) && Objects.equals(ttl, node.ttl) && Objects.equals(ip, node.ip); } + * + * @Override public int hashCode() { return Objects.hash(ip, port, ttl); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/ServiceInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/ServiceInfo.java index 800c77f..72d940d 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/ServiceInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/ServiceInfo.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service.bean; @@ -34,58 +32,24 @@ public class ServiceInfo { private Spec spec; /** - Example Service: - { - "kind" : "service", - "apiVersion" : "v1", - "metadata" : { - "name" : "kubernetes", - "namespace" : "default", - "uid" : "0b6f198e-c6ab-11e6-86aa-fa163ee2118b", - "creationTimestamp" : "2016-12-20T11:54:21Z", - "labels" : { - "component" : "apiserver", - "provider" : "kubernetes" - }, - "annotations" : {} - }, - "spec" : { - "visualRange" : 0, - "url" : "", - "path" : "", - "publish_port" : "", - "host" : "", - "protocol" : "", - "lb_policy" : "", - "enable_ssl" : "0|1", //转发时,使用http还是http转发。http:0/https:1 - "nodes" : [{ - "ip" : 10.10.10.2, - "port" : 8080, - "ttl" : - } - ], - } - "status" : "" - } - + * Example Service: { "kind" : "service", "apiVersion" : "v1", "metadata" : { "name" : + * "kubernetes", "namespace" : "default", "uid" : "0b6f198e-c6ab-11e6-86aa-fa163ee2118b", + * "creationTimestamp" : "2016-12-20T11:54:21Z", "labels" : { "component" : "apiserver", + * "provider" : "kubernetes" }, "annotations" : {} }, "spec" : { "visualRange" : 0, "url" : "", + * "path" : "", "publish_port" : "", "host" : "", "protocol" : "", "lb_policy" : "", + * "enable_ssl" : "0|1", //转发时,使用http还是http转发。http:0/https:1 "nodes" : [{ "ip" : 10.10.10.2, + * "port" : 8080, "ttl" : } ], } "status" : "" } + * */ - /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ServiceInfo that = (ServiceInfo) o; - return Objects.equals(kind, that.kind) && - Objects.equals(apiVersion, that.apiVersion) && - Objects.equals(status, that.status) && - Objects.equals(metadata, that.metadata) && - Objects.equals(spec, that.spec); - } - - @Override - public int hashCode() { - return Objects.hash(kind, apiVersion, status, metadata, spec); - } - */ + /* + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; ServiceInfo that = (ServiceInfo) o; return + * Objects.equals(kind, that.kind) && Objects.equals(apiVersion, that.apiVersion) && + * Objects.equals(status, that.status) && Objects.equals(metadata, that.metadata) && + * Objects.equals(spec, that.spec); } + * + * @Override public int hashCode() { return Objects.hash(kind, apiVersion, status, metadata, + * spec); } + */ } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Spec.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Spec.java index 4741200..062d868 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Spec.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/dao/service/bean/Spec.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright 2016-2017 ZTE, Inc. and others. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. ******************************************************************************/ package org.onap.msb.apiroute.wrapper.dao.service.bean; @@ -22,7 +20,8 @@ import lombok.Setter; @AllArgsConstructor @NoArgsConstructor -@Getter @Setter +@Getter +@Setter public class Spec { private String visualRange = ""; private String url = ""; @@ -35,25 +34,15 @@ public class Spec { private Node[] nodes; /* - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Spec spec = (Spec) o; - return Objects.equals(enable_ssl, spec.enable_ssl) && - Objects.equals(visualRange, spec.visualRange) && - Objects.equals(url, spec.url) && - Objects.equals(path, spec.path) && - Objects.equals(publish_port, spec.publish_port) && - Objects.equals(host, spec.host) && - Objects.equals(protocol, spec.protocol) && - Objects.equals(lb_policy, spec.lb_policy) && - Arrays.equals(nodes, spec.nodes); - } - - @Override - public int hashCode() { - return Objects.hash(visualRange, url, path, publish_port, host, protocol, lb_policy, enable_ssl, nodes); - } - */ + * @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || + * getClass() != o.getClass()) return false; Spec spec = (Spec) o; return + * Objects.equals(enable_ssl, spec.enable_ssl) && Objects.equals(visualRange, spec.visualRange) + * && Objects.equals(url, spec.url) && Objects.equals(path, spec.path) && + * Objects.equals(publish_port, spec.publish_port) && Objects.equals(host, spec.host) && + * Objects.equals(protocol, spec.protocol) && Objects.equals(lb_policy, spec.lb_policy) && + * Arrays.equals(nodes, spec.nodes); } + * + * @Override public int hashCode() { return Objects.hash(visualRange, url, path, publish_port, + * host, protocol, lb_policy, enable_ssl, nodes); } + */ } |