mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
changed event definition
This commit is contained in:
parent
aaeac03cfb
commit
94d626ca3c
@ -9,12 +9,12 @@
|
|||||||
@Plan:trace('false')
|
@Plan:trace('false')
|
||||||
|
|
||||||
@Import('org.wso2.android.agent.Stream:1.0.0')
|
@Import('org.wso2.android.agent.Stream:1.0.0')
|
||||||
define stream dataIn (deviceId string, payload string, type string);
|
define stream dataIn (meta_deviceId string, payload string, type string);
|
||||||
|
|
||||||
@Export('org.wso2.geo.LocationStream:1.0.0')
|
@Export('org.wso2.geo.LocationStream:1.0.0')
|
||||||
define stream dataOut (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float );
|
define stream dataOut (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float );
|
||||||
|
|
||||||
from dataIn[type == 'location']
|
from dataIn[type == 'location']
|
||||||
select deviceId as id, convert(json:getProperty(payload, 'timeStamp'), 'long') as timeStamp, convert(json:getProperty(payload,
|
select meta_deviceId as id, convert(json:getProperty(payload, 'timeStamp'), 'long') as timeStamp, convert(json:getProperty(payload,
|
||||||
'latitude'), 'double') as latitude, convert(json:getProperty(payload, 'longitude'), 'double') as longitude,
|
'latitude'), 'double') as latitude, convert(json:getProperty(payload, 'longitude'), 'double') as longitude,
|
||||||
'android' as type, 0.0f as speed, 0.0f as heading insert into dataOut
|
'android' as type, 0.0f as speed, 0.0f as heading insert into dataOut
|
||||||
@ -3,11 +3,13 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"nickName": "",
|
"nickName": "",
|
||||||
"description": "Stream that receives various types of events from android agent",
|
"description": "Stream that receives various types of events from android agent",
|
||||||
"payloadData": [
|
"metaData": [
|
||||||
{
|
{
|
||||||
"name": "deviceId",
|
"name": "deviceId",
|
||||||
"type": "STRING"
|
"type": "STRING"
|
||||||
},
|
}
|
||||||
|
],
|
||||||
|
"payloadData": [
|
||||||
{
|
{
|
||||||
"name": "payload",
|
"name": "payload",
|
||||||
"type": "STRING"
|
"type": "STRING"
|
||||||
|
|||||||
@ -21,6 +21,7 @@ package org.wso2.carbon.mdm.services.android.services.impl;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException;
|
import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException;
|
import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException;
|
||||||
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
|
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.bean.ErrorResponse;
|
||||||
@ -31,6 +32,7 @@ import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorExcep
|
|||||||
import org.wso2.carbon.mdm.services.android.services.EventReceiverService;
|
import org.wso2.carbon.mdm.services.android.services.EventReceiverService;
|
||||||
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
|
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
|
||||||
import org.wso2.carbon.mdm.services.android.util.Message;
|
import org.wso2.carbon.mdm.services.android.util.Message;
|
||||||
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
@ -51,12 +53,12 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
|||||||
log.debug("Invoking Android device even logging.");
|
log.debug("Invoking Android device even logging.");
|
||||||
}
|
}
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
|
Object metaData[] = {eventBeanWrapper.getDeviceIdentifier()};
|
||||||
|
|
||||||
Object payload[] = {eventBeanWrapper.getDeviceIdentifier(), eventBeanWrapper.getPayload(),
|
Object payload[] = {eventBeanWrapper.getPayload(), eventBeanWrapper.getType()};
|
||||||
eventBeanWrapper.getType()};
|
|
||||||
try {
|
try {
|
||||||
if (AndroidAPIUtils.getEventPublisherService().publishEvent(
|
if (AndroidAPIUtils.getEventPublisherService().publishEvent(
|
||||||
EVENT_STREAM_DEFINITION, "1.0.0", new Object[0], new Object[0], payload)) {
|
EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) {
|
||||||
message.setResponseCode("Event is published successfully.");
|
message.setResponseCode("Event is published successfully.");
|
||||||
return Response.status(Response.Status.CREATED).entity(message).build();
|
return Response.status(Response.Status.CREATED).entity(message).build();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user