@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common;
|
||||||
|
|
||||||
|
public class Property {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
4
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementServiceComponent.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceManagementBundleActivator.java
@ -0,0 +1,3 @@
|
|||||||
|
instructions.configure = \
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/conf/cdm-config.xml,target:${installFolder}/../../conf/cdm-config.xml,overwrite:true);\
|
||||||
|
|
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1015 B |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 110 B |
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<lint>
|
||||||
|
</lint>
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cdm.api.android.util;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AndroidAPIUtil class provides utility function used by Android REST-API classes.
|
|
||||||
*/
|
|
||||||
public class AndroidAPIUtil {
|
|
||||||
|
|
||||||
public static Device convertToDeviceObject(JsonObject json){
|
|
||||||
Device device = new Device();
|
|
||||||
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
||||||
device.setName("Test Device");
|
|
||||||
device.setOwner("harshan");
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId){
|
|
||||||
DeviceIdentifier identifier = new DeviceIdentifier();
|
|
||||||
identifier.setId(deviceId);
|
|
||||||
identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cdm.api.android.util;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.wso2.carbon.device.mgt.common.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AndroidAPIUtil class provides utility function used by Android REST-API classes.
|
||||||
|
*/
|
||||||
|
public class AndroidAPIUtils {
|
||||||
|
|
||||||
|
public static Device convertToDeviceObject(String jsonString) {
|
||||||
|
JsonObject obj = new Gson().fromJson(jsonString, JsonObject.class);
|
||||||
|
Device device = new Device();
|
||||||
|
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||||
|
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_MAC_KEY) != null) {
|
||||||
|
device.setDeviceIdentifier(
|
||||||
|
obj.get(AndroidConstants.DeviceConstants.DEVICE_MAC_KEY).getAsString());
|
||||||
|
}
|
||||||
|
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_DESCRIPTION_KEY) != null) {
|
||||||
|
device.setDescription(
|
||||||
|
obj.get(AndroidConstants.DeviceConstants.DEVICE_DESCRIPTION_KEY).getAsString());
|
||||||
|
}
|
||||||
|
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_OWNERSHIP_KEY) != null) {
|
||||||
|
device.setOwnership(
|
||||||
|
obj.get(AndroidConstants.DeviceConstants.DEVICE_OWNERSHIP_KEY).getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_PROPERTIES_KEY) != null) {
|
||||||
|
JsonObject properties =
|
||||||
|
new Gson().fromJson(
|
||||||
|
obj.get(AndroidConstants.DeviceConstants.DEVICE_PROPERTIES_KEY)
|
||||||
|
, JsonObject.class);
|
||||||
|
if (properties.get(AndroidConstants.DeviceProperties.PROPERTY_USER_KEY) != null) {
|
||||||
|
device.setOwner(properties.get(AndroidConstants.DeviceProperties.PROPERTY_USER_KEY)
|
||||||
|
.getAsString());
|
||||||
|
}
|
||||||
|
if (properties.get(AndroidConstants.DeviceProperties.PROPERTY_DEVICE_KEY) != null) {
|
||||||
|
device.setName(properties.get(AndroidConstants.DeviceProperties.PROPERTY_DEVICE_KEY)
|
||||||
|
.getAsString());
|
||||||
|
}
|
||||||
|
device.setProperties(parseProperties(properties));
|
||||||
|
}else{
|
||||||
|
device.setProperties(new ArrayList<Property>(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_FEATURES_KEY) != null) {
|
||||||
|
JsonObject features =
|
||||||
|
new Gson().fromJson(
|
||||||
|
obj.get(AndroidConstants.DeviceConstants.DEVICE_FEATURES_KEY),
|
||||||
|
JsonObject.class);
|
||||||
|
device.setFeatures(parseFeatures(features));
|
||||||
|
}else{
|
||||||
|
device.setFeatures(new ArrayList<Feature>(0));
|
||||||
|
}
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Property> parseProperties(JsonObject properties) {
|
||||||
|
List<Property> propertyList = new ArrayList<Property>(0);
|
||||||
|
for (Map.Entry<String, JsonElement> entry : properties.entrySet()) {
|
||||||
|
propertyList.add(parseProperty(entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
|
// propertyList.add(parseProperty("regid", properties.get("regid").getAsString()));
|
||||||
|
// propertyList.add(parseProperty("osversion", properties.get("osversion").getAsString()));
|
||||||
|
// propertyList.add(parseProperty("vendor", properties.get("vendor").getAsString()));
|
||||||
|
// propertyList.add(parseProperty("imei", properties.get("imei").getAsString()));
|
||||||
|
// propertyList.add(parseProperty("imsi", properties.get("imsi").getAsString()));
|
||||||
|
// propertyList.add(parseProperty("model", properties.get("model").getAsString()));
|
||||||
|
return propertyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Feature> parseFeatures(JsonObject features) {
|
||||||
|
List<Feature> featureList = new ArrayList<Feature>(0);
|
||||||
|
return featureList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Property parseProperty(String property, JsonElement value) {
|
||||||
|
Property prop = new Property();
|
||||||
|
prop.setName(property);
|
||||||
|
prop.setValue(value.getAsString());
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Feature parseFeature(JsonElement featureElement) {
|
||||||
|
Feature feature = new Feature();
|
||||||
|
return feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) {
|
||||||
|
DeviceIdentifier identifier = new DeviceIdentifier();
|
||||||
|
identifier.setId(deviceId);
|
||||||
|
identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cdm.api.android.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines constants used in Android-REST API bundle.
|
||||||
|
*/
|
||||||
|
public final class AndroidConstants {
|
||||||
|
|
||||||
|
public final class DeviceProperties{
|
||||||
|
private DeviceProperties() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
public static final String PROPERTY_USER_KEY = "username";
|
||||||
|
public static final String PROPERTY_DEVICE_KEY = "device";
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class DeviceFeatures{
|
||||||
|
private DeviceFeatures() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class DeviceConstants{
|
||||||
|
private DeviceConstants() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
public static final String DEVICE_MAC_KEY = "mac";
|
||||||
|
public static final String DEVICE_DESCRIPTION_KEY = "description";
|
||||||
|
public static final String DEVICE_OWNERSHIP_KEY = "ownership";
|
||||||
|
public static final String DEVICE_PROPERTIES_KEY = "properties";
|
||||||
|
public static final String DEVICE_FEATURES_KEY = "features";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
|
||||||
|
<providers>
|
||||||
|
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
|
||||||
|
</providers>
|
||||||
|
|
||||||
|
<datasources>
|
||||||
|
<datasource>
|
||||||
|
<name>WSO2DEVICE_DB</name>
|
||||||
|
<description>The datasource used for EMM</description>
|
||||||
|
<jndiConfig>
|
||||||
|
<name>jdbc/WSO2DEVICE_DB</name>
|
||||||
|
</jndiConfig>
|
||||||
|
<definition type="RDBMS">
|
||||||
|
<configuration>
|
||||||
|
<url>jdbc:h2:repository/database/WSO2DEVICE_DB;DB_CLOSE_ON_EXIT=FALSE</url>
|
||||||
|
<username>wso2carbon</username>
|
||||||
|
<password>wso2carbon</password>
|
||||||
|
<driverClassName>org.h2.Driver</driverClassName>
|
||||||
|
<maxActive>50</maxActive>
|
||||||
|
<maxWait>60000</maxWait>
|
||||||
|
<testOnBorrow>true</testOnBorrow>
|
||||||
|
<validationQuery>SELECT 1</validationQuery>
|
||||||
|
<validationInterval>30000</validationInterval>
|
||||||
|
</configuration>
|
||||||
|
</definition>
|
||||||
|
</datasource>
|
||||||
|
</datasources>
|
||||||
|
</datasources-configuration>
|