This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new b2866ee HOP-2599 - MQTT Updated PAHO libs to version 1.2.5 HOP-2614 -
MQTT transform does not save content of form HOP 2615 - MQTT Incoming field not
working Minor fix to Enhanced JSON Output transform to update i18n management
to new approach
new ed5aaf5 Merge pull request #684 from sramazzina/MQTT-Update
b2866ee is described below
commit b2866ee7a63d06512222567281d214e3d3c4534d
Author: sergio.ramazzina <[email protected]>
AuthorDate: Fri Mar 19 09:15:22 2021 +0100
HOP-2599 - MQTT Updated PAHO libs to version 1.2.5
HOP-2614 - MQTT transform does not save content of form
HOP 2615 - MQTT Incoming field not working
Minor fix to Enhanced JSON Output transform to update i18n management to
new approach
---
assemblies/plugins/transforms/mqtt/pom.xml | 2 +-
.../jsonoutputenhanced/JsonOutputMeta.java | 5 +-
plugins/transforms/mqtt/pom.xml | 2 +-
.../transforms/mqtt/publisher/MQTTPublisher.java | 5 +-
.../mqtt/publisher/MQTTPublisherDialog.java | 1318 ++++++++++----------
.../mqtt/publisher/MQTTPublisherMeta.java | 6 +-
.../transforms/mqtt/subscriber/MQTTSubscriber.java | 24 +-
.../mqtt/subscriber/MQTTSubscriberMeta.java | 8 +-
.../subscriber/messages/messages_en_US.properties | 1 +
9 files changed, 678 insertions(+), 693 deletions(-)
diff --git a/assemblies/plugins/transforms/mqtt/pom.xml
b/assemblies/plugins/transforms/mqtt/pom.xml
index c62a111..faf79f2 100644
--- a/assemblies/plugins/transforms/mqtt/pom.xml
+++ b/assemblies/plugins/transforms/mqtt/pom.xml
@@ -36,7 +36,7 @@
<description></description>
<properties>
- <eclipse.paho.version>1.1.0</eclipse.paho.version>
+ <eclipse.paho.version>1.2.5</eclipse.paho.version>
</properties>
<repositories>
diff --git
a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java
b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java
index 2abef04..c176c1d 100644
---
a/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java
+++
b/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsonoutputenhanced/JsonOutputMeta.java
@@ -47,9 +47,8 @@ import java.util.List;
@Transform(id = "EnhancedJsonOutput",
image = "JSO.svg",
- name = "EnhancedJsonOutput.name",
- i18nPackageName =
"org.apache.hop.pipeline.transforms.jsonoutput.enhanced",
- description = "EnhancedJsonOutput.description",
+ name = "i18n::EnhancedJsonOutput.name",
+ description = "i18n::EnhancedJsonOutput.description",
categoryDescription =
"i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Output",
keywords = { "json", "javascript", "object", "notation" },
documentationUrl =
"https://hop.apache.org/manual/latest/pipeline/transforms/enhancedjsonoutput.html")
diff --git a/plugins/transforms/mqtt/pom.xml b/plugins/transforms/mqtt/pom.xml
index f69125f..c0a1cce 100644
--- a/plugins/transforms/mqtt/pom.xml
+++ b/plugins/transforms/mqtt/pom.xml
@@ -34,7 +34,7 @@
<name>Hop Plugins Transforms MQTT</name>
<properties>
- <eclipse.paho.version>1.1.0</eclipse.paho.version>
+ <eclipse.paho.version>1.2.5</eclipse.paho.version>
</properties>
<repositories>
diff --git
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisher.java
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisher.java
index 58956da..2da8f6e 100644
---
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisher.java
+++
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisher.java
@@ -29,10 +29,7 @@ import org.apache.hop.pipeline.transform.BaseTransform;
import org.apache.hop.pipeline.transform.ITransform;
import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.pipeline.transforms.mqtt.key.SSLSocketFactoryGenerator;
-import org.eclipse.paho.client.mqttv3.MqttClient;
-import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
-import org.eclipse.paho.client.mqttv3.MqttException;
-import org.eclipse.paho.client.mqttv3.MqttMessage;
+import org.eclipse.paho.client.mqttv3.*;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
diff --git
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherDialog.java
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherDialog.java
index f62e989..e38fd2c 100644
---
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherDialog.java
+++
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherDialog.java
@@ -34,63 +34,48 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
public class MQTTPublisherDialog extends BaseTransformDialog implements
ITransformDialog {
- private MQTTPublisherMeta producerMeta;
+ private MQTTPublisherMeta producerMeta;
- private CCombo m_wInputField;
+ private CCombo m_wInputField;
- private CTabFolder m_wTabFolder;
+ private CTabFolder m_wTabFolder;
- private CTabItem m_wGeneralTab;
- private TextVar m_wBroker;
- private Label m_wlTopicName;
- private CCombo m_wTopicName;
- private TextVar m_wClientID;
- private TextVar m_wTimeout;
- private TextVar m_wQOS;
+ private CTabItem m_wGeneralTab;
+ private TextVar m_wBroker;
+ private Label m_wlTopicName;
+ private CCombo m_wTopicName;
+ private TextVar m_wClientID;
+ private TextVar m_wTimeout;
+ private TextVar m_wQOS;
- private Button m_wTopicFromIncomingField;
+ private Button m_wTopicFromIncomingField;
- private CTabItem m_wCredentialsTab;
- private Button m_wRequiresAuth;
- private Label m_wlUsername;
- private TextVar m_wUsername;
- private Label m_wlPassword;
- private TextVar m_wPassword;
+ private CTabItem m_wCredentialsTab;
+ private Button m_wRequiresAuth;
+ private Label m_wlUsername;
+ private TextVar m_wUsername;
+ private Label m_wlPassword;
+ private TextVar m_wPassword;
- private CTabItem m_wSSLTab;
- private TextVar m_wCAFile;
- private TextVar m_wCertFile;
- private TextVar m_wKeyFile;
- private TextVar m_wKeyPassword;
+ private CTabItem m_wSSLTab;
+ private TextVar m_wCAFile;
+ private TextVar m_wCertFile;
+ private TextVar m_wKeyFile;
+ private TextVar m_wKeyPassword;
- private boolean gotPreviousFields = false;
-
- public MQTTPublisherDialog(Shell parent, IVariables variables, Object in,
PipelineMeta tr, String transformname ) {
- super( parent, variables, (BaseTransformMeta) in, tr, transformname );
- producerMeta = (MQTTPublisherMeta) in;
- }
+ public MQTTPublisherDialog(Shell parent, IVariables variables, Object in,
PipelineMeta tr, String transformname) {
+ super(parent, variables, (BaseTransformMeta) in, tr, transformname);
+ producerMeta = (MQTTPublisherMeta) in;
+ }
/*public MQTTPublisherDialog( Shell parent, BaseStepMeta baseStepMeta,
TransMeta transMeta, String stepname ) {
super( parent, baseStepMeta, transMeta, stepname );
@@ -102,649 +87,646 @@ public class MQTTPublisherDialog extends
BaseTransformDialog implements ITransfo
producerMeta = (MQTTPublisherMeta) in;
}*/
- public String open() {
- Shell parent = getParent();
- Display display = parent.getDisplay();
-
- shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN |
SWT.MAX );
- props.setLook( shell );
- setShellImage( shell, producerMeta );
+ public String open() {
+ Shell parent = getParent();
+ Display display = parent.getDisplay();
+
+ shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN |
SWT.MAX);
+ props.setLook(shell);
+ setShellImage(shell, producerMeta);
+
+ ModifyListener lsMod = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ producerMeta.setChanged();
+ }
+ };
+ changed = producerMeta.hasChanged();
+
+ FormLayout formLayout = new FormLayout();
+ formLayout.marginWidth = Const.FORM_MARGIN;
+ formLayout.marginHeight = Const.FORM_MARGIN;
+
+ shell.setLayout(formLayout);
+ shell.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.Shell.Title"));
+
+ int middle = props.getMiddlePct();
+ int margin = Const.MARGIN;
+
+ // Step name
+ wlTransformName = new Label(shell, SWT.RIGHT);
+ wlTransformName.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.StepName.Label"));
+ props.setLook(wlTransformName);
+ fdlTransformName = new FormData();
+ fdlTransformName.left = new FormAttachment(0, 0);
+ fdlTransformName.right = new FormAttachment(middle, -margin);
+ fdlTransformName.top = new FormAttachment(0, margin);
+ wlTransformName.setLayoutData(fdlTransformName);
+ wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
+ props.setLook(wTransformName);
+ wTransformName.addModifyListener(lsMod);
+ fdTransformName = new FormData();
+ fdTransformName.left = new FormAttachment(middle, 0);
+ fdTransformName.top = new FormAttachment(0, margin);
+ fdTransformName.right = new FormAttachment(100, 0);
+ wTransformName.setLayoutData(fdTransformName);
+ Control lastControl = wTransformName;
+
+ // ====================
+ // START OF TAB FOLDER
+ // ====================
+ m_wTabFolder = new CTabFolder(shell, SWT.BORDER);
+ props.setLook(m_wTabFolder, Props.WIDGET_STYLE_TAB);
+
+ // ====================
+ // GENERAL TAB
+ // ====================
+
+ m_wGeneralTab = new CTabItem(m_wTabFolder, SWT.NONE);
+ m_wGeneralTab.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.GeneralTab.Label")); //$NON-NLS-1$
+
+ FormLayout mainLayout = new FormLayout();
+ mainLayout.marginWidth = 3;
+ mainLayout.marginHeight = 3;
+
+ Composite wGeneralTabComp = new Composite(m_wTabFolder, SWT.NONE);
+ props.setLook(wGeneralTabComp);
+ wGeneralTabComp.setLayout(mainLayout);
+
+ // Broker URL
+ Label wlBroker = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlBroker.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.Broker.Label"));
+ props.setLook(wlBroker);
+ FormData fdlBroker = new FormData();
+ fdlBroker.top = new FormAttachment(0, margin * 2);
+ fdlBroker.left = new FormAttachment(0, 0);
+ fdlBroker.right = new FormAttachment(middle, -margin);
+ wlBroker.setLayoutData(fdlBroker);
+ m_wBroker = new TextVar(variables, wGeneralTabComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER);
+ props.setLook(m_wBroker);
+ m_wBroker.addModifyListener(lsMod);
+ FormData fdBroker = new FormData();
+ fdBroker.top = new FormAttachment(0, margin * 2);
+ fdBroker.left = new FormAttachment(middle, 0);
+ fdBroker.right = new FormAttachment(100, 0);
+ m_wBroker.setLayoutData(fdBroker);
+ lastControl = m_wBroker;
+
+ // Topic name
+ m_wlTopicName = new Label(wGeneralTabComp, SWT.RIGHT);
+ m_wlTopicName.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.TopicName.Label"));
+ props.setLook(m_wlTopicName);
+ FormData fdlTopicName = new FormData();
+ fdlTopicName.top = new FormAttachment(lastControl, margin);
+ fdlTopicName.left = new FormAttachment(0, 0);
+ fdlTopicName.right = new FormAttachment(middle, -margin);
+ m_wlTopicName.setLayoutData(fdlTopicName);
+ m_wTopicName = new CCombo(wGeneralTabComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER);
+ props.setLook(m_wTopicName);
+ m_wTopicName.addModifyListener(lsMod);
+ FormData fdTopicName = new FormData();
+ fdTopicName.top = new FormAttachment(lastControl, margin);
+ fdTopicName.left = new FormAttachment(middle, 0);
+ fdTopicName.right = new FormAttachment(100, 0);
+ m_wTopicName.setLayoutData(fdTopicName);
+ lastControl = m_wTopicName;
+
+ // Topic is from field
+ Label wlTopicIsFromFieldLab = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlTopicIsFromFieldLab.setText(
+ BaseMessages.getString(MQTTPublisherMeta.PKG,
"MQTTClientDialog.TopicNameIsInIncomingField.Label"));
+ props.setLook(wlTopicIsFromFieldLab);
+ FormData fd = new FormData();
+ fd.top = new FormAttachment(lastControl, margin);
+ fd.left = new FormAttachment(0, 0);
+ fd.right = new FormAttachment(middle, -margin);
+ wlTopicIsFromFieldLab.setLayoutData(fd);
+
+ m_wTopicFromIncomingField = new Button(wGeneralTabComp, SWT.CHECK);
+ props.setLook(m_wTopicFromIncomingField);
+ m_wTopicFromIncomingField.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent selectionEvent) {
+ super.widgetSelected(selectionEvent);
+ producerMeta.setChanged();
+ updateTopicCombo(getPreviousFields());
+ }
+ });
+ fd = new FormData();
+ fd.top = new FormAttachment(lastControl, margin);
+ fd.left = new FormAttachment(middle, 0);
+ fd.right = new FormAttachment(100, 0);
+ m_wTopicFromIncomingField.setLayoutData(fd);
+ lastControl = m_wTopicFromIncomingField;
+
+ // Input field
+ IRowMeta previousFields = getPreviousFields();
+
+ Label wlInputField = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlInputField.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.FieldName.Label"));
+ props.setLook(wlInputField);
+ FormData fdlInputField = new FormData();
+ fdlInputField.top = new FormAttachment(lastControl, margin);
+ fdlInputField.left = new FormAttachment(0, 0);
+ fdlInputField.right = new FormAttachment(middle, -margin);
+ wlInputField.setLayoutData(fdlInputField);
+ m_wInputField = new CCombo(wGeneralTabComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER);
+ m_wInputField.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.FieldName.Tooltip"));
+ m_wInputField.setItems(previousFields.getFieldNames());
+ props.setLook(m_wInputField);
+ m_wInputField.addModifyListener(lsMod);
+ FormData fdFilename = new FormData();
+ fdFilename.top = new FormAttachment(lastControl, margin);
+ fdFilename.left = new FormAttachment(middle, 0);
+ fdFilename.right = new FormAttachment(100, 0);
+ m_wInputField.setLayoutData(fdFilename);
+ lastControl = m_wInputField;
+
+ // Client ID
+ Label wlClientID = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlClientID.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.ClientID.Label"));
+ props.setLook(wlClientID);
+ FormData fdlClientID = new FormData();
+ fdlClientID.top = new FormAttachment(lastControl, margin);
+ fdlClientID.left = new FormAttachment(0, 0);
+ fdlClientID.right = new FormAttachment(middle, -margin);
+ wlClientID.setLayoutData(fdlClientID);
+ m_wClientID = new TextVar(variables, wGeneralTabComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER);
+ props.setLook(m_wClientID);
+ m_wClientID.addModifyListener(lsMod);
+ FormData fdClientID = new FormData();
+ fdClientID.top = new FormAttachment(lastControl, margin);
+ fdClientID.left = new FormAttachment(middle, 0);
+ fdClientID.right = new FormAttachment(100, 0);
+ m_wClientID.setLayoutData(fdClientID);
+ lastControl = m_wClientID;
+
+ // Connection timeout
+ Label wlConnectionTimeout = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlConnectionTimeout.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.ConnectionTimeout.Label"));
+ wlConnectionTimeout.setToolTipText(
+ BaseMessages.getString(MQTTPublisherMeta.PKG,
"MQTTClientDialog.ConnectionTimeout.ToolTip"));
+ props.setLook(wlConnectionTimeout);
+ FormData fdlConnectionTimeout = new FormData();
+ fdlConnectionTimeout.top = new FormAttachment(lastControl, margin);
+ fdlConnectionTimeout.left = new FormAttachment(0, 0);
+ fdlConnectionTimeout.right = new FormAttachment(middle, -margin);
+ wlConnectionTimeout.setLayoutData(fdlConnectionTimeout);
+ m_wTimeout = new TextVar(variables, wGeneralTabComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER);
+ props.setLook(m_wTimeout);
+ m_wTimeout.addModifyListener(lsMod);
+ FormData fdConnectionTimeout = new FormData();
+ fdConnectionTimeout.top = new FormAttachment(lastControl, margin);
+ fdConnectionTimeout.left = new FormAttachment(middle, 0);
+ fdConnectionTimeout.right = new FormAttachment(100, 0);
+ m_wTimeout.setLayoutData(fdConnectionTimeout);
+ lastControl = m_wTimeout;
+
+ // QOS
+ Label wlQOS = new Label(wGeneralTabComp, SWT.RIGHT);
+ wlQOS.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.QOS.Label"));
+ props.setLook(wlQOS);
+ FormData fdlQOS = new FormData();
+ fdlQOS.top = new FormAttachment(lastControl, margin);
+ fdlQOS.left = new FormAttachment(0, 0);
+ fdlQOS.right = new FormAttachment(middle, -margin);
+ wlQOS.setLayoutData(fdlQOS);
+ m_wQOS = new TextVar(variables, wGeneralTabComp, SWT.SINGLE | SWT.LEFT
| SWT.BORDER);
+ props.setLook(m_wQOS);
+ m_wQOS.addModifyListener(lsMod);
+ FormData fdQOS = new FormData();
+ fdQOS.top = new FormAttachment(lastControl, margin);
+ fdQOS.left = new FormAttachment(middle, 0);
+ fdQOS.right = new FormAttachment(100, 0);
+ m_wQOS.setLayoutData(fdQOS);
+ lastControl = m_wQOS;
+
+ FormData fdGeneralTabComp = new FormData();
+ fdGeneralTabComp.left = new FormAttachment(0, 0);
+ fdGeneralTabComp.top = new FormAttachment(0, 0);
+ fdGeneralTabComp.right = new FormAttachment(100, 0);
+ fdGeneralTabComp.bottom = new FormAttachment(100, 0);
+ wGeneralTabComp.setLayoutData(fdGeneralTabComp);
+
+ wGeneralTabComp.layout();
+ m_wGeneralTab.setControl(wGeneralTabComp);
+
+ // ====================
+ // CREDENTIALS TAB
+ // ====================
+ m_wCredentialsTab = new CTabItem(m_wTabFolder, SWT.NONE);
+ m_wCredentialsTab.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.CredentialsTab.Title"));
//$NON-NLS-1$
- ModifyListener lsMod = new ModifyListener() {
- public void modifyText( ModifyEvent e ) {
- producerMeta.setChanged();
- }
- };
- changed = producerMeta.hasChanged();
-
- FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = Const.FORM_MARGIN;
- formLayout.marginHeight = Const.FORM_MARGIN;
-
- shell.setLayout( formLayout );
- shell.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Shell.Title" ) );
-
- int middle = props.getMiddlePct();
- int margin = Const.MARGIN;
-
- // Step name
- wlTransformName = new Label( shell, SWT.RIGHT );
- wlTransformName.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.StepName.Label" ) );
- props.setLook( wlTransformName );
- fdlTransformName = new FormData();
- fdlTransformName.left = new FormAttachment( 0, 0 );
- fdlTransformName.right = new FormAttachment( middle, -margin );
- fdlTransformName.top = new FormAttachment( 0, margin );
- wlTransformName.setLayoutData( fdlTransformName );
- wTransformName = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- props.setLook( wTransformName );
- wTransformName.addModifyListener( lsMod );
- fdTransformName = new FormData();
- fdTransformName.left = new FormAttachment( middle, 0 );
- fdTransformName.top = new FormAttachment( 0, margin );
- fdTransformName.right = new FormAttachment( 100, 0 );
- wTransformName.setLayoutData( fdTransformName );
- Control lastControl = wTransformName;
-
- // ====================
- // START OF TAB FOLDER
- // ====================
- m_wTabFolder = new CTabFolder( shell, SWT.BORDER );
- props.setLook( m_wTabFolder, Props.WIDGET_STYLE_TAB );
-
- // ====================
- // GENERAL TAB
- // ====================
-
- m_wGeneralTab = new CTabItem( m_wTabFolder, SWT.NONE );
- m_wGeneralTab.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.GeneralTab.Label" ) ); //$NON-NLS-1$
-
- FormLayout mainLayout = new FormLayout();
- mainLayout.marginWidth = 3;
- mainLayout.marginHeight = 3;
-
- Composite wGeneralTabComp = new Composite( m_wTabFolder, SWT.NONE );
- props.setLook( wGeneralTabComp );
- wGeneralTabComp.setLayout( mainLayout );
-
- // Broker URL
- Label wlBroker = new Label( wGeneralTabComp, SWT.RIGHT );
- wlBroker.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Broker.Label" ) );
- props.setLook( wlBroker );
- FormData fdlBroker = new FormData();
- fdlBroker.top = new FormAttachment( 0, margin * 2 );
- fdlBroker.left = new FormAttachment( 0, 0 );
- fdlBroker.right = new FormAttachment( middle, -margin );
- wlBroker.setLayoutData( fdlBroker );
- m_wBroker = new TextVar( variables, wGeneralTabComp, SWT.SINGLE | SWT.LEFT
| SWT.BORDER );
- props.setLook( m_wBroker );
- m_wBroker.addModifyListener( lsMod );
- FormData fdBroker = new FormData();
- fdBroker.top = new FormAttachment( 0, margin * 2 );
- fdBroker.left = new FormAttachment( middle, 0 );
- fdBroker.right = new FormAttachment( 100, 0 );
- m_wBroker.setLayoutData( fdBroker );
- lastControl = m_wBroker;
-
- // Topic name
- m_wlTopicName = new Label( wGeneralTabComp, SWT.RIGHT );
- m_wlTopicName.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.TopicName.Label" ) );
- props.setLook( m_wlTopicName );
- FormData fdlTopicName = new FormData();
- fdlTopicName.top = new FormAttachment( lastControl, margin );
- fdlTopicName.left = new FormAttachment( 0, 0 );
- fdlTopicName.right = new FormAttachment( middle, -margin );
- m_wlTopicName.setLayoutData( fdlTopicName );
- m_wTopicName = new CCombo( wGeneralTabComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- props.setLook( m_wTopicName );
- m_wTopicName.addModifyListener( lsMod );
- FormData fdTopicName = new FormData();
- fdTopicName.top = new FormAttachment( lastControl, margin );
- fdTopicName.left = new FormAttachment( middle, 0 );
- fdTopicName.right = new FormAttachment( 100, 0 );
- m_wTopicName.setLayoutData( fdTopicName );
- lastControl = m_wTopicName;
-
- // Topic is from field
- Label wlTopicIsFromFieldLab = new Label( wGeneralTabComp, SWT.RIGHT );
- wlTopicIsFromFieldLab.setText(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientDialog.TopicNameIsInIncomingField.Label" ) );
- props.setLook( wlTopicIsFromFieldLab );
- FormData fd = new FormData();
- fd.top = new FormAttachment( lastControl, margin );
- fd.left = new FormAttachment( 0, 0 );
- fd.right = new FormAttachment( middle, -margin );
- wlTopicIsFromFieldLab.setLayoutData( fd );
-
- m_wTopicFromIncomingField = new Button( wGeneralTabComp, SWT.CHECK );
- props.setLook( m_wTopicFromIncomingField );
- m_wTopicFromIncomingField.addSelectionListener( new SelectionAdapter() {
- @Override public void widgetSelected( SelectionEvent selectionEvent ) {
- super.widgetSelected( selectionEvent );
- producerMeta.setChanged();
- updateTopicCombo( getPreviousFields() );
- }
- } );
- fd = new FormData();
- fd.top = new FormAttachment( lastControl, margin );
- fd.left = new FormAttachment( middle, 0 );
- fd.right = new FormAttachment( 100, 0 );
- m_wTopicFromIncomingField.setLayoutData( fd );
- lastControl = m_wTopicFromIncomingField;
-
- // Input field
- IRowMeta previousFields = getPreviousFields();
-
- Label wlInputField = new Label( wGeneralTabComp, SWT.RIGHT );
- wlInputField.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.FieldName.Label" ) );
- props.setLook( wlInputField );
- FormData fdlInputField = new FormData();
- fdlInputField.top = new FormAttachment( lastControl, margin );
- fdlInputField.left = new FormAttachment( 0, 0 );
- fdlInputField.right = new FormAttachment( middle, -margin );
- wlInputField.setLayoutData( fdlInputField );
- m_wInputField = new CCombo( wGeneralTabComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- m_wInputField.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.FieldName.Tooltip" ) );
- m_wInputField.setItems( previousFields.getFieldNames() );
- props.setLook( m_wInputField );
- m_wInputField.addModifyListener( lsMod );
- FormData fdFilename = new FormData();
- fdFilename.top = new FormAttachment( lastControl, margin );
- fdFilename.left = new FormAttachment( middle, 0 );
- fdFilename.right = new FormAttachment( 100, 0 );
- m_wInputField.setLayoutData( fdFilename );
- lastControl = m_wInputField;
-
- // Client ID
- Label wlClientID = new Label( wGeneralTabComp, SWT.RIGHT );
- wlClientID.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.ClientID.Label" ) );
- props.setLook( wlClientID );
- FormData fdlClientID = new FormData();
- fdlClientID.top = new FormAttachment( lastControl, margin );
- fdlClientID.left = new FormAttachment( 0, 0 );
- fdlClientID.right = new FormAttachment( middle, -margin );
- wlClientID.setLayoutData( fdlClientID );
- m_wClientID = new TextVar( variables, wGeneralTabComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER );
- props.setLook( m_wClientID );
- m_wClientID.addModifyListener( lsMod );
- FormData fdClientID = new FormData();
- fdClientID.top = new FormAttachment( lastControl, margin );
- fdClientID.left = new FormAttachment( middle, 0 );
- fdClientID.right = new FormAttachment( 100, 0 );
- m_wClientID.setLayoutData( fdClientID );
- lastControl = m_wClientID;
-
- // Connection timeout
- Label wlConnectionTimeout = new Label( wGeneralTabComp, SWT.RIGHT );
- wlConnectionTimeout.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.ConnectionTimeout.Label" ) );
- wlConnectionTimeout.setToolTipText(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientDialog.ConnectionTimeout.ToolTip" ) );
- props.setLook( wlConnectionTimeout );
- FormData fdlConnectionTimeout = new FormData();
- fdlConnectionTimeout.top = new FormAttachment( lastControl, margin );
- fdlConnectionTimeout.left = new FormAttachment( 0, 0 );
- fdlConnectionTimeout.right = new FormAttachment( middle, -margin );
- wlConnectionTimeout.setLayoutData( fdlConnectionTimeout );
- m_wTimeout = new TextVar( variables, wGeneralTabComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER );
- props.setLook( m_wTimeout );
- m_wTimeout.addModifyListener( lsMod );
- FormData fdConnectionTimeout = new FormData();
- fdConnectionTimeout.top = new FormAttachment( lastControl, margin );
- fdConnectionTimeout.left = new FormAttachment( middle, 0 );
- fdConnectionTimeout.right = new FormAttachment( 100, 0 );
- m_wTimeout.setLayoutData( fdConnectionTimeout );
- lastControl = m_wTimeout;
-
- // QOS
- Label wlQOS = new Label( wGeneralTabComp, SWT.RIGHT );
- wlQOS.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.QOS.Label" ) );
- props.setLook( wlQOS );
- FormData fdlQOS = new FormData();
- fdlQOS.top = new FormAttachment( lastControl, margin );
- fdlQOS.left = new FormAttachment( 0, 0 );
- fdlQOS.right = new FormAttachment( middle, -margin );
- wlQOS.setLayoutData( fdlQOS );
- m_wQOS = new TextVar( variables, wGeneralTabComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- props.setLook( m_wQOS );
- m_wQOS.addModifyListener( lsMod );
- FormData fdQOS = new FormData();
- fdQOS.top = new FormAttachment( lastControl, margin );
- fdQOS.left = new FormAttachment( middle, 0 );
- fdQOS.right = new FormAttachment( 100, 0 );
- m_wQOS.setLayoutData( fdQOS );
- lastControl = m_wQOS;
-
- FormData fdGeneralTabComp = new FormData();
- fdGeneralTabComp.left = new FormAttachment( 0, 0 );
- fdGeneralTabComp.top = new FormAttachment( 0, 0 );
- fdGeneralTabComp.right = new FormAttachment( 100, 0 );
- fdGeneralTabComp.bottom = new FormAttachment( 100, 0 );
- wGeneralTabComp.setLayoutData( fdGeneralTabComp );
-
- wGeneralTabComp.layout();
- m_wGeneralTab.setControl( wGeneralTabComp );
-
- // ====================
- // CREDENTIALS TAB
- // ====================
- m_wCredentialsTab = new CTabItem( m_wTabFolder, SWT.NONE );
- m_wCredentialsTab.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.CredentialsTab.Title" ) ); //$NON-NLS-1$
-
- Composite wCredentialsComp = new Composite( m_wTabFolder, SWT.NONE );
- props.setLook( wCredentialsComp );
-
- FormLayout fieldsCompLayout = new FormLayout();
- fieldsCompLayout.marginWidth = Const.FORM_MARGIN;
- fieldsCompLayout.marginHeight = Const.FORM_MARGIN;
- wCredentialsComp.setLayout( fieldsCompLayout );
-
- Label wlRequiresAuth = new Label( wCredentialsComp, SWT.RIGHT );
- wlRequiresAuth.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.RequireAuth.Label" ) );
- props.setLook( wlRequiresAuth );
- FormData fdlRequriesAuth = new FormData();
- fdlRequriesAuth.left = new FormAttachment( 0, 0 );
- fdlRequriesAuth.top = new FormAttachment( 0, margin * 2 );
- fdlRequriesAuth.right = new FormAttachment( middle, -margin );
- wlRequiresAuth.setLayoutData( fdlRequriesAuth );
- m_wRequiresAuth = new Button( wCredentialsComp, SWT.CHECK );
- props.setLook( m_wRequiresAuth );
- FormData fdRequiresAuth = new FormData();
- fdRequiresAuth.left = new FormAttachment( middle, 0 );
- fdRequiresAuth.top = new FormAttachment( 0, margin * 2 );
- fdRequiresAuth.right = new FormAttachment( 100, 0 );
- m_wRequiresAuth.setLayoutData( fdRequiresAuth );
-
- m_wRequiresAuth.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent arg0 ) {
- boolean enabled = m_wRequiresAuth.getSelection();
- m_wlUsername.setEnabled( enabled );
- m_wUsername.setEnabled( enabled );
- m_wlPassword.setEnabled( enabled );
- m_wPassword.setEnabled( enabled );
- }
- } );
- lastControl = m_wRequiresAuth;
-
- // Username field
- m_wlUsername = new Label( wCredentialsComp, SWT.RIGHT );
- m_wlUsername.setEnabled( false );
- m_wlUsername.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Username.Label" ) ); //$NON-NLS-1$
- props.setLook( m_wlUsername );
- FormData fdlUsername = new FormData();
- fdlUsername.left = new FormAttachment( 0, -margin );
- fdlUsername.right = new FormAttachment( middle, -2 * margin );
- fdlUsername.top = new FormAttachment( lastControl, 2 * margin );
- m_wlUsername.setLayoutData( fdlUsername );
-
- m_wUsername = new TextVar( variables, wCredentialsComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER );
- m_wUsername.setEnabled( false );
- m_wUsername.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Username.Tooltip" ) );
- props.setLook( m_wUsername );
- m_wUsername.addModifyListener( lsMod );
- FormData fdResult = new FormData();
- fdResult.left = new FormAttachment( middle, -margin );
- fdResult.top = new FormAttachment( lastControl, 2 * margin );
- fdResult.right = new FormAttachment( 100, 0 );
- m_wUsername.setLayoutData( fdResult );
- lastControl = m_wUsername;
-
- // Password field
- m_wlPassword = new Label( wCredentialsComp, SWT.RIGHT );
- m_wlPassword.setEnabled( false );
- m_wlPassword.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Password.Label" ) ); //$NON-NLS-1$
- props.setLook( m_wlPassword );
- FormData fdlPassword = new FormData();
- fdlPassword.left = new FormAttachment( 0, -margin );
- fdlPassword.right = new FormAttachment( middle, -2 * margin );
- fdlPassword.top = new FormAttachment( lastControl, margin );
- m_wlPassword.setLayoutData( fdlPassword );
-
- m_wPassword = new TextVar( variables, wCredentialsComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER | SWT.PASSWORD );
- m_wPassword.setEnabled( false );
- m_wPassword.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.Password.Tooltip" ) );
- props.setLook( m_wPassword );
- m_wPassword.addModifyListener( lsMod );
- FormData fdPassword = new FormData();
- fdPassword.left = new FormAttachment( middle, -margin );
- fdPassword.top = new FormAttachment( lastControl, margin );
- fdPassword.right = new FormAttachment( 100, 0 );
- m_wPassword.setLayoutData( fdPassword );
-
- FormData fdCredentialsComp = new FormData();
- fdCredentialsComp.left = new FormAttachment( 0, 0 );
- fdCredentialsComp.top = new FormAttachment( 0, 0 );
- fdCredentialsComp.right = new FormAttachment( 100, 0 );
- fdCredentialsComp.bottom = new FormAttachment( 100, 0 );
- wCredentialsComp.setLayoutData( fdCredentialsComp );
-
- wCredentialsComp.layout();
- m_wCredentialsTab.setControl( wCredentialsComp );
-
- // ====================
- // SSL TAB
- // ====================
- m_wSSLTab = new CTabItem( m_wTabFolder, SWT.NONE );
- m_wSSLTab.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.SSLTab.Label" ) ); //$NON-NLS-1$
-
- Composite wSSLComp = new Composite( m_wTabFolder, SWT.NONE );
- props.setLook( wSSLComp );
-
- FormLayout sslCompLayout = new FormLayout();
- sslCompLayout.marginWidth = Const.FORM_MARGIN;
- sslCompLayout.marginHeight = Const.FORM_MARGIN;
- wSSLComp.setLayout( sslCompLayout );
-
- // Server CA file path
- Label wlCAFile = new Label( wSSLComp, SWT.RIGHT );
- wlCAFile.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.CAFile.Label" ) ); //$NON-NLS-1$
- props.setLook( wlCAFile );
- FormData fdlCAFile = new FormData();
- fdlCAFile.left = new FormAttachment( 0, -margin );
- fdlCAFile.right = new FormAttachment( middle, -2 * margin );
- fdlCAFile.top = new FormAttachment( 0, 2 * margin );
- wlCAFile.setLayoutData( fdlCAFile );
-
- m_wCAFile = new TextVar( variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- m_wCAFile.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.CAFile.Tooltip" ) );
- props.setLook( m_wCAFile );
- m_wCAFile.addModifyListener( lsMod );
- FormData fdCAFile = new FormData();
- fdCAFile.left = new FormAttachment( middle, -margin );
- fdCAFile.top = new FormAttachment( 0, 2 * margin );
- fdCAFile.right = new FormAttachment( 100, 0 );
- m_wCAFile.setLayoutData( fdCAFile );
- lastControl = m_wCAFile;
-
- // Client certificate file path
- Label wlCertFile = new Label( wSSLComp, SWT.RIGHT );
- wlCertFile.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.CertFile.Label" ) ); //$NON-NLS-1$
- props.setLook( wlCertFile );
- FormData fdlCertFile = new FormData();
- fdlCertFile.left = new FormAttachment( 0, -margin );
- fdlCertFile.right = new FormAttachment( middle, -2 * margin );
- fdlCertFile.top = new FormAttachment( lastControl, margin );
- wlCertFile.setLayoutData( fdlCertFile );
-
- m_wCertFile = new TextVar( variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- m_wCertFile.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.CertFile.Tooltip" ) );
- props.setLook( m_wCertFile );
- m_wCertFile.addModifyListener( lsMod );
- FormData fdCertFile = new FormData();
- fdCertFile.left = new FormAttachment( middle, -margin );
- fdCertFile.top = new FormAttachment( lastControl, margin );
- fdCertFile.right = new FormAttachment( 100, 0 );
- m_wCertFile.setLayoutData( fdCertFile );
- lastControl = m_wCertFile;
-
- // Client key file path
- Label wlKeyFile = new Label( wSSLComp, SWT.RIGHT );
- wlKeyFile.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.KeyFile.Label" ) ); //$NON-NLS-1$
- props.setLook( wlKeyFile );
- FormData fdlKeyFile = new FormData();
- fdlKeyFile.left = new FormAttachment( 0, -margin );
- fdlKeyFile.right = new FormAttachment( middle, -2 * margin );
- fdlKeyFile.top = new FormAttachment( lastControl, margin );
- wlKeyFile.setLayoutData( fdlKeyFile );
-
- m_wKeyFile = new TextVar( variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER );
- m_wKeyFile.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.KeyFile.Tooltip" ) );
- props.setLook( m_wKeyFile );
- m_wKeyFile.addModifyListener( lsMod );
- FormData fdKeyFile = new FormData();
- fdKeyFile.left = new FormAttachment( middle, -margin );
- fdKeyFile.top = new FormAttachment( lastControl, margin );
- fdKeyFile.right = new FormAttachment( 100, 0 );
- m_wKeyFile.setLayoutData( fdKeyFile );
- lastControl = m_wKeyFile;
-
- // Client key file password path
- Label wlKeyPassword = new Label( wSSLComp, SWT.RIGHT );
- wlKeyPassword.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.KeyPassword.Label" ) ); //$NON-NLS-1$
- props.setLook( wlKeyPassword );
- FormData fdlKeyPassword = new FormData();
- fdlKeyPassword.left = new FormAttachment( 0, -margin );
- fdlKeyPassword.right = new FormAttachment( middle, -2 * margin );
- fdlKeyPassword.top = new FormAttachment( lastControl, margin );
- wlKeyPassword.setLayoutData( fdlKeyPassword );
-
- m_wKeyPassword = new TextVar( variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER | SWT.PASSWORD );
- m_wKeyPassword.setToolTipText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.KeyPassword.Tooltip" ) );
- props.setLook( m_wKeyPassword );
- m_wKeyPassword.addModifyListener( lsMod );
- FormData fdKeyPassword = new FormData();
- fdKeyPassword.left = new FormAttachment( middle, -margin );
- fdKeyPassword.top = new FormAttachment( lastControl, margin );
- fdKeyPassword.right = new FormAttachment( 100, 0 );
- m_wKeyPassword.setLayoutData( fdKeyPassword );
- lastControl = m_wKeyPassword;
-
- FormData fdSSLComp = new FormData();
- fdSSLComp.left = new FormAttachment( 0, 0 );
- fdSSLComp.top = new FormAttachment( 0, 0 );
- fdSSLComp.right = new FormAttachment( 100, 0 );
- fdSSLComp.bottom = new FormAttachment( 100, 0 );
- wSSLComp.setLayoutData( fdSSLComp );
-
- wSSLComp.layout();
- m_wSSLTab.setControl( wSSLComp );
-
- // ====================
- // BUTTONS
- // ====================
- wOk = new Button( shell, SWT.PUSH );
- wOk.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "System.Button.OK" ) ); //$NON-NLS-1$
- wCancel = new Button( shell, SWT.PUSH );
- wCancel.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
- "System.Button.Cancel" ) ); //$NON-NLS-1$
-
- setButtonPositions( new Button[] { wOk, wCancel }, margin, null );
-
- // ====================
- // END OF TAB FOLDER
- // ====================
- FormData fdTabFolder = new FormData();
- fdTabFolder.left = new FormAttachment( 0, 0 );
- fdTabFolder.top = new FormAttachment( wTransformName, margin );
- fdTabFolder.right = new FormAttachment( 100, 0 );
- fdTabFolder.bottom = new FormAttachment( wOk, -margin );
- m_wTabFolder.setLayoutData( fdTabFolder );
-
- // Add listeners
- lsCancel = new Listener() {
- public void handleEvent( Event e ) {
- cancel();
- }
- };
- lsOk = new Listener() {
- public void handleEvent( Event e ) {
- ok();
- }
- };
- wCancel.addListener( SWT.Selection, lsCancel );
- wOk.addListener( SWT.Selection, lsOk );
-
- lsDef = new SelectionAdapter() {
- public void widgetDefaultSelected( SelectionEvent e ) {
- ok();
- }
- };
- wTransformName.addSelectionListener( lsDef );
- m_wTopicName.addSelectionListener( lsDef );
- m_wInputField.addSelectionListener( lsDef );
-
- m_wTabFolder.setSelection( 0 );
-
- // Detect X or ALT-F4 or something that kills this window...
- shell.addShellListener( new ShellAdapter() {
- public void shellClosed( ShellEvent e ) {
- cancel();
- }
- } );
-
- // Set the shell size, based upon previous time...
- setSize( shell, 440, 350, true );
-
- getData( producerMeta, true );
- producerMeta.setChanged( changed );
-
- shell.open();
- while ( !shell.isDisposed() ) {
- if ( !display.readAndDispatch() ) {
- display.sleep();
- }
- }
- return transformName;
- }
+ Composite wCredentialsComp = new Composite(m_wTabFolder, SWT.NONE);
+ props.setLook(wCredentialsComp);
- private IRowMeta getPreviousFields() {
- IRowMeta previousFields = null;
+ FormLayout fieldsCompLayout = new FormLayout();
+ fieldsCompLayout.marginWidth = Const.FORM_MARGIN;
+ fieldsCompLayout.marginHeight = Const.FORM_MARGIN;
+ wCredentialsComp.setLayout(fieldsCompLayout);
- if ( !gotPreviousFields ) {
- try {
- previousFields =
pipelineMeta.getPrevTransformFields(variables,transformName );
- } catch (HopTransformException e) {
- new ErrorDialog(shell, BaseMessages
+ Label wlRequiresAuth = new Label(wCredentialsComp, SWT.RIGHT);
+ wlRequiresAuth.setText(BaseMessages
.getString(MQTTPublisherMeta.PKG,
- "System.Dialog.Error.Title"), BaseMessages
+ "MQTTClientDialog.RequireAuth.Label"));
+ props.setLook(wlRequiresAuth);
+ FormData fdlRequriesAuth = new FormData();
+ fdlRequriesAuth.left = new FormAttachment(0, 0);
+ fdlRequriesAuth.top = new FormAttachment(0, margin * 2);
+ fdlRequriesAuth.right = new FormAttachment(middle, -margin);
+ wlRequiresAuth.setLayoutData(fdlRequriesAuth);
+ m_wRequiresAuth = new Button(wCredentialsComp, SWT.CHECK);
+ props.setLook(m_wRequiresAuth);
+ FormData fdRequiresAuth = new FormData();
+ fdRequiresAuth.left = new FormAttachment(middle, 0);
+ fdRequiresAuth.top = new FormAttachment(0, margin * 2);
+ fdRequiresAuth.right = new FormAttachment(100, 0);
+ m_wRequiresAuth.setLayoutData(fdRequiresAuth);
+
+ m_wRequiresAuth.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ boolean enabled = m_wRequiresAuth.getSelection();
+ m_wlUsername.setEnabled(enabled);
+ m_wUsername.setEnabled(enabled);
+ m_wlPassword.setEnabled(enabled);
+ m_wPassword.setEnabled(enabled);
+ }
+ });
+ lastControl = m_wRequiresAuth;
+
+ // Username field
+ m_wlUsername = new Label(wCredentialsComp, SWT.RIGHT);
+ m_wlUsername.setEnabled(false);
+ m_wlUsername.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.Username.Label")); //$NON-NLS-1$
+ props.setLook(m_wlUsername);
+ FormData fdlUsername = new FormData();
+ fdlUsername.left = new FormAttachment(0, -margin);
+ fdlUsername.right = new FormAttachment(middle, -2 * margin);
+ fdlUsername.top = new FormAttachment(lastControl, 2 * margin);
+ m_wlUsername.setLayoutData(fdlUsername);
+
+ m_wUsername = new TextVar(variables, wCredentialsComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER);
+ m_wUsername.setEnabled(false);
+ m_wUsername.setToolTipText(BaseMessages
.getString(MQTTPublisherMeta.PKG,
-
"MQTTClientDialog.ErrorDialog.UnableToGetInputFields.Message"), e);
- }
-
- gotPreviousFields = true;
+ "MQTTClientDialog.Username.Tooltip"));
+ props.setLook(m_wUsername);
+ m_wUsername.addModifyListener(lsMod);
+ FormData fdResult = new FormData();
+ fdResult.left = new FormAttachment(middle, -margin);
+ fdResult.top = new FormAttachment(lastControl, 2 * margin);
+ fdResult.right = new FormAttachment(100, 0);
+ m_wUsername.setLayoutData(fdResult);
+ lastControl = m_wUsername;
+
+ // Password field
+ m_wlPassword = new Label(wCredentialsComp, SWT.RIGHT);
+ m_wlPassword.setEnabled(false);
+ m_wlPassword.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.Password.Label")); //$NON-NLS-1$
+ props.setLook(m_wlPassword);
+ FormData fdlPassword = new FormData();
+ fdlPassword.left = new FormAttachment(0, -margin);
+ fdlPassword.right = new FormAttachment(middle, -2 * margin);
+ fdlPassword.top = new FormAttachment(lastControl, margin);
+ m_wlPassword.setLayoutData(fdlPassword);
+
+ m_wPassword = new TextVar(variables, wCredentialsComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER | SWT.PASSWORD);
+ m_wPassword.setEnabled(false);
+ m_wPassword.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.Password.Tooltip"));
+ props.setLook(m_wPassword);
+ m_wPassword.addModifyListener(lsMod);
+ FormData fdPassword = new FormData();
+ fdPassword.left = new FormAttachment(middle, -margin);
+ fdPassword.top = new FormAttachment(lastControl, margin);
+ fdPassword.right = new FormAttachment(100, 0);
+ m_wPassword.setLayoutData(fdPassword);
+
+ FormData fdCredentialsComp = new FormData();
+ fdCredentialsComp.left = new FormAttachment(0, 0);
+ fdCredentialsComp.top = new FormAttachment(0, 0);
+ fdCredentialsComp.right = new FormAttachment(100, 0);
+ fdCredentialsComp.bottom = new FormAttachment(100, 0);
+ wCredentialsComp.setLayoutData(fdCredentialsComp);
+
+ wCredentialsComp.layout();
+ m_wCredentialsTab.setControl(wCredentialsComp);
+
+ // ====================
+ // SSL TAB
+ // ====================
+ m_wSSLTab = new CTabItem(m_wTabFolder, SWT.NONE);
+ m_wSSLTab.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.SSLTab.Label")); //$NON-NLS-1$
+
+ Composite wSSLComp = new Composite(m_wTabFolder, SWT.NONE);
+ props.setLook(wSSLComp);
+
+ FormLayout sslCompLayout = new FormLayout();
+ sslCompLayout.marginWidth = Const.FORM_MARGIN;
+ sslCompLayout.marginHeight = Const.FORM_MARGIN;
+ wSSLComp.setLayout(sslCompLayout);
+
+ // Server CA file path
+ Label wlCAFile = new Label(wSSLComp, SWT.RIGHT);
+ wlCAFile.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.CAFile.Label")); //$NON-NLS-1$
+ props.setLook(wlCAFile);
+ FormData fdlCAFile = new FormData();
+ fdlCAFile.left = new FormAttachment(0, -margin);
+ fdlCAFile.right = new FormAttachment(middle, -2 * margin);
+ fdlCAFile.top = new FormAttachment(0, 2 * margin);
+ wlCAFile.setLayoutData(fdlCAFile);
+
+ m_wCAFile = new TextVar(variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER);
+ m_wCAFile.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.CAFile.Tooltip"));
+ props.setLook(m_wCAFile);
+ m_wCAFile.addModifyListener(lsMod);
+ FormData fdCAFile = new FormData();
+ fdCAFile.left = new FormAttachment(middle, -margin);
+ fdCAFile.top = new FormAttachment(0, 2 * margin);
+ fdCAFile.right = new FormAttachment(100, 0);
+ m_wCAFile.setLayoutData(fdCAFile);
+ lastControl = m_wCAFile;
+
+ // Client certificate file path
+ Label wlCertFile = new Label(wSSLComp, SWT.RIGHT);
+ wlCertFile.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.CertFile.Label")); //$NON-NLS-1$
+ props.setLook(wlCertFile);
+ FormData fdlCertFile = new FormData();
+ fdlCertFile.left = new FormAttachment(0, -margin);
+ fdlCertFile.right = new FormAttachment(middle, -2 * margin);
+ fdlCertFile.top = new FormAttachment(lastControl, margin);
+ wlCertFile.setLayoutData(fdlCertFile);
+
+ m_wCertFile = new TextVar(variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER);
+ m_wCertFile.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.CertFile.Tooltip"));
+ props.setLook(m_wCertFile);
+ m_wCertFile.addModifyListener(lsMod);
+ FormData fdCertFile = new FormData();
+ fdCertFile.left = new FormAttachment(middle, -margin);
+ fdCertFile.top = new FormAttachment(lastControl, margin);
+ fdCertFile.right = new FormAttachment(100, 0);
+ m_wCertFile.setLayoutData(fdCertFile);
+ lastControl = m_wCertFile;
+
+ // Client key file path
+ Label wlKeyFile = new Label(wSSLComp, SWT.RIGHT);
+ wlKeyFile.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.KeyFile.Label")); //$NON-NLS-1$
+ props.setLook(wlKeyFile);
+ FormData fdlKeyFile = new FormData();
+ fdlKeyFile.left = new FormAttachment(0, -margin);
+ fdlKeyFile.right = new FormAttachment(middle, -2 * margin);
+ fdlKeyFile.top = new FormAttachment(lastControl, margin);
+ wlKeyFile.setLayoutData(fdlKeyFile);
+
+ m_wKeyFile = new TextVar(variables, wSSLComp, SWT.SINGLE | SWT.LEFT |
SWT.BORDER);
+ m_wKeyFile.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.KeyFile.Tooltip"));
+ props.setLook(m_wKeyFile);
+ m_wKeyFile.addModifyListener(lsMod);
+ FormData fdKeyFile = new FormData();
+ fdKeyFile.left = new FormAttachment(middle, -margin);
+ fdKeyFile.top = new FormAttachment(lastControl, margin);
+ fdKeyFile.right = new FormAttachment(100, 0);
+ m_wKeyFile.setLayoutData(fdKeyFile);
+ lastControl = m_wKeyFile;
+
+ // Client key file password path
+ Label wlKeyPassword = new Label(wSSLComp, SWT.RIGHT);
+ wlKeyPassword.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.KeyPassword.Label")); //$NON-NLS-1$
+ props.setLook(wlKeyPassword);
+ FormData fdlKeyPassword = new FormData();
+ fdlKeyPassword.left = new FormAttachment(0, -margin);
+ fdlKeyPassword.right = new FormAttachment(middle, -2 * margin);
+ fdlKeyPassword.top = new FormAttachment(lastControl, margin);
+ wlKeyPassword.setLayoutData(fdlKeyPassword);
+
+ m_wKeyPassword = new TextVar(variables, wSSLComp, SWT.SINGLE |
SWT.LEFT | SWT.BORDER | SWT.PASSWORD);
+ m_wKeyPassword.setToolTipText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.KeyPassword.Tooltip"));
+ props.setLook(m_wKeyPassword);
+ m_wKeyPassword.addModifyListener(lsMod);
+ FormData fdKeyPassword = new FormData();
+ fdKeyPassword.left = new FormAttachment(middle, -margin);
+ fdKeyPassword.top = new FormAttachment(lastControl, margin);
+ fdKeyPassword.right = new FormAttachment(100, 0);
+ m_wKeyPassword.setLayoutData(fdKeyPassword);
+ lastControl = m_wKeyPassword;
+
+ FormData fdSSLComp = new FormData();
+ fdSSLComp.left = new FormAttachment(0, 0);
+ fdSSLComp.top = new FormAttachment(0, 0);
+ fdSSLComp.right = new FormAttachment(100, 0);
+ fdSSLComp.bottom = new FormAttachment(100, 0);
+ wSSLComp.setLayoutData(fdSSLComp);
+
+ wSSLComp.layout();
+ m_wSSLTab.setControl(wSSLComp);
+
+ // ====================
+ // BUTTONS
+ // ====================
+ wOk = new Button(shell, SWT.PUSH);
+ wOk.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "System.Button.OK")); //$NON-NLS-1$
+ wCancel = new Button(shell, SWT.PUSH);
+ wCancel.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
+ "System.Button.Cancel")); //$NON-NLS-1$
+
+ setButtonPositions(new Button[]{wOk, wCancel}, margin, null);
+
+ // ====================
+ // END OF TAB FOLDER
+ // ====================
+ FormData fdTabFolder = new FormData();
+ fdTabFolder.left = new FormAttachment(0, 0);
+ fdTabFolder.top = new FormAttachment(wTransformName, margin);
+ fdTabFolder.right = new FormAttachment(100, 0);
+ fdTabFolder.bottom = new FormAttachment(wOk, -margin);
+ m_wTabFolder.setLayoutData(fdTabFolder);
+
+ // Add listeners
+ lsCancel = new Listener() {
+ public void handleEvent(Event e) {
+ cancel();
+ }
+ };
+ lsOk = new Listener() {
+ public void handleEvent(Event e) {
+ ok();
+ }
+ };
+ wCancel.addListener(SWT.Selection, lsCancel);
+ wOk.addListener(SWT.Selection, lsOk);
+
+ lsDef = new SelectionAdapter() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ ok();
+ }
+ };
+ wTransformName.addSelectionListener(lsDef);
+ m_wTopicName.addSelectionListener(lsDef);
+ m_wInputField.addSelectionListener(lsDef);
+
+ m_wTabFolder.setSelection(0);
+
+ // Detect X or ALT-F4 or something that kills this window...
+ shell.addShellListener(new ShellAdapter() {
+ public void shellClosed(ShellEvent e) {
+ cancel();
+ }
+ });
+
+ // Set the shell size, based upon previous time...
+ setSize(shell, 440, 350, true);
+
+ getData(producerMeta, true);
+ producerMeta.setChanged(changed);
+
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ return transformName;
}
- return previousFields;
- }
+ private IRowMeta getPreviousFields() {
+ IRowMeta previousFields = null;
- private void updateTopicCombo( IRowMeta previousFields ) {
- if ( m_wTopicFromIncomingField.getSelection() ) {
- m_wlTopicName.setText( BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientDialog.TopicNameFromField" ) );
- } else {
- m_wlTopicName.setText( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
- "MQTTClientDialog.TopicName.Label" ) );
- }
+ try {
+ previousFields = pipelineMeta.getPrevTransformFields(variables,
transformName);
+ } catch (HopTransformException e) {
+ new ErrorDialog(shell, BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "System.Dialog.Error.Title"), BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+
"MQTTClientDialog.ErrorDialog.UnableToGetInputFields.Message"), e);
+ }
- String current = m_wTopicName.getText();
- m_wTopicName.removeAll();
- if ( m_wTopicFromIncomingField.getSelection() ) {
- m_wTopicName.setItems( previousFields.getFieldNames() );
+ return previousFields;
}
- if ( !Utils.isEmpty( current ) ) {
- m_wTopicName.setText( current );
+ private void updateTopicCombo(IRowMeta previousFields) {
+ if (m_wTopicFromIncomingField.getSelection()) {
+
m_wlTopicName.setText(BaseMessages.getString(MQTTPublisherMeta.PKG,
"MQTTClientDialog.TopicNameFromField"));
+ } else {
+ m_wlTopicName.setText(BaseMessages
+ .getString(MQTTPublisherMeta.PKG,
+ "MQTTClientDialog.TopicName.Label"));
+ }
+
+ String current = m_wTopicName.getText();
+ m_wTopicName.removeAll();
+ if (m_wTopicFromIncomingField.getSelection()) {
+ m_wTopicName.setItems(previousFields.getFieldNames());
+ }
+
+ if (!Utils.isEmpty(current)) {
+ m_wTopicName.setText(current);
+ }
}
- }
- /**
- * Copy information from the meta-data input to the dialog fields.
- */
- private void getData( MQTTPublisherMeta producerMeta, boolean copyStepname )
{
- if ( copyStepname ) {
- wTransformName.setText( transformName );
+ /**
+ * Copy information from the meta-data input to the dialog fields.
+ */
+ private void getData(MQTTPublisherMeta producerMeta, boolean copyStepname)
{
+ if (copyStepname) {
+ wTransformName.setText(transformName);
+ }
+ m_wBroker.setText(Const.NVL(producerMeta.getBroker(), ""));
+ m_wTopicName.setText(Const.NVL(producerMeta.getTopic(), ""));
+
m_wTopicFromIncomingField.setSelection(producerMeta.getTopicIsFromField());
+ m_wInputField.setText(Const.NVL(producerMeta.getField(), ""));
+ m_wClientID.setText(Const.NVL(producerMeta.getClientId(), ""));
+ m_wTimeout.setText(Const.NVL(producerMeta.getTimeout(), "10000"));
+ m_wQOS.setText(Const.NVL(producerMeta.getQoS(), "0"));
+
+ m_wRequiresAuth.setSelection(producerMeta.isRequiresAuth());
+ m_wRequiresAuth.notifyListeners(SWT.Selection, new Event());
+
+ m_wUsername.setText(Const.NVL(producerMeta.getUsername(), ""));
+ m_wPassword.setText(Const.NVL(producerMeta.getPassword(), ""));
+
+ m_wCAFile.setText(Const.NVL(producerMeta.getSSLCaFile(), ""));
+ m_wCertFile.setText(Const.NVL(producerMeta.getSSLCertFile(), ""));
+ m_wKeyFile.setText(Const.NVL(producerMeta.getSSLKeyFile(), ""));
+ m_wKeyPassword.setText(Const.NVL(producerMeta.getSSLKeyFilePass(),
""));
+
+ updateTopicCombo(getPreviousFields());
+
+ wTransformName.selectAll();
}
- m_wBroker.setText( Const.NVL( producerMeta.getBroker(), "" ) );
- m_wTopicName.setText( Const.NVL( producerMeta.getTopic(), "" ) );
- m_wTopicFromIncomingField.setSelection( producerMeta.getTopicIsFromField()
);
- m_wInputField.setText( Const.NVL( producerMeta.getField(), "" ) );
- m_wClientID.setText( Const.NVL( producerMeta.getClientId(), "" ) );
- m_wTimeout.setText( Const.NVL( producerMeta.getTimeout(), "10000" ) );
- m_wQOS.setText( Const.NVL( producerMeta.getQoS(), "0" ) );
-
- m_wRequiresAuth.setSelection( producerMeta.isRequiresAuth() );
- m_wRequiresAuth.notifyListeners( SWT.Selection, new Event() );
-
- m_wUsername.setText( Const.NVL( producerMeta.getUsername(), "" ) );
- m_wPassword.setText( Const.NVL( producerMeta.getPassword(), "" ) );
-
- m_wCAFile.setText( Const.NVL( producerMeta.getSSLCaFile(), "" ) );
- m_wCertFile.setText( Const.NVL( producerMeta.getSSLCertFile(), "" ) );
- m_wKeyFile.setText( Const.NVL( producerMeta.getSSLKeyFile(), "" ) );
- m_wKeyPassword.setText( Const.NVL( producerMeta.getSSLKeyFilePass(), "" )
);
- updateTopicCombo( getPreviousFields() );
-
- wTransformName.selectAll();
- }
-
- private void cancel() {
- transformName = null;
- producerMeta.setChanged( changed );
- dispose();
- }
-
- /**
- * Copy information from the dialog fields to the meta-data input
- */
- private void setData( MQTTPublisherMeta producerMeta ) {
- producerMeta.setBroker( m_wBroker.getText() );
- producerMeta.setTopic( m_wTopicName.getText() );
- producerMeta.setTopicIsFromField( m_wTopicFromIncomingField.getSelection()
);
- producerMeta.setField( m_wInputField.getText() );
- producerMeta.setClientId( m_wClientID.getText() );
- producerMeta.setTimeout( m_wTimeout.getText() );
- producerMeta.setQoS( m_wQOS.getText() );
-
- boolean requiresAuth = m_wRequiresAuth.getSelection();
- producerMeta.setRequiresAuth( requiresAuth );
- if ( requiresAuth ) {
- producerMeta.setUsername( m_wUsername.getText() );
- producerMeta.setPassword( m_wPassword.getText() );
+ private void cancel() {
+ transformName = null;
+ producerMeta.setChanged(changed);
+ dispose();
}
- producerMeta.setSSLCaFile( m_wCAFile.getText() );
- producerMeta.setSSLCertFile( m_wCertFile.getText() );
- producerMeta.setSSLKeyFile( m_wKeyFile.getText() );
- producerMeta.setSSLKeyFilePass( m_wKeyPassword.getText() );
+ /**
+ * Copy information from the dialog fields to the meta-data input
+ */
+ private void setData(MQTTPublisherMeta producerMeta) {
+ producerMeta.setBroker(m_wBroker.getText());
+ producerMeta.setTopic(m_wTopicName.getText());
+
producerMeta.setTopicIsFromField(m_wTopicFromIncomingField.getSelection());
+ producerMeta.setField(m_wInputField.getText());
+ producerMeta.setClientId(m_wClientID.getText());
+ producerMeta.setTimeout(m_wTimeout.getText());
+ producerMeta.setQoS(m_wQOS.getText());
+
+ boolean requiresAuth = m_wRequiresAuth.getSelection();
+ producerMeta.setRequiresAuth(requiresAuth);
+ if (requiresAuth) {
+ producerMeta.setUsername(m_wUsername.getText());
+ producerMeta.setPassword(m_wPassword.getText());
+ }
+
+ producerMeta.setSSLCaFile(m_wCAFile.getText());
+ producerMeta.setSSLCertFile(m_wCertFile.getText());
+ producerMeta.setSSLKeyFile(m_wKeyFile.getText());
+ producerMeta.setSSLKeyFilePass(m_wKeyPassword.getText());
- producerMeta.setChanged();
- }
+ producerMeta.setChanged();
+ }
- private void ok() {
- if ( Utils.isEmpty( wTransformName.getText() ) ) {
- return;
+ private void ok() {
+ if (Utils.isEmpty(wTransformName.getText())) {
+ return;
+ }
+ setData(producerMeta);
+ transformName = wTransformName.getText();
+ dispose();
}
- setData( producerMeta );
- transformName = wTransformName.getText();
- dispose();
- }
}
diff --git
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherMeta.java
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherMeta.java
index 5f50333..fb55ba4 100644
---
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherMeta.java
+++
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/publisher/MQTTPublisherMeta.java
@@ -316,7 +316,8 @@ public class MQTTPublisherMeta
}
}
- public void loadXML(Node transformNode, IHopMetadataProvider
metadataProvider )
+ @Override
+ public void loadXml(Node transformNode, IHopMetadataProvider
metadataProvider )
throws HopXmlException {
try {
@@ -349,7 +350,8 @@ public class MQTTPublisherMeta
}
}
- public String getXML() throws HopException {
+ @Override
+ public String getXml() throws HopException {
StringBuilder retval = new StringBuilder();
if ( broker != null ) {
retval.append( " " ).append( XmlHandler.addTagValue( "BROKER", broker
) );
diff --git
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriber.java
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriber.java
index 0daec69..76a583c 100644
---
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriber.java
+++
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriber.java
@@ -75,7 +75,7 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
}
if ( m_reconnectFailed ) {
- logError( BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Error.ReconnectFailed" ) );
+ logError( BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.Error.ReconnectFailed" ) );
setStopped( true );
return false;
}
@@ -105,7 +105,7 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
data.client.close();
data.client = null;
} catch ( MqttException e ) {
- logError( BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.ErrorClosingMQTTClient.Message" ), e );
+ logError( BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.ErrorClosingMQTTClient.Message" ), e );
}
}
}
@@ -133,7 +133,7 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
ValueMetaFactory.getIdForValueMeta( meta.getMessageType() ) );
if ( messageMeta.isSerializableType() &&
!meta.getAllowReadMessageOfTypeObject() ) {
logError( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Error.MessageTypeObjectButObjectNotAllowed" ) );
+ .getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.Error.MessageTypeObjectButObjectNotAllowed" ) );
return false;
}
} catch ( HopPluginException e ) {
@@ -164,11 +164,11 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
String broker = resolve( meta.getBroker() );
if ( Utils.isEmpty( broker ) ) {
throw new HopException(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Error.NoBrokerURL" ) );
+ BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.Error.NoBrokerURL" ) );
}
String clientId = resolve( meta.getClientId() );
if ( Utils.isEmpty( clientId ) ) {
- throw new HopException( BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Error.NoClientID" ) );
+ throw new HopException( BaseMessages.getString(
MQTTSubscriberMeta.PKG, "MQTTClientStep.Error.NoClientID" ) );
}
List<String> topics = meta.getTopics();
if ( topics == null || topics.size() == 0 ) {
@@ -213,27 +213,29 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
connectOptions.setConnectionTimeout( Integer.parseInt( timeout ) );
} catch ( NumberFormatException e ) {
throw new HopException(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.WrongTimeoutValue.Message", timeout ), e );
+ BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.WrongTimeoutValue.Message", timeout ), e );
}
try {
connectOptions.setKeepAliveInterval( Integer.parseInt( keepAlive ) );
} catch ( NumberFormatException e ) {
throw new HopException(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.WrongKeepAliveValue.Message", keepAlive ),
+ BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.WrongKeepAliveValue.Message", keepAlive ),
e );
}
logBasic( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.CreateMQTTClient.Message", broker, clientId ) );
+ .getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.CreateMQTTClient.Message", broker, clientId ) );
data.client.setCallback( new SubscriberCallback( data, meta ) );
data.client.connect( connectOptions );
data.client.subscribe( resolvedTopics.toArray( new
String[resolvedTopics.size()] ), qoss );
+ logBasic( BaseMessages
+ .getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.SubscribedMQTTClient.Message", clientId, String.join(", ",
resolvedTopics) ) );
} catch ( Exception e ) {
throw new HopException(
- BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.ErrorCreateMQTTClient.Message", broker ),
+ BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.ErrorCreateMQTTClient.Message", broker ),
e );
}
}
@@ -258,8 +260,8 @@ public class MQTTSubscriber extends
BaseTransform<MQTTSubscriberMeta, MQTTSubscr
// connection retry logic here
shutdown( );
logBasic( BaseMessages
- .getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Log.LostConnectionToBroker", throwable.getMessage() ) );
- logBasic( BaseMessages.getString( MQTTPublisherMeta.PKG,
"MQTTClientStep.Log.AttemptingToReconnect" ) );
+ .getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.Log.LostConnectionToBroker", throwable.getMessage() ) );
+ logBasic( BaseMessages.getString( MQTTSubscriberMeta.PKG,
"MQTTClientStep.Log.AttemptingToReconnect" ) );
try {
configureConnection();
} catch ( HopException e ) {
diff --git
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriberMeta.java
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriberMeta.java
index 2470b19..df2d502 100644
---
a/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriberMeta.java
+++
b/plugins/transforms/mqtt/src/main/java/org/apache/hop/pipeline/transforms/mqtt/subscriber/MQTTSubscriberMeta.java
@@ -315,8 +315,9 @@ public class MQTTSubscriberMeta
public MQTTSubscriberData getTransformData() {
return new MQTTSubscriberData();
}
-
- public void loadXML(Node transformNode, IHopMetadataProvider
metadataProvider )
+
+ @Override
+ public void loadXml(Node transformNode, IHopMetadataProvider
metadataProvider )
throws HopXmlException {
broker = XmlHandler.getTagValue( transformNode, "BROKER" );
String topics = XmlHandler.getTagValue( transformNode, "TOPICS" );
@@ -359,7 +360,8 @@ public class MQTTSubscriberMeta
}
}
- public String getXML() throws HopException {
+ @Override
+ public String getXml() throws HopException {
StringBuilder retval = new StringBuilder();
if ( !Utils.isEmpty(broker) ) {
retval.append( " " ).append( XmlHandler.addTagValue( "BROKER",
broker) );
diff --git
a/plugins/transforms/mqtt/src/main/resources/org/apache/hop/pipeline/transforms/mqtt/subscriber/messages/messages_en_US.properties
b/plugins/transforms/mqtt/src/main/resources/org/apache/hop/pipeline/transforms/mqtt/subscriber/messages/messages_en_US.properties
index 35d7103..f444696 100644
---
a/plugins/transforms/mqtt/src/main/resources/org/apache/hop/pipeline/transforms/mqtt/subscriber/messages/messages_en_US.properties
+++
b/plugins/transforms/mqtt/src/main/resources/org/apache/hop/pipeline/transforms/mqtt/subscriber/messages/messages_en_US.properties
@@ -22,6 +22,7 @@ MQTTSubscriber.Step.Name=MQTT Subscriber
MQTTSubscriber.Step.Description=Subscribe to topics at an MQTT broker
MQTTClientStep.CreateMQTTClient.Message=Connecting to MQTT broker\: {0} as
client ''{1}''
+MQTTClientStep.SubscribedMQTTClient.Message=Client ''{0}'' successfully
subscribed to topics {1}
MQTTClientStep.WrongTimeoutValue.Message=Wrong connection timeout value\: {0}!
MQTTClientStep.WrongKeepAliveValue.Message=Wrong keep alive value\: {0}!
MQTTClientStep.WrongQOSValue.Message=Wrong QoS value\: {0}!