Sync with master

This commit is contained in:
tcdlpds 2024-07-04 19:28:35 +05:30
commit dd23ab4dd6
51 changed files with 109 additions and 48 deletions

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<parent>
<artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<artifactId>virtual-fire-alarm-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>device-types</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -124,6 +124,15 @@ public class MQTTEventAdapterFactory extends InputEventAdapterFactory {
clientId.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID_HINT));
propertyList.add(clientId);
// set qos
Property qosProperty = new Property(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS);
qosProperty.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS));
qosProperty.setRequired(false);
qosProperty.setOptions(new String[]{"0", "1", "2"});
qosProperty.setDefaultValue("0");
propertyList.add(qosProperty);
return propertyList;
}

View File

@ -58,6 +58,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
private MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration;
private String topic;
private int qos;
private String topicStructure;
private String tenantDomain;
private volatile boolean connectionSucceeded = false;
@ -81,6 +82,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
int keepAlive = mqttBrokerConnectionConfiguration.getKeepAlive();
this.topicStructure = new String(topic);
this.topic = PropertyUtils.replacePlaceholders(topic);
this.qos = mqttBrokerConnectionConfiguration.getQos();
this.eventAdapterListener = inputEventAdapterListener;
this.tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
@ -162,7 +164,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
return false;
}
try {
mqttClient.subscribe(topic);
mqttClient.subscribe(topic, qos);
log.info("mqtt receiver subscribed to topic: " + topic);
} catch (MqttException e) {
log.error("Failed to subscribe to topic: " + topic + ", Retrying.....");

View File

@ -32,6 +32,7 @@ public class MQTTBrokerConnectionConfiguration {
private String brokerScopes = null;
private boolean cleanSession = true;
private int keepAlive;
private int qos;
private String brokerUrl;
private String dcrUrl;
private String contentValidatorType;
@ -83,6 +84,14 @@ public class MQTTBrokerConnectionConfiguration {
return adapterName;
}
public int getQos() {
return qos;
}
public void setQos(int qos) {
this.qos = qos;
}
public MQTTBrokerConnectionConfiguration(InputEventAdapterConfiguration eventAdapterConfiguration,
Map<String, String> globalProperties) throws InputEventAdapterException {
@ -131,6 +140,15 @@ public class MQTTBrokerConnectionConfiguration {
} else {
keepAlive = MQTTEventAdapterConstants.ADAPTER_CONF_DEFAULT_KEEP_ALIVE;
}
String qosVal = globalProperties.get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS);
if (qosVal != null && !qosVal.isEmpty()) {
this.qos = Integer.parseInt(qosVal);
} else {
qosVal = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS);
this.qos = Integer.parseInt(qosVal);
}
this.contentTransformerType = eventAdapterConfiguration.getProperties()
.get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_TRANSFORMER_TYPE);
}

View File

@ -47,6 +47,7 @@ public class MQTTEventAdapterConstants {
public static final String ADAPTER_CONF_CLEAN_SESSION_HINT = "cleanSession.hint";
public static final String ADAPTER_CONF_KEEP_ALIVE = "keepAlive";
public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 20000;
public static final String ADAPTER_MESSAGE_QOS = "qos";
public static final int INITIAL_RECONNECTION_DURATION = 4000;
public static final int RECONNECTION_PROGRESS_FACTOR = 2;

View File

@ -18,6 +18,7 @@
topic=Topic
topic.hint=Topic subscribed
qos=Quality of Service
clientId=Client Id
clientId.hint=client identifier is used by the server to identify a client when it reconnects, It used for durable subscriptions or reliable delivery of messages is required.
url=Broker Url (Not required), If it is not provided then it will connect to the default broker.

View File

@ -21,7 +21,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -92,7 +92,7 @@ public class MQTTEventAdapterFactory extends OutputEventAdapterFactory {
qos.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS));
qos.setRequired(false);
qos.setOptions(new String[]{"0", "1", "2"});
qos.setDefaultValue("2");
qos.setDefaultValue("0");
// set topic
Property topicProperty = new Property(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC);

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -20,7 +20,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>cdmf-transport-adapters</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>emqx-extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>emqx-extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>pull-notification-listeners</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>siddhi-extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>siddhi-extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<artifactId>android-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -58,8 +58,12 @@ import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotific
import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy;
import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService;
import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus;
import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException;
import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceDetailsDTO;
import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType;
import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion;
import io.entgra.device.mgt.core.device.mgt.core.dto.OperationDTO;
import io.entgra.device.mgt.core.device.mgt.core.dto.OwnerWithDeviceDTO;
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
import io.entgra.device.mgt.core.device.mgt.core.service.EmailMetaInfo;
import io.entgra.device.mgt.plugins.mobile.android.api.utils.TestUtils;
@ -67,6 +71,7 @@ import io.entgra.device.mgt.plugins.mobile.android.api.utils.TestUtils;
import org.apache.commons.collections.map.SingletonMap;
import java.sql.Timestamp;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -396,6 +401,11 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
}
@Override
public boolean recordDeviceUpdate(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return false;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return TestUtils.getDeviceId().equals(device.getDeviceIdentifier());
@ -897,4 +907,24 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
public void deleteDeviceDataByTenantDomain(String s) throws DeviceManagementException {
throw new UnsupportedOperationException("Not implemented");
}
@Override
public OwnerWithDeviceDTO getOwnersWithDeviceIds(String s) throws DeviceManagementDAOException {
return null;
}
@Override
public OwnerWithDeviceDTO getOwnerWithDeviceByDeviceId(int i) throws DeviceManagementDAOException {
return null;
}
@Override
public List<DeviceDetailsDTO> getDevicesByTenantId(int i) throws DeviceManagementDAOException {
return Collections.emptyList();
}
@Override
public OperationDTO getOperationDetailsById(int i) throws OperationManagementException {
return null;
}
}

View File

@ -21,7 +21,7 @@
<parent>
<artifactId>android-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<parent>
<artifactId>android-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<artifactId>android-plugin</artifactId>
<groupId>io.entgra.device.mgt.plugins</groupId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>mobile-plugins</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>analytics-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>virtual-fire-alarm-plugin-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>device-types-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>extensions-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>android-plugin-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>mobile-plugins-feature</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -23,7 +23,7 @@
<groupId>io.entgra.device.mgt.plugins</groupId>
<artifactId>io.entgra.device.mgt.plugins.parent</artifactId>
<packaging>pom</packaging>
<version>6.0.30-SNAPSHOT</version>
<version>6.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Plugins Parent</name>
<url>http://entgra.io</url>
<description>WSO2 Carbon - Device Management Plugins Parent</description>
@ -964,11 +964,11 @@
<properties>
<!-- Carbon Device Management -->
<io.entgra.device.mgt.core.version>5.0.42-SNAPSHOT</io.entgra.device.mgt.core.version>
<io.entgra.device.mgt.core.version>5.1.1-SNAPSHOT</io.entgra.device.mgt.core.version>
<io.entgra.device.mgt.core.version.range>[5.0.0, 6.0.0)</io.entgra.device.mgt.core.version.range>
<!-- Carbon Device Management Plugins -->
<io.entgra.device.mgt.plugins.version>6.0.30-SNAPSHOT</io.entgra.device.mgt.plugins.version>
<io.entgra.device.mgt.plugins.version>6.1.1-SNAPSHOT</io.entgra.device.mgt.plugins.version>
<!-- Android Agent Artifact Version-->
<android.agent.version>4.0.0</android.agent.version>