diff options
Diffstat (limited to 'apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api')
13 files changed, 583 insertions, 585 deletions
diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java index 5751289..3d370c5 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java @@ -1,107 +1,107 @@ /******************************************************************************* * 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.api; -import io.swagger.annotations.ApiModelProperty; - -import java.io.Serializable; import java.util.Arrays; import java.util.Objects; +import io.swagger.annotations.ApiModelProperty; + public class ApiRouteInfo extends RouteInfo { - private static final long serialVersionUID = 1L; - - @ApiModelProperty(example = "v1", required = true) - private String version; - - - private String apiJson=""; //swagger json Path - - @ApiModelProperty(value = "[apiJson Type] 0:local file 1: remote file", allowableValues = "0,1", example = "1") - private String apiJsonType="1"; - private String metricsUrl=""; - - - - public String getVersion() { - return version; - } - public void setVersion(String version) { - this.version = version; - } - - public String getApiJson() { - return apiJson; - } - public void setApiJson(String apiJson) { - this.apiJson = apiJson; - } - - - - - public String getApiJsonType() { - return apiJsonType; - } - public void setApiJsonType(String apiJsonType) { - this.apiJsonType = apiJsonType; - } - public String getMetricsUrl() { - return metricsUrl; - } - public void setMetricsUrl(String metricsUrl) { - this.metricsUrl = metricsUrl; - } - - - - - @Override - public Object clone() throws CloneNotSupportedException - { - return super.clone(); + private static final long serialVersionUID = 1L; + + @ApiModelProperty(example = "v1", required = true) + private String version; + + + private String apiJson = ""; // swagger json Path + + @ApiModelProperty(value = "[apiJson Type] 0:local file 1: remote file", allowableValues = "0,1", example = "1") + private String apiJsonType = "1"; + private String metricsUrl = ""; + + + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getApiJson() { + return apiJson; + } + + public void setApiJson(String apiJson) { + this.apiJson = apiJson; + } + + + + public String getApiJsonType() { + return apiJsonType; + } + + public void setApiJsonType(String apiJsonType) { + this.apiJsonType = apiJsonType; + } + + public String getMetricsUrl() { + return metricsUrl; + } + + public void setMetricsUrl(String metricsUrl) { + this.metricsUrl = metricsUrl; + } + + + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ApiRouteInfo that = (ApiRouteInfo) o; + return Objects.equals(isEnable_ssl(), that.isEnable_ssl()) + && Objects.equals(getServiceName(), that.getServiceName()) + && Objects.equals(version, that.version) && Objects.equals(getUrl(), that.getUrl()) + && Objects.equals(apiJson, that.apiJson) && Objects.equals(apiJsonType, that.apiJsonType) + && Objects.equals(metricsUrl, that.metricsUrl) + && Objects.equals(getControl(), that.getControl()) + && Objects.equals(getStatus(), that.getStatus()) + && Objects.equals(getVisualRange(), that.getVisualRange()) + && Objects.equals(getUseOwnUpstream(), that.getUseOwnUpstream()) + && Arrays.equals(getServers(), that.getServers()) && Objects.equals(getHost(), that.getHost()) + && Objects.equals(getNamespace(), that.getNamespace()) + && Objects.equals(getPublish_port(), that.getPublish_port()) + && Objects.equals(getConsulServiceName(), that.getConsulServiceName()) + && Objects.equals(getPublishProtocol(), that.getPublishProtocol()); + } + + @Override + public int hashCode() { + return Objects.hash(getServiceName(), version, getUrl(), apiJson, apiJsonType, metricsUrl, getControl(), + getStatus(), getVisualRange(), getServers(), getHost(), getNamespace(), getPublish_port(), + isEnable_ssl(), getConsulServiceName(), getPublishProtocol()); } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ApiRouteInfo that = (ApiRouteInfo) o; - return Objects.equals(isEnable_ssl(), that.isEnable_ssl()) && - Objects.equals(getServiceName(), that.getServiceName()) && - Objects.equals(version, that.version) && - Objects.equals(getUrl(), that.getUrl()) && - Objects.equals(apiJson, that.apiJson) && - Objects.equals(apiJsonType, that.apiJsonType) && - Objects.equals(metricsUrl, that.metricsUrl) && - Objects.equals(getControl(), that.getControl()) && - Objects.equals(getStatus(), that.getStatus()) && - Objects.equals(getVisualRange(), that.getVisualRange()) && - Objects.equals(getUseOwnUpstream(), that.getUseOwnUpstream()) && - Arrays.equals(getServers(), that.getServers()) && - Objects.equals(getHost(), that.getHost()) && - Objects.equals(getNamespace(), that.getNamespace()) && - Objects.equals(getPublish_port(), that.getPublish_port()) && - Objects.equals(getConsulServiceName(), that.getConsulServiceName()) && - Objects.equals(getPublishProtocol(), that.getPublishProtocol()); - } - - @Override - public int hashCode() { - return Objects.hash(getServiceName(), version, getUrl(), apiJson, apiJsonType, metricsUrl, getControl(), getStatus(), getVisualRange(), getServers(), getHost(), getNamespace(), getPublish_port(), isEnable_ssl(), getConsulServiceName(), getPublishProtocol()); - } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.java index a5a9337..95e9f72 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.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.api; @@ -24,16 +22,14 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -public class CustomDateSerializer extends JsonSerializer<Date> { - - @Override - public void serialize(Date value, - JsonGenerator jsonGenerator, - SerializerProvider provider) - throws IOException, JsonProcessingException { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); - jsonGenerator.writeString(sdf.format(value)); - } - - -} +public class CustomDateSerializer extends JsonSerializer<Date> { + + @Override + public void serialize(Date value, JsonGenerator jsonGenerator, SerializerProvider provider) + throws IOException, JsonProcessingException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + jsonGenerator.writeString(sdf.format(value)); + } + + +} diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java index f92a1ca..83b65a7 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java @@ -1,24 +1,22 @@ /******************************************************************************* * 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.api; -public class CustomRouteInfo extends RouteInfo{ +public class CustomRouteInfo extends RouteInfo { + + private static final long serialVersionUID = 1L; + - private static final long serialVersionUID = 1L; - - } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java index 5257c0b..50cbdec 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java @@ -1,55 +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.api; import java.io.Serializable; -public class DiscoverInfo implements Serializable{ +public class DiscoverInfo implements Serializable { private static final long serialVersionUID = 1L; - private String ip; + private String ip; private int port; private boolean enabled; - + public String getIp() { return ip; } + public void setIp(String ip) { this.ip = ip; } + public int getPort() { return port; } + public void setPort(int port) { this.port = port; } + public boolean isEnabled() { return enabled; } + public void setEnabled(boolean enabled) { this.enabled = enabled; } - + @Override public String toString() { - // TODO Auto-generated method stub - return this.ip+":"+this.port; + // TODO Auto-generated method stub + return this.ip + ":" + this.port; } - - - + + } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java index 4fc693c..cd3998a 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java @@ -1,25 +1,23 @@ /******************************************************************************* * 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.api; -public class IuiRouteInfo extends RouteInfo{ +public class IuiRouteInfo extends RouteInfo { + + private static final long serialVersionUID = 1L; + - private static final long serialVersionUID = 1L; - - } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java index d4d6686..a5c5bf0 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java @@ -1,97 +1,102 @@ /******************************************************************************* * 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.api; -import io.swagger.annotations.ApiModelProperty; - import java.io.Serializable; import java.util.Objects; import java.util.Set; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; + @JsonIgnoreProperties(ignoreUnknown = true) -public class MicroServiceFullInfo implements Serializable { +public class MicroServiceFullInfo implements Serializable { private static final long serialVersionUID = 1L; - + @ApiModelProperty(required = true) private String serviceName; - + @ApiModelProperty(example = "v1") - private String version=""; - - @ApiModelProperty(value = "Target Service URL,start with /",example = "/api/serviceName/v1", required = true) - private String url=""; - - @ApiModelProperty(value = "Service Protocol", allowableValues = "REST,UI, MQ, FTP,SNMP,TCP,UDP", example = "REST",required = true) + private String version = ""; + + @ApiModelProperty(value = "Target Service URL,start with /", example = "/api/serviceName/v1", required = true) + private String url = ""; + + @ApiModelProperty(value = "Service Protocol", allowableValues = "REST,UI, MQ, FTP,SNMP,TCP,UDP", example = "REST", + required = true) private String protocol = ""; - + @ApiModelProperty(value = "[visual Range]interSystem:0,inSystem:1", allowableValues = "0,1", example = "1") private String visualRange = "1"; - + @ApiModelProperty(value = "lb policy", allowableValues = "round-robin,hash,least_conn", example = "hash") - private String lb_policy=""; - - private String namespace=""; - - private String host=""; - - private String path=""; - - private String publish_port=""; - + private String lb_policy = ""; + + private String namespace = ""; + + private String host = ""; + + private String path = ""; + + private String publish_port = ""; + @ApiModelProperty(value = "enable ssl", allowableValues = "true,false", example = "false") - private boolean enable_ssl=false; //true:https:开启SSL加密, false:http - - private String custom; //PORTAL协议标志 - + private boolean enable_ssl = false; // true:https:开启SSL加密, false:http + + private String custom; // PORTAL协议标志 + private Set<Node> nodes; - + @ApiModelProperty(value = "Service Status", allowableValues = "0,1", example = "1") - private String status = "1"; //0:disable 1:enable - + private String status = "1"; // 0:disable 1:enable + + - - public String getServiceName() { return serviceName; } + public void setServiceName(String serviceName) { this.serviceName = serviceName; } + public String getVersion() { return version; } + public void setVersion(String version) { this.version = version; } + public String getUrl() { return url; } + public void setUrl(String url) { this.url = url; } + public String getProtocol() { return protocol; } + public void setProtocol(String protocol) { this.protocol = protocol; } - + public String getVisualRange() { return visualRange; } @@ -99,7 +104,7 @@ public class MicroServiceFullInfo implements Serializable { public void setVisualRange(String visualRange) { this.visualRange = visualRange; } - + public String getLb_policy() { return lb_policy; @@ -110,28 +115,31 @@ public class MicroServiceFullInfo implements Serializable { } public String getNamespace() { - return namespace; + return namespace; } public void setNamespace(String namespace) { - this.namespace = namespace; + this.namespace = namespace; } - + public String getHost() { - return host; + return host; } + public void setHost(String host) { - this.host = host; + this.host = host; } + public String getPath() { - return path; + return path; } + public void setPath(String path) { - this.path = path; + this.path = path; } - - + + public Set<Node> getNodes() { return nodes; @@ -140,56 +148,60 @@ public class MicroServiceFullInfo implements Serializable { public void setNodes(Set<Node> nodes) { this.nodes = nodes; } - + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public String getPublish_port() { - return publish_port; + return publish_port; } + public void setPublish_port(String publish_port) { - this.publish_port = publish_port; + this.publish_port = publish_port; } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; MicroServiceFullInfo that = (MicroServiceFullInfo) o; - return Objects.equals(serviceName, that.serviceName) && - Objects.equals(version, that.version) && - Objects.equals(url, that.url) && - Objects.equals(protocol, that.protocol) && - Objects.equals(visualRange, that.visualRange) && - Objects.equals(lb_policy, that.lb_policy) && - Objects.equals(namespace, that.namespace) && - Objects.equals(host, that.host) && - Objects.equals(path, that.path) && - Objects.equals(publish_port, that.publish_port) && - Objects.equals(enable_ssl, that.enable_ssl) && - Objects.equals(nodes, that.nodes) && - Objects.equals(status, that.status); + return Objects.equals(serviceName, that.serviceName) && Objects.equals(version, that.version) + && Objects.equals(url, that.url) && Objects.equals(protocol, that.protocol) + && Objects.equals(visualRange, that.visualRange) && Objects.equals(lb_policy, that.lb_policy) + && Objects.equals(namespace, that.namespace) && Objects.equals(host, that.host) + && Objects.equals(path, that.path) && Objects.equals(publish_port, that.publish_port) + && Objects.equals(enable_ssl, that.enable_ssl) && Objects.equals(nodes, that.nodes) + && Objects.equals(status, that.status); } @Override public int hashCode() { - return Objects.hash(serviceName, version, url, protocol, visualRange, lb_policy, namespace, host, path, publish_port, enable_ssl, nodes, status); + return Objects.hash(serviceName, version, url, protocol, visualRange, lb_policy, namespace, host, path, + publish_port, enable_ssl, nodes, status); } + public boolean isEnable_ssl() { - return enable_ssl; + return enable_ssl; } + public void setEnable_ssl(boolean enable_ssl) { - this.enable_ssl = enable_ssl; + this.enable_ssl = enable_ssl; } + public String getCustom() { - return custom; + return custom; } + public void setCustom(String custom) { - this.custom = custom; + this.custom = custom; } - - + + } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java index 41db8e7..4257c53 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java @@ -1,45 +1,43 @@ /******************************************************************************* * 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.api; -import io.swagger.annotations.ApiModelProperty; - import java.io.Serializable; import java.util.Objects; +import io.swagger.annotations.ApiModelProperty; + public class Node implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(required = true) private String ip; - + @ApiModelProperty(required = true) private String port; - - private String status="passing"; //实例健康检查状态 - - private int ttl=-1; - + + private String status = "passing"; // 实例健康检查状态 + + private int ttl = -1; + public String getStatus() { - return status; - } + return status; + } - public void setStatus(String status) { - this.status = status; - } + public void setStatus(String status) { + this.status = status; + } public String getIp() { return ip; @@ -65,30 +63,30 @@ public class Node implements Serializable { this.ttl = ttl; } - public Node(){ - + public Node() { + } - - public Node(String ip,String port,int ttl){ + + public Node(String ip, String port, int ttl) { this.ip = ip; this.port = port; this.ttl = ttl; } - - public Node(String ip,String port){ - this.ip = ip; - this.port = port; - } + + public Node(String ip, String port) { + this.ip = ip; + this.port = port; + } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Node node = (Node) o; - return Objects.equals(ttl, node.ttl) && - Objects.equals(ip, node.ip) && - Objects.equals(port, node.port) && - Objects.equals(status, node.status); + return Objects.equals(ttl, node.ttl) && Objects.equals(ip, node.ip) && Objects.equals(port, node.port) + && Objects.equals(status, node.status); } @Override diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.java index 49ef54c..59b4c39 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.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.api; @@ -21,43 +19,43 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class PublishFullAddress implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private String ip; + private String ip; - private String port; - + private String port; - private String publish_protocol; - public String getPublish_protocol() { - return publish_protocol; - } + private String publish_protocol; - public void setPublish_protocol(String publish_protocol) { - this.publish_protocol = publish_protocol; - } + public String getPublish_protocol() { + return publish_protocol; + } + public void setPublish_protocol(String publish_protocol) { + this.publish_protocol = publish_protocol; + } - public String getIp() { - return ip; - } - public void setIp(String ip) { - this.ip = ip; - } + public String getIp() { + return ip; + } - public String getPort() { - return port; - } + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public PublishFullAddress() { + + } - public void setPort(String port) { - this.port = port; - } - - public PublishFullAddress(){ - - } - } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java index 4bf6087..3d1eff9 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java @@ -1,194 +1,197 @@ /******************************************************************************* * 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.api; -import io.swagger.annotations.ApiModelProperty; - import java.io.Serializable; import java.util.Arrays; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; + @JsonIgnoreProperties(ignoreUnknown = true) -public class RouteInfo implements Serializable,Cloneable { - private static final long serialVersionUID = 1L; - @ApiModelProperty(required = true) - private String serviceName; - - @ApiModelProperty(value = "Target Service URL,start with /",example = "/test", required = true) - private String url; - - @ApiModelProperty(value = "[control Range] 0:default 1:readonly 2:hidden ", allowableValues = "0,1,2", example = "0") - private String control="0"; - - @ApiModelProperty(value = "[status] 1:abled 0:disabled ", allowableValues = "0,1", example = "1") - private String status="1"; - - @ApiModelProperty(value = "[visual Range]interSystem:0,inSystem:1", allowableValues = "0,1", example = "1") - private String visualRange = "1"; - - @ApiModelProperty(value = "[LB Policy]non_ip_hash:0,ip_hash:1", allowableValues = "0,1", example = "0") - private String useOwnUpstream="0"; //lb policy - - @ApiModelProperty(required = true) - private RouteServer servers[]; - - private String host=""; - - private String namespace=""; - - private String publish_port=""; - - private boolean enable_ssl=false; //true:https:开启SSL加密, false:http - - private String consulServiceName=""; - - private String publishProtocol="http"; - - - - public String getPublish_port() { - return publish_port; - } - public void setPublish_port(String publish_port) { - this.publish_port = publish_port; - } - - - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - -public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public RouteServer[] getServers() { - return servers.clone(); - } - - public void setServers(RouteServer[] servers) { - this.servers = servers.clone(); - } - - public String getControl() { - return control; - } - - public void setControl(String control) { - this.control = control; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getVisualRange() { - return visualRange; - } - - public void setVisualRange(String visualRange) { - this.visualRange = visualRange; - } - - public String getUseOwnUpstream() { - return useOwnUpstream; - } - - public void setUseOwnUpstream(String useOwnUpstream) { - this.useOwnUpstream = useOwnUpstream; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - public String getConsulServiceName() { - return consulServiceName; - } - public void setConsulServiceName(String consulServiceName) { - this.consulServiceName = consulServiceName; - } - - @Override - public Object clone() throws CloneNotSupportedException - { - return super.clone(); - } - public String getPublishProtocol() { - return publishProtocol; - } - public void setPublishProtocol(String publishProtocol) { - this.publishProtocol = publishProtocol; - } - public boolean isEnable_ssl() { - return enable_ssl; - } - public void setEnable_ssl(boolean enable_ssl) { - this.enable_ssl = enable_ssl; - } - - @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(enable_ssl, that.enable_ssl) && - Objects.equals(serviceName, that.serviceName) && - Objects.equals(url, that.url) && - Objects.equals(control, that.control) && - Objects.equals(status, that.status) && - Objects.equals(visualRange, that.visualRange) && - Objects.equals(useOwnUpstream, that.useOwnUpstream) && - Arrays.equals(servers, that.servers) && - Objects.equals(host, that.host) && - Objects.equals(namespace, that.namespace) && - Objects.equals(publish_port, that.publish_port) && - Objects.equals(consulServiceName, that.consulServiceName) && - Objects.equals(publishProtocol, that.publishProtocol); - } - - @Override - public int hashCode() { - return Objects.hash(serviceName, url, control, status, visualRange, useOwnUpstream, servers, host, namespace, publish_port, enable_ssl, consulServiceName, publishProtocol); - } +public class RouteInfo implements Serializable, Cloneable { + private static final long serialVersionUID = 1L; + @ApiModelProperty(required = true) + private String serviceName; + + @ApiModelProperty(value = "Target Service URL,start with /", example = "/test", required = true) + private String url; + + @ApiModelProperty(value = "[control Range] 0:default 1:readonly 2:hidden ", allowableValues = "0,1,2", + example = "0") + private String control = "0"; + + @ApiModelProperty(value = "[status] 1:abled 0:disabled ", allowableValues = "0,1", example = "1") + private String status = "1"; + + @ApiModelProperty(value = "[visual Range]interSystem:0,inSystem:1", allowableValues = "0,1", example = "1") + private String visualRange = "1"; + + @ApiModelProperty(value = "[LB Policy]non_ip_hash:0,ip_hash:1", allowableValues = "0,1", example = "0") + private String useOwnUpstream = "0"; // lb policy + + @ApiModelProperty(required = true) + private RouteServer servers[]; + + private String host = ""; + + private String namespace = ""; + + private String publish_port = ""; + + private boolean enable_ssl = false; // true:https:开启SSL加密, false:http + + private String consulServiceName = ""; + + private String publishProtocol = "http"; + + + + public String getPublish_port() { + return publish_port; + } + + public void setPublish_port(String publish_port) { + this.publish_port = publish_port; + } + + + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public RouteServer[] getServers() { + return servers.clone(); + } + + public void setServers(RouteServer[] servers) { + this.servers = servers.clone(); + } + + public String getControl() { + return control; + } + + public void setControl(String control) { + this.control = control; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getVisualRange() { + return visualRange; + } + + public void setVisualRange(String visualRange) { + this.visualRange = visualRange; + } + + public String getUseOwnUpstream() { + return useOwnUpstream; + } + + public void setUseOwnUpstream(String useOwnUpstream) { + this.useOwnUpstream = useOwnUpstream; + } + + public String getNamespace() { + return namespace; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + public String getConsulServiceName() { + return consulServiceName; + } + + public void setConsulServiceName(String consulServiceName) { + this.consulServiceName = consulServiceName; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public String getPublishProtocol() { + return publishProtocol; + } + + public void setPublishProtocol(String publishProtocol) { + this.publishProtocol = publishProtocol; + } + + public boolean isEnable_ssl() { + return enable_ssl; + } + + public void setEnable_ssl(boolean enable_ssl) { + this.enable_ssl = enable_ssl; + } + + @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(enable_ssl, that.enable_ssl) && Objects.equals(serviceName, that.serviceName) + && Objects.equals(url, that.url) && Objects.equals(control, that.control) + && Objects.equals(status, that.status) && Objects.equals(visualRange, that.visualRange) + && Objects.equals(useOwnUpstream, that.useOwnUpstream) && Arrays.equals(servers, that.servers) + && Objects.equals(host, that.host) && Objects.equals(namespace, that.namespace) + && Objects.equals(publish_port, that.publish_port) + && Objects.equals(consulServiceName, that.consulServiceName) + && Objects.equals(publishProtocol, that.publishProtocol); + } + + @Override + public int hashCode() { + return Objects.hash(serviceName, url, control, status, visualRange, useOwnUpstream, servers, host, namespace, + publish_port, enable_ssl, consulServiceName, publishProtocol); + } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java index e5922b4..ef4b62c 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java @@ -1,62 +1,60 @@ /******************************************************************************* * 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.api; -import io.swagger.annotations.ApiModelProperty; - import java.io.Serializable; import java.util.Objects; +import io.swagger.annotations.ApiModelProperty; + + +public class RouteServer implements Serializable { + private static final long serialVersionUID = 1L; + @ApiModelProperty(required = true) + private String ip; + + @ApiModelProperty(required = true) + private String port; + private int weight = 0; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + -public class RouteServer implements Serializable{ - private static final long serialVersionUID = 1L; - @ApiModelProperty(required = true) - private String ip; - - @ApiModelProperty(required = true) - private String port; - private int weight=0; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - - - public int getWeight() { - return weight; - } - - public void setWeight(int weight) { - this.weight = weight; - } - - public RouteServer(){ - - } - - public RouteServer(String ip,String port){ - this.ip=ip; - this.port=port; - this.weight=0; - } + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public RouteServer() { + + } + + public RouteServer(String ip, String port) { + this.ip = ip; + this.port = port; + this.weight = 0; + } public String getPort() { return port; @@ -66,18 +64,18 @@ public class RouteServer implements Serializable{ this.port = port; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RouteServer that = (RouteServer) o; - return Objects.equals(weight, that.weight) && - Objects.equals(ip, that.ip) && - Objects.equals(port, that.port); - } - - @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; + RouteServer that = (RouteServer) o; + return Objects.equals(weight, that.weight) && Objects.equals(ip, that.ip) && Objects.equals(port, that.port); + } + + @Override + public int hashCode() { + return Objects.hash(ip, port, weight); + } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.java index 86456cd..6514104 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.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.api.exception; @@ -20,9 +18,10 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; public class ExtendedInternalServerErrorException extends InternalServerErrorException { - + public ExtendedInternalServerErrorException(final String message) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).type(MediaType.TEXT_PLAIN).build()); + super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).type(MediaType.TEXT_PLAIN) + .build()); } } diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.java index d65f944..c37e226 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.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.api.exception; diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.java index 6c0fc8f..ad41d28 100644 --- a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.java +++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.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.api.exception; @@ -21,13 +19,13 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; -public class UnprocessableEntityException extends ClientErrorException{ - private static final long serialVersionUID = -8266622745725405656L; - - public UnprocessableEntityException(final String message) { - super(Response.status(HttpStatus.SC_UNPROCESSABLE_ENTITY).entity(message).type(MediaType.TEXT_PLAIN).build()); - } - - +public class UnprocessableEntityException extends ClientErrorException { + private static final long serialVersionUID = -8266622745725405656L; + + public UnprocessableEntityException(final String message) { + super(Response.status(HttpStatus.SC_UNPROCESSABLE_ENTITY).entity(message).type(MediaType.TEXT_PLAIN).build()); + } + + } |