mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge pull request #712 from ayyoob/devicetype-3.1.0
fixed virtual firealarm analytics flow and added default pull notification listner implementation
This commit is contained in:
commit
ba8878e77d
@ -20,7 +20,7 @@
|
||||
<artifacts>
|
||||
<artifact name="virtualfirealarm" version="1.0.0" type="carbon/application">
|
||||
<dependency artifact="virtualfirealarm_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="temperature_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="virtual_firealarm_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="temperature_store" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="temperature_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
</artifact>
|
||||
|
||||
@ -17,6 +17,6 @@
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<artifact name="temperature_publisher" version="1.0.0" type="event/publisher" serverRole="DataAnalyticsServer">
|
||||
<file>temperature_publisher.xml</file>
|
||||
<artifact name="virtual_firealarm_publisher" version="1.0.0" type="event/publisher" serverRole="DataAnalyticsServer">
|
||||
<file>virtual_firealarm_publisher.xml</file>
|
||||
</artifact>
|
||||
@ -17,7 +17,7 @@
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<eventPublisher name="temperature_publisher" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
|
||||
<eventPublisher name="virtual_firealarm_publisher" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
|
||||
<from streamName="iot.per.device.stream.virtualfirealarm.temperature" version="1.0.0"/>
|
||||
<mapping customMapping="disable" type="wso2event"/>
|
||||
<to eventAdapterType="secured-websocket"/>
|
||||
@ -25,19 +25,20 @@ import org.wso2.carbon.device.mgt.input.adapter.extension.ContentValidator;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.InputAdapterExtensionService;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.InputAdapterExtensionServiceImpl;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.transformer.DefaultContentTransformer;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.transformer.MQTTContentTransformer;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.validator.DefaultContentValidator;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.validator.HTTPContentValidator;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.validator.MQTTContentValidator;
|
||||
|
||||
/**
|
||||
* @scr.component name="input.adapter.extension.adapterService.component" immediate="true"
|
||||
* @scr.reference name="InputAdapterServiceComponent.service"
|
||||
* @scr.reference name="InputAdapterServiceComponent.content.validator.service"
|
||||
* interface="org.wso2.carbon.device.mgt.input.adapter.extension.ContentValidator"
|
||||
* cardinality="0..n"
|
||||
* policy="dynamic"
|
||||
* bind="setContentValidator"
|
||||
* unbind="unsetContentValidator"
|
||||
* * @scr.reference name="InputAdapterServiceComponent.service"
|
||||
* @scr.reference name="InputAdapterServiceComponent.transformer.service"
|
||||
* interface="org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer"
|
||||
* cardinality="0..n"
|
||||
* policy="dynamic"
|
||||
@ -56,6 +57,7 @@ public class InputAdapterServiceComponent {
|
||||
}
|
||||
|
||||
InputAdapterServiceDataHolder.getInstance().addContentTransformer(new DefaultContentTransformer());
|
||||
InputAdapterServiceDataHolder.getInstance().addContentTransformer(new MQTTContentTransformer());
|
||||
InputAdapterServiceDataHolder.getInstance().addContentValidator(new DefaultContentValidator());
|
||||
InputAdapterServiceDataHolder.getInstance().addContentValidator(new HTTPContentValidator());
|
||||
InputAdapterServiceDataHolder.getInstance().addContentValidator(new MQTTContentValidator());
|
||||
@ -87,7 +89,7 @@ public class InputAdapterServiceComponent {
|
||||
InputAdapterServiceDataHolder.getInstance().addContentTransformer(contentTransformer);
|
||||
}
|
||||
|
||||
protected void unsetContentValidator(ContentTransformer contentTransformer) {
|
||||
protected void unsetContentTransformer(ContentTransformer contentTransformer) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Un-setting ContentTransformer Service");
|
||||
}
|
||||
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.input.adapter.extension.transformer;
|
||||
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This holds the default implementation of ContentTransformer
|
||||
*/
|
||||
public class MQTTContentTransformer implements ContentTransformer {
|
||||
private static final String MQTT_CONTENT_TRANSFORMER = "device-meta-transformer";
|
||||
private static final String TOPIC = "topic";
|
||||
private static String JSON_ARRAY_START_CHAR = "[";
|
||||
|
||||
private static final Log log = LogFactory.getLog(MQTTContentTransformer.class);
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MQTT_CONTENT_TRANSFORMER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transform(Object messagePayload, Map<String, Object> dynamicProperties) {
|
||||
String topic = (String) dynamicProperties.get(TOPIC);
|
||||
String topics[] = topic.split("/");
|
||||
String deviceId = topics[2];
|
||||
String deviceType = topics[1];
|
||||
String message = (String) messagePayload;
|
||||
try {
|
||||
if (message.startsWith(JSON_ARRAY_START_CHAR)) {
|
||||
return processMultipleEvents(message, deviceId, deviceType);
|
||||
} else {
|
||||
return processSingleEvent(message, deviceId, deviceType);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
log.error("Invalid input " + message, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String processSingleEvent(String msg, String deviceIdFromTopic, String deviceIdJsonPath)
|
||||
throws ParseException {
|
||||
JSONParser parser = new JSONParser();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("deviceId", deviceIdFromTopic);
|
||||
JSONObject eventObject = new JSONObject();
|
||||
eventObject.put("payloadData", parser.parse(msg));
|
||||
eventObject.put("metaData", jsonObject);
|
||||
JSONObject event = new JSONObject();
|
||||
event.put("event", eventObject);
|
||||
return event.toJSONString();
|
||||
}
|
||||
|
||||
private String processMultipleEvents(String msg, String deviceIdFromTopic, String deviceIdJsonPath)
|
||||
throws ParseException {
|
||||
JSONParser jsonParser = new JSONParser();
|
||||
JSONArray jsonArray = (JSONArray) jsonParser.parse(msg);
|
||||
JSONArray eventsArray = new JSONArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
eventsArray.add(i, processSingleEvent(jsonArray.get(i).toString(), deviceIdFromTopic, deviceIdJsonPath));
|
||||
}
|
||||
return eventsArray.toJSONString();
|
||||
}
|
||||
}
|
||||
@ -32,11 +32,11 @@ import java.util.Map;
|
||||
public class MQTTContentValidator implements ContentValidator {
|
||||
private static final String JSON_ARRAY_START_CHAR = "[";
|
||||
private static final Log log = LogFactory.getLog(MQTTContentValidator.class);
|
||||
private static final String CDMF_MQTT_CONTENT_VALIDATOR = "iot-mqtt";
|
||||
public static final String DEVICE_ID_JSON_PATH = "event.metaData.deviceId";
|
||||
public static final String DEVICE_TYPE_JSON_PATH = "event.metaData.deviceId";
|
||||
public static final String TOPIC = "topic";
|
||||
public static final int DEVICE_ID_TOPIC_HIERARCHY_INDEX = 2;
|
||||
private static final String CDMF_MQTT_CONTENT_VALIDATOR = "deviceid-topic-content-validator";
|
||||
private static final String DEVICE_ID_JSON_PATH = "event.metaData.deviceId";
|
||||
private static final String DEVICE_TYPE_JSON_PATH = "event.metaData.deviceId";
|
||||
private static final String TOPIC = "topic";
|
||||
private static final int DEVICE_ID_TOPIC_HIERARCHY_INDEX = 2;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
@ -47,15 +47,14 @@ public class MQTTContentValidator implements ContentValidator {
|
||||
public ContentInfo validate(Object msgPayload, Map<String, Object> dynamicParams) {
|
||||
String topic = (String) dynamicParams.get(TOPIC);
|
||||
String topics[] = topic.split("/");
|
||||
String deviceIdJsonPath = DEVICE_ID_JSON_PATH;
|
||||
int deviceIdInTopicHierarchyLevelIndex = DEVICE_ID_TOPIC_HIERARCHY_INDEX;
|
||||
String deviceIdFromTopic = topics[deviceIdInTopicHierarchyLevelIndex];
|
||||
boolean status;
|
||||
String message = (String) msgPayload;
|
||||
if (message.startsWith(JSON_ARRAY_START_CHAR)) {
|
||||
status = processMultipleEvents(message, deviceIdFromTopic, deviceIdJsonPath);
|
||||
status = processMultipleEvents(message, deviceIdFromTopic, DEVICE_ID_JSON_PATH);
|
||||
} else {
|
||||
status = processSingleEvent(message, deviceIdFromTopic, deviceIdJsonPath);
|
||||
status = processSingleEvent(message, deviceIdFromTopic, DEVICE_ID_JSON_PATH);
|
||||
}
|
||||
return new ContentInfo(status, msgPayload);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package org.wso2.carbon.device.mgt.input.adapter.mqtt;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.core.ServerStatus;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTAdapterListener;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTBrokerConnectionConfiguration;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTEventAdapterConstants;
|
||||
@ -83,8 +84,10 @@ public class MQTTEventAdapter implements InputEventAdapter {
|
||||
.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
||||
return;
|
||||
}
|
||||
if (!mqttAdapterListener.isConnectionInitialized()) {
|
||||
mqttAdapterListener.createConnection();
|
||||
synchronized (this.mqttAdapterListener) {
|
||||
if (!mqttAdapterListener.isConnectionInitialized()) {
|
||||
mqttAdapterListener.createConnection();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -98,15 +101,24 @@ public class MQTTEventAdapter implements InputEventAdapter {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
if (mqttAdapterListener != null) {
|
||||
mqttAdapterListener.stopListener(eventAdapterConfiguration.getName());
|
||||
if (ServerStatus.getCurrentStatus().equals(ServerStatus.STATUS_SHUTTING_DOWN)) {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
synchronized (mqttAdapterListener) {
|
||||
if (mqttAdapterListener != null) {
|
||||
mqttAdapterListener.stopListener(eventAdapterConfiguration.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
thread.join(2000);
|
||||
} else {
|
||||
if (mqttAdapterListener != null) {
|
||||
mqttAdapterListener.stopListener(eventAdapterConfiguration.getName());
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
thread.join(2000);
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class MQTTEventAdapterFactory extends InputEventAdapterFactory {
|
||||
contentTransformer.setRequired(false);
|
||||
contentTransformer.setHint(
|
||||
resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_TRANSFORMER_TYPE_HINT));
|
||||
contentTransformer.setDefaultValue(MQTTEventAdapterConstants.DEFAULT);
|
||||
contentTransformer.setDefaultValue(MQTTEventAdapterConstants.EMPTY);
|
||||
propertyList.add(contentTransformer);
|
||||
|
||||
// set clientId
|
||||
|
||||
@ -69,7 +69,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
||||
private MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration;
|
||||
private String topic;
|
||||
private String tenantDomain;
|
||||
private boolean connectionSucceeded = false;
|
||||
private volatile boolean connectionSucceeded = false;
|
||||
private ContentValidator contentValidator;
|
||||
private ContentTransformer contentTransformer;
|
||||
private InputEventAdapterConfiguration inputEventAdapterConfiguration;
|
||||
@ -91,6 +91,10 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
||||
this.topic = PropertyUtils.replaceTenantDomainProperty(topic);
|
||||
this.eventAdapterListener = inputEventAdapterListener;
|
||||
this.tenantDomain = this.topic.split("/")[0];
|
||||
//this is to allow server listener from IoT Core to connect.
|
||||
if (this.tenantDomain.equals("+")) {
|
||||
this.tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
|
||||
}
|
||||
|
||||
//SORTING messages until the server fetches them
|
||||
String temp_directory = System.getProperty("java.io.tmpdir");
|
||||
@ -126,8 +130,8 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
||||
.getContentTransformer(contentTransformerType);
|
||||
}
|
||||
} catch (MqttException e) {
|
||||
log.error("Exception occurred while subscribing to MQTT broker at "
|
||||
+ mqttBrokerConnectionConfiguration.getBrokerUrl());
|
||||
log.error("Exception occurred while creating an mqtt client to "
|
||||
+ mqttBrokerConnectionConfiguration.getBrokerUrl() + " reason code:" + e.getReasonCode());
|
||||
throw new InputEventAdapterRuntimeException(e);
|
||||
}
|
||||
}
|
||||
@ -267,8 +271,8 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
||||
ContentInfo contentInfo;
|
||||
Map<String, Object> dynamicProperties = new HashMap<>();
|
||||
dynamicProperties.put(MQTTEventAdapterConstants.TOPIC, topic);
|
||||
msgText = (String) contentTransformer.transform(msgText, dynamicProperties);
|
||||
contentInfo = contentValidator.validate(msgText, dynamicProperties);
|
||||
Object transformedMessage = contentTransformer.transform(msgText, dynamicProperties);
|
||||
contentInfo = contentValidator.validate(transformedMessage, dynamicProperties);
|
||||
if (contentInfo != null && contentInfo.isValidContent()) {
|
||||
inputEventAdapterListener.onEvent(contentInfo.getMessage());
|
||||
}
|
||||
|
||||
@ -106,9 +106,17 @@ public class MQTTBrokerConnectionConfiguration {
|
||||
this.dcrUrl = PropertyUtils
|
||||
.replaceMqttProperty(globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL));
|
||||
this.contentValidatorType = globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_TYPE);
|
||||
String contentValidatorTypeLocal = eventAdapterConfiguration.getProperties()
|
||||
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_TYPE);
|
||||
if (contentValidatorType == null || contentValidatorType.isEmpty()) {
|
||||
this.contentValidatorType = eventAdapterConfiguration.getProperties()
|
||||
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_TYPE);
|
||||
} else if (contentValidatorTypeLocal != null && !contentValidatorTypeLocal.equals(MQTTEventAdapterConstants.EMPTY)) {
|
||||
this.contentValidatorType = eventAdapterConfiguration.getProperties()
|
||||
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_TYPE);
|
||||
}
|
||||
if (this.contentValidatorType.equals(MQTTEventAdapterConstants.EMPTY)) {
|
||||
this.contentValidatorType = MQTTEventAdapterConstants.DEFAULT;
|
||||
}
|
||||
String cleanSession = globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION);
|
||||
if (cleanSession == null || cleanSession.isEmpty()) {
|
||||
|
||||
@ -61,6 +61,7 @@ public class MQTTEventAdapterConstants {
|
||||
public static final String CLIENT_SECRET = "clientSecret";
|
||||
public static final String CLIENT_NAME = "client_name";
|
||||
public static final String DEFAULT = "default";
|
||||
public static final String EMPTY = "";
|
||||
public static final String MQTT_CONTENT_VALIDATION_DEFAULT_PARAMETERS = "";
|
||||
public static final String TOPIC = "topic";
|
||||
public static final String PAYLOAD = "payload";
|
||||
|
||||
@ -74,11 +74,13 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
||||
private static Log log = LogFactory.getLog(DeviceAccessBasedMQTTAuthorizer.class);
|
||||
private AuthorizationConfigurationManager MQTTAuthorizationConfiguration;
|
||||
private static final String CDMF_SERVER_BASE_CONTEXT = "/api/device-mgt/v1.0";
|
||||
private static final String DEFAULT_ADMIN_PERMISSION = "permission/admin/device-mgt";
|
||||
private static final String CACHE_MANAGER_NAME = "mqttAuthorizationCacheManager";
|
||||
private static final String CACHE_NAME = "mqttAuthorizationCache";
|
||||
private static DeviceAccessAuthorizationAdminService deviceAccessAuthorizationAdminService;
|
||||
private static OAuthRequestInterceptor oAuthRequestInterceptor;
|
||||
private static final String GATEWAY_ERROR_CODE = "<am:code>404</am:code>";
|
||||
private static final String ALL_TENANT_DOMAIN = "+";
|
||||
|
||||
public DeviceAccessBasedMQTTAuthorizer() {
|
||||
oAuthRequestInterceptor = new OAuthRequestInterceptor();
|
||||
@ -102,6 +104,13 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
||||
try {
|
||||
String topics[] = topic.split("/");
|
||||
String tenantDomainFromTopic = topics[0];
|
||||
if ("+".equals(tenantDomainFromTopic)) {
|
||||
if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(authorizationSubject.getTenantDomain())
|
||||
&& isUserAuthorized(authorizationSubject, DEFAULT_ADMIN_PERMISSION, UI_EXECUTE)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!tenantDomainFromTopic.equals(authorizationSubject.getTenantDomain())) {
|
||||
return false;
|
||||
}
|
||||
@ -124,7 +133,7 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
||||
return false;
|
||||
} catch (FeignException e) {
|
||||
oAuthRequestInterceptor.resetApiApplicationKey();
|
||||
if (e.getMessage().contains(GATEWAY_ERROR_CODE)) {
|
||||
if (e.getMessage().contains(GATEWAY_ERROR_CODE) || e.status() == 404) {
|
||||
log.error("Failed to connect to the device authorization service.");
|
||||
} else {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
@ -125,6 +125,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
|
||||
public void resetApiApplicationKey() {
|
||||
apiApplicationKey = null;
|
||||
tokenIssuerService = null;
|
||||
}
|
||||
|
||||
private static Client getSSLClient() {
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
<module>cdmf-transport-adapters</module>
|
||||
<module>mb-extensions</module>
|
||||
<module>siddhi-extensions</module>
|
||||
<module>pull-notification-listeners</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>pull-notification-listeners</artifactId>
|
||||
<version>4.0.5-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.mqtt.notification.listener</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>WSO2 Carbon - MQTT Pull Notification Listener Implementation</name>
|
||||
<description>WSO2 Carbon - MQTT Pull Notification Lister Implementation</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.analytics-common</groupId>
|
||||
<artifactId>org.wso2.carbon.event.input.adapter.core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.input.adapter.extension</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||
<Bundle-Version>${carbon.devicemgt.plugins.version}</Bundle-Version>
|
||||
<Bundle-Description>MQTT Pull Notification Provider Bundle</Bundle-Description>
|
||||
<Export-Package>
|
||||
!org.wso2.carbon.device.mgt.mqtt.notification.listener.internal,
|
||||
org.wso2.carbon.device.mgt.mqtt.notification.listener.*
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.osgi.framework,
|
||||
org.osgi.service.component,
|
||||
org.apache.commons.logging,
|
||||
org.wso2.carbon.device.mgt.common.*,
|
||||
org.wso2.carbon.device.mgt.core.service,
|
||||
com.google.gson,
|
||||
org.wso2.carbon.context,
|
||||
org.wso2.carbon.device.mgt.input.adapter.extension,
|
||||
org.wso2.carbon.event.input.adapter.core,
|
||||
org.wso2.carbon.event.input.adapter.core.exception,
|
||||
org.wso2.carbon.user.api,
|
||||
org.wso2.carbon.core,
|
||||
org.wso2.carbon.device.mgt.core.config,
|
||||
org.wso2.carbon.device.mgt.core.config.pull.notification,
|
||||
org.wso2.carbon.utils.multitenancy
|
||||
</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationExecutionFailedException;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.MqttNotificationDataHolder;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterSubscription;
|
||||
import org.wso2.carbon.user.api.UserStoreException;
|
||||
|
||||
/**
|
||||
* Creates a event subscription for the input adapter.
|
||||
*/
|
||||
public class DeviceTypeOperationAdapterSubscription implements InputEventAdapterSubscription {
|
||||
private static final Log log = LogFactory.getLog(DeviceTypeOperationAdapterSubscription.class);
|
||||
|
||||
@Override
|
||||
public void onEvent(Object o) {
|
||||
|
||||
if (o == null || !(o instanceof NotificationMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationMessage notificationMessage = (NotificationMessage) o;
|
||||
PrivilegedCarbonContext.startTenantFlow();
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(notificationMessage.getTenantDomain(),
|
||||
true);
|
||||
String deviceType = "";
|
||||
try {
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(PrivilegedCarbonContext.
|
||||
getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration().getAdminUserName());
|
||||
deviceType = notificationMessage.getDeviceIdentifier().getType();
|
||||
MqttNotificationDataHolder.getInstance().getDeviceManagementProviderService().
|
||||
notifyPullNotificationSubscriber(notificationMessage.getDeviceIdentifier(),
|
||||
notificationMessage.getOperation());
|
||||
} catch (UserStoreException e) {
|
||||
log.error("Failed to retrieve tenant username", e);
|
||||
} catch (PullNotificationExecutionFailedException e) {
|
||||
log.error("Failed to execute device type pull notification subscriber execution for device type" + deviceType,
|
||||
e);
|
||||
} finally {
|
||||
PrivilegedCarbonContext.endTenantFlow();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
|
||||
public class NotificationMessage {
|
||||
|
||||
private String tenantDomain;
|
||||
private DeviceIdentifier deviceIdentifier;
|
||||
private Operation operation;
|
||||
|
||||
public NotificationMessage(String tenantDomain, DeviceIdentifier deviceIdentifier,Operation operation) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
this.operation = operation;
|
||||
this.deviceIdentifier = deviceIdentifier;
|
||||
}
|
||||
|
||||
public String getTenantDomain() {
|
||||
return tenantDomain;
|
||||
}
|
||||
|
||||
public void setTenantDomain(String tenantDomain) {
|
||||
this.tenantDomain = tenantDomain;
|
||||
}
|
||||
|
||||
public Operation getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setNotificationContext(
|
||||
Operation operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public DeviceIdentifier getDeviceIdentifier() {
|
||||
return deviceIdentifier;
|
||||
}
|
||||
|
||||
public void setDeviceIdentifier(DeviceIdentifier deviceIdentifier) {
|
||||
this.deviceIdentifier = deviceIdentifier;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This transforms the incomming message payload to notification message, inorder to pass this
|
||||
* information before its passed to the input adapter subscriber.
|
||||
*/
|
||||
public class PullNotificationMqttContentTransformer implements ContentTransformer {
|
||||
|
||||
public static final String MQTT_NOTIFICATION_MESSAGE_TRANSFORMER = "mqtt-operation-transformer";
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return MQTT_NOTIFICATION_MESSAGE_TRANSFORMER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transform(Object message, Map<String, Object> dynamicProperties) {
|
||||
String topic = (String) dynamicProperties.get("topic");
|
||||
String[] topicParams = topic.split("/");
|
||||
String tenantDomain = topicParams[0];
|
||||
String deviceType = topicParams[1];
|
||||
String deviceId = topicParams[2];
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
Operation operation = gson.fromJson((String) message, Operation.class);
|
||||
return new NotificationMessage(tenantDomain, new DeviceIdentifier(deviceId, deviceType),operation);
|
||||
} catch (Exception e) {
|
||||
//Avoid notification listener to fail.
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.core.ServerStartupObserver;
|
||||
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.MqttNotificationDataHolder;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.util.MqttNotificationListener;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||
|
||||
/**
|
||||
* Startup listener is been used to make sure the reciever gets activated after the server start up to avoid
|
||||
* Bundle not loading issues.
|
||||
*/
|
||||
public class PullNotificationStartupListener implements ServerStartupObserver {
|
||||
|
||||
private static final Log log = LogFactory.getLog(PullNotificationStartupListener.class);
|
||||
|
||||
@Override
|
||||
public void completingServerStartup() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completedServerStartup() {
|
||||
PrivilegedCarbonContext.startTenantFlow();
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
|
||||
MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, true);
|
||||
try {
|
||||
//TODO DeviceConfiguration Either need to be a osgi service or need to add those variable to system variables.
|
||||
boolean isEnabled = DeviceConfigurationManager.getInstance().getDeviceManagementConfig()
|
||||
.getPullNotificationConfiguration().isEnabled();
|
||||
if (isEnabled) {
|
||||
MqttNotificationListener.setupMqttInputAdapter();
|
||||
MqttNotificationDataHolder.getInstance().getInputEventAdapterService().start();
|
||||
log.info("Mqtt operation listener activated");
|
||||
}
|
||||
} finally {
|
||||
PrivilegedCarbonContext.endTenantFlow();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener.internal;
|
||||
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService;
|
||||
|
||||
public class MqttNotificationDataHolder {
|
||||
|
||||
private DeviceManagementProviderService deviceManagementProviderService;
|
||||
private InputEventAdapterService inputEventAdapterService;
|
||||
|
||||
private static MqttNotificationDataHolder thisInstance = new MqttNotificationDataHolder();
|
||||
|
||||
public static MqttNotificationDataHolder getInstance() {
|
||||
return thisInstance;
|
||||
}
|
||||
|
||||
public DeviceManagementProviderService getDeviceManagementProviderService() {
|
||||
return deviceManagementProviderService;
|
||||
}
|
||||
|
||||
public void setDeviceManagementProviderService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
this.deviceManagementProviderService = deviceManagementProviderService;
|
||||
}
|
||||
|
||||
public InputEventAdapterService getInputEventAdapterService() {
|
||||
return inputEventAdapterService;
|
||||
}
|
||||
|
||||
public void setInputEventAdapterService(
|
||||
InputEventAdapterService inputEventAdapterService) {
|
||||
this.inputEventAdapterService = inputEventAdapterService;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener.internal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.core.ServerStartupObserver;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.PullNotificationMqttContentTransformer;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.PullNotificationStartupListener;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.util.MqttNotificationListener;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService;
|
||||
|
||||
/**
|
||||
* @scr.component name="org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.PullNotificationListenerServiceComponent" immediate="true"
|
||||
* @scr.reference name="carbon.device.mgt.provider"
|
||||
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setDeviceManagementProviderService"
|
||||
* unbind="unsetDeviceManagementProviderService"
|
||||
* @scr.reference name="event.input.adapter.service"
|
||||
* interface="org.wso2.carbon.event.input.adapter.core.InputEventAdapterService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setInputEventAdapterService"
|
||||
* unbind="unsetInputEventAdapterService"
|
||||
*/
|
||||
public class PullNotificationListenerServiceComponent {
|
||||
|
||||
private static final Log log = LogFactory.getLog(PullNotificationListenerServiceComponent.class);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
protected void activate(ComponentContext componentContext) {
|
||||
try {
|
||||
//Do nothing
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Pull notification provider implementation bundle has been successfully " +
|
||||
"initialized");
|
||||
}
|
||||
BundleContext bundleContext = componentContext.getBundleContext();
|
||||
bundleContext.registerService(ServerStartupObserver.class.getName(), new PullNotificationStartupListener(),
|
||||
null);
|
||||
bundleContext.registerService(ContentTransformer.class, new PullNotificationMqttContentTransformer(), null);
|
||||
} catch (Throwable e) {
|
||||
log.error("Error occurred while initializing pull notification provider implementation bundle", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivate(ComponentContext componentContext) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
protected void setDeviceManagementProviderService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
MqttNotificationDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService);
|
||||
}
|
||||
|
||||
protected void unsetDeviceManagementProviderService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
MqttNotificationDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService);
|
||||
}
|
||||
|
||||
protected void setInputEventAdapterService(InputEventAdapterService inputEventAdapterService) {
|
||||
MqttNotificationDataHolder.getInstance().setInputEventAdapterService(inputEventAdapterService);
|
||||
}
|
||||
|
||||
protected void unsetInputEventAdapterService(InputEventAdapterService inputEventAdapterService) {
|
||||
MqttNotificationDataHolder.getInstance().setInputEventAdapterService(null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mqtt.notification.listener.util;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.DeviceTypeOperationAdapterSubscription;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.PullNotificationMqttContentTransformer;
|
||||
import org.wso2.carbon.device.mgt.mqtt.notification.listener.internal.MqttNotificationDataHolder;
|
||||
import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration;
|
||||
import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterException;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This creates a link between input adapter and the subscription of the input adpater.
|
||||
*/
|
||||
public class MqttNotificationListener {
|
||||
private static final Log log = LogFactory.getLog(MqttNotificationListener.class);
|
||||
|
||||
private static final String TOPIC = "topic";
|
||||
private static final String SUBSCRIBED_TOPIC = "+/+/+/update/operation";
|
||||
private static final String TYPE = "oauth-mqtt";
|
||||
private static final String JSON = "json";
|
||||
private static final String NAME = "iot_core_server_adapter";
|
||||
private static final String CONTENT_TRANSFORMER_TYPE = "contentTransformer";
|
||||
private static final String MQTT_CONTENT_VALIDATOR_TYPE = "contentValidator";
|
||||
private static final String MQTT_CONTENT_VALIDATOR = "default";
|
||||
|
||||
|
||||
public static void setupMqttInputAdapter() {
|
||||
InputEventAdapterConfiguration inputEventAdapterConfiguration = new InputEventAdapterConfiguration();
|
||||
inputEventAdapterConfiguration.setName(NAME);
|
||||
inputEventAdapterConfiguration.setType(TYPE);
|
||||
inputEventAdapterConfiguration.setMessageFormat(JSON);
|
||||
Map<String, String> mqttAdapterProperties = new HashMap<>();
|
||||
mqttAdapterProperties.put(TOPIC, SUBSCRIBED_TOPIC);
|
||||
mqttAdapterProperties.put(CONTENT_TRANSFORMER_TYPE,
|
||||
PullNotificationMqttContentTransformer.MQTT_NOTIFICATION_MESSAGE_TRANSFORMER);
|
||||
mqttAdapterProperties.put(MQTT_CONTENT_VALIDATOR_TYPE, MQTT_CONTENT_VALIDATOR);
|
||||
inputEventAdapterConfiguration.setProperties(mqttAdapterProperties);
|
||||
try {
|
||||
PrivilegedCarbonContext.startTenantFlow();
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants
|
||||
.SUPER_TENANT_DOMAIN_NAME, true);
|
||||
MqttNotificationDataHolder.getInstance().getInputEventAdapterService()
|
||||
.create(inputEventAdapterConfiguration, new DeviceTypeOperationAdapterSubscription());
|
||||
} catch (InputEventAdapterException e) {
|
||||
log.error("Unable to create Input Event Adapter for pull notification.", e);
|
||||
} finally {
|
||||
PrivilegedCarbonContext.endTenantFlow();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
58
components/extensions/pull-notification-listeners/pom.xml
Normal file
58
components/extensions/pull-notification-listeners/pom.xml
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2014, 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions</artifactId>
|
||||
<version>4.0.5-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>pull-notification-listeners</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - Pull Notification Extension</name>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<modules>
|
||||
<module>org.wso2.carbon.device.mgt.mqtt.notification.listener</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-scr-scrdescriptor</id>
|
||||
<goals>
|
||||
<goal>scr</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
@ -79,7 +79,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
};
|
||||
try {
|
||||
if (AndroidAPIUtils.getEventPublisherService().publishEvent(
|
||||
EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) {
|
||||
EVENT_STREAM_DEFINITION, "1.0.0", new Object[0], new Object[0], payload)) {
|
||||
message.setResponseCode("Event is published successfully.");
|
||||
return Response.status(Response.Status.CREATED).entity(message).build();
|
||||
} else {
|
||||
|
||||
@ -30,6 +30,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
|
||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber;
|
||||
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants;
|
||||
@ -121,6 +122,12 @@ public class AndroidDeviceManagementService implements DeviceManagementService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PullNotificationSubscriber getPullNotificationSubscriber() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl;
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber;
|
||||
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
|
||||
@ -80,6 +81,12 @@ public class WindowsDeviceManagementService implements DeviceManagementService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PullNotificationSubscriber getPullNotificationSubscriber() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -90,28 +90,6 @@
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-analytics</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.analytics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
@ -155,28 +155,6 @@
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-analytics</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.analytics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
@ -34,11 +34,11 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<!--<PushNotificationProvider type="XMPP">-->
|
||||
<!--<PushNotificationProviderConfig type="XMPP">-->
|
||||
<!--<FileBasedProperties>true</FileBasedProperties>-->
|
||||
<!--<!–if file based properties is set to false then the configuration will be picked from platform configuration–>-->
|
||||
<!--<ConfigProperties>-->
|
||||
@ -50,7 +50,7 @@
|
||||
<!--<Property Name="jid">admin@localhost</Property>-->
|
||||
<!--<Property Name="server.name">localhost</Property>-->
|
||||
<!--</ConfigProperties>-->
|
||||
<!--</PushNotificationProvider>-->
|
||||
<!--</PushNotificationProviderConfig>-->
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -34,12 +34,12 @@
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<PushNotificationProviderConfig type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
<!--if file based properties is set to false then the configuration will be picked from platform configuration-->
|
||||
</PushNotificationProvider>
|
||||
</PushNotificationProviderConfig>
|
||||
|
||||
<!--<PushNotificationProvider type="XMPP">-->
|
||||
<!--<PushNotificationProviderConfig type="XMPP">-->
|
||||
<!--<FileBasedProperties>true</FileBasedProperties>-->
|
||||
<!--<!–if file based properties is set to false then the configuration will be picked from platform configuration–>-->
|
||||
<!--<ConfigProperties>-->
|
||||
@ -51,7 +51,7 @@
|
||||
<!--<Property Name="jid">admin@localhost</Property>-->
|
||||
<!--<Property Name="server.name">localhost</Property>-->
|
||||
<!--</ConfigProperties>-->
|
||||
<!--</PushNotificationProvider>-->
|
||||
<!--</PushNotificationProviderConfig>-->
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
|
||||
@ -52,10 +52,6 @@
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.input.adapter.extension</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.input.adapter.http</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.input.adapter.mqtt</artifactId>
|
||||
@ -176,9 +172,6 @@
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.input.adapter.extension:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.input.adapter.http:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.input.adapter.mqtt:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
instructions.configure = \
|
||||
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.adapter_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.adapter_${feature.version}/websocket-validation.xml,target:${installFolder}/../../conf/etc/websocket-validation.xml,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.adapter_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
|
||||
@ -1,50 +0,0 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
This configuration file represents the configuration that are needed
|
||||
for websocket connection validation
|
||||
-->
|
||||
<WebsocketValidationConfigs>
|
||||
|
||||
<!--Authenticator is holds the information of authticator that is used for websocket-->
|
||||
<Authenticator class="org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.OAuthAuthenticator">
|
||||
<Properties>
|
||||
<Property name="tokenValidationEndpoint">https://localhost:9443/services/OAuth2TokenValidationService</Property>
|
||||
<Property name="username">admin</Property>
|
||||
<Property name="password">admin</Property>
|
||||
<Property name="maximumHttpConnectionPerHost">2</Property>
|
||||
<Property name="maximumTotalHttpConnection">100</Property>
|
||||
</Properties>
|
||||
</Authenticator>
|
||||
|
||||
<!--Authorizer holds the information of the authorizer that is used authorize a connection.-->
|
||||
<Authorizer class="org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.DeviceAuthorizer">
|
||||
<Properties>
|
||||
<!--websocket connection permissions which are validated for grouping (can have multiple permission.)-->
|
||||
<Property name="statsPermission">/permission/device-mgt/user/groups/device_monitor</Property>
|
||||
<Property name="username">admin</Property>
|
||||
<Property name="password">admin</Property>
|
||||
<Property name="tokenEndpoint">https://localhost:9443/oauth2</Property>
|
||||
<!--offset time from expiry time to trigger refresh call (in seconds)-->
|
||||
<Property name="tokenRefreshTimeOffset">100</Property>
|
||||
<Property name="deviceMgtServerUrl">https://localhost:9443</Property>
|
||||
</Properties>
|
||||
</Authorizer>
|
||||
</WebsocketValidationConfigs>
|
||||
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>extensions-feature</artifactId>
|
||||
<version>4.0.5-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>org.wso2.carbon.device.mgt.notification.listener.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>4.0.5-SNAPSHOT</version>
|
||||
<name>WSO2 Carbon - Notification Listener</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the core bundles required iot core listeners</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.mqtt.notification.listener</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>4-p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.notification.listener</id>
|
||||
<propertiesFile>../etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<bundles>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mqtt.notification.listener:${carbon.devicemgt.plugins.version}
|
||||
</bundleDef>
|
||||
</bundles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,19 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
custom = true
|
||||
@ -0,0 +1 @@
|
||||
instructions.configure = \
|
||||
@ -39,6 +39,7 @@
|
||||
<module>org.wso2.carbon.device.mgt.adapter.feature</module>
|
||||
<module>org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature</module>
|
||||
<module>org.wso2.extension.siddhi.execution.json.feature</module>
|
||||
<module>org.wso2.carbon.device.mgt.notification.listener.feature</module>
|
||||
<module>org.wso2.gpl.siddhi.extension.geo.script.feature</module>
|
||||
</modules>
|
||||
|
||||
|
||||
@ -57,8 +57,8 @@
|
||||
access server after receiving push notification.
|
||||
-->
|
||||
<!--Configuration for enable firebase push notifications-->
|
||||
<!--<PushNotificationProvider type="FCM" isScheduled="false">-->
|
||||
<!--</PushNotificationProvider>-->
|
||||
<!--<PushNotificationProviderConfig type="FCM" isScheduled="false">-->
|
||||
<!--</PushNotificationProviderConfig>-->
|
||||
|
||||
<DataSource>
|
||||
<JndiConfig>
|
||||
|
||||
10
pom.xml
10
pom.xml
@ -449,7 +449,11 @@
|
||||
<artifactId>org.wso2.carbon.device.mgt.output.adapter.websocket</artifactId>
|
||||
<version>${carbon.devicemgt.plugins.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.mqtt.notification.listener</artifactId>
|
||||
<version>${carbon.devicemgt.plugins.version}</version>
|
||||
</dependency>
|
||||
<!--Android sense DeviceType Impl, API and Agent-->
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
@ -1143,14 +1147,14 @@
|
||||
<javax.ws.rs.version>1.1.1</javax.ws.rs.version>
|
||||
|
||||
<!-- Carbon Device Management -->
|
||||
<carbon.devicemgt.version>3.0.7</carbon.devicemgt.version>
|
||||
<carbon.devicemgt.version>3.0.8</carbon.devicemgt.version>
|
||||
<carbon.devicemgt.version.range>[3.0.0, 4.0.0)</carbon.devicemgt.version.range>
|
||||
|
||||
<!-- Carbon App Management -->
|
||||
<carbon.appmgt.version>1.2.25</carbon.appmgt.version>
|
||||
|
||||
<!-- Carbon Device Management Plugins -->
|
||||
<carbon.devicemgt.plugins.version>4.0.4</carbon.devicemgt.plugins.version>
|
||||
<carbon.devicemgt.plugins.version>4.0.5-SNAPSHOT</carbon.devicemgt.plugins.version>
|
||||
|
||||
<!-- Carbon Commons -->
|
||||
<carbon.commons.version>4.4.8</carbon.commons.version>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user