mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge branch 'release-3.0.x' of https://github.com/wso2/carbon-device-mgt-plugins into release-3.0.x
This commit is contained in:
commit
77d1e684f6
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
@ -28,18 +28,10 @@
|
||||
<param-name>isSharedWithAllTenants</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>providerTenantDomain</param-name>
|
||||
<param-value>carbon.super</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--publish to apim-->
|
||||
<context-param>
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
</web-app>
|
||||
|
||||
@ -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"}}
|
||||
|
||||
@ -28,19 +28,11 @@
|
||||
<param-name>isSharedWithAllTenants</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>providerTenantDomain</param-name>
|
||||
<param-value>carbon.super</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--publish to apim-->
|
||||
<context-param>
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
@ -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}}
|
||||
@ -28,7 +28,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();
|
||||
|
||||
@ -28,19 +28,11 @@
|
||||
<param-name>isSharedWithAllTenants</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>providerTenantDomain</param-name>
|
||||
<param-value>carbon.super</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--publish to apim-->
|
||||
<context-param>
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
@ -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}}
|
||||
@ -28,7 +28,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();
|
||||
|
||||
@ -34,9 +34,5 @@
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
@ -28,19 +28,11 @@
|
||||
<param-name>isSharedWithAllTenants</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>providerTenantDomain</param-name>
|
||||
<param-value>carbon.super</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--publish to apim-->
|
||||
<context-param>
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
@ -58,7 +58,7 @@ import java.util.List;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Path("/admin/devices")
|
||||
|
||||
@ -56,7 +56,7 @@ import java.util.List;
|
||||
}
|
||||
),
|
||||
tags = {
|
||||
@Tag(name = "devicemgt_android", description = "")
|
||||
@Tag(name = "android", description = "")
|
||||
}
|
||||
)
|
||||
@Api(value = "Android Device Management",
|
||||
|
||||
@ -55,7 +55,7 @@ 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.")
|
||||
|
||||
@ -53,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" +
|
||||
|
||||
@ -39,7 +39,7 @@ import org.wso2.carbon.mdm.services.android.util.AndroidConstants;
|
||||
import org.wso2.carbon.mdm.services.android.util.AndroidDeviceUtils;
|
||||
import org.wso2.carbon.mdm.services.android.util.Message;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@ -47,6 +47,7 @@ import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagement
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
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.common.policy.mgt.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
|
||||
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException;
|
||||
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
|
||||
@ -55,7 +56,7 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
|
||||
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
|
||||
import org.wso2.carbon.mdm.services.android.exception.BadRequestException;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
@ -275,7 +276,8 @@ public class AndroidAPIUtils {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info("Received compliance status from MONITOR operation ID: " + operation.getId());
|
||||
}
|
||||
getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, operation.getPayLoad());
|
||||
getPolicyManagerService().checkPolicyCompliance(deviceIdentifier,
|
||||
getComplianceFeatures(operation.getPayLoad()));
|
||||
} else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants.
|
||||
OperationCodes.APPLICATION_LIST.equals(operation.getCode())) {
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -493,4 +495,29 @@ public class AndroidAPIUtils {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static List<ComplianceFeature> getComplianceFeatures(Object compliancePayload) throws PolicyComplianceException {
|
||||
String compliancePayloadString = new Gson().toJson(compliancePayload);
|
||||
if (compliancePayload == null) {
|
||||
return null;
|
||||
}
|
||||
// Parsing json string to get compliance features.
|
||||
JsonElement jsonElement;
|
||||
if (compliancePayloadString instanceof String) {
|
||||
jsonElement = new JsonParser().parse(compliancePayloadString);
|
||||
} else {
|
||||
throw new PolicyComplianceException("Invalid policy compliance payload");
|
||||
}
|
||||
|
||||
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
||||
Gson gson = new Gson();
|
||||
ComplianceFeature complianceFeature;
|
||||
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>(jsonArray.size());
|
||||
|
||||
for (JsonElement element : jsonArray) {
|
||||
complianceFeature = gson.fromJson(element, ComplianceFeature.class);
|
||||
complianceFeatures.add(complianceFeature);
|
||||
}
|
||||
return complianceFeatures;
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,10 +51,6 @@
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>doAuthentication</param-name>
|
||||
<param-value>true</param-value>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -27,6 +27,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||
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.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants;
|
||||
@ -47,6 +48,7 @@ public class AndroidDeviceManagementService implements DeviceManagementService {
|
||||
private static final String NOTIFIER_PROPERTY = "notifierType";
|
||||
private static final String GCM_API_KEY = "gcmAPIKey";
|
||||
private static final String GCM_SENDER_ID = "gcmSenderId";
|
||||
private PolicyMonitoringManager policyMonitoringManager;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
@ -61,6 +63,7 @@ public class AndroidDeviceManagementService implements DeviceManagementService {
|
||||
@Override
|
||||
public void init() throws DeviceManagementException {
|
||||
this.deviceManager = new AndroidDeviceManager();
|
||||
this.policyMonitoringManager = new AndroidPolicyMonitoringManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,6 +108,11 @@ public class AndroidDeviceManagementService implements DeviceManagementService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyMonitoringManager getPolicyMonitoringManager() {
|
||||
return policyMonitoringManager;
|
||||
}
|
||||
|
||||
private String getConfigProperty(List<ConfigurationEntry> configs, String propertyName) {
|
||||
for (ConfigurationEntry entry : configs) {
|
||||
if (propertyName.equals(entry.getName())) {
|
||||
|
||||
@ -25,39 +25,27 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.gcm.GCMService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.internal.AndroidDeviceManagementDataHolder;
|
||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
||||
public class AndroidPolicyMonitoringManager implements PolicyMonitoringManager {
|
||||
|
||||
private static Log log = LogFactory.getLog(AndroidPolicyMonitoringService.class);
|
||||
private static Log log = LogFactory.getLog(AndroidPolicyMonitoringManager.class);
|
||||
|
||||
@Override
|
||||
public void notifyDevices(List<Device> list) throws PolicyComplianceException {
|
||||
GCMService gcmService = AndroidDeviceManagementDataHolder.getInstance().getGCMService();
|
||||
if (gcmService.isGCMEnabled() && !list.isEmpty()) {
|
||||
gcmService.sendNotification("POLICY_BUNDLE", list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy,
|
||||
public NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy,
|
||||
Object compliancePayload) throws PolicyComplianceException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Checking policy compliance status of device '" + deviceIdentifier.getId() + "'");
|
||||
}
|
||||
ComplianceData complianceData = new ComplianceData();
|
||||
NonComplianceData complianceData = new NonComplianceData();
|
||||
if (compliancePayload == null || policy == null) {
|
||||
return complianceData;
|
||||
}
|
||||
@ -93,8 +81,4 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
||||
return complianceData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID;
|
||||
}
|
||||
}
|
||||
@ -25,10 +25,8 @@ import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.AndroidDeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.AndroidPolicyMonitoringService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.gcm.GCMService;
|
||||
import org.wso2.carbon.ndatasource.core.DataSourceService;
|
||||
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||
|
||||
/**
|
||||
@ -75,8 +73,8 @@ public class AndroidDeviceManagementServiceComponent {
|
||||
|
||||
// Policy management service
|
||||
|
||||
bundleContext.registerService(PolicyMonitoringService.class,
|
||||
new AndroidPolicyMonitoringService(), null);
|
||||
// bundleContext.registerService(PolicyMonitoringManager.class,
|
||||
// new AndroidPolicyMonitoringManager(), null);
|
||||
|
||||
AndroidDeviceManagementDataHolder.getInstance().setAndroidDeviceManagementService(
|
||||
androidDeviceManagementService);
|
||||
|
||||
@ -35,9 +35,9 @@ 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;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
|
||||
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +33,7 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Wifi;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*;
|
||||
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
|
||||
import org.wso2.carbon.policy.mgt.common.ProfileFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -56,10 +56,6 @@
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>doAuthentication</param-name>
|
||||
<param-value>true</param-value>
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<div class="wr-input-control">
|
||||
<label class="wr-input-label" for="windows-config-notifier-frequency">
|
||||
Polling Interval*
|
||||
<span class="helper" title="Time interval after which windows agent will contact EMM server each time to fetch data">
|
||||
<span class="helper" title="Time interval after which windows agent will contact IoT Server each time to fetch data">
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManager;
|
||||
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
|
||||
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
|
||||
@ -34,6 +35,7 @@ public class WindowsDeviceManagementService implements DeviceManagementService {
|
||||
private DeviceManager deviceManager;
|
||||
public static final String DEVICE_TYPE_WINDOWS = "windows";
|
||||
private final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super";
|
||||
private PolicyMonitoringManager policyMonitoringManager;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
@ -48,6 +50,7 @@ public class WindowsDeviceManagementService implements DeviceManagementService {
|
||||
@Override
|
||||
public void init() throws DeviceManagementException {
|
||||
this.deviceManager = new WindowsDeviceManager();
|
||||
this.policyMonitoringManager = new WindowsPolicyMonitoringManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,4 +73,9 @@ public class WindowsDeviceManagementService implements DeviceManagementService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolicyMonitoringManager getPolicyMonitoringManager() {
|
||||
return policyMonitoringManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,36 +20,29 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.Policy;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WindowsPolicyMonitoringService implements PolicyMonitoringService {
|
||||
public class WindowsPolicyMonitoringManager implements PolicyMonitoringManager {
|
||||
|
||||
private static Log log = LogFactory.getLog(WindowsPolicyMonitoringService.class);
|
||||
private static Log log = LogFactory.getLog(WindowsPolicyMonitoringManager.class);
|
||||
|
||||
@Override
|
||||
public void notifyDevices(List<Device> list) throws PolicyComplianceException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object compliancePayload)
|
||||
public NonComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object compliancePayload)
|
||||
throws PolicyComplianceException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("checking policy compliance status of device '" + deviceIdentifier.getId() + "'");
|
||||
}
|
||||
List<ComplianceFeature> complianceFeatures = (List<ComplianceFeature>) compliancePayload;
|
||||
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
|
||||
ComplianceData complianceData = new ComplianceData();
|
||||
NonComplianceData complianceData = new NonComplianceData();
|
||||
|
||||
if (policy == null || compliancePayload == null) {
|
||||
return complianceData;
|
||||
@ -66,8 +59,4 @@ public class WindowsPolicyMonitoringService implements PolicyMonitoringService {
|
||||
return complianceData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
|
||||
}
|
||||
}
|
||||
@ -23,11 +23,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsDeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsPolicyMonitoringService;
|
||||
import org.wso2.carbon.ndatasource.core.DataSourceService;
|
||||
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
|
||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||
|
||||
/**
|
||||
@ -67,8 +63,8 @@ public class WindowsDeviceManagementServiceComponent {
|
||||
|
||||
// Policy management service
|
||||
|
||||
bundleContext.registerService(PolicyMonitoringService.class,
|
||||
new WindowsPolicyMonitoringService(), null);
|
||||
// bundleContext.registerService(PolicyMonitoringManager.class,
|
||||
// new WindowsPolicyMonitoringManager(), null);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Android Mobile Device Management Service Component has been successfully activated");
|
||||
|
||||
@ -253,11 +253,11 @@
|
||||
</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<bundles>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
</bundles>
|
||||
<!--<bundles>-->
|
||||
<!--<bundleDef>-->
|
||||
<!--org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android:${carbon.devicemgt.plugins.version}-->
|
||||
<!--</bundleDef>-->
|
||||
<!--</bundles>-->
|
||||
<importFeatures>
|
||||
<importFeatureDef>
|
||||
org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||
|
||||
@ -348,4 +348,5 @@
|
||||
</Operation>
|
||||
</Operations>
|
||||
</TaskConfiguration>
|
||||
<PolicyMonitoring enabled="true"/>
|
||||
</DeviceTypeConfiguration>
|
||||
@ -202,11 +202,11 @@
|
||||
</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<bundles>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
</bundles>
|
||||
<!--<bundles>-->
|
||||
<!--<bundleDef>-->
|
||||
<!--org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows:${carbon.devicemgt.plugins.version}-->
|
||||
<!--</bundleDef>-->
|
||||
<!--</bundles>-->
|
||||
<importFeatures>
|
||||
<importFeatureDef>
|
||||
org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||
|
||||
@ -124,4 +124,6 @@
|
||||
<authorizationRequired>false</authorizationRequired>
|
||||
</DeviceAuthorizationConfig>
|
||||
|
||||
<PolicyMonitoring enabled="true"/>
|
||||
|
||||
</DeviceTypeConfiguration>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user