This is an automated email from the ASF dual-hosted git repository. zehnder pushed a commit to branch remove-old-mqtt-adapters in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit ce833c57c8b949c424c7c6fdcf2c26c5b0ee0fb2 Author: Philipp Zehnder <[email protected]> AuthorDate: Wed Nov 12 11:25:13 2025 +0100 refactor: Remove deprecated mqtt adapters --- .../iiot/IIoTAdaptersExtensionModuleExport.java | 2 - .../iiot/adapters/iolink/IfmAlMqttAdapter.java | 223 --------------------- .../iiot/adapters/iolink/sensor/IoLinkSensor.java | 29 --- .../iiot/adapters/iolink/sensor/SensorVVB001.java | 162 --------------- .../adapters/iolink/sensor/SensorVVB001Test.java | 50 ----- .../streampipes-connect-adapters/pom.xml | 5 - .../GeneralAdaptersExtensionModuleExport.java | 4 - .../connect/adapters/netio/NetioMQTTAdapter.java | 121 ----------- .../connect/adapters/netio/NetioRestAdapter.java | 175 ---------------- .../connect/adapters/netio/NetioUtils.java | 182 ----------------- .../adapters/netio/model/NetioAllPowerOutputs.java | 50 ----- .../adapters/netio/model/NetioGlobalMeasure.java | 94 --------- .../adapters/netio/model/NetioPowerOutput.java | 126 ------------ 13 files changed, 1223 deletions(-) diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/IIoTAdaptersExtensionModuleExport.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/IIoTAdaptersExtensionModuleExport.java index ef2f44b7ec..31c984e0b6 100644 --- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/IIoTAdaptersExtensionModuleExport.java +++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/IIoTAdaptersExtensionModuleExport.java @@ -18,7 +18,6 @@ package org.apache.streampipes.connect.iiot; -import org.apache.streampipes.connect.iiot.adapters.iolink.IfmAlMqttAdapter; import org.apache.streampipes.connect.iiot.adapters.oi4.Oi4Adapter; import org.apache.streampipes.connect.iiot.adapters.simulator.machine.MachineDataSimulatorAdapter; import org.apache.streampipes.connect.iiot.protocol.stream.FileReplayAdapter; @@ -38,7 +37,6 @@ public class IIoTAdaptersExtensionModuleExport implements IExtensionModuleExport return List.of( new MachineDataSimulatorAdapter(), new FileReplayAdapter(), - new IfmAlMqttAdapter(), new Oi4Adapter(), new HttpStreamProtocol(), new HttpServerProtocol() diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/IfmAlMqttAdapter.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/IfmAlMqttAdapter.java deleted file mode 100644 index e86862a48b..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/IfmAlMqttAdapter.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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.connect.iiot.adapters.iolink; - -import org.apache.streampipes.commons.exceptions.connect.AdapterException; -import org.apache.streampipes.commons.exceptions.connect.ParseException; -import org.apache.streampipes.connect.iiot.adapters.iolink.sensor.SensorVVB001; -import org.apache.streampipes.extensions.api.connect.IAdapterConfiguration; -import org.apache.streampipes.extensions.api.connect.IEventCollector; -import org.apache.streampipes.extensions.api.connect.IParser; -import org.apache.streampipes.extensions.api.connect.StreamPipesAdapter; -import org.apache.streampipes.extensions.api.connect.context.IAdapterGuessSchemaContext; -import org.apache.streampipes.extensions.api.connect.context.IAdapterRuntimeContext; -import org.apache.streampipes.extensions.api.extractor.IAdapterParameterExtractor; -import org.apache.streampipes.extensions.api.extractor.IStaticPropertyExtractor; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConfig; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConnectUtils; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConsumer; -import org.apache.streampipes.extensions.management.connect.adapter.parser.JsonParsers; -import org.apache.streampipes.extensions.management.connect.adapter.parser.json.JsonObjectParser; -import org.apache.streampipes.model.AdapterType; -import org.apache.streampipes.model.connect.guess.GuessSchema; -import org.apache.streampipes.model.extensions.ExtensionAssetType; -import org.apache.streampipes.sdk.builder.adapter.AdapterConfigurationBuilder; -import org.apache.streampipes.sdk.helpers.Labels; -import org.apache.streampipes.sdk.helpers.Locales; -import org.apache.streampipes.sdk.helpers.Options; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -@Deprecated(since = "0.98.0", forRemoval = true) -public class IfmAlMqttAdapter implements StreamPipesAdapter { - - public static final String ID = "org.apache.streampipes.connect.iiot.adapters.iolink"; - - public static final String KEY_PORT_INFORMATION = "/iolinkmaster/port[%s]/iolinkdevice/pdin"; - - private static final Logger LOG = LoggerFactory.getLogger(IfmAlMqttAdapter.class); - - private static final String PORTS = "ports"; - private static final String SENSOR_TYPE = "sensor_type"; - - private final IParser parser; - private boolean missingEventDataDetected = false; - private boolean missingPortInformationDetected = false; - - private MqttConsumer mqttConsumer; - private MqttConfig mqttConfig; - - private List<String> ports; - - public IfmAlMqttAdapter() { - parser = new JsonParsers(new JsonObjectParser()); - } - - @Override - public IAdapterConfiguration declareConfig() { - return AdapterConfigurationBuilder - .create(ID, 0, IfmAlMqttAdapter::new) - .withLocales(Locales.EN) - .withAssets(ExtensionAssetType.DOCUMENTATION, ExtensionAssetType.ICON) - .withCategory(AdapterType.Generic, AdapterType.Manufacturing) - .requiredTextParameter(MqttConnectUtils.getBrokerUrlLabel()) - .requiredAlternatives(MqttConnectUtils.getAccessModeLabel(), MqttConnectUtils.getAlternativesOne(), - MqttConnectUtils.getAlternativesTwo()) - .requiredMultiValueSelection(Labels.withId(PORTS), - Options.from("Port 1", "Port 2", "Port 3", "Port 4")) - .requiredSingleValueSelection(Labels.withId(SENSOR_TYPE), - Options.from("VVB001")) - .requiredTextParameter(MqttConnectUtils.getTopicLabel()) - .buildConfiguration(); - } - - @Override - public void onAdapterStarted(IAdapterParameterExtractor extractor, - IEventCollector collector, - IAdapterRuntimeContext adapterRuntimeContext) throws AdapterException { - var sensor = new SensorVVB001(); - - this.applyConfiguration(extractor.getStaticPropertyExtractor()); - this.mqttConsumer = new MqttConsumer( - this.mqttConfig, - (mqttEvent) -> { - try { - InputStream in = convertByte(mqttEvent); - parser.parse(in, (event) -> { - - var data = getMap(event, "data"); - var payload = getMap(data, "payload"); - - var deviceInfo = getMap(payload, "/deviceinfo/serialnumber"); - var serialnumber = deviceInfo.get("data"); - - for (int i = 0; i < ports.size(); i++) { - - String keyPortInformation = KEY_PORT_INFORMATION.formatted(ports.get(i)); - - Map<String, Object> portResult; - if (payload.containsKey(keyPortInformation)) { - - portResult = getMap(payload, keyPortInformation); - - try { - String eventData; - if (portResult.containsKey("data")) { - eventData = (String) portResult.get("data"); - - var parsedEvent = sensor.parseEvent(eventData); - parsedEvent.put("timestamp", System.currentTimeMillis() + i); - parsedEvent.put("port", "port" + ports.get(i)); - parsedEvent.put(SensorVVB001.IO_LINK_MASTER_SN, serialnumber); - - collector.collect(parsedEvent); - } else { - if (!missingEventDataDetected) { - adapterRuntimeContext - .getLogger() - .warn("Payload for port %s does not contain event data".formatted(i), ""); - LOG.error( - "IoLink event does not look like expected. " - + "No port information found for port {}.", i); - missingEventDataDetected = true; - } - } - } catch (Exception e) { - adapterRuntimeContext - .getLogger() - .error(e); - LOG.error("Data from IOLink sensor could not be extracted for port {}: {}", i, e); - } - - } else { - if (!missingPortInformationDetected) { - adapterRuntimeContext - .getLogger() - .warn("Event does not contain information about port " + i, ""); - LOG.error("IoLink event does not look like expected. No port information found for port {}.", i); - missingPortInformationDetected = true; - } - } - } - }); - } catch (ParseException e) { - adapterRuntimeContext - .getLogger() - .error(e); - LOG.error("IOLink master event could not be parsed.", e); - } - } - ); - - Thread thread = new Thread(this.mqttConsumer); - thread.start(); - } - - @Override - public void onAdapterStopped(IAdapterParameterExtractor extractor, - IAdapterRuntimeContext adapterRuntimeContext) throws AdapterException { - this.mqttConsumer.close(); - } - - @Override - public GuessSchema onSchemaRequested(IAdapterParameterExtractor extractor, - IAdapterGuessSchemaContext adapterGuessSchemaContext) throws AdapterException { - this.applyConfiguration(extractor.getStaticPropertyExtractor()); - - return new SensorVVB001().getEventSchema(); - } - - - private void applyConfiguration(IStaticPropertyExtractor extractor) { - mqttConfig = MqttConnectUtils.getMqttConfig(extractor); - String sensorType = extractor.selectedSingleValue(SENSOR_TYPE, String.class); - var selectedPorts = extractor.selectedMultiValues(PORTS, String.class); - ports = selectedPorts.stream() - .map(port -> port.substring(5)) - .toList(); - } - - private Map<String, Object> getMap(Map<String, Object> event, String key) { - if (event.containsKey(key)) { - var payload = event.get(key); - if (payload instanceof Map) { - return (Map<String, Object>) event.get(key); - } else { - throw new ParseException(getErrorMessage(key)); - } - } else { - throw new ParseException(getErrorMessage(key)); - } - } - - private String getErrorMessage(String key) { - return "The event does not contain key: %s. Please reconfigure the IOLink master to include this key".formatted( - key); - } - - private InputStream convertByte(byte[] event) { - return IOUtils.toInputStream(new String(event), "UTF-8"); - } -} diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/IoLinkSensor.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/IoLinkSensor.java deleted file mode 100644 index f371aa1e35..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/IoLinkSensor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.connect.iiot.adapters.iolink.sensor; - -import org.apache.streampipes.model.connect.guess.GuessSchema; - -import java.util.Map; - -public interface IoLinkSensor { - GuessSchema getEventSchema(); - - Map<String, Object> parseEvent(String encodedEvent); -} diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001.java deleted file mode 100644 index 61bf36954a..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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.connect.iiot.adapters.iolink.sensor; - -import org.apache.streampipes.model.connect.guess.GuessSchema; -import org.apache.streampipes.model.schema.PropertyScope; -import org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder; -import org.apache.streampipes.sdk.builder.adapter.GuessSchemaBuilder; -import org.apache.streampipes.sdk.utils.Datatypes; - -import java.util.HashMap; -import java.util.Map; - -import static org.apache.streampipes.sdk.helpers.EpProperties.timestampProperty; - -public class SensorVVB001 implements IoLinkSensor { - - public static final String V_RMS_NAME = "vRms"; - public static final String A_PEAK_NAME = "aPeak"; - public static final String A_RMS_NAME = "aRms"; - public static final String TEMPERATURE_NAME = "temperature"; - public static final String CREST_NAME = "crest"; - public static final String STATUS_NAME = "status"; - public static final String OUT_1_NAME = "out1"; - public static final String OUT_2_NAME = "out2"; - public static final String PORT_NAME = "port"; - - public static final String IO_LINK_MASTER_SN = "ioLinkMasterSN"; - - - @Override - public GuessSchema getEventSchema() { - - return GuessSchemaBuilder.create() - .property(timestampProperty("timestamp")) - .sample("timestamp", 1685525380729L) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Float, V_RMS_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Speed RMS value") - .build() - ) - .sample(V_RMS_NAME, 0.0023) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Float, A_PEAK_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Acceleration peak value") - .build() - ) - .sample(A_PEAK_NAME, 6.6) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Float, A_RMS_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Acceleration RMS value") - .build() - ) - .sample(A_RMS_NAME, 1.8) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Float, TEMPERATURE_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Current temperature") - .build() - ) - .sample(TEMPERATURE_NAME, 22.0) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Float, CREST_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Acceleration crest factor") - .build() - ) - .sample(CREST_NAME, 3.7) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Integer, STATUS_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Device status (0: OK, 1: Maintenance required, " - + "2: Out of specification, 3: Function Test, 4: Error)") - .build() - ) - .sample(STATUS_NAME, 0) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Boolean, OUT_1_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Current state of the digital signal") - .build() - ) - .sample(OUT_1_NAME, true) - .property( - PrimitivePropertyBuilder - .create(Datatypes.Boolean, OUT_2_NAME) - .scope(PropertyScope.MEASUREMENT_PROPERTY) - .description("Current state of the digital signal") - .build() - ) - .sample(OUT_2_NAME, true) - .property( - PrimitivePropertyBuilder - .create(Datatypes.String, PORT_NAME) - .scope(PropertyScope.DIMENSION_PROPERTY) - .description("Port the sensor is connected to at IOLink master") - .build() - ) - .sample(PORT_NAME, "port1") - .property( - PrimitivePropertyBuilder - .create(Datatypes.String, IO_LINK_MASTER_SN) - .scope(PropertyScope.DIMENSION_PROPERTY) - .description("This is the serial number of the IO-Link Master") - .build() - ) - .sample(PORT_NAME, "XXXXXXXXXXXX") - .build(); - } - - @Override - public Map<String, Object> parseEvent(String encodedEvent) { - var event = new HashMap<String, Object>(); - event.put(V_RMS_NAME, getValue(0, 4, 0.0001, encodedEvent)); - event.put(A_PEAK_NAME, getValue(8, 12, 0.1, encodedEvent)); - event.put(A_RMS_NAME, getValue(16, 20, 0.1, encodedEvent)); - event.put(TEMPERATURE_NAME, getValue(24, 28, 0.1, encodedEvent)); - event.put(CREST_NAME, getValue(32, 36, 0.1, encodedEvent)); - event.put(STATUS_NAME, (int) getValue(38, 39, 1.0, encodedEvent)); - - // The last two bits represent the status - var outValues = (int) getValue(39, 40, 1.0, encodedEvent); - event.put(OUT_1_NAME, (outValues & 1) != 0); - event.put(OUT_2_NAME, (outValues & 2) != 0); - - return event; - } - - private double getValue(int start, int end, double scaleFactor, String encodedEvent) { - var word = encodedEvent.substring(start, end); - - var rawValue = (double) (Integer.parseInt(word, 16)); - - return rawValue * scaleFactor; - } -} diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/test/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001Test.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/test/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001Test.java deleted file mode 100644 index 772cd68e18..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/test/java/org/apache/streampipes/connect/iiot/adapters/iolink/sensor/SensorVVB001Test.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.connect.iiot.adapters.iolink.sensor; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class SensorVVB001Test { - - private SensorVVB001 sensor = new SensorVVB001(); - - private String sampleInput = "0017FC000042FF000012FF00015CFF000025FF03"; - - @Test - public void checkEventSize() { - var result = sensor.parseEvent(sampleInput); - Assertions.assertEquals(8, - result.keySet().size()); - } - - @Test - public void parseEvent() { - var result = sensor.parseEvent(sampleInput); - - Assertions.assertEquals(0.0023, (double) result.get(SensorVVB001.V_RMS_NAME), 0.001); - Assertions.assertEquals(6.600, (double) result.get(SensorVVB001.A_PEAK_NAME), 0.001); - Assertions.assertEquals(1.8, (double) result.get(SensorVVB001.A_RMS_NAME), 0.001); - Assertions.assertEquals(34.8, (double) result.get(SensorVVB001.TEMPERATURE_NAME), 0.001); - Assertions.assertEquals(3.7, (double) result.get(SensorVVB001.CREST_NAME), 0.001); - Assertions.assertEquals(0, result.get(SensorVVB001.STATUS_NAME)); - Assertions.assertEquals(true, result.get(SensorVVB001.OUT_1_NAME)); - Assertions.assertEquals(true, result.get(SensorVVB001.OUT_2_NAME)); - } -} \ No newline at end of file diff --git a/streampipes-extensions/streampipes-connect-adapters/pom.xml b/streampipes-extensions/streampipes-connect-adapters/pom.xml index 2b0b5cd70d..c4c3eb2184 100644 --- a/streampipes-extensions/streampipes-connect-adapters/pom.xml +++ b/streampipes-extensions/streampipes-connect-adapters/pom.xml @@ -39,11 +39,6 @@ <artifactId>streampipes-extensions-api</artifactId> <version>0.99.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-connectors-mqtt</artifactId> - <version>0.99.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>org.apache.streampipes</groupId> <artifactId>streampipes-pipeline-elements-shared</artifactId> diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/GeneralAdaptersExtensionModuleExport.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/GeneralAdaptersExtensionModuleExport.java index 4f35d27493..7c180d2752 100644 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/GeneralAdaptersExtensionModuleExport.java +++ b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/GeneralAdaptersExtensionModuleExport.java @@ -20,8 +20,6 @@ package org.apache.streampipes.connect; import org.apache.streampipes.connect.adapters.image.stream.ImageStreamAdapter; import org.apache.streampipes.connect.adapters.iss.IssAdapter; -import org.apache.streampipes.connect.adapters.netio.NetioMQTTAdapter; -import org.apache.streampipes.connect.adapters.netio.NetioRestAdapter; import org.apache.streampipes.extensions.api.connect.StreamPipesAdapter; import org.apache.streampipes.extensions.api.declarer.IExtensionModuleExport; import org.apache.streampipes.extensions.api.migration.IModelMigrator; @@ -35,8 +33,6 @@ public class GeneralAdaptersExtensionModuleExport implements IExtensionModuleExp @Override public List<StreamPipesAdapter> adapters() { return List.of( - new NetioRestAdapter(), - new NetioMQTTAdapter(), new ImageStreamAdapter(), new IssAdapter() ); diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioMQTTAdapter.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioMQTTAdapter.java deleted file mode 100644 index 4eb63b3fca..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioMQTTAdapter.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.connect.adapters.netio; - -import org.apache.streampipes.connect.adapters.netio.model.NetioAllPowerOutputs; -import org.apache.streampipes.connect.adapters.netio.model.NetioPowerOutput; -import org.apache.streampipes.extensions.api.connect.IAdapterConfiguration; -import org.apache.streampipes.extensions.api.connect.IEventCollector; -import org.apache.streampipes.extensions.api.connect.StreamPipesAdapter; -import org.apache.streampipes.extensions.api.connect.context.IAdapterGuessSchemaContext; -import org.apache.streampipes.extensions.api.connect.context.IAdapterRuntimeContext; -import org.apache.streampipes.extensions.api.extractor.IAdapterParameterExtractor; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConfig; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConnectUtils; -import org.apache.streampipes.extensions.connectors.mqtt.shared.MqttConsumer; -import org.apache.streampipes.messaging.InternalEventProcessor; -import org.apache.streampipes.model.AdapterType; -import org.apache.streampipes.model.connect.guess.GuessSchema; -import org.apache.streampipes.model.extensions.ExtensionAssetType; -import org.apache.streampipes.sdk.builder.adapter.AdapterConfigurationBuilder; -import org.apache.streampipes.sdk.helpers.Locales; - -import com.google.gson.Gson; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@Deprecated(since = "0.98.0", forRemoval = true) -public class NetioMQTTAdapter implements StreamPipesAdapter { - - private MqttConsumer mqttConsumer; - - /** - * A unique id to identify the adapter type - */ - public static final String ID = "org.apache.streampipes.connect.iiot.adapters.netio.mqtt"; - - @Override - public IAdapterConfiguration declareConfig() { - return AdapterConfigurationBuilder.create(ID, 0, NetioMQTTAdapter::new) - .withLocales(Locales.EN) - .withAssets(ExtensionAssetType.DOCUMENTATION, ExtensionAssetType.ICON) - .withCategory(AdapterType.Energy) - .requiredTextParameter(MqttConnectUtils.getBrokerUrlLabel()) - .requiredAlternatives(MqttConnectUtils.getAccessModeLabel(), MqttConnectUtils.getAlternativesOne(), - MqttConnectUtils.getAlternativesTwo()) - .buildConfiguration(); - } - - @Override - public void onAdapterStarted(IAdapterParameterExtractor extractor, - IEventCollector collector, - IAdapterRuntimeContext adapterRuntimeContext) { - - MqttConfig mqttConfig = MqttConnectUtils.getMqttConfig( - extractor.getStaticPropertyExtractor(), "devices/netio/messages/events/"); - this.mqttConsumer = new MqttConsumer(mqttConfig, new EventProcessor(collector)); - - Thread thread = new Thread(this.mqttConsumer); - thread.start(); - } - - @Override - public void onAdapterStopped(IAdapterParameterExtractor extractor, - IAdapterRuntimeContext adapterRuntimeContext) { - this.mqttConsumer.close(); - } - - @Override - public GuessSchema onSchemaRequested(IAdapterParameterExtractor extractor, - IAdapterGuessSchemaContext adapterGuessSchemaContext) { - return NetioUtils.getNetioSchema(); - } - - private record EventProcessor(IEventCollector collector) implements InternalEventProcessor<byte[]> { - - @Override - public void onEvent(byte[] payload) { - List<Map<String, Object>> events = parseEvent(payload); - - for (Map<String, Object> event : events) { - collector.collect(event); - } - } - } - - public static List<Map<String, Object>> parseEvent(byte[] input) { - List<Map<String, Object>> result = new ArrayList<>(); - - String s = new String(input); - - NetioAllPowerOutputs allPowerOutputs = new Gson().fromJson(s, NetioAllPowerOutputs.class); - - for (NetioPowerOutput output : allPowerOutputs.getPowerOutputs()) { - if (allPowerOutputs.getGobalMeasure() != null && output != null) { - Map<String, Object> event = NetioUtils.getEvent(allPowerOutputs.getGobalMeasure(), output); - result.add(event); - } - } - - return result; - } - -} diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioRestAdapter.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioRestAdapter.java deleted file mode 100644 index 1e9a5ca306..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioRestAdapter.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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.connect.adapters.netio; - - -import org.apache.streampipes.commons.exceptions.connect.AdapterException; -import org.apache.streampipes.connect.adapters.netio.model.NetioAllPowerOutputs; -import org.apache.streampipes.connect.adapters.netio.model.NetioPowerOutput; -import org.apache.streampipes.extensions.api.connect.IAdapterConfiguration; -import org.apache.streampipes.extensions.api.connect.IEventCollector; -import org.apache.streampipes.extensions.api.connect.IPullAdapter; -import org.apache.streampipes.extensions.api.connect.StreamPipesAdapter; -import org.apache.streampipes.extensions.api.connect.context.IAdapterGuessSchemaContext; -import org.apache.streampipes.extensions.api.connect.context.IAdapterRuntimeContext; -import org.apache.streampipes.extensions.api.extractor.IAdapterParameterExtractor; -import org.apache.streampipes.extensions.api.extractor.IParameterExtractor; -import org.apache.streampipes.extensions.management.connect.PullAdapterScheduler; -import org.apache.streampipes.extensions.management.connect.adapter.util.PollingSettings; -import org.apache.streampipes.model.AdapterType; -import org.apache.streampipes.model.connect.guess.GuessSchema; -import org.apache.streampipes.model.extensions.ExtensionAssetType; -import org.apache.streampipes.sdk.StaticProperties; -import org.apache.streampipes.sdk.builder.adapter.AdapterConfigurationBuilder; -import org.apache.streampipes.sdk.helpers.Labels; -import org.apache.streampipes.sdk.helpers.Locales; - -import com.google.gson.Gson; -import org.apache.http.HttpHost; -import org.apache.http.HttpStatus; -import org.apache.http.client.HttpResponseException; -import org.apache.http.client.fluent.Executor; -import org.apache.http.client.fluent.Request; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -@Deprecated(since = "0.98.0", forRemoval = true) -public class NetioRestAdapter implements StreamPipesAdapter, IPullAdapter { - - /** - * A unique id to identify the adapter type - */ - public static final String ID = "org.apache.streampipes.connect.iiot.adapters.netio.rest"; - - /** - * Keys of user configuration parameters - */ - private static final String NETIO_IP = "NETIO_IP"; - private static final String NETIO_USERNAME = "NETIO_USERNAME"; - private static final String NETIO_PASSWORD = "NETIO_PASSWORD"; - private static final String NETIO_POLLING_INTERVAL = "NETIO_POLLING_INTERVAL"; - - /** - * Values of user configuration parameters - */ - private String ip; - private String username; - private String password; - private int pollingInterval; - - private PullAdapterScheduler scheduler; - private IEventCollector collector; - - /** - * pullData is called iteratively according to the polling interval defined in getPollInterval. - */ - @Override - public void pullData() { - try { - NetioAllPowerOutputs allPowerOutputs = requestData(); - - for (NetioPowerOutput output : allPowerOutputs.getPowerOutputs()) { - Map<String, Object> event = NetioUtils.getEvent(allPowerOutputs.getGobalMeasure(), output); - collector.collect(event); - } - - } catch (IOException e) { - e.printStackTrace(); - } - } - - private NetioAllPowerOutputs requestData() throws IOException { - Executor executor = Executor.newInstance() - .auth(new HttpHost(this.ip, 80), this.username, this.password); - - String response = executor.execute(Request.Get("http://" + this.ip + "/netio.json")) - .returnContent().asString(); - - return new Gson().fromJson(response, NetioAllPowerOutputs.class); - } - - @Override - public PollingSettings getPollingInterval() { - return PollingSettings.from(TimeUnit.SECONDS, this.pollingInterval); - } - - /** - * Extracts the user configuration from the SpecificAdapterStreamDescription and sets the local variales - * - * @param extractor StaticPropertyExtractor - */ - private void applyConfiguration(IParameterExtractor extractor) { - - this.ip = extractor.singleValueParameter(NETIO_IP, String.class); - this.username = extractor.singleValueParameter(NETIO_USERNAME, String.class); - this.password = extractor.secretValue(NETIO_PASSWORD); - this.pollingInterval = extractor.singleValueParameter(NETIO_POLLING_INTERVAL, Integer.class); - } - - @Override - public IAdapterConfiguration declareConfig() { - return AdapterConfigurationBuilder.create(ID, 0, NetioRestAdapter::new) - .withLocales(Locales.EN) - .withAssets(ExtensionAssetType.DOCUMENTATION, ExtensionAssetType.ICON) - .withCategory(AdapterType.Energy) - .requiredTextParameter(Labels.withId(NETIO_IP)) - .requiredIntegerParameter(Labels.withId(NETIO_POLLING_INTERVAL), 2) - .requiredTextParameter(Labels.withId(NETIO_USERNAME)) - .requiredStaticProperty(StaticProperties.secretValue(Labels.withId(NETIO_PASSWORD))) - .buildConfiguration(); - } - - @Override - public void onAdapterStarted(IAdapterParameterExtractor extractor, - IEventCollector collector, - IAdapterRuntimeContext adapterRuntimeContext) { - this.applyConfiguration(extractor.getStaticPropertyExtractor()); - this.collector = collector; - this.scheduler = new PullAdapterScheduler(); - scheduler.schedule(this, extractor.getAdapterDescription().getElementId()); - } - - @Override - public void onAdapterStopped(IAdapterParameterExtractor extractor, - IAdapterRuntimeContext adapterRuntimeContext) { - this.scheduler.shutdown(); - } - - @Override - public GuessSchema onSchemaRequested(IAdapterParameterExtractor extractor, - IAdapterGuessSchemaContext adapterGuessSchemaContext) throws AdapterException { - applyConfiguration(extractor.getStaticPropertyExtractor()); - - try { - requestData(); - return NetioUtils.getNetioSchema(); - } catch (IOException e) { - if (e instanceof HttpResponseException && ((HttpResponseException) e).getStatusCode() - == HttpStatus.SC_UNAUTHORIZED) { - throw new AdapterException( - "Unauthorized! Could not connect to NETIO sensor: " + this.ip + " with username " + this.username); - } else { - throw - new AdapterException("Could not connect to NETIO sensor: " + this.ip + " with username " + this.username); - } - } - } -} diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java deleted file mode 100644 index cf6b7bd9f5..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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.connect.adapters.netio; - -import org.apache.streampipes.connect.adapters.netio.model.NetioGlobalMeasure; -import org.apache.streampipes.connect.adapters.netio.model.NetioPowerOutput; -import org.apache.streampipes.model.connect.guess.GuessSchema; -import org.apache.streampipes.model.schema.EventProperty; -import org.apache.streampipes.model.schema.EventSchema; -import org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder; -import org.apache.streampipes.sdk.helpers.EpProperties; -import org.apache.streampipes.sdk.utils.Datatypes; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Deprecated(since = "0.98.0", forRemoval = true) -public class NetioUtils { - public static final String TIMESTAMP_KEY = "timestamp"; - public static final String NAME_KEY = "name"; - public static final String VOLTAGE_KEY = "voltage"; - public static final String FREQUENCY_KEY = "frequency"; - public static final String OVERALL_POWER_FACTOR_KEY = "overall_power_factor"; - public static final String TOTAL_CURRENT_KEY = "total_current"; - public static final String STATE_KEY = "state"; - public static final String ACTION_KEY = "action"; - public static final String DELAY_KEY = "delay"; - public static final String CURRENT_KEY = "current"; - public static final String POWER_FACTOR_KEY = "power_factor"; - public static final String LOAD_KEY = "load"; - public static final String ENERGY_KEY = "energy"; - - public static URI volt = null; - public static URI watt = null; - public static URI ampere = null; - public static URI watthour = null; - public static URI hertz = null; - - static { - try { - volt = new URI("http://qudt.org/vocab/unit#Volt"); - watt = new URI("http://qudt.org/vocab/unit#Watt"); - ampere = new URI("http://qudt.org/vocab/unit#Ampere"); - watthour = new URI("http://qudt.org/vocab/unit#Watthour"); - hertz = new URI("http://qudt.org/vocab/unit#Hertz"); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } - - - public static GuessSchema getNetioSchema() { - - GuessSchema guessSchema = new GuessSchema(); - - EventSchema eventSchema = new EventSchema(); - List<EventProperty> allProperties = new ArrayList<>(); - - allProperties.add(EpProperties.timestampProperty(TIMESTAMP_KEY)); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.String, NAME_KEY) - .label("Name") - .description("The configured name of plug") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, VOLTAGE_KEY) - .label("Voltage") - .description("Instantaneous voltage") - .measurementUnit(volt) - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, FREQUENCY_KEY) - .label("Frequency") - .description("Instantaneous frequency") - .measurementUnit(hertz) - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, OVERALL_POWER_FACTOR_KEY) - .label("Overall Power Factor") - .description("Instantaneous Power Factor - weighted average from all meters") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, TOTAL_CURRENT_KEY) - .label("Total Current") - .description("Instantaneous total current for all power outputs") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Integer, STATE_KEY) - .label("State") - .description("State of the plug. 1 is on. 0 is off") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Integer, ACTION_KEY) - .label("Action") - .description("") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Integer, DELAY_KEY) - .label("Delay") - .description("") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, CURRENT_KEY) - .label("Current") - .description("Instantaneous current for the specific power output") - .measurementUnit(ampere) - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, POWER_FACTOR_KEY) - .label("Power Factor") - .description("Instantaneous Power Factor for the specific power output") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, LOAD_KEY) - .label("Load") - .description("Instantaneous load for the specific power output") - .build()); - allProperties.add( - PrimitivePropertyBuilder - .create(Datatypes.Float, ENERGY_KEY) - .label("Energy") - .description("Instantaneous energy counter for the value for the specific power output") - .measurementUnit(watthour) - .build()); - - eventSchema.setEventProperties(allProperties); - guessSchema.setEventSchema(eventSchema); - return guessSchema; - } - - public static Map<String, Object> getEvent(NetioGlobalMeasure globalMeasure, NetioPowerOutput powerOutput) { - Map<String, Object> event = new HashMap<>(); - - event.put(TIMESTAMP_KEY, System.currentTimeMillis()); - event.put(NAME_KEY, powerOutput.getName()); - event.put(VOLTAGE_KEY, globalMeasure.getVoltage()); - event.put(FREQUENCY_KEY, globalMeasure.getFrequency()); - event.put(OVERALL_POWER_FACTOR_KEY, globalMeasure.getOverallPowerFactor()); - event.put(TOTAL_CURRENT_KEY, globalMeasure.getTotalCurrent()); - event.put(STATE_KEY, powerOutput.getState()); - event.put(ACTION_KEY, powerOutput.getAction()); - event.put(DELAY_KEY, powerOutput.getDelay()); - event.put(CURRENT_KEY, powerOutput.getCurrent()); - event.put(POWER_FACTOR_KEY, powerOutput.getPowerFactor()); - event.put(LOAD_KEY, powerOutput.getLoad()); - event.put(ENERGY_KEY, powerOutput.getEnergy()); - - return event; - } - -} diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioAllPowerOutputs.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioAllPowerOutputs.java deleted file mode 100644 index 1bb097ba90..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioAllPowerOutputs.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.connect.adapters.netio.model; - -import com.google.gson.annotations.SerializedName; - -import jakarta.annotation.Generated; - -@Generated("net.hexar.json2pojo") -public class NetioAllPowerOutputs { - - @SerializedName("GlobalMeasure") - private NetioGlobalMeasure gobalMeasure; - - @SerializedName("Outputs") - private NetioPowerOutput[] powerOutputs; - - - public NetioGlobalMeasure getGobalMeasure() { - return gobalMeasure; - } - - public void setGobalMeasure(NetioGlobalMeasure gobalMeasure) { - this.gobalMeasure = gobalMeasure; - } - - public NetioPowerOutput[] getPowerOutputs() { - return powerOutputs; - } - - public void setPowerOutputs(NetioPowerOutput[] powerOutputs) { - this.powerOutputs = powerOutputs; - } -} diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioGlobalMeasure.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioGlobalMeasure.java deleted file mode 100644 index e1713d898c..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioGlobalMeasure.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.connect.adapters.netio.model; - - -import com.google.gson.annotations.SerializedName; - -import jakarta.annotation.Generated; - -@Generated("net.hexar.json2pojo") -public class NetioGlobalMeasure { - - @SerializedName("Voltage") - private float voltage; - - @SerializedName("Frequency") - private float frequency; - - @SerializedName("TotalCurrent") - private float totalCurrent; - - @SerializedName("OverallPowerFactor") - private float overallPowerFactor; - - @SerializedName("TotalLoad") - private float totalLoad; - - @SerializedName("TotalEnergy") - private float totalEnergy; - - public float getVoltage() { - return voltage; - } - - public void setVoltage(float voltage) { - this.voltage = voltage; - } - - public float getFrequency() { - return frequency; - } - - public void setFrequency(float frequency) { - this.frequency = frequency; - } - - public float getTotalCurrent() { - return totalCurrent; - } - - public void setTotalCurrent(float totalCurrent) { - this.totalCurrent = totalCurrent; - } - - public float getOverallPowerFactor() { - return overallPowerFactor; - } - - public void setOverallPowerFactor(float overallPowerFactor) { - this.overallPowerFactor = overallPowerFactor; - } - - public float getTotalLoad() { - return totalLoad; - } - - public void setTotalLoad(float totalLoad) { - this.totalLoad = totalLoad; - } - - public float getTotalEnergy() { - return totalEnergy; - } - - public void setTotalEnergy(float totalEnergy) { - this.totalEnergy = totalEnergy; - } -} diff --git a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioPowerOutput.java b/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioPowerOutput.java deleted file mode 100644 index c2cd5aafe1..0000000000 --- a/streampipes-extensions/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/netio/model/NetioPowerOutput.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.connect.adapters.netio.model; - -import com.google.gson.annotations.SerializedName; - -import jakarta.annotation.Generated; - -@Generated("net.hexar.json2pojo") -public class NetioPowerOutput { - - @SerializedName("ID") - private int id; - - @SerializedName("Name") - private String name; - - @SerializedName("State") - private int state; - - @SerializedName("Action") - private int action; - - @SerializedName("Delay") - private int delay; - - @SerializedName("Current") - private float current; - - @SerializedName("PowerFactor") - private float powerFactor; - - @SerializedName("Load") - private float load; - - @SerializedName("Energy") - private float energy; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public int getAction() { - return action; - } - - public void setAction(int action) { - this.action = action; - } - - public int getDelay() { - return delay; - } - - public void setDelay(int delay) { - this.delay = delay; - } - - public float getCurrent() { - return current; - } - - public void setCurrent(float current) { - this.current = current; - } - - public float getPowerFactor() { - return powerFactor; - } - - public void setPowerFactor(float powerFactor) { - this.powerFactor = powerFactor; - } - - public float getLoad() { - return load; - } - - public void setLoad(float load) { - this.load = load; - } - - public float getEnergy() { - return energy; - } - - public void setEnergy(float energy) { - this.energy = energy; - } -}
