Skip to content

Commit e30153a

Browse files
committed
Add property name to ListenPort interface
1 parent 839205d commit e30153a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/main/java/org/apache/nifi/components/listen/ListenPort.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@
2323
public interface ListenPort {
2424

2525
/**
26-
* Get The operating system numbered port that is listening for network traffic.
26+
* Get the operating system numbered port that is listening for network traffic.
2727
*
2828
* @return the port number
2929
*/
3030
int getPortNumber();
3131

32+
/**
33+
* Get the name of the property that defines the listen port.
34+
*
35+
* @return the name of the port propert corresponding to this listen port, or null if it is not defined by a property
36+
*/
37+
String getPortPropertyName();
38+
3239
/**
3340
* Get the layer 4 transport protocol that is used at the OS networking level for this port.
3441
*

src/main/java/org/apache/nifi/components/listen/StandardListenPort.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
public class StandardListenPort implements ListenPort {
2323

2424
private final int portNumber;
25+
private final String portPropertyName;
2526
private final TransportProtocol transportProtocol;
2627
private final List<String> applicationProtocols;
2728

@@ -30,6 +31,7 @@ private StandardListenPort(final Builder builder) {
3031
Objects.requireNonNull(builder.applicationProtocols, "Application protocols is required. Use empty list if there are no application protocols.");
3132

3233
this.portNumber = builder.portNumber;
34+
this.portPropertyName = builder.portPropertyName;
3335
this.transportProtocol = builder.transportProtocol;
3436
this.applicationProtocols = builder.applicationProtocols;
3537
}
@@ -39,6 +41,11 @@ public int getPortNumber() {
3941
return portNumber;
4042
}
4143

44+
@Override
45+
public String getPortPropertyName() {
46+
return portPropertyName;
47+
}
48+
4249
@Override
4350
public TransportProtocol getTransportProtocol() {
4451
return transportProtocol;
@@ -76,6 +83,7 @@ public static Builder builder() {
7683

7784
public static final class Builder {
7885
private int portNumber;
86+
private String portPropertyName;
7987
private TransportProtocol transportProtocol;
8088
private List<String> applicationProtocols = Collections.emptyList();
8189

@@ -84,6 +92,11 @@ public Builder portNumber(final int portNumber) {
8492
return this;
8593
}
8694

95+
public Builder portPropertyName(final String portPropertyName) {
96+
this.portPropertyName = portPropertyName;
97+
return this;
98+
}
99+
87100
public Builder transportProtocol(final TransportProtocol transportProtocol) {
88101
this.transportProtocol = transportProtocol;
89102
return this;

0 commit comments

Comments
 (0)