summaryrefslogtreecommitdiffstats
path: root/cadi/client/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'cadi/client/src/main/java/org')
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java33
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java12
2 files changed, 44 insertions, 1 deletions
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
index 058bbd38..04075f29 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
@@ -217,6 +217,20 @@ public abstract class Rcli<CT> {
return client.futureCreate(Void.class);
}
+ public Future<Void> create(String pathinfo, String contentType, EClient.Transfer content) throws APIException, CadiException {
+ final ParsePath pp = new ParsePath(pathinfo);
+
+ EClient<CT> client = client();
+ client.setMethod(POST);
+ client.addHeader(CONTENT_TYPE,contentType);
+ client.setPathInfo(pp.path());
+ client.setQueryParams(pp.query());
+ client.setFragment(pp.frag());
+ client.setPayload(content);
+ client.send();
+ return client.futureCreate(Void.class);
+ }
+
/**
* Post Data in WWW expected format, with the format tag1=value1&tag2=value2, etc
@@ -462,6 +476,22 @@ public abstract class Rcli<CT> {
client.send();
return client.futureReadString();
}
+
+ public Future<String> update(String pathinfo, String contentType, EClient.Transfer content) throws APIException, CadiException {
+ final ParsePath pp = new ParsePath(pathinfo);
+
+ EClient<CT> client = client();
+ client.setMethod(PUT);
+ client.addHeader(CONTENT_TYPE,contentType);
+ client.setPathInfo(pp.path());
+ client.setQueryParams(pp.query());
+ client.setFragment(pp.frag());
+ client.setPayload(content);
+ client.send();
+ return client.futureReadString();
+ }
+
+
public<T> Future<T> update(String pathinfo, final RosettaDF<T> df, final T t) throws APIException, CadiException {
@@ -503,6 +533,8 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
+
+
/**
* A method to update with a VOID
@@ -531,6 +563,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(null);
}
+
public<T> Future<T> delete(String pathinfo, String contentType, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
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 b0c830f6..23bcd4ad 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
@@ -22,6 +22,7 @@ package org.onap.aaf.cadi.locator;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Date;
import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
@@ -29,6 +30,7 @@ import org.onap.aaf.cadi.LocatorException;
public class SingleEndpointLocator implements Locator<URI> {
private final URI uri;
private final static Item item = new Item() {};
+ private Date noRetryUntil;
public SingleEndpointLocator(final URI uri) {
this.uri = uri;
@@ -45,12 +47,20 @@ public class SingleEndpointLocator implements Locator<URI> {
@Override
public boolean hasItems() {
+ if(noRetryUntil!=null) {
+ if(new Date().after(noRetryUntil)) {
+ noRetryUntil = null;
+ } else {
+ return false;
+ }
+ }
return true;
}
@Override
public void invalidate(Item item) throws LocatorException {
- // Endpoints cannot be invalidated
+ // one minute timeout, because there is no other item
+ noRetryUntil = new Date(System.currentTimeMillis()+60000);
}
@Override