From dbd9c14aae385eb5851fea4171b12b9ea6094c64 Mon Sep 17 00:00:00 2001
From: Abhishek Patil <abpatil@microsoft.com>
Date: Wed, 23 Sep 2020 17:43:45 +0530
Subject: [PATCH] Revert "Upgrading core-lib-azure version. Using
 TenantFactoryImpl.java and TenantInfoDoc.java from core-lib-azure."

This reverts commit cce625bf
---
 .../azure/tags/dataaccess/LegalTagDoc.java    | 28 +++++++++
 .../osdu/legal/byoc/di/TenantFactoryImpl.java | 61 +++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagDoc.java
 create mode 100644 provider/legal-byoc/src/main/java/org/opengroup/osdu/legal/byoc/di/TenantFactoryImpl.java

diff --git a/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagDoc.java b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagDoc.java
new file mode 100644
index 000000000..ddd924535
--- /dev/null
+++ b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagDoc.java
@@ -0,0 +1,28 @@
+//  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.tags.dataaccess;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.opengroup.osdu.core.common.model.legal.LegalTag;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class LegalTagDoc {
+    private String id;
+    private LegalTag legalTag;
+}
diff --git a/provider/legal-byoc/src/main/java/org/opengroup/osdu/legal/byoc/di/TenantFactoryImpl.java b/provider/legal-byoc/src/main/java/org/opengroup/osdu/legal/byoc/di/TenantFactoryImpl.java
new file mode 100644
index 000000000..0d6b85203
--- /dev/null
+++ b/provider/legal-byoc/src/main/java/org/opengroup/osdu/legal/byoc/di/TenantFactoryImpl.java
@@ -0,0 +1,61 @@
+//  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.byoc.di;
+
+import org.opengroup.osdu.core.common.cache.ICache;
+import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
+import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+@Component
+public class TenantFactoryImpl implements ITenantFactory {
+    public static final String[] REGISTERED_TENANTS = new String[] {"common", "opendes"};
+    private Map<String, TenantInfo> tenants;
+
+    public TenantFactoryImpl()
+    {
+        this.tenants = new HashMap<>();
+        for (String tenantName : REGISTERED_TENANTS) {
+            TenantInfo ti = new TenantInfo();
+            ti.setName(tenantName);
+            ti.setComplianceRuleSet(tenantName.equals("common") ?
+                    TenantInfo.ComplianceRuleSets.SHARED : TenantInfo.ComplianceRuleSets.CUSTOMER);
+            this.tenants.put(tenantName, ti);
+        }
+    }
+
+    public boolean exists(String tenantName)
+    {
+        return this.tenants.containsKey(tenantName);
+    }
+
+    public TenantInfo getTenantInfo(String tenantName) {
+        return this.tenants.get(tenantName);
+    }
+
+    public Collection<TenantInfo> listTenantInfo() {
+        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() {}
+}
+
-- 
GitLab