Merge pull request #653 from ruwany/master

Merging cloud-310 branch with master
revert-dabc3590
Charitha Goonetilleke 8 years ago committed by GitHub
commit 186b3e16e4

@ -33,6 +33,9 @@
} else if(action === 'getData'){
print(providerAPI.getData(id, type, timeFrom, timeTo));
return;
} else if(action === 'getAlerts'){
print(providerAPI.getAlerts(id));
return;
}
}());

@ -34,6 +34,7 @@ var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush;
var JS_MIN_VALUE = "-9007199254740992";
var tableName = "ORG_WSO2_GEO_FUSEDSPATIALEVENT";
var alertTable = "ORG_WSO2_GEO_ALERTSNOTIFICATION";
var typeMap = {
"bool": "string",
@ -130,9 +131,9 @@ var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush;
"query": luceneQuery,
"start": 0,
"count": limit,
"sortBy" : [{
"field" : "timeStamp",
"sortType" : "ASC"
"sortBy": [{
"field": "timeStamp",
"sortType": "ASC"
}]
};
result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage();
@ -151,4 +152,28 @@ var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush;
return data;
};
getAlerts = function (deviceId) {
var limit = 50;
var result;
//if there's a filter present, we should perform a Lucene search instead of reading the table
var luceneQuery = 'id:"' + deviceId;
var filter = {
"query": luceneQuery,
"start": 0,
"count": limit,
"sortBy": [{
"field": "timeStamp",
"sortType": "ASC"
}]
};
result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage();
result = JSON.parse(result);
var data = [];
for (var i = 0; i < result.length; i++) {
var values = result[i].values;
data.push(values);
}
return data;
};
}());

@ -509,38 +509,43 @@ function removeGeoFence(geoFenceElement, id) {
}
function getAlertsHistory(objectId) {
$.getJSON("/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/get_alerts_history.jag?objectId=" + objectId, function (data) {
var alertsContainer = $('#showAlertsArea').empty();
$.each(data, function (key, val) {
var alertDOMElement = document.createElement('a'); // Reason for using document.createElement (performance issue) http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent
switch (val.STATE) {
case "NORMAL":
$.ajax({
url: '/portal/store/carbon.super/fs/gadget/geo-dashboard/controllers/gadget-controller.jag?action=getAlerts&id=' + objectId,
method: "GET",
contentType: "application/json",
async: false,
success: function (data) {
var alertsContainer = $('#showAlertsArea').empty();
$.each(data, function (key, val) {
var alertDOMElement = document.createElement('a'); // Reason for using document.createElement (performance issue) http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent
switch (val.STATE) {
case "NORMAL":
// $(alertDOMElement).addClass("list-group-item list-group-item-info");
return;
case "WARNING":
$(alertDOMElement).addClass("list-group-item list-group-item-warning");
break;
case "ALERTED":
$(alertDOMElement).addClass("list-group-item list-group-item-danger");
break;
case "OFFLINE":
$(alertDOMElement).addClass("list-group-item list-group-item-success");
break;
}
$(alertDOMElement).html(val.INFORMATION);
$(alertDOMElement).css({marginTop: "5px"});
$(alertDOMElement).attr('onClick', 'showAlertInMap(this)');
// Set HTML5 data attributes for later use
$(alertDOMElement).attr('data-id', val.ID);
$(alertDOMElement).attr('data-latitude', val.LATITUDE);
$(alertDOMElement).attr('data-longitude', val.LONGITUDE);
$(alertDOMElement).attr('data-state', val.STATE);
$(alertDOMElement).attr('data-information', val.INFORMATION);
alertsContainer.append(alertDOMElement);
});
return;
case "WARNING":
$(alertDOMElement).addClass("list-group-item list-group-item-warning");
break;
case "ALERTED":
$(alertDOMElement).addClass("list-group-item list-group-item-danger");
break;
case "OFFLINE":
$(alertDOMElement).addClass("list-group-item list-group-item-success");
break;
}
$(alertDOMElement).html(val.INFORMATION);
$(alertDOMElement).css({marginTop: "5px"});
$(alertDOMElement).attr('onClick', 'showAlertInMap(this)');
// Set HTML5 data attributes for later use
$(alertDOMElement).attr('data-id', val.ID);
$(alertDOMElement).attr('data-latitude', val.LATITUDE);
$(alertDOMElement).attr('data-longitude', val.LONGITUDE);
$(alertDOMElement).attr('data-state', val.STATE);
$(alertDOMElement).attr('data-information', val.INFORMATION);
alertsContainer.append(alertDOMElement);
});
}
});
}

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<eventPublisher name="Geo-Publisher-RDBMS-GeoAlertNotifications"
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<from streamName="org.wso2.geo.AlertsNotifications" version="1.0.0"/>
<mapping customMapping="enable" type="map">
<property>
<from name="id"/>
<to name="id"/>
</property>
<property>
<from name="state"/>
<to name="state"/>
</property>
<property>
<from name="information"/>
<to name="information"/>
</property>
<property>
<from name="timeStamp"/>
<to name="timeStamp"/>
</property>
<property>
<from name="longitude"/>
<to name="longitude"/>
</property>
<property>
<from name="latitude"/>
<to name="latitude"/>
</property>
</mapping>
<to eventAdapterType="rdbms">
<property name="datasource.name">WSO2_GEO_DB</property>
<property name="table.name">alerts_history</property>
<property name="execution.mode">insert</property>
<property name="update.keys"/>
</to>
</eventPublisher>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EventStoreConfiguration>
<TableSchema>
<ColumnDefinition>
<Name>id</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>state</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>information</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>timeStamp</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>latitude</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>longitude</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>type</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
</TableSchema>
<Source>
<StreamId>Geo-Publisher-RDBMS-GeoAlertNotifications:1.0.0</StreamId>
</Source>
<MergeSchema>false</MergeSchema>
<RecordStoreName>EVENT_STORE</RecordStoreName>
</EventStoreConfiguration>

@ -16,6 +16,6 @@
~ under the License.
-->
<artifact name="Geo-Publisher-RDBMS-GeoAlertNotifications" version="1.0.0" type="event/publisher" serverRole="GeoDashboard">
<file>Geo-Publisher-RDBMS-GeoAlertNotifications-1.0.0.xml</file>
<artifact name="Geo-Publisher-RDBMS-GeoAlertNotifications" version="1.0.0" type="analytics/eventstore" serverRole="GeoDashboard">
<file>Geo-Publisher-RDBMS-GeoAlertNotifications.xml</file>
</artifact>

@ -1,55 +1,55 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center_horizontal"
android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" tools:context="org.wso2.carbon.iot.android.sense.RegisterActivity"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center_horizontal"
android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" tools:context="org.wso2.carbon.iot.android.sense.RegisterActivity"
android:weightSum="1">
<!-- Login progress -->
<ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:visibility="gone" />
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:visibility="gone" />
<ScrollView android:id="@+id/login_form" android:layout_width="match_parent"
android:layout_height="153dp"
android:fillViewport="false"
>
android:layout_height="153dp"
android:fillViewport="false"
>
<LinearLayout android:id="@+id/email_login_form" android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical">
android:layout_height="wrap_content" android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/prompt_username"
android:id="@+id/username"
android:inputType="text"
android:maxLines="1" android:singleLine="true"
/>
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/prompt_username"
android:id="@+id/username"
android:inputType="text"
android:maxLines="1" android:singleLine="true"
/>
<EditText android:id="@+id/password" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1" android:singleLine="true"
/>
android:layout_height="wrap_content" android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1" android:singleLine="true"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/hostname"
android:id="@+id/hostname"
android:text="https://localhost:8243"
android:inputType="text"
android:maxLines="1" android:singleLine="true"/>
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/hostname"
android:id="@+id/hostname"
android:text="https://localhost:8243"
android:inputType="text"
android:maxLines="1" android:singleLine="true"/>
</LinearLayout>
</ScrollView>
<Button android:id="@+id/device_register_button" style="?android:textAppearanceSmall"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:text="@string/action_sign_in"
android:textStyle="bold"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:text="@string/action_sign_in"
android:textStyle="bold"
android:layout_gravity="center_horizontal"/>
</LinearLayout>

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<artifact name="android_sense_receiver" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
<file>android_sense_receiver.xml</file>
</artifact>

@ -174,7 +174,6 @@
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_un_secured_devices_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_sense_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_sense_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_accelerometer_streams" version="1.0.0" include="true"

@ -40,7 +40,7 @@ public class MQTTContentValidator implements ContentValidator {
@Override
public String getType() {
return null;
return CDMF_MQTT_CONTENT_VALIDATOR;
}
@Override

@ -32,10 +32,10 @@
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>commons-codec.wso2</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-codec.wso2</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.analytics-common</groupId>
<artifactId>org.wso2.carbon.event.input.adapter.core</artifactId>
@ -76,10 +76,10 @@
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.input.adapter.extension</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.identity.jwt.client.extension</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.identity.jwt.client.extension</artifactId>
</dependency>
</dependencies>
<build>
@ -133,18 +133,22 @@
org.apache.http.impl.client;version="${httpclient.version.range}",
org.json.simple.*,
com.jayway.jsonpath.*,
org.wso2.carbon.identity.jwt.client.extension.*,
javax.net.ssl,
org.apache.commons.codec.binary,
org.apache.commons.logging,
org.apache.http.entity,
org.osgi.framework,
org.osgi.service.component,
org.osgi.service.http,
org.wso2.carbon.context,
org.wso2.carbon.core,
org.wso2.carbon.device.mgt.input.adapter.extension,
org.wso2.carbon.user.api
org.wso2.carbon.identity.jwt.client.extension.*,
javax.net.ssl,
org.apache.commons.codec.binary,
org.apache.commons.logging,
org.apache.http.entity,
org.osgi.framework,
org.osgi.service.component,
org.osgi.service.http,
org.wso2.carbon.context,
org.wso2.carbon.core,
org.wso2.carbon.device.mgt.input.adapter.extension,
org.wso2.carbon.user.api,
org.wso2.carbon.utils.multitenancy,
org.apache.axis2.context,
org.wso2.carbon.core.multitenancy.utils,
org.wso2.carbon.utils
</Import-Package>
</instructions>
</configuration>

@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.input.adapter.mqtt;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.internal.InputAdapterServiceDataHolder;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTAdapterListener;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTEventAdapterConstants;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTBrokerConnectionConfiguration;
@ -26,6 +27,7 @@ import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterListener;
import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterException;
import org.wso2.carbon.event.input.adapter.core.exception.TestConnectionNotSupportedException;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.util.Map;
import java.util.UUID;
@ -54,10 +56,12 @@ public class MQTTEventAdapter implements InputEventAdapter {
try {
mqttBrokerConnectionConfiguration = new MQTTBrokerConnectionConfiguration(eventAdapterConfiguration
,globalProperties);
String topic = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC);
String tenantDomain = topic.split("/")[0];
mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration
,eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC)
,eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID)
,eventAdapterListener, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
,topic
,eventAdapterConfiguration
,eventAdapterListener, tenantDomain);
} catch (Throwable t) {
throw new InputEventAdapterException(t.getMessage(), t);
}
@ -77,6 +81,10 @@ public class MQTTEventAdapter implements InputEventAdapter {
@Override
public void connect() {
if (!PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()
.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
return;
}
if (!mqttAdapterListener.isConnectionInitialized()) {
mqttAdapterListener.createConnection();
}

@ -17,6 +17,7 @@
*/
package org.wso2.carbon.device.mgt.input.adapter.mqtt.internal;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
@ -24,7 +25,9 @@ import org.osgi.service.http.HttpService;
import org.wso2.carbon.device.mgt.input.adapter.extension.InputAdapterExtensionService;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.MQTTEventAdapterFactory;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterFactory;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService;
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
import org.wso2.carbon.utils.ConfigurationContextService;
/**
* @scr.component name="input.iot.mqtt.AdapterService.component" immediate="true"
@ -38,6 +41,15 @@ import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerSer
* policy="dynamic"
* bind="setJWTClientManagerService"
* unbind="unsetJWTClientManagerService"
* @scr.reference name="input.adapter.service" interface="org.wso2.carbon.event.input.adapter.core.InputEventAdapterService"
* cardinality="1..1"
* policy="dynamic"
* bind="setInputEventAdapterService"
* unbind="unsetInputEventAdapterService"
* @scr.reference name="config.context.service"
* interface="org.wso2.carbon.utils.ConfigurationContextService"
* cardinality="1..1" policy="dynamic" bind="setConfigurationContextService"
* unbind="unsetConfigurationContextService"
*/
public class InputAdapterServiceComponent {
@ -80,4 +92,21 @@ public class InputAdapterServiceComponent {
InputAdapterServiceDataHolder.setJwtClientManagerService(null);
}
protected void setInputEventAdapterService(InputEventAdapterService inputEventAdapterService) {
InputAdapterServiceDataHolder.setInputEventAdapterService(inputEventAdapterService);
}
protected void unsetInputEventAdapterService(InputEventAdapterService inputEventAdapterService) {
InputAdapterServiceDataHolder.setInputEventAdapterService(null);
}
protected void setConfigurationContextService(ConfigurationContextService contextService) {
ConfigurationContext serverConfigContext = contextService.getServerConfigContext();
InputAdapterServiceDataHolder.setMainServerConfigContext(serverConfigContext);
}
protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
InputAdapterServiceDataHolder.setMainServerConfigContext(null);
}
}

@ -14,9 +14,11 @@
*/
package org.wso2.carbon.device.mgt.input.adapter.mqtt.internal;
import org.apache.axis2.context.ConfigurationContext;
import org.osgi.service.http.HttpService;
import org.wso2.carbon.device.mgt.input.adapter.extension.InputAdapterExtensionService;
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService;
/**
* common place to hold some OSGI service references.
@ -26,6 +28,8 @@ public final class InputAdapterServiceDataHolder {
private static HttpService httpService;
private static InputAdapterExtensionService inputAdapterExtensionService;
private static JWTClientManagerService jwtClientManagerService;
private static InputEventAdapterService inputEventAdapterService;
private static ConfigurationContext mainServerConfigContext;
private InputAdapterServiceDataHolder() {
}
@ -55,4 +59,20 @@ public final class InputAdapterServiceDataHolder {
JWTClientManagerService jwtClientManagerService) {
InputAdapterServiceDataHolder.jwtClientManagerService = jwtClientManagerService;
}
public static InputEventAdapterService getInputEventAdapterService() {
return inputEventAdapterService;
}
public static void setInputEventAdapterService(InputEventAdapterService inputEventAdapterService) {
InputAdapterServiceDataHolder.inputEventAdapterService = inputEventAdapterService;
}
public static ConfigurationContext getMainServerConfigContext() {
return mainServerConfigContext;
}
public static void setMainServerConfigContext(ConfigurationContext mainServerConfigContext) {
InputAdapterServiceDataHolder.mainServerConfigContext = mainServerConfigContext;
}
}

@ -17,6 +17,7 @@
*/
package org.wso2.carbon.device.mgt.input.adapter.mqtt.util;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -33,10 +34,12 @@ import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.core.ServerStatus;
import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentInfo;
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer;
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentValidator;
import org.wso2.carbon.device.mgt.input.adapter.mqtt.internal.InputAdapterServiceDataHolder;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration;
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterListener;
import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterRuntimeException;
import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
@ -63,26 +66,29 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
private MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration;
private String topic;
private int tenantId;
private String tenantDomain;
private boolean connectionSucceeded = false;
ContentValidator contentValidator;
ContentTransformer contentTransformer;
private ContentValidator contentValidator;
private ContentTransformer contentTransformer;
private InputEventAdapterConfiguration inputEventAdapterConfiguration;
private InputEventAdapterListener eventAdapterListener = null;
public MQTTAdapterListener(MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration,
String topic, String mqttClientId,
InputEventAdapterListener inputEventAdapterListener, int tenantId) {
String topic, InputEventAdapterConfiguration inputEventAdapterConfiguration,
InputEventAdapterListener inputEventAdapterListener, String tenantDomain) {
String mqttClientId = inputEventAdapterConfiguration.getProperties()
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID);
if(mqttClientId == null || mqttClientId.trim().isEmpty()){
mqttClientId = MqttClient.generateClientId();
}
this.inputEventAdapterConfiguration = inputEventAdapterConfiguration;
this.mqttBrokerConnectionConfiguration = mqttBrokerConnectionConfiguration;
this.cleanSession = mqttBrokerConnectionConfiguration.isCleanSession();
int keepAlive = mqttBrokerConnectionConfiguration.getKeepAlive();
this.topic = PropertyUtils.replaceTenantDomainProperty(topic);
this.eventAdapterListener = inputEventAdapterListener;
this.tenantId = tenantId;
this.tenantDomain = tenantDomain;
//SORTING messages until the server fetches them
String temp_directory = System.getProperty("java.io.tmpdir");
@ -145,7 +151,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
if (!mqttBrokerConnectionConfiguration.isGlobalCredentailSet()) {
registrationProfile.setClientName(MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX
+ mqttBrokerConnectionConfiguration.getAdapterName() +
"_" + tenantId);
"_" + tenantDomain);
registrationProfile.setIsSaasApp(false);
} else {
registrationProfile.setClientName(MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX
@ -186,6 +192,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
}
mqttClient.connect(connectionOptions);
mqttClient.subscribe(topic);
}
public void stopListener(String adapterName) {
@ -218,7 +225,12 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
log.debug(msgText);
}
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
TenantAxisUtils.getTenantConfigurationContext(tenantDomain,InputAdapterServiceDataHolder.getMainServerConfigContext());
InputEventAdapterListener inputEventAdapterListener = InputAdapterServiceDataHolder
.getInputEventAdapterService().getInputAdapterRuntime(PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getTenantId(), inputEventAdapterConfiguration.getName());
if (log.isDebugEnabled()) {
log.debug("Event received in MQTT Event Adapter - " + msgText);
@ -231,10 +243,10 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
msgText = (String) contentTransformer.transform(msgText, dynamicProperties);
contentInfo = contentValidator.validate(msgText, dynamicProperties);
if (contentInfo != null && contentInfo.isValidContent()) {
eventAdapterListener.onEvent(contentInfo.getMessage());
inputEventAdapterListener.onEvent(contentInfo.getMessage());
}
} else {
eventAdapterListener.onEvent(msgText);
inputEventAdapterListener.onEvent(msgText);
}
} finally {
PrivilegedCarbonContext.endTenantFlow();
@ -276,7 +288,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
private String getToken(String clientId, String clientSecret)
throws UserStoreException, JWTClientException {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId, true);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true);
try {
String scopes = mqttBrokerConnectionConfiguration.getBrokerScopes();
String username = mqttBrokerConnectionConfiguration.getUsername();

@ -20,14 +20,22 @@ 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.device.mgt.common.*;
import org.wso2.carbon.context.PrivilegedCarbonContext;
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.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
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.PolicyComplianceException;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.mdm.services.android.bean.ErrorResponse;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
@ -38,7 +46,6 @@ 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.device.mgt.common.policy.mgt.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.validation.Valid;
@ -219,8 +226,30 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device);
if (status) {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(androidDevice.getDeviceIdentifier(),
device.getType());
//Immediately update location information from initial payload
DeviceLocation deviceLocation = extractLocation(deviceIdentifier, androidDevice.getProperties());
if (deviceLocation != null) {
try {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
DeviceInformationManager informationManager =
(DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null);
informationManager.addDeviceLocation(deviceLocation);
} catch (DeviceDetailsMgtException e) {
String msg = "Error occurred while updating the device location upon android " +
"', which carries the id '" + androidDevice.getDeviceIdentifier() + "'";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
}
//Adding Tasks to get device information
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
deviceIdentifiers.add(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType()));
deviceIdentifiers.add(deviceIdentifier);
List<String> taskOperaions = new ArrayList<>();
taskOperaions.add(AndroidConstants.OperationCodes.APPLICATION_LIST);
@ -416,4 +445,41 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
}
}
/**
* Extracts the device location
*
* @param deviceIdentifier
* @param properties
* @return returns null when location not found
*/
private DeviceLocation extractLocation(DeviceIdentifier deviceIdentifier, List<Device.Property> properties)
throws DeviceManagementException {
DeviceLocation location = null;
String latitude = "", longitude = "";
if (properties == null) return null;
for (Device.Property property : properties) {
String propertyName = property.getName();
if (propertyName == null) continue;
if (propertyName.equals("LATITUDE")) {
latitude = property.getValue();
if (!longitude.isEmpty()) break;
} else if (propertyName.equals("LONGITUDE")) {
longitude = property.getValue();
if (!latitude.isEmpty()) break;
}
}
if (!latitude.isEmpty() && !longitude.isEmpty()) {
location = new DeviceLocation();
location.setLatitude(Double.valueOf(latitude));
location.setLongitude(Double.valueOf(longitude));
location.setDeviceIdentifier(deviceIdentifier);
Device savedDevice = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
location.setDeviceId(savedDevice.getId());
}
return location;
}
}

@ -20,7 +20,7 @@
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 add-padding-top-2x add-padding-bottom-2x">
{{#if isVirtual}}
<h3 class="text-center add-padding-bottom-4x">Download our virtual Android device, enroll it with WSO2
Device Cloud and try it out!</h3>
Device Cloud and try it out!</h3>
<div class="text-center"><a
href="{{@unit.publicUri}}/assets/android-tryit.ZIP"
class="btn-operations remove-margin download_agent">
@ -64,7 +64,7 @@
{{else}}
<p class="doc-link text-center">Need help? Read <a
href="https://docs.wso2.com/display/IoTS310/Android" target="_blank">WSO2
IoT Server documentation.</a></p>
IoT Server documentation.</a></p>
{{/if}}
</div>
@ -79,11 +79,11 @@
</div>
</div>
{{#if isCloud}}
<div class="row grey-bg">
{{#if isVirtual}}
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 1</strong></h5>
<div class="row grey-bg">
{{#if isCloud}}
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 1</strong></h5>
{{#if isVirtual}}
<div class="add-min-height">
<ol>
<li>Unzip the 'android-tryit.zip file and run the 'start' script on your terminal.</li>
@ -107,97 +107,101 @@
</ol>
</div>
<img src="{{@unit.publicUri}}/images/android-tryit.png" class="img-responsive">
</div>
{{else}}
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 1</strong></h5>
{{else}}
<div class="add-min-height">
<p>Let's start by opening the Android agent on your device.
<br/>Tap on <b>WSO2 Device Management Agent</b>.
</p>
</div>
<img src="{{@unit.publicUri}}/images/launch_agent.png" class="img-responsive">
</div>
{{/if}}
{{/if}}
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 col-md-offset-1 col-lg-offset-1 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 2</strong></h5>
<div class="add-min-height">
<p>Enter your :
<p>
<p>Enter your :</p>
<ul>
<li>Organization: <b>{{@user.domain}}</b></li>
<li>Username: <b>{{@user.username}}</b></li>
<li>Password: <i>Your Cloud password.</i></li>
</ul>
</div>
<img src="{{@unit.publicUri}}/images/register.png" class="img-responsive">
<img src="{{@unit.publicUri}}/images/register-cloud.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 col-md-offset-1 col-lg-offset-1 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 3</strong></h5>
<div class="add-min-height">
<p>To successfully register the virtual device,</p>
<p>To successfully register the device,</p>
<ul>
<li>Tap <b>ALLOW</b> to provide the necessary permissions.</li>
<li>Tap <b>ACTIVATE</b> to enable the device administrator.</li>
</ul>
</div>
</div>
{{else}}
<div class="row grey-bg">
{{else}}
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 1</strong></h5>
{{#if isVirtual}}
<ol>
<li>Unzip the 'android-tryit.zip file and run the 'start' script on your terminal.</li>
<li>Download and install the Android SDK.
<ul>
<li>If you already have an Android SDK on your computer, please provide the location of the
SDK.
</li>
<li>Else, this tool will download and install the minimum SDK components required to run the
emulator.
This is a one-time process.
</li>
</ul>
</li>
<li>Next, you will be asked to create an AVD:
<ul>
<li>If you don't have one, the WSO2_AVD will be created for you.</li>
<li>Else, you can use an existing AVD to try out IoT Android agent.</li>
</ul>
</li>
</ol>
<div class="add-min-height">
<ol>
<li>Unzip the 'android-tryit.zip file and run the 'start' script on your terminal.</li>
<li>Download and install the Android SDK.
<ul>
<li>If you already have an Android SDK on your computer, please provide the location of
the
SDK.
</li>
<li>Else, this tool will download and install the minimum SDK components required to run
the
emulator.
This is a one-time process.
</li>
</ul>
</li>
<li>Next, you will be asked to create an AVD:
<ul>
<li>If you don't have one, the WSO2_AVD will be created for you.</li>
<li>Else, you can use an existing AVD to try out IoT Android agent.</li>
</ul>
</li>
</ol>
</div>
<img src="{{@unit.publicUri}}/images/android-tryit.png" class="img-responsive">
{{else}}
<p>Let's start by installing the Android agent on your device. Open the downloaded file, and tap
<b>INSTALL</b>.</p>
<div class="add-min-height">
<p>Let's start by installing the Android agent on your device. Open the downloaded file, and tap
<b>INSTALL</b>.</p>
</div>
<img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive">
{{/if}}
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 2</strong></h5>
<p>Tap Skip to proceed with the default enrollment process.</p>
<div class="add-min-height">
<p>Tap Skip to proceed with the default enrollment process.</p>
</div>
<img src="{{@unit.publicUri}}/images/set_profile.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 3</strong></h5>
<p>Enter the server address based on your environment, in the text box provided.</p>
<div class="add-min-height">
<p>Enter the server address based on your environment, in the text box provided.</p>
</div>
<img src="{{@unit.publicUri}}/images/registration.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 4</strong></h5>
<p>Enter your:
<p>
<ul>
<li>Organization: <b>{{@user.domain}}</b></li>
<li>Username: <b>{{@user.username}}</b></li>
<li>Password: <i>Your password.</i></li>
</ul>
<div class="add-min-height">
<p>Enter your:</p>
<ul>
<li>Organization: <b>{{@user.domain}}</b></li>
<li>Username: <b>{{@user.username}}</b></li>
<li>Password: <i>Your password.</i></li>
</ul>
</div>
<img src="{{@unit.publicUri}}/images/register.png" class="img-responsive">
</div>
{{/if}}
{{/if}}
</div>
{{#zone "topCss"}}

@ -1,31 +1,31 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/devicetypes/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/webapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/webapps/,target:${installFolder}/../../../repository/deployment/server/webapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/carbonapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/carbonapps/,target:${installFolder}/../../../repository/resources/devicetypes/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/android_sense/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/carbonapps/,target:${installFolder}/../../resources/devicetypes/android_sense/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/android_sense,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/datasources/,target:${installFolder}/../../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/jaggeryapps/,target:${installFolder}/../../../repository/deployment/server/jaggeryapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/database/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/database/,target:${installFolder}/../../../repository/database/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,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.iot.androidsense_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\
instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/android_sense.war);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/android_sense);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/android_sense.war);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/android_sense);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android_sense);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/sketches/android_sense);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../conf/datasources/androidsense-datasources.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/database/AndroidSenseDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/carbonapps/android_sense.car);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/android_sense.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/devicetypes/android_sense.car);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../resources/sketches/android_sense);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/androidsense-datasources.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/AndroidSenseDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/android_sense.car);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/devicetypes/android_sense.xml);\

@ -17,11 +17,12 @@
~ under the License.
-->
<eventReceiver name="android_sense_receiver" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
<eventReceiver name="android_sense_receiver-${tenant-domain}" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
<from eventAdapterType="oauth-mqtt">
<property name="topic">${tenant-domain}/android_sense/+/data</property>
<property name="contentValidator">iot-mqtt</property>
<property name="cleanSession">true</property>
<property name="clientId">android_sense_receiver-${tenant-domain}</property>
</from>
<mapping customMapping="disable" type="json"/>
<to streamName="org.wso2.iot.android.sense" version="1.0.0"/>

@ -0,0 +1,63 @@
{
"name": "org.wso2.iot.android.sense",
"version": "1.0.0",
"nickName": "android_sense_stream",
"description": "This hold the device type stream of android sense",
"metaData": [
{"name": "owner", "type": "STRING"},
{"name": "deviceId", "type": "STRING"},
{"name": "type", "type": "STRING"},
{"name": "timestamp", "type": "LONG"}
],
"payloadData": [
{"name": "battery", "type": "INT"},
{"name": "battery_state", "type": "STRING"},
{"name": "battery_status", "type": "STRING"},
{"name": "battery_temperature", "type": "INT"},
{"name": "gps_lat", "type": "DOUBLE"},
{"name": "gps_long", "type": "DOUBLE"},
{"name": "accelerometer_x", "type": "FLOAT"},
{"name": "accelerometer_y", "type": "FLOAT"},
{"name": "accelerometer_z", "type": "FLOAT"},
{"name": "speed_limit", "type": "FLOAT"},
{"name": "turn_way", "type": "STRING"},
{"name": "magnetic_x", "type": "FLOAT"},
{"name": "magnetic_y", "type": "FLOAT"},
{"name": "magnetic_z", "type": "FLOAT"},
{"name": "gyroscope_x", "type": "FLOAT"},
{"name": "gyroscope_y", "type": "FLOAT"},
{"name": "gyroscope_z", "type": "FLOAT"},
{"name": "light", "type": "FLOAT"},
{"name": "pressure", "type": "FLOAT"},
{"name": "proximity", "type": "FLOAT"},
{"name": "gravity_x", "type": "FLOAT"},
{"name": "gravity_y", "type": "FLOAT"},
{"name": "gravity_z", "type": "FLOAT"},
{"name": "rotation_x", "type": "FLOAT"},
{"name": "rotation_y", "type": "FLOAT"},
{"name": "rotation_z", "type": "FLOAT"},
{"name": "word", "type": "STRING"},
{"name": "word_sessionId", "type": "STRING"},
{"name": "word_status", "type": "STRING"},
{"name": "beacon_major", "type": "INT"},
{"name": "beacon_minor", "type": "INT"},
{"name": "beacon_proximity", "type": "STRING"},
{"name": "beacon_uuid", "type": "INT"},
{"name": "call_number", "type": "STRING"},
{"name": "call_type", "type": "STRING"},
{"name": "call_start_time", "type": "LONG"},
{"name": "call_end_time", "type": "LONG"},
{"name": "screen_state", "type": "STRING"},
{"name": "audio_playing", "type": "BOOL"},
{"name": "headset_on", "type": "BOOL"},
{"name": "music_volume", "type": "INT"},
{"name": "activity_type", "type": "INT"},
{"name": "confidence", "type": "INT"},
{"name": "sms_number", "type": "STRING"},
{"name": "application_name", "type": "STRING"},
{"name": "action", "type": "STRING"},
{"name": "data_type", "type": "STRING"},
{"name": "data_sent", "type": "LONG"},
{"name": "data_received", "type": "LONG"}
]
}

@ -1128,7 +1128,7 @@
<javax.ws.rs.version>1.1.1</javax.ws.rs.version>
<!-- Carbon Device Management -->
<carbon.devicemgt.version>2.0.42</carbon.devicemgt.version>
<carbon.devicemgt.version>2.0.49</carbon.devicemgt.version>
<carbon.devicemgt.version.range>[2.0.0, 3.0.0)</carbon.devicemgt.version.range>
<!-- Carbon App Management -->
@ -1173,7 +1173,7 @@
<swagger.version>1.5.8</swagger.version>
<!-- Carbon Analytics -->
<carbon.analytics.common.version>5.1.3</carbon.analytics.common.version>
<carbon.analytics.common.version>5.1.17</carbon.analytics.common.version>
<carbon.analytics.common.version.range>[5.1.3,6.0.0)</carbon.analytics.common.version.range>
<carbon.analytics.version>1.3.3</carbon.analytics.version>
<carbon.analytics.version.range>[1.3.0,2.0.0)</carbon.analytics.version.range>

Loading…
Cancel
Save