mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
merge with upstream
This commit is contained in:
commit
4cb6aca5b0
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>iot-analytics</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>iot-analytics</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>iot-analytics</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -69,6 +69,12 @@
|
||||
<!--TODO: use http://requirejs.org/ for better performance, now we have too many imports -->
|
||||
<!-- C3 chart library styles-->
|
||||
<link rel="stylesheet" href="css/d3/c3.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="css/bootstrap-datepicker.min.css" type="text/css"/>
|
||||
<style>
|
||||
.datepicker-inline {
|
||||
margin:0 auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
@ -85,7 +91,17 @@
|
||||
<script src="js/jquery/jquery-2.1.1.min.js"></script>
|
||||
<script src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script src="js/bootstrap/bootstrap.min.js"></script>
|
||||
|
||||
<script src="js/bootstrap-datepicker.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#timeFrom").datepicker({
|
||||
orientation: 'top'
|
||||
});
|
||||
$("#timeTo").datepicker({
|
||||
orientation: 'top'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--bootstrap-application-wizard-->
|
||||
<script src="js/bootstrap-wizard-lib/bootstrap-wizard.js"></script>
|
||||
|
||||
|
||||
@ -327,25 +327,31 @@ function notifyError(message) {
|
||||
function enableRealTime() {
|
||||
document.getElementById('realTimeShow').style.display = 'none';
|
||||
spatialObject = currentSpatialObjects[selectedSpatialObject];
|
||||
spatialObject.removePath();
|
||||
spatialObject.marker.closePopup();
|
||||
if (spatialObject) {
|
||||
spatialObject.removePath();
|
||||
spatialObject.marker.closePopup();
|
||||
}
|
||||
selectedSpatialObject = null;
|
||||
clearFocus();
|
||||
clearMap();
|
||||
document.getElementById('objectInfo').style.display = 'none';
|
||||
isBatchModeOn = false;
|
||||
}
|
||||
|
||||
function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
|
||||
if (!timeFrom) {
|
||||
notifyError('No start time provided to show history. Please provide a suitable value' + timeFrom);
|
||||
} else if (!timeTo) {
|
||||
notifyError('No end time provided to show history. Please provide a suitable value' + timeTo);
|
||||
} else {
|
||||
$('#dateRangePopup').dialog('close');
|
||||
document.getElementById('realTimeShow').style.display = 'block';
|
||||
isBatchModeOn = true;
|
||||
clearFocus(); // Clear current focus if any
|
||||
clearMap();
|
||||
var tableData = getProviderData(timeFrom, timeTo);
|
||||
var fromDate = new Date(timeFrom);
|
||||
var toDate = new Date(timeTo);
|
||||
var tableData = getProviderData(fromDate.valueOf() / 1000, toDate.valueOf() / 1000);
|
||||
for (var i = 0; i < tableData.length; i++) {
|
||||
var data = tableData[i];
|
||||
var geoMessage = {
|
||||
@ -401,7 +407,6 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
|
||||
createChart();
|
||||
chart.load({columns: [spatialObject.speedHistory.getArray()]});
|
||||
}, 100);
|
||||
$('#dateRangePopup').dialog('close');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>analytics</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>androidsense-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>androidsense-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -153,6 +153,10 @@
|
||||
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@ -19,14 +19,29 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.iot.androidsense.service.impl;
|
||||
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
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.iot.androidsense.service.impl.constants.AndroidSenseConstants;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ResponseHeader;
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Tag;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@SwaggerDefinition(
|
||||
@ -44,6 +59,16 @@ import javax.ws.rs.core.Response;
|
||||
@Tag(name = "android_sense", description = "")
|
||||
}
|
||||
)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll device",
|
||||
description = "",
|
||||
key = "perm:android-sense:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/android-sense"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface AndroidSenseService {
|
||||
|
||||
/**
|
||||
@ -52,10 +77,57 @@ public interface AndroidSenseService {
|
||||
* @param deviceId The registered device Id.
|
||||
* @param keywords The key words to be sent. (Comma separated values)
|
||||
*/
|
||||
@Path("device/{deviceId}/words")
|
||||
@POST
|
||||
@Scope(key = "device:android-sense:enroll", name = "", description = "")
|
||||
Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords);
|
||||
@Path("device/{deviceId}/words")
|
||||
@ApiOperation(
|
||||
httpMethod = "POST",
|
||||
value = "End point to send the key words to the device",
|
||||
notes = "",
|
||||
tags = "android_sense",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK.",
|
||||
response = Response.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "The content type of the body"),
|
||||
@ResponseHeader(
|
||||
name = "Last-Modified",
|
||||
description = "Date and time the resource was last modified.\n" +
|
||||
"Used by caches, or in conditional requests."),
|
||||
}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid Device Identifiers found.",
|
||||
response = Response.class),
|
||||
@ApiResponse(
|
||||
code = 401,
|
||||
message = "Unauthorized. \n Unauthorized request."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while executing command operation to"
|
||||
+ " send keywords",
|
||||
response = Response.class)
|
||||
})
|
||||
Response sendKeyWords(
|
||||
@ApiParam(
|
||||
name = "deviceId",
|
||||
value = "The registered device Id.",
|
||||
required = true)
|
||||
@PathParam("deviceId") String deviceId,
|
||||
@ApiParam(
|
||||
name = "keywords",
|
||||
value = "The key words to be sent. (Comma separated values)",
|
||||
required = true)
|
||||
@QueryParam("keywords") String keywords);
|
||||
|
||||
/**
|
||||
* End point to send the key words to the device
|
||||
@ -63,34 +135,222 @@ public interface AndroidSenseService {
|
||||
* @param deviceId The registered device Id.
|
||||
* @param threshold The key words to be sent. (Comma separated values)
|
||||
*/
|
||||
@Path("device/{deviceId}/words/threshold")
|
||||
@POST
|
||||
@Scope(key = "device:android-sense:enroll", name = "", description = "")
|
||||
Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold);
|
||||
@Path("device/{deviceId}/words/threshold")
|
||||
@ApiOperation(
|
||||
httpMethod = "POST",
|
||||
value = "End point to send threshold value to the device",
|
||||
notes = "",
|
||||
tags = "android_sense",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK.",
|
||||
response = Response.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "The content type of the body"),
|
||||
@ResponseHeader(
|
||||
name = "Last-Modified",
|
||||
description = "Date and time the resource was last modified.\n" +
|
||||
"Used by caches, or in conditional requests."),
|
||||
}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid Device Identifiers found.",
|
||||
response = Response.class),
|
||||
@ApiResponse(
|
||||
code = 401,
|
||||
message = "Unauthorized. \n Unauthorized request."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while executing command operation to"
|
||||
+ " send threashold",
|
||||
response = Response.class)
|
||||
})
|
||||
Response sendThreshold(
|
||||
@ApiParam(
|
||||
name = "deviceId",
|
||||
value = "The registered device Id.",
|
||||
required = true)
|
||||
@PathParam("deviceId") String deviceId,
|
||||
@ApiParam(
|
||||
name = "threshold",
|
||||
value = "Threshold to be sent.",
|
||||
required = true)
|
||||
@QueryParam("threshold") String threshold);
|
||||
|
||||
@Path("device/{deviceId}/words")
|
||||
/**
|
||||
* End point to remove key words from the device
|
||||
*/
|
||||
@DELETE
|
||||
@Scope(key = "device:android-sense:enroll", name = "", description = "")
|
||||
Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words);
|
||||
@Path("device/{deviceId}/words")
|
||||
@ApiOperation(
|
||||
httpMethod = "DELETE",
|
||||
value = "Remove key words from the device",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "android_sense",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK.",
|
||||
response = Response.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "The content type of the body"),
|
||||
@ResponseHeader(
|
||||
name = "Last-Modified",
|
||||
description = "Date and time the resource was last modified.\n" +
|
||||
"Used by caches, or in conditional requests."),
|
||||
}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid Device Identifiers found.",
|
||||
response = Response.class),
|
||||
@ApiResponse(
|
||||
code = 401,
|
||||
message = "Unauthorized. \n Unauthorized request."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while executing command operation to"
|
||||
+ " send threashold",
|
||||
response = Response.class)
|
||||
})
|
||||
Response removeKeyWords(
|
||||
@ApiParam(
|
||||
name = "deviceId",
|
||||
value = "The registered device Id.",
|
||||
required = true)
|
||||
@PathParam("deviceId") String deviceId,
|
||||
@ApiParam(
|
||||
name = "words",
|
||||
value = "The key words to be sent. (Comma separated values)",
|
||||
required = true)
|
||||
@QueryParam("words") String words);
|
||||
|
||||
/**
|
||||
* Retrieve Sensor data for the device type
|
||||
*/
|
||||
@Path("stats/{deviceId}/sensors/{sensorName}")
|
||||
@GET
|
||||
@Consumes("application/json")
|
||||
@Scope(key = "device:android-sense:enroll", name = "", description = "")
|
||||
@Produces("application/json")
|
||||
Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor,
|
||||
@QueryParam("from") long from, @QueryParam("to") long to);
|
||||
@Path("stats/{deviceId}/sensors/{sensorName}")
|
||||
@ApiOperation(
|
||||
consumes = "application/json",
|
||||
produces = "application/json",
|
||||
httpMethod = "GET",
|
||||
value = "Retrieve Sensor data for the device type",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "android_sense",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK.",
|
||||
response = Response.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "The content type of the body"),
|
||||
@ResponseHeader(
|
||||
name = "Last-Modified",
|
||||
description = "Date and time the resource was last modified.\n" +
|
||||
"Used by caches, or in conditional requests."),
|
||||
}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid Device Identifiers found.",
|
||||
response = Response.class),
|
||||
@ApiResponse(
|
||||
code = 401,
|
||||
message = "Unauthorized. \n Unauthorized request."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error on retrieving stats",
|
||||
response = Response.class)
|
||||
})
|
||||
Response getAndroidSenseDeviceStats(
|
||||
@ApiParam(
|
||||
name = "deviceId",
|
||||
value = "The registered device Id.",
|
||||
required = true)
|
||||
@PathParam("deviceId") String deviceId,
|
||||
@ApiParam(
|
||||
name = "sensorName",
|
||||
value = "Name of the sensor",
|
||||
required = true)
|
||||
@PathParam("sensorName") String sensor,
|
||||
@ApiParam(
|
||||
name = "from",
|
||||
value = "Get stats from what time",
|
||||
required = true)
|
||||
@QueryParam("from") long from,
|
||||
@ApiParam(
|
||||
name = "to",
|
||||
value = "Get stats up to what time",
|
||||
required = true)
|
||||
@QueryParam("to") long to);
|
||||
|
||||
/**
|
||||
* Enroll devices.
|
||||
*/
|
||||
@Path("device/{device_id}/register")
|
||||
@POST
|
||||
@Scope(key = "device:android-sense:enroll", name = "", description = "")
|
||||
Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName);
|
||||
@Path("device/{device_id}/register")
|
||||
@ApiOperation(
|
||||
httpMethod = "POST",
|
||||
value = "Enroll device",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "android_sense",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidSenseConstants.SCOPE, value = "perm:android-sense:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 202,
|
||||
message = "Accepted.",
|
||||
response = Response.class),
|
||||
@ApiResponse(
|
||||
code = 406,
|
||||
message = "Not Acceptable"),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error on retrieving stats",
|
||||
response = Response.class)
|
||||
})
|
||||
Response register(
|
||||
@ApiParam(
|
||||
name = "deviceId",
|
||||
value = "Device identifier id of the device to be added",
|
||||
required = true)
|
||||
@PathParam("device_id") String deviceId,
|
||||
@ApiParam(
|
||||
name = "deviceName",
|
||||
value = "Device name of the device to be added",
|
||||
required = true)
|
||||
@QueryParam("deviceName") String deviceName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -42,4 +42,6 @@ public class AndroidSenseConstants {
|
||||
public static final String CONFIG_TYPE = "general";
|
||||
public static final String DEFAULT_ENDPOINT = "tcp://localhost:1886";
|
||||
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<artifactId>androidsense-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@
|
||||
</li>
|
||||
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
|
||||
aria-controls="event_log">Operations Log</a></li>
|
||||
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
|
||||
aria-controls="geo_dashboard">Map</a></li>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-view-tab-contents"}}
|
||||
@ -73,4 +75,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default tab-pane"
|
||||
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
|
||||
<div class="panel-heading">Map</div>
|
||||
|
||||
<div id="chartWrapper">
|
||||
</div>
|
||||
|
||||
<a class="padding-left"
|
||||
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
|
||||
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span> View Device Location
|
||||
</a>
|
||||
</div>
|
||||
{{/zone}}
|
||||
|
||||
@ -20,6 +20,7 @@ function onRequest(context) {
|
||||
var log = new Log("device-view.js");
|
||||
var deviceType = context.uriParams.deviceType;
|
||||
var deviceId = request.getParameter("id");
|
||||
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
var autoCompleteParams = [
|
||||
{"name" : "deviceId", "value" : deviceId}
|
||||
];
|
||||
@ -28,10 +29,13 @@ function onRequest(context) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||
if (device && device.status != "error") {
|
||||
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}};
|
||||
return {
|
||||
"device": device.content,
|
||||
"autoCompleteParams": autoCompleteParams,
|
||||
"encodedFeaturePayloads": ""
|
||||
"encodedFeaturePayloads": "",
|
||||
"portalUrl" : devicemgtProps['portalURL'],
|
||||
"anchor" : JSON.stringify(anchor)
|
||||
};
|
||||
} else {
|
||||
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>device-types</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>arduino-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>arduino-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -141,6 +141,10 @@
|
||||
<artifactId>org.wso2.carbon.analytics.api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -18,15 +18,14 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.iot.arduino.service.impl;
|
||||
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
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.iot.arduino.service.impl.constants.ArduinoConstants;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@SwaggerDefinition(
|
||||
@ -44,26 +43,72 @@ import javax.ws.rs.core.Response;
|
||||
@Tag(name = "arduino", description = "")
|
||||
}
|
||||
)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll device",
|
||||
description = "",
|
||||
key = "perm:arduino:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/arduino"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface ArduinoService {
|
||||
|
||||
@Path("device/{deviceId}/bulb")
|
||||
@POST
|
||||
@Scope(key = "device:arduino:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Switch bulb",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "arduino",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
|
||||
|
||||
@Path("device/{deviceId}/controls")
|
||||
@GET
|
||||
@Scope(key = "device:arduino:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Read controls",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "arduino",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response readControls(@PathParam("deviceId") String deviceId);
|
||||
|
||||
/**
|
||||
* Retreive Sensor data for the device type
|
||||
* Retrieve Sensor data for the device type
|
||||
*/
|
||||
@Path("device/stats/{deviceId}")
|
||||
@GET
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
@Scope(key = "device:arduino:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Retrieve Sensor data for the device type",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "arduino",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
|
||||
@QueryParam("to") long to);
|
||||
|
||||
@ -73,7 +118,19 @@ public interface ArduinoService {
|
||||
@Path("device/download")
|
||||
@GET
|
||||
@Produces("application/octet-stream")
|
||||
@Scope(key = "device:arduino:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Download device agent",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "arduino",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = ArduinoConstants.SCOPE, value = "perm:arduino:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response downloadSketch(@QueryParam("deviceName") String customDeviceName);
|
||||
|
||||
}
|
||||
|
||||
@ -27,4 +27,6 @@ public class ArduinoConstants {
|
||||
|
||||
public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600";
|
||||
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>arduino-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
</li>
|
||||
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
|
||||
aria-controls="event_log">Operations Log</a></li>
|
||||
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
|
||||
aria-controls="geo_dashboard">Map</a></li>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-view-tab-contents"}}
|
||||
@ -75,4 +77,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default tab-pane"
|
||||
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
|
||||
<div class="panel-heading">Map</div>
|
||||
|
||||
<div id="chartWrapper">
|
||||
</div>
|
||||
|
||||
<a class="padding-left"
|
||||
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
|
||||
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span> View Device Location
|
||||
</a>
|
||||
</div>
|
||||
{{/zone}}
|
||||
@ -20,6 +20,7 @@ function onRequest(context) {
|
||||
var log = new Log("device-view.js");
|
||||
var deviceType = context.uriParams.deviceType;
|
||||
var deviceId = request.getParameter("id");
|
||||
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
var autoCompleteParams = [
|
||||
{"name" : "deviceId", "value" : deviceId}
|
||||
];
|
||||
@ -28,7 +29,14 @@ function onRequest(context) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||
if (device && device.status != "error") {
|
||||
return {"device": device.content, "autoCompleteParams" : autoCompleteParams, "encodedFeaturePayloads": ""};
|
||||
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}};
|
||||
return {
|
||||
"device": device.content,
|
||||
"autoCompleteParams" : autoCompleteParams,
|
||||
"encodedFeaturePayloads": "",
|
||||
"portalUrl" : devicemgtProps['portalURL'],
|
||||
"anchor" : JSON.stringify(anchor)
|
||||
};
|
||||
} else {
|
||||
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
|
||||
exit();
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>device-types</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>raspberrypi-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>raspberrypi-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -121,7 +121,11 @@
|
||||
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
|
||||
@ -18,12 +18,10 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl;
|
||||
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
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.iot.raspberrypi.service.impl.constants.RaspberrypiConstants;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
@ -44,11 +42,33 @@ import javax.ws.rs.core.Response;
|
||||
@Tag(name = "raspberrypi", description = "")
|
||||
}
|
||||
)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll device",
|
||||
description = "",
|
||||
key = "perm:raspberrypi:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/raspberrypi"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface RaspberryPiService {
|
||||
|
||||
@Path("device/{deviceId}/bulb")
|
||||
@POST
|
||||
@Scope(key = "device:raspberrypi:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Switch bulb",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "raspberrypi",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response switchBulb(@PathParam("deviceId") String deviceId, @QueryParam("state") String state);
|
||||
|
||||
/**
|
||||
@ -58,7 +78,19 @@ public interface RaspberryPiService {
|
||||
@GET
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
@Scope(key = "device:raspberrypi:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Retreive Sensor data for the device type",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "raspberrypi",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response getRaspberryPiTemperatureStats(@PathParam("deviceId") String deviceId,
|
||||
@QueryParam("from") long from, @QueryParam("to") long to);
|
||||
|
||||
@ -68,7 +100,19 @@ public interface RaspberryPiService {
|
||||
@Path("device/download")
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Scope(key = "device:raspberrypi:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Download the agent.",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "raspberrypi",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = RaspberrypiConstants.SCOPE, value = "perm:raspberrypi:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketch_type") String sketchType);
|
||||
|
||||
}
|
||||
|
||||
@ -33,4 +33,6 @@ public class RaspberrypiConstants {
|
||||
|
||||
public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600";
|
||||
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>raspberrypi-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
</li>
|
||||
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
|
||||
aria-controls="event_log">Operations Log</a></li>
|
||||
<li><a class="list-group-item" href="#geo_dashboard" role="tab" data-toggle="tab"
|
||||
aria-controls="geo_dashboard">Map</a></li>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-view-tab-contents"}}
|
||||
@ -75,4 +77,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default tab-pane"
|
||||
id="geo_dashboard" role="tabpanel" aria-labelledby="geo_dashboard">
|
||||
<div class="panel-heading">Map</div>
|
||||
|
||||
<div id="chartWrapper">
|
||||
</div>
|
||||
|
||||
<a class="padding-left"
|
||||
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
|
||||
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-ring fw-stack-2x"></i>
|
||||
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||
</span> View Device Location
|
||||
</a>
|
||||
</div>
|
||||
{{/zone}}
|
||||
@ -20,6 +20,7 @@ function onRequest(context) {
|
||||
var log = new Log("device-view.js");
|
||||
var deviceType = context.uriParams.deviceType;
|
||||
var deviceId = request.getParameter("id");
|
||||
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
var autoCompleteParams = [
|
||||
{"name" : "deviceId", "value" : deviceId}
|
||||
];
|
||||
@ -28,7 +29,14 @@ function onRequest(context) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||
if (device && device.status != "error") {
|
||||
return {"device": device.content, "autoCompleteParams" : autoCompleteParams, "encodedFeaturePayloads": ""};
|
||||
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}};
|
||||
return {
|
||||
"device": device.content,
|
||||
"autoCompleteParams" : autoCompleteParams,
|
||||
"encodedFeaturePayloads": "",
|
||||
"portalUrl" : devicemgtProps['portalURL'],
|
||||
"anchor" : JSON.stringify(anchor)
|
||||
};
|
||||
} else {
|
||||
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
|
||||
exit();
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>device-types</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ public class FireAlarmHTTPCommunicator extends HTTPTransportHandler {
|
||||
|
||||
AgentManager agentManager = AgentManager.getInstance();
|
||||
String pathContext = request.getPathInfo();
|
||||
String separator = File.separator;
|
||||
String separator = File.separatorChar=='\\' ? "\\\\" : File.separator ;
|
||||
|
||||
if (pathContext.toUpperCase().contains(
|
||||
separator + AgentConstants.TEMPERATURE_CONTROL)) {
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -235,7 +235,11 @@
|
||||
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@ -18,14 +18,12 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
|
||||
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.apimgt.annotations.api.Scope;
|
||||
import org.wso2.carbon.apimgt.annotations.api.Scopes;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
@ -50,8 +48,20 @@ import javax.ws.rs.core.Response;
|
||||
@Tag(name = "virtual_firealarm", description = "")
|
||||
}
|
||||
)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll device",
|
||||
description = "",
|
||||
key = "perm:firealarm:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/firealarm"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface VirtualFireAlarmService {
|
||||
|
||||
String SCOPE = "scope";
|
||||
|
||||
/**
|
||||
* This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to
|
||||
* the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used
|
||||
@ -63,7 +73,19 @@ public interface VirtualFireAlarmService {
|
||||
*/
|
||||
@POST
|
||||
@Path("device/{deviceId}/buzz")
|
||||
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Switch Buzzer",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "virtual_firealarm",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response switchBuzzer(@PathParam("deviceId") String deviceId,
|
||||
@FormParam("state") String state);
|
||||
|
||||
@ -72,7 +94,19 @@ public interface VirtualFireAlarmService {
|
||||
*/
|
||||
@Path("device/stats/{deviceId}")
|
||||
@GET
|
||||
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "Retrieve Sensor data for the device type",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "virtual_firealarm",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
|
||||
@ -81,7 +115,19 @@ public interface VirtualFireAlarmService {
|
||||
@Path("device/download")
|
||||
@GET
|
||||
@Produces("application/zip")
|
||||
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "Download agent",
|
||||
notes = "",
|
||||
response = Response.class,
|
||||
tags = "virtual_firealarm",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
org.apache.commons.codec.binary,
|
||||
org.json.*;version="${commons-json.version.range}",
|
||||
org.wso2.carbon.certificate.mgt.core.*,
|
||||
org.wso2.carbon.certificate.mgt.core.util,
|
||||
org.wso2.carbon.device.mgt.analytics.data.publisher.exception,
|
||||
org.wso2.carbon.device.mgt.analytics.data.publisher.service,
|
||||
org.wso2.carbon.event.input.adapter.core,
|
||||
org.wso2.carbon.event.input.adapter.core.exception,
|
||||
org.jivesoftware.smack.*,
|
||||
javax.xml,
|
||||
javax.xml.bind,
|
||||
javax.xml.bind.annotation,
|
||||
javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",
|
||||
|
||||
@ -6,6 +6,7 @@ import org.w3c.dom.Document;
|
||||
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.exception.VirtualFirealarmConfigurationException;
|
||||
import org.wso2.carbon.utils.CarbonUtils;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
@ -50,6 +51,7 @@ public class VirtualFirealarmConfig {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
try {
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
return docBuilder.parse(file);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<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>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>WSO2 Carbon - IoT Server SCEP Server API</name>
|
||||
<description>WSO2 Carbon - Virtual FireAlarm SCEP Server API Implementation</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<dependencies>
|
||||
<!-- CDM -->
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</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.apache.axis2.wso2</groupId>
|
||||
<artifactId>axis2-client</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--CXF -->
|
||||
<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>
|
||||
|
||||
<!--JAX-RS -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-jaxrs</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-web-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>jsr311-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient.wso2</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bouncycastle.wso2</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.user.api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.queuing</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.base</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.axis2.wso2</groupId>
|
||||
<artifactId>axis2</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
||||
<artifactId>smack</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
||||
<artifactId>smackx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-fileupload.wso2</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant.wso2</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant.wso2</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-httpclient.wso2</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.equinox</groupId>
|
||||
<artifactId>javax.servlet</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.registry.api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>${wso2.maven.compiler.source}</source>
|
||||
<target>${wso2.maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<warName>virtual_firealarm_scep</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>device-types</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>appm-connector</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -134,6 +134,7 @@
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.wso2.carbon.event.output.adapter.core.*,
|
||||
javax.xml,
|
||||
javax.xml.namespace; version=0.0.0,
|
||||
org.apache.axis2,
|
||||
org.apache.axis2.client,
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>cdmf-transport-adapters</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>mb-extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>siddhi-extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>android-plugin</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>android-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -143,6 +143,11 @@
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<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>
|
||||
|
||||
@ -300,7 +300,7 @@ public class AndroidDeviceInfo extends DeviceInfo implements Serializable {
|
||||
}
|
||||
|
||||
public Date getUpdatedTime() {
|
||||
if(this.updatedTime.equals((Object)null)) {
|
||||
if(this.updatedTime == null) {
|
||||
this.updatedTime = new Date();
|
||||
}
|
||||
|
||||
|
||||
@ -83,13 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
|
||||
|
||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||
try {
|
||||
Type jsonType;
|
||||
if (type.equals(type)) {
|
||||
jsonType = type;
|
||||
} else {
|
||||
jsonType = type;
|
||||
}
|
||||
getGson().toJson(object, jsonType, writer);
|
||||
getGson().toJson(object, type, writer);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
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.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 javax.validation.Valid;
|
||||
import javax.ws.rs.Consumes;
|
||||
@ -57,13 +58,167 @@ import java.util.List;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Path("/admin/devices")
|
||||
@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Lock Device",
|
||||
description = "Hard lock own device",
|
||||
key = "perm:android:lock-devices",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/lock"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Unlock Device",
|
||||
description = "Unlock permanently locked device",
|
||||
key = "perm:android:unlock-devices",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/unlock"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Get Location",
|
||||
description = "Request device location coordinates",
|
||||
key = "perm:android:location",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/location"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Clear Password",
|
||||
description = "Clear the password on Android devices",
|
||||
key = "perm:android:clear-password",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/clear-password"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Control Camera",
|
||||
description = "Enabling or Disabling the Camera on Android Devices",
|
||||
key = "perm:android:control-camera",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/camera"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Get Info",
|
||||
description = "Requesting device information from Android Devices",
|
||||
key = "perm:android:info",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/info"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Get Logs",
|
||||
description = "Requesting Logcat Details from Android Devices",
|
||||
key = "perm:android:logcat",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/logcat"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Enterprise Wipe",
|
||||
description = "Enterprise Wiping Android Devices",
|
||||
key = "perm:android:enterprise-wipe",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/enterprise-wipe"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Factory Reset",
|
||||
description = "Factory Resetting Android Devices",
|
||||
key = "perm:android:wipe",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/wipe"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Get Installed Applications",
|
||||
description = "Get list of installed applications",
|
||||
key = "perm:android:applications",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/applications"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Ring Device",
|
||||
description = "Ring Android devices",
|
||||
key = "perm:android:ring",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/ring"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Reboot Device",
|
||||
description = "Reboot Android devices",
|
||||
key = "perm:android:reboot",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/reboot"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Mute Device",
|
||||
description = "Mute Android devices",
|
||||
key = "perm:android:mute",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/mute"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Install Applications",
|
||||
description = "Installing an Application on Android Devices",
|
||||
key = "perm:android:install-application",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/install-app"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Update Applications",
|
||||
description = "Updating an Application on Android Devices",
|
||||
key = "perm:android:update-application",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/update-app"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Uninstall Applications",
|
||||
description = "Uninstalling an Application on Android Devices",
|
||||
key = "perm:android:uninstall-application",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/uninstall-app"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Blacklist Applications",
|
||||
description = "Blacklisting applications on Android Devices",
|
||||
key = "perm:android:blacklist-applications",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/blacklist-app"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Upgrade Firmware",
|
||||
description = "Upgrading Firmware of Android Devices",
|
||||
key = "perm:android:upgrade-firmware",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/upgrade"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Configure VPN",
|
||||
description = "Configure VPN on Android Device",
|
||||
key = "perm:android:configure-vpn",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/vpn"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Send Notification",
|
||||
description = "Sending a notification to Android Device",
|
||||
key = "perm:android:send-notification",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/send-notification"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Configure Wi-Fi",
|
||||
description = "Configure Wi-Fi on Android Device",
|
||||
key = "perm:android:configure-wifi",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/wifi"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Encrypt Storage",
|
||||
description = "Encrypting storage on Android Device",
|
||||
key = "perm:android:encrypt-storage",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/encrypt"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Change Password",
|
||||
description = "Changing the lock code of an Android Device",
|
||||
key = "perm:android:change-lock-code",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/change-lock-code"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Password Policy",
|
||||
description = "Set password policy of an Android Device",
|
||||
key = "perm:android:set-password-policy",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/password-policy"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Add Web clip",
|
||||
description = "Setting a Web Clip on Android Devices",
|
||||
key = "perm:android:set-webclip",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/android/webclip"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface DeviceManagementAdminService {
|
||||
|
||||
@POST
|
||||
@ -76,13 +231,10 @@ public interface DeviceManagementAdminService {
|
||||
"permanently locks the device or screen locking an Android device.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/lock",
|
||||
description = "Lock Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:lock-devices")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -142,13 +294,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/unlock",
|
||||
description = "Unlock Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:unlock-devices")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -208,13 +357,10 @@ public interface DeviceManagementAdminService {
|
||||
"Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/location",
|
||||
description = "Get Device Location") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:location")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -270,13 +416,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Clear the password on Android devices",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service.",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/clear-password",
|
||||
description = "Clear Password of Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:clear-password")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -331,13 +474,11 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Enable or disable the camera on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/operations/android/camera", description = "Manage Camera") }
|
||||
)
|
||||
}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:control-camera")
|
||||
})
|
||||
} )
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 201,
|
||||
@ -398,13 +539,10 @@ public interface DeviceManagementAdminService {
|
||||
"the list of operations that needs to be executed on the device",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/info",
|
||||
description = "Get Device Information") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:info")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -464,13 +602,10 @@ public interface DeviceManagementAdminService {
|
||||
"the list of operations that needs to be executed on the device.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/logcat",
|
||||
description = "Get Logs") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:logcat")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -529,13 +664,10 @@ public interface DeviceManagementAdminService {
|
||||
"personal data intact. You are able to enterprise wipe Android devices using this REST API.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe",
|
||||
description = "Enterprise Wipe") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enterprise-wipe")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -592,13 +724,10 @@ public interface DeviceManagementAdminService {
|
||||
"to restore them back to the original system.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/wipe",
|
||||
description = "Factory Reset") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:wipe")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -659,13 +788,10 @@ public interface DeviceManagementAdminService {
|
||||
"on the device.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/applications",
|
||||
description = "Get Installed Application") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:applications")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -722,13 +848,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Ring Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/ring",
|
||||
description = "Ring Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:ring")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -785,13 +908,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Reboot or restart your Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/reboot",
|
||||
description = "Reboot Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:reboot")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -840,6 +960,7 @@ public interface DeviceManagementAdminService {
|
||||
List<String> deviceIDs);
|
||||
|
||||
@POST
|
||||
@Path("/mute")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
@ -847,13 +968,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Mute or enable a silent profile for Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/mute",
|
||||
description = "Mute Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:mute")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -894,7 +1012,6 @@ public interface DeviceManagementAdminService {
|
||||
message = "Internal Server Error. \n " +
|
||||
"Server error occurred while adding a new device mute operation.")
|
||||
})
|
||||
@Path("/mute")
|
||||
Response muteDevice(
|
||||
@ApiParam(
|
||||
name = "deviceIDs",
|
||||
@ -913,13 +1030,10 @@ public interface DeviceManagementAdminService {
|
||||
" the application installation will happen in silent mode, else the device user's consent will be required.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/install-app",
|
||||
description = "Install Applications") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:install-application")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -981,13 +1095,10 @@ public interface DeviceManagementAdminService {
|
||||
"mode, else the device user's consent is required.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/update-app",
|
||||
description = "Update installed applications") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:update-application")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1046,13 +1157,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Uninstall an application from Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/uninstall-app",
|
||||
description = "Uninstall Applications") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:uninstall-application")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1115,13 +1223,10 @@ public interface DeviceManagementAdminService {
|
||||
"COPE devices. Applications can be blacklisted via the application restriction policy too.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/blacklist-app",
|
||||
description = "Blacklist Applications") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:blacklist-applications")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1176,17 +1281,14 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "UUpgrading Firmware of Android Devices",
|
||||
value = "Upgrading Firmware of Android Devices",
|
||||
notes = "Upgrade the firmware of Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/upgrade",
|
||||
description = "Upgrade Firmware") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:upgrade-firmware")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1247,13 +1349,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Configure VPN on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/vpn",
|
||||
description = "Add VPN") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-vpn")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1310,13 +1409,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Send a notification or message to Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/send-notification",
|
||||
description = "Send Notifications") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:send-notification")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1374,13 +1470,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Configure Wi-Fi on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/wifi",
|
||||
description = "Add Wifi Configuration") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:configure-wifi")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1439,13 +1532,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Encrypt the data stored on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/encrypt",
|
||||
description = "Encrypt Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:encrypt-storage")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1504,13 +1594,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Change the lock code on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/change-lock-code",
|
||||
description = "Change Password of Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:change-lock-code")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1569,13 +1656,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Set a password policy on Android devices.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/password-policy",
|
||||
description = "Set Password Policy") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-password-policy")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -1624,7 +1708,7 @@ public interface DeviceManagementAdminService {
|
||||
PasswordPolicyBeanWrapper passwordPolicyBeanWrapper);
|
||||
|
||||
@POST
|
||||
@Path("set-webclip")
|
||||
@Path("/set-webclip")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
@ -1632,13 +1716,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/android/webclip",
|
||||
description = "Add Webclips") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:set-webclip")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
|
||||
@ -18,22 +18,14 @@
|
||||
*/
|
||||
package org.wso2.carbon.mdm.services.android.services;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Info;
|
||||
import io.swagger.annotations.ResponseHeader;
|
||||
import io.swagger.annotations.SwaggerDefinition;
|
||||
import io.swagger.annotations.Tag;
|
||||
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 javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@ -64,7 +56,7 @@ import java.util.List;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Android Device Management",
|
||||
@ -72,6 +64,22 @@ import java.util.List;
|
||||
@Path("/devices")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll Device",
|
||||
description = "Register an Android device",
|
||||
key = "perm:android:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/android"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Un-enroll Device",
|
||||
description = "Unregister an Android device",
|
||||
key = "perm:android:disenroll",
|
||||
permissions = {"/device-mgt/devices/disenroll/android"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface DeviceManagementService {
|
||||
|
||||
@PUT
|
||||
@ -83,12 +91,10 @@ public interface DeviceManagementService {
|
||||
value = "Updating the Application Details on Android Devices",
|
||||
notes = "Update the details of the applications that are installed on Android devices.",
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -150,12 +156,10 @@ public interface DeviceManagementService {
|
||||
"The server then updates the status of the operations that were carried out on the device.",
|
||||
response = Operation.class,
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -216,12 +220,10 @@ public interface DeviceManagementService {
|
||||
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
|
||||
" an Android Agent. This API can be mainly used to test the device enrollment process.",
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -273,12 +275,10 @@ public interface DeviceManagementService {
|
||||
value = "Getting the Registration Status of an Android Device",
|
||||
notes = "Use this REST API to retrieve the registration status of an Android device.",
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -328,12 +328,10 @@ public interface DeviceManagementService {
|
||||
value = "Updating the Registration Details of an Android Device",
|
||||
notes = "Use this REST API to update the registration details of an Android device.",
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
@ -386,11 +384,10 @@ public interface DeviceManagementService {
|
||||
value = "Unregistering an Android Device",
|
||||
notes = "Use this REST API to unregister an Android device.",
|
||||
tags = "Android Device Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/disenroll/android", description = "Disenroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:disenroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
|
||||
@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
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.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 javax.validation.Valid;
|
||||
import javax.ws.rs.*;
|
||||
@ -54,13 +55,35 @@ import javax.ws.rs.core.Response;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.")
|
||||
@Path("/configuration")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll Device",
|
||||
description = "Register an Android device",
|
||||
key = "perm:android:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/android"}
|
||||
),
|
||||
@Scope(
|
||||
name = "View Configurations",
|
||||
description = "Getting Android Platform Configurations",
|
||||
key = "perm:android:view-configuration",
|
||||
permissions = {"/device-mgt/platform-configurations/view"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Manage Configurations",
|
||||
description = "Updating Android Platform Configurations",
|
||||
key = "perm:android:manage-configuration",
|
||||
permissions = {"/device-mgt/platform-configurations/manage"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface DeviceTypeConfigurationService {
|
||||
|
||||
@GET
|
||||
@ -71,12 +94,10 @@ public interface DeviceTypeConfigurationService {
|
||||
notes = "Get the Android platform configuration details using this REST API.",
|
||||
response = PlatformConfiguration.class,
|
||||
tags = "Android Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
|
||||
description = "View Configurations") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:view-configuration")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -127,12 +148,10 @@ public interface DeviceTypeConfigurationService {
|
||||
value = "Updating Android Platform Configurations",
|
||||
notes = "Update the Android platform configurations using this REST API.",
|
||||
tags = "Android Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/manage",
|
||||
description = "Manage Configurations") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:manage-configuration")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -184,12 +203,10 @@ public interface DeviceTypeConfigurationService {
|
||||
"registration process.",
|
||||
response = String.class,
|
||||
tags = "Android Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Enroll Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
|
||||
@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty;
|
||||
import io.swagger.annotations.Extension;
|
||||
import io.swagger.annotations.Tag;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
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 javax.validation.Valid;
|
||||
import javax.validation.constraints.Size;
|
||||
@ -52,7 +53,7 @@ import javax.ws.rs.core.Response;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" +
|
||||
@ -61,6 +62,16 @@ import javax.ws.rs.core.Response;
|
||||
@Path("/events")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll Device",
|
||||
description = "Register an Android device",
|
||||
key = "perm:android:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/android"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface EventReceiverService {
|
||||
|
||||
@POST
|
||||
@ -72,12 +83,10 @@ public interface EventReceiverService {
|
||||
value = "Publishing Events",
|
||||
notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.",
|
||||
tags = "Event Receiver",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Publish Events to DAS") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
@ -137,12 +146,10 @@ public interface EventReceiverService {
|
||||
response = DeviceState.class,
|
||||
responseContainer = "List",
|
||||
tags = "Event Receiver",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
|
||||
description = "Publish Events to DAS") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
|
||||
@ -26,6 +26,7 @@ public final class AndroidConstants {
|
||||
public static final String DEVICE_TYPE_ANDROID = "android";
|
||||
public static final String HEADER_CONTENT_TYPE = "Content-Type";
|
||||
public static final String APPLICATION_JSON = "application/json";
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
public final class DeviceProperties {
|
||||
private DeviceProperties() {
|
||||
|
||||
@ -23,13 +23,13 @@
|
||||
<parent>
|
||||
<artifactId>android-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.mobile.android.ui</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<name>WSO2 Carbon - Mobile Android UI</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@ under the License. --}}
|
||||
<div class="row">
|
||||
<div class="col-md-4 wr-text">
|
||||
If you have not already enrolled this device with {{companyName}},
|
||||
Download and install following EMM Agent to continue.
|
||||
Download and install following IoT Server Agent to continue.
|
||||
<div class="wr-buttons">
|
||||
<a href="{{agentDownloadURL}}" class="btn-download-agent">Download EMM Agent</a>
|
||||
<a href="{{agentDownloadURL}}" class="btn-download-agent">Download IoT Server Agent</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -336,6 +336,13 @@
|
||||
<div id="device-location"
|
||||
data-lat="{{device.location.latitude}}"
|
||||
data-long="{{device.location.longitude}}">
|
||||
<a class="padding-left"
|
||||
href="{{portalUrl}}/portal/dashboards/geo-dashboard/?GLOBAL-STATE={{anchor}}">
|
||||
|
||||
<span class="fw-fw-map-location">
|
||||
<i class="fw fw-map-location fw-2x"></i>
|
||||
</span> View device on the map
|
||||
</a>
|
||||
</div>
|
||||
{{else}}
|
||||
<div id="map-error" class="message message-warning">
|
||||
|
||||
@ -21,6 +21,7 @@ function onRequest(context) {
|
||||
var deviceType = context["uriParams"]["deviceType"];
|
||||
var deviceId = request.getParameter("id");
|
||||
var deviceViewData = {};
|
||||
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
|
||||
if (deviceType && deviceId) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
@ -210,5 +211,9 @@ function onRequest(context) {
|
||||
];
|
||||
|
||||
deviceViewData["autoCompleteParams"] = autoCompleteParams;
|
||||
|
||||
deviceViewData["portalUrl"] = devicemgtProps['portalURL'];
|
||||
var anchor = { "device" : { "id" : deviceId, "type" : deviceType}};
|
||||
deviceViewData["anchor"] = JSON.stringify(anchor);
|
||||
return deviceViewData;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="android-config-notifier">
|
||||
Type of Communication
|
||||
<span class="helper" title="Communication method of android agent to contact EMM server">
|
||||
<span class="helper" title="Communication method of android agent to contact IoT Server">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
</label>
|
||||
@ -42,7 +42,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="android-config-notifier-frequency">
|
||||
Polling Interval*
|
||||
<span class="helper" title="Time interval after which Android agent will contact EMM server each time to fetch data">
|
||||
<span class="helper" title="Time interval after which Android agent will contact IoT Server each time to fetch data">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
@ -1137,7 +1137,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
|
||||
Profile Name
|
||||
<span class="helper" title="Name of the Work-Profile created by EMM Agent">
|
||||
<span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
@ -1243,7 +1243,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
|
||||
Profile Name
|
||||
<span class="helper" title="Name of the Work-Profile created by EMM Agent">
|
||||
<span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
@ -1137,7 +1137,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="work-profile-policy-max-passcode-age-in-days">
|
||||
Profile Name
|
||||
<span class="helper" title="Name of the Work-Profile created by EMM Agent">
|
||||
<span class="helper" title="Name of the Work-Profile created by IoT Server Agent">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<artifactId>android-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@ -59,6 +59,7 @@
|
||||
org.osgi.framework,
|
||||
org.osgi.service.component,
|
||||
org.apache.commons.logging,
|
||||
javax.xml,
|
||||
javax.xml.bind.*,
|
||||
javax.sql,
|
||||
javax.xml.parsers; version=0.0.0,
|
||||
|
||||
@ -38,6 +38,7 @@ import org.wso2.carbon.registry.api.RegistryException;
|
||||
import org.wso2.carbon.registry.api.Resource;
|
||||
import org.wso2.carbon.registry.core.Registry;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.File;
|
||||
@ -66,6 +67,7 @@ public class MobileDeviceManagementUtil {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
try {
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||
return docBuilder.parse(file);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>mobile-plugins</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>windows-plugin</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<version>3.0.5-SNAPSHOT</version>
|
||||
<version>3.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@ -218,6 +218,8 @@ public final class PluginConstants {
|
||||
public static final String BATTERY_CHARGE_REMAINING = "BATTERY_CHARGE_REMAINING";
|
||||
public static final String BATTERY_ESTIMATED_RUNTIME = "BATTERY_ESTIMATED_RUNTIME";
|
||||
public static final String MOBILE_ID = "MOBILE_ID";
|
||||
public static final String LONGITUDE = "LONGITUDE";
|
||||
public static final String LATITUDE = "LATITUDE";
|
||||
|
||||
}
|
||||
|
||||
@ -267,6 +269,11 @@ public final class PluginConstants {
|
||||
public static final String DEVICE_PASSWORD_STATUS = "DEVICE_PASSWORD_STATUS";
|
||||
public static final String DEVICE_PASSCODE_DELETE = "DEVICE_PASSCODE_DELETE";
|
||||
public static final String DEVICE_INFO = "DEVICE_INFO";
|
||||
public static final String POLICY_REVOKE = "POLICY_REVOKE";
|
||||
public static final String DEVICE_LOCATION = "DEVICE_LOCATION";
|
||||
public static final String LONGITUDE = "LONGITUDE";
|
||||
public static final String LATITUDE = "LATITUDE";
|
||||
public static final String DEVICE_REBOOT = "DEVICE_REBOOT";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -82,13 +82,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
|
||||
|
||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||
try {
|
||||
Type jsonType;
|
||||
if (type.equals(type)) {
|
||||
jsonType = type;
|
||||
} else {
|
||||
jsonType = type;
|
||||
}
|
||||
getGson().toJson(object, jsonType, writer);
|
||||
getGson().toJson(object, type, writer);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
|
||||
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.device.details.DeviceInfo;
|
||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
@ -187,10 +188,10 @@ public class WindowsAPIUtils {
|
||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
AuthenticatorConfigService authenticatorConfigService =
|
||||
(AuthenticatorConfigService) ctx.getOSGiService(AuthenticatorConfigService.class, null);
|
||||
AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST");
|
||||
if (authenticatorConfigService == null) {
|
||||
throw new IllegalStateException("AuthenticatorConfiguration service has not initialized.");
|
||||
}
|
||||
AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST");
|
||||
if (authenticatorConfig == null) {
|
||||
throw new IllegalStateException("BST authenticatorConfig has not initialized.");
|
||||
}
|
||||
@ -239,4 +240,16 @@ public class WindowsAPIUtils {
|
||||
(DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null);
|
||||
informationManager.addDeviceInfo(deviceId, deviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to update device location.
|
||||
* @param deviceLocation Device coordination related information.
|
||||
* @throws DeviceDetailsMgtException Error occurs while updating Device location.
|
||||
*/
|
||||
public static void updateDeviceLocation(DeviceLocation deviceLocation) throws DeviceDetailsMgtException {
|
||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
DeviceInformationManager informationManager =
|
||||
(DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null);
|
||||
informationManager.addDeviceLocation(deviceLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,8 @@ public class Constants {
|
||||
public static final String META_FORMAT_INT = "int";
|
||||
public static final String META_FORMAT_CHARACTER = "chr";
|
||||
|
||||
public static final String SCOPE = "scope";
|
||||
|
||||
/**
|
||||
* SynclML service related constants.
|
||||
*/
|
||||
|
||||
@ -43,8 +43,6 @@ public class OperationCode {
|
||||
ENCRYPT_STORAGE_STATUS("./Vendor/MSFT/PolicyManager/Device/Security/RequireDeviceEncryption"),
|
||||
DEVICE_PASSWORD_STATUS("./Vendor/MSFT/PolicyManager/Device/DeviceLock/DevicePasswordEnabled"),
|
||||
DEVICE_PASSCODE_DELETE("./Vendor/MSFT/PolicyManager/My/DeviceLock"),
|
||||
LONGITUDE("./Vendor/MSFT/RemoteFind/Location/Longitude"),
|
||||
LATITUDE("./Vendor/MSFT/RemoteFind/Location/Latitude"),
|
||||
|
||||
// Windows10 operation codes
|
||||
TOTAL_RAM("./DevDetail/Ext/Microsoft/TotalRAM"),
|
||||
@ -56,6 +54,8 @@ public class OperationCode {
|
||||
BATTERY_STATUS("./Vendor/MSFT/DeviceStatus/Battery/Status"),
|
||||
BATTERY_CHARGE_REMAINING("./Vendor/MSFT/DeviceStatus/Battery/EstimatedChargeRemaining"),
|
||||
BATTERY_ESTIMATED_RUNTIME("./Vendor/MSFT/DeviceStatus/Battery/EstimatedRuntime"),
|
||||
LONGITUDE("./Vendor/MSFT/RemoteFind/Location/Longitude"),
|
||||
LATITUDE("./Vendor/MSFT/RemoteFind/Location/Latitude"),
|
||||
TEST("./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors");
|
||||
private final String code;
|
||||
|
||||
@ -91,7 +91,10 @@ public class OperationCode {
|
||||
BATTERY_STATUS("./Vendor/MSFT/DeviceStatus/Battery/Status"),
|
||||
BATTERY_CHARGE_REMAINING("./Vendor/MSFT/DeviceStatus/Battery/EstimatedChargeRemaining"),
|
||||
BATTERY_ESTIMATED_RUNTIME("./Vendor/MSFT/DeviceStatus/Battery/EstimatedRuntime"),
|
||||
TEST("./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors");
|
||||
LONGITUDE("./Vendor/MSFT/RemoteFind/Location/Longitude"),
|
||||
LATITUDE("./Vendor/MSFT/RemoteFind/Location/Latitude"),
|
||||
TEST("./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors"),
|
||||
DEVICE_REBOOT("./Vendor/MSFT/Reboot/RebootNow");
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
@ -25,11 +25,13 @@ import org.json.JSONObject;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
|
||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
|
||||
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.device.details.mgt.DeviceDetailsMgtException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Profile;
|
||||
@ -181,7 +183,7 @@ public class OperationHandler {
|
||||
if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) {
|
||||
pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier);
|
||||
for (Operation operation : pendingDataOperations) {
|
||||
if ((OperationCode.Command.DEVICE_RING.equals(operation.getCode())) &&
|
||||
if ((OperationCode.Command.DEVICE_RING.getCode().equals(operation.getCode())) &&
|
||||
(operation.getId() == status.getCommandReference())) {
|
||||
operation.setStatus(Operation.Status.COMPLETED);
|
||||
updateStatus(syncmlDocument.getHeader().getSource().getLocURI(),
|
||||
@ -213,7 +215,7 @@ public class OperationHandler {
|
||||
}
|
||||
for (Operation operation : pendingDataOperations) {
|
||||
|
||||
if ((OperationCode.Command.WIPE_DATA.equals(operation.getCode())) &&
|
||||
if ((OperationCode.Command.WIPE_DATA.getCode().equals(operation.getCode())) &&
|
||||
(operation.getId() == status.getCommandReference())) {
|
||||
operation.setStatus(Operation.Status.COMPLETED);
|
||||
updateStatus(syncmlDocument.getHeader().getSource().getLocURI(),
|
||||
@ -239,6 +241,33 @@ public class OperationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDeviceLocationStatus(SyncmlDocument syncmlDocument) throws OperationManagementException {
|
||||
List<? extends Operation> pendingDataOperations;
|
||||
List<StatusTag> statuses = syncmlDocument.getBody().getStatus();
|
||||
DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(
|
||||
syncmlDocument.getHeader().getSource().getLocURI());
|
||||
try {
|
||||
pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier);
|
||||
} catch (DeviceManagementException e) {
|
||||
throw new OperationManagementException("Error occurred in getting pending operation.");
|
||||
}
|
||||
for (Operation operation : pendingDataOperations) {
|
||||
if (PluginConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) {
|
||||
for (StatusTag statusTag : statuses) {
|
||||
if (Constants.GET.equals(statusTag.getCommand()) && statusTag.getTargetReference() != null
|
||||
&& OperationCode.Command.LATITUDE.getCode().equals(statusTag.getTargetReference())) {
|
||||
if (Constants.SyncMLResponseCodes.ACCEPTED.equals(statusTag.getData())) {
|
||||
operation.setStatus(Operation.Status.COMPLETED);
|
||||
} else {
|
||||
operation.setStatus(Operation.Status.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateStatus(syncmlDocument.getHeader().getSource().getLocURI(),
|
||||
pendingDataOperations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pending operations.
|
||||
@ -253,12 +282,18 @@ public class OperationHandler {
|
||||
SyncmlBody syncmlBody = syncmlDocument.getBody();
|
||||
List<? extends Operation> pendingOperations;
|
||||
DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlHeader.getSource().getLocURI());
|
||||
int sessionId = syncmlHeader.getSessionId();
|
||||
int msgId = syncmlHeader.getMsgID();
|
||||
if (!(PluginConstants.SyncML.SYNCML_FIRST_MESSAGE_ID == msgId &&
|
||||
PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) {
|
||||
if ((syncmlBody.getResults() != null)) {
|
||||
updateDeviceInfo(syncmlDocument);
|
||||
List<StatusTag> statuses = syncmlBody.getStatus();
|
||||
for (StatusTag status : statuses ) {
|
||||
if (OperationCode.Command.LATITUDE.getCode().equals(status.getTargetReference()) &&
|
||||
Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData())) {
|
||||
updateLocation(syncmlDocument);
|
||||
}
|
||||
|
||||
if (OperationCode.Command.TOTAL_RAM.getCode().equals(status.getTargetReference()) &&
|
||||
Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData())) {
|
||||
if ((syncmlBody.getResults() != null)) {
|
||||
updateDeviceInfo(syncmlDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateUriOperations(syncmlDocument);
|
||||
@ -306,13 +341,13 @@ public class OperationHandler {
|
||||
if (status.getTargetReference() == null) {
|
||||
updateDeviceOperations(status, syncmlDocument, deviceIdentifier);
|
||||
} else {
|
||||
if ((OperationCode.Command.DEVICE_LOCK.equals(status.getTargetReference()))) {
|
||||
if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(status.getTargetReference()))) {
|
||||
updateLockOperation(status, syncmlDocument, deviceIdentifier);
|
||||
}
|
||||
if ((OperationCode.Command.DEVICE_RING.equals(status.getTargetReference()))) {
|
||||
if ((OperationCode.Command.DEVICE_RING.getCode().equals(status.getTargetReference()))) {
|
||||
ring(status, syncmlDocument, deviceIdentifier);
|
||||
}
|
||||
if (equals(OperationCode.Command.WIPE_DATA.equals(status.getTargetReference()))) {
|
||||
if ((OperationCode.Command.WIPE_DATA.getCode().equals(status.getTargetReference()))) {
|
||||
dataWipe(status, syncmlDocument, deviceIdentifier);
|
||||
}
|
||||
}
|
||||
@ -568,4 +603,33 @@ public class OperationHandler {
|
||||
throw new WindowsOperationException("Error occurred while updating Device info operation status.");
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLocation(SyncmlDocument syncmlDocument) throws WindowsOperationException {
|
||||
List<ItemTag> deviceInformations = syncmlDocument.getBody().getResults().getItem();
|
||||
DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(
|
||||
syncmlDocument.getHeader().getSource().getLocURI());
|
||||
|
||||
DeviceLocation deviceLocation = new DeviceLocation();
|
||||
deviceLocation.setDeviceIdentifier(deviceIdentifier);
|
||||
for (ItemTag item : deviceInformations) {
|
||||
String source = item.getSource().getLocURI();
|
||||
if (OperationCode.Info.LONGITUDE.getCode().equals(source)) {
|
||||
String longitude = item.getData();
|
||||
deviceLocation.setLongitude(Double.parseDouble(longitude));
|
||||
}
|
||||
if (OperationCode.Info.LATITUDE.getCode().equals(source)) {
|
||||
Double latitude = Double.parseDouble(item.getData());
|
||||
deviceLocation.setLatitude(latitude);
|
||||
}
|
||||
}
|
||||
try {
|
||||
WindowsAPIUtils.updateDeviceLocation(deviceLocation);
|
||||
updateDeviceLocationStatus(syncmlDocument);
|
||||
} catch (DeviceDetailsMgtException e) {
|
||||
throw new WindowsOperationException("Error occurred while updating Device Location.");
|
||||
} catch (OperationManagementException e) {
|
||||
throw new WindowsOperationException("Error occurred while updating Device Location operation status.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,6 @@ public class OperationReply {
|
||||
List<ItemTag> replaceItems = new ArrayList<>();
|
||||
SequenceTag monitorSequence = new SequenceTag();
|
||||
List<Operation> deviceInfoOperations;
|
||||
|
||||
if (operations != null) {
|
||||
for (Operation operation : operations) {
|
||||
Operation.Type type = operation.getType();
|
||||
@ -293,6 +292,23 @@ public class OperationReply {
|
||||
SequenceTag sequence = buildSequence(operation, sequenceElement);
|
||||
syncmlBody.setSequence(sequence);
|
||||
}
|
||||
if (PluginConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) {
|
||||
Operation longitudeOperation = new Operation();
|
||||
Operation latitudeOperation = new Operation();
|
||||
longitudeOperation.setCode(PluginConstants.OperationCodes.LONGITUDE);
|
||||
latitudeOperation.setCode(PluginConstants.OperationCodes.LATITUDE);
|
||||
List<Operation> deviceLocationOperations = new ArrayList<>();
|
||||
deviceLocationOperations.add(latitudeOperation);
|
||||
deviceLocationOperations.add(longitudeOperation);
|
||||
for (Operation infoOperation : deviceLocationOperations) {
|
||||
ItemTag deviceInfo = appendGetInfo(infoOperation);
|
||||
getElements.add(deviceInfo);
|
||||
}
|
||||
}
|
||||
if (PluginConstants.OperationCodes.DEVICE_REBOOT.equals(operation.getCode())) {
|
||||
execElement = executeCommand(operation);
|
||||
executeElements.add(execElement);
|
||||
}
|
||||
if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode()))) {
|
||||
GetTag monitorGetElement = new GetTag();
|
||||
List<ItemTag> monitorItems;
|
||||
@ -561,8 +577,7 @@ public class OperationReply {
|
||||
return execElement;
|
||||
}
|
||||
|
||||
public SequenceTag buildSequence(Operation operation, SequenceTag sequenceElement) throws
|
||||
JSONException,
|
||||
public SequenceTag buildSequence(Operation operation, SequenceTag sequenceElement) throws JSONException,
|
||||
SyncmlOperationException {
|
||||
|
||||
sequenceElement.setCommandId(operation.getId());
|
||||
@ -580,7 +595,6 @@ public class OperationReply {
|
||||
sequenceElement.setExec(execElement);
|
||||
sequenceElement.setGet(getElements);
|
||||
return sequenceElement;
|
||||
|
||||
} else if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode()))) {
|
||||
List<? extends Operation> policyOperations;
|
||||
try {
|
||||
|
||||
@ -32,9 +32,12 @@ import io.swagger.annotations.ApiResponse;
|
||||
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.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import javax.ws.rs.*;
|
||||
@ -59,15 +62,37 @@ import javax.ws.rs.core.Response;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_windows", description = "")
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows Configuration Management",
|
||||
description = "This carries all the resources related to Windows configurations management functionalities")
|
||||
description = "This carries all the resources related to Windows configurations management functionality")
|
||||
@WebService
|
||||
@Path("/configuration")
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Produces({"application/json", "application/xml"})
|
||||
@Consumes({"application/json", "application/xml"})
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll Device",
|
||||
description = "Register an Windows device",
|
||||
key = "perm:windows:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/windows"}
|
||||
),
|
||||
@Scope(
|
||||
name = "View Configurations",
|
||||
description = "Getting Windows Platform Configurations",
|
||||
key = "perm:windows:view-configuration",
|
||||
permissions = {"/device-mgt/platform-configurations/view"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Manage Configurations",
|
||||
description = "Updating Windows Platform Configurations",
|
||||
key = "perm:windows:manage-configuration",
|
||||
permissions = {"/device-mgt/platform-configurations/manage"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface ConfigurationMgtService {
|
||||
|
||||
@GET
|
||||
@ -78,12 +103,10 @@ public interface ConfigurationMgtService {
|
||||
notes = "Get the Windows platform configuration details using this REST API.",
|
||||
response = PlatformConfiguration.class,
|
||||
tags = "Windows Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
|
||||
description = "View Configurations")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:view-configuration")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -139,12 +162,10 @@ public interface ConfigurationMgtService {
|
||||
value = "Updating Windows Platform Configurations",
|
||||
notes = "Update the Windows platform configurations using this REST API.",
|
||||
tags = "Windows Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(scope = "/device-mgt/configurations/manage",
|
||||
description = "Manage Configurations")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:manage-configuration")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -197,12 +218,10 @@ public interface ConfigurationMgtService {
|
||||
"registration process.",
|
||||
response = String.class,
|
||||
tags = "Windows Configuration Management",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
|
||||
description = "Enroll Device")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
|
||||
@ -19,9 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.windows.api.services;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.apimgt.annotations.api.Permission;
|
||||
|
||||
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.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import javax.ws.rs.Consumes;
|
||||
@ -58,9 +61,55 @@ import java.util.List;
|
||||
@Api(value = "Windows Device Management Administrative Service",
|
||||
description = "Device management related admin APIs.")
|
||||
@WebService
|
||||
@Path("/operation/admin/devices")
|
||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Path("/admin/devices")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Lock Device",
|
||||
description = "Adding a Device Lock on Windows devices.",
|
||||
key = "perm:windows:lock-devices",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/lock"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Un-enroll Device",
|
||||
description = "Unregister an Windows device",
|
||||
key = "perm:windows:disenroll",
|
||||
permissions = {"/device-mgt/devices/disenroll/windows"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Factory Reset",
|
||||
description = "Factory Resetting Windows Devices",
|
||||
key = "perm:windows:wipe",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/wipe"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Ring Device",
|
||||
description = "Ring Windows devices",
|
||||
key = "perm:windows:ring",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/ring"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Lock Reset",
|
||||
description = "Lock reset on Windows devices",
|
||||
key = "perm:windows:lock-reset",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/lock-reset"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Reboot",
|
||||
description = "Lock reset on Windows devices",
|
||||
key = "perm:windows:reboot",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/reboot"}
|
||||
),
|
||||
@Scope(
|
||||
name = "Device Location",
|
||||
description = "Lock reset on Windows devices",
|
||||
key = "perm:windows:location",
|
||||
permissions = {"/device-mgt/devices/owning-device/operations/windows/location"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface DeviceManagementAdminService {
|
||||
|
||||
@POST
|
||||
@ -72,13 +121,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Using this API you have the option of Device Windows device.",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/windows/lock",
|
||||
description = "Lock Device")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-devices")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -134,13 +180,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Dis-enroll on Android devices",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service.",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(
|
||||
scope = "/device-mgt/devices/disenroll/windows",
|
||||
description = "Dis-enroll the windows devices ")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:disenroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -198,13 +241,10 @@ public interface DeviceManagementAdminService {
|
||||
"to restore them back to the original system.",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/windows/wipe",
|
||||
description = "DeviceWipe")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:wipe")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -259,13 +299,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Ring Windows devices.",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/windows/ring",
|
||||
description = "Ring Device") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:ring")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -321,13 +358,10 @@ public interface DeviceManagementAdminService {
|
||||
notes = "Lock reset on Windows devices.Its use to reset the device pass code",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value="permission",
|
||||
scopes = { @AuthorizationScope(
|
||||
scope = "/device-mgt/devices/owning-device/operations/windows/lock-reset",
|
||||
description = "Lock reset") }
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-reset")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ -373,4 +407,134 @@ public interface DeviceManagementAdminService {
|
||||
value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " +
|
||||
"using comma separated values. ",
|
||||
required = true) List<String> deviceIds) throws WindowsDeviceEnrolmentException;
|
||||
|
||||
@POST
|
||||
@Path("/location")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Requesting Location Coordinates",
|
||||
responseContainer = "List",
|
||||
notes = "Request location coordinates of Windows devices. \n" +
|
||||
"Example: In situations where you have lost your device and need to find out where it is, " +
|
||||
"you can use this REST API to get the location of the device.",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:location")
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 201,
|
||||
message = "Created. \n Get-location operation has successfully been scheduled",
|
||||
response = Activity.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "URL of the activity instance that refers to the " +
|
||||
"scheduled operation."),
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "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 was last modified.\n" +
|
||||
"Used by caches, or in conditional requests.")}),
|
||||
@ApiResponse(
|
||||
code = 303,
|
||||
message = "See Other. \n The source can be retrieved from the URL specified in the" +
|
||||
" location header.",
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "The Source URL of the document.")}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid request or validation error."),
|
||||
@ApiResponse(
|
||||
code = 415,
|
||||
message = "Unsupported media type. \n The format of the requested entity was not supported."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n " +
|
||||
"Server error occurred while adding a new get-location operation.")})
|
||||
Response getDeviceLocation(
|
||||
@ApiParam(
|
||||
name = "deviceIDs",
|
||||
value = "Provide the ID of the Windows device. Multiple device IDs can be added by " +
|
||||
"using comma separated values. ",
|
||||
required = true)
|
||||
List<String> deviceIDs);
|
||||
|
||||
@POST
|
||||
@Path("/reboot")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Rebooting Windows Devices",
|
||||
notes = "Reboot or restart your Windows devices.",
|
||||
response = Activity.class,
|
||||
tags = "Windows Device Management Administrative Service",
|
||||
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:reboot")
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 201,
|
||||
message = "Created. \n Successfully scheduled the device reboot operation.",
|
||||
response = Activity.class,
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "URL of the activity instance that refers to the scheduled operation."),
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "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 was last modified.\n" +
|
||||
"Used by caches, or in conditional requests.")}),
|
||||
@ApiResponse(
|
||||
code = 303,
|
||||
message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n",
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "The Source URL of the document.")}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid request or validation error."),
|
||||
@ApiResponse(
|
||||
code = 415,
|
||||
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n " +
|
||||
"Server error occurred while adding the new device reboot operation.")
|
||||
})
|
||||
Response rebootDevice(
|
||||
@ApiParam(
|
||||
name = "deviceIDs",
|
||||
value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ",
|
||||
required = true)
|
||||
List<String> deviceIDs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ import javax.ws.rs.core.Response;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for Syncml message flow.
|
||||
* Interface for Windows 10 Device management phase.
|
||||
*/
|
||||
@SwaggerDefinition(
|
||||
info = @Info(
|
||||
@ -44,18 +44,18 @@ import javax.ws.rs.core.Response;
|
||||
title = "",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "Syncml Endpoint"),
|
||||
@ExtensionProperty(name = "name", value = "Windows 10 Device management"),
|
||||
@ExtensionProperty(name = "context",
|
||||
value = "/api/device-mgt/windows/v1.0/syncmlmgt"),
|
||||
value = "/api/device-mgt/windows/v1.0/management"),
|
||||
})
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_windows", description = "")
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows syncml service to initialize management session",
|
||||
description = "This carries all the resources related to Windows syncml message flow.")
|
||||
@Api(value = "Windows 10 Device management",
|
||||
description = "This carries all the resources related to Windows 10 management session message flow.")
|
||||
@Path("/devicemgt")
|
||||
public interface DeviceManagementService {
|
||||
@Path("/pending-operations")
|
||||
|
||||
@ -19,8 +19,11 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.apimgt.annotations.api.Permission;
|
||||
|
||||
import org.wso2.carbon.apimgt.annotations.api.Scope;
|
||||
import org.wso2.carbon.apimgt.annotations.api.Scopes;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials;
|
||||
|
||||
import javax.jws.WebService;
|
||||
@ -41,28 +44,37 @@ import javax.ws.rs.core.Response;
|
||||
title = "",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "Windows Binary security token provider"),
|
||||
@ExtensionProperty(name = "name", value = "Windows Binary Security Token Service"),
|
||||
@ExtensionProperty(name = "context",
|
||||
value = "/api/device-mgt/windows/v1.0/federated"),
|
||||
})
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_windows", description = "")
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows BST Management",
|
||||
@Api(value = "Windows Binary Security Token Service",
|
||||
description = "This carries all the resources related to Windows Binary security token management.")
|
||||
@WebService
|
||||
@Path("/bst")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
@Consumes({"application/json", "application/xml"})
|
||||
@Scopes(
|
||||
scopes = {
|
||||
@Scope(
|
||||
name = "Enroll Device",
|
||||
description = "Register Windows device",
|
||||
key = "perm:windows:enroll",
|
||||
permissions = {"/device-mgt/devices/enroll/windows"}
|
||||
)
|
||||
}
|
||||
)
|
||||
public interface BSTProvider {
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/authentication")
|
||||
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows")
|
||||
@ApiOperation(
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
@ -70,13 +82,10 @@ public interface BSTProvider {
|
||||
value = "Getting Binary security token.",
|
||||
notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.",
|
||||
tags = "BST Provider",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
|
||||
description = "Getting Binary security token for Windows enrollment " +
|
||||
"and policy endpoints.")}
|
||||
)
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
|
||||
@ -48,17 +48,17 @@ import javax.xml.ws.soap.SOAPBinding;
|
||||
title = "",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "Windows Discovery service provider"),
|
||||
@ExtensionProperty(name = "name", value = "Windows Discovery Service"),
|
||||
@ExtensionProperty(name = "context",
|
||||
value = "/api/device-mgt/windows/v1.0/discovery/post"),
|
||||
})
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_windows", description = "")
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows Discovery service",
|
||||
@Api(value = "Windows Discovery Service",
|
||||
description = "This carries all the resources related to Windows Discovery service.")
|
||||
@WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE,
|
||||
name = "IDiscoveryService")
|
||||
@ -133,54 +133,4 @@ public interface DiscoveryService {
|
||||
javax.xml.ws.Holder<DiscoveryResponse> response
|
||||
) throws WindowsDeviceEnrolmentException;
|
||||
|
||||
|
||||
@ApiOperation(
|
||||
httpMethod = "GET",
|
||||
value = "Device ping the server to check whether it is running or not.",
|
||||
notes = ".",
|
||||
tags = "Windows Discovery service.",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
|
||||
description = "Ping the Discovery service")}
|
||||
)
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK. \n Server is already running."),
|
||||
@ApiResponse(
|
||||
code = 303,
|
||||
message = "See Other. \n The source can be retrieved from the URL specified " +
|
||||
"in the location header.",
|
||||
responseHeaders = {
|
||||
@ResponseHeader(name = "Content-Location",
|
||||
description = "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. You must provide" +
|
||||
" the device identifier. Additionally, the device identifier can be combined" +
|
||||
" with either the device type" +
|
||||
" OR the from and to date."),
|
||||
@ApiResponse(
|
||||
code = 404,
|
||||
message = "Not Found. \n The specified resource does not exist."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Error occurred while pinging the server.")
|
||||
})
|
||||
@GET
|
||||
@WebMethod
|
||||
@WebResult()
|
||||
Response discoverGet();
|
||||
|
||||
}
|
||||
@ -101,21 +101,6 @@ public class DiscoveryServiceImpl implements DiscoveryService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the first method called through device. The device checks the availability of the
|
||||
* Service end point by calling this method.
|
||||
*
|
||||
* @return - HTTP 200OK message
|
||||
*/
|
||||
@Override
|
||||
public Response discoverGet() {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Discovery service end point was triggered via GET method.");
|
||||
}
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentication policy from the tenant configuration, otherwise set default value as Federated.
|
||||
*
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
|
||||
@ -27,12 +28,32 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.R
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.xml.ws.BindingType;
|
||||
import javax.xml.ws.RequestWrapper;
|
||||
import javax.xml.ws.ResponseWrapper;
|
||||
import javax.xml.ws.soap.SOAPBinding;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@SwaggerDefinition(
|
||||
info = @Info(
|
||||
version = "1.0.0",
|
||||
title = "",
|
||||
extensions = {
|
||||
@io.swagger.annotations.Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "Windows 10 Enrollment Service"),
|
||||
@ExtensionProperty(name = "context",
|
||||
value = "/api/device-mgt/windows/v1.0/deviceenrolment/enrollment"),
|
||||
})
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows 10 Enrollment Service",
|
||||
description = "This carries all the resources related to Windows enrollment.")
|
||||
|
||||
@WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "enrollment")
|
||||
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
|
||||
public interface EnrollmentService {
|
||||
@ -42,6 +63,60 @@ public interface EnrollmentService {
|
||||
@WebMethod(operationName = "RequestSecurityToken")
|
||||
@ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace =
|
||||
PluginConstants.WS_TRUST_TARGET_NAMESPACE)
|
||||
@POST
|
||||
@ApiOperation(
|
||||
httpMethod = "POST",
|
||||
value = "Signing the certificate signing request(CSR) and provide request security token response.",
|
||||
notes = "Using this API to fetching more information to enroll the Device and " +
|
||||
"getting pending operations.",
|
||||
tags = "Windows 10 Device Enrollment Service.",
|
||||
authorizations = {
|
||||
@Authorization(
|
||||
value = "permission",
|
||||
scopes = {@AuthorizationScope(
|
||||
scope = "/device-mgt/devices/enroll/windows",
|
||||
description = "Signing the certificate signing request(CSR) " +
|
||||
"and provide request security token response")}
|
||||
)
|
||||
}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "Ok.Successfully signed the CSR.",
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "URL of the activity instance that refers to the scheduled operation."),
|
||||
@ResponseHeader(
|
||||
name = "Content-Type",
|
||||
description = "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 was last modified. \n" +
|
||||
"Used by caches, or in conditional requests.")}),
|
||||
@ApiResponse(
|
||||
code = 303,
|
||||
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
|
||||
responseHeaders = {
|
||||
@ResponseHeader(
|
||||
name = "Content-Location",
|
||||
description = "The Source URL of the document.")}),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid request or validation error."),
|
||||
@ApiResponse(
|
||||
code = 415,
|
||||
message = "Unsupported media type. \n The format of the requested entity was not supported.\n"),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n " +
|
||||
"Server error occurred while Signing the CSR.")
|
||||
})
|
||||
void requestSecurityToken(
|
||||
@WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
|
||||
String tokenType,
|
||||
|
||||
@ -25,9 +25,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ContextItem", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE,
|
||||
propOrder = {"Name" , "Value"})
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
@XmlType(name = "ContextItem", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE)
|
||||
public class ContextItem {
|
||||
|
||||
@XmlElement(required = true, namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE)
|
||||
|
||||
@ -51,6 +51,7 @@ import org.xml.sax.SAXException;
|
||||
import javax.annotation.Resource;
|
||||
import javax.jws.WebService;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@ -102,7 +103,7 @@ public class EnrollmentServiceImpl implements EnrollmentService {
|
||||
String headerTo = null;
|
||||
String encodedWap;
|
||||
List<Header> headers = getHeaders();
|
||||
for (Header headerElement : headers != null ? headers : null) {
|
||||
for (Header headerElement : headers) {
|
||||
String nodeName = headerElement.getName().getLocalPart();
|
||||
if (PluginConstants.SECURITY.equals(nodeName)) {
|
||||
Element element = (Element) headerElement.getObject();
|
||||
@ -231,6 +232,7 @@ public class EnrollmentServiceImpl implements EnrollmentService {
|
||||
signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded());
|
||||
|
||||
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
|
||||
domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
DocumentBuilder builder;
|
||||
|
||||
builder = domFactory.newDocumentBuilder();
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl;
|
||||
|
||||
import com.ibm.wsdl.OperationImpl;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
@ -29,6 +30,7 @@ import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsOperationsException;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
|
||||
@ -268,4 +270,70 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/location")
|
||||
public Response getDeviceLocation(@ApiParam(
|
||||
name = "deviceIDs",
|
||||
value = "Provide the ID of the Windows device. Multiple device IDs can be added by " +
|
||||
"using comma separated values. ",
|
||||
required = true) List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Windows device location operation.");
|
||||
}
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(PluginConstants.OperationCodes.DEVICE_LOCATION);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (InvalidDeviceException e) {
|
||||
String errorMessage = "Invalid Device Identifiers found.";
|
||||
log.error(errorMessage, e);
|
||||
throw new BadRequestException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
} catch (OperationManagementException e) {
|
||||
String errorMessage = "Issue in retrieving operation management service instance";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
} catch (DeviceManagementException e) {
|
||||
String errorMessage = "Issue in retrieving device management service instance";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/reboot")
|
||||
public Response rebootDevice(@ApiParam(
|
||||
name = "deviceIDs",
|
||||
value = "Provide the ID of the Windows device. Multiple device IDs can be " +
|
||||
"added using comma separated values.",
|
||||
required = true) List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Windows reboot-device device operation");
|
||||
}
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(PluginConstants.OperationCodes.DEVICE_REBOOT);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return WindowsAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (InvalidDeviceException e) {
|
||||
String errorMessage = "Invalid Device Identifiers found.";
|
||||
log.error(errorMessage, e);
|
||||
throw new BadRequestException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
} catch (OperationManagementException e) {
|
||||
String errorMessage = "Issue in retrieving operation management service instance";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
} catch (DeviceManagementException e) {
|
||||
String errorMessage = "Issue in retrieving device management service instance";
|
||||
log.error(errorMessage, e);
|
||||
throw new UnexpectedServerErrorException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
* Interface for Syncml message flow.
|
||||
* Interface for Windows 8.1 enrollment flow.
|
||||
*/
|
||||
@SwaggerDefinition(
|
||||
info = @Info(
|
||||
@ -43,17 +43,17 @@ import javax.ws.rs.core.Response;
|
||||
title = "",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = "name", value = "Syncml Endpoint"),
|
||||
@ExtensionProperty(name = "name", value = "Windows 8.1 Device Management Service"),
|
||||
@ExtensionProperty(name = "context",
|
||||
value = "/api/device-mgt/windows/v1.0/syncml"),
|
||||
})
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_windows", description = "")
|
||||
@Tag(name = "windows", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Windows syncml service",
|
||||
@Api(value = "Windows 8.1 Device Management Service",
|
||||
description = "This carries all the resources related to Windows syncml message flow.")
|
||||
@Path("/devicemanagement")
|
||||
public interface SyncmlService {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user