aboutsummaryrefslogtreecommitdiffstats
path: root/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api
diff options
context:
space:
mode:
Diffstat (limited to 'apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api')
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java107
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.java39
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java24
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java55
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java25
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java195
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java98
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.java48
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java179
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java83
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.java28
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.java28
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.java18
13 files changed, 927 insertions, 0 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
new file mode 100644
index 0000000..1465000
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/ApiRouteInfo.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Objects;
+
+
+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();
+ }
+
+ @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
new file mode 100644
index 0000000..709a995
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomDateSerializer.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+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));
+ }
+
+
+} \ No newline at end of file
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
new file mode 100644
index 0000000..788ce00
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/CustomRouteInfo.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+
+public class CustomRouteInfo extends RouteInfo{
+
+ 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
new file mode 100644
index 0000000..4a4708b
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/DiscoverInfo.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+import java.io.Serializable;
+
+public class DiscoverInfo implements Serializable{
+ private static final long serialVersionUID = 1L;
+ 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;
+ }
+
+
+
+
+}
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
new file mode 100644
index 0000000..b3f3cf6
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/IuiRouteInfo.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+
+
+public class IuiRouteInfo extends RouteInfo{
+
+ 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
new file mode 100644
index 0000000..ca0b235
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/MicroServiceFullInfo.java
@@ -0,0 +1,195 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+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;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+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 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="";
+
+ @ApiModelProperty(value = "enable ssl", allowableValues = "true,false", example = "false")
+ 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
+
+
+
+
+ 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;
+ }
+
+ public void setVisualRange(String visualRange) {
+ this.visualRange = visualRange;
+ }
+
+
+ public String getLb_policy() {
+ return lb_policy;
+ }
+
+ public void setLb_policy(String lb_policy) {
+ this.lb_policy = lb_policy;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public String getPath() {
+ return path;
+ }
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+
+ public Set<Node> getNodes() {
+ return nodes;
+ }
+
+ 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;
+ }
+ public void setPublish_port(String 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;
+ 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);
+ }
+
+ @Override
+ public int hashCode() {
+ 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;
+ }
+ public void setEnable_ssl(boolean enable_ssl) {
+ this.enable_ssl = enable_ssl;
+ }
+ public String getCustom() {
+ return custom;
+ }
+ public void setCustom(String custom) {
+ this.custom = custom;
+ }
+
+
+} \ No newline at end of file
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
new file mode 100644
index 0000000..c515820
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/Node.java
@@ -0,0 +1,98 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+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;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public int getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(int ttl) {
+ this.ttl = ttl;
+ }
+
+ public Node(){
+
+ }
+
+ 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;
+ }
+
+ @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(ttl, node.ttl) &&
+ Objects.equals(ip, node.ip) &&
+ Objects.equals(port, node.port) &&
+ Objects.equals(status, node.status);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ip, port, status, ttl);
+ }
+}
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
new file mode 100644
index 0000000..3f62897
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/PublishFullAddress.java
@@ -0,0 +1,48 @@
+package org.onap.msb.apiroute.api;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PublishFullAddress implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+
+ private String ip;
+
+ private String port;
+
+
+ private String 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 getPort() {
+ return port;
+ }
+
+ 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
new file mode 100644
index 0000000..5e36b9d
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteInfo.java
@@ -0,0 +1,179 @@
+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;
+
+@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);
+ }
+}
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
new file mode 100644
index 0000000..310e623
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/RouteServer.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+
+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 String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ 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);
+ }
+}
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
new file mode 100644
index 0000000..de0d47a
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedInternalServerErrorException.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api.exception;
+
+import javax.ws.rs.InternalServerErrorException;
+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());
+ }
+
+}
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
new file mode 100644
index 0000000..34439d9
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/ExtendedNotFoundException.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2016 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
+ *
+ * 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.
+ */
+package org.onap.msb.apiroute.api.exception;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+public class ExtendedNotFoundException extends NotFoundException {
+
+ public ExtendedNotFoundException(final String message) {
+ super(Response.status(Response.Status.NOT_FOUND).entity(message).type(MediaType.TEXT_PLAIN).build());
+ }
+}
+
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
new file mode 100644
index 0000000..28cfd17
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/api/exception/UnprocessableEntityException.java
@@ -0,0 +1,18 @@
+package org.onap.msb.apiroute.api.exception;
+
+import javax.ws.rs.ClientErrorException;
+import javax.ws.rs.core.MediaType;
+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());
+ }
+
+
+
+}