From 9c9c391fd4d1268e9464a3647c91c57e2455b4d0 Mon Sep 17 00:00:00 2001 From: rajitha Date: Tue, 18 Apr 2023 15:51:02 +0530 Subject: [PATCH] Code refactor --- .../common/exception/TenantMgtException.java | 3 +++ .../internal/TenantMgtServiceComponent.java | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/components/tenant-mgt/io.entgra.tenant.mgt.common/src/main/java/io/entgra/tenant/mgt/common/exception/TenantMgtException.java b/components/tenant-mgt/io.entgra.tenant.mgt.common/src/main/java/io/entgra/tenant/mgt/common/exception/TenantMgtException.java index f9b8c22e629..1470f07f63d 100644 --- a/components/tenant-mgt/io.entgra.tenant.mgt.common/src/main/java/io/entgra/tenant/mgt/common/exception/TenantMgtException.java +++ b/components/tenant-mgt/io.entgra.tenant.mgt.common/src/main/java/io/entgra/tenant/mgt/common/exception/TenantMgtException.java @@ -18,6 +18,9 @@ package io.entgra.tenant.mgt.common.exception; public class TenantMgtException extends Exception { + + private static final long serialVersionUID = 4304028531230841553L; + public TenantMgtException(String msg, Throwable ex) { super(msg, ex); } diff --git a/components/tenant-mgt/io.entgra.tenant.mgt.core/src/main/java/io/entgra/tenant/mgt/core/internal/TenantMgtServiceComponent.java b/components/tenant-mgt/io.entgra.tenant.mgt.core/src/main/java/io/entgra/tenant/mgt/core/internal/TenantMgtServiceComponent.java index 0f4480e1b90..fafdbbbea75 100644 --- a/components/tenant-mgt/io.entgra.tenant.mgt.core/src/main/java/io/entgra/tenant/mgt/core/internal/TenantMgtServiceComponent.java +++ b/components/tenant-mgt/io.entgra.tenant.mgt.core/src/main/java/io/entgra/tenant/mgt/core/internal/TenantMgtServiceComponent.java @@ -61,9 +61,14 @@ public class TenantMgtServiceComponent { whiteLabelManagementService, null); TenantMgtDataHolder.getInstance().setWhiteLabelManagementService(whiteLabelManagementService); DeviceMgtTenantListener deviceMgtTenantListener = new DeviceMgtTenantListener(); + if(log.isDebugEnabled()) { + log.info("Tenant management listener is registering"); + } componentContext.getBundleContext(). registerService(TenantMgtListener.class.getName(), deviceMgtTenantListener, null); - log.info("Tenant management service activated"); + if(log.isDebugEnabled()) { + log.info("Tenant management service activated"); + } } catch (Throwable t) { String msg = "Error occurred while activating tenant management service"; log.error(msg, t); @@ -76,18 +81,30 @@ public class TenantMgtServiceComponent { } protected void setApplicationManager(ApplicationManager applicationManager) { + if(log.isDebugEnabled()) { + log.info("Application manager service is binding"); + } TenantMgtDataHolder.getInstance().setApplicationManager(applicationManager); } protected void unsetApplicationManager(ApplicationManager applicationManager) { + if(log.isDebugEnabled()) { + log.info("Application manager service is unbinding"); + } TenantMgtDataHolder.getInstance().setApplicationManager(null); } protected void setRealmService(RealmService realmService) { + if(log.isDebugEnabled()) { + log.info("Realm Service service is binding"); + } TenantMgtDataHolder.getInstance().setRealmService(realmService); } protected void unsetRealmService(RealmService realmService) { + if(log.isDebugEnabled()) { + log.info("Realm Service service is unbinding"); + } TenantMgtDataHolder.getInstance().setRealmService(null); } }