summaryrefslogtreecommitdiffstats
path: root/cadi/oauth-enduser/src/main
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-10-15 08:19:50 -0500
committerInstrumental <jonathan.gathman@att.com>2019-10-15 08:35:35 -0500
commit1296352d8eafee57f982a4342ad79ada4aa56d28 (patch)
tree355cdb89d85530a861319f892b0f24236e6adc50 /cadi/oauth-enduser/src/main
parentbdce7667a6e272e2fa32e298d957a0d9090c5bc9 (diff)
Sonar Fixes, Formatting
Issue-ID: AAF-1019 Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/oauth-enduser/src/main')
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java6
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java12
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java56
3 files changed, 37 insertions, 37 deletions
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
index 2a1ecdeb..6bdda4e0 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class ClientFactory {
throw new CadiException(e);
}
}
-
+
public ClientFactory(String[] args) throws APIException, CadiException {
this(new PropAccess(args));
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
index 107e1d89..2b1003cb 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.onap.aaf.cadi.client.Future;
public class RESTException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -5232371598208651058L;
private Future<?> future;
@@ -32,11 +32,11 @@ public class RESTException extends Exception {
public RESTException(Future<?> future) {
this.future = future;
}
-
+
public int getCode() {
return future.code();
}
-
+
public String getMsg() {
return future.body();
}
@@ -61,6 +61,6 @@ public class RESTException extends Exception {
public String getLocalizedMessage() {
return errorString();
}
-
+
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
index c2deb458..3b7ab032 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,18 +56,18 @@ public class SimpleRESTClient {
public String[] headers() {
return EMPTY;
}};
-
+
public SimpleRESTClient(final TokenClientFactory tcf, final String tokenURL, final String endpoint, final String[] scope) throws CadiException, LocatorException, APIException {
callTimeout = Integer.parseInt(tcf.access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
tokenClient = tcf.newClient(tokenURL);
Result<TimedToken> rtt = tokenClient.getToken(scope);
if (rtt.isOK()) {
restClient = tcf.newTzClient(endpoint);
-
+
if ((client_id = tcf.access.getProperty(Config.AAF_APPID, null))==null) {
if ((client_id = tcf.access.getProperty(Config.CADI_ALIAS, null))==null) {
throw new CadiException(Config.AAF_APPID + " or " + Config.CADI_ALIAS + " needs to be defined");
- }
+ }
}
try {
restClient.setToken(client_id,rtt.value);
@@ -78,7 +78,7 @@ public class SimpleRESTClient {
throw new CadiException(rtt.error);
}
}
-
+
public SimpleRESTClient timeout(int newTimeout) {
callTimeout = newTimeout;
return this;
@@ -98,7 +98,7 @@ public class SimpleRESTClient {
}
return this;
}
-
+
/**
* Single Threaded Class for building up content
* @author Instrumental
@@ -109,24 +109,24 @@ public class SimpleRESTClient {
private String content;
private StringBuilder sb;
-
+
public Input() {
content = null;
sb = null;
}
-
+
public Input(final String content) {
this.content = content;
}
-
+
public void set(final String content) {
this.content = content;
}
-
+
public PrintWriter writer() {
return new PrintWriter(new StringBuilderWriter(builder()));
}
-
+
public StringBuilder builder() {
if (sb==null) {
sb = new StringBuilder();
@@ -134,7 +134,7 @@ public class SimpleRESTClient {
}
return sb;
}
-
+
/**
* Reuse StringBuilder object
*/
@@ -144,7 +144,7 @@ public class SimpleRESTClient {
sb.setLength(0);
}
}
-
+
@Override
public String toString() {
if (content!=null) {
@@ -162,7 +162,7 @@ public class SimpleRESTClient {
if (sb==null) {
rv = EMPTY_STREAM_BYTES;
} else {
- rv = sb.toString().getBytes();
+ rv = sb.toString().getBytes();
}
} else {
rv = content.getBytes();
@@ -173,7 +173,7 @@ public class SimpleRESTClient {
}
/////////////////////////////////////////////////////////////
- //
+ //
// CREATE
//
/////////////////////////////////////////////////////////////
@@ -194,11 +194,11 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// READ
//
/////////////////////////////////////////////////////////////
@@ -221,11 +221,11 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
-
+
/////////////////////////////////////////////////////////////
- //
+ //
// UPDATE
//
/////////////////////////////////////////////////////////////
@@ -249,18 +249,18 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// DELETE
//
/////////////////////////////////////////////////////////////
public void delete(final String path) throws RESTException, CadiException, LocatorException, APIException {
delete(path,APPLICATION_JSON);
}
-
+
public void delete(final String path, final String contentType) throws RESTException, CadiException, LocatorException, APIException {
Future<Void> future = restClient.best(new Retryable<Future<Void>>() {
@Override
@@ -270,17 +270,17 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
-
+
private static class ETransfer implements EClient.Transfer {
private Input input;
public ETransfer(final Input input) {
this.input = input;
}
-
+
@Override
public void transfer(OutputStream os) throws IOException, APIException {
os.write(input.getBytes());
@@ -290,7 +290,7 @@ public class SimpleRESTClient {
public interface Headers {
String[] headers();
}
-
+
public String[] headers() {
if (chain==null) {
return headers.headers();