tenthe commented on code in PR #3889:
URL: https://github.com/apache/streampipes/pull/3889#discussion_r2510962947


##########
streampipes-extensions/streampipes-connectors-mqtt/src/main/java/org/apache/streampipes/extensions/connectors/mqtt/migration/MQTTAdapterMigrationV1.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.streampipes.extensions.connectors.mqtt.migration;
+
+import 
org.apache.streampipes.extensions.api.extractor.IStaticPropertyExtractor;
+import org.apache.streampipes.extensions.api.migration.IAdapterMigrator;
+import org.apache.streampipes.extensions.connectors.mqtt.adapter.MqttProtocol;
+import 
org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConnectUtils;
+import org.apache.streampipes.model.connect.adapter.AdapterDescription;
+import org.apache.streampipes.model.extensions.svcdiscovery.SpServiceTagPrefix;
+import org.apache.streampipes.model.migration.MigrationResult;
+import org.apache.streampipes.model.migration.ModelMigratorConfig;
+import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
+import org.apache.streampipes.model.staticproperty.SlideToggleStaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternative;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
+import org.apache.streampipes.sdk.StaticProperties;
+
+import java.util.List;
+
+public class MQTTAdapterMigrationV1 implements IAdapterMigrator {
+
+    @Override
+    public ModelMigratorConfig config() {
+        return new ModelMigratorConfig(
+                MqttProtocol.ID,
+                SpServiceTagPrefix.ADAPTER,
+                0,
+                1);
+
+    }
+
+    @Override
+    public MigrationResult<AdapterDescription> migrate(AdapterDescription 
element,
+            IStaticPropertyExtractor extractor) throws RuntimeException {
+
+        var url = (FreeTextStaticProperty) element.getConfig().get(0);
+        url.setDescription(
+                "Example: tcp://test-server.com:1883 (Protocol required. Port 
required), with TLS ssl://test-server.com:8883 (Protocol required. Port 
required)");
+        element.getConfig().set(0, url);
+
+        migrateSecurity((StaticPropertyAlternatives) 
element.getConfig().get(1));
+
+        element.getConfig().add(2, makeTLS());
+        return MigrationResult.success(element);
+    }
+
+    private SlideToggleStaticProperty makeTLS() {
+        var tlsAlternative = 
StaticProperties.toggleAlternative(MqttConnectUtils.getTLS(), false);
+        return tlsAlternative;
+    }
+
+    public void migrateSecurity(StaticPropertyAlternatives 
securityAlternatives) {

Review Comment:
   Does this need to be public?



##########
streampipes-extensions/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.iiot.adapters.netio.mqtt/strings.en:
##########
@@ -38,7 +38,7 @@ password.title=Password
 password.description=
 
 broker_url.title=Broker URL
-broker_url.description=Example: tcp://test-server.com:1883 (Protocol required. 
Port required)"
+broker_url.description=Example: tcp://test-server.com:1883 (Protocol required. 
Port required), , with TLS ssl://test-server.com:8883 (Protocol required. Port 
required)"

Review Comment:
   ```suggestion
   broker_url.description=Example: tcp://test-server.com:1883 (Protocol 
required. Port required), with TLS ssl://test-server.com:8883 (Protocol 
required. Port required)"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to