diff options
author | Steve Smokowski <ss835w@att.com> | 2020-03-16 20:01:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-16 20:01:06 +0000 |
commit | 0514d12f76335aa3bf3cfccaef3864fd91a54444 (patch) | |
tree | 01d53843d40bf291cffea075ae360ff5f2278fe6 /common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java | |
parent | dd5fdf5d895c5682ddcb796238513a4de7147dc4 (diff) | |
parent | a577f75663e5c8ccddee54337328425c5b2361d2 (diff) |
Merge "split single and plural graph inventory uris"
Diffstat (limited to 'common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java')
-rw-r--r-- | common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java index 98d48ec3a8..09efb5a48d 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java @@ -25,6 +25,7 @@ import org.onap.so.client.RestClient; import org.onap.so.client.RestProperties; import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; +import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; public abstract class GraphInventoryClient { @@ -36,9 +37,22 @@ public abstract class GraphInventoryClient { this.props = props; } - protected abstract URI constructPath(GraphInventoryUri uri); + protected abstract URI constructPath(URI uri); + + protected abstract RestClient createClient(URI uri); + + public RestClient createClient(GraphInventoryUri uri) { + final URI result; + if (uri instanceof HttpAwareUri) { + result = ((HttpAwareUri) uri).locateAndBuild(); + } else { + result = uri.build(); + } + + return createClient(result); + + } - public abstract RestClient createClient(GraphInventoryUri uri); public <T extends RestProperties> T getRestProperties() { if (props == null) { |