From a8d8fc6113549ad149b9148d36ffc9090def0762 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Tue, 6 Jun 2023 14:10:28 +0530 Subject: [PATCH] updated mobile plugin for apim 420 --- .../pom.xml | 6 +- .../pom.xml | 72 +++++++++++-------- ...droidDeviceManagementServiceComponent.java | 35 ++++----- .../mobile-plugins/android-plugin/pom.xml | 18 ----- .../pom.xml | 44 +----------- ...id-Mutual-SSL-Configuration-Management.xml | 2 +- ...--Android-Mutual-SSL-Device-Management.xml | 2 +- ...min--Android-Mutual-SSL-Event-Receiver.xml | 2 +- pom.xml | 18 ++++- 9 files changed, 82 insertions(+), 117 deletions(-) diff --git a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android.api/pom.xml index 3f1d782b9..415de27af 100644 --- a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android.api/pom.xml @@ -34,13 +34,11 @@ + org.apache.maven.plugins maven-compiler-plugin - - 17 - 17 - + org.apache.maven.plugins maven-war-plugin WEB-INF/lib/*cxf*.jar diff --git a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/pom.xml index fd5fadfa8..6b196e460 100644 --- a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/pom.xml @@ -38,10 +38,10 @@ org.apache.maven.plugins maven-compiler-plugin - - - org.apache.felix - maven-scr-plugin + + 1.8 + 1.8 + org.apache.felix @@ -55,27 +55,44 @@ Device Management Mobile Android Impl Bundle io.entgra.device.mgt.plugins.mobile.android.internal - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.xml, - javax.xml.stream, - javax.xml.bind.*, + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.general;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry;version="[5.0,6)", + io.entgra.device.mgt.plugins.mobile.android.impl.config.datasource, + io.entgra.device.mgt.plugins.mobile.android.impl.dao, + io.entgra.device.mgt.plugins.mobile.android.impl.dao.impl, + io.entgra.device.mgt.plugins.mobile.android.impl.dao.util, + io.entgra.device.mgt.plugins.mobile.android.impl.dto, + javax.naming, javax.sql, - javax.xml.parsers; version=0.0.0, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.bind.annotation.adapters;version="[0.0,1)", + javax.xml.parsers, + javax.xml.stream;version="[1.0,2)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}", org.w3c.dom, - javax.naming, - org.wso2.carbon.context, - org.wso2.carbon.utils.*, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.ndatasource.core, - io.entgra.device.mgt.core.policy.mgt.common.*, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.registry.api, - io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry, - com.google.gson.* + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.registry.api;version="[1.0,2)", + org.wso2.carbon.registry.core;version="[1.0,2)", + org.wso2.carbon.registry.core.service;version="[1.0,2)", + org.wso2.carbon.registry.core.session;version="[1.0,2)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.plugins.mobile.android.internal, @@ -115,12 +132,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.wso2.carbon diff --git a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/src/main/java/io/entgra/device/mgt/plugins/mobile/android/internal/AndroidDeviceManagementServiceComponent.java b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/src/main/java/io/entgra/device/mgt/plugins/mobile/android/internal/AndroidDeviceManagementServiceComponent.java index f61c14a92..9754fc047 100644 --- a/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/src/main/java/io/entgra/device/mgt/plugins/mobile/android/internal/AndroidDeviceManagementServiceComponent.java +++ b/components/mobile-plugins/android-plugin/io.entgra.device.mgt.plugins.mobile.android/src/main/java/io/entgra/device/mgt/plugins/mobile/android/internal/AndroidDeviceManagementServiceComponent.java @@ -25,28 +25,16 @@ import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="io.entgra.device.mgt.plugins.mobile.android.internal.AndroidDeviceManagementServiceComponent" - * immediate="true" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - *

- * Adding reference to API Manager Configuration service is an unavoidable hack to get rid of NPEs thrown while - * initializing APIMgtDAOs attempting to register APIs programmatically. APIMgtDAO needs to be proper cleaned up - * to avoid as an ideal fix - */ +@Component( + name = "io.entgra.device.mgt.plugins.mobile.android.internal.AndroidDeviceManagementServiceComponent", + immediate = true) public class AndroidDeviceManagementServiceComponent { private static final Log log = LogFactory.getLog(AndroidDeviceManagementServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { @@ -64,6 +52,7 @@ public class AndroidDeviceManagementServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Android Mobile Device Management Service Component"); @@ -78,6 +67,12 @@ public class AndroidDeviceManagementServiceComponent { } } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ @@ -90,6 +85,12 @@ public class AndroidDeviceManagementServiceComponent { //do nothing } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService acquired"); diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 11875d3f1..81bfe85a8 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -39,22 +39,4 @@ io.entgra.device.mgt.plugins.mobile.android.ui - - - - - - - - - - - - - - - - - - diff --git a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/pom.xml index 0ce1c3a33..34b76dc30 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/pom.xml @@ -142,45 +142,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins maven-antrun-plugin @@ -219,7 +180,6 @@ org.wso2.maven carbon-p2-plugin - ${carbon.p2.plugin.version} p2-feature-generation @@ -245,9 +205,7 @@ - - org.wso2.carbon.core.server:${carbon.kernel.version} - + org.wso2.carbon.core.server:${carbon.kernel.version} io.entgra.device.mgt.core.device.mgt.server:${io.entgra.device.mgt.core.version} diff --git a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Configuration-Management.xml b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Configuration-Management.xml index 7cddba927..37a353d15 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Configuration-Management.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Configuration-Management.xml @@ -33,6 +33,6 @@ - + diff --git a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Device-Management.xml b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Device-Management.xml index 055e6fbf2..37d50fff5 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Device-Management.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Device-Management.xml @@ -77,6 +77,6 @@ - + diff --git a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Event-Receiver.xml b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Event-Receiver.xml index 2d116a9ad..610d407e7 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Event-Receiver.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/io.entgra.device.mgt.plugins.mobile.android.feature/src/main/resources/apis/admin--Android-Mutual-SSL-Event-Receiver.xml @@ -32,6 +32,6 @@ - + diff --git a/pom.xml b/pom.xml index 3191b3bde..dfd9f57be 100644 --- a/pom.xml +++ b/pom.xml @@ -1189,6 +1189,11 @@ httpasyncclient 4.1 + + org.apache.felix + org.apache.felix.scr.ds-annotations + ${apache.felix.scr.ds.annotations.version} + @@ -1389,6 +1394,8 @@ 1.51.0 6.0.53 2.6.0.wso2v1 + 1.2.4 + @@ -1427,8 +1434,8 @@ 3.8.1 UTF-8 - 17 - 17 + 11 + 11 @@ -1453,6 +1460,11 @@ exec-maven-plugin 1.4.0 + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + @@ -1472,7 +1484,7 @@ org.apache.felix maven-bundle-plugin - 5.1.1 + 3.2.0 true NONE