Merge branch 'rest-api-improvements' of https://github.com/wso2/carbon-device-mgt-plugins into rest-api-improvements

revert-dabc3590
inoshperera 9 years ago
commit f346c7c528

@ -72,7 +72,7 @@
<tasks> <tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true"> <copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target"> <fileset dir="${basedir}/target">
<include name="${project.artifactId}.war" /> <include name="api#device-mgt#android#v2.1.war" />
</fileset> </fileset>
</copy> </copy>
</tasks> </tasks>
@ -168,12 +168,6 @@
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
@ -188,5 +182,28 @@
<artifactId>org.wso2.carbon.analytics.api</artifactId> <artifactId>org.wso2.carbon.analytics.api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -28,6 +28,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@Api(value = "Android Device Management API",
description = "This carries all the resources related to Android device management functionalities")
@Path("/devices") @Path("/devices")
@Api(value = "DeviceManagement", description = "Device management related APIs that is used by mainly by the Android " + @Api(value = "DeviceManagement", description = "Device management related APIs that is used by mainly by the Android " +
"agent.") "agent.")
@ -40,15 +42,18 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating an ApplicationList", value = "Update the application list of a device"
notes = "Update application list in server side."
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 202, message = "Device information has modified successfully"), @ApiResponse(code = 200, message = "OK. \n " +
@ApiResponse(code = 500, message = "Error occurred while modifying the application list") "Application list of the device has successfully been updated"),
@ApiResponse(code = 204, message = "No Content. \n Application list of the device has not been updated"),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Sever error occurred while modifying the application list")
}) })
Response updateApplicationList(@ApiParam(name = "id", value = "deviceIdentifier") @PathParam("id") String id, Response updateApplicationList(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id,
@ApiParam(name = "applications", value = "updatable applications") @ApiParam(name = "applications", value = "List of applications that need to be " +
"persisted against the device")
List<Application> applications); List<Application> applications);
@GET @GET
@ -57,17 +62,34 @@ public interface DeviceManagementService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Getting Pending Android Device Operations", value = "Get the operation list pending for the device",
responseContainer = "List", responseContainer = "List",
notes = "The Android agent communicates with the server to get the operations that are queued up " + notes = "The Android agent communicates with the server to get the operations that are queued up " +
"at the server end for a given device using this REST API", "at the server end for a given device using via this particular resource",
response = Operation.class) response = Operation.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "List of pending operations"), @ApiResponse(code = 200, message = "OK. \n List of pending operations of the device is returned",
@ApiResponse(code = 500, message = "Issue in retrieving operation management service instance") responseHeaders = {
@ResponseHeader(name = "Content-Type", description = "The content type of the body"),
@ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(code = 303, message = "See Other. \n " +
"Source can be retrieved from the URL specified at the Location header.",
responseHeaders = {
@ResponseHeader(name = "Location", description = "The Source URL of the document.")}),
@ApiResponse(code = 304, message = "Not Modified. \n " +
"Empty body because the client already has the latest version of the requested resource."),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 404, message = "Not Found. \n Requested device not found."),
@ApiResponse(code = 406, message = "Not Acceptable. \n The requested media type is not supported."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while retrieving the pending operation list of the device.")
}) })
Response getPendingOperations( Response getPendingOperations(
@ApiParam(name = "id", value = "DeviceIdentifier") @PathParam("id") String id, @ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id,
@ApiParam(name = "resultOperations", value = "Device Operation Status") @ApiParam(name = "resultOperations", value = "Device Operation Status")
List<? extends Operation> resultOperations); List<? extends Operation> resultOperations);
@ -75,15 +97,20 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Registering an Android Device", value = "Register an Android Device",
notes = "When carrying out device registration via an Android device, you need to initially install" + notes = "When carrying out device registration via an Android device, you need to initially install" +
" an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," + " an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," +
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
" an Android Agent on the respective device" " an Android Agent on the respective device"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device enrollment succeeded"), @ApiResponse(code = 201, message = "Created. \n Device has successfully been enrolled. Location header " +
@ApiResponse(code = 500, message = "Device enrollment failed"), "contains URL of newly enrolled device",
responseHeaders = {
@ResponseHeader(name = "Location", description = "URL of the device enrolled")}),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while enrolling the device."),
}) })
Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device); Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device);
@ -95,10 +122,19 @@ public interface DeviceManagementService {
notes = "Use this REST API to retrieve the registration status of an Android device" notes = "Use this REST API to retrieve the registration status of an Android device"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device has already enrolled"), @ApiResponse(code = 200, message = "Device has already enrolled",
@ApiResponse(code = 404, message = "Device not found") responseHeaders = {
@ResponseHeader(name = "Content-Type", description = "The content type of the body"),
@ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(code = 404, message = "Not Found. \n Requested device not found."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while retrieving the enrollment status of the device."),
}) })
Response isEnrolled(@ApiParam(name = "id", value = "DeviceIdentifier") @PathParam("id") String id); Response isEnrolled(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id);
@PUT @PUT
@Path("/{id}") @Path("/{id}")
@ -108,10 +144,22 @@ public interface DeviceManagementService {
notes = "Use this REST API to update the registration details of an Android device" notes = "Use this REST API to update the registration details of an Android device"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device enrollment has updated successfully"), @ApiResponse(code = 200, message = "OK. \n Device enrollment has been updated successfully",
@ApiResponse(code = 404, message = "Device not found for enrollment") responseHeaders = {
@ResponseHeader(name = "Location", description = "The URL of the updated device."),
@ResponseHeader(name = "Content-Type", description = "The content type of the body"),
@ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(code = 204, message = "No Content. \n Enrollment of the device has not been updated"),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 404, message = "Not Found. \n Resource to be deleted does not exist."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while modifying the current enrollment of the device.")
}) })
Response modifyEnrollment(@ApiParam(name = "id", value = "DeviceIdentifier") @PathParam("id") String id, Response modifyEnrollment(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id,
@ApiParam(name = "device", value = "Device information to be modify") Device device); @ApiParam(name = "device", value = "Device information to be modify") Device device);
@DELETE @DELETE
@ -119,12 +167,14 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "DELETE", httpMethod = "DELETE",
value = "Un-registering an Android Device", value = "Un-registering an Android Device",
notes = "Use this REST API to unregister a specific Android device" notes = "Use this REST API to un-register a specific Android device"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device has removed successfully"), @ApiResponse(code = 200, message = "OK. \n Device has successfully been dis-enrolled"),
@ApiResponse(code = 404, message = "Device not found") @ApiResponse(code = 404, message = "Not Found. \n Device requested to be dis-enrolled does not exist."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while dis-enrolling the the device."),
}) })
Response disEnrollDevice(@ApiParam(name = "id", value = "DeviceIdentifier") @PathParam("id") String id); Response disEnrollDevice(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id);
} }

@ -118,7 +118,7 @@
<overWrite>true</overWrite> <overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/ <outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/
</outputDirectory> </outputDirectory>
<destFileName>mdm-android-agent.war</destFileName> <destFileName>api#device-mgt#android#v2.1.war</destFileName>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
</configuration> </configuration>

@ -1,5 +1,5 @@
instructions.configure = \ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/mdm-android-agent.war,target:${installFolder}/../../deployment/server/webapps/mdm-android-agent.war,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/api#device-mgt#android#v2.1.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt#android#v2.1.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\

@ -49,6 +49,28 @@
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version> <version>${swagger.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<!--Carbon Kernel Dependencies--> <!--Carbon Kernel Dependencies-->
<dependency> <dependency>
@ -1180,6 +1202,8 @@
<!-- Release plugin ID for github--> <!-- Release plugin ID for github-->
<project.scm.id>github-scm</project.scm.id> <project.scm.id>github-scm</project.scm.id>
<servlet-api.version>2.5</servlet-api.version>
</properties> </properties>
<scm> <scm>

Loading…
Cancel
Save