Commit 1e04a9b5 authored by Aalekh Jain's avatar Aalekh Jain
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://community.opengroup.org/osdu/platform/system/lib/cloud/azure/os-core-lib-azure into getSasToken
parents d8a735e5 1b23b14d
Pipeline #15574 passed with stages
in 11 minutes and 10 seconds
......@@ -2,6 +2,13 @@
Generated by fossa-cli (https://github.com/fossas/fossa-cli).
This software includes the following software and licenses:
========================================================================
Apache-1.1
========================================================================
The following software have components provided under the terms of this license:
- StAX (from http://stax.codehaus.org/)
========================================================================
Apache-2.0
========================================================================
......@@ -22,8 +29,10 @@ The following software have components provided under the terms of this license:
- Apache Log4j Core (from )
- Apache Log4j JUL Adapter (from )
- Apache Log4j SLF4J Binding (from )
- Apache Log4j to SLF4J Adapter (from )
- Asynchronous Http Client (from )
- Asynchronous Http Client Netty Utils (from )
- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Bean Validation API (from http://beanvalidation.org)
- Byte Buddy (without dependencies) (from )
- Byte Buddy Java agent (from )
......@@ -31,6 +40,7 @@ The following software have components provided under the terms of this license:
- Converter: Jackson (from )
- Elastic JNA Distribution (from https://github.com/java-native-access/jna)
- Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch)
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- FindBugs-jsr305 (from http://findbugs.sourceforge.net/)
- Google HTTP Client Library for Java (from https://github.com/google/google-http-java-client.git)
- Gson (from https://github.com/google/gson)
......@@ -39,6 +49,7 @@ The following software have components provided under the terms of this license:
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HPPC Collections (from http://labs.carrotsearch.com)
- Hibernate Validator Engine (from )
- IntelliJ IDEA Annotations (from http://www.jetbrains.org)
- J2ObjC Annotations (from https://github.com/google/j2objc/)
- JBoss Logging 3 (from http://www.jboss.org)
- JCIP Annotations under Apache License (from http://stephenc.github.com/jcip-annotations)
......@@ -60,6 +71,12 @@ The following software have components provided under the terms of this license:
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/)
- Joda-Time (from http://www.joda.org/joda-time/)
- KeePassJava2 :: All (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2)
- KeePassJava2 :: DOM (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-dom)
- KeePassJava2 :: JAXB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-jaxb)
- KeePassJava2 :: KDB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdb)
- KeePassJava2 :: KDBX (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdbx)
- KeePassJava2 :: Simple (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-simple)
- Lucene Common Analyzers (from )
- Lucene Core (from )
- Lucene Grouping (from )
......@@ -86,7 +103,6 @@ The following software have components provided under the terms of this license:
- Netty Reactive Streams Implementation (from )
- Netty/Buffer (from http://netty.io/)
- Netty/Codec (from )
- Netty/Codec/DNS (from )
- Netty/Codec/HTTP (from )
- Netty/Codec/HTTP2 (from )
- Netty/Codec/Socks (from )
......@@ -94,10 +110,10 @@ The following software have components provided under the terms of this license:
- Netty/Handler (from )
- Netty/Handler/Proxy (from )
- Netty/Resolver (from )
- Netty/Resolver/DNS (from )
- Netty/TomcatNative [BoringSSL - Static] (from )
- Netty/Transport (from http://netty.io/)
- Netty/Transport/Native/Unix/Common (from )
- Nimbus Content Type (from https://bitbucket.org/connect2id/nimbus-content-type)
- Nimbus JOSE+JWT (from https://bitbucket.org/connect2id/nimbus-jose-jwt)
- Nimbus LangTag (from https://bitbucket.org/connect2id/nimbus-language-tags)
- Non-Blocking Reactive Foundation for the JVM (from https://github.com/reactor/reactor)
......@@ -109,8 +125,10 @@ The following software have components provided under the terms of this license:
- Okio (from )
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database)
- Reactive Streams Netty driver (from https://github.com/reactor/reactor-netty)
- Retrofit (from )
- Simple XML (from http://simple.sourceforge.net)
- SnakeYAML (from http://www.snakeyaml.org)
- Spring AOP (from https://github.com/spring-projects/spring-framework)
- Spring Beans (from https://github.com/spring-projects/spring-framework)
......@@ -120,6 +138,7 @@ The following software have components provided under the terms of this license:
- Spring Boot AutoConfigure (from http://projects.spring.io/spring-boot/)
- Spring Boot Json Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-json)
- Spring Boot Log4J2 Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Logging Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Tomcat Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Validation Starter (from http://projects.spring.io/spring-boot/)
......@@ -132,8 +151,11 @@ The following software have components provided under the terms of this license:
- Spring Transaction (from https://github.com/spring-projects/spring-framework)
- Spring Web (from https://github.com/spring-projects/spring-framework)
- Spring Web MVC (from https://github.com/spring-projects/spring-framework)
- StAX (from http://stax.codehaus.org/)
- StAX API (from http://stax.codehaus.org/)
- T-Digest (from https://github.com/tdunning/t-digest)
- Woodstox (from https://github.com/FasterXML/woodstox)
- aalto-xml (from )
- aggs-matrix-stats (from https://github.com/elastic/elasticsearch)
- cli (from https://github.com/elastic/elasticsearch)
- compiler (from http://github.com/spullara/mustache.java)
......@@ -169,6 +191,7 @@ BSD-2-Clause
The following software have components provided under the terms of this license:
- Lucene Common Analyzers (from )
- StAX (from http://stax.codehaus.org/)
- Stax2 API (from http://github.com/FasterXML/stax2-api)
========================================================================
......@@ -240,12 +263,16 @@ EPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- Logback Classic Module (from )
- Logback Core Module (from )
- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- SnakeYAML (from http://www.snakeyaml.org)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-params (from http://junit.org/junit5/)
......@@ -257,7 +284,9 @@ EPL-2.0
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-params (from http://junit.org/junit5/)
......@@ -286,8 +315,10 @@ GPL-2.0-with-classpath-exception
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JavaBeans Activation Framework (from )
- JavaMail API (from )
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
- tomcat-embed-core (from http://tomcat.apache.org/)
......@@ -296,8 +327,9 @@ GPL-3.0-only
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- Project Lombok (from https://projectlombok.org)
- SnakeYAML (from http://www.snakeyaml.org)
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
========================================================================
LGPL-2.1-only
......@@ -308,6 +340,8 @@ The following software have components provided under the terms of this license:
- Java Native Access (from https://github.com/java-native-access/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/)
- Logback Classic Module (from )
- Logback Core Module (from )
- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java)
......@@ -337,7 +371,6 @@ The following software have components provided under the terms of this license:
- Azure Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Azure Spring Boot AutoConfigure (from https://github.com/Microsoft/azure-spring-boot)
- Azure Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Checker Qual (from https://checkerframework.org)
- Extensions on Apache Proton-J library (from https://github.com/Azure/qpid-proton-j-extensions)
- JOpt Simple (from http://pholser.github.io/jopt-simple)
......@@ -359,16 +392,19 @@ The following software have components provided under the terms of this license:
- Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure client library for KeyVault Secrets (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure common module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure internal Avro module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://mockito.org)
- Netty/Codec/HTTP (from )
- Netty/Common (from )
- Project Lombok (from https://projectlombok.org)
- SLF4J API Module (from http://www.slf4j.org)
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- Spring Data for Azure Cosmos DB SQL API (from https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos)
- adal4j (from https://github.com/AzureAD/azure-activedirectory-library-for-java)
- micrometer-core (from https://github.com/micrometer-metrics/micrometer)
- mockito-junit-jupiter (from https://github.com/mockito/mockito)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java)
========================================================================
MPL-1.1
......@@ -399,7 +435,7 @@ The following software have components provided under the terms of this license:
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
- reactive-streams (from http://www.reactive-streams.org/)
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
========================================================================
SPL-1.0
......@@ -430,6 +466,8 @@ The following software have components provided under the terms of this license:
- Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java)
- Project Lombok (from https://projectlombok.org)
- Spring Web (from https://github.com/spring-projects/spring-framework)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- reactive-streams (from http://www.reactive-streams.org/)
========================================================================
unknown
......@@ -440,6 +478,7 @@ The following software have components provided under the terms of this license:
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- JavaBeans Activation Framework API jar (from )
- JavaMail API (from )
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- jakarta.xml.bind-api (from )
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
......
......@@ -15,13 +15,12 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<packaging>jar</packaging>
<version>0.0.39</version>
<version>0.0.42</version>
<name>core-lib-azure</name>
<properties>
......@@ -34,16 +33,23 @@
<junit.jupiter.version>5.6.0</junit.jupiter.version>
<maven.surefire.version>2.22.2</maven.surefire.version>
<javax.inject.version>1</javax.inject.version>
<azure.identity.version>1.0.1</azure.identity.version>
<azure.keyvault.version>4.1.0</azure.keyvault.version>
<azure.storage.version>12.3.0</azure.storage.version>
<azure.servicebus.version>3.1.4</azure.servicebus.version>
<azure.identity.version>1.1.3</azure.identity.version>
<azure.keyvault.version>4.2.2</azure.keyvault.version>
<azure.spring.data.cosmos.version>3.1.0</azure.spring.data.cosmos.version>
<azure.storage.version>12.8.0</azure.storage.version>
<azure.servicebus.version>3.4.0</azure.servicebus.version>
<azure.core.http.netty.version>1.6.2</azure.core.http.netty.version>
<azure.msal4j.version>1.7.1</azure.msal4j.version>
<azure.appinsights.version>2.5.1</azure.appinsights.version>
<azure.appinsights.log4j.version>2.5.1</azure.appinsights.log4j.version>
<azure.spring.boot.metric.version>2.0.7</azure.spring.boot.metric.version>
<reactor.version>0.9.0.RELEASE</reactor.version>
<azure.spring.boot.version>2.3.5</azure.spring.boot.version>
<checkstyle.version>3.1.0</checkstyle.version>
<jackson.version>2.10.1</jackson.version>
<jackson.version>2.11.3</jackson.version>
<netty.version>4.1.51.Final</netty.version>
<lombok.version>1.18.16</lombok.version>
<osdu.oscorecommon.version>0.3.18</osdu.oscorecommon.version>
<mockito-junit-jupiter.version>2.23.0</mockito-junit-jupiter.version>
<spring-boot-starter-log4j2.version>2.3.4.RELEASE</spring-boot-starter-log4j2.version>
</properties>
<licenses>
......@@ -54,12 +60,67 @@
</license>
</licenses>
<dependencies>
<!-- List of managed dependencies to use a consistent set of version for Azure
and some common dependencies across all OSDU services. Each OSDU service can
inherit this list. -->
<dependencyManagement>
<dependencies>
<!-- Bill of materials to make sure a consistent set of
versions is used for Reactor 3 and Netty artifacts. -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>Dysprosium-SR12</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>${azure.msal4j.version}</version>
</dependency>
<!-- BOM for Azure Spring Boot Starters like azure-active-directory-spring-boot-starter,
azure-cosmosdb-spring-boot-starter etc. -->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-boot-bom</artifactId>
<version>${azure.spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson/jackson-bom -->
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.5.3</version>
<version>${azure.core.http.netty.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- Spring dependencies -->
......@@ -79,7 +140,7 @@
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.3.18</version>
<version>${osdu.oscorecommon.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
......@@ -107,7 +168,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>3.0.0</version>
<version>${azure.spring.data.cosmos.version}</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
......@@ -129,12 +190,11 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-boot-metrics-starter</artifactId>
<version>${azure.spring.boot.metric.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.3.4.RELEASE</version>
<version>${spring-boot-starter-log4j2.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
......@@ -143,7 +203,6 @@
</dependency>
<!-- Other dependencies -->
<dependency>
<groupId>javax.inject</groupId>
......@@ -161,26 +220,22 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.23.0</version>
<version>${mockito-junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
......
......@@ -14,86 +14,28 @@
package org.opengroup.osdu.azure.cache;
import org.opengroup.osdu.core.common.cache.VmCache;
import org.opengroup.osdu.core.common.model.search.ClusterSettings;
import org.opengroup.osdu.core.common.provider.interfaces.IElasticCredentialsCache;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import javax.inject.Named;
/**
* Elastic credential cache used by the Azure implementation of OSDU.
* abstract class for Elastic credential cache.
*/
@Component
@Lazy
public class ElasticCredentialsCache implements IElasticCredentialsCache<String, ClusterSettings> {
/**
* Underlying cache.
*/
private VmCache<String, ClusterSettings> cache;
/**
* @param cacheExpirationMinutes The cache expiration time, in minutes.
* @param maxCachedObjectEntries The max number of objects that can be in the cache.
*/
public ElasticCredentialsCache(
@Named("ELASTIC_CACHE_EXPIRATION") final Integer cacheExpirationMinutes,
@Named("MAX_CACHE_VALUE_SIZE") final Integer maxCachedObjectEntries) {
cache = new VmCache<>(cacheExpirationMinutes * 60, maxCachedObjectEntries);
}
/**
* @param s Key of item to insert.
* @param o The data to insert.
*/
@Override
public void put(final String s, final ClusterSettings o) {
cache.put(s, o);
}
/**
* @param s The cache key.
* @return The data cached with that key.
*/
@Override
public ClusterSettings get(final String s) {
return cache.get(s);
}
/**
* Delete an item from the cache.
*
* @param s The key to use for the delete operation.
*/
@Override
public void delete(final String s) {
cache.delete(s);
}
/**
* Clear all items from the cache.
*/
@Override
public void clearAll() {
cache.clearAll();
}
/**
* @param key cache key
* @return true if found in cache
*/
public boolean containsKey(final String key) {
return this.get(key) != null;
}
/**
* @param partitionId the tenant for which the request should be cached for.
* @return cache key for the tenant.
*/
public String getCacheKey(final String partitionId) {
return String.format("%s-clusterSettings", partitionId);
}
public abstract class ElasticCredentialsCache implements IElasticCredentialsCache<String, ClusterSettings> {
/**
* @param key cache key
* @return true if found in cache
*/
public boolean containsKey(final String key) {
return get(key) != null;
}
/**
* @param partitionId the tenant for which the request should be cached for.
* @return cache key for the tenant.
*/
public String getCacheKey(final String partitionId) {
return String.format("%s-clusterSettings", partitionId);
}
}
// Copyright © Microsoft Corporation
//
// 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.
package org.opengroup.osdu.azure.cache;
import javax.inject.Named;
import org.opengroup.osdu.core.common.cache.VmCache;
import org.opengroup.osdu.core.common.model.search.ClusterSettings;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
/**
* Elastic credential cache used by the Azure implementation of OSDU.
*/
@Component("clusterSettingsCache")
@Lazy
@ConditionalOnProperty(value = "cache.provider", havingValue = "vm", matchIfMissing = true)
public class ElasticCredentialsCacheImpl extends ElasticCredentialsCache {
/**
* Underlying cache.
*/
private VmCache<String, ClusterSettings> cache;
/**
* @param cacheExpirationMinutes The cache expiration time, in minutes.
* @param maxCachedObjectEntries The max number of objects that can be in the cache.
*/
public ElasticCredentialsCacheImpl(
@Named("ELASTIC_CACHE_EXPIRATION") final Integer cacheExpirationMinutes,
@Named("MAX_CACHE_VALUE_SIZE") final Integer maxCachedObjectEntries) {
cache = new VmCache<>(cacheExpirationMinutes * 60, maxCachedObjectEntries);
}
/**
* @param s Key of item to insert.
* @param o The data to insert.
*/
@Override
public void put(final String s, final ClusterSettings o) {
cache.put(s, o);
}
/**
* @param s The cache key.
* @return The data cached with that key.
*/
@Override
public ClusterSettings get(final String s) {
return cache.get(s);
}
/**
* Delete an item from the cache.
*
* @param s The key to use for the delete operation.
*/
@Override
public void delete(final String s) {
cache.delete(s);
}
/**
* Clear all items from the cache.
*/
@Override
public void clearAll() {
cache.clearAll();
}
}
package org.opengroup.osdu.azure.cache;
import com.microsoft.azure.servicebus.SubscriptionClient;
import org.opengroup.osdu.core.common.cache.VmCache;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
/**
* Implementation of ICache for SubscriptionClient.
*/
@Component
@Lazy
public class SubscriptionClientCache extends VmCache<String, SubscriptionClient> {
/**
* Default cache constructor.
*/
public SubscriptionClientCache() {
super(60 * 60, 1000);
}
/**
* @param key cache key
* @return true if found in cache
*/
public boolean containsKey(final String key) {
return this.get(key) != null;
}
}
\ No newline at end of file
package org.opengroup.osdu.azure.servicebus;
import com.microsoft.azure.servicebus.SubscriptionClient;
import com.microsoft.azure.servicebus.primitives.ServiceBusException;
/**
* Interface for Subscription Client Factory to return appropriate subscription client
* instance for each tenant based on data partition, service bus topic and subscription Name.
*/