Add improvements for the TenantMgtServiceComponent.

Nipuni Kavindya 2 months ago
parent 0039adad53
commit 7acf8c079a

@ -42,6 +42,39 @@ public class TenantMgtServiceComponent {
private static final Log log = LogFactory.getLog(TenantManagerService.class); private static final Log log = LogFactory.getLog(TenantManagerService.class);
@SuppressWarnings("unused")
@Activate
protected void activate(ComponentContext componentContext) {
try {
TenantManagerService tenantManagerService = new TenantManagerServiceImpl();
componentContext.getBundleContext().
registerService(TenantManagerService.class.getName(), tenantManagerService, null);
TenantManagerAdminService tenantManagerAdminService = new TenantManagerAdminServiceImpl();
componentContext.getBundleContext().
registerService(TenantManagerAdminService.class.getName(), tenantManagerAdminService, null);
TenantManager tenantManager = new TenantManagerImpl();
TenantMgtDataHolder.getInstance().setTenantManager(tenantManager);
DeviceMgtTenantListener deviceMgtTenantListener = new DeviceMgtTenantListener();
if(log.isDebugEnabled()) {
log.info("Tenant management listener is registering");
}
componentContext.getBundleContext().
registerService(TenantMgtListener.class.getName(), deviceMgtTenantListener, null);
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);
}
}
@SuppressWarnings("unused")
@Deactivate
protected void deactivate(ComponentContext componentContext) {
// nothing to do
}
@Reference( @Reference(
name = "whiteLabelManagement.service", name = "whiteLabelManagement.service",
service = io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService.class, service = io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService.class,
@ -82,39 +115,6 @@ public class TenantMgtServiceComponent {
TenantMgtDataHolder.getInstance().setDeviceStatusManagementService(null); TenantMgtDataHolder.getInstance().setDeviceStatusManagementService(null);
} }
@SuppressWarnings("unused")
@Activate
protected void activate(ComponentContext componentContext) {
try {
TenantManagerService tenantManagerService = new TenantManagerServiceImpl();
componentContext.getBundleContext().
registerService(TenantManagerService.class.getName(), tenantManagerService, null);
TenantManagerAdminService tenantManagerAdminService = new TenantManagerAdminServiceImpl();
componentContext.getBundleContext().
registerService(TenantManagerAdminService.class.getName(), tenantManagerAdminService, null);
TenantManager tenantManager = new TenantManagerImpl();
TenantMgtDataHolder.getInstance().setTenantManager(tenantManager);
DeviceMgtTenantListener deviceMgtTenantListener = new DeviceMgtTenantListener();
if(log.isDebugEnabled()) {
log.info("Tenant management listener is registering");
}
componentContext.getBundleContext().
registerService(TenantMgtListener.class.getName(), deviceMgtTenantListener, null);
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);
}
}
@SuppressWarnings("unused")
@Deactivate
protected void deactivate(ComponentContext componentContext) {
// nothing to do
}
@Reference( @Reference(
name = "application.mgr", name = "application.mgr",
service = io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager.class, service = io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager.class,

Loading…
Cancel
Save