summaryrefslogtreecommitdiffstats
path: root/cadi/client/src/main/java
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-09-04 19:41:24 -0500
committerInstrumental <jonathan.gathman@att.com>2019-09-04 19:41:51 -0500
commitc5aaaeeb8a4c008fa4a576c55da4c3bf703acdac (patch)
treedf48d917f868dc110734afc48c50478b58c697ad /cadi/client/src/main/java
parent4fbae1b6a5de191a9e26361ce6d1b8958be53f9e (diff)
K8s doesn't necessarily support DNS
Issue-ID: AAF-963 Change-Id: I65248837fc217b0ccc09f2afe02e14c716ca5bcc Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/client/src/main/java')
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java9
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java16
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java28
3 files changed, 44 insertions, 9 deletions
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
index d64de699..8053dabf 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
@@ -27,11 +27,10 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.onap.aaf.cadi.Access;
-import org.onap.aaf.cadi.Locator;
-import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.Access.Level;
+import org.onap.aaf.cadi.LocatorException;
-public class DNSLocator implements Locator<URI> {
+public class DNSLocator implements SizedLocator<URI> {
private static enum Status {UNTRIED, OK, INVALID, SLOW};
private static final int CHECK_TIME = 3000;
@@ -63,11 +62,11 @@ public class DNSLocator implements Locator<URI> {
throw new LocatorException("Null passed into DNSLocator constructor");
}
int start, defPort;
- if (aaf_locate.startsWith("https:")) {
+ if (aaf_locate.startsWith("https://")) {
protocol = "https";
start = 8; // https://
defPort = 443;
- } else if (aaf_locate.startsWith("http:")) {
+ } else if (aaf_locate.startsWith("http://")) {
protocol = "http";
start = 7; // http://
defPort = 80;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
index 3b79dba5..b0654cfa 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
@@ -24,10 +24,9 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
-import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
-public class SingleEndpointLocator implements Locator<URI> {
+public class SingleEndpointLocator implements SizedLocator<URI> {
private final URI uri;
private final static Item item = new Item() {};
private Date noRetryUntil;
@@ -36,8 +35,12 @@ public class SingleEndpointLocator implements Locator<URI> {
this.uri = uri;
}
- public SingleEndpointLocator(final String endpoint) throws URISyntaxException {
- this.uri = new URI(endpoint);
+ public SingleEndpointLocator(final String endpoint) throws LocatorException {
+ try {
+ this.uri = new URI(endpoint);
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
}
@Override
@@ -84,6 +87,11 @@ public class SingleEndpointLocator implements Locator<URI> {
// Never refreshed
return true;
}
+
+ @Override
+ public int size() {
+ return 1;
+ }
@Override
public void destroy() {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
new file mode 100644
index 00000000..65a34738
--- /dev/null
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
@@ -0,0 +1,28 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.cadi.locator;
+
+import org.onap.aaf.cadi.Locator;
+
+public interface SizedLocator<T> extends Locator<T> {
+ public abstract int size();
+}