@BeforeClass(alwaysRun = true)
 public void init() throws Exception {
   OperationManagementDAOFactory.init(this.getDataSource());
   this.initOperationManager();
   this.setupData();
 }
  @SuppressWarnings("unused")
  protected void activate(ComponentContext componentContext) {
    try {
      if (log.isDebugEnabled()) {
        log.debug("Initializing device management core bundle");
      }
      /* Initializing Device Management Configuration */
      DeviceConfigurationManager.getInstance().initConfig();
      DeviceManagementConfig config =
          DeviceConfigurationManager.getInstance().getDeviceManagementConfig();

      DataSourceConfig dsConfig =
          config.getDeviceManagementConfigRepository().getDataSourceConfig();

      APIManagerConfiguration apiManagerConfiguration = new APIManagerConfiguration();
      apiManagerConfiguration.load(APIM_CONFIGURATION_PATH);
      DeviceManagementDataHolder.getInstance().setApiManagerConfiguration(apiManagerConfiguration);

      DeviceManagementDAOFactory.init(dsConfig);
      GroupManagementDAOFactory.init(dsConfig);
      NotificationManagementDAOFactory.init(dsConfig);
      OperationManagementDAOFactory.init(dsConfig);

      String apiManagerDataSource = apiManagerConfiguration.getFirstProperty(DATA_SOURCE_NAME);
      ScopeManagementDAOFactory.init(apiManagerDataSource);

      /* Initialize Operation Manager */
      this.initOperationsManager();

      PushNotificationProviderRepository pushNotificationRepo =
          new PushNotificationProviderRepository();
      List<String> pushNotificationProviders = config.getPushNotificationProviders();
      if (pushNotificationProviders != null) {
        for (String pushNoteProvider : pushNotificationProviders) {
          pushNotificationRepo.addProvider(pushNoteProvider);
        }
      }
      DeviceManagementDataHolder.getInstance()
          .setPushNotificationProviderRepository(pushNotificationRepo);

      /* If -Dsetup option enabled then create device management database schema */
      String setupOption = System.getProperty(DeviceManagementConstants.Common.SETUP_PROPERTY);
      if (setupOption != null) {
        if (log.isDebugEnabled()) {
          log.debug(
              "-Dsetup is enabled. Device management repository schema initialization is about to "
                  + "begin");
        }
        this.setupDeviceManagementSchema(dsConfig);
      }

      /* Registering declarative service instances exposed by DeviceManagementServiceComponent */
      this.registerServices(componentContext);

      /* This is a workaround to initialize all Device Management Service Providers after the initialization
       * of Device Management Service component in order to avoid bundle start up order related complications */
      notifyStartupListeners();
      if (log.isDebugEnabled()) {
        log.debug("Device management core bundle has been successfully initialized");
      }
    } catch (Throwable e) {
      log.error("Error occurred while initializing device management core bundle", e);
    }
  }