Skip to content
Snippets Groups Projects
Commit 2bb3d69c authored by Kishore Battula's avatar Kishore Battula
Browse files

Merge branch 'abpatil_legal_refactor' into 'master'

Upgrading core-lib-azure version

See merge request !54
parents feffc4b1 1153a412
No related branches found
No related tags found
1 merge request!54Upgrading core-lib-azure version
Pipeline #10287 passed
......@@ -382,9 +382,10 @@ The following software have components provided under the terms of this license:
- 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)
- Mockito (from http://mockito.org)
- Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org)
- Mockito (from http://mockito.org)
- Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/)
- Netty Reactive Streams Implementation (from )
- Netty/Buffer (from http://netty.io/)
......
......@@ -88,7 +88,7 @@
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<version>0.0.11</version>
<version>0.0.29</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
......
......@@ -37,9 +37,6 @@ public class AzureBootstrapConfig {
@Value("${azure.servicebus.namespace-name}")
private String serviceBusNamespace;
@Value("${azure.cosmosdb.tenant.collection}")
private String tenantCollectionName;
@Value("${azure.cosmosdb.legal.collection}")
private String legalCollectionName;
......@@ -100,9 +97,4 @@ public class AzureBootstrapConfig {
public String legalTagsContainer(){
return legalCollectionName;
}
@Bean
public String tenantInfoContainer(){
return tenantCollectionName;
}
}
\ No newline at end of file
// 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.legal.azure.di;
import org.opengroup.osdu.azure.CosmosStore;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@Component
public class TenantFactoryImpl implements ITenantFactory {
@Autowired
private CosmosStore cosmosStore;
@Autowired
private String tenantInfoContainer;
@Autowired
private String cosmosDBName;
@Autowired
private DpsHeaders headers;
private Map<String, TenantInfo> tenants;
public boolean exists(String tenantName)
{
if (this.tenants == null)
initTenants();
return this.tenants.containsKey(tenantName);
}
public TenantInfo getTenantInfo(String tenantName) {
if (this.tenants == null)
initTenants();
return this.tenants.get(tenantName);
}
public Collection<TenantInfo> listTenantInfo() {
if (this.tenants == null)
initTenants();
return this.tenants.values();
}
public <V> ICache<String, V> createCache(String tenantName, String host, int port, int expireTimeSeconds, Class<V> classOfV)
{
return null;
}
public void flushCache() {}
private void initTenants() {
this.tenants = new HashMap<>();
cosmosStore.findAllItems(headers.getPartitionId(), cosmosDBName, tenantInfoContainer, TenantInfoDoc.class).forEach(doc -> {
TenantInfo ti = new TenantInfo();
String tenantName = doc.getId();
ti.setName(tenantName);
String complianceRuleSet = doc.getComplianceRuleSet();
ti.setComplianceRuleSet(complianceRuleSet);
this.tenants.put(tenantName, ti) ;
});
}
}
// 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.legal.azure.di;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TenantInfoDoc {
private String id;
private String complianceRuleSet;
}
......@@ -32,7 +32,6 @@ azure.istio.auth.enabled=${azure_istioauth_enabled}
# Azure CosmosDB configuration
azure.cosmosdb.database=${cosmosdb_database}
azure.cosmosdb.tenant.collection=TenantInfo
azure.cosmosdb.legal.collection=LegalTag
# Azure Blob Storage configuration
......@@ -54,3 +53,7 @@ spring.application.name=legal-azure
#logging configuration
logging.transaction.enabled=true
logging.slf4jlogger.enabled=true
#TenantFactory Configuration
tenantFactoryImpl.required=true
tenantInfo.container.name=TenantInfo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment