Format Android plugin source

revert-dabc3590
lasanthaDLPDS 5 years ago
parent e5abe5dc91
commit e3c6bb319b

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
~
~ Entgra (pvt) Ltd. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>5.0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.addons</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Mobile Device Management Android Addons Impl</name>
<description>WSO2 Carbon - Mobile Device Management Android Addons Implementation</description>
<url>https://entgra.io/</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.devicemgt.plugins.version}</Bundle-Version>
<Bundle-Description>Device Management Mobile Android addons Impl Bundle</Bundle-Description>
<Import-Package>
com.google.gson.*
</Import-Package>
<Export-Package>
org.wso2.carbon.device.mgt.mobile.android.addons.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
</dependencies>
</project>

@ -16,9 +16,14 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.util;
package org.wso2.carbon.device.mgt.mobile.android.addons;
import javax.servlet.*;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.common;
package org.wso2.carbon.device.mgt.mobile.android.addons;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -29,7 +29,11 @@ import org.apache.cxf.message.MessageContentsList;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import javax.validation.*;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.executable.ExecutableValidator;
import java.lang.reflect.Method;
import java.util.List;

@ -49,44 +49,6 @@
<warName>api#device-mgt#android#v1.0</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
@ -99,7 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<version>1.8</version>
<executions>
<execution>
<phase>compile</phase>
@ -118,54 +80,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>client</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@ -212,32 +126,6 @@
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-httpclient.wso2</groupId>
<artifactId>commons-httpclient</artifactId>
@ -287,11 +175,7 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
@ -300,78 +184,49 @@
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.queuing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<scope>test</scope>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidenterprise</artifactId>
<version>v1-rev186-1.25.0</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>javax.cache.wso2</artifactId>
<scope>test</scope>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.addons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidenterprise</artifactId>
<version>v1-rev186-1.25.0</version>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
</dependency>
</dependencies>
</project>

@ -15,9 +15,8 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.services;
package org.wso2.carbon.device.mgt.mobile.android.api;
import com.google.api.services.androidenterprise.model.Device;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -32,22 +31,17 @@ import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.application.mgt.common.dto.ApplicationPolicyDTO;
import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig;
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePageLinks;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePageLinks;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
@ -69,10 +63,11 @@ import javax.ws.rs.core.Response;
}
),
tags = {
@Tag(name = "android,device_management", description = "")
@Tag(name = "android,device_management", description = "Android Device Management Service")
}
)
@Api(value = "Android Enterprise Service", description = "Android Enterprise Service ")
@Api(value = "Android Enterprise Service")
@Path("/enterprise")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -92,7 +87,7 @@ import javax.ws.rs.core.Response;
)
}
)
public interface AndroidEnterpriseService {
public interface AndroidEnterpriseAPI {
@POST
@Path("/user")
@ -148,8 +143,7 @@ public interface AndroidEnterpriseService {
})
Response addUser(@ApiParam(
name = "user",
value = "Enterprise user and device data.")
EnterpriseUser enterpriseUser);
value = "Enterprise user and device data.") EnterpriseUser enterpriseUser);
//######################################################################################################################
//######################################################################################################################
@ -209,8 +203,7 @@ public interface AndroidEnterpriseService {
})
Response updateUser(@ApiParam(
name = "device",
value = "Enterprise user and device data.")
EnterpriseInstallPolicy device);
value = "Enterprise user and device data.") EnterpriseInstallPolicy device);
//######################################################################################################################
//######################################################################################################################
@ -269,43 +262,38 @@ public interface AndroidEnterpriseService {
Response getStoreUrl(
@ApiParam(
name = "approveApps",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false)
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("approveApps") boolean approveApps,
@ApiParam(
name = "searchEnabled",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false)
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("searchEnabled") boolean searchEnabled,
@ApiParam(
name = "isPrivateAppsEnabled",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false) @QueryParam("isPrivateAppsEnabled") boolean isPrivateAppsEnabled,
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("isPrivateAppsEnabled") boolean isPrivateAppsEnabled,
@ApiParam(
name = "isWebAppEnabled",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false) @QueryParam("isWebAppEnabled") boolean isWebAppEnabled,
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("isWebAppEnabled") boolean isWebAppEnabled,
@ApiParam(
name = "isOrganizeAppPageVisible",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false) @QueryParam("isOrganizeAppPageVisible") boolean isOrganizeAppPageVisible,
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("isOrganizeAppPageVisible") boolean isOrganizeAppPageVisible,
@ApiParam(
name = "isManagedConfigEnabled",
value = "Boolean flag indicating whether to permanently delete the device.",
required = false) @QueryParam("isManagedConfigEnabled") boolean isManagedConfigEnabled,
value = "Boolean flag indicating whether to permanently delete the device.")
@QueryParam("isManagedConfigEnabled") boolean isManagedConfigEnabled,
@ApiParam(name = "host",
value = "Boolean flag indicating whether to permanently delete the device.",
required = true) @QueryParam("host") String host);
@GET
@Path("/products/sync")
@ApiOperation(
@ -416,8 +404,7 @@ public interface AndroidEnterpriseService {
})
Response addPage(@ApiParam(
name = "page",
value = "Enterprise page.")
EnterpriseStorePage page);
value = "Enterprise page.") EnterpriseStorePage page);
//######################################################################################################################
//######################################################################################################################
@ -777,8 +764,7 @@ public interface AndroidEnterpriseService {
})
Response addCluster(@ApiParam(
name = "storeCluster",
value = "Enterprise cluster.")
EnterpriseStoreCluster storeCluster);
value = "Enterprise cluster.") EnterpriseStoreCluster storeCluster);
//######################################################################################################################
//######################################################################################################################
@ -965,7 +951,7 @@ public interface AndroidEnterpriseService {
@ApiParam(
name = "pageId",
value = "The unique page pageId")
@PathParam("pageId") String pageId);
@PathParam("id") String pageId);
//######################################################################################################################
//######################################################################################################################
@ -1025,8 +1011,7 @@ public interface AndroidEnterpriseService {
})
Response updateLinks(@ApiParam(
name = "links",
value = "Enterprise page links.")
EnterpriseStorePageLinks links);
value = "Enterprise page links.") EnterpriseStorePageLinks links);
//######################################################################################################################
//######################################################################################################################

@ -32,16 +32,16 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.services;
package org.wso2.carbon.device.mgt.mobile.android.api;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@ -73,11 +73,10 @@ import java.util.List;
}
),
tags = {
@Tag(name = "android,device_management", description = "")
@Tag(name = "android,device_management", description = "Android Device Management Service")
}
)
@Api(value = "Android Device Management",
description = "This carries all the resources related to the Android device management functionalities.")
@Api(value = "Android Device Management")
@Path("/devices")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -97,7 +96,7 @@ import java.util.List;
)
}
)
public interface DeviceManagementService {
public interface DeviceManagementAPI {
@PUT
@Path("/{id}/applications")
@ -211,8 +210,7 @@ public interface DeviceManagementService {
Response getPendingOperations(
@ApiParam(
name = "disableGoogleApps",
value = "Specifically disable having Google apps installed.",
required = false)
value = "Specifically disable having Google apps installed.")
@QueryParam("disableGoogleApps") boolean disableGoogleApps,
@ApiParam(
name = "id",
@ -223,8 +221,7 @@ public interface DeviceManagementService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200.",
required = false)
"Example: Mon, 05 Jan 2014 15:10:00 +0200.")
@HeaderParam("If-Modified-Since") String ifModifiedSince,
@ApiParam(
name = "resultOperations",
@ -339,8 +336,7 @@ public interface DeviceManagementService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false)
"Example: Mon, 05 Jan 2014 15:10:00 +0200")
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@PUT

@ -33,7 +33,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services;
package org.wso2.carbon.device.mgt.mobile.android.api;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
@ -49,8 +49,26 @@ import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationRestrictionBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUpdateBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.BlacklistApplicationsBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.CameraBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DeviceLockBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DisplayMessageBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EncryptionBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.FileTransferBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.GlobalProxyBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.LockCodeBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.NotificationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.PasswordPolicyBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.UpgradeFirmwareBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
@ -75,11 +93,11 @@ import java.util.List;
}
),
tags = {
@Tag(name = "android,device_management", description = "")
@Tag(name = "android,device_management", description = "Android Device Management Admin Service")
}
)
@Path("/admin/devices")
@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.")
@Api(value = "Android Device Management Administrative Service")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Scopes(
@ -266,7 +284,7 @@ import java.util.List;
)
}
)
public interface DeviceManagementAdminService {
public interface DeviceManagementAdminAPI {
@POST
@Path("/file-transfer")
@ -632,8 +650,7 @@ public interface DeviceManagementAdminService {
"Disable the camera on the device by assigning true as the value or enable the " +
"camera on the device to function by defining false as the value and the ID of the Android device. " +
"Multiple device IDs can be added by using comma separated values. ",
required = true)
CameraBeanWrapper cameraBeanWrapper);
required = true) CameraBeanWrapper cameraBeanWrapper);
@POST
@Path("/info")
@ -880,8 +897,7 @@ public interface DeviceManagementAdminService {
name = "wipeData",
value = "Provide the the passcode, which is the passcode that the Android agent prompts the device owner to set at the time of device enrollment, " +
"to enable the factory reset operation, and the ID of the Android device. Multiple device IDs can be added by using comma separated values. ",
required = true)
WipeDataBeanWrapper wipeDataBeanWrapper);
required = true) WipeDataBeanWrapper wipeDataBeanWrapper);
@POST
@Path("/applications")
@ -1248,8 +1264,7 @@ public interface DeviceManagementAdminService {
value = "Properties required to install an application on Android devices. Provide the the package name, type," +
" URL and name of the application, the date and time for the scheduled installation, and the ID of the " +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper);
required = true) ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper);
@POST
@Path("/update-application")
@ -1313,8 +1328,7 @@ public interface DeviceManagementAdminService {
value = "Properties required to update an application on Android devices. Provide the the package name, type," +
"URL and name of the application, the date and time for the scheduled installation, and the ID of the" +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper);
required = true) ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper);
@POST
@Path("/uninstall-application")
@ -1375,8 +1389,7 @@ public interface DeviceManagementAdminService {
value = "Properties required to uninstall an application. Provide the the package name, type," +
"URL and name of the application, the date and time for the scheduled installation, and the ID of the" +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper);
required = true) ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper);
@POST
@Path("/blacklist-applications")
@ -1504,8 +1517,7 @@ public interface DeviceManagementAdminService {
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX format, the OTA upgrade server URL in one of the following formats " +
"(example: http//abc.com, http://abc.com/ota), " +
"and the ID of the Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper);
required = true) UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper);
@POST
@Path("/configure-vpn")
@ -1565,8 +1577,7 @@ public interface DeviceManagementAdminService {
@ApiParam(
name = "vpnBean",
value = "VPN configuration and DeviceIds",
required = true)
VpnBeanWrapper vpnBeanWrapper);
required = true) VpnBeanWrapper vpnBeanWrapper);
@POST
@Path("/send-notification")
@ -1626,8 +1637,7 @@ public interface DeviceManagementAdminService {
name = "notification",
value = "The properties required to send a notification. Provide the message you wish to send and the ID of the " +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
NotificationBeanWrapper notificationBeanWrapper);
required = true) NotificationBeanWrapper notificationBeanWrapper);
@POST
@Path("/configure-wifi")
@ -1688,8 +1698,7 @@ public interface DeviceManagementAdminService {
value = "The properties required to configure Wi-Fi. Provide the password to connect to the specified Wi-Fi network," +
"the ssid or the name of the Wi-Fi network that you wish to configure and the ID of the Android device." +
" Multiple device IDs can be added by using comma separated values.",
required = true)
WifiBeanWrapper wifiBeanWrapper);
required = true) WifiBeanWrapper wifiBeanWrapper);
@POST
@Path("/encrypt-storage")
@ -1750,8 +1759,7 @@ public interface DeviceManagementAdminService {
value = "Properties required to encrypt the storage. Encrypt the storage on the device by assigning " +
"true as the value or do not encrypt the storage on the device by assigning false as the value and " +
"provide the ID of the Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
EncryptionBeanWrapper encryptionBeanWrapper);
required = true) EncryptionBeanWrapper encryptionBeanWrapper);
@POST
@Path("/change-lock-code")
@ -1812,8 +1820,7 @@ public interface DeviceManagementAdminService {
value = "The properties to change th lock code. Provide the lock code that will replace the current lock code on Android devices and " +
"the ID of the Android device. Multiple device IDs can be added by using comma separated values. " +
"If a passcode policy has been set in EMM, the lock code should comply to the passcode policy.\t",
required = true)
LockCodeBeanWrapper lockCodeBeanWrapper);
required = true) LockCodeBeanWrapper lockCodeBeanWrapper);
@POST
@Path("/set-password-policy")
@ -1872,8 +1879,7 @@ public interface DeviceManagementAdminService {
@ApiParam(
name = "passwordPolicy",
value = "The properties required to set a password policy.",
required = true)
PasswordPolicyBeanWrapper passwordPolicyBeanWrapper);
required = true) PasswordPolicyBeanWrapper passwordPolicyBeanWrapper);
@POST
@Path("/set-webclip")
@ -1932,8 +1938,7 @@ public interface DeviceManagementAdminService {
@ApiParam(
name = "webClip",
value = "The properties to set the web clip.",
required = true)
WebClipBeanWrapper webClipBeanWrapper);
required = true) WebClipBeanWrapper webClipBeanWrapper);
@POST
@Path("/send-app-conf")
@ApiOperation(
@ -1994,8 +1999,7 @@ public interface DeviceManagementAdminService {
value = "The properties required to send application restrictions. Provide the restriction you " +
"wish to send and the ID of the Android device. Multiple device IDs can be added by using" +
" comma separated values.",
required = true)
ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper);
required = true) ApplicationRestrictionBeanWrapper applicationRestrictionBeanWrapper);
@POST
@Path("/configure-global-proxy")
@ -2056,8 +2060,7 @@ public interface DeviceManagementAdminService {
@ApiParam(
name = "globalProxyInfo",
value = "The properties to set the global proxy settings.",
required = true)
GlobalProxyBeanWrapper globalProxyBeanWrapper);
required = true) GlobalProxyBeanWrapper globalProxyBeanWrapper);
@POST
@Path("/configure-display-message")
@ -2107,6 +2110,5 @@ public interface DeviceManagementAdminService {
name = "display-message",
value = "The properties required to send a messages. Provide the message you wish to send and the ID of the " +
"Android device. Multiple device IDs can be added by using comma separated values.",
required = true)
DisplayMessageBeanWrapper displayMessageBeanWrapper);
required = true) DisplayMessageBeanWrapper displayMessageBeanWrapper);
}

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services;
package org.wso2.carbon.device.mgt.mobile.android.api;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
@ -32,9 +32,9 @@ import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException;
import javax.validation.Valid;
import javax.ws.rs.*;
@ -55,10 +55,10 @@ import javax.ws.rs.core.Response;
}
),
tags = {
@Tag(name = "android,device_management", description = "")
@Tag(name = "android,device_management", description = "Device Type Configuration Service")
}
)
@Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.")
@Api(value = "Android Configuration Management")
@Path("/configuration")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -84,7 +84,7 @@ import javax.ws.rs.core.Response;
)
}
)
public interface DeviceTypeConfigurationService {
public interface DeviceTypeConfigurationAPI {
@GET
@ApiOperation(
@ -136,8 +136,7 @@ public interface DeviceTypeConfigurationService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false)
"Example: Mon, 05 Jan 2014 15:10:00 +0200")
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@PUT
@ -245,8 +244,7 @@ public interface DeviceTypeConfigurationService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200.",
required = false)
"Example: Mon, 05 Jan 2014 15:10:00 +0200.")
@HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException;
}

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services;
package org.wso2.carbon.device.mgt.mobile.android.api;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
@ -31,9 +31,9 @@ import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWrapper;
import javax.validation.Valid;
import javax.validation.constraints.Size;
@ -53,12 +53,10 @@ import javax.ws.rs.core.Response;
}
),
tags = {
@Tag(name = "android,device_management", description = "")
@Tag(name = "android,device_management", description = "Android Even Receiver Service")
}
)
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" +
" configure WSO2 EMM as explained in https://docs.wso2.com/display/EMM220/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " +
"https://docs.wso2.com/display/EMM220/Creating+a+New+Event+Stream+and+Receiver")
@Api(value = "Event Receiver")
@Path("/events")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -72,7 +70,7 @@ import javax.ws.rs.core.Response;
)
}
)
public interface EventReceiverService {
public interface EventReceiverAPI {
@POST
@Path("/publish")
@ -131,8 +129,7 @@ public interface EventReceiverService {
@ApiParam(
name = "eventBeanWrapper",
value = "Information of the agent event to be published on DAS.")
@Valid
EventBeanWrapper eventBeanWrapper);
@Valid EventBeanWrapper eventBeanWrapper);
@GET
@ApiOperation(
@ -207,8 +204,7 @@ public interface EventReceiverService {
name = "If-Modified-Since",
value = "Checks if the requested variant was modified, since the specified date-time.\n" +
"Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" +
"Example: Mon, 05 Jan 2014 15:10:00 +0200",
required = false)
"Example: Mon, 05 Jan 2014 15:10:00 +0200")
@HeaderParam("If-Modified-Since") String ifModifiedSince);
}

@ -16,12 +16,17 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.exception;
package org.wso2.carbon.device.mgt.mobile.android.api.exception;
import com.google.gson.JsonParseException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.dto.ErrorDTO;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.ForbiddenException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import javax.naming.AuthenticationException;
import javax.validation.ConstraintViolationException;

@ -16,10 +16,10 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.exception;
package org.wso2.carbon.device.mgt.mobile.android.api.exception;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import javax.validation.ConstraintViolation;
import javax.ws.rs.WebApplicationException;

@ -16,9 +16,8 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services.impl;
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
import com.google.api.services.androidenterprise.model.AppRestrictionsSchema;
import com.google.api.services.androidenterprise.model.ProductsListResponse;
import com.google.api.services.androidenterprise.model.StoreCluster;
import com.google.api.services.androidenterprise.model.StoreLayout;
@ -33,29 +32,29 @@ import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManage
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException;
import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseManagedConfig;
import org.wso2.carbon.device.mgt.mobile.android.impl.dto.AndroidEnterpriseUser;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseConfigs;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePackages;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePageLinks;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseTokenUrl;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.GoogleAppSyncResponse;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseApp;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseInstallPolicy;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.mdm.services.android.bean.wrapper.TokenWrapper;
import org.wso2.carbon.mdm.services.android.common.GoogleAPIInvoker;
import org.wso2.carbon.mdm.services.android.exception.BadRequestException;
import org.wso2.carbon.mdm.services.android.exception.NotFoundException;
import org.wso2.carbon.mdm.services.android.services.AndroidEnterpriseService;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidEnterpriseUtils;
import org.wso2.carbon.device.mgt.mobile.android.api.AndroidEnterpriseAPI;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.GoogleAPIInvoker;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseConfigs;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePackages;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePageLinks;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.GoogleAppSyncResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseApp;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseInstallPolicy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.TokenWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseManagedConfig;
import org.wso2.carbon.device.mgt.mobile.android.common.dto.AndroidEnterpriseUser;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidEnterpriseUtils;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
import javax.ws.rs.Consumes;
@ -76,8 +75,8 @@ import java.util.List;
@Path("/enterprise")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class AndroidEnterpriseServiceImpl implements AndroidEnterpriseService {
private static final Log log = LogFactory.getLog(AndroidEnterpriseServiceImpl.class);
public class AndroidEnterpriseAPIImpl implements AndroidEnterpriseAPI {
private static final Log log = LogFactory.getLog(AndroidEnterpriseAPIImpl.class);
@Override
@Produces(MediaType.APPLICATION_JSON)
@ -784,9 +783,7 @@ public class AndroidEnterpriseServiceImpl implements AndroidEnterpriseService {
log.error(errorMessage);
throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(Response.Status.INTERNAL_SERVER_ERROR
.getStatusCode()).setMessage(errorMessage).build());
}
.getStatusCode()).setMessage(errorMessage).build()); }
}
if (sentToDevice) {

@ -32,7 +32,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.services.impl;
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@ -54,17 +54,19 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceExce
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException;
import org.wso2.carbon.mdm.services.android.services.DeviceManagementService;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.mdm.services.android.util.Message;
import org.wso2.carbon.device.mgt.mobile.android.api.DeviceManagementAPI;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.Message;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidApplication;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.AndroidDevice;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EnterpriseUser;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -90,10 +92,10 @@ import java.util.List;
@Path("/devices")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceManagementServiceImpl implements DeviceManagementService {
public class DeviceManagementAPIImpl implements DeviceManagementAPI {
private static final String OPERATION_ERROR_STATUS = "ERROR";
private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class);
private static final Log log = LogFactory.getLog(DeviceManagementAPIImpl.class);
public static final String GOOGLE_AFW_EMM_ANDROID_ID = "googleEMMAndroidId";
public static final String GOOGLE_AFW_DEVICE_ID = "googleEMMDeviceId";
@ -233,7 +235,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
if (androidDevice == null) {
String errorMessage = "The payload of the android device enrollment is incorrect.";
log.error(errorMessage);
throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException(
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
try {
@ -264,7 +266,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
EnterpriseUser user = new EnterpriseUser();
user.setAndroidPlayDeviceId(googleEMMAndroidId);
user.setEmmDeviceIdentifier(googleEMMDeviceId);
AndroidEnterpriseServiceImpl enterpriseService = new AndroidEnterpriseServiceImpl();
AndroidEnterpriseAPIImpl enterpriseService = new AndroidEnterpriseAPIImpl();
token = enterpriseService.insertUser(user);
}
}
@ -427,13 +429,13 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
if (androidDevice == null) {
String errorMessage = "The payload of the android device enrollment is incorrect.";
log.error(errorMessage);
throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException(
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
if (device == null) {
String errorMessage = "The device to be modified doesn't exist.";
log.error(errorMessage);
throw new org.wso2.carbon.mdm.services.android.exception.NotFoundException(
throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build());
}
if(androidDevice.getEnrolmentInfo() != null){

@ -33,7 +33,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services.impl;
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -45,51 +45,51 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation;
import org.wso2.carbon.mdm.services.android.bean.ApplicationRestriction;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate;
import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications;
import org.wso2.carbon.mdm.services.android.bean.Camera;
import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption;
import org.wso2.carbon.mdm.services.android.bean.DeviceLock;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.FileTransfer;
import org.wso2.carbon.mdm.services.android.bean.GlobalProxy;
import org.wso2.carbon.mdm.services.android.bean.LockCode;
import org.wso2.carbon.mdm.services.android.bean.DisplayMessage;
import org.wso2.carbon.mdm.services.android.bean.Notification;
import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy;
import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware;
import org.wso2.carbon.mdm.services.android.bean.Vpn;
import org.wso2.carbon.mdm.services.android.bean.WebClip;
import org.wso2.carbon.mdm.services.android.bean.Wifi;
import org.wso2.carbon.mdm.services.android.bean.WipeData;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationInstallationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationRestrictionBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUninstallationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUpdateBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.BlacklistApplicationsBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.CameraBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.DeviceLockBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.FileTransferBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.GlobalProxyBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.DisplayMessageBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.VpnBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WebClipBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WifiBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WipeDataBeanWrapper;
import org.wso2.carbon.mdm.services.android.exception.BadRequestException;
import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException;
import org.wso2.carbon.mdm.services.android.services.DeviceManagementAdminService;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.device.mgt.mobile.android.api.DeviceManagementAdminAPI;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationRestriction;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DisplayMessage;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.FileTransfer;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.GlobalProxy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationInstallationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationRestrictionBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUninstallationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.ApplicationUpdateBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.BlacklistApplicationsBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.CameraBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DeviceLockBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.DisplayMessageBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EncryptionBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.FileTransferBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.GlobalProxyBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.LockCodeBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.NotificationBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.PasswordPolicyBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.UpgradeFirmwareBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
@ -110,9 +110,9 @@ import java.util.List;
@Path("/admin/devices")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService {
public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
private static final Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class);
private static final Log log = LogFactory.getLog(DeviceManagementAdminAPIImpl.class);
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
@POST
@ -140,7 +140,8 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setType(Operation.Type.PROFILE);
operation.setEnabled(true);
operation.setPayLoad(file.toJSON());
Activity activity = AndroidDeviceUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation);
Activity activity = AndroidDeviceUtils
.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation);
return Response.status(Response.Status.CREATED).entity(activity).build();
} catch (InvalidDeviceException e) {
String errorMessage = "Invalid Device Identifiers ( " + fileTransferBeanWrapper.getDeviceIDs() + " ) found.";

@ -0,0 +1,130 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
import com.google.api.client.http.HttpStatusCodes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.android.api.DeviceTypeConfigurationAPI;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/configuration")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceTypeConfigurationAPIImpl implements DeviceTypeConfigurationAPI {
private static final Log log = LogFactory.getLog(DeviceTypeConfigurationAPIImpl.class);
@GET
@Override
public Response getConfiguration(
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
try {
AndroidService androidService = AndroidAPIUtils.getAndroidnService();
PlatformConfiguration platformConfiguration = androidService.getPlatformConfig();
return Response.status(Response.Status.OK).entity(platformConfiguration).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the Android tenant configuration";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(msg).build());
}
}
@PUT
@Override
public Response updateConfiguration(
@Valid AndroidPlatformConfiguration androidPlatformConfiguration) {
try {
AndroidService androidService = AndroidAPIUtils.getAndroidnService();
androidService.updateConfiguration(androidPlatformConfiguration);
return Response.status(Response.Status.OK)
.entity("Android platform configuration has been updated successfully.").build();
} catch (BadRequestExceptionDup e) {
String msg = "The payload of the android platform configuration is incorrect.";
log.error(msg, e);
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
.setMessage(msg).build());
} catch (AndroidDeviceMgtPluginException e) {
String msg = "Error occurred while modifying configuration settings of Android platform";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(msg).build());
}
}
@GET
@Path("/license")
@Produces(MediaType.TEXT_PLAIN)
public Response getLicense(
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
try {
License license = AndroidAPIUtils.getDeviceManagementService()
.getLicense(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
return Response.status(Response.Status.OK).entity((license == null) ? null : license.getText()).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Android device enrolment";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
.setMessage(msg).build());
}
}
}

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.services.impl;
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@ -29,17 +29,17 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
import org.wso2.carbon.mdm.services.android.exception.BadRequestException;
import org.wso2.carbon.mdm.services.android.exception.NotFoundException;
import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException;
import org.wso2.carbon.mdm.services.android.services.EventReceiverService;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
import org.wso2.carbon.mdm.services.android.util.Message;
import org.wso2.carbon.device.mgt.mobile.android.api.EventReceiverAPI;
import org.wso2.carbon.device.mgt.mobile.android.common.AndroidConstants;
import org.wso2.carbon.device.mgt.mobile.android.common.Message;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceState;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ErrorResponse;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.EventBeanWrapper;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.NotFoundException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidDeviceUtils;
import javax.validation.Valid;
import javax.validation.constraints.Size;
@ -52,9 +52,9 @@ import javax.ws.rs.core.Response;
import java.util.List;
@Path("/events")
public class EventReceiverServiceImpl implements EventReceiverService {
public class EventReceiverAPIImpl implements EventReceiverAPI {
private static final String EVENT_STREAM_DEFINITION = "org.wso2.iot.LocationStream";
private static final Log log = LogFactory.getLog(EventReceiverServiceImpl.class);
private static final Log log = LogFactory.getLog(EventReceiverAPIImpl.class);
private Gson gson = new Gson();
private static final String LONGITUDE = "longitude";

@ -1,238 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.ServerConfiguration;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.NotifierFrequency;
import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException;
import org.wso2.carbon.mdm.services.android.services.DeviceTypeConfigurationService;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
@Path("/configuration")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurationService {
private static final Log log = LogFactory.getLog(DeviceTypeConfigurationServiceImpl.class);
@GET
@Override
public Response getConfiguration(
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
String msg;
PlatformConfiguration platformConfiguration;
List<ConfigurationEntry> configs;
try {
platformConfiguration = AndroidAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
if (platformConfiguration != null) {
configs = platformConfiguration.getConfiguration();
} else {
platformConfiguration = new PlatformConfiguration();
configs = new ArrayList<>();
}
ConfigurationEntry entry = new ConfigurationEntry();
License license = AndroidAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, AndroidConstants.
TenantConfigProperties.LANGUAGE_US);
if (configs != null) {
ConfigurationEntry versionEntry = new ConfigurationEntry();
versionEntry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT);
versionEntry.setName(AndroidConstants.TenantConfigProperties.SERVER_VERSION);
versionEntry.setValue(ServerConfiguration.getInstance().getFirstProperty("Version"));
configs.add(versionEntry);
if (license != null) {
entry.setContentType(AndroidConstants.TenantConfigProperties.CONTENT_TYPE_TEXT);
entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY);
entry.setValue(license.getText());
configs.add(entry);
}
platformConfiguration.setConfiguration(configs);
}
} catch (DeviceManagementException e) {
msg = "Error occurred while retrieving the Android tenant configuration";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
return Response.status(Response.Status.OK).entity(platformConfiguration).build();
}
@PUT
@Override
public Response updateConfiguration(@Valid AndroidPlatformConfiguration androidPlatformConfiguration) {
String msg;
ConfigurationEntry licenseEntry = null;
PlatformConfiguration configuration = new PlatformConfiguration();
if (androidPlatformConfiguration == null) {
String errorMessage = "The payload of the android platform configuration is incorrect.";
log.error(errorMessage);
throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
}
configuration.setConfiguration(androidPlatformConfiguration.getConfiguration());
try {
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
List<ConfigurationEntry> configs = configuration.getConfiguration();
NotifierFrequency notifierFrequency = new NotifierFrequency();
for (ConfigurationEntry entry : configs) {
if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) {
License license = new License();
license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
license.setLanguage(AndroidConstants.TenantConfigProperties.LANGUAGE_US);
license.setVersion("1.0.0");
license.setText(entry.getValue().toString());
AndroidAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license);
licenseEntry = entry;
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals(entry.getName())) {
if (entry.getValue() != null) {
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
} else {
return Response.status(Response.Status.BAD_REQUEST)
.entity("No value specified for notifierFrequency.").build();
}
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) {
if (entry.getValue() != null) {
notifierFrequency.setType(Integer.parseInt(entry.getValue().toString()));
} else {
return Response.status(Response.Status.BAD_REQUEST)
.entity("No value specified for notifierType.").build();
}
}
}
if (licenseEntry != null) {
configs.remove(licenseEntry);
}
configuration.setConfiguration(configs);
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
notifyDevices(notifierFrequency);
} catch (DeviceManagementException e) {
msg = "Error occurred while modifying configuration settings of Android platform";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
} catch (NumberFormatException e) {
msg = "Error occurred while reading notification frequency.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
} catch (OperationManagementException e) {
msg = "Error occurred while modifying configuration settings of Android platform.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
} catch (InvalidDeviceException e) {
msg = "Error occurred with the device.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
return Response.status(Response.Status.OK)
.entity("Android platform configuration has been updated successfully.").build();
}
private void notifyDevices(NotifierFrequency notifierFrequency) throws DeviceManagementException,
OperationManagementException, InvalidDeviceException {
List<Device> deviceList = AndroidAPIUtils.
getDeviceManagementService().
getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false);
List<DeviceIdentifier> deviceIdList = new ArrayList<>();
for (Device device : deviceList) {
if (EnrolmentInfo.Status.REMOVED != device.getEnrolmentInfo().getStatus()) {
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
}
}
if (!deviceIdList.isEmpty()) {
ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY);
operation.setPayLoad(notifierFrequency.toJSON());
operation.setEnabled(true);
AndroidAPIUtils.getDeviceManagementService().addOperation(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
operation, deviceIdList);
}
}
@GET
@Path("/license")
@Produces(MediaType.TEXT_PLAIN)
public Response getLicense(
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
License license;
try {
license =
AndroidAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Android device enrolment";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
return Response.status(Response.Status.OK).entity((license == null) ? null : license.getText()).build();
}
}

@ -1,48 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.util;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import java.util.List;
/**
* Holder class for storing valid & invalid device-ids.
*/
public class DeviceIDHolder {
private List<String> errorDeviceIdList;
private List<DeviceIdentifier> validDeviceIDList;
public List<String> getErrorDeviceIdList() {
return errorDeviceIdList;
}
public void setErrorDeviceIdList(List<String> errorDeviceIdList) {
this.errorDeviceIdList = errorDeviceIdList;
}
public List<DeviceIdentifier> getValidDeviceIDList() {
return validDeviceIDList;
}
public void setValidDeviceIDList(List<DeviceIdentifier> validDeviceIDList) {
this.validDeviceIDList = validDeviceIDList;
}
}

@ -44,8 +44,8 @@
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers" />
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource" />
<bean id="GlobalExceptionMapper" class="org.wso2.carbon.mdm.services.android.exception.GlobalThrowableMapper"/>
<bean id="ValidationInterceptor" class="org.wso2.carbon.mdm.services.android.common.ValidationInterceptor"/>
<bean id="GlobalExceptionMapper" class="org.wso2.carbon.device.mgt.mobile.android.api.exception.GlobalThrowableMapper"/>
<bean id="ValidationInterceptor" class="org.wso2.carbon.device.mgt.mobile.android.common.ValidationInterceptor"/>
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="resourcePackage" value="org.wso2.carbon.mdm.services.android.services"/>
@ -60,13 +60,13 @@
<property name="scan" value="true"/>
</bean>
<bean id="deviceManagementService" class="org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementServiceImpl"/>
<bean id="deviceManagementAdminService" class="org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementAdminServiceImpl"/>
<bean id="eventReceiverService" class="org.wso2.carbon.mdm.services.android.services.impl.EventReceiverServiceImpl"/>
<bean id="deviceTypeConfigurationService" class="org.wso2.carbon.mdm.services.android.services.impl.DeviceTypeConfigurationServiceImpl"/>
<bean id="androidEnterprise" class="org.wso2.carbon.mdm.services.android.services.impl.AndroidEnterpriseServiceImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.mdm.services.android.common.GsonMessageBodyHandler"/>
<bean id="errorHandler" class="org.wso2.carbon.mdm.services.android.common.ErrorHandler"/>
<bean id="deviceManagementService" class="org.wso2.carbon.mdm.services.android.impl.DeviceManagementServiceImpl"/>
<bean id="deviceManagementAdminService" class="org.wso2.carbon.mdm.services.android.impl.DeviceManagementAdminServiceImpl"/>
<bean id="eventReceiverService" class="org.wso2.carbon.mdm.services.android.impl.EventReceiverServiceImpl"/>
<bean id="deviceTypeConfigurationService" class="org.wso2.carbon.mdm.services.android.impl.DeviceTypeConfigurationServiceImpl"/>
<bean id="androidEnterprise" class="org.wso2.carbon.mdm.services.android.impl.AndroidEnterpriseServiceImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.mobile.android.common.GsonMessageBodyHandler"/>
<bean id="errorHandler" class="org.wso2.carbon.device.mgt.mobile.android.common.ErrorHandler"/>
<cxf:bus>
<cxf:inInterceptors>
<ref bean="ValidationInterceptor"/>

@ -76,7 +76,7 @@
<filter>
<filter-name>ApiOriginFilter</filter-name>
<filter-class>org.wso2.carbon.mdm.services.android.util.ApiOriginFilter</filter-class>
<filter-class>org.wso2.carbon.device.mgt.mobile.android.addons.ApiOriginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ApiOriginFilter</filter-name>

@ -1,312 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android;
import org.mockito.MockitoAnnotations;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockObjectFactory;
import org.testng.Assert;
import org.testng.IObjectFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.mdm.services.android.mocks.DeviceManagementProviderServiceMock;
import org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementAdminServiceImpl;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.utils.TestUtils;
import javax.ws.rs.core.Response;
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
@PrepareForTest(AndroidAPIUtils.class)
public class DeviceManagementAdminServiceTests {
private DeviceManagementAdminServiceImpl deviceManagementAdminService;
@ObjectFactory
public IObjectFactory getObjectFactory() {
return new PowerMockObjectFactory();
}
@BeforeClass
public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
MockitoAnnotations.initMocks(this);
deviceManagementAdminService = new DeviceManagementAdminServiceImpl();
}
private void mockDeviceManagementService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService"))
.toReturn(new DeviceManagementProviderServiceMock());
}
@Test
public void testConfigureDeviceLock()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureDeviceUnlock()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.configureDeviceUnlock(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceLocation()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.getDeviceLocation(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRemovePassword()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.removePassword(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureCamera()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.configureCamera(TestUtils.getCamerabeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceInformation()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.getDeviceInformation(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceLogcat()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.getDeviceLogcat(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testWipeDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.wipeDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testWipeData()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.wipeData(TestUtils.getWipeDataBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetApplications()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.getApplications(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRingDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.ringDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRebootDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.rebootDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testChangeLockTask()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.changeLockTask(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testMuteDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.muteDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testInstallApplication()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService
.installApplication(TestUtils.getApplicationInstallationBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUpdateApplication()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUninstallApplicationPublic()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService
.uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUninstallApplicationWebApp()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService
.uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testBlacklistApplications()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService
.blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUpgradeFirmware()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureVPN()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.configureVPN(TestUtils.getVpnBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSendNotification()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.sendNotification(TestUtils.getNotificationBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureWifi()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.configureWifi(TestUtils.getWifiBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testEncryptStorage()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.encryptStorage(TestUtils.getEncryptionBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testChangeLockCode()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.changeLockCode(TestUtils.getLockCodeBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSetPasswordPolicy()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSetWebClip()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementAdminService.setWebClip(TestUtils.getWebClipBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
}

@ -1,334 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android;
import org.mockito.MockitoAnnotations;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockObjectFactory;
import org.testng.Assert;
import org.testng.IObjectFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
import org.wso2.carbon.mdm.services.android.mocks.ApplicationManagementProviderServiceMock;
import org.wso2.carbon.mdm.services.android.mocks.DeviceInformationManagerServiceMock;
import org.wso2.carbon.mdm.services.android.mocks.DeviceManagementProviderServiceMock;
import org.wso2.carbon.mdm.services.android.mocks.NotificationManagementServiceMock;
import org.wso2.carbon.mdm.services.android.mocks.PolicyManagerServiceMock;
import org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementServiceImpl;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.utils.TestUtils;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
@PrepareForTest(AndroidAPIUtils.class)
public class DeviceManagementServiceTests {
private DeviceManagementServiceImpl deviceManagementService;
@ObjectFactory
public IObjectFactory getObjectFactory() {
return new PowerMockObjectFactory();
}
@BeforeClass
public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
MockitoAnnotations.initMocks(this);
deviceManagementService = new DeviceManagementServiceImpl();
}
private void mockDeviceManagementService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceManagementService"))
.toReturn(new DeviceManagementProviderServiceMock());
}
private void mockApplicationManagerService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getApplicationManagerService"))
.toReturn(new ApplicationManagementProviderServiceMock());
}
private void mockPolicyManagerService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getPolicyManagerService"))
.toReturn(new PolicyManagerServiceMock());
}
private void mockDeviceInformationManagerService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getDeviceInformationManagerService"))
.toReturn(new DeviceInformationManagerServiceMock());
}
private void mockNotificationManagementService()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getNotificationManagementService"))
.toReturn(new NotificationManagementServiceMock());
}
private void mockUser()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
PowerMockito.stub(PowerMockito.method(AndroidAPIUtils.class, "getAuthenticatedUser"))
.toReturn("admin");
}
@Test
public void testUpdateApplicationList()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockApplicationManagerService();
Response response = deviceManagementService
.updateApplicationList(TestUtils.getDeviceId(), TestUtils.getAndroidApplications());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
}
@Test
public void testGetPendingOperationsForNullDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Response response = deviceManagementService
.getPendingOperations(true, null, null, null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
}
@Test
public void testGetPendingOperationsInvalidDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService
.getPendingOperations(true, "1234", null, null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
}
@Test
public void testGetPendingOperationsNullResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null, null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetPendingOperationsWithMonitorResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockPolicyManagerService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null,
TestUtils.getSuccessMonitorOperationResponse());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetPendingOperationsWithApplicationResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockApplicationManagerService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null,
TestUtils.getSuccessApplicationOperationResponse());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetPendingOperationsWithDeviceInfoResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockDeviceInformationManagerService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null,
TestUtils.getSuccessInfoOperationResponse());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetPendingOperationsWithInProgressResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null,
TestUtils.getInProgressOperationResponse());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetPendingOperationsWithErrorResponse()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockNotificationManagementService();
Response response = deviceManagementService
.getPendingOperations(true, TestUtils.getDeviceId(), null,
TestUtils.getErrorOperationResponse());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testEnrollDeviceWithoutLocationSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockPolicyManagerService();
mockUser();
Response response = deviceManagementService.enrollDevice(TestUtils.getBasicAndroidDevice());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
}
@Test
public void testEnrollDeviceWithLocationSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockDeviceInformationManagerService();
mockPolicyManagerService();
mockUser();
AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice();
List<Device.Property> properties = new ArrayList<>();
Device.Property property = new Device.Property();
property.setName("LATITUDE");
property.setValue("79.5");
properties.add(property);
property = new Device.Property();
property.setName("LONGITUDE");
property.setValue("6.9");
properties.add(property);
property = new Device.Property();
property.setName("ALTITUDE");
property.setValue("-59.8373726");
properties.add(property);
property = new Device.Property();
property.setName("SPEED");
property.setValue("0.5123423333");
properties.add(property);
property = new Device.Property();
property.setName("BEARING");
property.setValue("44.0");
properties.add(property);
property = new Device.Property();
property.setName("DISTANCE");
property.setValue("44.0");
properties.add(property);
androidDevice.setProperties(properties);
Response response = deviceManagementService.enrollDevice(androidDevice);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
}
@Test
public void testEnrollDeviceUnSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockUser();
AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice();
androidDevice.setDeviceIdentifier("1234");
Response response = deviceManagementService.enrollDevice(androidDevice);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
@Test
public void testIsEnrolledExists()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService.isEnrolled(TestUtils.getDeviceId(), null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
}
@Test
public void testIsEnrolledNonExist()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService.isEnrolled("1234", null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
}
@Test
public void testIsEnrolledNull()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService.isEnrolled(null, null);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
}
@Test
public void testModifyEnrollmentSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockUser();
Response response = deviceManagementService
.modifyEnrollment(TestUtils.getDeviceId(), TestUtils.getBasicAndroidDevice());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
}
@Test
public void testModifyEnrollmentUnSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
mockUser();
AndroidDevice androidDevice = TestUtils.getBasicAndroidDevice();
androidDevice.setDeviceIdentifier("1234");
Response response = deviceManagementService
.modifyEnrollment(TestUtils.getDeviceId(), androidDevice);
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_MODIFIED.getStatusCode());
}
@Test
public void testDisEnrollDeviceSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode());
}
@Test
public void testDisenrollUnSuccess()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockDeviceManagementService();
Response response = deviceManagementService.disEnrollDevice("1234");
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode());
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
~
~ Entgra (pvt) Ltd. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>android-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>5.0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.mobile.android.common</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Mobile Device Management Android Common Impl</name>
<description>WSO2 Carbon - Mobile Device Management Android Common Implementation</description>
<url>https://entgra.io/</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.devicemgt.plugins.version}</Bundle-Version>
<Bundle-Description>Device Management Mobile Android Impl Bundle</Bundle-Description>
<Import-Package>
io.swagger.annotations.*;resolution:=optional,
javax.validation.constraints,
javax.xml.bind.annotation.*,
javax.xml,
javax.xml.stream,
javax.xml.bind.*,
javax.xml.parsers; version=0.0.0,
javax.naming,
org.wso2.carbon.context,
org.wso2.carbon.utils.*,
org.wso2.carbon.device.mgt.common.*,
org.wso2.carbon.ndatasource.core,
org.wso2.carbon.policy.mgt.common.*,
org.wso2.carbon.device.mgt.extensions.license.mgt.registry,
com.google.gson.*
</Import-Package>
<Export-Package>
org.wso2.carbon.device.mgt.mobile.android.common.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-androidenterprise</artifactId>
<version>v1-rev186-1.25.0</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
</dependencies>
</project>

@ -15,9 +15,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.common;
package org.wso2.carbon.device.mgt.mobile.android.common;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidAgentException;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.common;
package org.wso2.carbon.device.mgt.mobile.android.common;
public class ErrorMessage {

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.common;
package org.wso2.carbon.device.mgt.mobile.android.common;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
@ -49,11 +49,11 @@ import com.google.api.services.androidenterprise.model.User;
import com.google.common.collect.ImmutableList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.android.impl.EnterpriseServiceException;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStoreCluster;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePackages;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseStorePage;
import org.wso2.carbon.mdm.services.android.bean.EnterpriseTokenUrl;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStoreCluster;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePackages;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseStorePage;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.EnterpriseTokenUrl;
import org.wso2.carbon.device.mgt.mobile.android.common.exception.EnterpriseServiceException;
import java.io.ByteArrayInputStream;
import java.io.IOException;

@ -16,9 +16,8 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.util;
package org.wso2.carbon.device.mgt.mobile.android.common;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@ -16,12 +16,11 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,11 +16,11 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.io.Serializable;
@ApiModel(value = "Disenrollment",

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;

@ -16,7 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;

@ -15,11 +15,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.AndroidOperation;
import java.io.Serializable;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean;
package org.wso2.carbon.device.mgt.mobile.android.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.Device;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.AppRestriction;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.AppRestriction;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationInstallation;
import java.util.List;

@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.ApplicationRestriction;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationRestriction;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUninstallation;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.ApplicationUpdate;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.BlacklistApplications;
import javax.validation.Valid;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.Camera;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Camera;
import java.util.List;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -16,11 +16,11 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.DeviceLock;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceLock;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.Disenrollment;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Disenrollment;
import java.util.List;

@ -16,11 +16,11 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.DisplayMessage;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DisplayMessage;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.DeviceEncryption;
import java.util.List;

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.FileTransfer;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.FileTransfer;
import java.util.List;

@ -17,11 +17,11 @@
*
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.GlobalProxy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.GlobalProxy;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.LockCode;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.LockCode;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.Notification;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Notification;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.PasscodePolicy;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.UpgradeFirmware;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.Vpn;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Vpn;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.WebClip;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.WebClip;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.Wifi;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.Wifi;
import java.util.List;

@ -15,11 +15,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.services.android.bean.wrapper;
package org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.mdm.services.android.bean.WipeData;
import org.wso2.carbon.device.mgt.mobile.android.common.bean.WipeData;
import java.util.List;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save