added androoid feature

merge-requests/182/head
Amalka Subasinghe 4 years ago
parent b52210a87c
commit bfbbe3c733

@ -172,6 +172,15 @@
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json.wso2</groupId>
<artifactId>json</artifactId>
</dependency>
<!--project dependancies-->
<dependency>
<groupId>org.apache.cxf</groupId>
@ -247,22 +256,6 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.analytics</groupId>
<artifactId>org.wso2.carbon.analytics.api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>

@ -22,8 +22,6 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException;
import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
@ -69,58 +67,58 @@ public class EventReceiverServiceImpl implements EventReceiverService {
if (log.isDebugEnabled()) {
log.debug("Invoking Android device event logging.");
}
Device device;
try {
if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) {
return Response.status(Response.Status.ACCEPTED).entity("Event is publishing has not enabled.").build();
}
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(),
AndroidConstants.DEVICE_TYPE_ANDROID);
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){
return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build();
} else if (device == null){
return Response.status(Response.Status.ACCEPTED).entity("Device is not enrolled yet.").build();
}
} catch (DeviceManagementException e) {
log.error("Error occurred while checking Operation Analytics is Enabled.", e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
String eventType = eventBeanWrapper.getType();
if (!LOCATION_EVENT_TYPE.equals(eventType)) {
String msg = "Dropping Android " + eventType + " Event.Only Location Event Type is supported.";
log.warn(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
Message message = new Message();
Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(),
AndroidConstants.DEVICE_TYPE_ANDROID};
String eventPayload = eventBeanWrapper.getPayload();
JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class);
Object[] payload = {
jsonObject.get(TIME_STAMP).getAsLong(),
jsonObject.get(LATITUDE).getAsDouble(),
jsonObject.get(LONGITUDE).getAsDouble()
};
try {
if (AndroidAPIUtils.getEventPublisherService().publishEvent(
EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) {
message.setResponseCode("Event is published successfully.");
return Response.status(Response.Status.CREATED).entity(message).build();
} else {
log.warn("Error occurred while trying to publish the event. This could be due to unavailability " +
"of the publishing service. Please make sure that analytics server is running and accessible " +
"by this server");
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(503l).setMessage("Error occurred due to " +
"unavailability of the publishing service.").build());
}
} catch (DataPublisherConfigurationException e) {
// Device device;
// try {
// if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) {
// return Response.status(Response.Status.ACCEPTED).entity("Event is publishing has not enabled.").build();
// }
// DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(),
// AndroidConstants.DEVICE_TYPE_ANDROID);
// device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
// if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){
// return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build();
// } else if (device == null){
// return Response.status(Response.Status.ACCEPTED).entity("Device is not enrolled yet.").build();
// }
// } catch (DeviceManagementException e) {
// log.error("Error occurred while checking Operation Analytics is Enabled.", e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
// }
// String eventType = eventBeanWrapper.getType();
// if (!LOCATION_EVENT_TYPE.equals(eventType)) {
// String msg = "Dropping Android " + eventType + " Event.Only Location Event Type is supported.";
// log.warn(msg);
// return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
// }
// Message message = new Message();
// Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(),
// AndroidConstants.DEVICE_TYPE_ANDROID};
// String eventPayload = eventBeanWrapper.getPayload();
// JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class);
// Object[] payload = {
// jsonObject.get(TIME_STAMP).getAsLong(),
// jsonObject.get(LATITUDE).getAsDouble(),
// jsonObject.get(LONGITUDE).getAsDouble()
// };
// try {
// if (AndroidAPIUtils.getEventPublisherService().publishEvent(
// EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) {
// message.setResponseCode("Event is published successfully.");
// return Response.status(Response.Status.CREATED).entity(message).build();
// } else {
// log.warn("Error occurred while trying to publish the event. This could be due to unavailability " +
// "of the publishing service. Please make sure that analytics server is running and accessible " +
// "by this server");
// throw new UnexpectedServerErrorException(
// new ErrorResponse.ErrorResponseBuilder().setCode(503l).setMessage("Error occurred due to " +
// "unavailability of the publishing service.").build());
// }
// } catch (DataPublisherConfigurationException e) {
String msg = "Error occurred while getting the Data publisher Service instance.";
log.error(msg, e);
// log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
// }
}
@GET
@ -134,94 +132,94 @@ public class EventReceiverServiceImpl implements EventReceiverService {
@QueryParam("type") String type,
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
if (from != 0l && to != 0l && deviceId != null) {
return retrieveAlertFromDate(deviceId, from, to);
} else if (deviceId != null && type != null) {
return retrieveAlertByType(deviceId, type);
} else if (deviceId != null) {
return retrieveAlert(deviceId);
} else {
// if (from != 0l && to != 0l && deviceId != null) {
// return retrieveAlertFromDate(deviceId, from, to);
// } else if (deviceId != null && type != null) {
// return retrieveAlertByType(deviceId, type);
// } else if (deviceId != null) {
// return retrieveAlert(deviceId);
// } else {
throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage("Request must contain " +
"the device identifier. Optionally, both from and to value should be present to get " +
"alerts between times.").build());
}
}
private Response retrieveAlert(String deviceId) {
if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device Identifier.");
}
String query = "deviceIdentifier:" + deviceId;
List<DeviceState> deviceStates;
try {
deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
if (deviceStates == null) {
throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
"published for Device: " + deviceId + ".").build());
} else {
return Response.status(Response.Status.OK).entity(deviceStates).build();
}
} catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific device: " + deviceId + ".";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
// }
}
private Response retrieveAlertFromDate(String deviceId, long from, long to) {
String fromDate = String.valueOf(from);
String toDate = String.valueOf(to);
if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device Identifier and time period.");
}
String query = "deviceIdentifier:" + deviceId + " AND _timestamp: [" + fromDate + " TO " + toDate + "]";
List<DeviceState> deviceStates;
try {
deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
if (deviceStates == null) {
throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
"published on given date for given Device: " + deviceId + ".").build());
} else {
return Response.status(Response.Status.OK).entity(deviceStates).build();
}
} catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific " +
"Device: " + deviceId + " on given Date.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
}
private Response retrieveAlertByType(String deviceId, String type) {
if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device identifier and type.");
}
String query = "deviceIdentifier:" + deviceId + " AND type:" + type;
List<DeviceState> deviceStates;
try {
deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
if (deviceStates == null) {
throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
"published for given Device: '" + deviceId + "' and given specific Type.").build());
} else {
return Response.status(Response.Status.OK).entity(deviceStates).build();
}
} catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific " +
"Device: " + deviceId + "and given specific Type.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
}
// private Response retrieveAlert(String deviceId) {
// if (log.isDebugEnabled()) {
// log.debug("Retrieving events for given device Identifier.");
// }
// String query = "deviceIdentifier:" + deviceId;
// List<DeviceState> deviceStates;
// try {
// deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
// if (deviceStates == null) {
// throw new NotFoundException(
// new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
// "published for Device: " + deviceId + ".").build());
// } else {
// return Response.status(Response.Status.OK).entity(deviceStates).build();
// }
// } catch (AnalyticsException e) {
// String msg = "Error occurred while getting published events for specific device: " + deviceId + ".";
// log.error(msg, e);
// throw new UnexpectedServerErrorException(
// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
// }
// }
//
// private Response retrieveAlertFromDate(String deviceId, long from, long to) {
// String fromDate = String.valueOf(from);
// String toDate = String.valueOf(to);
// if (log.isDebugEnabled()) {
// log.debug("Retrieving events for given device Identifier and time period.");
// }
//
// String query = "deviceIdentifier:" + deviceId + " AND _timestamp: [" + fromDate + " TO " + toDate + "]";
// List<DeviceState> deviceStates;
// try {
// deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
// if (deviceStates == null) {
// throw new NotFoundException(
// new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
// "published on given date for given Device: " + deviceId + ".").build());
//
// } else {
// return Response.status(Response.Status.OK).entity(deviceStates).build();
// }
// } catch (AnalyticsException e) {
// String msg = "Error occurred while getting published events for specific " +
// "Device: " + deviceId + " on given Date.";
// log.error(msg, e);
// throw new UnexpectedServerErrorException(
// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
// }
// }
//
// private Response retrieveAlertByType(String deviceId, String type) {
// if (log.isDebugEnabled()) {
// log.debug("Retrieving events for given device identifier and type.");
// }
// String query = "deviceIdentifier:" + deviceId + " AND type:" + type;
// List<DeviceState> deviceStates;
// try {
// deviceStates = AndroidDeviceUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
// if (deviceStates == null) {
// throw new NotFoundException(
// new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No any alerts are " +
// "published for given Device: '" + deviceId + "' and given specific Type.").build());
//
// } else {
// return Response.status(Response.Status.OK).entity(deviceStates).build();
// }
// } catch (AnalyticsException e) {
// String msg = "Error occurred while getting published events for specific " +
// "Device: " + deviceId + "and given specific Type.";
// log.error(msg, e);
// throw new UnexpectedServerErrorException(
// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
// }
// }
}

@ -20,9 +20,7 @@ package org.wso2.carbon.mdm.services.android.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.analytics.api.AnalyticsDataAPI;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
@ -41,8 +39,8 @@ public class AndroidAPIUtils {
private static PolicyManagerService policyManagerService = null;
private static ApplicationManagementProviderService applicationManagementProviderService = null;
private static NotificationManagementService notificationManagementService = null;
private static EventsPublisherService eventsPublisherService = null;
private static AnalyticsDataAPI analyticsDataAPI = null;
// private static EventsPublisherService eventsPublisherService = null;
// private static AnalyticsDataAPI analyticsDataAPI = null;
private AndroidAPIUtils() {
throw new IllegalStateException("Utility class");
@ -126,30 +124,30 @@ public class AndroidAPIUtils {
return notificationManagementService;
}
public static EventsPublisherService getEventPublisherService() {
if (eventsPublisherService == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
eventsPublisherService = (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null);
if (eventsPublisherService == null) {
String msg = "Event Publisher service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
}
return eventsPublisherService;
}
// public static EventsPublisherService getEventPublisherService() {
// if (eventsPublisherService == null) {
// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
// eventsPublisherService = (EventsPublisherService) ctx.getOSGiService(EventsPublisherService.class, null);
// if (eventsPublisherService == null) {
// String msg = "Event Publisher service has not initialized.";
// log.error(msg);
// throw new IllegalStateException(msg);
// }
// }
// return eventsPublisherService;
// }
public static AnalyticsDataAPI getAnalyticsDataAPI() {
if (analyticsDataAPI == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
analyticsDataAPI = (AnalyticsDataAPI) ctx.getOSGiService(AnalyticsDataAPI.class, null);
if (analyticsDataAPI == null) {
String msg = "Analytics api service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
}
return analyticsDataAPI;
}
// public static AnalyticsDataAPI getAnalyticsDataAPI() {
// if (analyticsDataAPI == null) {
// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
// analyticsDataAPI = (AnalyticsDataAPI) ctx.getOSGiService(AnalyticsDataAPI.class, null);
// if (analyticsDataAPI == null) {
// String msg = "Analytics api service has not initialized.";
// log.error(msg);
// throw new IllegalStateException(msg);
// }
// }
// return analyticsDataAPI;
// }
}

@ -26,12 +26,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.analytics.api.AnalyticsDataAPI;
import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil;
import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse;
import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry;
import org.wso2.carbon.analytics.datasource.commons.Record;
import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device;
@ -108,53 +102,53 @@ public class AndroidDeviceUtils {
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, deviceIdentifiers);
}
public static List<DeviceState> getAllEventsForDevice(String tableName, String query) throws AnalyticsException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
AnalyticsDataAPI analyticsDataAPI = AndroidAPIUtils.getAnalyticsDataAPI();
int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
if (eventCount == 0) {
return null;
}
List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount);
List<String> recordIds = getRecordIds(resultEntries);
AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
Map<String, DeviceState> deviceStateses = createDeviceStatusData(AnalyticsDataAPIUtil.listRecords(
analyticsDataAPI, response));
return getSortedDeviceStateData(deviceStateses, resultEntries);
}
private static List<String> getRecordIds(List<SearchResultEntry> searchResults) {
List<String> ids = new ArrayList<>();
for (SearchResultEntry searchResult : searchResults) {
ids.add(searchResult.getId());
}
return ids;
}
public static Map<String, DeviceState> createDeviceStatusData(List<Record> records) {
Map<String, DeviceState> deviceStatuses = new HashMap<>();
for (Record record : records) {
DeviceState deviceState = createDeviceStatusData(record);
deviceStatuses.put(deviceState.getId(), deviceState);
}
return deviceStatuses;
}
private static DeviceState createDeviceStatusData(Record record) {
DeviceState deviceState = new DeviceState();
deviceState.setId(record.getId());
deviceState.setValues(record.getValues());
return deviceState;
}
public static List<DeviceState> getSortedDeviceStateData(Map<String, DeviceState> sensorDatas,
List<SearchResultEntry> searchResults) {
List<DeviceState> sortedRecords = new ArrayList<>();
for (SearchResultEntry searchResultEntry : searchResults) {
sortedRecords.add(sensorDatas.get(searchResultEntry.getId()));
}
return sortedRecords;
}
// public static List<DeviceState> getAllEventsForDevice(String tableName, String query) throws AnalyticsException {
// int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
// AnalyticsDataAPI analyticsDataAPI = AndroidAPIUtils.getAnalyticsDataAPI();
// int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
// if (eventCount == 0) {
// return null;
// }
// List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount);
// List<String> recordIds = getRecordIds(resultEntries);
// AnalyticsDataResponse response = analyticsDataAPI.get(tenantId, tableName, 1, null, recordIds);
// Map<String, DeviceState> deviceStateses = createDeviceStatusData(AnalyticsDataAPIUtil.listRecords(
// analyticsDataAPI, response));
// return getSortedDeviceStateData(deviceStateses, resultEntries);
// }
// private static List<String> getRecordIds(List<SearchResultEntry> searchResults) {
// List<String> ids = new ArrayList<>();
// for (SearchResultEntry searchResult : searchResults) {
// ids.add(searchResult.getId());
// }
// return ids;
// }
// public static Map<String, DeviceState> createDeviceStatusData(List<Record> records) {
// Map<String, DeviceState> deviceStatuses = new HashMap<>();
// for (Record record : records) {
// DeviceState deviceState = createDeviceStatusData(record);
// deviceStatuses.put(deviceState.getId(), deviceState);
// }
// return deviceStatuses;
// }
// private static DeviceState createDeviceStatusData(Record record) {
// DeviceState deviceState = new DeviceState();
// deviceState.setId(record.getId());
// deviceState.setValues(record.getValues());
// return deviceState;
// }
// public static List<DeviceState> getSortedDeviceStateData(Map<String, DeviceState> sensorDatas,
// List<SearchResultEntry> searchResults) {
// List<DeviceState> sortedRecords = new ArrayList<>();
// for (SearchResultEntry searchResultEntry : searchResults) {
// sortedRecords.add(sensorDatas.get(searchResultEntry.getId()));
// }
// return sortedRecords;
// }
public static void updateOperation(Device device, Operation operation)
throws OperationManagementException, PolicyComplianceException, ApplicationManagementException {

@ -31,5 +31,5 @@
Tomcat environment is the default and every webapps gets it even if they didn't specify it.
e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
-->
<Environments>CXF,Carbon</Environments>
<Environments>CXF3,Carbon</Environments>
</Classloading>

@ -56,8 +56,8 @@
<Bundle-Description>Device Management Mobile Android Impl Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.device.mgt.mobile.android.internal</Private-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.apache.commons.logging,
javax.xml,
javax.xml.stream,

@ -14,7 +14,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -30,7 +29,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>

@ -13,7 +13,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -29,7 +28,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -45,7 +43,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -61,7 +58,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -77,7 +73,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>

@ -13,7 +13,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
@ -29,7 +28,6 @@
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>

@ -0,0 +1,63 @@
<!--
~ Copyright (C) 2020. Entgra (Pvt) Ltd, https://entgra.io
~ All Rights Reserved.
~
~ Unauthorized copying/redistribution of this file, via any medium
~ is strictly prohibited.
~ Proprietary and confidential.
~
~ Licensed under the Entgra Commercial License,
~ Version 1.0 (the "License");
~ you may not use this file except in compliance with the License.
~
~ 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.
~
~ You may obtain a copy of the License at
~ https://entgra.io/licenses/entgra-commercial/1.0
-->
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>
<datasources>
<datasource>
<name>Android_DB</name>
<description>The datasource used as the Android Device Management database</description>
<jndiConfig>
<name>jdbc/MobileAndroidDM_DS</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
{% if database.android is defined %}
<url>{{database.android.url}}</url>
<username>{{database.android.username}}</username>
<password>{{database.android.password}}</password>
<driverClassName>{{database.android.driver}}</driverClassName>
<validationQuery>{{database.android.validationQuery}}</validationQuery>
{% for property_name,property_value in database.android.pool_options.items() %}
<{{property_name}}>{{property_value}}</{{property_name}}>
{% endfor %}
{% else %}
<url>jdbc:h2:./repository/database/WSO2MobileAndroid_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>
{% endif %}
</configuration>
</definition>
</datasource>
</datasources>
</datasources-configuration>

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<MobileDeviceMgtConfiguration>
<ManagementRepository>
<DataSourceConfigurations>
<DataSourceConfiguration type="android">
<JndiLookupDefinition>
{% if mobile_conf.datasource.android.name is defined %}
<Name>{{mobile_conf.datasource.android.name}}</Name>
{% else %}
<Name>jdbc/MobileAndroidDM_DS</Name>
{% endif %}
</JndiLookupDefinition>
</DataSourceConfiguration>
</DataSourceConfigurations>
</ManagementRepository>
<APIPublisher>
<APIs>
<!--todo remove this -->
<API>
<Name>appmanager</Name>
<Owner>admin</Owner>
<Context>/devices</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/test/app</Endpoint>
<Transports>http,https</Transports>
</API>
<API>
<Name>enrol</Name>
<Owner>admin</Owner>
<Context>/enroll</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/mdm-android-agent/enrollment</Endpoint>
<Transports>http,https</Transports>
</API>
<API>
<Name>license</Name>
<Owner>admin</Owner>
<Context>/license</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/mdm-android-agent/devices/license</Endpoint>
<Transports>http,https</Transports>
</API>
<API>
<Name>operation</Name>
<Owner>admin</Owner>
<Context>/operation</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/mdm-android-agent/operations</Endpoint>
<Transports>http,https</Transports>
</API>
</APIs>
</APIPublisher>
</MobileDeviceMgtConfiguration>

@ -30,8 +30,7 @@
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2MobileAndroid_DB;DB_CLOSE_ON_EXIT=FALSE
</url>
<url>jdbc:h2:./repository/database/WSO2MobileAndroid_DB;DB_CLOSE_ON_EXIT=FALSE</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>

@ -1,8 +1,8 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/api#device-mgt#android#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt#android#v1.0.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/devicemgt,target:${installFolder}/../../deployment/server/jaggeryapps/devicemgt,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/datasources/,target:${installFolder}/../../repository/conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../repository/conf/mobile-config.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
@ -12,10 +12,11 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/apis/admin--Android-Mutual-SSL-Configuration-Management.xml,target:${installFolder}/../../deployment/server/synapse-configs/default/api/admin--Android-Mutual-SSL-Configuration-Management.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/apis/admin--Android-Mutual-SSL-Device-Management.xml,target:${installFolder}/../../deployment/server/synapse-configs/default/api/admin--Android-Mutual-SSL-Device-Management.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/apis/admin--Android-Mutual-SSL-Event-Receiver.xml,target:${installFolder}/../../deployment/server/synapse-configs/default/api/admin--Android-Mutual-SSL-Event-Receiver.xml,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf_templates/,target:${installFolder}/../../resources/conf/,overwrite:true);\
instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/mdm-android-agent.war);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/android-datasources.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../repository/conf/datasources/android-datasources.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/mdm-android-agent);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view);\

@ -36,12 +36,12 @@
<modules>
<module>components/extensions</module>
<!--<module>components/mobile-plugins</module>-->
<module>components/mobile-plugins</module>
<!--<module>components/device-types</module>-->
<!--<module>components/analytics</module>-->
<!--<module>components/test-coverage</module>-->
<!--<module>features/analytics-feature</module>-->
<!--<module>features/mobile-plugins-feature</module>-->
<module>features/mobile-plugins-feature</module>
<!--<module>features/device-types-feature</module>-->
<module>features/extensions-feature</module>
</modules>

Loading…
Cancel
Save