From 282ac72249ca7de9be0d82704532d7d83244e966 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Mon, 4 Jul 2016 17:58:14 +0530 Subject: [PATCH] adding SCEPManagerService to scep manager compenent --- .../internal/SCEPManagerServiceComponent.java | 60 +++++++++++++++++++ .../internal/SCEPManagerServiceComponent.java | 52 ++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/internal/SCEPManagerServiceComponent.java 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/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/internal/SCEPManagerServiceComponent.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/internal/SCEPManagerServiceComponent.java new file mode 100644 index 00000000000..2f9fc8e22c3 --- /dev/null +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/internal/SCEPManagerServiceComponent.java @@ -0,0 +1,60 @@ +package org.wso2.carbon.certificate.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.scep.SCEPManager; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPManagerImpl; +import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; + +/** + * @scr.component name="org.wso2.carbon.certificate.mgt.core.scep" immediate="true" + * @scr.reference name="app.mgt.service" + * interface="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService" + * cardinality="1..1" + * policy="dynamic" + * bind="setApplicationManagementProviderService" + * unbind="unsetApplicationManagementProviderService" + */ +public class SCEPManagerServiceComponent { + + private static final Log log = LogFactory.getLog(SCEPManagerServiceComponent.class); + + protected void activate(ComponentContext componentContext) { + + try { + if (log.isDebugEnabled()) { + log.debug("Initializing SCEP core bundle"); + } + + BundleContext bundleContext = componentContext.getBundleContext(); + bundleContext.registerService(SCEPManager.class.getName(), + new SCEPManagerImpl(), null); + + if (log.isDebugEnabled()) { + log.debug("SCEP core bundle has been successfully initialized"); + } + } catch (Throwable e) { + String msg = "Error occurred while initializing SCEP core bundle"; + log.error(msg, e); + } + } + + protected void deactivate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("Deactivating SCEP core bundle"); + } + } + + protected void unsetApplicationManagementProviderService(ApplicationManagementProviderService + applicationManagementProviderService) { + //do nothing + } + + protected void setApplicationManagementProviderService(ApplicationManagementProviderService + applicationManagementProviderService) { + //do nothing + } + +} 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 00000000000..e5d9058bdfc --- /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,52 @@ +package org.wso2.carbon.device.mgt.core.internal; + +///** +// * @scr.component name="org.wso2.carbon.certificate.mgt.core.scep" immediate="true" +// * @scr.reference name="app.mgt.service" +// * interface="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService" +// * cardinality="1..1" +// * policy="dynamic" +// * bind="setApplicationManagementProviderService" +// * unbind="unsetApplicationManagementProviderService" +// */ +//public class SCEPManagerServiceComponent { +// +// private static final Log log = LogFactory.getLog(SCEPManagerServiceComponent.class); +// +// protected void activate(ComponentContext componentContext) { +// +// try { +// if (log.isDebugEnabled()) { +// log.debug("Initializing SCEP core bundle"); +// } +// +// BundleContext bundleContext = componentContext.getBundleContext(); +// bundleContext.registerService(SCEPManager.class.getName(), +// new SCEPManagerImpl(), null); +// +// if (log.isDebugEnabled()) { +// log.debug("SCEP core bundle has been successfully initialized"); +// } +// } catch (Throwable e) { +// String msg = "Error occurred while initializing SCEP core bundle"; +// log.error(msg, e); +// } +// } +// +// protected void deactivate(ComponentContext ctx) { +// if (log.isDebugEnabled()) { +// log.debug("Deactivating SCEP core bundle"); +// } +// } +// +// protected void unsetApplicationManagementProviderService(ApplicationManagementProviderService +// applicationManagementProviderService) { +// //do nothing +// } +// +// protected void setApplicationManagementProviderService(ApplicationManagementProviderService +// applicationManagementProviderService) { +// //do nothing +// } +// +//}