aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-11-30 14:49:48 +0000
committerGerrit Code Review <gerrit@onap.org>2020-11-30 14:49:48 +0000
commit0fb130d77336e7476bbc09cc453efabf6fa1b16e (patch)
treebc26a41332365895dd4c9949ff229fbd49f46a15 /adapters
parentaec0236281f227a0a68b38ca7b0e56e50ffa95b7 (diff)
parenta16231657fe29334a589c98290ac8b6b2710a144 (diff)
Merge "add caching to graph inventory client"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
index b7e214f9fc..cd32cc208a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
@@ -24,6 +24,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.onap.aaiclient.client.aai.AAIProperties;
import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.so.client.CacheProperties;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
@@ -33,6 +34,8 @@ public class AaiClientPropertiesImpl implements AAIProperties {
private String auth;
private String key;
private Long readTimeout;
+ private boolean enableCaching;
+ private Long cacheMaxAge;
private static final String SYSTEM_NAME = "MSO";
public AaiClientPropertiesImpl() {
@@ -41,6 +44,8 @@ public class AaiClientPropertiesImpl implements AAIProperties {
this.auth = context.getEnvironment().getProperty("aai.auth");
this.key = context.getEnvironment().getProperty("mso.msoKey");
this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000));
+ this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false);
+ this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L);
}
@Override
@@ -72,4 +77,19 @@ public class AaiClientPropertiesImpl implements AAIProperties {
public Long getReadTimeout() {
return this.readTimeout;
}
+
+ @Override
+ public boolean isCachingEnabled() {
+ return this.enableCaching;
+ }
+
+ @Override
+ public CacheProperties getCacheProperties() {
+ return new AAICacheProperties() {
+ @Override
+ public Long getMaxAge() {
+ return cacheMaxAge;
+ }
+ };
+ }
}