changed event definition

revert-dabc3590
ayyoob 8 years ago
parent aaeac03cfb
commit 94d626ca3c

@ -9,12 +9,12 @@
@Plan:trace('false')
@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')
define stream dataOut (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float );
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,
'android' as type, 0.0f as speed, 0.0f as heading insert into dataOut

@ -3,11 +3,13 @@
"version": "1.0.0",
"nickName": "",
"description": "Stream that receives various types of events from android agent",
"payloadData": [
"metaData": [
{
"name": "deviceId",
"type": "STRING"
},
}
],
"payloadData": [
{
"name": "payload",
"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.LogFactory;
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.mdm.services.android.bean.DeviceState;
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.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.util.Message;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import javax.validation.Valid;
import javax.validation.constraints.Size;
@ -51,12 +53,12 @@ public class EventReceiverServiceImpl implements EventReceiverService {
log.debug("Invoking Android device even logging.");
}
Message message = new Message();
Object metaData[] = {eventBeanWrapper.getDeviceIdentifier()};
Object payload[] = {eventBeanWrapper.getDeviceIdentifier(), eventBeanWrapper.getPayload(),
eventBeanWrapper.getType()};
Object payload[] = {eventBeanWrapper.getPayload(), eventBeanWrapper.getType()};
try {
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.");
return Response.status(Response.Status.CREATED).entity(message).build();
} else {

Loading…
Cancel
Save