From 4a03c7abf796837e440b9b15d42e453da0337124 Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Mon, 14 Sep 2015 15:23:11 +0530 Subject: [PATCH] certificate authentication changes --- .../internal/SCEPManagerServiceComponent.java | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java new file mode 100644 index 0000000000..e414b6c8ae --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java @@ -0,0 +1,86 @@ +package org.wso2.carbon.device.mgt.core.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.ios.core.service.IOSEnrollmentService; + +/** + * @scr.component name="org.wso2.carbon.device.ios.enrollment" immediate="true" + * @scr.reference name="org.wso2.carbon.device.manager" + * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" + * policy="dynamic" + * cardinality="1..n" + * bind="setDeviceManagementService" + * unbind="unsetDeviceManagementService" + * @scr.reference name="org.wso2.carbon.certificate.mgt" + * interface="org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService" + * policy="dynamic" + * cardinality="1..n" + * bind="setCertificateManagementService" + * unbind="unsetCertificateManagementService" + */ +public class SCEPManagerServiceComponent { + + private static final Log log = LogFactory.getLog(IOSEnrollmentServiceComponent.class); + + protected void activate(ComponentContext componentContext) { + + try { + if (log.isDebugEnabled()) { + log.debug("Initializing iOS device management core bundle"); + } + + BundleContext bundleContext = componentContext.getBundleContext(); + bundleContext.registerService(IOSEnrollmentService.class.getName(), + IOSEnrollmentService.getInstance(), null); + + if (log.isDebugEnabled()) { + log.debug("iOS device management core bundle has been successfully initialized"); + } + } catch (Throwable e) { + String msg = "Error occurred while initializing ios device management core bundle"; + log.error(msg, e); + } + } + + protected void deactivate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("Deactivating iOS device management core bundle"); + } + } + + protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) { + if (log.isDebugEnabled()) { + log.debug("Setting device management service provider"); + } + IOSEnrollmentServiceHolder.getInstance().setDeviceManagementService(deviceManagementService); + } + + protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementService) { + if (log.isDebugEnabled()) { + log.debug("Removing device management service provider"); + } + + IOSEnrollmentServiceHolder.getInstance().setDeviceManagementService(null); + } + + protected void setCertificateManagementService(CertificateManagementService certificateManagementService) { + if (log.isDebugEnabled()) { + log.debug("Setting certificate management service"); + } + IOSEnrollmentServiceHolder.getInstance().setCertificateManagementService(certificateManagementService); + } + + protected void unsetCertificateManagementService(CertificateManagementService certificateManagementService) { + if (log.isDebugEnabled()) { + log.debug("Removing certificate management service"); + } + + IOSEnrollmentServiceHolder.getInstance().setCertificateManagementService(null); + } + +}