updated mobile plugin for apim 420

fix
Amalka Subasinghe 2 years ago
parent 41af0d78a2
commit d5f7bbfeaa

@ -34,13 +34,11 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<configuration> <configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes> <packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>

@ -38,10 +38,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
</plugin> <configuration>
<plugin> <source>1.8</source>
<groupId>org.apache.felix</groupId> <target>1.8</target>
<artifactId>maven-scr-plugin</artifactId> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
@ -55,27 +55,44 @@
<Bundle-Description>Device Management Mobile Android Impl Bundle</Bundle-Description> <Bundle-Description>Device Management Mobile Android Impl Bundle</Bundle-Description>
<Private-Package>io.entgra.device.mgt.plugins.mobile.android.internal</Private-Package> <Private-Package>io.entgra.device.mgt.plugins.mobile.android.internal</Private-Package>
<Import-Package> <Import-Package>
org.osgi.framework.*;version="${imp.package.version.osgi.framework}", com.google.gson;version="[2.9,3)",
org.osgi.service.*;version="${imp.package.version.osgi.service}", io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)",
org.apache.commons.logging, io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)",
javax.xml, io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)",
javax.xml.stream, io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)",
javax.xml.bind.*, 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.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, org.w3c.dom,
javax.naming, org.wso2.carbon.context;version="[4.8,5)",
org.wso2.carbon.context, org.wso2.carbon.ndatasource.core;version="[4.8,5)",
org.wso2.carbon.utils.*, org.wso2.carbon.registry.api;version="[1.0,2)",
io.entgra.device.mgt.core.device.mgt.common.*, org.wso2.carbon.registry.core;version="[1.0,2)",
org.wso2.carbon.ndatasource.core, org.wso2.carbon.registry.core.service;version="[1.0,2)",
io.entgra.device.mgt.core.policy.mgt.common.*, org.wso2.carbon.registry.core.session;version="[1.0,2)",
org.wso2.carbon.registry.core, org.wso2.carbon.utils;version="[4.8,5)"
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.*
</Import-Package> </Import-Package>
<Export-Package> <Export-Package>
!io.entgra.device.mgt.plugins.mobile.android.internal, !io.entgra.device.mgt.plugins.mobile.android.internal,
@ -115,12 +132,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.osgi</groupId> <groupId>org.apache.felix</groupId>
<artifactId>org.eclipse.osgi</artifactId> <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
</dependency> <scope>provided</scope>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>

@ -25,28 +25,16 @@ import org.osgi.service.component.ComponentContext;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ndatasource.core.DataSourceService;
import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.RegistryService;
import org.osgi.service.component.annotations.*;
/** @Component(
* @scr.component name="io.entgra.device.mgt.plugins.mobile.android.internal.AndroidDeviceManagementServiceComponent" name = "io.entgra.device.mgt.plugins.mobile.android.internal.AndroidDeviceManagementServiceComponent",
* immediate="true" 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"
* <p>
* 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
*/
public class AndroidDeviceManagementServiceComponent { public class AndroidDeviceManagementServiceComponent {
private static final Log log = LogFactory.getLog(AndroidDeviceManagementServiceComponent.class); private static final Log log = LogFactory.getLog(AndroidDeviceManagementServiceComponent.class);
@Activate
protected void activate(ComponentContext ctx) { protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -64,6 +52,7 @@ public class AndroidDeviceManagementServiceComponent {
} }
} }
@Deactivate
protected void deactivate(ComponentContext ctx) { protected void deactivate(ComponentContext ctx) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("De-activating Android Mobile Device Management Service Component"); 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) { protected void setDataSourceService(DataSourceService dataSourceService) {
/* This is to avoid mobile device management component getting initialized before the underlying datasources /* This is to avoid mobile device management component getting initialized before the underlying datasources
are registered */ are registered */
@ -90,6 +85,12 @@ public class AndroidDeviceManagementServiceComponent {
//do nothing //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) { protected void setRegistryService(RegistryService registryService) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("RegistryService acquired"); log.debug("RegistryService acquired");

@ -39,22 +39,4 @@
<module>io.entgra.device.mgt.plugins.mobile.android.ui</module> <module>io.entgra.device.mgt.plugins.mobile.android.ui</module>
</modules> </modules>
<!-- <build>-->
<!-- <pluginManagement>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.felix</groupId>-->
<!-- <artifactId>maven-scr-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>generate-scr-scrdescriptor</id>-->
<!-- <goals>-->
<!-- <goal>scr</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </pluginManagement>-->
<!-- </build>-->
</project> </project>

@ -142,45 +142,6 @@
</executions> </executions>
</plugin> </plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-dependency-plugin</artifactId>-->
<!--<version>2.10</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>unpack</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>unpack</goal>-->
<!--</goals>-->
<!--<configuration>-->
<!--<artifactItems>-->
<!--<artifactItem>-->
<!--<groupId>junit</groupId>-->
<!--<artifactId>junit</artifactId>-->
<!--<type>jar</type>-->
<!--<overWrite>false</overWrite>-->
<!--<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>-->
<!--<destFileName>optional-new-name.jar</destFileName>-->
<!--<includes>**/*.class,**/*.xml</includes>-->
<!--<excludes>**/*test.class</excludes>-->
<!--</artifactItem>-->
<!--</artifactItems>-->
<!--<includes>**/*.java</includes>-->
<!--<excludes>**/*.properties</excludes>-->
<!--<outputDirectory>${project.build.directory}/wars</outputDirectory>-->
<!--<overWriteReleases>false</overWriteReleases>-->
<!--<overWriteSnapshots>true</overWriteSnapshots>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<!--<fileSet>-->
<!--<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps/uuf-template-app/</directory>-->
<!--<outputDirectory>${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/emm-web-agent</outputDirectory>-->
<!--</fileSet>-->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
@ -219,7 +180,6 @@
<plugin> <plugin>
<groupId>org.wso2.maven</groupId> <groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId> <artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions> <executions>
<execution> <execution>
<id>p2-feature-generation</id> <id>p2-feature-generation</id>
@ -245,9 +205,7 @@
</bundleDef> </bundleDef>
</bundles> </bundles>
<importFeatures> <importFeatures>
<importFeatureDef> <importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>
<importFeatureDef> <importFeatureDef>
io.entgra.device.mgt.core.device.mgt.server:${io.entgra.device.mgt.core.version} io.entgra.device.mgt.core.device.mgt.server:${io.entgra.device.mgt.core.version}
</importFeatureDef> </importFeatureDef>

@ -33,6 +33,6 @@
</outSequence> </outSequence>
</resource> </resource>
<handlers> <handlers>
<handler class="org.wso2.carbon.apimgt.handlers.AuthenticationHandler"/> <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
</handlers> </handlers>
</api> </api>

@ -77,6 +77,6 @@
</outSequence> </outSequence>
</resource> </resource>
<handlers> <handlers>
<handler class="org.wso2.carbon.apimgt.handlers.AuthenticationHandler"/> <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
</handlers> </handlers>
</api> </api>

@ -32,6 +32,6 @@
</outSequence> </outSequence>
</resource> </resource>
<handlers> <handlers>
<handler class="org.wso2.carbon.apimgt.handlers.AuthenticationHandler"/> <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
</handlers> </handlers>
</api> </api>

@ -1189,6 +1189,11 @@
<artifactId>httpasyncclient</artifactId> <artifactId>httpasyncclient</artifactId>
<version>4.1</version> <version>4.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<version>${apache.felix.scr.ds.annotations.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -1389,6 +1394,8 @@
<grpc.version>1.51.0</grpc.version> <grpc.version>1.51.0</grpc.version>
<tomcat-annotations-api>6.0.53</tomcat-annotations-api> <tomcat-annotations-api>6.0.53</tomcat-annotations-api>
<commons-lang-wso2>2.6.0.wso2v1</commons-lang-wso2> <commons-lang-wso2>2.6.0.wso2v1</commons-lang-wso2>
<apache.felix.scr.ds.annotations.version>1.2.4</apache.felix.scr.ds.annotations.version>
</properties> </properties>
<scm> <scm>
@ -1427,8 +1434,8 @@
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<source>17</source> <source>11</source>
<target>17</target> <target>11</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -1453,6 +1460,11 @@
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version> <version>1.4.0</version>
</plugin> </plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
</plugin>
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
@ -1472,7 +1484,7 @@
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version> <version>3.2.0</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<obrRepository>NONE</obrRepository> <obrRepository>NONE</obrRepository>

Loading…
Cancel
Save