From 9faaef8cfae703c5b3a77796620c03787767cc28 Mon Sep 17 00:00:00 2001 From: joewitt Date: Tue, 21 Apr 2015 02:15:46 -0400 Subject: [PATCH] NIFI-271 checkpoint push because there are so many changes. Long way to go but got through dto library --- nifi-parent/pom.xml | 19 +- .../apache/nifi/bootstrap/BootstrapCodec.java | 118 +- .../apache/nifi/bootstrap/NiFiListener.java | 196 +- .../org/apache/nifi/bootstrap/RunNiFi.java | 1613 +++++++++-------- .../apache/nifi/bootstrap/ShutdownHook.java | 120 +- .../exception/InvalidCommandException.java | 33 +- .../apache/nifi/util/FlowFilePackagerV1.java | 2 +- .../nifi/util/FlowFileUnpackagerV1.java | 2 +- .../nifi-hl7-query-language/pom.xml | 204 ++- .../src/checkstyle/suppressions.xml | 22 + .../org/apache/nifi/hl7/hapi/EmptyField.java | 16 +- .../org/apache/nifi/hl7/hapi/HapiField.java | 95 +- .../org/apache/nifi/hl7/hapi/HapiMessage.java | 115 +- .../org/apache/nifi/hl7/hapi/HapiSegment.java | 70 +- .../nifi/hl7/hapi/SingleValueField.java | 29 +- .../org/apache/nifi/hl7/io/HL7Reader.java | 4 +- .../hl7/io/exception/InvalidHL7Exception.java | 29 +- .../apache/nifi/hl7/model/HL7Component.java | 6 +- .../org/apache/nifi/hl7/model/HL7Field.java | 1 - .../org/apache/nifi/hl7/model/HL7Message.java | 8 +- .../org/apache/nifi/hl7/model/HL7Segment.java | 8 +- .../apache/nifi/hl7/query/Declaration.java | 12 +- .../org/apache/nifi/hl7/query/HL7Query.java | 622 +++---- .../apache/nifi/hl7/query/QueryResult.java | 15 +- .../org/apache/nifi/hl7/query/ResultHit.java | 7 +- .../org/apache/nifi/hl7/query/Selection.java | 31 +- .../hl7/query/evaluator/BooleanEvaluator.java | 6 +- .../nifi/hl7/query/evaluator/Evaluator.java | 11 +- .../hl7/query/evaluator/IntegerEvaluator.java | 7 +- .../hl7/query/evaluator/StringEvaluator.java | 8 +- .../AbstractComparisonEvaluator.java | 159 +- .../comparison/AbstractNumericComparison.java | 85 +- .../evaluator/comparison/EqualsEvaluator.java | 16 +- .../comparison/GreaterThanEvaluator.java | 16 +- .../GreaterThanOrEqualEvaluator.java | 16 +- .../evaluator/comparison/IsNullEvaluator.java | 83 +- .../comparison/LessThanEvaluator.java | 15 +- .../comparison/LessThanOrEqualEvaluator.java | 15 +- .../comparison/NotEqualsEvaluator.java | 16 +- .../evaluator/comparison/NotEvaluator.java | 23 +- .../comparison/NotNullEvaluator.java | 75 +- .../literal/IntegerLiteralEvaluator.java | 22 +- .../literal/StringLiteralEvaluator.java | 21 +- .../query/evaluator/logic/AndEvaluator.java | 37 +- .../query/evaluator/logic/OrEvaluator.java | 37 +- .../message/DeclaredReferenceEvaluator.java | 31 +- .../query/evaluator/message/DotEvaluator.java | 111 +- .../evaluator/message/FieldEvaluator.java | 69 +- .../evaluator/message/MessageEvaluator.java | 12 +- .../evaluator/message/SegmentEvaluator.java | 39 +- .../exception/HL7QueryParsingException.java | 33 +- .../nifi/hl7/query/result/MissedResult.java | 55 +- .../hl7/query/result/StandardQueryResult.java | 75 +- .../hl7/query/result/StandardResultHit.java | 29 +- .../apache/nifi/hl7/query/TestHL7Query.java | 500 +++-- .../org/apache/nifi/util/NiFiProperties.java | 14 +- .../nifi/security/util/CertificateUtils.java | 21 +- .../security/util/SecurityStoreTypes.java | 8 +- .../nifi/security/util/SslContextFactory.java | 36 +- .../flowfile/attributes/CoreAttributes.java | 27 +- .../attributes/FlowFileAttributeKey.java | 1 + .../apache/nifi/remote/VersionNegotiator.java | 10 +- .../remote/io/CompressionInputStream.java | 5 +- .../remote/io/CompressionOutputStream.java | 2 +- .../remote/io/socket/BufferStateManager.java | 2 +- .../io/socket/SocketChannelInputStream.java | 9 +- .../io/socket/SocketChannelOutputStream.java | 3 +- .../io/socket/ssl/SSLSocketChannel.java | 4 +- .../ssl/SSLSocketChannelInputStream.java | 2 +- .../nifi/stream/io/ByteArrayOutputStream.java | 6 +- .../stream/io/ByteCountingOutputStream.java | 2 - .../stream/io/LeakyBucketStreamThrottler.java | 8 +- .../nifi/stream/io/LimitingInputStream.java | 2 +- .../stream/io/MinimumLengthInputStream.java | 125 +- .../apache/nifi/stream/io/StreamUtils.java | 52 +- .../io/util/NonThreadSafeCircularBuffer.java | 2 +- .../org/apache/nifi/util/EscapeUtils.java | 15 +- .../org/apache/nifi/util/FormatUtils.java | 16 +- .../nifi/util/NaiveSearchRingBuffer.java | 14 +- .../org/apache/nifi/util/ObjectHolder.java | 1 - .../java/org/apache/nifi/util/RingBuffer.java | 19 +- .../java/org/apache/nifi/util/StopWatch.java | 8 +- .../main/java/org/apache/nifi/util/Tuple.java | 6 - .../concurrency/DebugDisabledTimedLock.java | 11 +- .../concurrency/DebugEnabledTimedLock.java | 16 +- .../org/apache/nifi/util/file/FileUtils.java | 57 +- .../file/monitor/SynchronousFileWatcher.java | 4 +- .../org/apache/nifi/util/search/Search.java | 6 +- .../apache/nifi/util/search/SearchTerm.java | 14 +- .../monitor/TestCompoundUpdateMonitor.java | 1 - .../monitor/TestSynchronousFileWatcher.java | 1 - .../nifi/util/timebuffer/TestRingBuffer.java | 6 +- .../org/apache/nifi/web/util/ClientUtils.java | 38 +- nifi/nifi-docs/pom.xml | 9 + .../nifi/web/api/dto/BulletinBoardDTO.java | 8 +- .../apache/nifi/web/api/dto/BulletinDTO.java | 38 +- .../nifi/web/api/dto/BulletinQueryDTO.java | 24 +- .../apache/nifi/web/api/dto/ClusterDTO.java | 8 +- .../nifi/web/api/dto/ComponentHistoryDTO.java | 8 +- .../nifi/web/api/dto/ConnectableDTO.java | 36 +- .../nifi/web/api/dto/ConnectionDTO.java | 24 +- .../api/dto/ControllerConfigurationDTO.java | 44 +- .../nifi/web/api/dto/ControllerDTO.java | 56 +- .../web/api/dto/ControllerServiceDTO.java | 68 +- ...trollerServiceReferencingComponentDTO.java | 69 +- .../apache/nifi/web/api/dto/CounterDTO.java | 16 +- .../apache/nifi/web/api/dto/CountersDTO.java | 8 +- .../nifi/web/api/dto/DocumentedTypeDTO.java | 12 +- .../nifi/web/api/dto/FlowSnippetDTO.java | 37 +- .../org/apache/nifi/web/api/dto/LabelDTO.java | 12 +- .../nifi/web/api/dto/NiFiComponentDTO.java | 5 +- .../org/apache/nifi/web/api/dto/NodeDTO.java | 40 +- .../apache/nifi/web/api/dto/NodeEventDTO.java | 12 +- .../web/api/dto/NodeSystemDiagnosticsDTO.java | 8 +- .../org/apache/nifi/web/api/dto/PortDTO.java | 34 +- .../apache/nifi/web/api/dto/PositionDTO.java | 8 +- .../nifi/web/api/dto/PreviousValueDTO.java | 12 +- .../nifi/web/api/dto/ProcessGroupDTO.java | 46 +- .../nifi/web/api/dto/ProcessorConfigDTO.java | 59 +- .../apache/nifi/web/api/dto/ProcessorDTO.java | 22 +- .../web/api/dto/PropertyDescriptorDTO.java | 63 +- .../nifi/web/api/dto/PropertyHistoryDTO.java | 4 +- .../nifi/web/api/dto/RelationshipDTO.java | 12 +- .../dto/RemoteProcessGroupContentsDTO.java | 8 +- .../web/api/dto/RemoteProcessGroupDTO.java | 70 +- .../api/dto/RemoteProcessGroupPortDTO.java | 42 +- .../nifi/web/api/dto/ReportingTaskDTO.java | 262 ++- .../apache/nifi/web/api/dto/RevisionDTO.java | 5 +- .../apache/nifi/web/api/dto/SnippetDTO.java | 68 +- .../web/api/dto/SystemDiagnosticsDTO.java | 116 +- .../apache/nifi/web/api/dto/TemplateDTO.java | 24 +- .../org/apache/nifi/web/api/dto/UserDTO.java | 42 +- .../apache/nifi/web/api/dto/UserGroupDTO.java | 16 +- .../nifi/web/api/dto/action/ActionDTO.java | 40 +- .../nifi/web/api/dto/action/HistoryDTO.java | 12 +- .../web/api/dto/action/HistoryQueryDTO.java | 32 +- .../details/ExtensionDetailsDTO.java | 4 +- .../details/RemoteProcessGroupDetailsDTO.java | 4 +- .../action/details/ConfigureDetailsDTO.java | 12 +- .../dto/action/details/ConnectDetailsDTO.java | 28 +- .../dto/action/details/MoveDetailsDTO.java | 16 +- .../dto/action/details/PurgeDetailsDTO.java | 4 +- .../web/api/dto/provenance/AttributeDTO.java | 12 +- .../web/api/dto/provenance/ProvenanceDTO.java | 36 +- .../dto/provenance/ProvenanceEventDTO.java | 186 +- .../dto/provenance/ProvenanceOptionsDTO.java | 4 +- .../dto/provenance/ProvenanceRequestDTO.java | 24 +- .../dto/provenance/ProvenanceResultsDTO.java | 28 +- .../ProvenanceSearchableFieldDTO.java | 16 +- .../dto/provenance/lineage/LineageDTO.java | 36 +- .../provenance/lineage/LineageRequestDTO.java | 12 +- .../provenance/lineage/LineageResultsDTO.java | 12 +- .../provenance/lineage/ProvenanceLinkDTO.java | 20 +- .../provenance/lineage/ProvenanceNodeDTO.java | 36 +- .../dto/search/ComponentSearchResultDTO.java | 16 +- .../api/dto/search/NodeSearchResultDTO.java | 8 +- .../web/api/dto/search/SearchResultsDTO.java | 28 +- .../dto/search/UserGroupSearchResultDTO.java | 4 +- .../api/dto/search/UserSearchResultDTO.java | 8 +- .../status/ClusterConnectionStatusDTO.java | 14 +- .../api/dto/status/ClusterPortStatusDTO.java | 14 +- .../dto/status/ClusterProcessorStatusDTO.java | 20 +- .../ClusterRemoteProcessGroupStatusDTO.java | 14 +- .../web/api/dto/status/ClusterStatusDTO.java | 4 +- .../dto/status/ClusterStatusHistoryDTO.java | 12 +- .../api/dto/status/ConnectionStatusDTO.java | 42 +- .../api/dto/status/ControllerStatusDTO.java | 42 +- .../dto/status/NodeConnectionStatusDTO.java | 8 +- .../web/api/dto/status/NodePortStatusDTO.java | 8 +- .../dto/status/NodeProcessorStatusDTO.java | 8 +- .../NodeRemoteProcessGroupStatusDTO.java | 8 +- .../web/api/dto/status/NodeStatusDTO.java | 8 +- .../api/dto/status/NodeStatusHistoryDTO.java | 8 +- .../web/api/dto/status/PortStatusDTO.java | 36 +- .../api/dto/status/ProcessGroupStatusDTO.java | 8 +- .../api/dto/status/ProcessorStatusDTO.java | 46 +- .../api/dto/status/RemotePortStatusDTO.java | 20 +- .../status/RemoteProcessGroupStatusDTO.java | 38 +- .../nifi/web/api/dto/status/StatusDTO.java | 4 +- .../api/dto/status/StatusDescriptorDTO.java | 16 +- .../web/api/dto/status/StatusHistoryDTO.java | 16 +- .../dto/status/StatusHistoryDetailDTO.java | 8 +- .../web/api/dto/status/StatusSnapshotDTO.java | 8 +- .../nifi/web/api/entity/AuthorityEntity.java | 8 +- .../entity/ClusterSearchResultsEntity.java | 4 +- .../nifi/web/api/entity/ConnectionEntity.java | 4 +- .../web/api/entity/ConnectionsEntity.java | 4 +- .../api/entity/ControllerServiceEntity.java | 6 +- ...lerServiceReferencingComponentsEntity.java | 5 +- .../entity/ControllerServiceTypesEntity.java | 4 +- .../api/entity/ControllerServicesEntity.java | 4 +- .../nifi/web/api/entity/CounterEntity.java | 4 +- .../nifi/web/api/entity/CountersEntity.java | 6 +- .../apache/nifi/web/api/entity/Entity.java | 4 +- .../nifi/web/api/entity/FunnelsEntity.java | 4 +- .../nifi/web/api/entity/InputPortEntity.java | 4 +- .../nifi/web/api/entity/InputPortsEntity.java | 4 +- .../nifi/web/api/entity/LabelsEntity.java | 4 +- .../nifi/web/api/entity/OutputPortEntity.java | 4 +- .../web/api/entity/OutputPortsEntity.java | 4 +- .../api/entity/PrioritizerTypesEntity.java | 4 +- .../web/api/entity/ProcessorTypesEntity.java | 4 +- .../nifi/web/api/entity/ProcessorsEntity.java | 4 +- .../api/entity/PropertyDescriptorEntity.java | 1 - .../nifi/web/api/entity/ProvenanceEntity.java | 4 +- .../api/entity/RemoteProcessGroupsEntity.java | 4 +- .../web/api/entity/ReportingTaskEntity.java | 6 +- .../api/entity/ReportingTaskTypesEntity.java | 4 +- .../web/api/entity/ReportingTasksEntity.java | 4 +- .../web/api/entity/SearchResultsEntity.java | 4 +- .../nifi/web/api/entity/TemplatesEntity.java | 4 +- .../api/entity/UserSearchResultsEntity.java | 8 +- .../nifi/web/api/entity/UsersEntity.java | 4 +- .../util/SslContextCreationException.java | 1 + .../security/util/SslContextFactory.java | 39 +- .../framework/security/util/SslException.java | 1 + .../security/util/SslServerSocketFactory.java | 19 +- ...lServerSocketFactoryCreationException.java | 4 +- .../security/util/SslSocketFactory.java | 17 +- .../SslSocketFactoryCreationException.java | 1 + .../security/util/SslContextFactoryTest.java | 18 +- .../nifi-framework/nifi-site-to-site/pom.xml | 4 +- .../util/RemoteProcessGroupUtils.java | 120 +- .../nifi/remote/RemoteResourceFactory.java | 114 +- .../nifi/remote/RemoteResourceManager.java | 98 +- .../nifi/remote/RemoteSiteListener.java | 2 +- .../nifi/remote/SocketRemoteSiteListener.java | 232 +-- .../nifi/remote/StandardRemoteGroupPort.java | 200 +- .../nifi/remote/StandardRootGroupPort.java | 243 +-- .../exception/UnsupportedCodecException.java | 5 +- .../socket/ClusterManagerServerProtocol.java | 50 +- .../socket/SocketFlowFileServerProtocol.java | 254 +-- .../TestStandardSiteToSiteProtocol.java | 28 +- .../io/socket/TestSocketChannelStreams.java | 62 +- .../io/socket/ssl/TestSSLSocketChannel.java | 114 +- .../org/apache/nifi/web/ContentAccess.java | 6 +- .../nifi/web/ContentRequestContext.java | 24 +- .../apache/nifi/web/DownloadableContent.java | 12 +- .../cache/protocol/ProtocolHandshake.java | 37 +- .../exception/HandshakeException.java | 3 +- .../nifi/update/attributes/Criteria.java | 24 +- .../attributes/serde/CriteriaSerDe.java | 8 +- 242 files changed, 4434 insertions(+), 5534 deletions(-) create mode 100644 nifi/nifi-commons/nifi-hl7-query-language/src/checkstyle/suppressions.xml diff --git a/nifi-parent/pom.xml b/nifi-parent/pom.xml index fc1a19d104..ba9f7ae348 100644 --- a/nifi-parent/pom.xml +++ b/nifi-parent/pom.xml @@ -198,6 +198,13 @@ org.apache.maven.plugins maven-checkstyle-plugin 2.15 + + + com.puppycrawl.tools + checkstyle + 6.5 + + @@ -310,7 +317,6 @@ - @@ -325,15 +331,8 @@ warning true - **/HelpMojo.java + **/HelpMojo.java,**/generated-sources - - - com.puppycrawl.tools - checkstyle - 6.3 - - check-style @@ -379,7 +378,7 @@ org.apache.nifi nifi-nar-maven-plugin - 1.0.0-incubating + 1.0.1-incubating-SNAPSHOT true diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java index f03bf1edcd..381787512d 100644 --- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java +++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/BootstrapCodec.java @@ -27,66 +27,66 @@ import java.util.Arrays; import org.apache.nifi.bootstrap.exception.InvalidCommandException; - public class BootstrapCodec { - private final RunNiFi runner; - private final BufferedReader reader; - private final BufferedWriter writer; - - public BootstrapCodec(final RunNiFi runner, final InputStream in, final OutputStream out) { - this.runner = runner; - this.reader = new BufferedReader(new InputStreamReader(in)); - this.writer = new BufferedWriter(new OutputStreamWriter(out)); - } - - public void communicate() throws IOException { - final String line = reader.readLine(); - final String[] splits = line.split(" "); - if ( splits.length < 0 ) { - throw new IOException("Received invalid command from NiFi: " + line); - } - - final String cmd = splits[0]; - final String[] args; - if ( splits.length == 1 ) { - args = new String[0]; - } else { - args = Arrays.copyOfRange(splits, 1, splits.length); - } - - try { - processRequest(cmd, args); - } catch (final InvalidCommandException ice) { - throw new IOException("Received invalid command from NiFi: " + line + " : " + ice.getMessage() == null ? "" : "Details: " + ice.toString()); - } - } - private void processRequest(final String cmd, final String[] args) throws InvalidCommandException, IOException { - switch (cmd) { - case "PORT": { - if ( args.length != 2 ) { - throw new InvalidCommandException(); - } - - final int port; - try { - port = Integer.parseInt( args[0] ); - } catch (final NumberFormatException nfe) { - throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535"); - } - - if ( port < 1 || port > 65535 ) { - throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535"); - } + private final RunNiFi runner; + private final BufferedReader reader; + private final BufferedWriter writer; - final String secretKey = args[1]; - - runner.setNiFiCommandControlPort(port, secretKey); - writer.write("OK"); - writer.newLine(); - writer.flush(); - } - break; - } - } + public BootstrapCodec(final RunNiFi runner, final InputStream in, final OutputStream out) { + this.runner = runner; + this.reader = new BufferedReader(new InputStreamReader(in)); + this.writer = new BufferedWriter(new OutputStreamWriter(out)); + } + + public void communicate() throws IOException { + final String line = reader.readLine(); + final String[] splits = line.split(" "); + if (splits.length < 0) { + throw new IOException("Received invalid command from NiFi: " + line); + } + + final String cmd = splits[0]; + final String[] args; + if (splits.length == 1) { + args = new String[0]; + } else { + args = Arrays.copyOfRange(splits, 1, splits.length); + } + + try { + processRequest(cmd, args); + } catch (final InvalidCommandException ice) { + throw new IOException("Received invalid command from NiFi: " + line + " : " + ice.getMessage() == null ? "" : "Details: " + ice.toString()); + } + } + + private void processRequest(final String cmd, final String[] args) throws InvalidCommandException, IOException { + switch (cmd) { + case "PORT": { + if (args.length != 2) { + throw new InvalidCommandException(); + } + + final int port; + try { + port = Integer.parseInt(args[0]); + } catch (final NumberFormatException nfe) { + throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535"); + } + + if (port < 1 || port > 65535) { + throw new InvalidCommandException("Invalid Port number; should be integer between 1 and 65535"); + } + + final String secretKey = args[1]; + + runner.setNiFiCommandControlPort(port, secretKey); + writer.write("OK"); + writer.newLine(); + writer.flush(); + } + break; + } + } } diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java index f05d45a395..171347880e 100644 --- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java +++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/NiFiListener.java @@ -28,101 +28,103 @@ import java.util.concurrent.TimeUnit; import org.apache.nifi.bootstrap.util.LimitingInputStream; public class NiFiListener { - private ServerSocket serverSocket; - private volatile Listener listener; - - int start(final RunNiFi runner) throws IOException { - serverSocket = new ServerSocket(); - serverSocket.bind(new InetSocketAddress("localhost", 0)); - - final int localPort = serverSocket.getLocalPort(); - listener = new Listener(serverSocket, runner); - final Thread listenThread = new Thread(listener); - listenThread.setName("Listen to NiFi"); - listenThread.start(); - return localPort; - } - - public void stop() throws IOException { - final Listener listener = this.listener; - if ( listener == null ) { - return; - } - - listener.stop(); - } - - private class Listener implements Runnable { - private final ServerSocket serverSocket; - private final ExecutorService executor; - private final RunNiFi runner; - private volatile boolean stopped = false; - - public Listener(final ServerSocket serverSocket, final RunNiFi runner) { - this.serverSocket = serverSocket; - this.executor = Executors.newFixedThreadPool(2); - this.runner = runner; - } - - public void stop() throws IOException { - stopped = true; - - executor.shutdown(); - try { - executor.awaitTermination(3, TimeUnit.SECONDS); - } catch (final InterruptedException ie) { - } - - serverSocket.close(); - } - - @Override - public void run() { - while (!serverSocket.isClosed()) { - try { - if ( stopped ) { - return; - } - - final Socket socket; - try { - socket = serverSocket.accept(); - } catch (final IOException ioe) { - if ( stopped ) { - return; - } - - throw ioe; - } - - executor.submit(new Runnable() { - @Override - public void run() { - try { - // we want to ensure that we don't try to read data from an InputStream directly - // by a BufferedReader because any user on the system could open a socket and send - // a multi-gigabyte file without any new lines in order to crash the Bootstrap, - // which in turn may cause the Shutdown Hook to shutdown NiFi. - // So we will limit the amount of data to read to 4 KB - final InputStream limitingIn = new LimitingInputStream(socket.getInputStream(), 4096); - final BootstrapCodec codec = new BootstrapCodec(runner, limitingIn, socket.getOutputStream()); - codec.communicate(); - } catch (final Throwable t) { - System.out.println("Failed to communicate with NiFi due to " + t); - t.printStackTrace(); - } finally { - try { - socket.close(); - } catch (final IOException ioe) { - } - } - } - }); - } catch (final Throwable t) { - System.err.println("Failed to receive information from NiFi due to " + t); - t.printStackTrace(); - } - } - } - } + + private ServerSocket serverSocket; + private volatile Listener listener; + + int start(final RunNiFi runner) throws IOException { + serverSocket = new ServerSocket(); + serverSocket.bind(new InetSocketAddress("localhost", 0)); + + final int localPort = serverSocket.getLocalPort(); + listener = new Listener(serverSocket, runner); + final Thread listenThread = new Thread(listener); + listenThread.setName("Listen to NiFi"); + listenThread.start(); + return localPort; + } + + public void stop() throws IOException { + final Listener listener = this.listener; + if (listener == null) { + return; + } + + listener.stop(); + } + + private class Listener implements Runnable { + + private final ServerSocket serverSocket; + private final ExecutorService executor; + private final RunNiFi runner; + private volatile boolean stopped = false; + + public Listener(final ServerSocket serverSocket, final RunNiFi runner) { + this.serverSocket = serverSocket; + this.executor = Executors.newFixedThreadPool(2); + this.runner = runner; + } + + public void stop() throws IOException { + stopped = true; + + executor.shutdown(); + try { + executor.awaitTermination(3, TimeUnit.SECONDS); + } catch (final InterruptedException ie) { + } + + serverSocket.close(); + } + + @Override + public void run() { + while (!serverSocket.isClosed()) { + try { + if (stopped) { + return; + } + + final Socket socket; + try { + socket = serverSocket.accept(); + } catch (final IOException ioe) { + if (stopped) { + return; + } + + throw ioe; + } + + executor.submit(new Runnable() { + @Override + public void run() { + try { + // we want to ensure that we don't try to read data from an InputStream directly + // by a BufferedReader because any user on the system could open a socket and send + // a multi-gigabyte file without any new lines in order to crash the Bootstrap, + // which in turn may cause the Shutdown Hook to shutdown NiFi. + // So we will limit the amount of data to read to 4 KB + final InputStream limitingIn = new LimitingInputStream(socket.getInputStream(), 4096); + final BootstrapCodec codec = new BootstrapCodec(runner, limitingIn, socket.getOutputStream()); + codec.communicate(); + } catch (final Throwable t) { + System.out.println("Failed to communicate with NiFi due to " + t); + t.printStackTrace(); + } finally { + try { + socket.close(); + } catch (final IOException ioe) { + } + } + } + }); + } catch (final Throwable t) { + System.err.println("Failed to receive information from NiFi due to " + t); + t.printStackTrace(); + } + } + } + } } diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index 28a9b71028..d3796b5c9f 100644 --- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -49,218 +49,223 @@ import java.util.logging.ConsoleHandler; import java.util.logging.Handler; import java.util.logging.Level; - /** - * Bootstrap class to run Apache NiFi. - * - * This class looks for the bootstrap.conf file by looking in the following places (in order): + * + *

+ * The class which bootstraps Apache NiFi. This class looks for the + * bootstrap.conf file by looking in the following places (in order):

*
    - *
  1. Java System Property named {@code org.apache.nifi.bootstrap.config.file}
  2. - *
  3. ${NIFI_HOME}/./conf/bootstrap.conf, where ${NIFI_HOME} references an environment variable {@code NIFI_HOME}
  4. - *
  5. ./conf/bootstrap.conf, where {@code .} represents the working directory. + *
  6. Java System Property named + * {@code org.apache.nifi.bootstrap.config.file}
  7. + *
  8. ${NIFI_HOME}/./conf/bootstrap.conf, where ${NIFI_HOME} references an + * environment variable {@code NIFI_HOME}
  9. + *
  10. ./conf/bootstrap.conf, where {@code ./} represents the working + * directory.
  11. *
* - * If the {@code bootstrap.conf} file cannot be found, throws a {@code FileNotFoundException]. + * If the {@code bootstrap.conf} file cannot be found, throws a {@code FileNotFoundException}. */ public class RunNiFi { - public static final String DEFAULT_CONFIG_FILE = "./conf/bootstrap.conf"; - public static final String DEFAULT_NIFI_PROPS_FILE = "./conf/nifi.properties"; - public static final String DEFAULT_JAVA_CMD = "java"; - public static final String GRACEFUL_SHUTDOWN_PROP = "graceful.shutdown.seconds"; - public static final String DEFAULT_GRACEFUL_SHUTDOWN_VALUE = "20"; - - public static final String RUN_AS_PROP = "run.as"; - - public static final int MAX_RESTART_ATTEMPTS = 5; - public static final int STARTUP_WAIT_SECONDS = 60; - - public static final String SHUTDOWN_CMD = "SHUTDOWN"; - public static final String PING_CMD = "PING"; - public static final String DUMP_CMD = "DUMP"; - - private volatile boolean autoRestartNiFi = true; - private volatile int ccPort = -1; - private volatile long nifiPid = -1L; - private volatile String secretKey; - private volatile ShutdownHook shutdownHook; - - private final Lock lock = new ReentrantLock(); - private final Condition startupCondition = lock.newCondition(); - - private final File bootstrapConfigFile; + public static final String DEFAULT_CONFIG_FILE = "./conf/bootstrap.conf"; + public static final String DEFAULT_NIFI_PROPS_FILE = "./conf/nifi.properties"; + public static final String DEFAULT_JAVA_CMD = "java"; - private final java.util.logging.Logger logger; - - public RunNiFi(final File bootstrapConfigFile, final boolean verbose) { - this.bootstrapConfigFile = bootstrapConfigFile; - logger = java.util.logging.Logger.getLogger("Bootstrap"); - if ( verbose ) { - logger.info("Enabling Verbose Output"); - - logger.setLevel(Level.FINE); - final Handler handler = new ConsoleHandler(); - handler.setLevel(Level.FINE); - logger.addHandler(handler); - } - } - - private static void printUsage() { - System.out.println("Usage:"); - System.out.println(); - System.out.println("java org.apache.nifi.bootstrap.RunNiFi [<-verbose>] [options]"); - System.out.println(); - System.out.println("Valid commands include:"); - System.out.println(""); - System.out.println("Start : Start a new instance of Apache NiFi"); - System.out.println("Stop : Stop a running instance of Apache NiFi"); - System.out.println("Restart : Stop Apache NiFi, if it is running, and then start a new instance"); - System.out.println("Status : Determine if there is a running instance of Apache NiFi"); - System.out.println("Dump : Write a Thread Dump to the file specified by [options], or to the log if no file is given"); - System.out.println("Run : Start a new instance of Apache NiFi and monitor the Process, restarting if the instance dies"); - System.out.println(); - } + public static final String GRACEFUL_SHUTDOWN_PROP = "graceful.shutdown.seconds"; + public static final String DEFAULT_GRACEFUL_SHUTDOWN_VALUE = "20"; - private static String[] shift(final String[] orig) { - return Arrays.copyOfRange(orig, 1, orig.length); - } - - public static void main(String[] args) throws IOException, InterruptedException { - if ( args.length < 1 || args.length > 3 ) { - printUsage(); - return; - } - - File dumpFile = null; - boolean verbose = false; - if ( args[0].equals("-verbose") ) { - verbose = true; - args = shift(args); - } - - final String cmd = args[0]; - if (cmd.equals("dump") ) { - if ( args.length > 1 ) { - dumpFile = new File(args[1]); - } else { - dumpFile = null; - } - } - - switch (cmd.toLowerCase()) { - case "start": - case "run": - case "stop": - case "status": - case "dump": - case "restart": - break; - default: - printUsage(); - return; - } - - String configFilename = System.getProperty("org.apache.nifi.bootstrap.config.file"); - - if ( configFilename == null ) { - final String nifiHome = System.getenv("NIFI_HOME"); - if ( nifiHome != null ) { - final File nifiHomeFile = new File(nifiHome.trim()); - final File configFile = new File(nifiHomeFile, DEFAULT_CONFIG_FILE); - configFilename = configFile.getAbsolutePath(); - } - } - - if ( configFilename == null ) { - configFilename = DEFAULT_CONFIG_FILE; - } - - final File configFile = new File(configFilename); - - final RunNiFi runNiFi = new RunNiFi(configFile, verbose); - - switch (cmd.toLowerCase()) { - case "start": - runNiFi.start(false); - break; - case "run": - runNiFi.start(true); - break; - case "stop": - runNiFi.stop(); - break; - case "status": - runNiFi.status(); - break; - case "restart": - runNiFi.stop(); - runNiFi.start(false); - break; - case "dump": - runNiFi.dump(dumpFile); - break; - } - } - - - public File getStatusFile() { - final File confDir = bootstrapConfigFile.getParentFile(); - final File nifiHome = confDir.getParentFile(); - final File bin = new File(nifiHome, "bin"); - final File statusFile = new File(bin, "nifi.pid"); - - logger.fine("Status File: " + statusFile); - - return statusFile; - } - - private Properties loadProperties() throws IOException { - final Properties props = new Properties(); - final File statusFile = getStatusFile(); - if ( statusFile == null || !statusFile.exists() ) { - logger.fine("No status file to load properties from"); - return props; - } - - try (final FileInputStream fis = new FileInputStream(getStatusFile())) { - props.load(fis); - } - - logger.fine("Properties: " + props); - return props; - } - - private synchronized void saveProperties(final Properties nifiProps) throws IOException { - final File statusFile = getStatusFile(); - if ( statusFile.exists() && !statusFile.delete() ) { - logger.warning("Failed to delete " + statusFile); - } + public static final String RUN_AS_PROP = "run.as"; - if ( !statusFile.createNewFile() ) { - throw new IOException("Failed to create file " + statusFile); - } + public static final int MAX_RESTART_ATTEMPTS = 5; + public static final int STARTUP_WAIT_SECONDS = 60; + + public static final String SHUTDOWN_CMD = "SHUTDOWN"; + public static final String PING_CMD = "PING"; + public static final String DUMP_CMD = "DUMP"; + + private volatile boolean autoRestartNiFi = true; + private volatile int ccPort = -1; + private volatile long nifiPid = -1L; + private volatile String secretKey; + private volatile ShutdownHook shutdownHook; + + private final Lock lock = new ReentrantLock(); + private final Condition startupCondition = lock.newCondition(); + + private final File bootstrapConfigFile; + + private final java.util.logging.Logger logger; + + public RunNiFi(final File bootstrapConfigFile, final boolean verbose) { + this.bootstrapConfigFile = bootstrapConfigFile; + logger = java.util.logging.Logger.getLogger("Bootstrap"); + if (verbose) { + logger.info("Enabling Verbose Output"); + + logger.setLevel(Level.FINE); + final Handler handler = new ConsoleHandler(); + handler.setLevel(Level.FINE); + logger.addHandler(handler); + } + } + + private static void printUsage() { + System.out.println("Usage:"); + System.out.println(); + System.out.println("java org.apache.nifi.bootstrap.RunNiFi [<-verbose>] [options]"); + System.out.println(); + System.out.println("Valid commands include:"); + System.out.println(""); + System.out.println("Start : Start a new instance of Apache NiFi"); + System.out.println("Stop : Stop a running instance of Apache NiFi"); + System.out.println("Restart : Stop Apache NiFi, if it is running, and then start a new instance"); + System.out.println("Status : Determine if there is a running instance of Apache NiFi"); + System.out.println("Dump : Write a Thread Dump to the file specified by [options], or to the log if no file is given"); + System.out.println("Run : Start a new instance of Apache NiFi and monitor the Process, restarting if the instance dies"); + System.out.println(); + } + + private static String[] shift(final String[] orig) { + return Arrays.copyOfRange(orig, 1, orig.length); + } + + public static void main(String[] args) throws IOException, InterruptedException { + if (args.length < 1 || args.length > 3) { + printUsage(); + return; + } + + File dumpFile = null; + boolean verbose = false; + if (args[0].equals("-verbose")) { + verbose = true; + args = shift(args); + } + + final String cmd = args[0]; + if (cmd.equals("dump")) { + if (args.length > 1) { + dumpFile = new File(args[1]); + } else { + dumpFile = null; + } + } + + switch (cmd.toLowerCase()) { + case "start": + case "run": + case "stop": + case "status": + case "dump": + case "restart": + break; + default: + printUsage(); + return; + } + + String configFilename = System.getProperty("org.apache.nifi.bootstrap.config.file"); + + if (configFilename == null) { + final String nifiHome = System.getenv("NIFI_HOME"); + if (nifiHome != null) { + final File nifiHomeFile = new File(nifiHome.trim()); + final File configFile = new File(nifiHomeFile, DEFAULT_CONFIG_FILE); + configFilename = configFile.getAbsolutePath(); + } + } + + if (configFilename == null) { + configFilename = DEFAULT_CONFIG_FILE; + } + + final File configFile = new File(configFilename); + + final RunNiFi runNiFi = new RunNiFi(configFile, verbose); + + switch (cmd.toLowerCase()) { + case "start": + runNiFi.start(false); + break; + case "run": + runNiFi.start(true); + break; + case "stop": + runNiFi.stop(); + break; + case "status": + runNiFi.status(); + break; + case "restart": + runNiFi.stop(); + runNiFi.start(false); + break; + case "dump": + runNiFi.dump(dumpFile); + break; + } + } + + public File getStatusFile() { + final File confDir = bootstrapConfigFile.getParentFile(); + final File nifiHome = confDir.getParentFile(); + final File bin = new File(nifiHome, "bin"); + final File statusFile = new File(bin, "nifi.pid"); + + logger.log(Level.FINE, "Status File: {0}", statusFile); + + return statusFile; + } + + private Properties loadProperties() throws IOException { + final Properties props = new Properties(); + final File statusFile = getStatusFile(); + if (statusFile == null || !statusFile.exists()) { + logger.fine("No status file to load properties from"); + return props; + } + + try (final FileInputStream fis = new FileInputStream(getStatusFile())) { + props.load(fis); + } + + logger.log(Level.FINE, "Properties: {0}", props); + return props; + } + + private synchronized void saveProperties(final Properties nifiProps) throws IOException { + final File statusFile = getStatusFile(); + if (statusFile.exists() && !statusFile.delete()) { + logger.log(Level.WARNING, "Failed to delete {0}", statusFile); + } + + if (!statusFile.createNewFile()) { + throw new IOException("Failed to create file " + statusFile); + } + + try { + final Set perms = new HashSet<>(); + perms.add(PosixFilePermission.OWNER_READ); + perms.add(PosixFilePermission.OWNER_WRITE); + Files.setPosixFilePermissions(statusFile.toPath(), perms); + } catch (final Exception e) { + logger.log(Level.WARNING, "Failed to set permissions so that only the owner can read status file {0}; " + + "this may allows others to have access to the key needed to communicate with NiFi. " + + "Permissions should be changed so that only the owner can read this file", statusFile); + } - try { - final Set perms = new HashSet<>(); - perms.add(PosixFilePermission.OWNER_READ); - perms.add(PosixFilePermission.OWNER_WRITE); - Files.setPosixFilePermissions(statusFile.toPath(), perms); - } catch (final Exception e) { - logger.warning("Failed to set permissions so that only the owner can read status file " + statusFile + "; this may allows others to have access to the key needed to communicate with NiFi. Permissions should be changed so that only the owner can read this file"); - } - try (final FileOutputStream fos = new FileOutputStream(statusFile)) { nifiProps.store(fos, null); fos.getFD().sync(); } - - logger.fine("Saved Properties " + nifiProps + " to " + statusFile); - } - private boolean isPingSuccessful(final int port, final String secretKey) { - logger.fine("Pinging " + port); - - try (final Socket socket = new Socket("localhost", port)) { + logger.log(Level.FINE, "Saved Properties {0} to {1}", new Object[]{nifiProps, statusFile}); + } + + private boolean isPingSuccessful(final int port, final String secretKey) { + logger.log(Level.FINE, "Pinging {0}", port); + + try (final Socket socket = new Socket("localhost", port)) { final OutputStream out = socket.getOutputStream(); out.write((PING_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); out.flush(); @@ -270,106 +275,104 @@ public class RunNiFi { final InputStream in = socket.getInputStream(); final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); final String response = reader.readLine(); - logger.fine("PING response: " + response); - - return PING_CMD.equals(response); - } catch (final IOException ioe) { - return false; - } - } - - private Integer getCurrentPort() throws IOException { - final Properties props = loadProperties(); - final String portVal = props.getProperty("port"); - if ( portVal == null ) { - logger.fine("No Port found in status file"); - return null; - } else { - logger.fine("Port defined in status file: " + portVal); - } - - final int port = Integer.parseInt(portVal); - final boolean success = isPingSuccessful(port, props.getProperty("secret.key")); - if ( success ) { - logger.fine("Successful PING on port " + port); - return port; - } + logger.log(Level.FINE, "PING response: {0}", response); - final String pid = props.getProperty("pid"); - logger.fine("PID in status file is " + pid); - if ( pid != null ) { - final boolean procRunning = isProcessRunning(pid); - if ( procRunning ) { - return port; - } else { - return null; - } - } - - return null; - } - - - private boolean isProcessRunning(final String pid) { - try { - // We use the "ps" command to check if the process is still running. - final ProcessBuilder builder = new ProcessBuilder(); - - builder.command("ps", "-p", pid); - final Process proc = builder.start(); - - // Look for the pid in the output of the 'ps' command. - boolean running = false; - String line; - try (final InputStream in = proc.getInputStream(); - final Reader streamReader = new InputStreamReader(in); - final BufferedReader reader = new BufferedReader(streamReader)) { - - while ((line = reader.readLine()) != null) { - if ( line.trim().startsWith(pid) ) { + return PING_CMD.equals(response); + } catch (final IOException ioe) { + return false; + } + } + + private Integer getCurrentPort() throws IOException { + final Properties props = loadProperties(); + final String portVal = props.getProperty("port"); + if (portVal == null) { + logger.fine("No Port found in status file"); + return null; + } else { + logger.log(Level.FINE, "Port defined in status file: {0}", portVal); + } + + final int port = Integer.parseInt(portVal); + final boolean success = isPingSuccessful(port, props.getProperty("secret.key")); + if (success) { + logger.log(Level.FINE, "Successful PING on port {0}", port); + return port; + } + + final String pid = props.getProperty("pid"); + logger.log(Level.FINE, "PID in status file is {0}", pid); + if (pid != null) { + final boolean procRunning = isProcessRunning(pid); + if (procRunning) { + return port; + } else { + return null; + } + } + + return null; + } + + private boolean isProcessRunning(final String pid) { + try { + // We use the "ps" command to check if the process is still running. + final ProcessBuilder builder = new ProcessBuilder(); + + builder.command("ps", "-p", pid); + final Process proc = builder.start(); + + // Look for the pid in the output of the 'ps' command. + boolean running = false; + String line; + try (final InputStream in = proc.getInputStream(); + final Reader streamReader = new InputStreamReader(in); + final BufferedReader reader = new BufferedReader(streamReader)) { + + while ((line = reader.readLine()) != null) { + if (line.trim().startsWith(pid)) { running = true; } - } - } - - // If output of the ps command had our PID, the process is running. - if ( running ) { - logger.fine("Process with PID " + pid + " is running"); - } else { - logger.fine("Process with PID " + pid + " is not running"); - } - - return running; - } catch (final IOException ioe) { - System.err.println("Failed to determine if Process " + pid + " is running; assuming that it is not"); - return false; - } - } - - - private Status getStatus() { - final Properties props; - try { - props = loadProperties(); - } catch (final IOException ioe) { - return new Status(null, null, false, false); - } - - if ( props == null ) { - return new Status(null, null, false, false); - } - + } + } + + // If output of the ps command had our PID, the process is running. + if (running) { + logger.log(Level.FINE, "Process with PID {0} is running", pid); + } else { + logger.log(Level.FINE, "Process with PID {0} is not running", pid); + } + + return running; + } catch (final IOException ioe) { + System.err.println("Failed to determine if Process " + pid + " is running; assuming that it is not"); + return false; + } + } + + private Status getStatus() { + final Properties props; + try { + props = loadProperties(); + } catch (final IOException ioe) { + return new Status(null, null, false, false); + } + + if (props == null) { + return new Status(null, null, false, false); + } + final String portValue = props.getProperty("port"); final String pid = props.getProperty("pid"); final String secretKey = props.getProperty("secret.key"); - - if ( portValue == null && pid == null ) { + + if (portValue == null && pid == null) { return new Status(null, null, false, false); } - + Integer port = null; boolean pingSuccess = false; - if ( portValue != null ) { + if (portValue != null) { try { port = Integer.parseInt(portValue); pingSuccess = isPingSuccessful(port, secretKey); @@ -377,577 +380,577 @@ public class RunNiFi { return new Status(null, null, false, false); } } - - if ( pingSuccess ) { + + if (pingSuccess) { return new Status(port, pid, true, true); } - + final boolean alive = (pid == null) ? false : isProcessRunning(pid); return new Status(port, pid, pingSuccess, alive); - } - - public void status() throws IOException { - final Status status = getStatus(); - if ( status.isRespondingToPing() ) { - logger.info("Apache NiFi is currently running, listening to Bootstrap on port " + status.getPort() + - ", PID=" + (status.getPid() == null ? "unknkown" : status.getPid())); - return; - } + } - if ( status.isProcessRunning() ) { - logger.info("Apache NiFi is running at PID " + status.getPid() + " but is not responding to ping requests"); - return; - } - - if ( status.getPort() == null ) { - logger.info("Apache NiFi is not running"); - return; - } - - if ( status.getPid() == null ) { - logger.info("Apache NiFi is not responding to Ping requests. The process may have died or may be hung"); - } else { - logger.info("Apache NiFi is not running"); - } - } - - - /** - * Writes a NiFi thread dump to the given file; if file is null, logs at INFO level instead. - * @param dumpFile - * @return - * @throws IOException - */ - public void dump(final File dumpFile) throws IOException { - final Integer port = getCurrentPort(); - if ( port == null ) { + public void status() throws IOException { + final Status status = getStatus(); + if (status.isRespondingToPing()) { + logger.log(Level.INFO, "Apache NiFi is currently running, listening to Bootstrap on port {0}, PID={1}", + new Object[]{status.getPort(), status.getPid() == null ? "unknkown" : status.getPid()}); + return; + } + + if (status.isProcessRunning()) { + logger.log(Level.INFO, "Apache NiFi is running at PID {0} but is not responding to ping requests", status.getPid()); + return; + } + + if (status.getPort() == null) { + logger.info("Apache NiFi is not running"); + return; + } + + if (status.getPid() == null) { + logger.info("Apache NiFi is not responding to Ping requests. The process may have died or may be hung"); + } else { + logger.info("Apache NiFi is not running"); + } + } + + /** + * Writes a NiFi thread dump to the given file; if file is null, logs at + * INFO level instead. + * + * @param dumpFile the file to write the dump content to + * @throws IOException if any issues occur while writing the dump file + */ + public void dump(final File dumpFile) throws IOException { + final Integer port = getCurrentPort(); + if (port == null) { System.out.println("Apache NiFi is not currently running"); } - + final Properties nifiProps = loadProperties(); final String secretKey = nifiProps.getProperty("secret.key"); final StringBuilder sb = new StringBuilder(); - try (final Socket socket = new Socket()) { + try (final Socket socket = new Socket()) { logger.fine("Connecting to NiFi instance"); socket.setSoTimeout(60000); socket.connect(new InetSocketAddress("localhost", port)); logger.fine("Established connection to NiFi instance."); socket.setSoTimeout(60000); - - logger.fine("Sending DUMP Command to port " + port); + + logger.log(Level.FINE, "Sending DUMP Command to port {0}", port); final OutputStream out = socket.getOutputStream(); out.write((DUMP_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); out.flush(); - + final InputStream in = socket.getInputStream(); final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; - while ((line = reader.readLine()) != null ) { + while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } } - - final String dump = sb.toString(); - if ( dumpFile == null ) { - logger.info(dump); - } else { - try (final FileOutputStream fos = new FileOutputStream(dumpFile)) { - fos.write(dump.getBytes(StandardCharsets.UTF_8)); - } - logger.info("Successfully wrote thread dump to " + dumpFile.getAbsolutePath()); - } - } - - public void stop() throws IOException { - final Integer port = getCurrentPort(); - if ( port == null ) { - System.out.println("Apache NiFi is not currently running"); - return; - } - - final Properties nifiProps = loadProperties(); - final String secretKey = nifiProps.getProperty("secret.key"); - - try (final Socket socket = new Socket()) { - logger.fine("Connecting to NiFi instance"); - socket.setSoTimeout(60000); - socket.connect(new InetSocketAddress("localhost", port)); - logger.fine("Established connection to NiFi instance."); - socket.setSoTimeout(60000); - - logger.fine("Sending SHUTDOWN Command to port " + port); - final OutputStream out = socket.getOutputStream(); - out.write((SHUTDOWN_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); - out.flush(); - - final InputStream in = socket.getInputStream(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - final String response = reader.readLine(); - - logger.fine("Received response to SHUTDOWN command: " + response); - - if ( SHUTDOWN_CMD.equals(response) ) { - logger.info("Apache NiFi has accepted the Shutdown Command and is shutting down now"); - - final String pid = nifiProps.getProperty("pid"); - if ( pid != null ) { - final Properties bootstrapProperties = new Properties(); - try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) { - bootstrapProperties.load(fis); - } - String gracefulShutdown = bootstrapProperties.getProperty(GRACEFUL_SHUTDOWN_PROP, DEFAULT_GRACEFUL_SHUTDOWN_VALUE); - int gracefulShutdownSeconds; - try { - gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown); - } catch (final NumberFormatException nfe) { - gracefulShutdownSeconds = Integer.parseInt(DEFAULT_GRACEFUL_SHUTDOWN_VALUE); - } - - final long startWait = System.nanoTime(); - while ( isProcessRunning(pid) ) { - logger.info("Waiting for Apache NiFi to finish shutting down..."); - final long waitNanos = System.nanoTime() - startWait; - final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); - if ( waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0 ) { - if ( isProcessRunning(pid) ) { - logger.warning("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process."); - try { - killProcessTree(pid); - } catch (final IOException ioe) { - logger.severe("Failed to kill Process with PID " + pid); - } - } - break; - } else { - try { - Thread.sleep(2000L); - } catch (final InterruptedException ie) {} - } - } - - logger.info("NiFi has finished shutting down."); - } - - final File statusFile = getStatusFile(); - if ( !statusFile.delete() ) { - logger.severe("Failed to delete status file " + statusFile + "; this file should be cleaned up manually"); - } - } else { - logger.severe("When sending SHUTDOWN command to NiFi, got unexpected response " + response); - } - } catch (final IOException ioe) { - logger.severe("Failed to send shutdown command to port " + port + " due to " + ioe); - return; - } - } - - - private static List getChildProcesses(final String ppid) throws IOException { - final Process proc = Runtime.getRuntime().exec(new String[] {"ps", "-o", "pid", "--no-headers", "--ppid", ppid}); - final List childPids = new ArrayList<>(); - try (final InputStream in = proc.getInputStream(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { - - String line; - while ((line = reader.readLine()) != null) { - childPids.add(line.trim()); - } - } - - return childPids; - } - - private void killProcessTree(final String pid) throws IOException { - logger.fine("Killing Process Tree for PID " + pid); - - final List children = getChildProcesses(pid); - logger.fine("Children of PID " + pid + ": " + children); - - for ( final String childPid : children ) { - killProcessTree(childPid); - } - - Runtime.getRuntime().exec(new String[] {"kill", "-9", pid}); - } - - public static boolean isAlive(final Process process) { - try { - process.exitValue(); - return false; - } catch (final IllegalStateException | IllegalThreadStateException itse) { - return true; - } - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void start(final boolean monitor) throws IOException, InterruptedException { - final Integer port = getCurrentPort(); - if ( port != null ) { - System.out.println("Apache NiFi is already running, listening to Bootstrap on port " + port); - return; - } - - final ProcessBuilder builder = new ProcessBuilder(); + final String dump = sb.toString(); + if (dumpFile == null) { + logger.info(dump); + } else { + try (final FileOutputStream fos = new FileOutputStream(dumpFile)) { + fos.write(dump.getBytes(StandardCharsets.UTF_8)); + } + logger.log(Level.INFO, "Successfully wrote thread dump to {0}", dumpFile.getAbsolutePath()); + } + } - if ( !bootstrapConfigFile.exists() ) { - throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath()); - } - - final Properties properties = new Properties(); - try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) { - properties.load(fis); - } - - final Map props = new HashMap<>(); - props.putAll( (Map) properties ); + public void stop() throws IOException { + final Integer port = getCurrentPort(); + if (port == null) { + System.out.println("Apache NiFi is not currently running"); + return; + } - final String specifiedWorkingDir = props.get("working.dir"); - if ( specifiedWorkingDir != null ) { - builder.directory(new File(specifiedWorkingDir)); - } + final Properties nifiProps = loadProperties(); + final String secretKey = nifiProps.getProperty("secret.key"); - final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile(); - final File binDir = bootstrapConfigAbsoluteFile.getParentFile(); - final File workingDir = binDir.getParentFile(); - - if ( specifiedWorkingDir == null ) { - builder.directory(workingDir); - } - - final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim(); - File libDir = getFile(libFilename, workingDir); - - final String confFilename = replaceNull(props.get("conf.dir"), "./conf").trim(); - File confDir = getFile(confFilename, workingDir); - - String nifiPropsFilename = props.get("props.file"); - if ( nifiPropsFilename == null ) { - if ( confDir.exists() ) { - nifiPropsFilename = new File(confDir, "nifi.properties").getAbsolutePath(); - } else { - nifiPropsFilename = DEFAULT_CONFIG_FILE; - } - } - - nifiPropsFilename = nifiPropsFilename.trim(); - - final List javaAdditionalArgs = new ArrayList<>(); - for ( final Map.Entry entry : props.entrySet() ) { - final String key = entry.getKey(); - final String value = entry.getValue(); - - if ( key.startsWith("java.arg") ) { - javaAdditionalArgs.add(value); - } - } - - final File[] libFiles = libDir.listFiles(new FilenameFilter() { - @Override - public boolean accept(final File dir, final String filename) { - return filename.toLowerCase().endsWith(".jar"); - } - }); - - if ( libFiles == null || libFiles.length == 0 ) { - throw new RuntimeException("Could not find lib directory at " + libDir.getAbsolutePath()); - } - - final File[] confFiles = confDir.listFiles(); - if ( confFiles == null || confFiles.length == 0 ) { - throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath()); - } + try (final Socket socket = new Socket()) { + logger.fine("Connecting to NiFi instance"); + socket.setSoTimeout(60000); + socket.connect(new InetSocketAddress("localhost", port)); + logger.fine("Established connection to NiFi instance."); + socket.setSoTimeout(60000); - final List cpFiles = new ArrayList<>(confFiles.length + libFiles.length); - cpFiles.add(confDir.getAbsolutePath()); - for ( final File file : libFiles ) { - cpFiles.add(file.getAbsolutePath()); - } - - final StringBuilder classPathBuilder = new StringBuilder(); - for (int i=0; i < cpFiles.size(); i++) { - final String filename = cpFiles.get(i); - classPathBuilder.append(filename); - if ( i < cpFiles.size() - 1 ) { - classPathBuilder.append(File.pathSeparatorChar); - } - } + logger.log(Level.FINE, "Sending SHUTDOWN Command to port {0}", port); + final OutputStream out = socket.getOutputStream(); + out.write((SHUTDOWN_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); + out.flush(); - final String classPath = classPathBuilder.toString(); - String javaCmd = props.get("java"); - if (javaCmd == null) { - javaCmd = DEFAULT_JAVA_CMD; - } - if (javaCmd.equals(DEFAULT_JAVA_CMD)) { - String javaHome = System.getenv("JAVA_HOME"); - if (javaHome != null) { - String fileExtension = isWindows() ? ".exe" : ""; - File javaFile = new File(javaHome + File.separatorChar + "bin" - + File.separatorChar + "java" + fileExtension); - if (javaFile.exists() && javaFile.canExecute()) { - javaCmd = javaFile.getAbsolutePath(); - } - } - } - - final NiFiListener listener = new NiFiListener(); - final int listenPort = listener.start(this); - - String runAs = isWindows() ? null : props.get(RUN_AS_PROP); - if ( runAs != null ) { - runAs = runAs.trim(); - if ( runAs.isEmpty() ) { - runAs = null; - } - } - - final List cmd = new ArrayList<>(); - if ( runAs != null ) { - cmd.add("sudo"); - cmd.add("-u"); - cmd.add(runAs); - } - cmd.add(javaCmd); - cmd.add("-classpath"); - cmd.add(classPath); - cmd.addAll(javaAdditionalArgs); - cmd.add("-Dnifi.properties.file.path=" + nifiPropsFilename); - cmd.add("-Dnifi.bootstrap.listen.port=" + listenPort); - cmd.add("-Dapp=NiFi"); - cmd.add("org.apache.nifi.NiFi"); - - builder.command(cmd); - - final StringBuilder cmdBuilder = new StringBuilder(); - for ( final String s : cmd ) { - cmdBuilder.append(s).append(" "); - } + final InputStream in = socket.getInputStream(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + final String response = reader.readLine(); - logger.info("Starting Apache NiFi..."); - logger.info("Working Directory: " + workingDir.getAbsolutePath()); - logger.info("Command: " + cmdBuilder.toString()); - - if ( monitor ) { - String gracefulShutdown = props.get(GRACEFUL_SHUTDOWN_PROP); - if ( gracefulShutdown == null ) { - gracefulShutdown = DEFAULT_GRACEFUL_SHUTDOWN_VALUE; - } + logger.log(Level.FINE, "Received response to SHUTDOWN command: {0}", response); - final int gracefulShutdownSeconds; - try { - gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown); - } catch (final NumberFormatException nfe) { - throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); - } - - if ( gracefulShutdownSeconds < 0 ) { - throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); - } - - Process process = builder.start(); - Long pid = getPid(process); - if ( pid != null ) { + if (SHUTDOWN_CMD.equals(response)) { + logger.info("Apache NiFi has accepted the Shutdown Command and is shutting down now"); + + final String pid = nifiProps.getProperty("pid"); + if (pid != null) { + final Properties bootstrapProperties = new Properties(); + try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) { + bootstrapProperties.load(fis); + } + + String gracefulShutdown = bootstrapProperties.getProperty(GRACEFUL_SHUTDOWN_PROP, DEFAULT_GRACEFUL_SHUTDOWN_VALUE); + int gracefulShutdownSeconds; + try { + gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown); + } catch (final NumberFormatException nfe) { + gracefulShutdownSeconds = Integer.parseInt(DEFAULT_GRACEFUL_SHUTDOWN_VALUE); + } + + final long startWait = System.nanoTime(); + while (isProcessRunning(pid)) { + logger.info("Waiting for Apache NiFi to finish shutting down..."); + final long waitNanos = System.nanoTime() - startWait; + final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); + if (waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0) { + if (isProcessRunning(pid)) { + logger.log(Level.WARNING, "NiFi has not finished shutting down after {0} seconds. Killing process.", gracefulShutdownSeconds); + try { + killProcessTree(pid); + } catch (final IOException ioe) { + logger.log(Level.SEVERE, "Failed to kill Process with PID {0}", pid); + } + } + break; + } else { + try { + Thread.sleep(2000L); + } catch (final InterruptedException ie) { + } + } + } + + logger.info("NiFi has finished shutting down."); + } + + final File statusFile = getStatusFile(); + if (!statusFile.delete()) { + logger.log(Level.SEVERE, "Failed to delete status file {0}; this file should be cleaned up manually", statusFile); + } + } else { + logger.log(Level.SEVERE, "When sending SHUTDOWN command to NiFi, got unexpected response {0}", response); + } + } catch (final IOException ioe) { + logger.log(Level.SEVERE, "Failed to send shutdown command to port {0} due to {1}", new Object[]{port, ioe}); + } + } + + private static List getChildProcesses(final String ppid) throws IOException { + final Process proc = Runtime.getRuntime().exec(new String[]{"ps", "-o", "pid", "--no-headers", "--ppid", ppid}); + final List childPids = new ArrayList<>(); + try (final InputStream in = proc.getInputStream(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { + + String line; + while ((line = reader.readLine()) != null) { + childPids.add(line.trim()); + } + } + + return childPids; + } + + private void killProcessTree(final String pid) throws IOException { + logger.log(Level.FINE, "Killing Process Tree for PID {0}", pid); + + final List children = getChildProcesses(pid); + logger.log(Level.FINE, "Children of PID {0}: {1}", new Object[]{pid, children}); + + for (final String childPid : children) { + killProcessTree(childPid); + } + + Runtime.getRuntime().exec(new String[]{"kill", "-9", pid}); + } + + public static boolean isAlive(final Process process) { + try { + process.exitValue(); + return false; + } catch (final IllegalStateException | IllegalThreadStateException itse) { + return true; + } + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + public void start(final boolean monitor) throws IOException, InterruptedException { + final Integer port = getCurrentPort(); + if (port != null) { + System.out.println("Apache NiFi is already running, listening to Bootstrap on port " + port); + return; + } + + final ProcessBuilder builder = new ProcessBuilder(); + + if (!bootstrapConfigFile.exists()) { + throw new FileNotFoundException(bootstrapConfigFile.getAbsolutePath()); + } + + final Properties properties = new Properties(); + try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) { + properties.load(fis); + } + + final Map props = new HashMap<>(); + props.putAll((Map) properties); + + final String specifiedWorkingDir = props.get("working.dir"); + if (specifiedWorkingDir != null) { + builder.directory(new File(specifiedWorkingDir)); + } + + final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile(); + final File binDir = bootstrapConfigAbsoluteFile.getParentFile(); + final File workingDir = binDir.getParentFile(); + + if (specifiedWorkingDir == null) { + builder.directory(workingDir); + } + + final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim(); + File libDir = getFile(libFilename, workingDir); + + final String confFilename = replaceNull(props.get("conf.dir"), "./conf").trim(); + File confDir = getFile(confFilename, workingDir); + + String nifiPropsFilename = props.get("props.file"); + if (nifiPropsFilename == null) { + if (confDir.exists()) { + nifiPropsFilename = new File(confDir, "nifi.properties").getAbsolutePath(); + } else { + nifiPropsFilename = DEFAULT_CONFIG_FILE; + } + } + + nifiPropsFilename = nifiPropsFilename.trim(); + + final List javaAdditionalArgs = new ArrayList<>(); + for (final Map.Entry entry : props.entrySet()) { + final String key = entry.getKey(); + final String value = entry.getValue(); + + if (key.startsWith("java.arg")) { + javaAdditionalArgs.add(value); + } + } + + final File[] libFiles = libDir.listFiles(new FilenameFilter() { + @Override + public boolean accept(final File dir, final String filename) { + return filename.toLowerCase().endsWith(".jar"); + } + }); + + if (libFiles == null || libFiles.length == 0) { + throw new RuntimeException("Could not find lib directory at " + libDir.getAbsolutePath()); + } + + final File[] confFiles = confDir.listFiles(); + if (confFiles == null || confFiles.length == 0) { + throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath()); + } + + final List cpFiles = new ArrayList<>(confFiles.length + libFiles.length); + cpFiles.add(confDir.getAbsolutePath()); + for (final File file : libFiles) { + cpFiles.add(file.getAbsolutePath()); + } + + final StringBuilder classPathBuilder = new StringBuilder(); + for (int i = 0; i < cpFiles.size(); i++) { + final String filename = cpFiles.get(i); + classPathBuilder.append(filename); + if (i < cpFiles.size() - 1) { + classPathBuilder.append(File.pathSeparatorChar); + } + } + + final String classPath = classPathBuilder.toString(); + String javaCmd = props.get("java"); + if (javaCmd == null) { + javaCmd = DEFAULT_JAVA_CMD; + } + if (javaCmd.equals(DEFAULT_JAVA_CMD)) { + String javaHome = System.getenv("JAVA_HOME"); + if (javaHome != null) { + String fileExtension = isWindows() ? ".exe" : ""; + File javaFile = new File(javaHome + File.separatorChar + "bin" + + File.separatorChar + "java" + fileExtension); + if (javaFile.exists() && javaFile.canExecute()) { + javaCmd = javaFile.getAbsolutePath(); + } + } + } + + final NiFiListener listener = new NiFiListener(); + final int listenPort = listener.start(this); + + String runAs = isWindows() ? null : props.get(RUN_AS_PROP); + if (runAs != null) { + runAs = runAs.trim(); + if (runAs.isEmpty()) { + runAs = null; + } + } + + final List cmd = new ArrayList<>(); + if (runAs != null) { + cmd.add("sudo"); + cmd.add("-u"); + cmd.add(runAs); + } + cmd.add(javaCmd); + cmd.add("-classpath"); + cmd.add(classPath); + cmd.addAll(javaAdditionalArgs); + cmd.add("-Dnifi.properties.file.path=" + nifiPropsFilename); + cmd.add("-Dnifi.bootstrap.listen.port=" + listenPort); + cmd.add("-Dapp=NiFi"); + cmd.add("org.apache.nifi.NiFi"); + + builder.command(cmd); + + final StringBuilder cmdBuilder = new StringBuilder(); + for (final String s : cmd) { + cmdBuilder.append(s).append(" "); + } + + logger.info("Starting Apache NiFi..."); + logger.log(Level.INFO, "Working Directory: {0}", workingDir.getAbsolutePath()); + logger.log(Level.INFO, "Command: {0}", cmdBuilder.toString()); + + if (monitor) { + String gracefulShutdown = props.get(GRACEFUL_SHUTDOWN_PROP); + if (gracefulShutdown == null) { + gracefulShutdown = DEFAULT_GRACEFUL_SHUTDOWN_VALUE; + } + + final int gracefulShutdownSeconds; + try { + gracefulShutdownSeconds = Integer.parseInt(gracefulShutdown); + } catch (final NumberFormatException nfe) { + throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); + } + + if (gracefulShutdownSeconds < 0) { + throw new NumberFormatException("The '" + GRACEFUL_SHUTDOWN_PROP + "' property in Bootstrap Config File " + + bootstrapConfigAbsoluteFile.getAbsolutePath() + " has an invalid value. Must be a non-negative integer"); + } + + Process process = builder.start(); + Long pid = getPid(process); + if (pid != null) { nifiPid = pid; final Properties nifiProps = new Properties(); nifiProps.setProperty("pid", String.valueOf(nifiPid)); saveProperties(nifiProps); } - - shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds); - final Runtime runtime = Runtime.getRuntime(); - runtime.addShutdownHook(shutdownHook); - - while (true) { - final boolean alive = isAlive(process); - - if ( alive ) { - try { - Thread.sleep(1000L); - } catch (final InterruptedException ie) { - } - } else { - try { - runtime.removeShutdownHook(shutdownHook); - } catch (final IllegalStateException ise) { - // happens when already shutting down - } - - if (autoRestartNiFi) { - logger.warning("Apache NiFi appears to have died. Restarting..."); - process = builder.start(); - - pid = getPid(process); - if ( pid != null ) { - nifiPid = pid; - final Properties nifiProps = new Properties(); - nifiProps.setProperty("pid", String.valueOf(nifiPid)); - saveProperties(nifiProps); - } - - shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds); - runtime.addShutdownHook(shutdownHook); - - final boolean started = waitForStart(); - - if ( started ) { - logger.info("Successfully started Apache NiFi" + (pid == null ? "" : " with PID " + pid)); - } else { - logger.severe("Apache NiFi does not appear to have started"); - } - } else { - return; - } - } - } - } else { - final Process process = builder.start(); - final Long pid = getPid(process); - - if ( pid != null ) { - nifiPid = pid; + + shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds); + final Runtime runtime = Runtime.getRuntime(); + runtime.addShutdownHook(shutdownHook); + + while (true) { + final boolean alive = isAlive(process); + + if (alive) { + try { + Thread.sleep(1000L); + } catch (final InterruptedException ie) { + } + } else { + try { + runtime.removeShutdownHook(shutdownHook); + } catch (final IllegalStateException ise) { + // happens when already shutting down + } + + if (autoRestartNiFi) { + logger.warning("Apache NiFi appears to have died. Restarting..."); + process = builder.start(); + + pid = getPid(process); + if (pid != null) { + nifiPid = pid; + final Properties nifiProps = new Properties(); + nifiProps.setProperty("pid", String.valueOf(nifiPid)); + saveProperties(nifiProps); + } + + shutdownHook = new ShutdownHook(process, this, secretKey, gracefulShutdownSeconds); + runtime.addShutdownHook(shutdownHook); + + final boolean started = waitForStart(); + + if (started) { + logger.log(Level.INFO, "Successfully started Apache NiFi{0}", (pid == null ? "" : " with PID " + pid)); + } else { + logger.severe("Apache NiFi does not appear to have started"); + } + } else { + return; + } + } + } + } else { + final Process process = builder.start(); + final Long pid = getPid(process); + + if (pid != null) { + nifiPid = pid; final Properties nifiProps = new Properties(); nifiProps.setProperty("pid", String.valueOf(nifiPid)); saveProperties(nifiProps); - } - - boolean started = waitForStart(); - - if ( started ) { - logger.info("Successfully started Apache NiFi" + (pid == null ? "" : " with PID " + pid)); - } else { - logger.severe("Apache NiFi does not appear to have started"); - } - - listener.stop(); - } - } - - - private Long getPid(final Process process) { - try { + } + + boolean started = waitForStart(); + + if (started) { + logger.log(Level.INFO, "Successfully started Apache NiFi{0}", (pid == null ? "" : " with PID " + pid)); + } else { + logger.severe("Apache NiFi does not appear to have started"); + } + + listener.stop(); + } + } + + private Long getPid(final Process process) { + try { final Class procClass = process.getClass(); final Field pidField = procClass.getDeclaredField("pid"); pidField.setAccessible(true); final Object pidObject = pidField.get(process); - - logger.fine("PID Object = " + pidObject); - - if ( pidObject instanceof Number ) { + + logger.log(Level.FINE, "PID Object = {0}", pidObject); + + if (pidObject instanceof Number) { return ((Number) pidObject).longValue(); } return null; } catch (final IllegalAccessException | NoSuchFieldException nsfe) { - logger.fine("Could not find PID for child process due to " + nsfe); + logger.log(Level.FINE, "Could not find PID for child process due to {0}", nsfe); return null; } - } - - private boolean isWindows() { - final String osName = System.getProperty("os.name"); - return osName != null && osName.toLowerCase().contains("win"); - } - - private boolean waitForStart() { - lock.lock(); - try { - final long startTime = System.nanoTime(); - - while ( ccPort < 1 ) { - try { - startupCondition.await(1, TimeUnit.SECONDS); - } catch (final InterruptedException ie) { - return false; - } - - final long waitNanos = System.nanoTime() - startTime; - final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); - if (waitSeconds > STARTUP_WAIT_SECONDS) { - return false; - } - } - } finally { - lock.unlock(); - } - return true; - } - - private File getFile(final String filename, final File workingDir) { - File file = new File(filename); - if ( !file.isAbsolute() ) { - file = new File(workingDir, filename); - } - - return file; - } - - private String replaceNull(final String value, final String replacement) { - return (value == null) ? replacement : value; - } - - void setAutoRestartNiFi(final boolean restart) { - this.autoRestartNiFi = restart; - } - - void setNiFiCommandControlPort(final int port, final String secretKey) { - this.ccPort = port; - this.secretKey = secretKey; - - if ( shutdownHook != null ) { - shutdownHook.setSecretKey(secretKey); - } - - final File statusFile = getStatusFile(); - - final Properties nifiProps = new Properties(); - if ( nifiPid != -1 ) { - nifiProps.setProperty("pid", String.valueOf(nifiPid)); - } - nifiProps.setProperty("port", String.valueOf(ccPort)); - nifiProps.setProperty("secret.key", secretKey); - - try { - saveProperties(nifiProps); - } catch (final IOException ioe) { - logger.warning("Apache NiFi has started but failed to persist NiFi Port information to " + statusFile.getAbsolutePath() + " due to " + ioe); - } - - logger.info("Apache NiFi now running and listening for Bootstrap requests on port " + port); - } - - int getNiFiCommandControlPort() { - return this.ccPort; - } - - - private static class Status { - private final Integer port; - private final String pid; - - private final Boolean respondingToPing; - private final Boolean processRunning; - - public Status(final Integer port, final String pid, final Boolean respondingToPing, final Boolean processRunning) { - this.port = port; - this.pid = pid; - this.respondingToPing = respondingToPing; - this.processRunning = processRunning; - } - - public String getPid() { - return pid; - } - - public Integer getPort() { - return port; - } - - public boolean isRespondingToPing() { - return Boolean.TRUE.equals(respondingToPing); - } - + } + + private boolean isWindows() { + final String osName = System.getProperty("os.name"); + return osName != null && osName.toLowerCase().contains("win"); + } + + private boolean waitForStart() { + lock.lock(); + try { + final long startTime = System.nanoTime(); + + while (ccPort < 1) { + try { + startupCondition.await(1, TimeUnit.SECONDS); + } catch (final InterruptedException ie) { + return false; + } + + final long waitNanos = System.nanoTime() - startTime; + final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); + if (waitSeconds > STARTUP_WAIT_SECONDS) { + return false; + } + } + } finally { + lock.unlock(); + } + return true; + } + + private File getFile(final String filename, final File workingDir) { + File file = new File(filename); + if (!file.isAbsolute()) { + file = new File(workingDir, filename); + } + + return file; + } + + private String replaceNull(final String value, final String replacement) { + return (value == null) ? replacement : value; + } + + void setAutoRestartNiFi(final boolean restart) { + this.autoRestartNiFi = restart; + } + + void setNiFiCommandControlPort(final int port, final String secretKey) { + this.ccPort = port; + this.secretKey = secretKey; + + if (shutdownHook != null) { + shutdownHook.setSecretKey(secretKey); + } + + final File statusFile = getStatusFile(); + + final Properties nifiProps = new Properties(); + if (nifiPid != -1) { + nifiProps.setProperty("pid", String.valueOf(nifiPid)); + } + nifiProps.setProperty("port", String.valueOf(ccPort)); + nifiProps.setProperty("secret.key", secretKey); + + try { + saveProperties(nifiProps); + } catch (final IOException ioe) { + logger.log(Level.WARNING, "Apache NiFi has started but failed to persist NiFi Port information to {0} due to {1}", new Object[]{statusFile.getAbsolutePath(), ioe}); + } + + logger.log(Level.INFO, "Apache NiFi now running and listening for Bootstrap requests on port {0}", port); + } + + int getNiFiCommandControlPort() { + return this.ccPort; + } + + private static class Status { + + private final Integer port; + private final String pid; + + private final Boolean respondingToPing; + private final Boolean processRunning; + + public Status(final Integer port, final String pid, final Boolean respondingToPing, final Boolean processRunning) { + this.port = port; + this.pid = pid; + this.respondingToPing = respondingToPing; + this.processRunning = processRunning; + } + + public String getPid() { + return pid; + } + + public Integer getPort() { + return port; + } + + public boolean isRespondingToPing() { + return Boolean.TRUE.equals(respondingToPing); + } + public boolean isProcessRunning() { return Boolean.TRUE.equals(processRunning); } - } + } } diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java index 3d3a241328..023ab84e64 100644 --- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java +++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/ShutdownHook.java @@ -24,63 +24,65 @@ import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; public class ShutdownHook extends Thread { - private final Process nifiProcess; - private final RunNiFi runner; - private final int gracefulShutdownSeconds; - - private volatile String secretKey; - - public ShutdownHook(final Process nifiProcess, final RunNiFi runner, final String secretKey, final int gracefulShutdownSeconds) { - this.nifiProcess = nifiProcess; - this.runner = runner; - this.secretKey = secretKey; - this.gracefulShutdownSeconds = gracefulShutdownSeconds; - } - - void setSecretKey(final String secretKey) { - this.secretKey = secretKey; - } - - @Override - public void run() { - runner.setAutoRestartNiFi(false); - final int ccPort = runner.getNiFiCommandControlPort(); - if ( ccPort > 0 ) { - System.out.println("Initiating Shutdown of NiFi..."); - - try { - final Socket socket = new Socket("localhost", ccPort); - final OutputStream out = socket.getOutputStream(); - out.write(("SHUTDOWN " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); - out.flush(); - - socket.close(); - } catch (final IOException ioe) { - System.out.println("Failed to Shutdown NiFi due to " + ioe); - } - } - - System.out.println("Waiting for Apache NiFi to finish shutting down..."); - final long startWait = System.nanoTime(); - while ( RunNiFi.isAlive(nifiProcess) ) { - final long waitNanos = System.nanoTime() - startWait; - final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); - if ( waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0 ) { - if ( RunNiFi.isAlive(nifiProcess) ) { - System.out.println("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process."); - nifiProcess.destroy(); - } - break; - } else { - try { - Thread.sleep(1000L); - } catch (final InterruptedException ie) {} - } - } - - final File statusFile = runner.getStatusFile(); - if ( !statusFile.delete() ) { - System.err.println("Failed to delete status file " + statusFile.getAbsolutePath() + "; this file should be cleaned up manually"); - } - } + + private final Process nifiProcess; + private final RunNiFi runner; + private final int gracefulShutdownSeconds; + + private volatile String secretKey; + + public ShutdownHook(final Process nifiProcess, final RunNiFi runner, final String secretKey, final int gracefulShutdownSeconds) { + this.nifiProcess = nifiProcess; + this.runner = runner; + this.secretKey = secretKey; + this.gracefulShutdownSeconds = gracefulShutdownSeconds; + } + + void setSecretKey(final String secretKey) { + this.secretKey = secretKey; + } + + @Override + public void run() { + runner.setAutoRestartNiFi(false); + final int ccPort = runner.getNiFiCommandControlPort(); + if (ccPort > 0) { + System.out.println("Initiating Shutdown of NiFi..."); + + try { + final Socket socket = new Socket("localhost", ccPort); + final OutputStream out = socket.getOutputStream(); + out.write(("SHUTDOWN " + secretKey + "\n").getBytes(StandardCharsets.UTF_8)); + out.flush(); + + socket.close(); + } catch (final IOException ioe) { + System.out.println("Failed to Shutdown NiFi due to " + ioe); + } + } + + System.out.println("Waiting for Apache NiFi to finish shutting down..."); + final long startWait = System.nanoTime(); + while (RunNiFi.isAlive(nifiProcess)) { + final long waitNanos = System.nanoTime() - startWait; + final long waitSeconds = TimeUnit.NANOSECONDS.toSeconds(waitNanos); + if (waitSeconds >= gracefulShutdownSeconds && gracefulShutdownSeconds > 0) { + if (RunNiFi.isAlive(nifiProcess)) { + System.out.println("NiFi has not finished shutting down after " + gracefulShutdownSeconds + " seconds. Killing process."); + nifiProcess.destroy(); + } + break; + } else { + try { + Thread.sleep(1000L); + } catch (final InterruptedException ie) { + } + } + } + + final File statusFile = runner.getStatusFile(); + if (!statusFile.delete()) { + System.err.println("Failed to delete status file " + statusFile.getAbsolutePath() + "; this file should be cleaned up manually"); + } + } } diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java index 962aa1c39d..52e36b9a0e 100644 --- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java +++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/exception/InvalidCommandException.java @@ -17,21 +17,22 @@ package org.apache.nifi.bootstrap.exception; public class InvalidCommandException extends Exception { - private static final long serialVersionUID = 1L; - public InvalidCommandException() { - super(); - } - - public InvalidCommandException(final String message) { - super(message); - } - - public InvalidCommandException(final Throwable t) { - super(t); - } - - public InvalidCommandException(final String message, final Throwable t) { - super(message, t); - } + private static final long serialVersionUID = 1L; + + public InvalidCommandException() { + super(); + } + + public InvalidCommandException(final String message) { + super(message); + } + + public InvalidCommandException(final Throwable t) { + super(t); + } + + public InvalidCommandException(final String message, final Throwable t) { + super(message, t); + } } diff --git a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java index 07baab1409..479ac588a4 100644 --- a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java +++ b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFilePackagerV1.java @@ -78,7 +78,7 @@ public class FlowFilePackagerV1 implements FlowFilePackager { entry.setMode(tarPermissions); entry.setSize(fileSize); tarOut.putArchiveEntry(entry); - final byte[] buffer = new byte[512 << 10];//512KB + final byte[] buffer = new byte[512 << 10];//512KB int bytesRead = 0; while ((bytesRead = inStream.read(buffer)) != -1) { //still more data to read if (bytesRead > 0) { diff --git a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java index f8ef3d1ab5..b96534a6b2 100644 --- a/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java +++ b/nifi/nifi-commons/nifi-flowfile-packager/src/main/java/org/apache/nifi/util/FlowFileUnpackagerV1.java @@ -51,7 +51,7 @@ public class FlowFileUnpackagerV1 implements FlowFileUnpackager { final TarArchiveEntry contentEntry = tarIn.getNextTarEntry(); if (contentEntry != null && contentEntry.getName().equals(FlowFilePackagerV1.FILENAME_CONTENT)) { - final byte[] buffer = new byte[512 << 10];//512KB + final byte[] buffer = new byte[512 << 10];//512KB int bytesRead = 0; while ((bytesRead = tarIn.read(buffer)) != -1) { //still more data to read if (bytesRead > 0) { diff --git a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml index 7daa400835..bcd489effe 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/pom.xml +++ b/nifi/nifi-commons/nifi-hl7-query-language/pom.xml @@ -14,109 +14,115 @@ limitations under the License. --> - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - - org.apache.nifi - nifi-commons - 0.1.0-incubating-SNAPSHOT - + + org.apache.nifi + nifi-commons + 0.1.0-incubating-SNAPSHOT + - nifi-hl7-query-language - jar - - - - maven-compiler-plugin - - 1.7 - 1.7 - - - - org.antlr - antlr3-maven-plugin - - - - antlr - - - - - - org.apache.rat - apache-rat-plugin - - - src/test/resources/hypoglycemia - src/test/resources/hyperglycemia - - - - - + nifi-hl7-query-language + jar + + + + maven-compiler-plugin + + 1.7 + 1.7 + + + + org.antlr + antlr3-maven-plugin + + + + antlr + + + + + + org.apache.rat + apache-rat-plugin + + + src/test/resources/hypoglycemia + src/test/resources/hyperglycemia + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + **/HL7QueryParser.java,**/HL7QueryLexer.java + + + + - - - org.antlr - antlr-runtime - 3.5.2 - + + + org.antlr + antlr-runtime + - - - ca.uhn.hapi - hapi-base - 2.2 - - - ca.uhn.hapi - hapi-structures-v21 - 2.2 - - - ca.uhn.hapi - hapi-structures-v22 - 2.2 - - - ca.uhn.hapi - hapi-structures-v23 - 2.2 - - - ca.uhn.hapi - hapi-structures-v231 - 2.2 - - - ca.uhn.hapi - hapi-structures-v24 - 2.2 - - - ca.uhn.hapi - hapi-structures-v25 - 2.2 - - - ca.uhn.hapi - hapi-structures-v251 - 2.2 - - - ca.uhn.hapi - hapi-structures-v26 - 2.2 - + + + ca.uhn.hapi + hapi-base + 2.2 + + + ca.uhn.hapi + hapi-structures-v21 + 2.2 + + + ca.uhn.hapi + hapi-structures-v22 + 2.2 + + + ca.uhn.hapi + hapi-structures-v23 + 2.2 + + + ca.uhn.hapi + hapi-structures-v231 + 2.2 + + + ca.uhn.hapi + hapi-structures-v24 + 2.2 + + + ca.uhn.hapi + hapi-structures-v25 + 2.2 + + + ca.uhn.hapi + hapi-structures-v251 + 2.2 + + + ca.uhn.hapi + hapi-structures-v26 + 2.2 + - - junit - junit - test - - + + junit + junit + test + + diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/checkstyle/suppressions.xml b/nifi/nifi-commons/nifi-hl7-query-language/src/checkstyle/suppressions.xml new file mode 100644 index 0000000000..a0bfd6bf6e --- /dev/null +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/checkstyle/suppressions.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java index be645e59c8..dc73efbea7 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/EmptyField.java @@ -24,14 +24,14 @@ import org.apache.nifi.hl7.model.HL7Field; public class EmptyField implements HL7Field { - @Override - public String getValue() { - return null; - } + @Override + public String getValue() { + return null; + } - @Override - public List getComponents() { - return Collections.emptyList(); - } + @Override + public List getComponents() { + return Collections.emptyList(); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java index 056b6b677d..94cce5c1a9 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiField.java @@ -32,52 +32,53 @@ import ca.uhn.hl7v2.parser.EncodingCharacters; import ca.uhn.hl7v2.parser.PipeParser; public class HapiField implements HL7Field, HL7Component { - private final String value; - private final List components; - - public HapiField(final Type type) { - this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance()); - - final List componentList = new ArrayList<>(); - if ( type instanceof Composite ) { - final Composite composite = (Composite) type; - - for ( final Type component : composite.getComponents() ) { - componentList.add(new HapiField(component)); - } - } - - final ExtraComponents extra = type.getExtraComponents(); - if ( extra != null && extra.numComponents() > 0 ) { - final String singleFieldValue; - if ( type instanceof Primitive ) { - singleFieldValue = ((Primitive) type).getValue(); - } else { - singleFieldValue = this.value; - } - componentList.add(new SingleValueField(singleFieldValue)); - - for (int i=0; i < extra.numComponents(); i++) { - final Varies varies = extra.getComponent(i); - componentList.add(new HapiField(varies)); - } - } - - this.components = Collections.unmodifiableList(componentList); - } - - @Override - public String getValue() { - return value; - } - @Override - public List getComponents() { - return components; - } - - @Override - public String toString() { - return value; - } + private final String value; + private final List components; + + public HapiField(final Type type) { + this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance()); + + final List componentList = new ArrayList<>(); + if (type instanceof Composite) { + final Composite composite = (Composite) type; + + for (final Type component : composite.getComponents()) { + componentList.add(new HapiField(component)); + } + } + + final ExtraComponents extra = type.getExtraComponents(); + if (extra != null && extra.numComponents() > 0) { + final String singleFieldValue; + if (type instanceof Primitive) { + singleFieldValue = ((Primitive) type).getValue(); + } else { + singleFieldValue = this.value; + } + componentList.add(new SingleValueField(singleFieldValue)); + + for (int i = 0; i < extra.numComponents(); i++) { + final Varies varies = extra.getComponent(i); + componentList.add(new HapiField(varies)); + } + } + + this.components = Collections.unmodifiableList(componentList); + } + + @Override + public String getValue() { + return value; + } + + @Override + public List getComponents() { + return components; + } + + @Override + public String toString() { + return value; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java index ddd28b2bf9..74a8f6cada 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiMessage.java @@ -32,63 +32,64 @@ import ca.uhn.hl7v2.model.Segment; import ca.uhn.hl7v2.model.Structure; public class HapiMessage implements HL7Message { - private final Message message; - private final List allSegments; - private final Map> segmentMap; - - public HapiMessage(final Message message) throws HL7Exception { - this.message = message; - - allSegments = new ArrayList<>(); - populateSegments(message, allSegments); - - segmentMap = new HashMap<>(); - for ( final HL7Segment segment : allSegments ) { - final String segmentName = segment.getName(); - List segmentList = segmentMap.get(segmentName); - if ( segmentList == null ) { - segmentList = new ArrayList<>(); - segmentMap.put(segmentName, segmentList); - } - - segmentList.add(segment); - } - } - - private void populateSegments(final Group group, final List segments) throws HL7Exception { - for ( final String structureName : group.getNames() ) { - final Structure[] structures = group.getAll(structureName); - if ( group.isGroup(structureName) ) { - for ( final Structure structure : structures ) { - populateSegments((Group) structure, segments); - } - } else { - for ( final Structure structure : structures ) { - final Segment segment = (Segment) structure; - final HapiSegment hapiSegment = new HapiSegment(segment); - segments.add(hapiSegment); - } - } - } - } - - @Override - public List getSegments() { - return Collections.unmodifiableList(allSegments); - } - @Override - public List getSegments(final String segmentType) { - final List segments = segmentMap.get(segmentType); - if ( segments == null ) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(segments); - } + private final Message message; + private final List allSegments; + private final Map> segmentMap; - @Override - public String toString() { - return message.toString(); - } + public HapiMessage(final Message message) throws HL7Exception { + this.message = message; + + allSegments = new ArrayList<>(); + populateSegments(message, allSegments); + + segmentMap = new HashMap<>(); + for (final HL7Segment segment : allSegments) { + final String segmentName = segment.getName(); + List segmentList = segmentMap.get(segmentName); + if (segmentList == null) { + segmentList = new ArrayList<>(); + segmentMap.put(segmentName, segmentList); + } + + segmentList.add(segment); + } + } + + private void populateSegments(final Group group, final List segments) throws HL7Exception { + for (final String structureName : group.getNames()) { + final Structure[] structures = group.getAll(structureName); + if (group.isGroup(structureName)) { + for (final Structure structure : structures) { + populateSegments((Group) structure, segments); + } + } else { + for (final Structure structure : structures) { + final Segment segment = (Segment) structure; + final HapiSegment hapiSegment = new HapiSegment(segment); + segments.add(hapiSegment); + } + } + } + } + + @Override + public List getSegments() { + return Collections.unmodifiableList(allSegments); + } + + @Override + public List getSegments(final String segmentType) { + final List segments = segmentMap.get(segmentType); + if (segments == null) { + return Collections.emptyList(); + } + + return Collections.unmodifiableList(segments); + } + + @Override + public String toString() { + return message.toString(); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java index d50afdb960..20e646ccb0 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/HapiSegment.java @@ -28,42 +28,42 @@ import ca.uhn.hl7v2.model.Segment; import ca.uhn.hl7v2.model.Type; public class HapiSegment implements HL7Segment { - private final Segment segment; - private final List fields; - - public HapiSegment(final Segment segment) throws HL7Exception { - this.segment = segment; - - final List fieldList = new ArrayList<>(); - for (int i=1; i <= segment.numFields(); i++) { - final Type[] types = segment.getField(i); - if ( types == null || types.length == 0 ) { - fieldList.add(new EmptyField()); - continue; - } - - for ( final Type type : types ) { - fieldList.add(new HapiField(type)); - } - } - - this.fields = Collections.unmodifiableList(fieldList); - } - - - @Override - public String getName() { - return segment.getName(); - } + private final Segment segment; + private final List fields; - @Override - public List getFields() { - return fields; - } + public HapiSegment(final Segment segment) throws HL7Exception { + this.segment = segment; - @Override - public String toString() { - return segment.toString(); - } + final List fieldList = new ArrayList<>(); + for (int i = 1; i <= segment.numFields(); i++) { + final Type[] types = segment.getField(i); + + if (types == null || types.length == 0) { + fieldList.add(new EmptyField()); + continue; + } + + for (final Type type : types) { + fieldList.add(new HapiField(type)); + } + } + + this.fields = Collections.unmodifiableList(fieldList); + } + + @Override + public String getName() { + return segment.getName(); + } + + @Override + public List getFields() { + return fields; + } + + @Override + public String toString() { + return segment.toString(); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java index ed99077b45..b8a63510a0 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/hapi/SingleValueField.java @@ -23,20 +23,21 @@ import org.apache.nifi.hl7.model.HL7Component; import org.apache.nifi.hl7.model.HL7Field; public class SingleValueField implements HL7Field { - private final String value; - - public SingleValueField(final String value) { - this.value = value; - } - - @Override - public String getValue() { - return value; - } - @Override - public List getComponents() { - return Collections.emptyList(); - } + private final String value; + + public SingleValueField(final String value) { + this.value = value; + } + + @Override + public String getValue() { + return value; + } + + @Override + public List getComponents() { + return Collections.emptyList(); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java index e7b31a4c4a..4d2f2768db 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/HL7Reader.java @@ -22,6 +22,6 @@ import org.apache.nifi.hl7.model.HL7Message; public interface HL7Reader { - HL7Message nextMessage() throws IOException; - + HL7Message nextMessage() throws IOException; + } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java index 669f40c6bc..c0c74f95df 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/io/exception/InvalidHL7Exception.java @@ -19,22 +19,23 @@ package org.apache.nifi.hl7.io.exception; import java.io.IOException; public class InvalidHL7Exception extends IOException { - private static final long serialVersionUID = -5675416667224562441L; - public InvalidHL7Exception() { - super(); - } + private static final long serialVersionUID = -5675416667224562441L; - public InvalidHL7Exception(String message, Throwable cause) { - super(message, cause); - } + public InvalidHL7Exception() { + super(); + } - public InvalidHL7Exception(String message) { - super(message); - } + public InvalidHL7Exception(String message, Throwable cause) { + super(message, cause); + } + + public InvalidHL7Exception(String message) { + super(message); + } + + public InvalidHL7Exception(Throwable cause) { + super(cause); + } - public InvalidHL7Exception(Throwable cause) { - super(cause); - } - } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java index cf355041b1..d8c1495a1b 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Component.java @@ -19,6 +19,8 @@ package org.apache.nifi.hl7.model; import java.util.List; public interface HL7Component { - String getValue(); - List getComponents(); + + String getValue(); + + List getComponents(); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java index 4086e581d1..ff58d962ef 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Field.java @@ -16,6 +16,5 @@ */ package org.apache.nifi.hl7.model; - public interface HL7Field extends HL7Component { } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java index dd9c2a9ff4..dc68c2b4ed 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Message.java @@ -20,8 +20,8 @@ import java.util.List; public interface HL7Message { - List getSegments(); - - List getSegments(String segmentType); - + List getSegments(); + + List getSegments(String segmentType); + } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java index de5aaa1d4b..d5d67aea05 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/model/HL7Segment.java @@ -20,8 +20,8 @@ import java.util.List; public interface HL7Segment { - String getName(); - - List getFields(); - + String getName(); + + List getFields(); + } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java index 0903cc8d30..94998e78c8 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Declaration.java @@ -20,10 +20,10 @@ import org.apache.nifi.hl7.model.HL7Message; public interface Declaration { - String getAlias(); - - boolean isRequired(); - - Object getDeclaredValue(HL7Message message); - + String getAlias(); + + boolean isRequired(); + + Object getDeclaredValue(HL7Message message); + } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java index a036106481..3734b4fe08 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java @@ -16,8 +16,6 @@ */ package org.apache.nifi.hl7.query; -import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.*; - import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -58,196 +56,211 @@ import org.apache.nifi.hl7.query.result.StandardQueryResult; import org.apache.nifi.hl7.query.antlr.HL7QueryLexer; import org.apache.nifi.hl7.query.antlr.HL7QueryParser; - +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.AND; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.DECLARE; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.DOT; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.EQUALS; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.GE; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.GT; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.IDENTIFIER; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.IS_NULL; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.LE; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.LT; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.MESSAGE; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT_EQUALS; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NOT_NULL; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.NUMBER; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.OR; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.REQUIRED; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.SEGMENT_NAME; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.SELECT; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.STRING_LITERAL; +import static org.apache.nifi.hl7.query.antlr.HL7QueryParser.WHERE; public class HL7Query { - private final Tree tree; - private final String query; - private final Set declarations = new HashSet<>(); - - private final List selections; - private final BooleanEvaluator whereEvaluator; - - private HL7Query(final Tree tree, final String query) { - this.tree = tree; - this.query = query; - List select = null; - BooleanEvaluator where = null; - for (int i=0; i < tree.getChildCount(); i++) { - final Tree child = tree.getChild(i); - - switch (child.getType()) { - case DECLARE: - processDeclare(child); - break; - case SELECT: - select = processSelect(child); - break; - case WHERE: - where = processWhere(child); - break; - default: - throw new HL7QueryParsingException("Found unexpected clause at root level: " + tree.getText()); - } - } - - this.whereEvaluator = where; - this.selections = select; - } - - private void processDeclare(final Tree declare) { - for (int i=0; i < declare.getChildCount(); i++) { - final Tree declarationTree = declare.getChild(i); - - final String identifier = declarationTree.getChild(0).getText(); - final Tree requiredOrOptionalTree = declarationTree.getChild(1); - final boolean required = requiredOrOptionalTree.getType() == REQUIRED; - - final String segmentName = declarationTree.getChild(2).getText(); - - final Declaration declaration = new Declaration() { - @Override - public String getAlias() { - return identifier; - } + private final Tree tree; + private final String query; + private final Set declarations = new HashSet<>(); - @Override - public boolean isRequired() { - return required; - } + private final List selections; + private final BooleanEvaluator whereEvaluator; - @Override - public Object getDeclaredValue(final HL7Message message) { - if ( message == null ) { - return null; - } - - return message.getSegments(segmentName); - } - }; - - declarations.add(declaration); - } - } + private HL7Query(final Tree tree, final String query) { + this.tree = tree; + this.query = query; - private List processSelect(final Tree select) { - final List selections = new ArrayList<>(); + List select = null; + BooleanEvaluator where = null; + for (int i = 0; i < tree.getChildCount(); i++) { + final Tree child = tree.getChild(i); - for (int i=0; i < select.getChildCount(); i++) { - final Tree selectable = select.getChild(i); - - final String alias = getSelectedName(selectable); - final Evaluator selectionEvaluator = buildReferenceEvaluator(selectable); - final Selection selection = new Selection(selectionEvaluator, alias); - selections.add(selection); - } - - return selections; - } - - - private String getSelectedName(final Tree selectable) { - if ( selectable.getChildCount() == 0 ) { - return selectable.getText(); - } else if (selectable.getType() == DOT ) { - return getSelectedName(selectable.getChild(0)) + "." + getSelectedName(selectable.getChild(1)); - } else { - return selectable.getChild(selectable.getChildCount() - 1).getText(); - } - } - + switch (child.getType()) { + case DECLARE: + processDeclare(child); + break; + case SELECT: + select = processSelect(child); + break; + case WHERE: + where = processWhere(child); + break; + default: + throw new HL7QueryParsingException("Found unexpected clause at root level: " + tree.getText()); + } + } - private BooleanEvaluator processWhere(final Tree where) { - return buildBooleanEvaluator(where.getChild(0)); - } - + this.whereEvaluator = where; + this.selections = select; + } - private Evaluator buildReferenceEvaluator(final Tree tree) { - switch (tree.getType()) { - case MESSAGE: - return new MessageEvaluator(); - case SEGMENT_NAME: - return new SegmentEvaluator(new StringLiteralEvaluator(tree.getText())); - case IDENTIFIER: - return new DeclaredReferenceEvaluator(new StringLiteralEvaluator(tree.getText())); - case DOT: - final Tree firstChild = tree.getChild(0); - final Tree secondChild = tree.getChild(1); - return new DotEvaluator(buildReferenceEvaluator(firstChild), buildIntegerEvaluator(secondChild)); - case STRING_LITERAL: - return new StringLiteralEvaluator(tree.getText()); - case NUMBER: - return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText())); - default: - throw new HL7QueryParsingException("Failed to build evaluator for " + tree.getText()); - } - } - - - private IntegerEvaluator buildIntegerEvaluator(final Tree tree) { - switch (tree.getType()) { - case NUMBER: - return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText())); - default: - throw new HL7QueryParsingException("Failed to build Integer Evaluator for " + tree.getText()); - } - } - - - private BooleanEvaluator buildBooleanEvaluator(final Tree tree) { - // TODO: add Date comparisons - // LT/GT/GE/GE should allow for dates based on Field's Type - // BETWEEN - // DATE('2015/01/01') - // DATE('2015/01/01 12:00:00') - // DATE('24 HOURS AGO') - // DATE('YESTERDAY') - - switch (tree.getType()) { - case EQUALS: - return new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case NOT_EQUALS: - return new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case GT: - return new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case LT: - return new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case GE: - return new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case LE: - return new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); - case NOT: - return new NotEvaluator(buildBooleanEvaluator(tree.getChild(0))); - case AND: - return new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1))); - case OR: - return new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1))); - case IS_NULL: - return new IsNullEvaluator(buildReferenceEvaluator(tree.getChild(0))); - case NOT_NULL: - return new NotNullEvaluator(buildReferenceEvaluator(tree.getChild(0))); - default: - throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'"); - } - } - - - Tree getTree() { - return tree; - } - - public String getQuery() { - return query; - } - - @Override - public String toString() { - return "HL7Query[" + query + "]"; - } - - public static HL7Query compile(final String query) { - try { + private void processDeclare(final Tree declare) { + for (int i = 0; i < declare.getChildCount(); i++) { + final Tree declarationTree = declare.getChild(i); + + final String identifier = declarationTree.getChild(0).getText(); + final Tree requiredOrOptionalTree = declarationTree.getChild(1); + final boolean required = requiredOrOptionalTree.getType() == REQUIRED; + + final String segmentName = declarationTree.getChild(2).getText(); + + final Declaration declaration = new Declaration() { + @Override + public String getAlias() { + return identifier; + } + + @Override + public boolean isRequired() { + return required; + } + + @Override + public Object getDeclaredValue(final HL7Message message) { + if (message == null) { + return null; + } + + return message.getSegments(segmentName); + } + }; + + declarations.add(declaration); + } + } + + private List processSelect(final Tree select) { + final List selections = new ArrayList<>(); + + for (int i = 0; i < select.getChildCount(); i++) { + final Tree selectable = select.getChild(i); + + final String alias = getSelectedName(selectable); + final Evaluator selectionEvaluator = buildReferenceEvaluator(selectable); + final Selection selection = new Selection(selectionEvaluator, alias); + selections.add(selection); + } + + return selections; + } + + private String getSelectedName(final Tree selectable) { + if (selectable.getChildCount() == 0) { + return selectable.getText(); + } else if (selectable.getType() == DOT) { + return getSelectedName(selectable.getChild(0)) + "." + getSelectedName(selectable.getChild(1)); + } else { + return selectable.getChild(selectable.getChildCount() - 1).getText(); + } + } + + private BooleanEvaluator processWhere(final Tree where) { + return buildBooleanEvaluator(where.getChild(0)); + } + + private Evaluator buildReferenceEvaluator(final Tree tree) { + switch (tree.getType()) { + case MESSAGE: + return new MessageEvaluator(); + case SEGMENT_NAME: + return new SegmentEvaluator(new StringLiteralEvaluator(tree.getText())); + case IDENTIFIER: + return new DeclaredReferenceEvaluator(new StringLiteralEvaluator(tree.getText())); + case DOT: + final Tree firstChild = tree.getChild(0); + final Tree secondChild = tree.getChild(1); + return new DotEvaluator(buildReferenceEvaluator(firstChild), buildIntegerEvaluator(secondChild)); + case STRING_LITERAL: + return new StringLiteralEvaluator(tree.getText()); + case NUMBER: + return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText())); + default: + throw new HL7QueryParsingException("Failed to build evaluator for " + tree.getText()); + } + } + + private IntegerEvaluator buildIntegerEvaluator(final Tree tree) { + switch (tree.getType()) { + case NUMBER: + return new IntegerLiteralEvaluator(Integer.parseInt(tree.getText())); + default: + throw new HL7QueryParsingException("Failed to build Integer Evaluator for " + tree.getText()); + } + } + + private BooleanEvaluator buildBooleanEvaluator(final Tree tree) { + // TODO: add Date comparisons + // LT/GT/GE/GE should allow for dates based on Field's Type + // BETWEEN + // DATE('2015/01/01') + // DATE('2015/01/01 12:00:00') + // DATE('24 HOURS AGO') + // DATE('YESTERDAY') + + switch (tree.getType()) { + case EQUALS: + return new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case NOT_EQUALS: + return new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case GT: + return new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case LT: + return new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case GE: + return new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case LE: + return new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1))); + case NOT: + return new NotEvaluator(buildBooleanEvaluator(tree.getChild(0))); + case AND: + return new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1))); + case OR: + return new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1))); + case IS_NULL: + return new IsNullEvaluator(buildReferenceEvaluator(tree.getChild(0))); + case NOT_NULL: + return new NotNullEvaluator(buildReferenceEvaluator(tree.getChild(0))); + default: + throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'"); + } + } + + Tree getTree() { + return tree; + } + + public String getQuery() { + return query; + } + + @Override + public String toString() { + return "HL7Query[" + query + "]"; + } + + public static HL7Query compile(final String query) { + try { final CommonTokenStream lexerTokenStream = createTokenStream(query); final HL7QueryParser parser = new HL7QueryParser(lexerTokenStream); final Tree tree = (Tree) parser.query().getTree(); @@ -258,155 +271,114 @@ public class HL7Query { } catch (final Exception e) { throw new HL7QueryParsingException(e); } - } - - private static CommonTokenStream createTokenStream(final String expression) throws HL7QueryParsingException { + } + + private static CommonTokenStream createTokenStream(final String expression) throws HL7QueryParsingException { final CharStream input = new ANTLRStringStream(expression); final HL7QueryLexer lexer = new HL7QueryLexer(input); return new CommonTokenStream(lexer); } - - public List> getReturnTypes() { - final List> returnTypes = new ArrayList<>(); - - for ( final Selection selection : selections ) { - returnTypes.add( selection.getEvaluator().getType() ); - } - - return returnTypes; - } - - @SuppressWarnings("unchecked") - public QueryResult evaluate(final HL7Message message) { - - int totalIterations = 1; - final LinkedHashMap> possibleValueMap = new LinkedHashMap<>(); - for ( final Declaration declaration : declarations ) { - final Object value = declaration.getDeclaredValue(message); - if ( value == null && declaration.isRequired() ) { - return new MissedResult(selections); - } - final List possibleValues; - if ( value instanceof List ) { - possibleValues = (List) value; - } else if ( value instanceof Collection ) { - possibleValues = new ArrayList((Collection) value); - } else { - possibleValues = new ArrayList<>(1); - possibleValues.add(value); - } - - if ( possibleValues.isEmpty() ) { - return new MissedResult(selections); - } - - possibleValueMap.put(declaration.getAlias(), possibleValues); - totalIterations *= possibleValues.size(); - } + public List> getReturnTypes() { + final List> returnTypes = new ArrayList<>(); - final Set> resultSet = new HashSet<>(); - for (int i=0; i < totalIterations; i++) { - final Map aliasValues = assignAliases(possibleValueMap, i); + for (final Selection selection : selections) { + returnTypes.add(selection.getEvaluator().getType()); + } - aliasValues.put(Evaluator.MESSAGE_KEY, message); - if (whereEvaluator == null || Boolean.TRUE.equals(whereEvaluator.evaluate(aliasValues))) { - final Map resultMap = new HashMap<>(); + return returnTypes; + } - for ( final Selection selection : selections ) { - final Object value = selection.getEvaluator().evaluate(aliasValues); - resultMap.put(selection.getName(), value); - } - - resultSet.add(resultMap); - } - } - -// for ( final Declaration declaration : declarations ) { -// final Object value = declaration.getDeclaredValue(message); -// if ( value == null && declaration.isRequired() ) { -// return new MissedResult(selections); -// } -// objectMap.put(declaration.getAlias(), value); -// } -// -// if (whereEvaluator == null || Boolean.TRUE.equals(whereEvaluator.evaluate(objectMap))) { -// for ( final Selection selection : selections ) { -// final Object value = selection.getEvaluator().evaluate(objectMap); -// resultMap.put(selection.getName(), value); -// } -// } else { -// return new MissedResult(selections); -// } - - return new StandardQueryResult(selections, resultSet); - } - - - // assigns one of the possible values to each alias, based on which iteration this is. - // require LinkedHashMap just to be very clear and explicit that the order of the Map MUST be guaranteed - // between multiple invocations of this method. - // package protected for testing visibility -// static Map assignAliases(final LinkedHashMap> possibleValues, final int iteration) { -// final Map aliasMap = new HashMap<>(); -// -// int aliasIndex = possibleValues.size() - 1; -// for ( final Map.Entry> entry : possibleValues.entrySet() ) { -// final String alias = entry.getKey(); -// final List validValues = entry.getValue(); -// -// final int validValueIndex; -// if (aliasIndex > 0) { -// validValueIndex = iteration / aliasIndex; -// } else { -// validValueIndex = iteration; -// } -// -// final Object obj = validValues.get(validValueIndex % validValues.size()); -// aliasMap.put(alias, obj); -// -// aliasIndex--; -// } -// -// return aliasMap; -// } -// - - static Map assignAliases(final LinkedHashMap> possibleValues, final int iteration) { - final Map aliasMap = new HashMap<>(); - - int divisor = 1; - for ( final Map.Entry> entry : possibleValues.entrySet() ) { - final String alias = entry.getKey(); - final List validValues = entry.getValue(); + @SuppressWarnings("unchecked") + public QueryResult evaluate(final HL7Message message) { - final int idx = (iteration / divisor) % validValues.size(); - final Object obj = validValues.get(idx); - aliasMap.put(alias, obj); - - divisor *= validValues.size(); - } - - return aliasMap; - } - - public String toTreeString() { - final StringBuilder sb = new StringBuilder(); - toTreeString(tree, sb, 0); - return sb.toString(); - } - - private void toTreeString(final Tree tree, final StringBuilder sb, final int indentLevel) { - final String nodeName = tree.getText(); - for (int i=0; i < indentLevel; i++) { - sb.append(" "); - } - sb.append(nodeName); - sb.append("\n"); - - for (int i=0; i < tree.getChildCount(); i++) { - final Tree child = tree.getChild(i); - toTreeString(child, sb, indentLevel + 2); - } - } + int totalIterations = 1; + final LinkedHashMap> possibleValueMap = new LinkedHashMap<>(); + for (final Declaration declaration : declarations) { + final Object value = declaration.getDeclaredValue(message); + if (value == null && declaration.isRequired()) { + return new MissedResult(selections); + } + + final List possibleValues; + if (value instanceof List) { + possibleValues = (List) value; + } else if (value instanceof Collection) { + possibleValues = new ArrayList((Collection) value); + } else { + possibleValues = new ArrayList<>(1); + possibleValues.add(value); + } + + if (possibleValues.isEmpty()) { + return new MissedResult(selections); + } + + possibleValueMap.put(declaration.getAlias(), possibleValues); + totalIterations *= possibleValues.size(); + } + + final Set> resultSet = new HashSet<>(); + for (int i = 0; i < totalIterations; i++) { + final Map aliasValues = assignAliases(possibleValueMap, i); + + aliasValues.put(Evaluator.MESSAGE_KEY, message); + if (whereEvaluator == null || Boolean.TRUE.equals(whereEvaluator.evaluate(aliasValues))) { + final Map resultMap = new HashMap<>(); + + for (final Selection selection : selections) { + final Object value = selection.getEvaluator().evaluate(aliasValues); + resultMap.put(selection.getName(), value); + } + + resultSet.add(resultMap); + } + } + + return new StandardQueryResult(selections, resultSet); + } + + /** + * assigns one of the possible values to each alias, based on which iteration this is. + * require LinkedHashMap just to be very clear and explicit that the order of the Map MUST be guaranteed + * between multiple invocations of this method. + * package protected for testing visibility + */ + static Map assignAliases(final LinkedHashMap> possibleValues, final int iteration) { + final Map aliasMap = new HashMap<>(); + + int divisor = 1; + for (final Map.Entry> entry : possibleValues.entrySet()) { + final String alias = entry.getKey(); + final List validValues = entry.getValue(); + + final int idx = (iteration / divisor) % validValues.size(); + final Object obj = validValues.get(idx); + aliasMap.put(alias, obj); + + divisor *= validValues.size(); + } + + return aliasMap; + } + + public String toTreeString() { + final StringBuilder sb = new StringBuilder(); + toTreeString(tree, sb, 0); + return sb.toString(); + } + + private void toTreeString(final Tree tree, final StringBuilder sb, final int indentLevel) { + final String nodeName = tree.getText(); + for (int i = 0; i < indentLevel; i++) { + sb.append(" "); + } + sb.append(nodeName); + sb.append("\n"); + + for (int i = 0; i < tree.getChildCount(); i++) { + final Tree child = tree.getChild(i); + toTreeString(child, sb, indentLevel + 2); + } + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/QueryResult.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/QueryResult.java index b198bc7ffb..033ac0a0a2 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/QueryResult.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/QueryResult.java @@ -19,11 +19,12 @@ package org.apache.nifi.hl7.query; import java.util.List; public interface QueryResult { - boolean isMatch(); - - List getLabels(); - - int getHitCount(); - - ResultHit nextHit(); + + boolean isMatch(); + + List getLabels(); + + int getHitCount(); + + ResultHit nextHit(); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/ResultHit.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/ResultHit.java index ee97e5d94c..9eb1d8f694 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/ResultHit.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/ResultHit.java @@ -19,7 +19,8 @@ package org.apache.nifi.hl7.query; import java.util.Map; public interface ResultHit { - Object getValue(String label); - - Map getSelectedValues(); + + Object getValue(String label); + + Map getSelectedValues(); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Selection.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Selection.java index 36a181f539..7b5b7b37ca 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Selection.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/Selection.java @@ -19,19 +19,20 @@ package org.apache.nifi.hl7.query; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class Selection { - private final Evaluator evaluator; - private final String name; - - public Selection(final Evaluator evaluator, final String name) { - this.evaluator = evaluator; - this.name = name; - } - - public String getName() { - return name; - } - - public Evaluator getEvaluator() { - return evaluator; - } + + private final Evaluator evaluator; + private final String name; + + public Selection(final Evaluator evaluator, final String name) { + this.evaluator = evaluator; + this.name = name; + } + + public String getName() { + return name; + } + + public Evaluator getEvaluator() { + return evaluator; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/BooleanEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/BooleanEvaluator.java index fdd807ed3e..98b077eb54 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/BooleanEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/BooleanEvaluator.java @@ -18,7 +18,7 @@ package org.apache.nifi.hl7.query.evaluator; public abstract class BooleanEvaluator implements Evaluator { - public Class getType() { - return Boolean.class; - } + public Class getType() { + return Boolean.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/Evaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/Evaluator.java index d86c30e06d..2d1ddc7a96 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/Evaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/Evaluator.java @@ -19,9 +19,10 @@ package org.apache.nifi.hl7.query.evaluator; import java.util.Map; public interface Evaluator { - public static final String MESSAGE_KEY = "message"; - - T evaluate(Map objectMap); - - Class getType(); + + public static final String MESSAGE_KEY = "message"; + + T evaluate(Map objectMap); + + Class getType(); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/IntegerEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/IntegerEvaluator.java index 6afa9ed46c..ed56d80c8b 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/IntegerEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/IntegerEvaluator.java @@ -16,11 +16,10 @@ */ package org.apache.nifi.hl7.query.evaluator; - public abstract class IntegerEvaluator implements Evaluator { - public Class getType() { - return Integer.class; - } + public Class getType() { + return Integer.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/StringEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/StringEvaluator.java index 5f73649318..53ab004cc4 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/StringEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/StringEvaluator.java @@ -18,8 +18,8 @@ package org.apache.nifi.hl7.query.evaluator; public abstract class StringEvaluator implements Evaluator { - public Class getType() { - return String.class; - } - + public Class getType() { + return String.class; + } + } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractComparisonEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractComparisonEvaluator.java index a7fa1b7a29..45edf64c97 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractComparisonEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractComparisonEvaluator.java @@ -24,83 +24,88 @@ import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; import org.apache.nifi.hl7.query.evaluator.Evaluator; public abstract class AbstractComparisonEvaluator extends BooleanEvaluator { - private final Evaluator lhs; - private final Evaluator rhs; - - public AbstractComparisonEvaluator(final Evaluator lhs, final Evaluator rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - public final Boolean evaluate(final Map objectMap) { - final Object lhsValue = lhs.evaluate(objectMap); - if ( lhsValue == null ) { - return false; - } - - final Object rhsValue = rhs.evaluate(objectMap); - if ( rhsValue == null ) { - return false; - } - - return compareRaw(lhsValue, rhsValue); - } - - - private Boolean compareRaw(Object lhsValue, Object rhsValue) { - if ( lhsValue == null || rhsValue == null ) { - return false; - } - if ( lhsValue instanceof HL7Field ) { - lhsValue = ((HL7Field) lhsValue).getValue(); - } - - if ( rhsValue instanceof HL7Field ) { - rhsValue = ((HL7Field) rhsValue).getValue(); - } + private final Evaluator lhs; + private final Evaluator rhs; - if ( lhsValue == null || rhsValue == null ) { - return false; - } - - // both are collections, and compare(lhsValue, rhsValue) is false. - // this would be the case, for instance, if we compared field 1 of one segment to - // a field in another segment, and both fields had components. - if ( lhsValue instanceof Collection && rhsValue instanceof Collection ) { - return false; - } - - // if one side is a collection but the other is not, check if any element in that - // collection compares to the other element in a way that satisfies the condition. - // this would happen, for instance, if we check Segment1.Field5 = 'X' and field 5 repeats - // with a value "A~B~C~X~Y~Z"; in this case we do want to consider Field 5 = X as true. - if ( lhsValue instanceof Collection ) { - for ( final Object lhsObject : (Collection) lhsValue ) { - if ( compareRaw(lhsObject, rhsValue) ) { - return true; - } - } - - return false; - } - - if ( rhsValue instanceof Collection ) { - for ( final Object rhsObject : (Collection) rhsValue ) { - if ( compareRaw(rhsObject, lhsValue) ) { - return true; - } - } - - return false; - } - - if ( lhsValue != null && rhsValue != null && compare(lhsValue, rhsValue) ) { - return true; - } - - return false; - } - - protected abstract boolean compare(Object lhs, Object rhs); + public AbstractComparisonEvaluator(final Evaluator lhs, final Evaluator rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public final Boolean evaluate(final Map objectMap) { + final Object lhsValue = lhs.evaluate(objectMap); + if (lhsValue == null) { + return false; + } + + final Object rhsValue = rhs.evaluate(objectMap); + if (rhsValue == null) { + return false; + } + + return compareRaw(lhsValue, rhsValue); + } + + private Boolean compareRaw(Object lhsValue, Object rhsValue) { + if (lhsValue == null || rhsValue == null) { + return false; + } + + if (lhsValue instanceof HL7Field) { + lhsValue = ((HL7Field) lhsValue).getValue(); + } + + if (rhsValue instanceof HL7Field) { + rhsValue = ((HL7Field) rhsValue).getValue(); + } + + if (lhsValue == null || rhsValue == null) { + return false; + } + + /** + * both are collections, and compare(lhsValue, rhsValue) is false. + * this would be the case, for instance, if we compared field 1 of one segment to + * a field in another segment, and both fields had components. + */ + if (lhsValue instanceof Collection && rhsValue instanceof Collection) { + return false; + } + + /** + * if one side is a collection but the other is not, check if any element in that + * collection compares to the other element in a way that satisfies the condition. + * this would happen, for instance, if we check Segment1.Field5 = 'X' and field 5 repeats + * with a value "A~B~C~X~Y~Z"; in this case we do want to consider Field 5 = X as true. + */ + if (lhsValue instanceof Collection) { + for (final Object lhsObject : (Collection) lhsValue) { + if (compareRaw(lhsObject, rhsValue)) { + return true; + } + } + + return false; + } + + if (rhsValue instanceof Collection) { + for (final Object rhsObject : (Collection) rhsValue) { + if (compareRaw(rhsObject, lhsValue)) { + return true; + } + } + + return false; + } + + if (lhsValue != null && rhsValue != null && compare(lhsValue, rhsValue)) { + return true; + } + + return false; + } + + protected abstract boolean compare(Object lhs, Object rhs); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractNumericComparison.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractNumericComparison.java index 2529c4914b..d74e9cfcc3 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractNumericComparison.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/AbstractNumericComparison.java @@ -21,47 +21,48 @@ import java.util.regex.Pattern; import org.apache.nifi.hl7.query.evaluator.Evaluator; public abstract class AbstractNumericComparison extends AbstractComparisonEvaluator { - private static final Pattern NUMERIC_PATTERN = Pattern.compile("\\d+(\\.\\d+)?"); - - public AbstractNumericComparison(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } - - @Override - protected final boolean compare(final Object lhs, final Object rhs) { - final Double lhsDouble = toDouble(lhs); - if ( lhsDouble == null ) { - return false; - } - - final Double rhsDouble = toDouble(rhs); - if ( rhsDouble == null ) { - return false; - } - - return compareNumbers(lhsDouble, rhsDouble); - } - private Double toDouble(final Object value) { - if ( value == null ) { - return null; - } - - if ( value instanceof Double ) { - return (Double) value; - } - if ( value instanceof Number ) { - return ((Number) value).doubleValue(); - } - - if ( value instanceof String ) { - if ( NUMERIC_PATTERN.matcher((String) value).matches() ) { - return Double.parseDouble((String) value); - } - } - - return null; - } - - protected abstract boolean compareNumbers(final Double lhs, final Double rhs); + private static final Pattern NUMERIC_PATTERN = Pattern.compile("\\d+(\\.\\d+)?"); + + public AbstractNumericComparison(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } + + @Override + protected final boolean compare(final Object lhs, final Object rhs) { + final Double lhsDouble = toDouble(lhs); + if (lhsDouble == null) { + return false; + } + + final Double rhsDouble = toDouble(rhs); + if (rhsDouble == null) { + return false; + } + + return compareNumbers(lhsDouble, rhsDouble); + } + + private Double toDouble(final Object value) { + if (value == null) { + return null; + } + + if (value instanceof Double) { + return (Double) value; + } + if (value instanceof Number) { + return ((Number) value).doubleValue(); + } + + if (value instanceof String) { + if (NUMERIC_PATTERN.matcher((String) value).matches()) { + return Double.parseDouble((String) value); + } + } + + return null; + } + + protected abstract boolean compareNumbers(final Double lhs, final Double rhs); } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/EqualsEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/EqualsEvaluator.java index 7ee2f8707b..fa6c57bd7c 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/EqualsEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/EqualsEvaluator.java @@ -20,13 +20,13 @@ import org.apache.nifi.hl7.query.evaluator.Evaluator; public class EqualsEvaluator extends AbstractComparisonEvaluator { - public EqualsEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } - - @Override - protected boolean compare(final Object lhs, final Object rhs) { - return lhs != null && rhs != null && ((lhs == rhs) || (lhs.equals(rhs)) || lhs.toString().equals(rhs.toString())); - } + public EqualsEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } + + @Override + protected boolean compare(final Object lhs, final Object rhs) { + return lhs != null && rhs != null && ((lhs == rhs) || (lhs.equals(rhs)) || lhs.toString().equals(rhs.toString())); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanEvaluator.java index bf8596ecc9..cfef7b53a7 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanEvaluator.java @@ -18,17 +18,15 @@ package org.apache.nifi.hl7.query.evaluator.comparison; import org.apache.nifi.hl7.query.evaluator.Evaluator; - public class GreaterThanEvaluator extends AbstractNumericComparison { - public GreaterThanEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } + public GreaterThanEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } - @Override - protected boolean compareNumbers(final Double lhs, final Double rhs) { - return lhs > rhs; - } + @Override + protected boolean compareNumbers(final Double lhs, final Double rhs) { + return lhs > rhs; + } - } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanOrEqualEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanOrEqualEvaluator.java index 69115a3855..d9da6f77dc 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanOrEqualEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/GreaterThanOrEqualEvaluator.java @@ -18,17 +18,15 @@ package org.apache.nifi.hl7.query.evaluator.comparison; import org.apache.nifi.hl7.query.evaluator.Evaluator; - public class GreaterThanOrEqualEvaluator extends AbstractNumericComparison { - public GreaterThanOrEqualEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } + public GreaterThanOrEqualEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } - @Override - protected boolean compareNumbers(final Double lhs, final Double rhs) { - return lhs >= rhs; - } + @Override + protected boolean compareNumbers(final Double lhs, final Double rhs) { + return lhs >= rhs; + } - } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/IsNullEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/IsNullEvaluator.java index 69d481e289..0f16dd9390 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/IsNullEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/IsNullEvaluator.java @@ -24,46 +24,47 @@ import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class IsNullEvaluator extends BooleanEvaluator { - private final Evaluator subjectEvaluator; - - public IsNullEvaluator(final Evaluator subjectEvaluator) { - this.subjectEvaluator = subjectEvaluator; - } - - @Override - public Boolean evaluate(final Map objectMap) { - Object subjectValue = subjectEvaluator.evaluate(objectMap); - if ( subjectValue == null ) { - return true; - } - - return isNull(subjectValue); - } - private boolean isNull(Object subjectValue) { - if ( subjectValue == null ) { - return true; - } - - if ( subjectValue instanceof HL7Component ) { - subjectValue = ((HL7Component) subjectValue).getValue(); - } - - if ( subjectValue instanceof Collection ) { - final Collection collection = (Collection) subjectValue; - if ( collection.isEmpty() ) { - return true; - } - - for ( final Object obj : collection ) { - if ( !isNull(obj) ) { - return false; - } - } - - return true; - } - - return subjectValue == null; - } + private final Evaluator subjectEvaluator; + + public IsNullEvaluator(final Evaluator subjectEvaluator) { + this.subjectEvaluator = subjectEvaluator; + } + + @Override + public Boolean evaluate(final Map objectMap) { + Object subjectValue = subjectEvaluator.evaluate(objectMap); + if (subjectValue == null) { + return true; + } + + return isNull(subjectValue); + } + + private boolean isNull(Object subjectValue) { + if (subjectValue == null) { + return true; + } + + if (subjectValue instanceof HL7Component) { + subjectValue = ((HL7Component) subjectValue).getValue(); + } + + if (subjectValue instanceof Collection) { + final Collection collection = (Collection) subjectValue; + if (collection.isEmpty()) { + return true; + } + + for (final Object obj : collection) { + if (!isNull(obj)) { + return false; + } + } + + return true; + } + + return subjectValue == null; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanEvaluator.java index 891d5e4c3b..280586011b 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanEvaluator.java @@ -19,13 +19,14 @@ package org.apache.nifi.hl7.query.evaluator.comparison; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class LessThanEvaluator extends AbstractNumericComparison { - public LessThanEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } - @Override - protected boolean compareNumbers(final Double lhs, final Double rhs) { - return lhs < rhs; - } + public LessThanEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } + + @Override + protected boolean compareNumbers(final Double lhs, final Double rhs) { + return lhs < rhs; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanOrEqualEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanOrEqualEvaluator.java index c6fb0974ed..e7eb156196 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanOrEqualEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/LessThanOrEqualEvaluator.java @@ -19,13 +19,14 @@ package org.apache.nifi.hl7.query.evaluator.comparison; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class LessThanOrEqualEvaluator extends AbstractNumericComparison { - public LessThanOrEqualEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } - @Override - protected boolean compareNumbers(final Double lhs, final Double rhs) { - return lhs <= rhs; - } + public LessThanOrEqualEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } + + @Override + protected boolean compareNumbers(final Double lhs, final Double rhs) { + return lhs <= rhs; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEqualsEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEqualsEvaluator.java index b7c1ce28a0..98715ff01d 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEqualsEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEqualsEvaluator.java @@ -19,14 +19,14 @@ package org.apache.nifi.hl7.query.evaluator.comparison; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class NotEqualsEvaluator extends AbstractComparisonEvaluator { - - public NotEqualsEvaluator(final Evaluator lhs, final Evaluator rhs) { - super(lhs, rhs); - } - @Override - protected boolean compare(final Object lhs, final Object rhs) { - return lhs != null && rhs != null && lhs != rhs && !lhs.equals(rhs) && !lhs.toString().equals(rhs.toString()); - } + public NotEqualsEvaluator(final Evaluator lhs, final Evaluator rhs) { + super(lhs, rhs); + } + + @Override + protected boolean compare(final Object lhs, final Object rhs) { + return lhs != null && rhs != null && lhs != rhs && !lhs.equals(rhs) && !lhs.toString().equals(rhs.toString()); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEvaluator.java index 58888d9aea..3343c1c37b 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotEvaluator.java @@ -21,16 +21,17 @@ import java.util.Map; import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; public class NotEvaluator extends BooleanEvaluator { - private final BooleanEvaluator subjectEvaluator; - - public NotEvaluator(final BooleanEvaluator subjectEvaluator) { - this.subjectEvaluator = subjectEvaluator; - } - - @Override - public Boolean evaluate(final Map objectMap) { - final Boolean subjectValue = subjectEvaluator.evaluate(objectMap); - return (subjectValue == null || Boolean.TRUE.equals(subjectValue)); - } + + private final BooleanEvaluator subjectEvaluator; + + public NotEvaluator(final BooleanEvaluator subjectEvaluator) { + this.subjectEvaluator = subjectEvaluator; + } + + @Override + public Boolean evaluate(final Map objectMap) { + final Boolean subjectValue = subjectEvaluator.evaluate(objectMap); + return (subjectValue == null || Boolean.TRUE.equals(subjectValue)); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotNullEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotNullEvaluator.java index a764fef61c..80d6c45b56 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotNullEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/comparison/NotNullEvaluator.java @@ -24,42 +24,43 @@ import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; import org.apache.nifi.hl7.query.evaluator.Evaluator; public class NotNullEvaluator extends BooleanEvaluator { - private final Evaluator subjectEvaluator; - - public NotNullEvaluator(final Evaluator subjectEvaluator) { - this.subjectEvaluator = subjectEvaluator; - } - - @Override - public Boolean evaluate(final Map objectMap) { - Object subjectValue = subjectEvaluator.evaluate(objectMap); - if ( subjectValue == null ) { - return false; - } - - return isNotNull(subjectValue); - } - private boolean isNotNull(Object subjectValue) { - if ( subjectValue instanceof HL7Component ) { - subjectValue = ((HL7Component) subjectValue).getValue(); - } - - if ( subjectValue instanceof Collection ) { - final Collection collection = (Collection) subjectValue; - if ( collection.isEmpty() ) { - return false; - } - - for ( final Object obj : collection ) { - if ( isNotNull(obj) ) { - return true; - } - } - - return false; - } - - return subjectValue != null; - } + private final Evaluator subjectEvaluator; + + public NotNullEvaluator(final Evaluator subjectEvaluator) { + this.subjectEvaluator = subjectEvaluator; + } + + @Override + public Boolean evaluate(final Map objectMap) { + Object subjectValue = subjectEvaluator.evaluate(objectMap); + if (subjectValue == null) { + return false; + } + + return isNotNull(subjectValue); + } + + private boolean isNotNull(Object subjectValue) { + if (subjectValue instanceof HL7Component) { + subjectValue = ((HL7Component) subjectValue).getValue(); + } + + if (subjectValue instanceof Collection) { + final Collection collection = (Collection) subjectValue; + if (collection.isEmpty()) { + return false; + } + + for (final Object obj : collection) { + if (isNotNull(obj)) { + return true; + } + } + + return false; + } + + return subjectValue != null; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/IntegerLiteralEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/IntegerLiteralEvaluator.java index c6ff6e479d..dfceee469e 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/IntegerLiteralEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/IntegerLiteralEvaluator.java @@ -21,16 +21,16 @@ import java.util.Map; import org.apache.nifi.hl7.query.evaluator.IntegerEvaluator; public class IntegerLiteralEvaluator extends IntegerEvaluator { - private final Integer value; - - public IntegerLiteralEvaluator(final Integer value) { - this.value = value; - } - - - @Override - public Integer evaluate(final Map objectMap) { - return value; - } + + private final Integer value; + + public IntegerLiteralEvaluator(final Integer value) { + this.value = value; + } + + @Override + public Integer evaluate(final Map objectMap) { + return value; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/StringLiteralEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/StringLiteralEvaluator.java index 3b296117c9..278ac1d071 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/StringLiteralEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/literal/StringLiteralEvaluator.java @@ -21,15 +21,16 @@ import java.util.Map; import org.apache.nifi.hl7.query.evaluator.StringEvaluator; public class StringLiteralEvaluator extends StringEvaluator { - private final String value; - - public StringLiteralEvaluator(final String value) { - this.value = value; - } - - @Override - public String evaluate(final Map objectMap) { - return value; - } + + private final String value; + + public StringLiteralEvaluator(final String value) { + this.value = value; + } + + @Override + public String evaluate(final Map objectMap) { + return value; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/AndEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/AndEvaluator.java index 21f596e3dc..989cee47af 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/AndEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/AndEvaluator.java @@ -21,23 +21,24 @@ import java.util.Map; import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; public class AndEvaluator extends BooleanEvaluator { - private final BooleanEvaluator lhs; - private final BooleanEvaluator rhs; - - public AndEvaluator(final BooleanEvaluator lhs, final BooleanEvaluator rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - @Override - public Boolean evaluate(final Map objectMap) { - final Boolean lhsValue = lhs.evaluate(objectMap); - if ( lhsValue == null || Boolean.FALSE.equals(lhsValue) ) { - return false; - } - - final Boolean rhsValue = rhs.evaluate(objectMap); - return (rhsValue != null && Boolean.TRUE.equals(rhsValue)); - } + + private final BooleanEvaluator lhs; + private final BooleanEvaluator rhs; + + public AndEvaluator(final BooleanEvaluator lhs, final BooleanEvaluator rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public Boolean evaluate(final Map objectMap) { + final Boolean lhsValue = lhs.evaluate(objectMap); + if (lhsValue == null || Boolean.FALSE.equals(lhsValue)) { + return false; + } + + final Boolean rhsValue = rhs.evaluate(objectMap); + return (rhsValue != null && Boolean.TRUE.equals(rhsValue)); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/OrEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/OrEvaluator.java index d090946da0..e86daad1b4 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/OrEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/logic/OrEvaluator.java @@ -21,23 +21,24 @@ import java.util.Map; import org.apache.nifi.hl7.query.evaluator.BooleanEvaluator; public class OrEvaluator extends BooleanEvaluator { - private final BooleanEvaluator lhs; - private final BooleanEvaluator rhs; - - public OrEvaluator(final BooleanEvaluator lhs, final BooleanEvaluator rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - @Override - public Boolean evaluate(final Map objectMap) { - final Boolean lhsValue = lhs.evaluate(objectMap); - if ( lhsValue != null && Boolean.TRUE.equals(lhsValue) ) { - return true; - } - - final Boolean rhsValue = rhs.evaluate(objectMap); - return (rhsValue != null && Boolean.TRUE.equals(rhsValue)); - } + + private final BooleanEvaluator lhs; + private final BooleanEvaluator rhs; + + public OrEvaluator(final BooleanEvaluator lhs, final BooleanEvaluator rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public Boolean evaluate(final Map objectMap) { + final Boolean lhsValue = lhs.evaluate(objectMap); + if (lhsValue != null && Boolean.TRUE.equals(lhsValue)) { + return true; + } + + final Boolean rhsValue = rhs.evaluate(objectMap); + return (rhsValue != null && Boolean.TRUE.equals(rhsValue)); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DeclaredReferenceEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DeclaredReferenceEvaluator.java index 6afb8d7ec1..bb3f20397e 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DeclaredReferenceEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DeclaredReferenceEvaluator.java @@ -22,21 +22,22 @@ import org.apache.nifi.hl7.query.evaluator.Evaluator; import org.apache.nifi.hl7.query.evaluator.StringEvaluator; public class DeclaredReferenceEvaluator implements Evaluator { - private final StringEvaluator referenceNameEvaluator; - - public DeclaredReferenceEvaluator(final StringEvaluator referenceNameEvaluator) { - this.referenceNameEvaluator = referenceNameEvaluator; - } - - @Override - public Object evaluate(final Map objectMap) { - final String referenceName = referenceNameEvaluator.evaluate(objectMap); - return objectMap.get(referenceName); - } - @Override - public Class getType() { - return Object.class; - } + private final StringEvaluator referenceNameEvaluator; + + public DeclaredReferenceEvaluator(final StringEvaluator referenceNameEvaluator) { + this.referenceNameEvaluator = referenceNameEvaluator; + } + + @Override + public Object evaluate(final Map objectMap) { + final String referenceName = referenceNameEvaluator.evaluate(objectMap); + return objectMap.get(referenceName); + } + + @Override + public Class getType() { + return Object.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DotEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DotEvaluator.java index c5fbf41c54..238b540b8e 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DotEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/DotEvaluator.java @@ -28,61 +28,62 @@ import org.apache.nifi.hl7.query.evaluator.Evaluator; import org.apache.nifi.hl7.query.evaluator.IntegerEvaluator; public class DotEvaluator implements Evaluator { - private final Evaluator lhs; - private final IntegerEvaluator rhs; - - public DotEvaluator(final Evaluator lhs, final IntegerEvaluator rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - @Override - public Object evaluate(final Map objectMap) { - final Object lhsValue = this.lhs.evaluate(objectMap); - final Integer rhsValue = this.rhs.evaluate(objectMap); - - if ( lhsValue == null || rhsValue == null ) { - return null; - } - - final List results = new ArrayList<>(); - if ( lhsValue instanceof Collection ) { - final Collection lhsCollection = (Collection) lhsValue; - for ( final Object obj : lhsCollection ) { - final Object val = getValue(obj, rhsValue); - results.add(val); - } - } else { - final Object val = getValue(lhsValue, rhsValue); - return val; - } - - return results; - } - - private Object getValue(final Object lhsValue, final int rhsValue) { - final List list; - if ( lhsValue instanceof HL7Message ) { - list = ((HL7Message) lhsValue).getSegments(); - } else if ( lhsValue instanceof HL7Segment ) { - list = ((HL7Segment) lhsValue).getFields(); - } else if ( lhsValue instanceof HL7Component ) { - list = ((HL7Component) lhsValue).getComponents(); - } else { - return null; - } - - if ( rhsValue > list.size() ) { - return null; - } - - // convert from 0-based to 1-based - return list.get(rhsValue - 1); - } - @Override - public Class getType() { - return Object.class; - } + private final Evaluator lhs; + private final IntegerEvaluator rhs; + + public DotEvaluator(final Evaluator lhs, final IntegerEvaluator rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + public Object evaluate(final Map objectMap) { + final Object lhsValue = this.lhs.evaluate(objectMap); + final Integer rhsValue = this.rhs.evaluate(objectMap); + + if (lhsValue == null || rhsValue == null) { + return null; + } + + final List results = new ArrayList<>(); + if (lhsValue instanceof Collection) { + final Collection lhsCollection = (Collection) lhsValue; + for (final Object obj : lhsCollection) { + final Object val = getValue(obj, rhsValue); + results.add(val); + } + } else { + final Object val = getValue(lhsValue, rhsValue); + return val; + } + + return results; + } + + private Object getValue(final Object lhsValue, final int rhsValue) { + final List list; + if (lhsValue instanceof HL7Message) { + list = ((HL7Message) lhsValue).getSegments(); + } else if (lhsValue instanceof HL7Segment) { + list = ((HL7Segment) lhsValue).getFields(); + } else if (lhsValue instanceof HL7Component) { + list = ((HL7Component) lhsValue).getComponents(); + } else { + return null; + } + + if (rhsValue > list.size()) { + return null; + } + + // convert from 0-based to 1-based + return list.get(rhsValue - 1); + } + + @Override + public Class getType() { + return Object.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/FieldEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/FieldEvaluator.java index 869c2d0783..bc8046ed00 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/FieldEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/FieldEvaluator.java @@ -28,40 +28,41 @@ import org.apache.nifi.hl7.query.evaluator.IntegerEvaluator; @SuppressWarnings("rawtypes") public class FieldEvaluator implements Evaluator { - private final SegmentEvaluator segmentEvaluator; - private final IntegerEvaluator indexEvaluator; - - public FieldEvaluator(final SegmentEvaluator segmentEvaluator, final IntegerEvaluator indexEvaluator) { - this.segmentEvaluator = segmentEvaluator; - this.indexEvaluator = indexEvaluator; - } - - public List evaluate(final Map objectMap) { - final List segments = segmentEvaluator.evaluate(objectMap); - if ( segments == null ) { - return Collections.emptyList(); - } - - final Integer index = indexEvaluator.evaluate(objectMap); - if ( index == null ) { - return Collections.emptyList(); - } - - final List fields = new ArrayList<>(); - for ( final HL7Segment segment : segments ) { - final List segmentFields = segment.getFields(); - if ( segmentFields.size() <= index ) { - continue; - } - - fields.add(segmentFields.get(index)); - } - - return fields; - } - public Class getType() { - return List.class; - } + private final SegmentEvaluator segmentEvaluator; + private final IntegerEvaluator indexEvaluator; + + public FieldEvaluator(final SegmentEvaluator segmentEvaluator, final IntegerEvaluator indexEvaluator) { + this.segmentEvaluator = segmentEvaluator; + this.indexEvaluator = indexEvaluator; + } + + public List evaluate(final Map objectMap) { + final List segments = segmentEvaluator.evaluate(objectMap); + if (segments == null) { + return Collections.emptyList(); + } + + final Integer index = indexEvaluator.evaluate(objectMap); + if (index == null) { + return Collections.emptyList(); + } + + final List fields = new ArrayList<>(); + for (final HL7Segment segment : segments) { + final List segmentFields = segment.getFields(); + if (segmentFields.size() <= index) { + continue; + } + + fields.add(segmentFields.get(index)); + } + + return fields; + } + + public Class getType() { + return List.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java index 5e08961954..f430b505e8 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/MessageEvaluator.java @@ -23,12 +23,12 @@ import org.apache.nifi.hl7.query.evaluator.Evaluator; public class MessageEvaluator implements Evaluator { - public HL7Message evaluate(final Map objectMap) { - return (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); - } + public HL7Message evaluate(final Map objectMap) { + return (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); + } - public Class getType() { - return HL7Message.class; - } + public Class getType() { + return HL7Message.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java index 1b9782d0e6..9840461c8b 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/evaluator/message/SegmentEvaluator.java @@ -27,25 +27,26 @@ import org.apache.nifi.hl7.query.evaluator.StringEvaluator; @SuppressWarnings("rawtypes") public class SegmentEvaluator implements Evaluator { - private final StringEvaluator segmentTypeEvaluator; - - public SegmentEvaluator(final StringEvaluator segmentTypeEvaluator) { - this.segmentTypeEvaluator = segmentTypeEvaluator; - } - - public List evaluate(final Map objectMap) { - final String segmentType = segmentTypeEvaluator.evaluate(objectMap); - if ( segmentType == null ) { - return Collections.emptyList(); - } - - final HL7Message message = (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); - final List segments = message.getSegments(segmentType); - return (segments == null) ? Collections.emptyList() : segments; - } - public Class getType() { - return List.class; - } + private final StringEvaluator segmentTypeEvaluator; + + public SegmentEvaluator(final StringEvaluator segmentTypeEvaluator) { + this.segmentTypeEvaluator = segmentTypeEvaluator; + } + + public List evaluate(final Map objectMap) { + final String segmentType = segmentTypeEvaluator.evaluate(objectMap); + if (segmentType == null) { + return Collections.emptyList(); + } + + final HL7Message message = (HL7Message) objectMap.get(Evaluator.MESSAGE_KEY); + final List segments = message.getSegments(segmentType); + return (segments == null) ? Collections.emptyList() : segments; + } + + public Class getType() { + return List.class; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/exception/HL7QueryParsingException.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/exception/HL7QueryParsingException.java index 998f3bc87c..e27dd58164 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/exception/HL7QueryParsingException.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/exception/HL7QueryParsingException.java @@ -17,21 +17,22 @@ package org.apache.nifi.hl7.query.exception; public class HL7QueryParsingException extends RuntimeException { - private static final long serialVersionUID = 1L; - public HL7QueryParsingException() { - super(); - } - - public HL7QueryParsingException(final Throwable cause) { - super(cause); - } - - public HL7QueryParsingException(final String message) { - super(message); - } - - public HL7QueryParsingException(final String message, final Throwable cause) { - super(message, cause); - } + private static final long serialVersionUID = 1L; + + public HL7QueryParsingException() { + super(); + } + + public HL7QueryParsingException(final Throwable cause) { + super(cause); + } + + public HL7QueryParsingException(final String message) { + super(message); + } + + public HL7QueryParsingException(final String message, final Throwable cause) { + super(message, cause); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/MissedResult.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/MissedResult.java index a6b36c8621..1043ab6df1 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/MissedResult.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/MissedResult.java @@ -24,33 +24,34 @@ import org.apache.nifi.hl7.query.ResultHit; import org.apache.nifi.hl7.query.Selection; public class MissedResult implements QueryResult { - private final List selections; - - public MissedResult(final List selections) { - this.selections = selections; - } - - @Override - public List getLabels() { - final List labels = new ArrayList<>(); - for ( final Selection selection : selections ) { - labels.add(selection.getName()); - } - return labels; - } - @Override - public boolean isMatch() { - return false; - } + private final List selections; - @Override - public ResultHit nextHit() { - return null; - } - - @Override - public int getHitCount() { - return 0; - } + public MissedResult(final List selections) { + this.selections = selections; + } + + @Override + public List getLabels() { + final List labels = new ArrayList<>(); + for (final Selection selection : selections) { + labels.add(selection.getName()); + } + return labels; + } + + @Override + public boolean isMatch() { + return false; + } + + @Override + public ResultHit nextHit() { + return null; + } + + @Override + public int getHitCount() { + return 0; + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardQueryResult.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardQueryResult.java index fbc16cab4c..bcba697136 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardQueryResult.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardQueryResult.java @@ -27,43 +27,44 @@ import org.apache.nifi.hl7.query.ResultHit; import org.apache.nifi.hl7.query.Selection; public class StandardQueryResult implements QueryResult { - private final List selections; - private final Set> hits; - private final Iterator> hitIterator; - - public StandardQueryResult(final List selections, final Set> hits) { - this.selections = selections; - this.hits = hits; - - hitIterator = hits.iterator(); - } - - @Override - public boolean isMatch() { - return !hits.isEmpty(); - } - @Override - public List getLabels() { - final List labels = new ArrayList<>(); - for ( final Selection selection : selections ) { - labels.add(selection.getName()); - } - return labels; - } + private final List selections; + private final Set> hits; + private final Iterator> hitIterator; + + public StandardQueryResult(final List selections, final Set> hits) { + this.selections = selections; + this.hits = hits; + + hitIterator = hits.iterator(); + } + + @Override + public boolean isMatch() { + return !hits.isEmpty(); + } + + @Override + public List getLabels() { + final List labels = new ArrayList<>(); + for (final Selection selection : selections) { + labels.add(selection.getName()); + } + return labels; + } + + @Override + public int getHitCount() { + return hits.size(); + } + + @Override + public ResultHit nextHit() { + if (hitIterator.hasNext()) { + return new StandardResultHit(hitIterator.next()); + } else { + return null; + } + } - @Override - public int getHitCount() { - return hits.size(); - } - - @Override - public ResultHit nextHit() { - if ( hitIterator.hasNext() ) { - return new StandardResultHit(hitIterator.next()); - } else { - return null; - } - } - } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardResultHit.java b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardResultHit.java index 944e998173..7fe92050f5 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardResultHit.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/result/StandardResultHit.java @@ -22,20 +22,21 @@ import java.util.Map; import org.apache.nifi.hl7.query.ResultHit; public class StandardResultHit implements ResultHit { - private final Map values; - - public StandardResultHit(final Map values) { - this.values = values; - } - - @Override - public Object getValue(final String label) { - return values.get(label); - } - @Override - public Map getSelectedValues() { - return Collections.unmodifiableMap(values); - } + private final Map values; + + public StandardResultHit(final Map values) { + this.values = values; + } + + @Override + public Object getValue(final String label) { + return values.get(label); + } + + @Override + public Map getSelectedValues() { + return Collections.unmodifiableMap(values); + } } diff --git a/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java b/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java index 596440c380..f78f82b40c 100644 --- a/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java +++ b/nifi/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java @@ -43,268 +43,264 @@ import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; @SuppressWarnings("resource") public class TestHL7Query { - @Test - public void testAssignAliases() { - final LinkedHashMap> possibleValueMap = new LinkedHashMap<>(); - - final List valuesA = new ArrayList<>(); - valuesA.add("a"); - valuesA.add("b"); - valuesA.add("c"); - - final List valuesB = new ArrayList<>(); - valuesB.add("d"); - - final List valuesC = new ArrayList<>(); - valuesC.add("e"); - valuesC.add("f"); - - final List valuesD = new ArrayList<>(); - valuesD.add("g"); - valuesD.add("h"); - - possibleValueMap.put("A", valuesA); - possibleValueMap.put("B", valuesB); - possibleValueMap.put("C", valuesC); - possibleValueMap.put("D", valuesD); - - for (int i=0; i < valuesA.size() * valuesB.size() * valuesC.size() * valuesD.size(); i++) { - System.out.println(i + " : " + HL7Query.assignAliases(possibleValueMap, i)); - } - - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 0), "a", "d", "e", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 1), "b", "d", "e", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 2), "c", "d", "e", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 3), "a", "d", "f", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 4), "b", "d", "f", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 5), "c", "d", "f", "g"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 6), "a", "d", "e", "h"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 7), "b", "d", "e", "h"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 8), "c", "d", "e", "h"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 9), "a", "d", "f", "h"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 10), "b", "d", "f", "h"); - verifyAssignments(HL7Query.assignAliases(possibleValueMap, 11), "c", "d", "f", "h"); - } - - private void verifyAssignments(final Map map, final String a, final String b, final String c, final String d) { - assertEquals(a, map.get("A")); - assertEquals(b, map.get("B")); - assertEquals(c, map.get("C")); - assertEquals(d, map.get("D")); - } - - @Test - public void testSelectMessage() throws HL7Exception, IOException { - final HL7Query query = HL7Query.compile("SELECT MESSAGE"); - final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); - final QueryResult result = query.evaluate(msg); - assertTrue(result.isMatch()); - final List labels = result.getLabels(); - assertEquals(1, labels.size()); - assertEquals("MESSAGE", labels.get(0)); - - assertEquals(1, result.getHitCount()); - assertEquals(msg, result.nextHit().getValue("MESSAGE")); - } - - @Test - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void testSelectField() throws HL7Exception, IOException { - final HL7Query query = HL7Query.compile("SELECT PID.5"); - final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); - final QueryResult result = query.evaluate(msg); - assertTrue(result.isMatch()); - final List labels = result.getLabels(); - assertEquals(1, labels.size()); - assertEquals(1, result.getHitCount()); - - final Object names = result.nextHit().getValue("PID.5"); - assertTrue(names instanceof List); - final List nameList = (List) names; - assertEquals(1, nameList.size()); - final HL7Field nameField = (HL7Field) nameList.get(0); - assertEquals("SMITH^JOHN", nameField.getValue()); - } - - @Test - public void testSelectAbnormalTestResult() throws HL7Exception, IOException { - final String query = "DECLARE result AS REQUIRED OBX SELECT result WHERE result.7 != 'N' AND result.1 = 1"; - - final HL7Query hl7Query = HL7Query.compile(query); - final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - } - - - @Test - public void testFieldEqualsString() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L'"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H'"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - @Test - public void testLessThan() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < 600"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < 59"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - @Test - public void testCompareTwoFields() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < result.6.2"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE NOT(result.4 > result.6.3)"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - @Test - public void testLessThanOrEqual() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 59"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + @Test + public void testAssignAliases() { + final LinkedHashMap> possibleValueMap = new LinkedHashMap<>(); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 600"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + final List valuesA = new ArrayList<>(); + valuesA.add("a"); + valuesA.add("b"); + valuesA.add("c"); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 58"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - @Test - public void testGreaterThanOrEqual() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 59"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + final List valuesB = new ArrayList<>(); + valuesB.add("d"); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 6"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + final List valuesC = new ArrayList<>(); + valuesC.add("e"); + valuesC.add("f"); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 580"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - @Test - public void testGreaterThan() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 58"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + final List valuesD = new ArrayList<>(); + valuesD.add("g"); + valuesD.add("h"); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 6"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); + possibleValueMap.put("A", valuesA); + possibleValueMap.put("B", valuesB); + possibleValueMap.put("C", valuesC); + possibleValueMap.put("D", valuesD); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 580"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } + for (int i = 0; i < valuesA.size() * valuesB.size() * valuesC.size() * valuesD.size(); i++) { + System.out.println(i + " : " + HL7Query.assignAliases(possibleValueMap, i)); + } - - @Test - public void testDistinctValuesReturned() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result1 AS REQUIRED OBX, result2 AS REQUIRED OBX SELECT MESSAGE WHERE result1.7 = 'L' OR result2.7 != 'H'"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - assertEquals(1, result.getHitCount()); - } - - @Test - public void testAndWithParens() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L' AND result.3.1 = 'GLU'"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L' AND result.3.1 = 'GLU'"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); - assertFalse( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H' AND result.3.1 = 'GLU'"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 0), "a", "d", "e", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 1), "b", "d", "e", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 2), "c", "d", "e", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 3), "a", "d", "f", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 4), "b", "d", "f", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 5), "c", "d", "f", "g"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 6), "a", "d", "e", "h"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 7), "b", "d", "e", "h"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 8), "c", "d", "e", "h"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 9), "a", "d", "f", "h"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 10), "b", "d", "f", "h"); + verifyAssignments(HL7Query.assignAliases(possibleValueMap, 11), "c", "d", "f", "h"); + } - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H' AND result.3.1 = 'GLU'"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); - assertTrue( result.isMatch() ); + private void verifyAssignments(final Map map, final String a, final String b, final String c, final String d) { + assertEquals(a, map.get("A")); + assertEquals(b, map.get("B")); + assertEquals(c, map.get("C")); + assertEquals(d, map.get("D")); + } - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE (result.7 = 'H') AND (result.3.1 = 'GLU')"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); - assertTrue( result.isMatch() ); + @Test + public void testSelectMessage() throws HL7Exception, IOException { + final HL7Query query = HL7Query.compile("SELECT MESSAGE"); + final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); + final QueryResult result = query.evaluate(msg); + assertTrue(result.isMatch()); + final List labels = result.getLabels(); + assertEquals(1, labels.size()); + assertEquals("MESSAGE", labels.get(0)); - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE ((result.7 = 'H') AND (result.3.1 = 'GLU'))"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); - assertTrue( result.isMatch() ); + assertEquals(1, result.getHitCount()); + assertEquals(msg, result.nextHit().getValue("MESSAGE")); + } - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE (( ((result.7 = 'H')) AND ( ((result.3.1 = 'GLU')) )))"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); - assertTrue( result.isMatch() ); + @Test + @SuppressWarnings({"unchecked", "rawtypes"}) + public void testSelectField() throws HL7Exception, IOException { + final HL7Query query = HL7Query.compile("SELECT PID.5"); + final HL7Message msg = createMessage(new File("src/test/resources/hypoglycemia")); + final QueryResult result = query.evaluate(msg); + assertTrue(result.isMatch()); + final List labels = result.getLabels(); + assertEquals(1, labels.size()); + assertEquals(1, result.getHitCount()); + + final Object names = result.nextHit().getValue("PID.5"); + assertTrue(names instanceof List); + final List nameList = (List) names; + assertEquals(1, nameList.size()); + final HL7Field nameField = (HL7Field) nameList.get(0); + assertEquals("SMITH^JOHN", nameField.getValue()); + } + + @Test + public void testSelectAbnormalTestResult() throws HL7Exception, IOException { + final String query = "DECLARE result AS REQUIRED OBX SELECT result WHERE result.7 != 'N' AND result.1 = 1"; + + final HL7Query hl7Query = HL7Query.compile(query); + final QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + } + + @Test + public void testFieldEqualsString() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L'"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H'"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testLessThan() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < 600"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < 59"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testCompareTwoFields() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 < result.6.2"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE NOT(result.4 > result.6.3)"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testLessThanOrEqual() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 59"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 600"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 <= 58"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testGreaterThanOrEqual() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 59"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 6"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 >= 580"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testGreaterThan() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 58"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 6"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.4 > 580"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testDistinctValuesReturned() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result1 AS REQUIRED OBX, result2 AS REQUIRED OBX SELECT MESSAGE WHERE result1.7 = 'L' OR result2.7 != 'H'"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + assertEquals(1, result.getHitCount()); + } + + @Test + public void testAndWithParens() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L' AND result.3.1 = 'GLU'"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'L' AND result.3.1 = 'GLU'"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); + assertFalse(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H' AND result.3.1 = 'GLU'"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.7 = 'H' AND result.3.1 = 'GLU'"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE (result.7 = 'H') AND (result.3.1 = 'GLU')"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE ((result.7 = 'H') AND (result.3.1 = 'GLU'))"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE (( ((result.7 = 'H')) AND ( ((result.3.1 = 'GLU')) )))"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hyperglycemia"))); + assertTrue(result.isMatch()); + + } + + @Test + public void testIsNull() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.999 IS NULL"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.1 IS NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + + hl7Query = HL7Query.compile("SELECT MESSAGE WHERE ZZZ IS NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX IS NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + } + + @Test + public void testNotNull() throws HL7Exception, IOException { + HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.999 NOT NULL"); + QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + + hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.1 NOT NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + + hl7Query = HL7Query.compile("SELECT MESSAGE WHERE ZZZ NOT NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertFalse(result.isMatch()); + + hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX NOT NULL"); + result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); + assertTrue(result.isMatch()); + } + + private HL7Message createMessage(final File file) throws HL7Exception, IOException { + final byte[] bytes = Files.readAllBytes(file.toPath()); + final String msgText = new String(bytes, "UTF-8"); + + final HapiContext hapiContext = new DefaultHapiContext(); + hapiContext.setValidationContext(ValidationContextFactory.noValidation()); + + final PipeParser parser = hapiContext.getPipeParser(); + final Message message = parser.parse(msgText); + return new HapiMessage(message); + } - } - - - @Test - public void testIsNull() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.999 IS NULL"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.1 IS NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE ZZZ IS NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX IS NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - } - - - @Test - public void testNotNull() throws HL7Exception, IOException { - HL7Query hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.999 NOT NULL"); - QueryResult result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - - hl7Query = HL7Query.compile("DECLARE result AS REQUIRED OBX SELECT MESSAGE WHERE result.1 NOT NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE ZZZ NOT NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertFalse( result.isMatch() ); - - hl7Query = HL7Query.compile("SELECT MESSAGE WHERE OBX NOT NULL"); - result = hl7Query.evaluate(createMessage(new File("src/test/resources/hypoglycemia"))); - assertTrue( result.isMatch() ); - } - - private HL7Message createMessage(final File file) throws HL7Exception, IOException { - final byte[] bytes = Files.readAllBytes(file.toPath()); - final String msgText = new String(bytes, "UTF-8"); - - final HapiContext hapiContext = new DefaultHapiContext(); - hapiContext.setValidationContext(ValidationContextFactory.noValidation()); - - final PipeParser parser = hapiContext.getPipeParser(); - final Message message = parser.parse(msgText); - return new HapiMessage(message); - } - } diff --git a/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index 3b427a77ae..4e3a502ede 100644 --- a/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/nifi/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -360,7 +360,7 @@ public class NiFiProperties extends Properties { /** * The socket port to listen on for a Remote Input Port. * - * @return + * @return the remote input port */ public Integer getRemoteInputPort() { return getPropertyAsPort(REMOTE_INPUT_PORT, DEFAULT_REMOTE_INPUT_PORT); @@ -383,7 +383,7 @@ public class NiFiProperties extends Properties { /** * Returns the directory to which Templates are to be persisted * - * @return + * @return the template directory */ public Path getTemplateDirectory() { final String strVal = getProperty(TEMPLATE_DIRECTORY); @@ -414,7 +414,7 @@ public class NiFiProperties extends Properties { * Returns the number of partitions that should be used for the FlowFile * Repository * - * @return + * @return the number of partitions */ public int getFlowFileRepositoryPartitions() { final String rawProperty = getProperty(FLOWFILE_REPOSITORY_PARTITIONS, DEFAULT_FLOWFILE_REPO_PARTITIONS); @@ -425,7 +425,7 @@ public class NiFiProperties extends Properties { * Returns the number of milliseconds between FlowFileRepository * checkpointing * - * @return + * @return the number of milliseconds between checkpoint events */ public String getFlowFileRepositoryCheckpointInterval() { return getProperty(FLOWFILE_REPOSITORY_CHECKPOINT_INTERVAL, DEFAULT_FLOWFILE_CHECKPOINT_INTERVAL); @@ -504,7 +504,7 @@ public class NiFiProperties extends Properties { public int getWebThreads() { return getIntegerProperty(WEB_THREADS, DEFAULT_WEB_THREADS); } - + public File getWebWorkingDirectory() { return new File(getProperty(WEB_WORKING_DIR, DEFAULT_WEB_WORKING_DIR)); } @@ -551,7 +551,7 @@ public class NiFiProperties extends Properties { /** * Returns the auto refresh interval in seconds. * - * @return + * @return the interval over which the properties should auto refresh */ public String getAutoRefreshInterval() { return getProperty(UI_AUTO_REFRESH_INTERVAL); @@ -829,7 +829,7 @@ public class NiFiProperties extends Properties { * values configured. No directories will be created as a result of this * operation. * - * @return + * @return the name and paths of all provenance repository locations */ public Map getProvenanceRepositoryPaths() { final Map provenanceRepositoryPaths = new HashMap<>(); diff --git a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/CertificateUtils.java b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/CertificateUtils.java index 087d891d29..51269335ed 100644 --- a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/CertificateUtils.java +++ b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/CertificateUtils.java @@ -36,10 +36,11 @@ public final class CertificateUtils { /** * Returns true if the given keystore can be loaded using the given keystore * type and password. Returns false otherwise. - * @param keystore - * @param keystoreType - * @param password - * @return + * + * @param keystore the keystore to validate + * @param keystoreType the type of the keystore + * @param password the password to access the keystore + * @return true if valid; false otherwise */ public static boolean isStoreValid(final URL keystore, final KeystoreType keystoreType, final char[] password) { @@ -81,8 +82,8 @@ public final class CertificateUtils { * returned. If the CN cannot be extracted because the DN is in an * unrecognized format, the entire DN is returned. * - * @param dn - * @return + * @param dn the dn to extract the username from + * @return the exatracted username */ public static String extractUsername(String dn) { String username = dn; @@ -135,11 +136,11 @@ public final class CertificateUtils { final List result = new ArrayList<>(); for (final List generalName : altNames) { - /* - * generalName has the name type as the first element a String or - * byte array for the second element. We return any general names + /** + * generalName has the name type as the first element a String or + * byte array for the second element. We return any general names * that are String types. - * + * * We don't inspect the numeric name type because some certificates * incorrectly put IPs and DNS names under the wrong name types. */ diff --git a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SecurityStoreTypes.java b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SecurityStoreTypes.java index 9abfcc3ccd..f448312ff4 100644 --- a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SecurityStoreTypes.java +++ b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SecurityStoreTypes.java @@ -100,12 +100,12 @@ public enum SecurityStoreTypes { /** * Creates an instance. * - * @param storeProperty the Java system property for setting the keystore ( - * or truststore) path + * @param storeProperty the Java system property for setting the keystore or + * truststore path * @param storePasswordProperty the Java system property for setting the - * keystore (or truststore) password + * keystore or truststore path * @param storeTypeProperty the Java system property for setting the - * keystore (or truststore) type + * keystore or truststore type */ SecurityStoreTypes(final String storeProperty, final String storePasswordProperty, diff --git a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SslContextFactory.java b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SslContextFactory.java index 2371b0c138..aae87609f2 100644 --- a/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SslContextFactory.java +++ b/nifi/nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/SslContextFactory.java @@ -60,12 +60,12 @@ public final class SslContextFactory { * @param clientAuth the type of client authentication * * @return a SSLContext instance - * @throws java.security.KeyStoreException - * @throws java.io.IOException - * @throws java.security.NoSuchAlgorithmException - * @throws java.security.cert.CertificateException - * @throws java.security.UnrecoverableKeyException - * @throws java.security.KeyManagementException + * @throws java.security.KeyStoreException if any issues accessing the keystore + * @throws java.io.IOException for any problems loading the keystores + * @throws java.security.NoSuchAlgorithmException if an algorithm is found to be used but is unknown + * @throws java.security.cert.CertificateException if there is an issue with the certificate + * @throws java.security.UnrecoverableKeyException if the key is insufficient + * @throws java.security.KeyManagementException if unable to manage the key */ public static SSLContext createSslContext( final String keystore, final char[] keystorePasswd, final String keystoreType, @@ -113,12 +113,12 @@ public final class SslContextFactory { * @param keystoreType the type of keystore (e.g., PKCS12, JKS) * * @return a SSLContext instance - * @throws java.security.KeyStoreException - * @throws java.io.IOException - * @throws java.security.NoSuchAlgorithmException - * @throws java.security.cert.CertificateException - * @throws java.security.UnrecoverableKeyException - * @throws java.security.KeyManagementException + * @throws java.security.KeyStoreException if any issues accessing the keystore + * @throws java.io.IOException for any problems loading the keystores + * @throws java.security.NoSuchAlgorithmException if an algorithm is found to be used but is unknown + * @throws java.security.cert.CertificateException if there is an issue with the certificate + * @throws java.security.UnrecoverableKeyException if the key is insufficient + * @throws java.security.KeyManagementException if unable to manage the key */ public static SSLContext createSslContext( final String keystore, final char[] keystorePasswd, final String keystoreType) @@ -149,12 +149,12 @@ public final class SslContextFactory { * @param truststoreType the type of truststore (e.g., PKCS12, JKS) * * @return a SSLContext instance - * @throws java.security.KeyStoreException - * @throws java.io.IOException - * @throws java.security.NoSuchAlgorithmException - * @throws java.security.cert.CertificateException - * @throws java.security.UnrecoverableKeyException - * @throws java.security.KeyManagementException + * @throws java.security.KeyStoreException if any issues accessing the keystore + * @throws java.io.IOException for any problems loading the keystores + * @throws java.security.NoSuchAlgorithmException if an algorithm is found to be used but is unknown + * @throws java.security.cert.CertificateException if there is an issue with the certificate + * @throws java.security.UnrecoverableKeyException if the key is insufficient + * @throws java.security.KeyManagementException if unable to manage the key */ public static SSLContext createTrustSslContext( final String truststore, final char[] truststorePasswd, final String truststoreType) diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/CoreAttributes.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/CoreAttributes.java index 24f43ca587..b0f40481d6 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/CoreAttributes.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/CoreAttributes.java @@ -17,53 +17,50 @@ package org.apache.nifi.flowfile.attributes; public enum CoreAttributes implements FlowFileAttributeKey { + /** - * The flowfile's path indicates the relative directory to which a FlowFile belongs and does not - * contain the filename + * The flowfile's path indicates the relative directory to which a FlowFile + * belongs and does not contain the filename */ PATH("path"), - /** - * The flowfile's absolute path indicates the absolute directory to which a FlowFile belongs and does not - * contain the filename + * The flowfile's absolute path indicates the absolute directory to which a + * FlowFile belongs and does not contain the filename */ ABSOLUTE_PATH("absolute.path"), - /** - * The filename of the FlowFile. The filename should not contain any directory structure. + * The filename of the FlowFile. The filename should not contain any + * directory structure. */ FILENAME("filename"), - /** * A unique UUID assigned to this FlowFile */ UUID("uuid"), - /** * A numeric value indicating the FlowFile priority */ PRIORITY("priority"), - /** * The MIME Type of this FlowFile */ MIME_TYPE("mime.type"), - /** * Specifies the reason that a FlowFile is being discarded */ DISCARD_REASON("discard.reason"), - /** - * Indicates an identifier other than the FlowFile's UUID that is known to refer to this FlowFile. + * Indicates an identifier other than the FlowFile's UUID that is known to + * refer to this FlowFile. */ ALTERNATE_IDENTIFIER("alternate.identifier"); - + private final String key; + private CoreAttributes(final String key) { this.key = key; } - + @Override public String key() { return key; diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/FlowFileAttributeKey.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/FlowFileAttributeKey.java index cc6c28ebaa..963763108a 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/FlowFileAttributeKey.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/flowfile/attributes/FlowFileAttributeKey.java @@ -17,5 +17,6 @@ package org.apache.nifi.flowfile.attributes; public interface FlowFileAttributeKey { + String key(); } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/VersionNegotiator.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/VersionNegotiator.java index 74f9b3dbdf..a05ea9de65 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/VersionNegotiator.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/VersionNegotiator.java @@ -29,7 +29,7 @@ public interface VersionNegotiator { * Sets the version of this resource to the specified version. Only the * lower byte of the version is relevant. * - * @param version + * @param version the version to set * @throws IllegalArgumentException if the given Version is not supported by * this resource, as is indicated by the {@link #isVersionSupported(int)} * method @@ -47,8 +47,8 @@ public interface VersionNegotiator { * given maxVersion. If no acceptable version exists that is less than * maxVersion, then null is returned * - * @param maxVersion - * @return + * @param maxVersion the maximum version desired + * @return the preferred version if found; null otherwise */ Integer getPreferredVersion(int maxVersion); @@ -56,8 +56,8 @@ public interface VersionNegotiator { * Indicates whether or not the specified version is supported by this * resource * - * @param version - * @return + * @param version the version to test + * @return true if supported; false otherwise */ boolean isVersionSupported(int version); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionInputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionInputStream.java index d953185f90..6434b2d3a2 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionInputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionInputStream.java @@ -73,7 +73,7 @@ public class CompressionInputStream extends InputStream { fillBuffer(fourByteBuffer); compressedBuffer = new byte[toInt(fourByteBuffer)]; - bufferIndex = buffer.length; // indicate that buffer is empty + bufferIndex = buffer.length; // indicate that buffer is empty } private int toInt(final byte[] data) { @@ -175,7 +175,8 @@ public class CompressionInputStream extends InputStream { /** * Does nothing. Does NOT close underlying InputStream - * @throws java.io.IOException + * + * @throws java.io.IOException for any issues closing underlying stream */ @Override public void close() throws IOException { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionOutputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionOutputStream.java index bc46b0ff7b..311c84c531 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionOutputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/CompressionOutputStream.java @@ -61,7 +61,7 @@ public class CompressionOutputStream extends OutputStream { * Compresses the currently buffered chunk of data and sends it to the * output stream * - * @throws IOException + * @throws IOException if issues occur writing to stream */ protected void compressAndWrite() throws IOException { if (bufferIndex <= 0) { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/BufferStateManager.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/BufferStateManager.java index 68913bdc85..e613155183 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/BufferStateManager.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/BufferStateManager.java @@ -42,7 +42,7 @@ public class BufferStateManager { * resizing the buffer if necessary. This operation MAY change the direction * of the buffer. * - * @param requiredSize + * @param requiredSize the desired size of the buffer */ public void ensureSize(final int requiredSize) { if (buffer.capacity() < requiredSize) { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelInputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelInputStream.java index 0ad0b74a43..1ec229df40 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelInputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelInputStream.java @@ -43,17 +43,17 @@ public class SocketChannelInputStream extends InputStream { public void setTimeout(final int timeoutMillis) { this.timeoutMillis = timeoutMillis; } - + public void consume() throws IOException { channel.shutdownInput(); - + final byte[] b = new byte[4096]; final ByteBuffer buffer = ByteBuffer.wrap(b); int bytesRead; do { bytesRead = channel.read(buffer); buffer.flip(); - } while ( bytesRead > 0 ); + } while (bytesRead > 0); } @Override @@ -160,7 +160,8 @@ public class SocketChannelInputStream extends InputStream { /** * Closes the underlying socket channel. - * @throws java.io.IOException + * + * @throws java.io.IOException for issues closing underlying stream */ @Override public void close() throws IOException { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelOutputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelOutputStream.java index 77049ad1ad..a56d9dd20c 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelOutputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/SocketChannelOutputStream.java @@ -104,7 +104,8 @@ public class SocketChannelOutputStream extends OutputStream { /** * Closes the underlying SocketChannel - * @throws java.io.IOException + * + * @throws java.io.IOException if issues closing underlying stream */ @Override public void close() throws IOException { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannel.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannel.java index 249ad483fe..1f23d790a2 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannel.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannel.java @@ -260,7 +260,7 @@ public class SSLSocketChannel implements Closeable { public void consume() throws IOException { channel.shutdownInput(); - + final byte[] b = new byte[4096]; final ByteBuffer buffer = ByteBuffer.wrap(b); int readCount; @@ -269,7 +269,7 @@ public class SSLSocketChannel implements Closeable { buffer.flip(); } while (readCount > 0); } - + private int readData(final ByteBuffer dest) throws IOException { final long startTime = System.currentTimeMillis(); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannelInputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannelInputStream.java index 6fb79d42ae..19179bcdf1 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannelInputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/remote/io/socket/ssl/SSLSocketChannelInputStream.java @@ -30,7 +30,7 @@ public class SSLSocketChannelInputStream extends InputStream { public void consume() throws IOException { channel.consume(); } - + @Override public int read() throws IOException { return channel.read(); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteArrayOutputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteArrayOutputStream.java index 459563b967..bbc5cee49c 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteArrayOutputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteArrayOutputStream.java @@ -98,8 +98,7 @@ public class ByteArrayOutputStream extends OutputStream { newCapacity = minCapacity; } if (newCapacity < 0) { - if (minCapacity < 0) // overflow - { + if (minCapacity < 0) { // overflow throw new OutOfMemoryError(); } newCapacity = Integer.MAX_VALUE; @@ -170,8 +169,7 @@ public class ByteArrayOutputStream extends OutputStream { * @return the current contents of this output stream, as a byte array. * @see java.io.ByteArrayOutputStream#size() */ - public byte toByteArray () - [] { + public byte[] toByteArray() { return Arrays.copyOf(buf, count); } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingOutputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingOutputStream.java index d8e1a42254..3e3e3fe96d 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingOutputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/ByteCountingOutputStream.java @@ -39,8 +39,6 @@ public class ByteCountingOutputStream extends OutputStream { write(b, 0, b.length); } - ; - @Override public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LeakyBucketStreamThrottler.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LeakyBucketStreamThrottler.java index ae075b5e30..ac6322d202 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LeakyBucketStreamThrottler.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LeakyBucketStreamThrottler.java @@ -104,7 +104,7 @@ public class LeakyBucketStreamThrottler implements StreamThrottler { @Override public int read(final byte[] b) throws IOException { - if(b.length == 0){ + if (b.length == 0) { return 0; } return read(b, 0, b.length); @@ -112,13 +112,13 @@ public class LeakyBucketStreamThrottler implements StreamThrottler { @Override public int read(byte[] b, int off, int len) throws IOException { - if ( len < 0 ) { + if (len < 0) { throw new IllegalArgumentException(); } - if ( len == 0 ) { + if (len == 0) { return 0; } - + baos.reset(); final int copied = (int) LeakyBucketStreamThrottler.this.copy(toWrap, baos, len); if (copied == 0) { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LimitingInputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LimitingInputStream.java index 421d579c2a..a657030e1a 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LimitingInputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/LimitingInputStream.java @@ -106,6 +106,6 @@ public class LimitingInputStream extends InputStream { } public long getLimit() { - return limit; + return limit; } } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/MinimumLengthInputStream.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/MinimumLengthInputStream.java index 2e9359956c..7d6d8d1db3 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/MinimumLengthInputStream.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/MinimumLengthInputStream.java @@ -22,72 +22,71 @@ import java.io.IOException; import java.io.InputStream; /** - * An InputStream that will throw EOFException if the underlying InputStream runs out of data before reaching the - * configured minimum amount of data + * An InputStream that will throw EOFException if the underlying InputStream + * runs out of data before reaching the configured minimum amount of data */ public class MinimumLengthInputStream extends FilterInputStream { - private final long minLength; - private long consumedCount = 0L; - - public MinimumLengthInputStream(final InputStream in, final long minLength) { - super(in); - this.minLength = minLength; - } + private final long minLength; + private long consumedCount = 0L; - - @Override - public int read() throws IOException { - final int b = super.read(); - if ( b < 0 && consumedCount < minLength ) { - throw new EOFException(); - } - - if ( b >= 0 ) { - consumedCount++; - } - - return b; - } - - @Override - public int read(byte[] b) throws IOException { - return read(b, 0, b.length); - } - - public int read(byte[] b, int off, int len) throws IOException { - final int num = super.read(b, off, len); - - if ( num < 0 && consumedCount < minLength ) { - throw new EOFException(); - } - - if ( num >= 0 ) { - consumedCount += num; - } + public MinimumLengthInputStream(final InputStream in, final long minLength) { + super(in); + this.minLength = minLength; + } + + @Override + public int read() throws IOException { + final int b = super.read(); + if (b < 0 && consumedCount < minLength) { + throw new EOFException(); + } + + if (b >= 0) { + consumedCount++; + } + + return b; + } + + @Override + public int read(byte[] b) throws IOException { + return read(b, 0, b.length); + } + + public int read(byte[] b, int off, int len) throws IOException { + final int num = super.read(b, off, len); + + if (num < 0 && consumedCount < minLength) { + throw new EOFException(); + } + + if (num >= 0) { + consumedCount += num; + } + + return num; + } + + @Override + public long skip(final long n) throws IOException { + long skipped = super.skip(n); + if (skipped < 1) { + final int b = super.read(); + if (b >= 0) { + skipped = 1; + } + } + + if (skipped < 0 && consumedCount < minLength) { + throw new EOFException(); + } + + if (skipped >= 0) { + consumedCount += skipped; + } + + return skipped; + } - return num; - } - - @Override - public long skip(final long n) throws IOException { - long skipped = super.skip(n); - if ( skipped < 1 ) { - final int b = super.read(); - if ( b >= 0 ) { - skipped = 1; - } - } - - if ( skipped < 0 && consumedCount < minLength ) { - throw new EOFException(); - } - - if ( skipped >= 0 ) { - consumedCount += skipped; - } - - return skipped; - } - } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/StreamUtils.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/StreamUtils.java index 8e3d606273..101a546287 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/StreamUtils.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/StreamUtils.java @@ -44,10 +44,10 @@ public class StreamUtils { * destination. If numBytes are not available from * source, throws EOFException * - * @param source - * @param destination - * @param numBytes - * @throws IOException + * @param source the source of bytes to copy + * @param destination the destination to copy bytes to + * @param numBytes the number of bytes to copy + * @throws IOException if any issues occur while copying */ public static void copy(final InputStream source, final OutputStream destination, final long numBytes) throws IOException { final byte[] buffer = new byte[8192]; @@ -68,9 +68,9 @@ public class StreamUtils { * byte array. If the InputStream has less data than the given byte array, * throws an EOFException * - * @param source - * @param destination - * @throws IOException + * @param source the source to copy bytes from + * @param destination the destination to fill + * @throws IOException if any issues occur reading bytes */ public static void fillBuffer(final InputStream source, final byte[] destination) throws IOException { fillBuffer(source, destination, true); @@ -82,12 +82,12 @@ public class StreamUtils { * throws an EOFException if ensureCapacity is true and * otherwise returns the number of bytes copied * - * @param source - * @param destination + * @param source the source to read bytes from + * @param destination the destination to fill * @param ensureCapacity whether or not to enforce that the InputStream have * at least as much data as the capacity of the destination byte array - * @return - * @throws IOException + * @return the number of bytes actually filled + * @throws IOException if unable to read from the underlying stream */ public static int fillBuffer(final InputStream source, final byte[] destination, final boolean ensureCapacity) throws IOException { int bytesRead = 0; @@ -114,19 +114,19 @@ public class StreamUtils { * stoppers parameter (returns the byte pattern matched). The * bytes in the stopper will be copied. * - * @param in - * @param out - * @param maxBytes - * @param stoppers + * @param in the source to read bytes from + * @param out the destination to write bytes to + * @param maxBytes the max bytes to copy + * @param stoppers patterns of bytes which if seen will cause the copy to stop * @return the byte array matched, or null if end of stream was reached - * @throws IOException + * @throws IOException if issues occur reading or writing bytes to the underlying streams */ public static byte[] copyInclusive(final InputStream in, final OutputStream out, final int maxBytes, final byte[]... stoppers) throws IOException { if (stoppers.length == 0) { return null; } - final List circularBuffers = new ArrayList(); + final List circularBuffers = new ArrayList<>(); for (final byte[] stopper : stoppers) { circularBuffers.add(new NonThreadSafeCircularBuffer(stopper)); } @@ -157,12 +157,12 @@ public class StreamUtils { * byte pattern matched will NOT be copied to the output and will be un-read * from the input. * - * @param in - * @param out - * @param maxBytes - * @param stoppers + * @param in the source to read bytes from + * @param out the destination to write bytes to + * @param maxBytes the maximum number of bytes to copy + * @param stoppers byte patterns which will cause the copy to stop if found * @return the byte array matched, or null if end of stream was reached - * @throws IOException + * @throws IOException for issues reading or writing to underlying streams */ public static byte[] copyExclusive(final InputStream in, final OutputStream out, final int maxBytes, final byte[]... stoppers) throws IOException { if (stoppers.length == 0) { @@ -171,7 +171,7 @@ public class StreamUtils { int longest = 0; NonThreadSafeCircularBuffer longestBuffer = null; - final List circularBuffers = new ArrayList(); + final List circularBuffers = new ArrayList<>(); for (final byte[] stopper : stoppers) { final NonThreadSafeCircularBuffer circularBuffer = new NonThreadSafeCircularBuffer(stopper); if (stopper.length > longest) { @@ -220,9 +220,9 @@ public class StreamUtils { * * If unable to skip that number of bytes, throws EOFException * - * @param stream - * @param bytesToSkip - * @throws IOException + * @param stream the stream to skip over + * @param bytesToSkip the number of bytes to skip + * @throws IOException if any issues reading or skipping underlying stream */ public static void skip(final InputStream stream, final long bytesToSkip) throws IOException { if (bytesToSkip <= 0) { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/NonThreadSafeCircularBuffer.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/NonThreadSafeCircularBuffer.java index b4b4c17ca2..f18d824903 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/NonThreadSafeCircularBuffer.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/NonThreadSafeCircularBuffer.java @@ -38,7 +38,7 @@ public class NonThreadSafeCircularBuffer { /** * Returns the oldest byte in the buffer * - * @return + * @return the oldest byte */ public int getOldestByte() { return buffer[insertionPointer]; diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/EscapeUtils.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/EscapeUtils.java index 9d48d3dc57..b7a663c196 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/EscapeUtils.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/EscapeUtils.java @@ -19,24 +19,25 @@ package org.apache.nifi.util; public class EscapeUtils { /** - * Escapes the specified html by replacing &, <, >, ", ', / - * with their corresponding html entity. If html is null, null is returned. - * - * @param html - * @return + * Escapes the specified html by replacing &, <, >, ", ', + * / with their corresponding html entity. If html is null, null is + * returned. + * + * @param html to escape + * @return escaped html */ public static String escapeHtml(String html) { if (html == null) { return null; } - + html = html.replace("&", "&"); html = html.replace("<", "<"); html = html.replace(">", ">"); html = html.replace("\"", """); html = html.replace("'", "'"); html = html.replace("/", "/"); - + return html; } } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/FormatUtils.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/FormatUtils.java index 805223f3b7..03afec0031 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/FormatUtils.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/FormatUtils.java @@ -49,8 +49,8 @@ public class FormatUtils { /** * Formats the specified count by adding commas. * - * @param count - * @return + * @param count the value to add commas to + * @return the string representation of the given value with commas included */ public static String formatCount(final long count) { return NumberFormat.getIntegerInstance().format(count); @@ -59,9 +59,9 @@ public class FormatUtils { /** * Formats the specified duration in 'mm:ss.SSS' format. * - * @param sourceDuration - * @param sourceUnit - * @return + * @param sourceDuration the duration to format + * @param sourceUnit the unit to interpret the duration + * @return representation of the given time data in minutes/seconds */ public static String formatMinutesSeconds(final long sourceDuration, final TimeUnit sourceUnit) { final long millis = TimeUnit.MILLISECONDS.convert(sourceDuration, sourceUnit); @@ -72,9 +72,9 @@ public class FormatUtils { /** * Formats the specified duration in 'HH:mm:ss.SSS' format. * - * @param sourceDuration - * @param sourceUnit - * @return + * @param sourceDuration the duration to format + * @param sourceUnit the unit to interpret the duration + * @return representation of the given time data in hours/minutes/seconds */ public static String formatHoursMinutesSeconds(final long sourceDuration, final TimeUnit sourceUnit) { final long millis = TimeUnit.MILLISECONDS.convert(sourceDuration, sourceUnit); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java index 85bfd96e67..b7831de789 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java @@ -60,12 +60,10 @@ public class NaiveSearchRingBuffer { } /** - * Returns the contents of the internal buffer, which represents the last X + * @return the contents of the internal buffer, which represents the last X * bytes added to the buffer, where X is the minimum of the number of bytes * added to the buffer or the length of the byte sequence for which we are * looking - * - * @return */ public byte[] getBufferContents() { final int contentLength = Math.min(lookingFor.length, bufferSize); @@ -78,20 +76,16 @@ public class NaiveSearchRingBuffer { } /** - * Returns the oldest byte in the buffer - * - * @return + * @return the oldest byte in the buffer */ public int getOldestByte() { return buffer[insertionPointer]; } /** - * Returns true if the number of bytes that have been added to + * @return true if the number of bytes that have been added to * the buffer is at least equal to the length of the byte sequence for which * we are searching - * - * @return */ public boolean isFilled() { return bufferSize >= buffer.length; @@ -110,7 +104,7 @@ public class NaiveSearchRingBuffer { * Add the given byte to the buffer and notify whether or not the byte * completes the desired byte sequence. * - * @param data + * @param data the data to add to the buffer * @return true if this byte completes the byte sequence, * false otherwise. */ diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/ObjectHolder.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/ObjectHolder.java index a58ec6a10e..12a887cf9b 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/ObjectHolder.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/ObjectHolder.java @@ -19,7 +19,6 @@ package org.apache.nifi.util; /** * A bean that holds a single value of type T. * - * @param */ public class ObjectHolder { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/RingBuffer.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/RingBuffer.java index 81f32ab3ed..b46bae58af 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/RingBuffer.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/RingBuffer.java @@ -26,7 +26,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Thread-safe implementation of a RingBuffer * - * @param */ public class RingBuffer { @@ -46,8 +45,8 @@ public class RingBuffer { * Adds the given value to the RingBuffer and returns the value that was * removed in order to make room. * - * @param value - * @return + * @param value the new value to add + * @return value previously in the buffer */ @SuppressWarnings("unchecked") public T add(final T value) { @@ -135,8 +134,8 @@ public class RingBuffer { /** * Removes all elements from the RingBuffer that match the given filter * - * @param filter - * @return + * @param filter to use for deciding what is removed + * @return always zero */ public int removeSelectedElements(final Filter filter) { int count = 0; @@ -209,7 +208,7 @@ public class RingBuffer { * will skip all remaining elements in the RingBuffer; otherwise, the next * element will be evaluated until all elements have been evaluated. * - * @param evaluator + * @param evaluator used to evaluate each item in the ring buffer */ public void forEach(final ForEachEvaluator evaluator) { forEach(evaluator, IterationDirection.FORWARD); @@ -222,7 +221,7 @@ public class RingBuffer { * will skip all remaining elements in the RingBuffer; otherwise, the next * element will be evaluated until all elements have been evaluated. * - * @param evaluator + * @param evaluator the evaluator * @param iterationDirection the order in which to iterate over the elements * in the RingBuffer */ @@ -270,7 +269,7 @@ public class RingBuffer { * Defines an interface that can be used to iterate over all of the elements * in the RingBuffer via the {@link #forEach} method * - * @param + * @param the type to evaluate */ public static interface ForEachEvaluator { @@ -278,8 +277,8 @@ public class RingBuffer { * Evaluates the given element and returns {@code true} if the next * element should be evaluated, {@code false} otherwise * - * @param value - * @return + * @param value the value to evaluate + * @return true if should continue evaluating; false otherwise */ boolean evaluate(S value); } diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java index cd119305f3..bc8ab75466 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java @@ -55,8 +55,8 @@ public final class StopWatch { /** * Returns the amount of time that the StopWatch was running. * - * @param timeUnit - * @return + * @param timeUnit the unit for which the duration should be reported + * @return the duration of the stopwatch in the specified unit * * @throws IllegalStateException if the StopWatch has not been stopped via * {@link #stop()} @@ -71,8 +71,8 @@ public final class StopWatch { /** * Returns the amount of time that has elapsed since the timer was started. * - * @param timeUnit - * @return + * @param timeUnit the unit for which the elapsed time should be computed + * @return the elapsed time in the specified unit */ public long getElapsed(final TimeUnit timeUnit) { return timeUnit.convert(System.nanoTime() - startNanos, TimeUnit.NANOSECONDS); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/Tuple.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/Tuple.java index 63736ed2f6..c797c7f9b0 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/Tuple.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/Tuple.java @@ -16,12 +16,6 @@ */ package org.apache.nifi.util; -/** - * - * @author unattrib - * @param - * @param - */ public class Tuple { final A key; diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugDisabledTimedLock.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugDisabledTimedLock.java index a8d7e82650..8faf3ba319 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugDisabledTimedLock.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugDisabledTimedLock.java @@ -29,7 +29,7 @@ public class DebugDisabledTimedLock implements DebuggableTimedLock { /** * - * @return + * @return true if lock obtained; false otherwise */ @Override public boolean tryLock() { @@ -38,9 +38,9 @@ public class DebugDisabledTimedLock implements DebuggableTimedLock { /** * - * @param timeout - * @param timeUnit - * @return + * @param timeout the duration of time to wait for the lock + * @param timeUnit the unit which provides meaning to the duration + * @return true if obtained lock in time; false otherwise */ @Override public boolean tryLock(final long timeout, final TimeUnit timeUnit) { @@ -51,9 +51,6 @@ public class DebugDisabledTimedLock implements DebuggableTimedLock { } } - /** - * - */ @Override public void lock() { lock.lock(); diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugEnabledTimedLock.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugEnabledTimedLock.java index f082168582..e7d599eb41 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugEnabledTimedLock.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/concurrency/DebugEnabledTimedLock.java @@ -44,8 +44,7 @@ public class DebugEnabledTimedLock implements DebuggableTimedLock { } /** - * - * @return + * @return true if lock obtained; false otherwise */ @Override public boolean tryLock() { @@ -61,10 +60,9 @@ public class DebugEnabledTimedLock implements DebuggableTimedLock { } /** - * - * @param timeout - * @param timeUnit - * @return + * @param timeout duration to wait for lock + * @param timeUnit unit to understand given duration + * @return true if lock obtained in time; false otherwise */ @Override public boolean tryLock(final long timeout, final TimeUnit timeUnit) { @@ -84,9 +82,6 @@ public class DebugEnabledTimedLock implements DebuggableTimedLock { return true; } - /** - * - */ @Override public void lock() { logger.trace("Obtaining Lock {}", name); @@ -96,8 +91,7 @@ public class DebugEnabledTimedLock implements DebuggableTimedLock { } /** - * - * @param task + * @param task to release the lock for */ @Override public void unlock(final String task) { diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java index 41a05576f6..73c8aa05e1 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java @@ -16,7 +16,6 @@ */ package org.apache.nifi.util.file; -import java.io.BufferedInputStream; import java.io.Closeable; import java.io.File; import java.io.FileInputStream; @@ -53,7 +52,7 @@ public class FileUtils { /** * Closes the given closeable quietly - no logging, no exceptions... * - * @param closeable + * @param closeable the thing to close */ public static void closeQuietly(final Closeable closeable) { if (null != closeable) { @@ -66,9 +65,9 @@ public class FileUtils { } /** - * Releases the given lock quietly - no logging, no exception + * Releases the given lock quietly no logging, no exception * - * @param lock + * @param lock the lock to release */ public static void releaseQuietly(final FileLock lock) { if (null != lock) { @@ -98,9 +97,10 @@ public class FileUtils { * Deletes the given file. If the given file exists but could not be deleted * this will be printed as a warning to the given logger * - * @param file - * @param logger - * @return + * @param file the file to delete + * @param logger the logger to provide logging information to about the + * operation + * @return true if given file no longer exists */ public static boolean deleteFile(final File file, final Logger logger) { return FileUtils.deleteFile(file, logger, 1); @@ -110,8 +110,8 @@ public class FileUtils { * Deletes the given file. If the given file exists but could not be deleted * this will be printed as a warning to the given logger * - * @param file - * @param logger + * @param file the file to delete + * @param logger the logger to write to * @param attempts indicates how many times an attempt to delete should be * made * @return true if given file no longer exists @@ -192,9 +192,9 @@ public class FileUtils { * recursive) that match the given filename filter. If any file cannot be * deleted then this is printed at warn to the given logger. * - * @param directory + * @param directory the directory to scan for files to delete * @param filter if null then no filter is used - * @param logger + * @param logger the logger to use */ public static void deleteFilesInDir(final File directory, final FilenameFilter filter, final Logger logger) { FileUtils.deleteFilesInDir(directory, filter, logger, false); @@ -205,10 +205,10 @@ public class FileUtils { * that match the given filename filter. If any file cannot be deleted then * this is printed at warn to the given logger. * - * @param directory + * @param directory the directory to scan * @param filter if null then no filter is used - * @param logger - * @param recurse + * @param logger the logger to use + * @param recurse indicates whether to recurse subdirectories */ public static void deleteFilesInDir(final File directory, final FilenameFilter filter, final Logger logger, final boolean recurse) { FileUtils.deleteFilesInDir(directory, filter, logger, recurse, false); @@ -219,10 +219,10 @@ public class FileUtils { * that match the given filename filter. If any file cannot be deleted then * this is printed at warn to the given logger. * - * @param directory + * @param directory the directory to scan * @param filter if null then no filter is used - * @param logger - * @param recurse + * @param logger the logger + * @param recurse whether to recurse subdirectories or not * @param deleteEmptyDirectories default is false; if true will delete * directories found that are empty */ @@ -248,9 +248,9 @@ public class FileUtils { /** * Deletes given files. * - * @param files - * @param recurse will recurse - * @throws IOException + * @param files the files to delete + * @param recurse will recurse if true; false otherwise + * @throws IOException if any issues deleting specified files */ public static void deleteFiles(final Collection files, final boolean recurse) throws IOException { for (final File file : files) { @@ -352,8 +352,8 @@ public class FileUtils { * Copies the given source file to the given destination file. The given * destination will be overwritten if it already exists. * - * @param source - * @param destination + * @param source the file to copy + * @param destination the file to copy to * @param lockInputFile if true will lock input file during copy; if false * will not * @param lockOutputFile if true will lock output file during copy; if false @@ -369,11 +369,12 @@ public class FileUtils { * indicating the problem. * @return long number of bytes copied * @throws FileNotFoundException if the source file could not be found - * @throws IOException + * @throws IOException if unable to read or write the underlying streams * @throws SecurityException if a security manager denies the needed file * operations */ - public static long copyFile(final File source, final File destination, final boolean lockInputFile, final boolean lockOutputFile, final boolean move, final Logger logger) throws FileNotFoundException, IOException { + public static long copyFile(final File source, final File destination, final boolean lockInputFile, final boolean lockOutputFile, final boolean move, final Logger logger) + throws FileNotFoundException, IOException { FileInputStream fis = null; FileOutputStream fos = null; @@ -436,16 +437,16 @@ public class FileUtils { * Copies the given source file to the given destination file. The given * destination will be overwritten if it already exists. * - * @param source - * @param destination + * @param source the file to copy from + * @param destination the file to copy to * @param lockInputFile if true will lock input file during copy; if false * will not * @param lockOutputFile if true will lock output file during copy; if false * will not - * @param logger + * @param logger the logger to use * @return long number of bytes copied * @throws FileNotFoundException if the source file could not be found - * @throws IOException + * @throws IOException if unable to read or write to file * @throws SecurityException if a security manager denies the needed file * operations */ diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/monitor/SynchronousFileWatcher.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/monitor/SynchronousFileWatcher.java index e0089c196b..270d4d7cb3 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/monitor/SynchronousFileWatcher.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/monitor/SynchronousFileWatcher.java @@ -61,8 +61,8 @@ public class SynchronousFileWatcher { * Checks if the file has been updated according to the configured * {@link UpdateMonitor} and resets the state * - * @return - * @throws IOException + * @return true if updated; false otherwise + * @throws IOException if failure occurs checking for changes */ public boolean checkAndReset() throws IOException { if (checkUpdateMillis <= 0) { // if checkUpdateMillis <= 0, always check diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/Search.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/Search.java index 59b444a457..f93902faf5 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/Search.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/Search.java @@ -26,8 +26,6 @@ import org.apache.nifi.util.search.ahocorasick.SearchState; * Defines an interface to search for content given a set of search terms. Any * implementation of search must be thread safe. * - * @author - * @param */ public interface Search { @@ -35,7 +33,7 @@ public interface Search { * Establishes the dictionary of terms which will be searched in subsequent * search calls. This can be called only once * - * @param terms + * @param terms the terms to create a dictionary of */ void initializeDictionary(Set> terms); @@ -43,7 +41,7 @@ public interface Search { * Searches the given input stream for matches between the already specified * dictionary and the contents scanned. * - * @param haystack + * @param haystack the source data to scan for hits * @param findAll if true will find all matches if false will find only the * first match * @return SearchState containing results Map might be empty which indicates diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/SearchTerm.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/SearchTerm.java index 62de964b9f..a1d361e984 100644 --- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/SearchTerm.java +++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/search/SearchTerm.java @@ -22,8 +22,6 @@ import java.util.Arrays; /** * This is an immutable thread safe object representing a search term * - * @author - * @param */ public class SearchTerm { @@ -34,8 +32,8 @@ public class SearchTerm { /** * Constructs a SearchTerm. Defensively copies the given byte array * - * @param bytes - * @throws IllegalArgument exception if given bytes are null or 0 length + * @param bytes the bytes of the search term + * @throws IllegalArgumentException if given bytes are null or 0 length */ public SearchTerm(final byte[] bytes) { this(bytes, true, null); @@ -46,9 +44,9 @@ public class SearchTerm { * given byte array. If the caller indicates a defensive copy is not * necessary then they must not change the given arrays state any longer * - * @param bytes - * @param defensiveCopy - * @param reference + * @param bytes the bytes of the new search term + * @param defensiveCopy if true will make a defensive copy; false otherwise + * @param reference a holder for an object which can be retrieved when this search term hits */ public SearchTerm(final byte[] bytes, final boolean defensiveCopy, final T reference) { if (bytes == null || bytes.length == 0) { @@ -84,7 +82,7 @@ public class SearchTerm { /** * Determines if the given window starts with the same bytes as this term * - * @param window Current window of bytes from the haystack being evaluated. + * @param window bytes from the haystack being evaluated * @param windowLength The length of the window to consider * @return true if this term starts with the same bytes of the given window */ diff --git a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestCompoundUpdateMonitor.java b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestCompoundUpdateMonitor.java index f576e94b1e..ec04efb70c 100644 --- a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestCompoundUpdateMonitor.java +++ b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestCompoundUpdateMonitor.java @@ -27,7 +27,6 @@ import java.io.OutputStream; import java.nio.file.Path; import java.util.UUID; - import org.junit.Test; public class TestCompoundUpdateMonitor { diff --git a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestSynchronousFileWatcher.java b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestSynchronousFileWatcher.java index 7125581b5e..3440c165ef 100644 --- a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestSynchronousFileWatcher.java +++ b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/monitor/TestSynchronousFileWatcher.java @@ -30,7 +30,6 @@ import java.nio.file.StandardCopyOption; import org.junit.Test; - public class TestSynchronousFileWatcher { @Test diff --git a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/timebuffer/TestRingBuffer.java b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/timebuffer/TestRingBuffer.java index 5f8c4c8db9..b01b495076 100644 --- a/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/timebuffer/TestRingBuffer.java +++ b/nifi/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/timebuffer/TestRingBuffer.java @@ -36,13 +36,13 @@ public class TestRingBuffer { @Test public void testGetNewestElement() { final RingBuffer ringBuffer = new RingBuffer<>(10); - - for (int i=0; i < 11; i++) { + + for (int i = 0; i < 11; i++) { ringBuffer.add(i); assertEquals(i, ringBuffer.getNewestElement().intValue()); } } - + @Test public void testAsList() { final RingBuffer ringBuffer = new RingBuffer<>(10); diff --git a/nifi/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ClientUtils.java b/nifi/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ClientUtils.java index 8c0b1f4363..1eaf366bf5 100644 --- a/nifi/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ClientUtils.java +++ b/nifi/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/ClientUtils.java @@ -40,10 +40,10 @@ public class ClientUtils { /** * Gets the content at the specified URI. * - * @param uri - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the URI to get the content of + * @return the client response resulting from getting the content of the URI + * @throws ClientHandlerException if issues occur handling the request + * @throws UniformInterfaceException if any interface violations occur */ public ClientResponse get(final URI uri) throws ClientHandlerException, UniformInterfaceException { return get(uri, null); @@ -52,11 +52,11 @@ public class ClientUtils { /** * Gets the content at the specified URI using the given query parameters. * - * @param uri - * @param queryParams - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the URI to get the content of + * @param queryParams the query parameters to use in the request + * @return the client response resulting from getting the content of the URI + * @throws ClientHandlerException if issues occur handling the request + * @throws UniformInterfaceException if any interface violations occur */ public ClientResponse get(final URI uri, final Map queryParams) throws ClientHandlerException, UniformInterfaceException { // perform the request @@ -73,9 +73,9 @@ public class ClientUtils { /** * Performs a POST using the specified url and entity body. * - * @param uri - * @param entity - * @return + * @param uri the URI to post to + * @param entity the item to post + * @return the client response of the request */ public ClientResponse post(URI uri, Object entity) throws ClientHandlerException, UniformInterfaceException { // get the resource @@ -93,9 +93,9 @@ public class ClientUtils { /** * Performs a POST using the specified url and form data. * - * @param uri - * @param formData - * @return + * @param uri the uri to post to + * @param formData the data to post + * @return the client reponse of the post */ public ClientResponse post(URI uri, Map formData) throws ClientHandlerException, UniformInterfaceException { // convert the form data @@ -119,10 +119,10 @@ public class ClientUtils { /** * Performs a HEAD request to the specified URI. * - * @param uri - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the uri to request the head of + * @return the client response of the request + * @throws ClientHandlerException for issues handling the request + * @throws UniformInterfaceException for issues with the request */ public ClientResponse head(final URI uri) throws ClientHandlerException, UniformInterfaceException { // perform the request diff --git a/nifi/nifi-docs/pom.xml b/nifi/nifi-docs/pom.xml index 7f2b02271f..f724e9690f 100644 --- a/nifi/nifi-docs/pom.xml +++ b/nifi/nifi-docs/pom.xml @@ -103,6 +103,15 @@ + + org.apache.rat + apache-rat-plugin + + + src/main/asciidoc/asciidoc-mod.css + + + maven-assembly-plugin diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java index ddc3d2e904..a71484ee33 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinBoardDTO.java @@ -34,9 +34,7 @@ public class BulletinBoardDTO { private Date generated; /** - * The bulletins to populate in the bulletin board. - * - * @return + * @return bulletins to populate in the bulletin board */ public List getBulletins() { return bulletins; @@ -47,9 +45,7 @@ public class BulletinBoardDTO { } /** - * When this bulletin board was generated. - * - * @return + * @return when this bulletin board was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java index c6aca24051..239e7102f8 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinDTO.java @@ -40,9 +40,7 @@ public class BulletinDTO { private Date timestamp; /** - * The id of this message. - * - * @return + * @return id of this message */ public Long getId() { return id; @@ -53,10 +51,8 @@ public class BulletinDTO { } /** - * When clustered, the address of the node from which this bulletin - * originated. - * - * @return + * @return When clustered, the address of the node from which this bulletin + * originated */ public String getNodeAddress() { return nodeAddress; @@ -67,9 +63,7 @@ public class BulletinDTO { } /** - * The group id of the source component. - * - * @return + * @return group id of the source component */ public String getGroupId() { return groupId; @@ -80,9 +74,7 @@ public class BulletinDTO { } /** - * The category of this message. - * - * @return + * @return category of this message */ public String getCategory() { return category; @@ -93,9 +85,7 @@ public class BulletinDTO { } /** - * The actual message. - * - * @return + * @return actual message */ public String getMessage() { return message; @@ -106,9 +96,7 @@ public class BulletinDTO { } /** - * The id of the source of this message. - * - * @return + * @return id of the source of this message */ public String getSourceId() { return sourceId; @@ -119,9 +107,7 @@ public class BulletinDTO { } /** - * The name of the source of this message. - * - * @return + * @return name of the source of this message */ public String getSourceName() { return sourceName; @@ -132,9 +118,7 @@ public class BulletinDTO { } /** - * The level of this bulletin. - * - * @return + * @return level of this bulletin */ public String getLevel() { return level; @@ -145,9 +129,7 @@ public class BulletinDTO { } /** - * When this bulletin was generated as a formatted string. - * - * @return + * @return When this bulletin was generated as a formatted string */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getTimestamp() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java index 015b174bab..cf4146dce6 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/BulletinQueryDTO.java @@ -33,9 +33,7 @@ public class BulletinQueryDTO { private Integer limit; /** - * Include bulletins after this id. - * - * @return + * @return Include bulletins after this id */ public Long getAfter() { return after; @@ -46,9 +44,7 @@ public class BulletinQueryDTO { } /** - * Include bulletin within this group. Supports a regular expression. - * - * @return + * @return Include bulletin within this group. Supports a regular expression */ public String getGroupId() { return groupId; @@ -59,9 +55,7 @@ public class BulletinQueryDTO { } /** - * Include bulletins that match this message. Supports a regular expression. - * - * @return + * @return Include bulletins that match this message. Supports a regular expression */ public String getMessage() { return message; @@ -72,9 +66,7 @@ public class BulletinQueryDTO { } /** - * Include bulletins that match this name. Supports a regular expression. - * - * @return + * @return Include bulletins that match this name. Supports a regular expression */ public String getName() { return name; @@ -85,9 +77,7 @@ public class BulletinQueryDTO { } /** - * Include bulletins that match this id. Supports a source id. - * - * @return + * @return Include bulletins that match this id. Supports a source id */ public String getSourceId() { return sourceId; @@ -98,9 +88,7 @@ public class BulletinQueryDTO { } /** - * The maximum number of bulletins to return. - * - * @return + * @return The maximum number of bulletins to return */ public Integer getLimit() { return limit; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java index 53100e3044..161e788cfc 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ClusterDTO.java @@ -33,9 +33,7 @@ public class ClusterDTO { private Date generated; /** - * The collection of the node DTOs. - * - * @return + * @return collection of the node DTOs */ public Collection getNodes() { return nodes; @@ -46,9 +44,7 @@ public class ClusterDTO { } /** - * Gets the date/time that this report was generated. - * - * @return + * @return the date/time that this report was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java index 3bdbe2814e..2345b0801c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentHistoryDTO.java @@ -29,9 +29,7 @@ public class ComponentHistoryDTO { private Map propertyHistory; /** - * The component id. - * - * @return + * @return component id */ public String getComponentId() { return componentId; @@ -42,9 +40,7 @@ public class ComponentHistoryDTO { } /** - * The history for this components properties. - * - * @return + * @return history for this components properties */ public Map getPropertyHistory() { return propertyHistory; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java index 1be480cfb1..199c73ea93 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectableDTO.java @@ -34,9 +34,7 @@ public class ConnectableDTO { private String comments; /** - * The id of this connectable component. - * - * @return + * @return id of this connectable component */ public String getId() { return id; @@ -47,9 +45,7 @@ public class ConnectableDTO { } /** - * The type of this connectable component. - * - * @return + * @return type of this connectable component */ public String getType() { return type; @@ -60,9 +56,7 @@ public class ConnectableDTO { } /** - * The id of the group that this connectable component resides in. - * - * @return + * @return id of the group that this connectable component resides in */ public String getGroupId() { return groupId; @@ -73,9 +67,7 @@ public class ConnectableDTO { } /** - * The name of this connectable component. - * - * @return + * @return name of this connectable component */ public String getName() { return name; @@ -86,9 +78,7 @@ public class ConnectableDTO { } /** - * Used to reflect the current state of this Connectable. - * - * @return + * @return Used to reflect the current state of this Connectable */ public Boolean isRunning() { return running; @@ -99,10 +89,8 @@ public class ConnectableDTO { } /** - * If this represents a remote port it is used to indicate whether the - * target exists. - * - * @return + * @return If this represents a remote port it is used to indicate whether the + * target exists */ public Boolean getExists() { return exists; @@ -113,10 +101,8 @@ public class ConnectableDTO { } /** - * If this represents a remote port it is used to indicate whether is it - * configured to transmit. - * - * @return + * @return If this represents a remote port it is used to indicate whether is it + * configured to transmit */ public Boolean getTransmitting() { return transmitting; @@ -127,9 +113,7 @@ public class ConnectableDTO { } /** - * The comments from this Connectable. - * - * @return + * @return The comments from this Connectable */ public String getComments() { return comments; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java index 660820c900..1bd382e5d0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java @@ -67,9 +67,7 @@ public class ConnectionDTO extends NiFiComponentDTO { } /** - * The name of the connection. - * - * @return + * @return name of the connection */ public String getName() { return name; @@ -80,9 +78,7 @@ public class ConnectionDTO extends NiFiComponentDTO { } /** - * The position of the bend points on this connection. - * - * @return + * @return position of the bend points on this connection */ public List getBends() { return bends; @@ -93,10 +89,8 @@ public class ConnectionDTO extends NiFiComponentDTO { } /** - * The index of control point that the connection label should be placed - * over. - * - * @return + * @return The index of control point that the connection label should be placed + * over */ public Integer getLabelIndex() { return labelIndex; @@ -107,9 +101,7 @@ public class ConnectionDTO extends NiFiComponentDTO { } /** - * The z index for this connection. - * - * @return + * @return z index for this connection */ public Long getzIndex() { return zIndex; @@ -133,10 +125,8 @@ public class ConnectionDTO extends NiFiComponentDTO { } /** - * The relationships that the source of the connection currently supports. - * This property is read only. - * - * @return + * @return relationships that the source of the connection currently supports. + * This property is read only */ public Set getAvailableRelationships() { return availableRelationships; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java index 190cb47fe2..8e09fe7b4e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerConfigurationDTO.java @@ -42,9 +42,7 @@ public class ControllerConfigurationDTO { private String uri; /** - * The maximum number of timer driven threads this NiFi has available. - * - * @return The maximum number of threads + * @return maximum number of timer driven threads this NiFi has available */ public Integer getMaxTimerDrivenThreadCount() { return maxTimerDrivenThreadCount; @@ -55,9 +53,7 @@ public class ControllerConfigurationDTO { } /** - * The maximum number of event driven thread this NiFi has available. - * - * @return + * @return maximum number of event driven thread this NiFi has available */ public Integer getMaxEventDrivenThreadCount() { return maxEventDrivenThreadCount; @@ -68,9 +64,7 @@ public class ControllerConfigurationDTO { } /** - * The name of this NiFi. - * - * @return The name + * @return name of this NiFi */ public String getName() { return name; @@ -81,9 +75,7 @@ public class ControllerConfigurationDTO { } /** - * The comments for this NiFi. - * - * @return + * @return comments for this NiFi */ public String getComments() { return comments; @@ -94,10 +86,8 @@ public class ControllerConfigurationDTO { } /** - * The interval in seconds between the automatic NiFi refresh requests. This - * value is read only. - * - * @return The interval in seconds + * @return interval in seconds between the automatic NiFi refresh requests. This + * value is read only */ public Long getAutoRefreshIntervalSeconds() { return autoRefreshIntervalSeconds; @@ -108,10 +98,8 @@ public class ControllerConfigurationDTO { } /** - * Indicates whether or not Site-to-Site communications with this instance - * is secure (2-way authentication). This value is read only. - * - * @return + * @return Indicates whether or not Site-to-Site communications with this instance + * is secure (2-way authentication). This value is read only */ public Boolean isSiteToSiteSecure() { return siteToSiteSecure; @@ -122,9 +110,7 @@ public class ControllerConfigurationDTO { } /** - * The current time on the server. - * - * @return + * @return current time on the server */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getCurrentTime() { @@ -136,9 +122,7 @@ public class ControllerConfigurationDTO { } /** - * The time offset of the server. - * - * @return + * @return time offset of the server */ public Integer getTimeOffset() { return timeOffset; @@ -149,9 +133,7 @@ public class ControllerConfigurationDTO { } /** - * Returns the URL for the content viewer if configured. - * - * @return + * @return the URL for the content viewer if configured */ public String getContentViewerUrl() { return contentViewerUrl; @@ -162,9 +144,7 @@ public class ControllerConfigurationDTO { } /** - * The URI for this NiFi controller. - * - * @return + * @return URI for this NiFi controller */ public String getUri() { return uri; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java index 9e15fc1772..c5ee057cd4 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerDTO.java @@ -48,9 +48,7 @@ public class ControllerDTO { private Set outputPorts; /** - * The id of this NiFi controller. - * - * @return + * @return id of this NiFi controller */ public String getId() { return id; @@ -74,9 +72,7 @@ public class ControllerDTO { } /** - * The comments of this NiFi controller. - * - * @return + * @return comments of this NiFi controller */ public String getComments() { return comments; @@ -87,9 +83,7 @@ public class ControllerDTO { } /** - * The input ports available to send data to this NiFi controller. - * - * @return + * @return input ports available to send data to this NiFi controller */ public Set getInputPorts() { return inputPorts; @@ -100,9 +94,7 @@ public class ControllerDTO { } /** - * The output ports available to received data from this NiFi controller. - * - * @return + * @return output ports available to received data from this NiFi controller */ public Set getOutputPorts() { return outputPorts; @@ -113,10 +105,8 @@ public class ControllerDTO { } /** - * The Instance ID of the cluster, if this node is connected to a Cluster + * @return Instance ID of the cluster, if this node is connected to a Cluster * Manager, or of this individual instance of in standalone mode - * - * @return */ public String getInstanceId() { return instanceId; @@ -143,10 +133,8 @@ public class ControllerDTO { } /** - * Indicates whether or not Site-to-Site communications with this instance + * @return Indicates whether or not Site-to-Site communications with this instance * is secure (2-way authentication) - * - * @return */ public Boolean isSiteToSiteSecure() { return siteToSiteSecure; @@ -157,9 +145,7 @@ public class ControllerDTO { } /** - * The number of running components in this process group. - * - * @return + * @return number of running components in this process group */ public Integer getRunningCount() { return runningCount; @@ -170,9 +156,7 @@ public class ControllerDTO { } /** - * The number of stopped components in this process group. - * - * @return + * @return number of stopped components in this process group */ public Integer getStoppedCount() { return stoppedCount; @@ -183,9 +167,7 @@ public class ControllerDTO { } /** - * The number of active remote ports contained in this process group. - * - * @return + * @return number of active remote ports contained in this process group */ public Integer getActiveRemotePortCount() { return activeRemotePortCount; @@ -196,9 +178,7 @@ public class ControllerDTO { } /** - * The number of inactive remote ports contained in this process group. - * - * @return + * @return number of inactive remote ports contained in this process group */ public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; @@ -209,9 +189,7 @@ public class ControllerDTO { } /** - * The number of input ports contained in this process group. - * - * @return + * @return number of input ports contained in this process group */ public Integer getInputPortCount() { return inputPortCount; @@ -222,9 +200,7 @@ public class ControllerDTO { } /** - * The number of invalid components in this process group. - * - * @return + * @return number of invalid components in this process group */ public Integer getInvalidCount() { return invalidCount; @@ -235,9 +211,7 @@ public class ControllerDTO { } /** - * The number of disabled components in this process group. - * - * @return + * @return number of disabled components in this process group */ public Integer getDisabledCount() { return disabledCount; @@ -248,9 +222,7 @@ public class ControllerDTO { } /** - * The number of output ports in this process group. - * - * @return + * @return number of output ports in this process group */ public Integer getOutputPortCount() { return outputPortCount; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java index 75d18a2caa..02ba2e23b7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java @@ -32,21 +32,19 @@ public class ControllerServiceDTO extends NiFiComponentDTO { private String comments; private String availability; private String state; - + private Map properties; private Map descriptors; - + private String customUiUrl; private String annotationData; - + private Set referencingComponents; - + private Collection validationErrors; /** - * The controller service name. - * - * @return + * @return controller service name */ public String getName() { return name; @@ -57,9 +55,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * The controller service type. - * - * @return + * @return the controller service type */ public String getType() { return type; @@ -68,24 +64,20 @@ public class ControllerServiceDTO extends NiFiComponentDTO { public void setType(String type) { this.type = type; } - /** - * The comment for the Controller Service - * @return + * @return the comment for the Controller Service */ public String getComments() { - return comments; - } + return comments; + } - public void setComments(String comments) { - this.comments = comments; - } + public void setComments(String comments) { + this.comments = comments; + } - /** - * Where this service is available. Possible values are NCM, NODE. - * - * @return + /** + * @return Where this service is available. Possible values are NCM, NODE */ public String getAvailability() { return availability; @@ -96,8 +88,8 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * The state of this controller service. Possible values are ENABLED, ENABLING, DISABLED, DISABLING. - * @return + * @return The state of this controller service. Possible values are ENABLED, + * ENABLING, DISABLED, DISABLING */ public String getState() { return state; @@ -108,9 +100,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * The controller service properties. - * - * @return + * @return controller service properties */ public Map getProperties() { return properties; @@ -121,9 +111,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * The descriptors for the controller service properties. - * - * @return + * @return descriptors for the controller service properties */ public Map getDescriptors() { return descriptors; @@ -134,10 +122,8 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * Returns the URL for this controller services custom configuration UI - * if applicable. Null otherwise. - * - * @return + * @return the URL for this controller services custom configuration UI if + * applicable. Null otherwise */ public String getCustomUiUrl() { return customUiUrl; @@ -148,9 +134,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * The annotation data for this controller service. - * - * @return + * @return annotation data for this controller service */ public String getAnnotationData() { return annotationData; @@ -161,9 +145,7 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * All components referencing this controller service. - * - * @return + * @return all components referencing this controller service */ public Set getReferencingComponents() { return referencingComponents; @@ -174,9 +156,9 @@ public class ControllerServiceDTO extends NiFiComponentDTO { } /** - * Gets the validation errors from this controller service. These validation errors - * represent the problems with the controller service that must be resolved before it - * can be enabled. + * Gets the validation errors from this controller service. These validation + * errors represent the problems with the controller service that must be + * resolved before it can be enabled. * * @return The validation errors */ diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java index 7fc57ffc0b..4b557e1ca7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceReferencingComponentDTO.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlType; */ @XmlType(name = "controllerServiceReferencingComponent") public class ControllerServiceReferencingComponentDTO { + private String groupId; private String id; private String name; @@ -36,20 +37,18 @@ public class ControllerServiceReferencingComponentDTO { private Map properties; private Map descriptors; - + private Collection validationErrors; - + private String referenceType; private Integer activeThreadCount; - + private Boolean referenceCycle; private Set referencingComponents; /** - * Group id for this component referencing a controller service. If this - * component is another service, this field is blank. - * - * @return + * @return Group id for this component referencing a controller service. If this + * component is another service, this field is blank */ public String getGroupId() { return groupId; @@ -60,9 +59,7 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The id for this component referencing a controller service. - * - * @return + * @return id for this component referencing a controller service */ public String getId() { return id; @@ -73,9 +70,7 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The name for this component referencing a controller service. - * - * @return + * @return name for this component referencing a controller service */ public String getName() { return name; @@ -86,9 +81,7 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The type for this component referencing a controller service. - * - * @return + * @return type for this component referencing a controller service */ public String getType() { return type; @@ -99,10 +92,8 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The state of the processor referencing a controller service. If this - * component is another service, this field is blank. - * - * @return + * @return state of the processor referencing a controller service. If this + * component is another service, this field is blank */ public String getState() { return state; @@ -113,8 +104,8 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The type of reference this is (Processor, ControllerService, or ReportingTask). - * @return + * @return type of reference this is (Processor, ControllerService, or + * ReportingTask) */ public String getReferenceType() { return referenceType; @@ -125,9 +116,7 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The component properties. - * - * @return + * @return component properties */ public Map getProperties() { return properties; @@ -138,9 +127,7 @@ public class ControllerServiceReferencingComponentDTO { } /** - * The descriptors for the components properties. - * - * @return + * @return descriptors for the components properties */ public Map getDescriptors() { return descriptors; @@ -149,11 +136,9 @@ public class ControllerServiceReferencingComponentDTO { public void setDescriptors(Map descriptors) { this.descriptors = descriptors; } - + /** - * Any validation error associated with this component. - * - * @return + * @return Any validation error associated with this component */ public Collection getValidationErrors() { return validationErrors; @@ -162,11 +147,9 @@ public class ControllerServiceReferencingComponentDTO { public void setValidationErrors(Collection validationErrors) { this.validationErrors = validationErrors; } - + /** - * The active thread count for the referencing component. - * - * @return + * @return active thread count for the referencing component */ public Integer getActiveThreadCount() { return activeThreadCount; @@ -177,10 +160,8 @@ public class ControllerServiceReferencingComponentDTO { } /** - * If this referencing component represents a ControllerService, these - * are the components that reference it. - * - * @return + * @return If this referencing component represents a ControllerService, these are + * the components that reference it */ public Set getReferencingComponents() { return referencingComponents; @@ -191,10 +172,8 @@ public class ControllerServiceReferencingComponentDTO { } /** - * If this referencing component represents a ControllerService, this indicates - * whether it has already been represented in this hierarchy. - * - * @return + * @return If this referencing component represents a ControllerService, this + * indicates whether it has already been represented in this hierarchy */ public Boolean getReferenceCycle() { return referenceCycle; @@ -204,4 +183,4 @@ public class ControllerServiceReferencingComponentDTO { this.referenceCycle = referenceCycle; } -} \ No newline at end of file +} diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java index 10ea41dc74..2df4dd4612 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CounterDTO.java @@ -32,9 +32,7 @@ public class CounterDTO { private String value; /** - * The context of the counter. - * - * @return + * @return context of the counter */ public String getContext() { return context; @@ -45,9 +43,7 @@ public class CounterDTO { } /** - * The id of the counter. - * - * @return + * @return id of the counter */ public String getId() { return id; @@ -58,9 +54,7 @@ public class CounterDTO { } /** - * The name of the counter - * - * @return + * @return name of the counter */ public String getName() { return name; @@ -71,9 +65,7 @@ public class CounterDTO { } /** - * The value for the counter - * - * @return + * @return value for the counter */ public String getValue() { return value; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java index ac1aa388df..d9f45e398e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/CountersDTO.java @@ -33,9 +33,7 @@ public class CountersDTO { private Collection counters; /** - * Gets the collection of counters. - * - * @return + * @return the collection of counters */ public Collection getCounters() { return counters; @@ -46,9 +44,7 @@ public class CountersDTO { } /** - * Gets the date/time that this report was generated. - * - * @return + * @return the date/time that this report was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java index 6e4aeb9b9b..2241d625d2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java @@ -30,9 +30,7 @@ public class DocumentedTypeDTO { private Set tags; /** - * An optional description of the corresponding type. - * - * @return + * @return An optional description of the corresponding type */ public String getDescription() { return description; @@ -43,9 +41,7 @@ public class DocumentedTypeDTO { } /** - * The type is the fully-qualified name of a Java class. - * - * @return + * @return The type is the fully-qualified name of a Java class */ public String getType() { return type; @@ -56,9 +52,7 @@ public class DocumentedTypeDTO { } /** - * The tags associated with this type. - * - * @return + * @return The tags associated with this type */ public Set getTags() { return tags; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java index 47a6871b9d..5aec78feaf 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java @@ -35,11 +35,9 @@ public class FlowSnippetDTO { private Set labels = new LinkedHashSet<>(); private Set funnels = new LinkedHashSet<>(); private Set controllerServices = new LinkedHashSet<>(); - + /** - * The connections in this flow snippet. - * - * @return + * @return connections in this flow snippet */ public Set getConnections() { return connections; @@ -50,9 +48,7 @@ public class FlowSnippetDTO { } /** - * The input ports in this flow snippet. - * - * @return + * @return input ports in this flow snippet */ public Set getInputPorts() { return inputPorts; @@ -63,9 +59,7 @@ public class FlowSnippetDTO { } /** - * The labels in this flow snippet. - * - * @return + * @return labels in this flow snippet */ public Set getLabels() { return labels; @@ -76,9 +70,7 @@ public class FlowSnippetDTO { } /** - * The funnels in this flow snippet. - * - * @return + * @return funnels in this flow snippet */ public Set getFunnels() { return funnels; @@ -89,9 +81,7 @@ public class FlowSnippetDTO { } /** - * The output ports in this flow snippet. - * - * @return + * @return output ports in this flow snippet */ public Set getOutputPorts() { return outputPorts; @@ -102,9 +92,7 @@ public class FlowSnippetDTO { } /** - * The process groups in this flow snippet. - * - * @return + * @return process groups in this flow snippet */ public Set getProcessGroups() { return processGroups; @@ -115,9 +103,7 @@ public class FlowSnippetDTO { } /** - * The processors in this flow group. - * - * @return + * @return processors in this flow group */ public Set getProcessors() { return processors; @@ -128,9 +114,7 @@ public class FlowSnippetDTO { } /** - * The remote process groups in this flow snippet. - * - * @return + * @return remote process groups in this flow snippet */ public Set getRemoteProcessGroups() { return remoteProcessGroups; @@ -141,8 +125,7 @@ public class FlowSnippetDTO { } /** - * Returns the Controller Services in this flow snippet - * @return + * @return the Controller Services in this flow snippet */ public Set getControllerServices() { return controllerServices; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java index f50c79292b..7f6ed256a3 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java @@ -53,9 +53,7 @@ public class LabelDTO extends NiFiComponentDTO { } /** - * The style for this label. - * - * @return + * @return style for this label */ public Map getStyle() { return style; @@ -66,9 +64,7 @@ public class LabelDTO extends NiFiComponentDTO { } /** - * The height of the label in pixels when at a 1:1 scale. - * - * @return + * @return height of the label in pixels when at a 1:1 scale */ public Double getHeight() { return height; @@ -79,9 +75,7 @@ public class LabelDTO extends NiFiComponentDTO { } /** - * The width of the label in pixels when at a 1:1 scale. - * - * @return + * @return width of the label in pixels when at a 1:1 scale */ public Double getWidth() { return width; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java index 2829287b66..1ed0676efd 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java @@ -55,9 +55,8 @@ public class NiFiComponentDTO { } /** - * The id for the parent group of this component if applicable, null otherwise. - * - * @return + * @return id for the parent group of this component if applicable, null + * otherwise */ public String getParentGroupId() { return parentGroupId; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java index 9499c2efb2..6aae62f982 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeDTO.java @@ -41,9 +41,7 @@ public class NodeDTO { private Date nodeStartTime; /** - * The node's last heartbeat timestamp. - * - * @return + * @return node's last heartbeat timestamp */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getHeartbeat() { @@ -55,9 +53,7 @@ public class NodeDTO { } /** - * The time of the node's last connection request. - * - * @return + * @return time of the node's last connection request */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getConnectionRequested() { @@ -82,9 +78,7 @@ public class NodeDTO { } /** - * The queue for the controller. - * - * @return + * @return queue for the controller */ public String getQueued() { return queued; @@ -95,9 +89,7 @@ public class NodeDTO { } /** - * The node's host/IP address. - * - * @return + * @return node's host/IP address */ public String getAddress() { return address; @@ -108,9 +100,7 @@ public class NodeDTO { } /** - * The node ID. - * - * @return + * @return node ID */ public String getNodeId() { return nodeId; @@ -121,9 +111,7 @@ public class NodeDTO { } /** - * The port the node is listening for API requests. - * - * @return + * @return port the node is listening for API requests */ public Integer getApiPort() { return apiPort; @@ -134,9 +122,7 @@ public class NodeDTO { } /** - * The node's status. - * - * @return + * @return node's status */ public String getStatus() { return status; @@ -147,9 +133,7 @@ public class NodeDTO { } /** - * The node's events. - * - * @return + * @return node's events */ public List getEvents() { return events; @@ -160,9 +144,7 @@ public class NodeDTO { } /** - * Whether this node is the primary node within the cluster. - * - * @return + * @return whether this node is the primary node within the cluster */ public Boolean isPrimary() { return primary; @@ -173,9 +155,7 @@ public class NodeDTO { } /** - * The time at which this Node was last restarted - * - * @return + * @return time at which this Node was last restarted */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getNodeStartTime() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java index 3cad8d84e4..7d8273fdbe 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeEventDTO.java @@ -32,9 +32,7 @@ public class NodeEventDTO { private String message; /** - * The category of the node event. - * - * @return + * @return category of the node event */ public String getCategory() { return category; @@ -45,9 +43,7 @@ public class NodeEventDTO { } /** - * The message of the node event. - * - * @return + * @return message of the node event */ public String getMessage() { return message; @@ -58,9 +54,7 @@ public class NodeEventDTO { } /** - * The timestamp of the node event. - * - * @return + * @return timestamp of the node event */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getTimestamp() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsDTO.java index 8c83331005..f7aff7961d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NodeSystemDiagnosticsDTO.java @@ -28,9 +28,7 @@ public class NodeSystemDiagnosticsDTO { private SystemDiagnosticsDTO systemDiagnostics; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -41,9 +39,7 @@ public class NodeSystemDiagnosticsDTO { } /** - * The system diagnostics. - * - * @return + * @return the system diagnostics */ public SystemDiagnosticsDTO getSystemDiagnostics() { return systemDiagnostics; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java index 2a372f4ef4..464beafb63 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java @@ -38,9 +38,7 @@ public class PortDTO extends NiFiComponentDTO { private Collection validationErrors; /** - * The name of this port. - * - * @return + * @return name of this port */ public String getName() { return name; @@ -51,10 +49,8 @@ public class PortDTO extends NiFiComponentDTO { } /** - * The state of this port. Possible states are 'RUNNING', 'STOPPED', and - * 'DISABLED'. - * - * @return + * @return The state of this port. Possible states are 'RUNNING', 'STOPPED', and + * 'DISABLED' */ public String getState() { return state; @@ -67,7 +63,7 @@ public class PortDTO extends NiFiComponentDTO { /** * The type of port. Possible values are 'INPUT_PORT' or 'OUTPUT_PORT'. * - * @return + * @return The type of port */ public String getType() { return type; @@ -78,9 +74,7 @@ public class PortDTO extends NiFiComponentDTO { } /** - * The number of tasks that should be concurrently scheduled for this port. - * - * @return + * @return number of tasks that should be concurrently scheduled for this port */ public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -91,9 +85,7 @@ public class PortDTO extends NiFiComponentDTO { } /** - * The comments for this port. - * - * @return + * @return comments for this port */ public String getComments() { return comments; @@ -104,10 +96,8 @@ public class PortDTO extends NiFiComponentDTO { } /** - * Whether this port has incoming or outgoing connections to a remote NiFi. - * This is only applicable when the port is running on the root group. - * - * @return + * @return whether this port has incoming or outgoing connections to a remote NiFi. + * This is only applicable when the port is running on the root group */ public Boolean isTransmitting() { return transmitting; @@ -118,9 +108,7 @@ public class PortDTO extends NiFiComponentDTO { } /** - * Groups that are allowed to access this port. - * - * @return + * @return groups that are allowed to access this port */ public Set getGroupAccessControl() { return groupAccessControl; @@ -131,9 +119,7 @@ public class PortDTO extends NiFiComponentDTO { } /** - * Users that are allowed to access this port. - * - * @return + * @return users that are allowed to access this port */ public Set getUserAccessControl() { return userAccessControl; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java index ab077f371b..5b0f3864f0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PositionDTO.java @@ -37,9 +37,7 @@ public class PositionDTO { /* getters / setters */ /** - * The x coordinate. - * - * @return + * @return the x coordinate */ public Double getX() { return x; @@ -50,9 +48,7 @@ public class PositionDTO { } /** - * The y coordinate. - * - * @return + * @return the y coordinate */ public Double getY() { return y; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java index fb33c672d3..458a2b390b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PreviousValueDTO.java @@ -32,9 +32,7 @@ public class PreviousValueDTO { private String userName; /** - * The previous value. - * - * @return + * @return previous value */ public String getPreviousValue() { return previousValue; @@ -45,9 +43,7 @@ public class PreviousValueDTO { } /** - * When it was modified. - * - * @return + * @return when it was modified */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getTimestamp() { @@ -59,9 +55,7 @@ public class PreviousValueDTO { } /** - * The user who changed the previous value. - * - * @return + * @return user who changed the previous value */ public String getUserName() { return userName; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java index 414004601f..870c32ad63 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java @@ -73,9 +73,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The comments for this process group. - * - * @return + * @return comments for this process group */ public String getComments() { return comments; @@ -86,10 +84,8 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The contents of this process group. This field will be populated if the - * request is marked verbose. - * - * @return + * @return contents of this process group. This field will be populated if the + * request is marked verbose */ public FlowSnippetDTO getContents() { return contents; @@ -100,9 +96,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of input ports contained in this process group. - * - * @return + * @return number of input ports contained in this process group */ public Integer getInputPortCount() { return inputPortCount; @@ -113,9 +107,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of invalid components in this process group. - * - * @return + * @return number of invalid components in this process group */ public Integer getInvalidCount() { return invalidCount; @@ -126,9 +118,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of output ports in this process group. - * - * @return + * @return number of output ports in this process group */ public Integer getOutputPortCount() { return outputPortCount; @@ -139,9 +129,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * Used in requests, indicates whether this process group should be running. - * - * @return + * @return Used in requests, indicates whether this process group should be running */ public Boolean isRunning() { return running; @@ -152,9 +140,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of running component in this process group. - * - * @return + * @return number of running component in this process group */ public Integer getRunningCount() { return runningCount; @@ -165,9 +151,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of stopped components in this process group. - * - * @return + * @return number of stopped components in this process group */ public Integer getStoppedCount() { return stoppedCount; @@ -178,9 +162,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of disabled components in this process group. - * - * @return + * @return number of disabled components in this process group */ public Integer getDisabledCount() { return disabledCount; @@ -191,9 +173,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of active remote ports in this process group. - * - * @return + * @return number of active remote ports in this process group */ public Integer getActiveRemotePortCount() { return activeRemotePortCount; @@ -204,9 +184,7 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of inactive remote ports in this process group. - * - * @return + * @return number of inactive remote ports in this process group */ public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java index 63ed005026..b507033b68 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java @@ -54,8 +54,8 @@ public class ProcessorConfigDTO { } /** - * The frequency with which to schedule the processor. The format of the value will - * depend on the value of {@link #getSchedulingStrategy()}. + * The frequency with which to schedule the processor. The format of the + * value will depend on the value of {@link #getSchedulingStrategy()}. * * @return The scheduling period */ @@ -71,7 +71,7 @@ public class ProcessorConfigDTO { * Indicates whether the processor should be scheduled to run in * event-driven mode or timer-driven mode * - * @return + * @return scheduling strategy */ public String getSchedulingStrategy() { return schedulingStrategy; @@ -82,10 +82,7 @@ public class ProcessorConfigDTO { } /** - * The amount of time that is used when this processor penalizes a flow - * file. - * - * @return + * @return the amount of time that is used when this processor penalizes a flow file */ public String getPenaltyDuration() { return penaltyDuration; @@ -96,10 +93,8 @@ public class ProcessorConfigDTO { } /** - * When yielding, this amount of time must elaspe before this processor is - * scheduled again. - * - * @return + * @return amount of time must elaspe before this processor is + * scheduled again when yielding */ public String getYieldDuration() { return yieldDuration; @@ -110,9 +105,7 @@ public class ProcessorConfigDTO { } /** - * The level at this this processor will report bulletins. - * - * @return + * @return the level at this this processor will report bulletins */ public String getBulletinLevel() { return bulletinLevel; @@ -127,7 +120,7 @@ public class ProcessorConfigDTO { * processor. If this processor doesn't allow parallel processing then any * positive input will be ignored. * - * @return The concurrently schedulable task count + * @return the concurrently schedulable task count */ public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -138,9 +131,7 @@ public class ProcessorConfigDTO { } /** - * Whether or not this Processor is Loss Tolerant - * - * @return + * @return whether or not this Processor is Loss Tolerant */ public Boolean isLossTolerant() { return lossTolerant; @@ -151,9 +142,7 @@ public class ProcessorConfigDTO { } /** - * The comments for this processor. - * - * @return The comments + * @return the comments */ public String getComments() { return comments; @@ -181,9 +170,7 @@ public class ProcessorConfigDTO { } /** - * The descriptors for this processor's properties. - * - * @return + * @return descriptors for this processor's properties */ public Map getDescriptors() { return descriptors; @@ -207,10 +194,8 @@ public class ProcessorConfigDTO { } /** - * Returns the URL for this processors custom configuration UI - * if applicable. Null otherwise. - * - * @return + * @return the URL for this processors custom configuration UI if + * applicable. Null otherwise. */ public String getCustomUiUrl() { return customUiUrl; @@ -221,10 +206,8 @@ public class ProcessorConfigDTO { } /** - * The names of all processor relationships that cause a flow file to be + * @return the names of all processor relationships that cause a flow file to be * terminated if the relationship is not connected to anything - * - * @return */ public Set getAutoTerminatedRelationships() { return autoTerminatedRelationships; @@ -235,10 +218,8 @@ public class ProcessorConfigDTO { } /** - * Maps default values for concurrent tasks for each applicable scheduling + * @return maps default values for concurrent tasks for each applicable scheduling * strategy. - * - * @return */ public Map getDefaultConcurrentTasks() { return defaultConcurrentTasks; @@ -249,9 +230,7 @@ public class ProcessorConfigDTO { } /** - * The run duration in milliseconds. - * - * @return + * @return run duration in milliseconds */ public Long getRunDurationMillis() { return runDurationMillis; @@ -262,10 +241,8 @@ public class ProcessorConfigDTO { } /** - * Maps default values for scheduling period for each applicable scheduling - * strategy. - * - * @return + * @return Maps default values for scheduling period for each applicable scheduling + * strategy */ public Map getDefaultSchedulingPeriod() { return defaultSchedulingPeriod; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java index 71ba4edbe1..cda26cdc40 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java @@ -71,10 +71,8 @@ public class ProcessorDTO extends NiFiComponentDTO { } /** - * The state of this processor. Possible states are 'RUNNING', 'STOPPED', - * and 'DISABLED'. - * - * @return + * @return The state of this processor. Possible states are 'RUNNING', 'STOPPED', + * and 'DISABLED' */ public String getState() { return state; @@ -85,9 +83,7 @@ public class ProcessorDTO extends NiFiComponentDTO { } /** - * The styles for this processor. (Currently only supports color). - * - * @return + * @return The styles for this processor. (Currently only supports color) */ public Map getStyle() { return style; @@ -98,9 +94,7 @@ public class ProcessorDTO extends NiFiComponentDTO { } /** - * Whether this processor supports parallel processing. - * - * @return + * @return whether this processor supports parallel processing */ public Boolean getSupportsParallelProcessing() { return supportsParallelProcessing; @@ -111,9 +105,7 @@ public class ProcessorDTO extends NiFiComponentDTO { } /** - * Whether this processor supports event driven scheduling. - * - * @return + * @return whether this processor supports event driven scheduling */ public Boolean getSupportsEventDriven() { return supportsEventDriven; @@ -166,9 +158,7 @@ public class ProcessorDTO extends NiFiComponentDTO { } /** - * Gets the description for this processor. - * - * @return + * @return the description for this processor */ public String getDescription() { return description; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java index ecde255022..af3de2b91a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java @@ -37,10 +37,8 @@ public class PropertyDescriptorDTO { private String identifiesControllerService; /** - * The set of allowable values for this property. If empty then the - * allowable values are not constrained. - * - * @return + * @return set of allowable values for this property. If empty then the + * allowable values are not constrained */ public List getAllowableValues() { return allowableValues; @@ -51,9 +49,7 @@ public class PropertyDescriptorDTO { } /** - * The default value for this property. - * - * @return + * @return default value for this property */ public String getDefaultValue() { return defaultValue; @@ -64,11 +60,9 @@ public class PropertyDescriptorDTO { } /** - * And explanation of the meaning of the given property. This + * @return An explanation of the meaning of the given property. This * description is meant to be displayed to a user or simply provide a - * mechanism of documenting intent. - * - * @return + * mechanism of documenting intent */ public String getDescription() { return description; @@ -79,9 +73,7 @@ public class PropertyDescriptorDTO { } /** - * The property name. - * - * @return + * @return property name */ public String getName() { return name; @@ -92,9 +84,7 @@ public class PropertyDescriptorDTO { } /** - * The human-readable name to display to users. - * - * @return + * @return human-readable name to display to users */ public String getDisplayName() { return displayName; @@ -105,9 +95,7 @@ public class PropertyDescriptorDTO { } /** - * Determines whether the property is required for this processor. - * - * @return + * @return whether the property is required for this processor */ public boolean isRequired() { return required; @@ -118,10 +106,8 @@ public class PropertyDescriptorDTO { } /** - * Indicates that the value for this property should be considered - * sensitive and protected whenever stored or represented. - * - * @return + * @return indicates that the value for this property should be considered + * sensitive and protected whenever stored or represented */ public boolean isSensitive() { return sensitive; @@ -132,9 +118,7 @@ public class PropertyDescriptorDTO { } /** - * Indicates whether this property is dynamic. - * - * @return + * @return indicates whether this property is dynamic */ public boolean isDynamic() { return dynamic; @@ -145,9 +129,8 @@ public class PropertyDescriptorDTO { } /** - * Specifies whether or not this property support expression language. - * - * @return + * @return specifies whether or not this property support expression + * language */ public boolean getSupportsEl() { return supportsEl; @@ -158,10 +141,8 @@ public class PropertyDescriptorDTO { } /** - * If this property identifies a controller service, this returns the - * fully qualified type, null otherwise. - * - * @return + * @return if this property identifies a controller service, this returns + * the fully qualified type, null otherwise */ public String getIdentifiesControllerService() { return identifiesControllerService; @@ -170,7 +151,7 @@ public class PropertyDescriptorDTO { public void setIdentifiesControllerService(String identifiesControllerService) { this.identifiesControllerService = identifiesControllerService; } - + /** * The allowable values for a property with a constrained set of options. */ @@ -182,10 +163,8 @@ public class PropertyDescriptorDTO { private String description; /** - * Returns the human-readable value that is allowed for this + * @return the human-readable value that is allowed for this * PropertyDescriptor - * - * @return */ public String getDisplayName() { return displayName; @@ -196,9 +175,7 @@ public class PropertyDescriptorDTO { } /** - * Returns the value for this allowable value. - * - * @return + * @return the value for this allowable value */ public String getValue() { return value; @@ -209,10 +186,8 @@ public class PropertyDescriptorDTO { } /** - * Returns a description of this Allowable Value, or null + * @return a description of this Allowable Value, or null * if no description is given - * - * @return */ public String getDescription() { return description; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java index 064ad21b22..5dc5b99c19 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyHistoryDTO.java @@ -28,9 +28,7 @@ public class PropertyHistoryDTO { private List previousValues; /** - * The previous values. - * - * @return + * @return previous values */ public List getPreviousValues() { return previousValues; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java index 7042aaa362..a9fbfc6e66 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RelationshipDTO.java @@ -29,9 +29,7 @@ public class RelationshipDTO { private Boolean autoTerminate; /** - * The relationship name. - * - * @return + * @return the relationship name */ public String getName() { return name; @@ -42,9 +40,7 @@ public class RelationshipDTO { } /** - * The relationship description. - * - * @return + * @return the relationship description */ public String getDescription() { return description; @@ -55,9 +51,7 @@ public class RelationshipDTO { } /** - * Whether or not this relationship is auto terminated. - * - * @return + * @return true if relationship is auto terminated;false otherwise */ public Boolean isAutoTerminate() { return autoTerminate; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java index 1e5356d209..3645eb8ade 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupContentsDTO.java @@ -29,9 +29,7 @@ public class RemoteProcessGroupContentsDTO { private Set outputPorts; /** - * The Controller Input Ports to which data can be sent - * - * @return + * @return Controller Input Ports to which data can be sent */ public Set getInputPorts() { return inputPorts; @@ -42,9 +40,7 @@ public class RemoteProcessGroupContentsDTO { } /** - * The Controller Output Ports from which data can be retrieved - * - * @return + * @return Controller Output Ports from which data can be retrieved */ public Set getOutputPorts() { return outputPorts; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java index df59b13aaa..22bbee0d94 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java @@ -67,18 +67,14 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The target uri of this remote process group. - * - * @return + * @return target uri of this remote process group */ public String getTargetUri() { return this.targetUri; } /** - * The name of this remote process group. - * - * @param name + * @param name of this remote process group */ public void setName(final String name) { this.name = name; @@ -89,9 +85,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * Comments for this remote process group. - * - * @return + * @return Comments for this remote process group */ public String getComments() { return comments; @@ -102,9 +96,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * Returns any remote authorization issues for this remote process group. - * - * @return + * @return any remote authorization issues for this remote process group */ public List getAuthorizationIssues() { return authorizationIssues; @@ -115,9 +107,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * Whether or not this remote process group is actively transmitting. - * - * @return + * @return whether or not this remote process group is actively transmitting */ public Boolean isTransmitting() { return transmitting; @@ -128,9 +118,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * Whether or not the target is running securely. - * - * @return + * @return whether or not the target is running securely */ public Boolean isTargetSecure() { return targetSecure; @@ -141,10 +129,8 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * Returns the time period used for the timeout when communicating with this - * RemoteProcessGroup. - * - * @return + * @return the time period used for the timeout when communicating with this + * RemoteProcessGroup */ public String getCommunicationsTimeout() { return communicationsTimeout; @@ -155,10 +141,8 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * When yielding, this amount of time must elaspe before this remote process - * group is scheduled again. - * - * @return + * @return when yielding, this amount of time must elaspe before this remote process + * group is scheduled again */ public String getYieldDuration() { return yieldDuration; @@ -169,9 +153,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of active remote input ports. - * - * @return + * @return number of active remote input ports */ public Integer getActiveRemoteInputPortCount() { return activeRemoteInputPortCount; @@ -182,9 +164,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of inactive remote input ports. - * - * @return + * @return number of inactive remote input ports */ public Integer getInactiveRemoteInputPortCount() { return inactiveRemoteInputPortCount; @@ -195,9 +175,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of active remote output ports. - * - * @return + * @return number of active remote output ports */ public Integer getActiveRemoteOutputPortCount() { return activeRemoteOutputPortCount; @@ -208,9 +186,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of inactive remote output ports. - * - * @return + * @return number of inactive remote output ports */ public Integer getInactiveRemoteOutputPortCount() { return inactiveRemoteOutputPortCount; @@ -221,10 +197,8 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of Remote Input Ports currently available in the remote NiFi + * @return number of Remote Input Ports currently available in the remote NiFi * instance - * - * @return */ public Integer getInputPortCount() { return inputPortCount; @@ -235,10 +209,8 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The number of Remote Output Ports currently available in the remote NiFi + * @return number of Remote Output Ports currently available in the remote NiFi * instance - * - * @return */ public Integer getOutputPortCount() { return outputPortCount; @@ -249,10 +221,8 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * The contents of this remote process group. Will contain available - * input/output ports. - * - * @return + * @return contents of this remote process group. Will contain available + * input/output ports */ public RemoteProcessGroupContentsDTO getContents() { return contents; @@ -263,9 +233,7 @@ public class RemoteProcessGroupDTO extends NiFiComponentDTO { } /** - * When the flow for this remote group was last refreshed. - * - * @return + * @return the flow for this remote group was last refreshed */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getFlowRefreshed() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java index 7948dadd82..71d0f661d7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupPortDTO.java @@ -36,9 +36,7 @@ public class RemoteProcessGroupPortDTO { private Boolean connected; /** - * The comments as configured in the target port. - * - * @return + * @return comments as configured in the target port */ public String getComments() { return comments; @@ -49,10 +47,8 @@ public class RemoteProcessGroupPortDTO { } /** - * The number tasks that may transmit flow files to the target port - * concurrently. - * - * @return + * @return number tasks that may transmit flow files to the target port + * concurrently */ public Integer getConcurrentlySchedulableTaskCount() { return concurrentlySchedulableTaskCount; @@ -63,9 +59,7 @@ public class RemoteProcessGroupPortDTO { } /** - * The id of the target port. - * - * @return + * @return id of the target port */ public String getId() { return id; @@ -76,9 +70,7 @@ public class RemoteProcessGroupPortDTO { } /** - * The id of the remote process group that this port resides in. - * - * @return + * @return id of the remote process group that this port resides in */ public String getGroupId() { return groupId; @@ -89,9 +81,7 @@ public class RemoteProcessGroupPortDTO { } /** - * The name of the target port. - * - * @return + * @return name of the target port */ public String getName() { return name; @@ -102,9 +92,7 @@ public class RemoteProcessGroupPortDTO { } /** - * Whether or not this remote group port is configured for transmission. - * - * @return + * @return whether or not this remote group port is configured for transmission */ public Boolean isTransmitting() { return transmitting; @@ -115,9 +103,7 @@ public class RemoteProcessGroupPortDTO { } /** - * Whether or not flow file are compressed when sent to this target port. - * - * @return + * @return whether or not flow file are compressed when sent to this target port */ public Boolean getUseCompression() { return useCompression; @@ -128,9 +114,7 @@ public class RemoteProcessGroupPortDTO { } /** - * Whether or not the target port exists. - * - * @return + * @return whether or not the target port exists */ public Boolean getExists() { return exists; @@ -141,9 +125,7 @@ public class RemoteProcessGroupPortDTO { } /** - * Whether or not the target port is running. - * - * @return + * @return whether or not the target port is running */ public Boolean isTargetRunning() { return targetRunning; @@ -154,9 +136,7 @@ public class RemoteProcessGroupPortDTO { } /** - * Whether or not this port has either an incoming or outgoing connection. - * - * @return + * @return whether or not this port has either an incoming or outgoing connection */ public Boolean isConnected() { return connected; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java index a019f97341..6b6558ae4a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java @@ -22,147 +22,138 @@ import java.util.Map; import javax.xml.bind.annotation.XmlType; /** - * Component that is capable of reporting internal NiFi state to an external service + * Component that is capable of reporting internal NiFi state to an external + * service */ @XmlType(name = "reportingTask") public class ReportingTaskDTO extends NiFiComponentDTO { - private String name; - private String type; - private String state; - private String availability; + + private String name; + private String type; + private String state; + private String availability; private String comments; - - private String schedulingPeriod; - private String schedulingStrategy; + + private String schedulingPeriod; + private String schedulingStrategy; private Map defaultSchedulingPeriod; - - private Map properties; + + private Map properties; private Map descriptors; - + private String customUiUrl; private String annotationData; - + private Collection validationErrors; private Integer activeThreadCount; - + /** - * The user-defined name of the reporting task - * @return + * @return user-defined name of the reporting task */ - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - /** - * The user-defined comments for the reporting task - * @return - */ - public String getComments() { - return comments; - } + /** + * @return user-defined comments for the reporting task + */ + public String getComments() { + return comments; + } - public void setComments(String comments) { - this.comments = comments; - } + public void setComments(String comments) { + this.comments = comments; + } - /** - * The type of reporting task - * @return - */ - public String getType() { - return type; - } + /** + * @return type of reporting task + */ + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - /** - * The frequency with which to schedule the reporting task. The format of the value will - * depend on the value of {@link #getSchedulingStrategy()}. + /** + * The frequency with which to schedule the reporting task. The format of + * the value will depend on the value of {@link #getSchedulingStrategy()}. * * @return The scheduling period */ - public String getSchedulingPeriod() { - return schedulingPeriod; - } + public String getSchedulingPeriod() { + return schedulingPeriod; + } - public void setSchedulingPeriod(String schedulingPeriod) { - this.schedulingPeriod = schedulingPeriod; - } - - /** - * The current scheduling state of the reporting task - * @return - */ - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - /** - * The scheduling strategy that determines how the {@link #getSchedulingPeriod()} value should - * be interpreted - * - * @return - */ - public String getSchedulingStrategy() { - return schedulingStrategy; - } - - public void setSchedulingStrategy(String schedulingStrategy) { - this.schedulingStrategy = schedulingStrategy; - } - - /** - * Where this service is available. Possible values are CLUSTER_MANAGER_ONLY, NODE_ONLY, BOTH. - * - * @return - */ - public String getAvailability() { - return availability; - } - - public void setAvailability(String availability) { - this.availability = availability; - } - - /** - * The reporting task's properties - * @return - */ - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - - /** - * Map of property name to descriptor - * @return - */ - public Map getDescriptors() { - return descriptors; - } - - public void setDescriptors(Map descriptors) { - this.descriptors = descriptors; - } + public void setSchedulingPeriod(String schedulingPeriod) { + this.schedulingPeriod = schedulingPeriod; + } /** - * Returns the URL for this reporting task custom configuration UI - * if applicable. Null otherwise. - * - * @return + * @return current scheduling state of the reporting task + */ + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + /** + * @return The scheduling strategy that determines how the + * {@link #getSchedulingPeriod()} value should be interpreted + */ + public String getSchedulingStrategy() { + return schedulingStrategy; + } + + public void setSchedulingStrategy(String schedulingStrategy) { + this.schedulingStrategy = schedulingStrategy; + } + + /** + * @return Where this service is available. Possible values are + * CLUSTER_MANAGER_ONLY, NODE_ONLY, BOTH + */ + public String getAvailability() { + return availability; + } + + public void setAvailability(String availability) { + this.availability = availability; + } + + /** + * @return reporting task's properties + */ + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + /** + * @return Map of property name to descriptor + */ + public Map getDescriptors() { + return descriptors; + } + + public void setDescriptors(Map descriptors) { + this.descriptors = descriptors; + } + + /** + * @return the URL for this reporting task custom configuration UI if + * applicable. Null otherwise */ public String getCustomUiUrl() { return customUiUrl; @@ -172,22 +163,21 @@ public class ReportingTaskDTO extends NiFiComponentDTO { this.customUiUrl = customUiUrl; } - /** - * The currently configured annotation data for the reporting task - * @return - */ - public String getAnnotationData() { - return annotationData; - } - - public void setAnnotationData(String annotationData) { - this.annotationData = annotationData; - } - /** - * Gets the validation errors from this reporting task. These validation errors - * represent the problems with the reporting task that must be resolved before it - * can be scheduled to run. + * @return currently configured annotation data for the reporting task + */ + public String getAnnotationData() { + return annotationData; + } + + public void setAnnotationData(String annotationData) { + this.annotationData = annotationData; + } + + /** + * Gets the validation errors from this reporting task. These validation + * errors represent the problems with the reporting task that must be + * resolved before it can be scheduled to run. * * @return The validation errors */ @@ -200,9 +190,7 @@ public class ReportingTaskDTO extends NiFiComponentDTO { } /** - * The default scheduling period for the different scheduling strategies. - * - * @return + * @return default scheduling period for the different scheduling strategies */ public Map getDefaultSchedulingPeriod() { return defaultSchedulingPeriod; @@ -213,9 +201,7 @@ public class ReportingTaskDTO extends NiFiComponentDTO { } /** - * The number of active threads for this reporting task. - * - * @return + * @return number of active threads for this reporting task */ public Integer getActiveThreadCount() { return activeThreadCount; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java index 3327b49815..7a60c6edd2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RevisionDTO.java @@ -29,7 +29,6 @@ public class RevisionDTO { private String lastModifier; /* getters / setters */ - /** * A client identifier used to make a request. By including a client * identifier, the API can allow multiple requests without needing the @@ -63,9 +62,7 @@ public class RevisionDTO { } /** - * The user that last modified the flow. - * - * @return + * @return The user that last modified the flow */ public String getLastModifier() { return lastModifier; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java index 2ee13106da..8e2c21501b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java @@ -44,9 +44,7 @@ public class SnippetDTO { private FlowSnippetDTO contents; /** - * The id of this snippet. - * - * @return + * @return id of this snippet */ public String getId() { return id; @@ -57,9 +55,7 @@ public class SnippetDTO { } /** - * The uri of this snippet. - * - * @return + * @return uri of this snippet */ public String getUri() { return uri; @@ -70,9 +66,7 @@ public class SnippetDTO { } /** - * The group id for the components in this snippet. - * - * @return + * @return group id for the components in this snippet */ public String getParentGroupId() { return parentGroupId; @@ -83,9 +77,7 @@ public class SnippetDTO { } /** - * Whether or not this snippet is linked to the underlying data flow. - * - * @return + * @return whether or not this snippet is linked to the underlying data flow */ public Boolean isLinked() { return linked; @@ -96,12 +88,10 @@ public class SnippetDTO { } /** - * The ids of the connections in this snippet. These ids will be populated + * @return the ids of the connections in this snippet. These ids will be populated * within each response. They can be specified when creating a snippet. * However, once a snippet has been created its contents cannot be modified - * (these ids are ignored during update requests). - * - * @return + * (these ids are ignored during update requests) */ public Set getConnections() { return connections; @@ -112,12 +102,10 @@ public class SnippetDTO { } /** - * The ids of the funnels in this snippet. These ids will be populated + * @return the ids of the funnels in this snippet. These ids will be populated * within each response. They can be specified when creating a snippet. * However, once a snippet has been created its contents cannot be modified - * (these ids are ignored during update requests). - * - * @param funnels + * (these ids are ignored during update requests) */ public Set getFunnels() { return funnels; @@ -128,12 +116,10 @@ public class SnippetDTO { } /** - * The ids of the input port in this snippet. These ids will be populated + * @return the ids of the input port in this snippet. These ids will be populated * within each response. They can be specified when creating a snippet. * However, once a snippet has been created its contents cannot be modified - * (these ids are ignored during update requests). - * - * @return + * (these ids are ignored during update requests) */ public Set getInputPorts() { return inputPorts; @@ -144,12 +130,10 @@ public class SnippetDTO { } /** - * The ids of the labels in this snippet. These ids will be populated within + * @return the ids of the labels in this snippet. These ids will be populated within * each response. They can be specified when creating a snippet. However, * once a snippet has been created its contents cannot be modified (these - * ids are ignored during update requests). - * - * @return + * ids are ignored during update requests) */ public Set getLabels() { return labels; @@ -160,12 +144,10 @@ public class SnippetDTO { } /** - * The ids of the output ports in this snippet. These ids will be populated + * @return the ids of the output ports in this snippet. These ids will be populated * within each response. They can be specified when creating a snippet. * However, once a snippet has been created its contents cannot be modified - * (these ids are ignored during update requests). - * - * @return + * (these ids are ignored during update requests) */ public Set getOutputPorts() { return outputPorts; @@ -176,12 +158,10 @@ public class SnippetDTO { } /** - * The ids of the process groups in this snippet. These ids will be + * @return The ids of the process groups in this snippet. These ids will be * populated within each response. They can be specified when creating a * snippet. However, once a snippet has been created its contents cannot be - * modified (these ids are ignored during update requests). - * - * @return + * modified (these ids are ignored during update requests) */ public Set getProcessGroups() { return processGroups; @@ -192,12 +172,10 @@ public class SnippetDTO { } /** - * The ids of the processors in this snippet. These ids will be populated + * @return The ids of the processors in this snippet. These ids will be populated * within each response. They can be specified when creating a snippet. * However, once a snippet has been created its contents cannot be modified - * (these ids are ignored during update requests). - * - * @return + * (these ids are ignored during update requests) */ public Set getProcessors() { return processors; @@ -208,12 +186,10 @@ public class SnippetDTO { } /** - * The ids of the remote process groups in this snippet. These ids will be + * @return the ids of the remote process groups in this snippet. These ids will be * populated within each response. They can be specified when creating a * snippet. However, once a snippet has been created its contents cannot be - * modified (these ids are ignored during update requests). - * - * @return + * modified (these ids are ignored during update requests) */ public Set getRemoteProcessGroups() { return remoteProcessGroups; @@ -224,9 +200,7 @@ public class SnippetDTO { } /** - * The contents of the configuration for this snippet. - * - * @return + * @return the contents of the configuration for this snippet */ public FlowSnippetDTO getContents() { return contents; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java index 0b2085298f..f39cbafffd 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SystemDiagnosticsDTO.java @@ -54,9 +54,7 @@ public class SystemDiagnosticsDTO { /* getters / setters */ /** - * The number of available processors, if supported. - * - * @return + * @return number of available processors, if supported */ public Integer getAvailableProcessors() { return availableProcessors; @@ -67,9 +65,7 @@ public class SystemDiagnosticsDTO { } /** - * The number of daemon threads. - * - * @return + * @return number of daemon threads */ public Integer getDaemonThreads() { return daemonThreads; @@ -80,9 +76,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of free heap. - * - * @return + * @return amount of free heap */ public String getFreeHeap() { return freeHeap; @@ -93,9 +87,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of free non-heap. - * - * @return + * @return amount of free non-heap */ public String getFreeNonHeap() { return freeNonHeap; @@ -106,9 +98,7 @@ public class SystemDiagnosticsDTO { } /** - * The max size of the heap. - * - * @return + * @return max size of the heap */ public String getMaxHeap() { return maxHeap; @@ -119,9 +109,7 @@ public class SystemDiagnosticsDTO { } /** - * The max size of the non-heap. - * - * @return + * @return max size of the non-heap */ public String getMaxNonHeap() { return maxNonHeap; @@ -132,9 +120,7 @@ public class SystemDiagnosticsDTO { } /** - * The processor load average, if supported. - * - * @return + * @return processor load average, if supported */ public Double getProcessorLoadAverage() { return processorLoadAverage; @@ -145,9 +131,7 @@ public class SystemDiagnosticsDTO { } /** - * The total size of the heap. - * - * @return + * @return total size of the heap */ public String getTotalHeap() { return totalHeap; @@ -158,9 +142,7 @@ public class SystemDiagnosticsDTO { } /** - * The total size of non-heap. - * - * @return + * @return total size of non-heap */ public String getTotalNonHeap() { return totalNonHeap; @@ -171,9 +153,7 @@ public class SystemDiagnosticsDTO { } /** - * The total number of threads. - * - * @return + * @return total number of threads */ public Integer getTotalThreads() { return totalThreads; @@ -184,9 +164,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of used heap. - * - * @return + * @return amount of used heap */ public String getUsedHeap() { return usedHeap; @@ -197,9 +175,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of used non-heap. - * - * @return + * @return amount of used non-heap */ public String getUsedNonHeap() { return usedNonHeap; @@ -210,9 +186,7 @@ public class SystemDiagnosticsDTO { } /** - * The heap utilization. - * - * @return + * @return heap utilization */ public String getHeapUtilization() { return heapUtilization; @@ -223,9 +197,7 @@ public class SystemDiagnosticsDTO { } /** - * The non-heap utilization. - * - * @return + * @return non-heap utilization */ public String getNonHeapUtilization() { return nonHeapUtilization; @@ -236,9 +208,7 @@ public class SystemDiagnosticsDTO { } /** - * The content repository storage usage. - * - * @return + * @return content repository storage usage */ public Set getContentRepositoryStorageUsage() { return contentRepositoryStorageUsage; @@ -249,9 +219,7 @@ public class SystemDiagnosticsDTO { } /** - * The flowfile repository storage usage. - * - * @return + * @return flowfile repository storage usage */ public StorageUsageDTO getFlowFileRepositoryStorageUsage() { return flowFileRepositoryStorageUsage; @@ -262,9 +230,7 @@ public class SystemDiagnosticsDTO { } /** - * Garbage collection details. - * - * @return + * @return Garbage collection details */ public Set getGarbageCollection() { return garbageCollection; @@ -275,9 +241,7 @@ public class SystemDiagnosticsDTO { } /** - * When these diagnostics were generated. - * - * @return + * @return When these diagnostics were generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getStatsLastRefreshed() { @@ -304,9 +268,7 @@ public class SystemDiagnosticsDTO { private String utilization; /** - * The identifier for this storage location. - * - * @return + * @return identifier for this storage location */ public String getIdentifier() { return identifier; @@ -317,9 +279,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of free space. - * - * @return + * @return amount of free space */ public String getFreeSpace() { return freeSpace; @@ -330,9 +290,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of total space. - * - * @param freeSpace + * @return freeSpace amount of total space */ public String getTotalSpace() { return totalSpace; @@ -343,9 +301,7 @@ public class SystemDiagnosticsDTO { } /** - * The amount of used space. - * - * @return + * @return amount of used space */ public String getUsedSpace() { return usedSpace; @@ -356,9 +312,7 @@ public class SystemDiagnosticsDTO { } /** - * The utilization of this storage location. - * - * @return + * @return utilization of this storage location */ public String getUtilization() { return utilization; @@ -369,9 +323,7 @@ public class SystemDiagnosticsDTO { } /** - * The number of bytes of free space. - * - * @return + * @return number of bytes of free space */ public Long getFreeSpaceBytes() { return freeSpaceBytes; @@ -382,9 +334,7 @@ public class SystemDiagnosticsDTO { } /** - * The number of bytes of total space. - * - * @return + * @return number of bytes of total space */ public Long getTotalSpaceBytes() { return totalSpaceBytes; @@ -395,9 +345,7 @@ public class SystemDiagnosticsDTO { } /** - * The number of bytes of used space. - * - * @return + * @return number of bytes of used space */ public Long getUsedSpaceBytes() { return usedSpaceBytes; @@ -419,9 +367,7 @@ public class SystemDiagnosticsDTO { private String collectionTime; /** - * The name of the garbage collector. - * - * @return + * @return name of the garbage collector */ public String getName() { return name; @@ -436,18 +382,14 @@ public class SystemDiagnosticsDTO { } /** - * The number of times garbage collection has run. - * - * @param collectionCount + * @param collectionCount number of times garbage collection has run */ public void setCollectionCount(long collectionCount) { this.collectionCount = collectionCount; } /** - * The total amount of time spent garbage collecting. - * - * @return + * @return total amount of time spent garbage collecting */ public String getCollectionTime() { return collectionTime; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java index 156a6e9382..635e3e81cb 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java @@ -37,9 +37,7 @@ public class TemplateDTO { private FlowSnippetDTO snippet; /** - * The id for this template. - * - * @return + * @return id for this template */ public String getId() { return id; @@ -50,9 +48,7 @@ public class TemplateDTO { } /** - * The uri for this template. - * - * @return + * @return uri for this template */ public String getUri() { return uri; @@ -63,9 +59,7 @@ public class TemplateDTO { } /** - * The name of this template. - * - * @return + * @return name of this template */ public String getName() { return name; @@ -76,9 +70,7 @@ public class TemplateDTO { } /** - * The description of this template. - * - * @return + * @return description of this template */ public String getDescription() { return description; @@ -89,9 +81,7 @@ public class TemplateDTO { } /** - * The timestamp when this template was created. - * - * @return + * @return timestamp when this template was created */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getTimestamp() { @@ -103,9 +93,7 @@ public class TemplateDTO { } /** - * The snippet in this template. - * - * @return + * @return snippet in this template */ public FlowSnippetDTO getSnippet() { return snippet; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java index 85c82dc3a0..c62f99c2e9 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserDTO.java @@ -41,9 +41,7 @@ public class UserDTO { private Set authorities; /** - * The user id. - * - * @return + * @return user id */ public String getId() { return id; @@ -54,9 +52,7 @@ public class UserDTO { } /** - * The users authorities. - * - * @return + * @return users authorities */ public Set getAuthorities() { return authorities; @@ -67,9 +63,7 @@ public class UserDTO { } /** - * The creation time for this users account. - * - * @return + * @return creation time for this users account */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getCreation() { @@ -81,9 +75,7 @@ public class UserDTO { } /** - * The users DN. - * - * @return + * @return users DN */ public String getDn() { return dn; @@ -94,10 +86,8 @@ public class UserDTO { } /** - * The users name. If the name could not be extracted from the DN, this - * value will be the entire DN. - * - * @return + * @return users name. If the name could not be extracted from the DN, this + * value will be the entire DN */ public String getUserName() { return userName; @@ -108,9 +98,7 @@ public class UserDTO { } /** - * The user group. - * - * @return + * @return user group */ public String getUserGroup() { return userGroup; @@ -121,9 +109,7 @@ public class UserDTO { } /** - * The users account justification. - * - * @return + * @return users account justification */ public String getJustification() { return justification; @@ -134,9 +120,7 @@ public class UserDTO { } /** - * The time that the user last accessed the system. - * - * @return + * @return time that the user last accessed the system */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getLastAccessed() { @@ -148,9 +132,7 @@ public class UserDTO { } /** - * The time that the users credentials were last verified. - * - * @return + * @return time that the users credentials were last verified */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getLastVerified() { @@ -162,9 +144,7 @@ public class UserDTO { } /** - * The status of the users account. - * - * @return + * @return status of the users account */ public String getStatus() { return status; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java index 285c355841..6c4d224e61 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/UserGroupDTO.java @@ -31,9 +31,7 @@ public class UserGroupDTO { private String status; /** - * The user group. - * - * @return + * @return user group */ public String getGroup() { return group; @@ -44,9 +42,7 @@ public class UserGroupDTO { } /** - * The users in this group. - * - * @return + * @return users in this group */ public Set getUserIds() { return userIds; @@ -57,9 +53,7 @@ public class UserGroupDTO { } /** - * The status of the users account. - * - * @return + * @return status of the users account */ public String getStatus() { return status; @@ -70,9 +64,7 @@ public class UserGroupDTO { } /** - * The users authorities. - * - * @return + * @return users authorities */ public Set getAuthorities() { return authorities; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java index 84024801f2..357dd0fa6b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/ActionDTO.java @@ -43,9 +43,7 @@ public class ActionDTO { private ActionDetailsDTO actionDetails; /** - * The action id. - * - * @return + * @return action id */ public Integer getId() { return id; @@ -56,9 +54,7 @@ public class ActionDTO { } /** - * The user dn who perform this action. - * - * @return + * @return user dn who perform this action */ public String getUserDn() { return userDn; @@ -69,9 +65,7 @@ public class ActionDTO { } /** - * The user name who perform this action. - * - * @return + * @return user name who perform this action */ public String getUserName() { return userName; @@ -82,9 +76,7 @@ public class ActionDTO { } /** - * This action's timestamp. - * - * @return + * @return action's timestamp */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getTimestamp() { @@ -96,9 +88,7 @@ public class ActionDTO { } /** - * The id of the source component of this action. - * - * @return + * @return id of the source component of this action */ public String getSourceId() { return sourceId; @@ -109,9 +99,7 @@ public class ActionDTO { } /** - * The name of the source component of this action. - * - * @return + * @return name of the source component of this action */ public String getSourceName() { return sourceName; @@ -122,9 +110,7 @@ public class ActionDTO { } /** - * The type of the source component of this action. - * - * @return + * @return type of the source component of this action */ public String getSourceType() { return sourceType; @@ -135,9 +121,7 @@ public class ActionDTO { } /** - * The component details (if any) for this action. - * - * @return + * @return component details (if any) for this action */ public ComponentDetailsDTO getComponentDetails() { return componentDetails; @@ -148,9 +132,7 @@ public class ActionDTO { } /** - * The operation being performed in this action. - * - * @return + * @return operation being performed in this action */ public String getOperation() { return operation; @@ -161,9 +143,7 @@ public class ActionDTO { } /** - * The action details (if any) for this action. - * - * @return + * @return action details (if any) for this action */ public ActionDetailsDTO getActionDetails() { return actionDetails; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java index 9ab47ed566..36a5e47202 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryDTO.java @@ -33,9 +33,7 @@ public class HistoryDTO { private Collection actions; /** - * The total number of actions. - * - * @return + * @return total number of actions */ public Integer getTotal() { return total; @@ -46,9 +44,7 @@ public class HistoryDTO { } /** - * Timestamp when these records were returned. - * - * @return + * @return timestamp when these records were returned */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getLastRefreshed() { @@ -60,9 +56,7 @@ public class HistoryDTO { } /** - * The actions for this range. - * - * @return + * @return actions for this range */ public Collection getActions() { return actions; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java index e8e11e5a05..48a1321be8 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/HistoryQueryDTO.java @@ -37,9 +37,7 @@ public class HistoryQueryDTO { private String sortOrder; /** - * The user name. - * - * @return + * @return user name */ public String getUserName() { return userName; @@ -50,9 +48,7 @@ public class HistoryQueryDTO { } /** - * The source component id. - * - * @return + * @return source component id */ public String getSourceId() { return sourceId; @@ -63,9 +59,7 @@ public class HistoryQueryDTO { } /** - * The start date. - * - * @return + * @return start date */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getStartDate() { @@ -77,9 +71,7 @@ public class HistoryQueryDTO { } /** - * The end date. - * - * @return + * @return end date */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getEndDate() { @@ -91,9 +83,7 @@ public class HistoryQueryDTO { } /** - * The offset. - * - * @return + * @return offset */ public Integer getOffset() { return offset; @@ -104,9 +94,7 @@ public class HistoryQueryDTO { } /** - * The desired row count. - * - * @return + * @return desired row count */ public Integer getCount() { return count; @@ -117,9 +105,7 @@ public class HistoryQueryDTO { } /** - * The desired sort column. - * - * @return + * @return desired sort column */ public String getSortColumn() { return sortColumn; @@ -130,9 +116,7 @@ public class HistoryQueryDTO { } /** - * The desired sort order. - * - * @return + * @return desired sort order */ public String getSortOrder() { return sortOrder; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java index e2e49d67a2..90eb5f05e6 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/ExtensionDetailsDTO.java @@ -27,9 +27,7 @@ public class ExtensionDetailsDTO extends ComponentDetailsDTO { private String type; /** - * The extension type. - * - * @return + * @return extension type */ public String getType() { return type; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java index 280939808d..a696a25bed 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/component/details/RemoteProcessGroupDetailsDTO.java @@ -27,9 +27,7 @@ public class RemoteProcessGroupDetailsDTO extends ComponentDetailsDTO { private String uri; /** - * The URI of the remote process group. - * - * @return + * @return URI of the remote process group */ public String getUri() { return uri; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java index 4011b007b6..223994625b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConfigureDetailsDTO.java @@ -29,9 +29,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { private String value; /** - * The name of the property that was modified. - * - * @return + * @return name of the property that was modified */ public String getName() { return name; @@ -42,9 +40,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { } /** - * The previous value. - * - * @return + * @return previous value */ public String getPreviousValue() { return previousValue; @@ -55,9 +51,7 @@ public class ConfigureDetailsDTO extends ActionDetailsDTO { } /** - * The new value. - * - * @return + * @return new value */ public String getValue() { return value; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java index ba88bd10da..a6d5d99dfc 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/ConnectDetailsDTO.java @@ -33,9 +33,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { private String destinationType; /** - * The id of the source of the connection. - * - * @return + * @return id of the source of the connection */ public String getSourceId() { return sourceId; @@ -46,9 +44,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The name of the source of the connection. - * - * @return + * @return name of the source of the connection */ public String getSourceName() { return sourceName; @@ -59,9 +55,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The type of the source of the connection. - * - * @return + * @return type of the source of the connection */ public String getSourceType() { return sourceType; @@ -72,9 +66,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The name of the relationship that was connected. - * - * @return + * @return name of the relationship that was connected */ public String getRelationship() { return relationship; @@ -85,9 +77,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The id of the destination of the connection. - * - * @return + * @return id of the destination of the connection */ public String getDestinationId() { return destinationId; @@ -98,9 +88,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The name of the destination of the connection. - * - * @return + * @return name of the destination of the connection */ public String getDestinationName() { return destinationName; @@ -111,9 +99,7 @@ public class ConnectDetailsDTO extends ActionDetailsDTO { } /** - * The type of the destination of the connection. - * - * @return + * @return type of the destination of the connection */ public String getDestinationType() { return destinationType; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java index c6f04509d6..a7f7cf8537 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/MoveDetailsDTO.java @@ -30,9 +30,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { private String group; /** - * The id of the group the components previously belonged to. - * - * @return + * @return id of the group the components previously belonged to */ public String getPreviousGroupId() { return previousGroupId; @@ -43,9 +41,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { } /** - * The name of the group of the components previously belonged to. - * - * @return + * @return name of the group of the components previously belonged to */ public String getPreviousGroup() { return previousGroup; @@ -56,9 +52,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { } /** - * The id of the group the components belong to. - * - * @return + * @return id of the group the components belong to */ public String getGroupId() { return groupId; @@ -69,9 +63,7 @@ public class MoveDetailsDTO extends ActionDetailsDTO { } /** - * The name of the group the components belong to. - * - * @return + * @return name of the group the components belong to */ public String getGroup() { return group; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java index b5a5bcbadf..6d5b02f40c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/action/details/PurgeDetailsDTO.java @@ -30,9 +30,7 @@ public class PurgeDetailsDTO extends ActionDetailsDTO { private Date endDate; /** - * The end date for this purge action. - * - * @return + * @return end date for this purge action */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getEndDate() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java index ed5807799c..a9db5d0eaa 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/AttributeDTO.java @@ -29,9 +29,7 @@ public class AttributeDTO { private String previousValue; /** - * The attribute name. - * - * @return + * @return attribute name */ public String getName() { return name; @@ -42,9 +40,7 @@ public class AttributeDTO { } /** - * The attribute value. - * - * @return + * @return attribute value */ public String getValue() { return value; @@ -55,9 +51,7 @@ public class AttributeDTO { } /** - * The value of this attribute before the event took place. - * - * @return + * @return value of this attribute before the event took place */ public String getPreviousValue() { return previousValue; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java index 90dd119dca..333570e9fa 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceDTO.java @@ -44,9 +44,7 @@ public class ProvenanceDTO { private ProvenanceResultsDTO results; /** - * The id of this provenance query. - * - * @return + * @return id of this provenance query */ public String getId() { return id; @@ -57,9 +55,7 @@ public class ProvenanceDTO { } /** - * The URI for this query. Used for obtaining the requests at a later time. - * - * @return + * @return URI for this query. Used for obtaining the requests at a later time */ public String getUri() { return uri; @@ -70,9 +66,7 @@ public class ProvenanceDTO { } /** - * The id of the node in the cluster where this provenance originated. - * - * @return + * @return id of the node in the cluster where this provenance originated */ public String getClusterNodeId() { return clusterNodeId; @@ -83,9 +77,7 @@ public class ProvenanceDTO { } /** - * The time the query was submitted. - * - * @return + * @return time the query was submitted */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getSubmissionTime() { @@ -97,9 +89,7 @@ public class ProvenanceDTO { } /** - * The expiration time of the query results. - * - * @return + * @return expiration time of the query results */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getExpiration() { @@ -111,9 +101,7 @@ public class ProvenanceDTO { } /** - * The percent completed. - * - * @return + * @return percent completed */ public Integer getPercentCompleted() { return percentCompleted; @@ -124,9 +112,7 @@ public class ProvenanceDTO { } /** - * Whether the query has finished. - * - * @return + * @return whether the query has finished */ public Boolean isFinished() { return finished; @@ -137,9 +123,7 @@ public class ProvenanceDTO { } /** - * The provenance request. - * - * @return + * @return provenance request */ public ProvenanceRequestDTO getRequest() { return request; @@ -150,9 +134,7 @@ public class ProvenanceDTO { } /** - * The results of this query. - * - * @return + * @return results of this query */ public ProvenanceResultsDTO getResults() { return results; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java index b1ead42c65..883fce8392 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceEventDTO.java @@ -83,9 +83,7 @@ public class ProvenanceEventDTO { private String sourceConnectionIdentifier; /** - * The event uuid. - * - * @return + * @return event uuid */ public String getId() { return id; @@ -96,9 +94,7 @@ public class ProvenanceEventDTO { } /** - * The event id. - * - * @return + * @return event id */ public Long getEventId() { return eventId; @@ -109,9 +105,7 @@ public class ProvenanceEventDTO { } /** - * The time the event occurred. - * - * @return + * @return time the event occurred */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getEventTime() { @@ -123,9 +117,7 @@ public class ProvenanceEventDTO { } /** - * The UUID of the FlowFile for this event. - * - * @return + * @return UUID of the FlowFile for this event */ public String getFlowFileUuid() { return flowFileUuid; @@ -136,9 +128,7 @@ public class ProvenanceEventDTO { } /** - * The size of the FlowFile for this event. - * - * @return + * @return size of the FlowFile for this event */ public String getFileSize() { return fileSize; @@ -149,9 +139,7 @@ public class ProvenanceEventDTO { } /** - * The size of the FlowFile in bytes for this event. - * - * @return + * @return size of the FlowFile in bytes for this event */ public Long getFileSizeBytes() { return fileSizeBytes; @@ -162,9 +150,7 @@ public class ProvenanceEventDTO { } /** - * The type of this event. - * - * @return + * @return type of this event */ public String getEventType() { return eventType; @@ -175,9 +161,7 @@ public class ProvenanceEventDTO { } /** - * The attributes for the FlowFile for this event. - * - * @return + * @return attributes for the FlowFile for this event */ public Collection getAttributes() { return attributes; @@ -188,10 +172,8 @@ public class ProvenanceEventDTO { } /** - * The id of the group that this component resides in. If the component is - * no longer in the flow, the group id will not be set. - * - * @return + * @return id of the group that this component resides in. If the component is + * no longer in the flow, the group id will not be set */ public String getGroupId() { return groupId; @@ -202,9 +184,7 @@ public class ProvenanceEventDTO { } /** - * The id of the component that generated this event. - * - * @return + * @return id of the component that generated this event */ public String getComponentId() { return componentId; @@ -215,9 +195,7 @@ public class ProvenanceEventDTO { } /** - * The name of the component that generated this event. - * - * @return + * @return name of the component that generated this event */ public String getComponentName() { return componentName; @@ -228,9 +206,7 @@ public class ProvenanceEventDTO { } /** - * The type of the component that generated this event. - * - * @return + * @return type of the component that generated this event */ public String getComponentType() { return componentType; @@ -241,9 +217,7 @@ public class ProvenanceEventDTO { } /** - * The source/destination system URI if the event was a RECEIVE/SEND. - * - * @return + * @return source/destination system URI if the event was a RECEIVE/SEND */ public String getTransitUri() { return transitUri; @@ -254,9 +228,7 @@ public class ProvenanceEventDTO { } /** - * The alternate identifier URI for the FlowFile for this event. - * - * @return + * @return alternate identifier URI for the FlowFile for this event */ public String getAlternateIdentifierUri() { return alternateIdentifierUri; @@ -267,9 +239,7 @@ public class ProvenanceEventDTO { } /** - * The identifier of the node where this event originated. - * - * @return + * @return identifier of the node where this event originated */ public String getClusterNodeId() { return clusterNodeId; @@ -280,9 +250,7 @@ public class ProvenanceEventDTO { } /** - * The label to use to show which node this event originated from. - * - * @return + * @return label to use to show which node this event originated from */ public String getClusterNodeAddress() { return clusterNodeAddress; @@ -293,9 +261,7 @@ public class ProvenanceEventDTO { } /** - * The parent uuids for this event. - * - * @return + * @return parent uuids for this event */ public List getParentUuids() { return parentUuids; @@ -306,9 +272,7 @@ public class ProvenanceEventDTO { } /** - * The child uuids for this event. - * - * @return + * @return child uuids for this event */ public List getChildUuids() { return childUuids; @@ -319,9 +283,7 @@ public class ProvenanceEventDTO { } /** - * The duration of the event, in milliseconds. - * - * @return + * @return duration of the event, in milliseconds */ public Long getEventDuration() { return eventDuration; @@ -332,9 +294,7 @@ public class ProvenanceEventDTO { } /** - * The duration since the lineage began, in milliseconds. - * - * @return + * @return duration since the lineage began, in milliseconds */ public Long getLineageDuration() { return lineageDuration; @@ -345,9 +305,7 @@ public class ProvenanceEventDTO { } /** - * The source system FlowFile id. - * - * @return + * @return source system FlowFile id */ public String getSourceSystemFlowFileId() { return sourceSystemFlowFileId; @@ -358,10 +316,8 @@ public class ProvenanceEventDTO { } /** - * If this represents a route event, this is the relationship to which the - * flowfile was routed. - * - * @return + * @return If this represents a route event, this is the relationship to which the + * flowfile was routed */ public String getRelationship() { return relationship; @@ -372,9 +328,7 @@ public class ProvenanceEventDTO { } /** - * The event details. - * - * @return + * @return event details */ public String getDetails() { return details; @@ -385,9 +339,7 @@ public class ProvenanceEventDTO { } /** - * Whether or not the input and output content claim is the same. - * - * @return + * @return whether or not the input and output content claim is the same */ public Boolean getContentEqual() { return contentEqual; @@ -398,9 +350,7 @@ public class ProvenanceEventDTO { } /** - * Returns whether or not the output content is still available. - * - * @return + * @return whether or not the output content is still available */ public Boolean getOutputContentAvailable() { return outputContentAvailable; @@ -411,10 +361,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Section in which the output Content Claim lives, or - * null if no Content Claim exists. - * - * @return + * @return the Section in which the output Content Claim lives, or + * null if no Content Claim exists */ public String getOutputContentClaimSection() { return outputContentClaimSection; @@ -425,10 +373,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Container in which the output Content Claim lives, or - * null if no Content Claim exists. - * - * @return + * @return the Container in which the output Content Claim lives, or + * null if no Content Claim exists */ public String getOutputContentClaimContainer() { return outputContentClaimContainer; @@ -439,10 +385,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Identifier of the output Content Claim, or null - * if no Content Claim exists. - * - * @return + * @return the Identifier of the output Content Claim, or null + * if no Content Claim exists */ public String getOutputContentClaimIdentifier() { return outputContentClaimIdentifier; @@ -453,10 +397,8 @@ public class ProvenanceEventDTO { } /** - * Returns the offset into the the output Content Claim where the FlowFile's - * content begins, or null if no Content Claim exists. - * - * @return + * @return the offset into the the output Content Claim where the FlowFile's + * content begins, or null if no Content Claim exists */ public Long getOutputContentClaimOffset() { return outputContentClaimOffset; @@ -467,9 +409,7 @@ public class ProvenanceEventDTO { } /** - * Returns the formatted file size of the input content claim. - * - * @return + * @return the formatted file size of the input content claim */ public String getOutputContentClaimFileSize() { return outputContentClaimFileSize; @@ -480,9 +420,7 @@ public class ProvenanceEventDTO { } /** - * Returns the number of bytes of the input content claim. - * - * @return + * @return the number of bytes of the input content claim */ public Long getOutputContentClaimFileSizeBytes() { return outputContentClaimFileSizeBytes; @@ -493,9 +431,7 @@ public class ProvenanceEventDTO { } /** - * Returns whether or not the input content is still available. - * - * @return + * @return whether or not the input content is still available */ public Boolean getInputContentAvailable() { return inputContentAvailable; @@ -506,10 +442,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Section in which the input Content Claim lives, or - * null if no Content Claim exists. - * - * @return + * @return the Section in which the input Content Claim lives, or + * null if no Content Claim exists */ public String getInputContentClaimSection() { return inputContentClaimSection; @@ -520,10 +454,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Container in which the input Content Claim lives, or - * null if no Content Claim exists. - * - * @return + * @return the Container in which the input Content Claim lives, or + * null if no Content Claim exists */ public String getInputContentClaimContainer() { return inputContentClaimContainer; @@ -534,10 +466,8 @@ public class ProvenanceEventDTO { } /** - * Returns the Identifier of the input Content Claim, or null - * if no Content Claim exists. - * - * @return + * @return the Identifier of the input Content Claim, or null + * if no Content Claim exists */ public String getInputContentClaimIdentifier() { return inputContentClaimIdentifier; @@ -548,10 +478,8 @@ public class ProvenanceEventDTO { } /** - * Returns the offset into the the input Content Claim where the FlowFile's - * content begins, or null if no Content Claim exists. - * - * @return + * @return the offset into the the input Content Claim where the FlowFile's + * content begins, or null if no Content Claim exists */ public Long getInputContentClaimOffset() { return inputContentClaimOffset; @@ -562,9 +490,7 @@ public class ProvenanceEventDTO { } /** - * Returns the formatted file size of the input content claim. - * - * @return + * @return the formatted file size of the input content claim */ public String getInputContentClaimFileSize() { return inputContentClaimFileSize; @@ -575,9 +501,7 @@ public class ProvenanceEventDTO { } /** - * Returns the number of bytes of the input content claim. - * - * @return + * @return the number of bytes of the input content claim */ public Long getInputContentClaimFileSizeBytes() { return inputContentClaimFileSizeBytes; @@ -588,9 +512,7 @@ public class ProvenanceEventDTO { } /** - * Returns whether or not replay is available. - * - * @return + * @return whether or not replay is available */ public Boolean getReplayAvailable() { return replayAvailable; @@ -601,9 +523,7 @@ public class ProvenanceEventDTO { } /** - * Returns the explanation as to why replay is unavailable. - * - * @return + * @return the explanation as to why replay is unavailable */ public String getReplayExplanation() { return replayExplanation; @@ -614,11 +534,9 @@ public class ProvenanceEventDTO { } /** - * Returns identifier of the FlowFile Queue / Connection from which the + * @return identifier of the FlowFile Queue / Connection from which the * FlowFile was pulled to generate this event, or null if - * either the queue is unknown or the FlowFile was created by this event. - * - * @return + * either the queue is unknown or the FlowFile was created by this event */ public String getSourceConnectionIdentifier() { return sourceConnectionIdentifier; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java index 7f939b9d15..2c7f4675c4 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceOptionsDTO.java @@ -28,9 +28,7 @@ public class ProvenanceOptionsDTO { private List searchableFields; /** - * The available searchable fields for this NiFi instance. - * - * @return + * @return available searchable fields for this NiFi instance */ public List getSearchableFields() { return searchableFields; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java index e9e54534ed..bc239eee39 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceRequestDTO.java @@ -37,9 +37,7 @@ public class ProvenanceRequestDTO { private Integer maxResults; /** - * Returns the search terms to use for this search - * - * @return + * @return the search terms to use for this search */ public Map getSearchTerms() { return searchTerms; @@ -50,9 +48,7 @@ public class ProvenanceRequestDTO { } /** - * The earliest event time to include in the query - * - * @return + * @return earliest event time to include in the query */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getStartDate() { @@ -64,9 +60,7 @@ public class ProvenanceRequestDTO { } /** - * The latest event time to include in the query - * - * @return + * @return latest event time to include in the query */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getEndDate() { @@ -78,9 +72,7 @@ public class ProvenanceRequestDTO { } /** - * The minimum file size to include in the query. - * - * @return + * @return minimum file size to include in the query */ public String getMinimumFileSize() { return minimumFileSize; @@ -91,9 +83,7 @@ public class ProvenanceRequestDTO { } /** - * The maximum file size to include in the query. - * - * @return + * @return maximum file size to include in the query */ public String getMaximumFileSize() { return maximumFileSize; @@ -104,9 +94,7 @@ public class ProvenanceRequestDTO { } /** - * The number of max results. - * - * @return + * @return number of max results */ public Integer getMaxResults() { return maxResults; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java index d6ea8a00d7..6d2f64d317 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceResultsDTO.java @@ -41,9 +41,7 @@ public class ProvenanceResultsDTO { private Set errors; /** - * Any error messages. - * - * @return + * @return error messages */ public Set getErrors() { return errors; @@ -54,9 +52,7 @@ public class ProvenanceResultsDTO { } /** - * The provenance events that matched the search criteria. - * - * @return + * @return provenance events that matched the search criteria */ public List getProvenanceEvents() { return provenanceEvents; @@ -67,9 +63,7 @@ public class ProvenanceResultsDTO { } /** - * The total number of results formatted. - * - * @return + * @return total number of results formatted */ public String getTotal() { return total; @@ -80,9 +74,7 @@ public class ProvenanceResultsDTO { } /** - * The total number of results. - * - * @return + * @return total number of results */ public Long getTotalCount() { return totalCount; @@ -93,9 +85,7 @@ public class ProvenanceResultsDTO { } /** - * When the search was performed. - * - * @return + * @return when the search was performed */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { @@ -107,9 +97,7 @@ public class ProvenanceResultsDTO { } /** - * The oldest event available in the provenance repository. - * - * @return + * @return oldest event available in the provenance repository */ @XmlJavaTypeAdapter(DateTimeAdapter.class) public Date getOldestEvent() { @@ -121,9 +109,7 @@ public class ProvenanceResultsDTO { } /** - * The time offset on the server thats used for event time. - * - * @return + * @return time offset on the server thats used for event time */ public Integer getTimeOffset() { return timeOffset; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java index af89f97c3f..97300f6e85 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/ProvenanceSearchableFieldDTO.java @@ -30,9 +30,7 @@ public class ProvenanceSearchableFieldDTO { private String type; /** - * The id of this searchable field. - * - * @return + * @return id of this searchable field */ public String getId() { return id; @@ -43,9 +41,7 @@ public class ProvenanceSearchableFieldDTO { } /** - * The field. - * - * @return + * @return the field */ public String getField() { return field; @@ -56,9 +52,7 @@ public class ProvenanceSearchableFieldDTO { } /** - * The label for this field. - * - * @return + * @return label for this field */ public String getLabel() { return label; @@ -69,9 +63,7 @@ public class ProvenanceSearchableFieldDTO { } /** - * The type for this field. - * - * @return + * @return type of this field */ public String getType() { return type; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java index 745105ed01..0ef8aab25d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageDTO.java @@ -40,9 +40,7 @@ public class LineageDTO { private LineageResultsDTO results; /** - * The id of this lineage. - * - * @return + * @return id of this lineage */ public String getId() { return id; @@ -53,9 +51,7 @@ public class LineageDTO { } /** - * The uri for this lineage. - * - * @return + * @return uri for this lineage */ public String getUri() { return uri; @@ -66,9 +62,7 @@ public class LineageDTO { } /** - * The id of the node in the cluster where this lineage originated. - * - * @return + * @return id of the node in the cluster where this lineage originated */ public String getClusterNodeId() { return clusterNodeId; @@ -79,9 +73,7 @@ public class LineageDTO { } /** - * The submission time for this lineage. - * - * @return + * @return submission time for this lineage */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getSubmissionTime() { @@ -93,9 +85,7 @@ public class LineageDTO { } /** - * The expiration of this lineage. - * - * @return + * @return expiration of this lineage */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getExpiration() { @@ -107,9 +97,7 @@ public class LineageDTO { } /** - * Percent completed for this result. - * - * @return + * @return percent completed for this result */ public Integer getPercentCompleted() { return percentCompleted; @@ -120,9 +108,7 @@ public class LineageDTO { } /** - * Whether or not the request is finished running. - * - * @return + * @return whether or not the request is finished running */ public Boolean getFinished() { return finished; @@ -133,9 +119,7 @@ public class LineageDTO { } /** - * The lineage request. - * - * @return + * @return the lineage request */ public LineageRequestDTO getRequest() { return request; @@ -146,9 +130,7 @@ public class LineageDTO { } /** - * The results of this lineage. - * - * @return + * @return the results of this lineage */ public LineageResultsDTO getResults() { return results; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java index 23cf892cfa..afcea3f062 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageRequestDTO.java @@ -43,9 +43,7 @@ public class LineageRequestDTO { private String uuid; /** - * The event id that was used to generate this lineage. - * - * @return + * @return event id that was used to generate this lineage */ public Long getEventId() { return eventId; @@ -56,13 +54,11 @@ public class LineageRequestDTO { } /** - * The type of lineage request. Either 'PARENTS', 'CHILDREN', or 'FLOWFILE'. + * @return type of lineage request. Either 'PARENTS', 'CHILDREN', or 'FLOWFILE'. * PARENTS will return the lineage for the flowfiles that are parents of the * specified event. CHILDREN will return the lineage of for the flowfiles * that are children of the specified event. FLOWFILE will return the * lineage for the specified flowfile. - * - * @return */ public LineageRequestType getLineageRequestType() { return lineageRequestType; @@ -73,9 +69,7 @@ public class LineageRequestDTO { } /** - * The uuid that was used to generate this lineage. - * - * @return + * @return uuid that was used to generate this lineage */ public String getUuid() { return uuid; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java index 77b6e7ace7..8876e9e78e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/LineageResultsDTO.java @@ -32,9 +32,7 @@ public class LineageResultsDTO { private List links; /** - * Any error messages. - * - * @return + * @return any error messages */ public Set getErrors() { return errors; @@ -45,9 +43,7 @@ public class LineageResultsDTO { } /** - * The nodes. - * - * @return + * @return the nodes */ public List getNodes() { return nodes; @@ -58,9 +54,7 @@ public class LineageResultsDTO { } /** - * The links. - * - * @return + * @return the links */ public List getLinks() { return links; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java index f3bbcefbed..d002626afa 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceLinkDTO.java @@ -34,9 +34,7 @@ public class ProvenanceLinkDTO { private Long millis; /** - * The source node id. - * - * @return + * @return source node id */ public String getSourceId() { return sourceId; @@ -47,9 +45,7 @@ public class ProvenanceLinkDTO { } /** - * The target node id. - * - * @return + * @return target node id */ public String getTargetId() { return targetId; @@ -60,9 +56,7 @@ public class ProvenanceLinkDTO { } /** - * The flowfile uuid that traversed this link. - * - * @return + * @return flowfile uuid that traversed this link */ public String getFlowFileUuid() { return flowFileUuid; @@ -73,9 +67,7 @@ public class ProvenanceLinkDTO { } /** - * The timestamp of this link (based on the destination). - * - * @return + * @return timestamp of this link (based on the destination) */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getTimestamp() { @@ -87,9 +79,7 @@ public class ProvenanceLinkDTO { } /** - * The number of millis since epoch. - * - * @return + * @return number of millis since epoch */ public Long getMillis() { return millis; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java index c15c598cd0..4a7ed9c394 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/provenance/lineage/ProvenanceNodeDTO.java @@ -42,9 +42,7 @@ public class ProvenanceNodeDTO { private Date timestamp; /** - * The id of the node. - * - * @return + * @return id of the node */ public String getId() { return id; @@ -55,9 +53,7 @@ public class ProvenanceNodeDTO { } /** - * The flowfile uuid for this provenance event. - * - * @return + * @return flowfile uuid for this provenance event */ public String getFlowFileUuid() { return flowFileUuid; @@ -68,9 +64,7 @@ public class ProvenanceNodeDTO { } /** - * The parent flowfile uuids for this provenance event. - * - * @return + * @return parent flowfile uuids for this provenance event */ public List getParentUuids() { return parentUuids; @@ -81,9 +75,7 @@ public class ProvenanceNodeDTO { } /** - * The child flowfile uuids for this provenance event. - * - * @return + * @return child flowfile uuids for this provenance event */ public List getChildUuids() { return childUuids; @@ -94,9 +86,7 @@ public class ProvenanceNodeDTO { } /** - * The node identifier that this event/flowfile originated from. - * - * @return + * @return node identifier that this event/flowfile originated from */ public String getClusterNodeIdentifier() { return clusterNodeIdentifier; @@ -107,9 +97,7 @@ public class ProvenanceNodeDTO { } /** - * The type of node. - * - * @return + * @return type of node */ public String getType() { return type; @@ -120,9 +108,7 @@ public class ProvenanceNodeDTO { } /** - * If this is an event node, this is the type of event. - * - * @return + * @return this is an event node, this is the type of event */ public String getEventType() { return eventType; @@ -133,9 +119,7 @@ public class ProvenanceNodeDTO { } /** - * The timestamp of this node. - * - * @return + * @return timestamp of this node */ @XmlJavaTypeAdapter(TimestampAdapter.class) public Date getTimestamp() { @@ -147,9 +131,7 @@ public class ProvenanceNodeDTO { } /** - * The number of millis since epoch. - * - * @return + * @return number of millis since epoch */ public Long getMillis() { return millis; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java index 83d7a91319..01965f97c2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/ComponentSearchResultDTO.java @@ -31,9 +31,7 @@ public class ComponentSearchResultDTO { private List matches; /** - * The id of the component that matched. - * - * @return + * @return id of the component that matched */ public String getId() { return id; @@ -44,9 +42,7 @@ public class ComponentSearchResultDTO { } /** - * The group id of the component that matched. - * - * @return + * @return group id of the component that matched */ public String getGroupId() { return groupId; @@ -57,9 +53,7 @@ public class ComponentSearchResultDTO { } /** - * The name of the component that matched. - * - * @return + * @return name of the component that matched */ public String getName() { return name; @@ -70,9 +64,7 @@ public class ComponentSearchResultDTO { } /** - * What matched the search string for this component. - * - * @return + * @return What matched the search string for this component */ public List getMatches() { return matches; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java index 7c250ee806..ab78d069d0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/NodeSearchResultDTO.java @@ -28,9 +28,7 @@ public class NodeSearchResultDTO { private String address; /** - * The id of the node that was matched. - * - * @return + * @return id of the node that was matched */ public String getId() { return id; @@ -41,9 +39,7 @@ public class NodeSearchResultDTO { } /** - * The address of the node that was matched. - * - * @return + * @return address of the node that was matched */ public String getAddress() { return address; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java index 212d4f2ef3..0319916dbb 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/SearchResultsDTO.java @@ -35,9 +35,7 @@ public class SearchResultsDTO { private List funnelResults = new ArrayList<>(); /** - * The processors that matched the search. - * - * @return + * @return The processors that matched the search */ public List getProcessorResults() { return processorResults; @@ -48,9 +46,7 @@ public class SearchResultsDTO { } /** - * The connections that matched the search. - * - * @return + * @return connections that matched the search */ public List getConnectionResults() { return connectionResults; @@ -61,9 +57,7 @@ public class SearchResultsDTO { } /** - * The process group that matched the search. - * - * @return + * @return process group that matched the search */ public List getProcessGroupResults() { return processGroupResults; @@ -74,18 +68,14 @@ public class SearchResultsDTO { } /** - * The input ports that matched the search. - * - * @return + * @return input ports that matched the search */ public List getInputPortResults() { return inputPortResults; } /** - * The output ports that matched the search. - * - * @return + * @return output ports that matched the search */ public List getOutputPortResults() { return outputPortResults; @@ -100,9 +90,7 @@ public class SearchResultsDTO { } /** - * The remote process groups that matched the search. - * - * @return + * @return remote process groups that matched the search */ public List getRemoteProcessGroupResults() { return remoteProcessGroupResults; @@ -113,9 +101,7 @@ public class SearchResultsDTO { } /** - * The funnels that matched the search. - * - * @return + * @return funnels that matched the search */ public List getFunnelResults() { return funnelResults; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserGroupSearchResultDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserGroupSearchResultDTO.java index ab5636d680..863ba3a93c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserGroupSearchResultDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserGroupSearchResultDTO.java @@ -27,9 +27,7 @@ public class UserGroupSearchResultDTO { private String group; /** - * The name of the group that matched. - * - * @return + * @return name of the group that matched */ public String getGroup() { return group; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserSearchResultDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserSearchResultDTO.java index 9402eeb0d9..b68ab0f43c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserSearchResultDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/search/UserSearchResultDTO.java @@ -28,9 +28,7 @@ public class UserSearchResultDTO { private String userDn; /** - * The dn of the user that matched. - * - * @return + * @return dn of the user that matched */ public String getUserDn() { return userDn; @@ -41,9 +39,7 @@ public class UserSearchResultDTO { } /** - * The username of user that matched. - * - * @return + * @return username of user that matched */ public String getUserName() { return userName; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterConnectionStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterConnectionStatusDTO.java index f0e11d6398..248729ebe5 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterConnectionStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterConnectionStatusDTO.java @@ -34,9 +34,7 @@ public class ClusterConnectionStatusDTO { private String connectionName; /** - * The time the status were last refreshed. - * - * @return + * @return time the status were last refreshed */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getStatsLastRefreshed() { @@ -48,9 +46,7 @@ public class ClusterConnectionStatusDTO { } /** - * The connection id. - * - * @return + * @return connection id */ public String getConnectionId() { return connectionId; @@ -61,9 +57,7 @@ public class ClusterConnectionStatusDTO { } /** - * The connection name. - * - * @return + * @return connection name */ public String getConnectionName() { return connectionName; @@ -74,8 +68,6 @@ public class ClusterConnectionStatusDTO { } /** - * Collection of node connection status DTO. - * * @return The collection of node connection status DTO */ public Collection getNodeConnectionStatus() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterPortStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterPortStatusDTO.java index 4d7fa4d611..ca4ef07b31 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterPortStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterPortStatusDTO.java @@ -34,8 +34,6 @@ public class ClusterPortStatusDTO { private String portName; /** - * The time the status was last refreshed. - * * @return the time the status were last refreshed */ @XmlJavaTypeAdapter(TimeAdapter.class) @@ -48,9 +46,7 @@ public class ClusterPortStatusDTO { } /** - * The port status from each node in the cluster. - * - * @return + * @return port status from each node in the cluster */ public Collection getNodePortStatus() { return nodePortStatus; @@ -61,9 +57,7 @@ public class ClusterPortStatusDTO { } /** - * The port id. - * - * @return + * @return port id */ public String getPortId() { return portId; @@ -74,9 +68,7 @@ public class ClusterPortStatusDTO { } /** - * The port name. - * - * @return + * @return port name */ public String getPortName() { return portName; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterProcessorStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterProcessorStatusDTO.java index b9f45f2b85..8d78b1f5a0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterProcessorStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterProcessorStatusDTO.java @@ -36,9 +36,7 @@ public class ClusterProcessorStatusDTO { private String processorRunStatus; /** - * The time the status were last refreshed. - * - * @return + * @return time the status were last refreshed */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getStatsLastRefreshed() { @@ -50,9 +48,7 @@ public class ClusterProcessorStatusDTO { } /** - * The processor id. - * - * @return + * @return processor id */ public String getProcessorId() { return processorId; @@ -63,9 +59,7 @@ public class ClusterProcessorStatusDTO { } /** - * The processor name. - * - * @return + * @return processor name */ public String getProcessorName() { return processorName; @@ -76,9 +70,7 @@ public class ClusterProcessorStatusDTO { } /** - * The processor type. - * - * @return + * @return processor type */ public String getProcessorType() { return processorType; @@ -89,9 +81,7 @@ public class ClusterProcessorStatusDTO { } /** - * The processor run status. - * - * @return + * @return processor run status */ public String getProcessorRunStatus() { return processorRunStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterRemoteProcessGroupStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterRemoteProcessGroupStatusDTO.java index d6b26d414e..027bf4f320 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterRemoteProcessGroupStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterRemoteProcessGroupStatusDTO.java @@ -34,8 +34,6 @@ public class ClusterRemoteProcessGroupStatusDTO { private String remoteProcessGroupName; /** - * The time the status was last refreshed. - * * @return the time the status were last refreshed */ @XmlJavaTypeAdapter(TimeAdapter.class) @@ -48,9 +46,7 @@ public class ClusterRemoteProcessGroupStatusDTO { } /** - * The remote process group status from each node in the cluster. - * - * @return + * @return remote process group status from each node in the cluster */ public Collection getNodeRemoteProcessGroupStatus() { return nodeRemoteProcessGroupStatus; @@ -61,9 +57,7 @@ public class ClusterRemoteProcessGroupStatusDTO { } /** - * The remote process group id. - * - * @return + * @return remote process group id */ public String getRemoteProcessGroupId() { return remoteProcessGroupId; @@ -74,9 +68,7 @@ public class ClusterRemoteProcessGroupStatusDTO { } /** - * The remote process group name. - * - * @return + * @return remote process group name */ public String getRemoteProcessGroupName() { return remoteProcessGroupName; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java index d83399174b..e170c8b218 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusDTO.java @@ -29,9 +29,7 @@ public class ClusterStatusDTO { private Collection nodeStatus; /** - * The collection of the node status DTOs. - * - * @return + * @return collection of the node status DTOs */ public Collection getNodeStatus() { return nodeStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusHistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusHistoryDTO.java index 31a994845d..a22c872778 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusHistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ClusterStatusHistoryDTO.java @@ -33,9 +33,7 @@ public class ClusterStatusHistoryDTO { private Date generated; /** - * When this status history was generated. - * - * @return + * @return when this status history was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { @@ -47,9 +45,7 @@ public class ClusterStatusHistoryDTO { } /** - * The status history from each node in the cluster. - * - * @return + * @return status history from each node in the cluster */ public Collection getNodeStatusHistory() { return nodeStatusHistory; @@ -60,9 +56,7 @@ public class ClusterStatusHistoryDTO { } /** - * The status history for this component across the entire cluster. - * - * @return + * @return status history for this component across the entire cluster */ public StatusHistoryDTO getClusterStatusHistory() { return clusterStatusHistory; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java index 387cce5c89..2abc6ff7a4 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatusDTO.java @@ -40,8 +40,6 @@ public class ConnectionStatusDTO { /* getters / setters */ /** - * The id for the connection. - * * @return The connection id */ public String getId() { @@ -53,8 +51,6 @@ public class ConnectionStatusDTO { } /** - * The ID of the Process Group to which this processor belongs. - * * @return the ID of the Process Group to which this processor belongs. */ public String getGroupId() { @@ -66,9 +62,7 @@ public class ConnectionStatusDTO { } /** - * The name of this connection. - * - * @return + * @return name of this connection */ public String getName() { return name; @@ -79,9 +73,7 @@ public class ConnectionStatusDTO { } /** - * The total count of flow files that are queued. - * - * @return + * @return total count of flow files that are queued */ public String getQueuedCount() { return queuedCount; @@ -92,9 +84,7 @@ public class ConnectionStatusDTO { } /** - * The total size of flow files that are queued. - * - * @return + * @return total size of flow files that are queued */ public String getQueuedSize() { return queuedSize; @@ -105,8 +95,6 @@ public class ConnectionStatusDTO { } /** - * The total count and size of flow files that are queued. - * * @return The total count and size of queued flow files */ public String getQueued() { @@ -118,9 +106,7 @@ public class ConnectionStatusDTO { } /** - * The id of the source of this connection. - * - * @return + * @return id of the source of this connection */ public String getSourceId() { return sourceId; @@ -131,9 +117,7 @@ public class ConnectionStatusDTO { } /** - * The name of the source of this connection. - * - * @return + * @return name of the source of this connection */ public String getSourceName() { return sourceName; @@ -144,9 +128,7 @@ public class ConnectionStatusDTO { } /** - * The id of the destination of this connection. - * - * @return + * @return id of the destination of this connection */ public String getDestinationId() { return destinationId; @@ -157,9 +139,7 @@ public class ConnectionStatusDTO { } /** - * The name of the destination of this connection. - * - * @return + * @return name of the destination of this connection */ public String getDestinationName() { return destinationName; @@ -170,9 +150,7 @@ public class ConnectionStatusDTO { } /** - * The input for this connection. - * - * @return + * @return input for this connection */ public String getInput() { return input; @@ -183,9 +161,7 @@ public class ConnectionStatusDTO { } /** - * The output for this connection. - * - * @return + * @return output for this connection */ public String getOutput() { return output; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java index 9e063e44b8..adfee2ad6c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ControllerStatusDTO.java @@ -54,9 +54,7 @@ public class ControllerStatusDTO { } /** - * The queue for the controller. - * - * @return + * @return queue for the controller */ public String getQueued() { return queued; @@ -67,10 +65,8 @@ public class ControllerStatusDTO { } /** - * Used in clustering, will report the number of nodes connected vs the - * number of nodes in the cluster. - * - * @return + * @return Used in clustering, will report the number of nodes connected vs the + * number of nodes in the cluster */ public String getConnectedNodes() { return connectedNodes; @@ -81,9 +77,7 @@ public class ControllerStatusDTO { } /** - * System bulletins to be reported to the user. - * - * @return + * @return System bulletins to be reported to the user */ public List getBulletins() { return bulletins; @@ -94,9 +88,7 @@ public class ControllerStatusDTO { } /** - * Whether or not there are pending user requests. - * - * @return + * @return whether or not there are pending user requests */ public Boolean getHasPendingAccounts() { return hasPendingAccounts; @@ -107,9 +99,7 @@ public class ControllerStatusDTO { } /** - * The number of running components in this controller. - * - * @return + * @return number of running components in this controller */ public Integer getRunningCount() { return runningCount; @@ -120,9 +110,7 @@ public class ControllerStatusDTO { } /** - * The number of stopped components in this controller. - * - * @return + * @return number of stopped components in this controller */ public Integer getStoppedCount() { return stoppedCount; @@ -133,9 +121,7 @@ public class ControllerStatusDTO { } /** - * The number of invalid components in this controller. - * - * @return + * @return number of invalid components in this controller */ public Integer getInvalidCount() { return invalidCount; @@ -146,9 +132,7 @@ public class ControllerStatusDTO { } /** - * The number of disabled components in this controller. - * - * @return + * @return number of disabled components in this controller */ public Integer getDisabledCount() { return disabledCount; @@ -159,9 +143,7 @@ public class ControllerStatusDTO { } /** - * The number of active remote ports in this controller. - * - * @return + * @return number of active remote ports in this controller */ public Integer getActiveRemotePortCount() { return activeRemotePortCount; @@ -172,9 +154,7 @@ public class ControllerStatusDTO { } /** - * The number of inactive remote ports in this controller. - * - * @return + * @return number of inactive remote ports in this controller */ public Integer getInactiveRemotePortCount() { return inactiveRemotePortCount; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusDTO.java index f7cba448a2..39fb5ce3eb 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeConnectionStatusDTO.java @@ -29,9 +29,7 @@ public class NodeConnectionStatusDTO { private ConnectionStatusDTO connectionStatus; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodeConnectionStatusDTO { } /** - * The connection's status. - * - * @return + * @return connection's status */ public ConnectionStatusDTO getConnectionStatus() { return connectionStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java index 93d89ac1e2..91a6d01aa4 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodePortStatusDTO.java @@ -29,9 +29,7 @@ public class NodePortStatusDTO { private PortStatusDTO portStatus; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodePortStatusDTO { } /** - * The port's status. - * - * @return + * @return port status */ public PortStatusDTO getPortStatus() { return portStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusDTO.java index afff4b10f5..86d13d5d85 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeProcessorStatusDTO.java @@ -29,9 +29,7 @@ public class NodeProcessorStatusDTO { private ProcessorStatusDTO processorStatus; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodeProcessorStatusDTO { } /** - * The processor's status. - * - * @return + * @return processor's status */ public ProcessorStatusDTO getProcessorStatus() { return processorStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusDTO.java index 03923bf35b..12a0ca0076 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeRemoteProcessGroupStatusDTO.java @@ -29,9 +29,7 @@ public class NodeRemoteProcessGroupStatusDTO { private RemoteProcessGroupStatusDTO remoteProcessGroupStatus; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodeRemoteProcessGroupStatusDTO { } /** - * The remote process group's status. - * - * @return + * @return remote process group's status */ public RemoteProcessGroupStatusDTO getRemoteProcessGroupStatus() { return remoteProcessGroupStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java index 03647cd173..b770015065 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusDTO.java @@ -29,9 +29,7 @@ public class NodeStatusDTO { private ProcessGroupStatusDTO controllerStatus; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodeStatusDTO { } /** - * The controller status. - * - * @return + * @return the controller status */ public ProcessGroupStatusDTO getControllerStatus() { return controllerStatus; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusHistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusHistoryDTO.java index c8b05f3e82..9a7cb1677d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusHistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/NodeStatusHistoryDTO.java @@ -29,9 +29,7 @@ public class NodeStatusHistoryDTO { private StatusHistoryDTO statusHistory; /** - * The node. - * - * @return + * @return the node */ public NodeDTO getNode() { return node; @@ -42,9 +40,7 @@ public class NodeStatusHistoryDTO { } /** - * The processor status history. - * - * @return + * @return processor status history */ public StatusHistoryDTO getStatusHistory() { return statusHistory; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java index c32efdb750..db03146758 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/PortStatusDTO.java @@ -34,9 +34,7 @@ public class PortStatusDTO extends StatusDTO { private String runStatus; /** - * Whether this port has incoming or outgoing connections to a remote NiFi. - * - * @return + * @return whether this port has incoming or outgoing connections to a remote NiFi */ public Boolean isTransmitting() { return transmitting; @@ -47,9 +45,7 @@ public class PortStatusDTO extends StatusDTO { } /** - * The active thread count for this port. - * - * @return + * @return the active thread count for this port */ public Integer getActiveThreadCount() { return activeThreadCount; @@ -60,9 +56,7 @@ public class PortStatusDTO extends StatusDTO { } /** - * The id of this port. - * - * @return + * @return id of this port */ public String getId() { return id; @@ -73,9 +67,7 @@ public class PortStatusDTO extends StatusDTO { } /** - * The id of the group this port resides in. - * - * @return + * @return id of the group this port resides in */ public String getGroupId() { return groupId; @@ -86,9 +78,7 @@ public class PortStatusDTO extends StatusDTO { } /** - * The name of this port. - * - * @return + * @return name of this port */ public String getName() { return name; @@ -99,9 +89,7 @@ public class PortStatusDTO extends StatusDTO { } /** - * The run status of this port. - * - * @return + * @return run status of this port */ public String getRunStatus() { return runStatus; @@ -112,10 +100,8 @@ public class PortStatusDTO extends StatusDTO { } /** - * The total count and size of flow files that have been accepted in the - * last five minutes. - * - * @return The total processed + * @return The total count and size of flow files that have been accepted in the + * last five minutes */ public String getInput() { return input; @@ -126,10 +112,8 @@ public class PortStatusDTO extends StatusDTO { } /** - * The total count and size of flow files that have been processed in the - * last five minutes. - * - * @return The total output + * @return The total count and size of flow files that have been processed in the + * last five minutes */ public String getOutput() { return output; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java index 4fa2b641eb..2193fb0f82 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusDTO.java @@ -59,9 +59,7 @@ public class ProcessGroupStatusDTO extends StatusDTO { } /** - * The name of this process group. - * - * @return + * @return name of this process group */ public String getName() { return name; @@ -72,9 +70,7 @@ public class ProcessGroupStatusDTO extends StatusDTO { } /** - * The active thread count for this process group. - * - * @return + * @return active thread count for this process group */ public Integer getActiveThreadCount() { return activeThreadCount; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java index 334adad4ed..18539bed53 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessorStatusDTO.java @@ -42,8 +42,6 @@ public class ProcessorStatusDTO extends StatusDTO { /* getters / setters */ /** - * The id for the processor. - * * @return The processor id */ public String getId() { @@ -55,8 +53,6 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The name of the processor. - * * @return The processor name */ public String getName() { @@ -68,8 +64,6 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The type of the processor. - * * @return The processor type */ public String getType() { @@ -81,9 +75,7 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The run status of this processor. - * - * @return + * @return run status of this processor */ public String getRunStatus() { return runStatus; @@ -94,10 +86,8 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The total count and size of flow files that have been accepted in the - * last five minutes. - * - * @return The total processed + * @return The total count and size of flow files that have been accepted in the + * last five minutes */ public String getInput() { return input; @@ -108,9 +98,7 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The number of bytes read. - * - * @return + * @return number of bytes read */ public String getRead() { return read; @@ -121,9 +109,7 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The number of bytes written. - * - * @return + * @return number of bytes written */ public String getWritten() { return written; @@ -134,8 +120,6 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The ID of the Process Group to which this processor belongs. - * * @return the ID of the Process Group to which this processor belongs. */ public String getGroupId() { @@ -147,10 +131,8 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The total count and size of flow files that have been processed in the - * last five minutes. - * - * @return The total output + * @return The total count and size of flow files that have been processed in the + * last five minutes */ public String getOutput() { return output; @@ -161,9 +143,7 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The number of threads currently running for this Processor - * - * @return + * @return number of threads currently running for this Processor */ public Integer getActiveThreadCount() { return activeThreadCount; @@ -174,9 +154,7 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The number of task this connectable has had over the last 5 minutes. - * - * @return + * @return number of task this connectable has had over the last 5 minutes */ public String getTasks() { return tasks; @@ -187,10 +165,8 @@ public class ProcessorStatusDTO extends StatusDTO { } /** - * The total duration of all tasks for this connectable over the last 5 - * minutes. - * - * @return + * @return total duration of all tasks for this connectable over the last 5 + * minutes */ public String getTasksDuration() { return tasksDuration; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemotePortStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemotePortStatusDTO.java index a8fcc9f52d..58f616190d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemotePortStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemotePortStatusDTO.java @@ -31,9 +31,7 @@ public class RemotePortStatusDTO { private Boolean exists; /** - * The id of the connection this remote port is connected to. - * - * @return + * @return id of the connection this remote port is connected to */ public String getConnectionId() { return connectionId; @@ -44,9 +42,7 @@ public class RemotePortStatusDTO { } /** - * The id of the remote port. - * - * @return + * @return id of the remote port */ public String getId() { return id; @@ -57,9 +53,7 @@ public class RemotePortStatusDTO { } /** - * The name of the remote port. - * - * @return + * @return name of the remote port */ public String getName() { return name; @@ -70,9 +64,7 @@ public class RemotePortStatusDTO { } /** - * Whether or not the remote port exists. - * - * @return + * @return whether or not the remote port exists */ public Boolean getExists() { return exists; @@ -83,9 +75,7 @@ public class RemotePortStatusDTO { } /** - * Whether or not the remote port is running. - * - * @return + * @return whether or not the remote port is running */ public Boolean getRunning() { return running; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java index 363d4da39b..68aa5d6c47 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/RemoteProcessGroupStatusDTO.java @@ -38,8 +38,6 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { private String received; /** - * The id for the remote process group. - * * @return The id for the remote process group */ public String getId() { @@ -51,9 +49,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * The id of the group this remote process group is in. - * - * @return + * @return id of the group this remote process group is in */ public String getGroupId() { return groupId; @@ -64,9 +60,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * The URI of the target system. - * - * @return + * @return URI of the target system */ public String getTargetUri() { return targetUri; @@ -77,9 +71,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * The name of this remote process group. - * - * @return + * @return name of this remote process group */ public String getName() { return name; @@ -90,9 +82,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * The transmission status of this remote process group. - * - * @return + * @return transmission status of this remote process group */ public String getTransmissionStatus() { return transmissionStatus; @@ -103,9 +93,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * The number of active threads. - * - * @return + * @return number of active threads */ public Integer getActiveThreadCount() { return activeThreadCount; @@ -116,9 +104,7 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * Returns any remote authorization issues for this remote process group. - * - * @return + * @return any remote authorization issues for this remote process group */ public List getAuthorizationIssues() { return authorizationIssues; @@ -129,10 +115,8 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * Formatted description of the amount of data sent to this remote process - * group. - * - * @return + * @return Formatted description of the amount of data sent to this remote process + * group */ public String getSent() { return sent; @@ -143,10 +127,8 @@ public class RemoteProcessGroupStatusDTO extends StatusDTO { } /** - * Formatted description of the amount of data received from this remote - * process group. - * - * @return + * @return Formatted description of the amount of data received from this remote + * process group */ public String getReceived() { return received; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDTO.java index e4e7a450f9..e922b70727 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDTO.java @@ -29,9 +29,7 @@ public abstract class StatusDTO { private List bulletins; /** - * Bulletins for this component. - * - * @return + * @return Bulletins for this component */ public List getBulletins() { return bulletins; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java index a203e10d61..65823d566c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusDescriptorDTO.java @@ -47,9 +47,7 @@ public class StatusDescriptorDTO { } /** - * The name of this status field. - * - * @return + * @return name of this status field */ public String getField() { return field; @@ -60,9 +58,7 @@ public class StatusDescriptorDTO { } /** - * The label of this status field. - * - * @return + * @return label of this status field */ public String getLabel() { return label; @@ -73,9 +69,7 @@ public class StatusDescriptorDTO { } /** - * The description of this status field. - * - * @return + * @return description of this status field */ public String getDescription() { return description; @@ -86,9 +80,7 @@ public class StatusDescriptorDTO { } /** - * The formatter for this descriptor. - * - * @return + * @return formatter for this descriptor */ public String getFormatter() { return formatter; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java index 5b97c16d71..a996365d19 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDTO.java @@ -37,9 +37,7 @@ public class StatusHistoryDTO { private List statusSnapshots; /** - * When this status history was generated. - * - * @return + * @return when this status history was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { @@ -51,9 +49,7 @@ public class StatusHistoryDTO { } /** - * The component details for this status history. - * - * @return + * @return The component details for this status history */ public LinkedHashMap getDetails() { return details; @@ -64,9 +60,7 @@ public class StatusHistoryDTO { } /** - * Descriptors for each supported status field. - * - * @return + * @return Descriptors for each supported status field */ public List getFieldDescriptors() { return fieldDescriptors; @@ -77,9 +71,7 @@ public class StatusHistoryDTO { } /** - * The status snapshots. - * - * @return + * @return The status snapshots */ public List getStatusSnapshots() { return statusSnapshots; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDetailDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDetailDTO.java index b9d16bba00..4ebb5e35f0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDetailDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusHistoryDetailDTO.java @@ -28,9 +28,7 @@ public class StatusHistoryDetailDTO { private String value; /** - * The label for this status detail. - * - * @return + * @return label for this status detail */ public String getLabel() { return label; @@ -41,9 +39,7 @@ public class StatusHistoryDetailDTO { } /** - * The value for this status detail. - * - * @return + * @return value for this status detail */ public String getValue() { return value; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java index cc6894a617..b39fd607ba 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/StatusSnapshotDTO.java @@ -30,9 +30,7 @@ public class StatusSnapshotDTO { private Map statusMetrics; /** - * The timestamp of this snapshot. - * - * @return + * @return timestamp of this snapshot */ public Date getTimestamp() { return timestamp; @@ -43,9 +41,7 @@ public class StatusSnapshotDTO { } /** - * The status metrics. - * - * @return + * @return status metrics */ public Map getStatusMetrics() { return statusMetrics; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AuthorityEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AuthorityEntity.java index eed1305526..103a93751a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AuthorityEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AuthorityEntity.java @@ -32,9 +32,7 @@ public class AuthorityEntity extends Entity { private Set authorities; /** - * The current user id. - * - * @return + * @return current user id */ public String getUserId() { return userId; @@ -45,9 +43,7 @@ public class AuthorityEntity extends Entity { } /** - * The set of authorities that are being serialized. - * - * @return + * @return set of authorities that are being serialized */ public Set getAuthorities() { return authorities; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ClusterSearchResultsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ClusterSearchResultsEntity.java index 546bd8b9f5..ad1c1a5557 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ClusterSearchResultsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ClusterSearchResultsEntity.java @@ -31,9 +31,7 @@ public class ClusterSearchResultsEntity { private List nodeResults; /** - * The node search results. - * - * @return + * @return node search results */ public List getNodeResults() { return nodeResults; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java index 69ae937e21..2791bfaa9b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionEntity.java @@ -30,9 +30,7 @@ public class ConnectionEntity extends Entity { private ConnectionDTO connection; /** - * The RelationshipDTO that is being serialized. - * - * @return + * @return RelationshipDTO that is being serialized */ public ConnectionDTO getConnection() { return connection; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java index c69c69ae3d..7988d120d8 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ConnectionsEntity.java @@ -32,9 +32,7 @@ public class ConnectionsEntity extends Entity { private Set connections; /** - * The list of ConnectionDTOs that are being serialized. - * - * @return + * @return list of ConnectionDTOs that are being serialized */ public Set getConnections() { return connections; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java index 44364e712c..65c38a979d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceEntity.java @@ -21,7 +21,7 @@ import org.apache.nifi.web.api.dto.ControllerServiceDTO; /** * A serialized representation of this class can be placed in the entity body of - * a response to the API. This particular entity holds a reference to a + * a response to the API. This particular entity holds a reference to a * controller service. */ @XmlRootElement(name = "controllerServiceEntity") @@ -30,9 +30,7 @@ public class ControllerServiceEntity extends Entity { private ControllerServiceDTO controllerService; /** - * The controller service that is being serialized. - * - * @return + * @return controller service that is being serialized */ public ControllerServiceDTO getControllerService() { return controllerService; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java index 6010f93014..69999274ef 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceReferencingComponentsEntity.java @@ -31,9 +31,8 @@ public class ControllerServiceReferencingComponentsEntity extends Entity { private Set controllerServiceReferencingComponents; /** - * The list of controller service referencing components that are being serialized. - * - * @return + * @return list of controller service referencing components that are being + * serialized */ public Set getControllerServiceReferencingComponents() { return controllerServiceReferencingComponents; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceTypesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceTypesEntity.java index dafb8c22af..580a76e4ce 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceTypesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServiceTypesEntity.java @@ -31,9 +31,7 @@ public class ControllerServiceTypesEntity extends Entity { private Set controllerServiceTypes; /** - * The list of controller service types that are being serialized. - * - * @return + * @return list of controller service types that are being serialized */ public Set getControllerServiceTypes() { return controllerServiceTypes; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java index 4485b43d15..cda93c4ef5 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ControllerServicesEntity.java @@ -31,9 +31,7 @@ public class ControllerServicesEntity extends Entity { private Set controllerServices; /** - * The list of controller services that are being serialized. - * - * @return + * @return list of controller services that are being serialized */ public Set getControllerServices() { return controllerServices; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CounterEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CounterEntity.java index 666dc75fea..ef329b8293 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CounterEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CounterEntity.java @@ -30,9 +30,7 @@ public class CounterEntity extends Entity { private CounterDTO counter; /** - * Get the counter. - * - * @return + * @return the counter */ public CounterDTO getCounter() { return counter; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CountersEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CountersEntity.java index bee76692fc..c1991a1dc0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CountersEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CountersEntity.java @@ -30,10 +30,8 @@ public class CountersEntity extends Entity { private CountersDTO counters; /** - * Get the counters which contains all the counter groups and a generation - * date. - * - * @return + * @return the counters which contains all the counter groups and a generation + * date */ public CountersDTO getCounters() { return counters; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java index 6abcbf391a..e2bb3e70ef 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/Entity.java @@ -28,9 +28,7 @@ public class Entity { private RevisionDTO revision; /** - * A revision for this request/response. - * - * @return + * @return revision for this request/response */ public RevisionDTO getRevision() { return revision; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java index 2b8cbc88db..4586c9d50f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/FunnelsEntity.java @@ -32,9 +32,7 @@ public class FunnelsEntity extends Entity { private Set funnels; /** - * The collection of FunnelDTOs that are being serialized. - * - * @return + * @return collection of FunnelDTOs that are being serialized */ public Set getFunnels() { return funnels; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java index 9fec9d8727..dc497b5eb1 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortEntity.java @@ -30,9 +30,7 @@ public class InputPortEntity extends Entity { private PortDTO inputPort; /** - * The input PortDTO that are being serialized. - * - * @return + * @return input PortDTO that are being serialized */ public PortDTO getInputPort() { return inputPort; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java index 8637596284..a112fdd054 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InputPortsEntity.java @@ -32,9 +32,7 @@ public class InputPortsEntity extends Entity { private Set inputPorts; /** - * The collection of input PortDTOs that are being serialized. - * - * @return + * @return collection of input PortDTOs that are being serialized */ public Set getInputPorts() { return inputPorts; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java index 063eeafe40..d4b9681b3a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/LabelsEntity.java @@ -32,9 +32,7 @@ public class LabelsEntity extends Entity { private Set labels; /** - * The collection of LabelDTOs that are being serialized. - * - * @return + * @return collection of LabelDTOs that are being serialized */ public Set getLabels() { return labels; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java index 07fdab7589..7c5145ede8 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortEntity.java @@ -30,9 +30,7 @@ public class OutputPortEntity extends Entity { private PortDTO outputPort; /** - * The output PortDTO that are being serialized. - * - * @return + * @return output PortDTO that are being serialized */ public PortDTO getOutputPort() { return outputPort; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java index 9fa398dadd..01271905f2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/OutputPortsEntity.java @@ -32,9 +32,7 @@ public class OutputPortsEntity extends Entity { private Set outputPorts; /** - * The collection of output PortDTOs that are being serialized. - * - * @return + * @return collection of output PortDTOs that are being serialized */ public Set getOutputPorts() { return outputPorts; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PrioritizerTypesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PrioritizerTypesEntity.java index 2ddddd8887..2e3f545b62 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PrioritizerTypesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PrioritizerTypesEntity.java @@ -31,9 +31,7 @@ public class PrioritizerTypesEntity extends Entity { private Set prioritizerTypes; /** - * The list of prioritizer types that are being serialized. - * - * @return + * @return list of prioritizer types that are being serialized */ public Set getPrioritizerTypes() { return prioritizerTypes; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorTypesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorTypesEntity.java index 23237fe7e1..fa584ce25f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorTypesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorTypesEntity.java @@ -31,9 +31,7 @@ public class ProcessorTypesEntity extends Entity { private Set processorTypes; /** - * The list of processor types that are being serialized. - * - * @return + * @return list of processor types that are being serialized */ public Set getProcessorTypes() { return processorTypes; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java index 4962b38a8c..201f5aae22 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessorsEntity.java @@ -32,9 +32,7 @@ public class ProcessorsEntity extends Entity { private Set processors; /** - * The collection of ProcessorDTOs that are being serialized. - * - * @return + * @return collection of ProcessorDTOs that are being serialized */ public Set getProcessors() { return processors; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PropertyDescriptorEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PropertyDescriptorEntity.java index 9251b7f220..87ca4a3932 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PropertyDescriptorEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/PropertyDescriptorEntity.java @@ -17,7 +17,6 @@ package org.apache.nifi.web.api.entity; import javax.xml.bind.annotation.XmlRootElement; -import org.apache.nifi.web.api.dto.ProcessorDTO; import org.apache.nifi.web.api.dto.PropertyDescriptorDTO; /** diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProvenanceEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProvenanceEntity.java index 72a85285fb..c26f9aa2be 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProvenanceEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProvenanceEntity.java @@ -25,9 +25,7 @@ public class ProvenanceEntity extends Entity { private ProvenanceDTO provenance; /** - * The provenance . - * - * @return + * @return provenance */ public ProvenanceDTO getProvenance() { return provenance; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java index a04c789636..a94b42f83b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/RemoteProcessGroupsEntity.java @@ -32,9 +32,7 @@ public class RemoteProcessGroupsEntity extends Entity { private Set remoteProcessGroups; /** - * The collection of RemoteProcessGroupDTOs that are being serialized. - * - * @return + * @return collection of RemoteProcessGroupDTOs that are being serialized */ public Set getRemoteProcessGroups() { return remoteProcessGroups; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java index a372751712..2177564ff7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskEntity.java @@ -21,7 +21,7 @@ import org.apache.nifi.web.api.dto.ReportingTaskDTO; /** * A serialized representation of this class can be placed in the entity body of - * a response to the API. This particular entity holds a reference to a + * a response to the API. This particular entity holds a reference to a * reporting task. */ @XmlRootElement(name = "reportingTaskEntity") @@ -30,9 +30,7 @@ public class ReportingTaskEntity extends Entity { private ReportingTaskDTO reportingTask; /** - * The reporting task that is being serialized. - * - * @return + * @return reporting task that is being serialized */ public ReportingTaskDTO getReportingTask() { return reportingTask; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskTypesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskTypesEntity.java index 4b021efb44..c527ec72f0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskTypesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTaskTypesEntity.java @@ -31,9 +31,7 @@ public class ReportingTaskTypesEntity extends Entity { private Set reportingTaskTypes; /** - * The list of reporting task types that are being serialized. - * - * @return + * @return list of reporting task types that are being serialized */ public Set getReportingTaskTypes() { return reportingTaskTypes; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java index 4699d5d3c4..4f7be11c71 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ReportingTasksEntity.java @@ -31,9 +31,7 @@ public class ReportingTasksEntity extends Entity { private Set reportingTasks; /** - * The list of reporting tasks that are being serialized. - * - * @return + * @return list of reporting tasks that are being serialized */ public Set getReportingTasks() { return reportingTasks; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SearchResultsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SearchResultsEntity.java index 6b9a88b3ff..01e6918874 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SearchResultsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/SearchResultsEntity.java @@ -31,9 +31,7 @@ public class SearchResultsEntity { private SearchResultsDTO searchResultsDTO; /** - * The search results. - * - * @return + * @return search results */ public SearchResultsDTO getSearchResultsDTO() { return searchResultsDTO; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TemplatesEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TemplatesEntity.java index 34000453f2..3ff5bc6d89 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TemplatesEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TemplatesEntity.java @@ -48,9 +48,7 @@ public class TemplatesEntity extends Entity { } /** - * When this content was generated. - * - * @return + * @return When this content was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UserSearchResultsEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UserSearchResultsEntity.java index baffe1511c..eece172b5f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UserSearchResultsEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UserSearchResultsEntity.java @@ -33,9 +33,7 @@ public class UserSearchResultsEntity { private List userGroupResults; /** - * The user search results. - * - * @return + * @return user search results */ public List getUserResults() { return userResults; @@ -46,9 +44,7 @@ public class UserSearchResultsEntity { } /** - * The user group search results. - * - * @return + * @return user group search results */ public List getUserGroupResults() { return userGroupResults; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java index 2d11d1f0cb..180b6505c4 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/UsersEntity.java @@ -48,9 +48,7 @@ public class UsersEntity extends Entity { } /** - * When this content was generated. - * - * @return + * @return When this content was generated */ @XmlJavaTypeAdapter(TimeAdapter.class) public Date getGenerated() { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextCreationException.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextCreationException.java index 66ed652c46..b70b829516 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextCreationException.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextCreationException.java @@ -18,6 +18,7 @@ package org.apache.nifi.framework.security.util; /** * Represents the exceptional case when a SSL context failed creation. + * * @author unattributed */ public class SslContextCreationException extends SslException { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextFactory.java index ebb1f91283..82a6458aa6 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslContextFactory.java @@ -32,33 +32,36 @@ import org.apache.nifi.util.NiFiProperties; import org.apache.commons.lang3.StringUtils; /** - * A factory for creating SSL contexts using the application's security properties. + * A factory for creating SSL contexts using the application's security + * properties. + * * @author unattributed */ public final class SslContextFactory { public static enum ClientAuth { + WANT, REQUIRED, NONE } - + public static SSLContext createSslContext(final NiFiProperties props) throws SslContextCreationException { return createSslContext(props, false); } - + public static SSLContext createSslContext(final NiFiProperties props, final boolean strict) throws SslContextCreationException { final boolean hasKeystoreProperties = hasKeystoreProperties(props); - if(hasKeystoreProperties == false) { - if(strict) { + if (hasKeystoreProperties == false) { + if (strict) { throw new SslContextCreationException("SSL context cannot be created because keystore properties have not been configured."); } else { return null; } - } else if(props.getNeedClientAuth() && hasTruststoreProperties(props) == false) { + } else if (props.getNeedClientAuth() && hasTruststoreProperties(props) == false) { throw new SslContextCreationException("Need client auth is set to 'true', but no truststore properties are configured."); } @@ -66,7 +69,7 @@ public final class SslContextFactory { // prepare the trust store final KeyStore trustStore; - if(hasTruststoreProperties(props)) { + if (hasTruststoreProperties(props)) { trustStore = KeyStore.getInstance(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_TYPE)); try (final InputStream trustStoreStream = new FileInputStream(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE))) { trustStore.load(trustStoreStream, props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_PASSWD).toCharArray()); @@ -83,7 +86,7 @@ public final class SslContextFactory { keyStore.load(keyStoreStream, props.getProperty(NiFiProperties.SECURITY_KEYSTORE_PASSWD).toCharArray()); } KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - + // if the key password is provided, try to use that - otherwise default to the keystore password if (StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEY_PASSWD))) { keyManagerFactory.init(keyStore, props.getProperty(NiFiProperties.SECURITY_KEY_PASSWD).toCharArray()); @@ -94,26 +97,26 @@ public final class SslContextFactory { // initialize the ssl context final SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagerFactory.getKeyManagers(), - trustManagerFactory.getTrustManagers(), null); + trustManagerFactory.getTrustManagers(), null); sslContext.getDefaultSSLParameters().setNeedClientAuth(props.getNeedClientAuth()); return sslContext; - - } catch(final KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException | UnrecoverableKeyException | KeyManagementException e) { + + } catch (final KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException | UnrecoverableKeyException | KeyManagementException e) { throw new SslContextCreationException(e); } } private static boolean hasKeystoreProperties(final NiFiProperties props) { - return (StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE)) && - StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE_PASSWD)) && - StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE_TYPE)) ); + return (StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE)) + && StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE_PASSWD)) + && StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_KEYSTORE_TYPE))); } private static boolean hasTruststoreProperties(final NiFiProperties props) { - return (StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE)) && - StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_PASSWD)) && - StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_TYPE)) ); + return (StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE)) + && StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_PASSWD)) + && StringUtils.isNotBlank(props.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_TYPE))); } - + } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslException.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslException.java index 0ec967266e..e623a4c383 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslException.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslException.java @@ -18,6 +18,7 @@ package org.apache.nifi.framework.security.util; /** * Base class for SSL related exceptions. + * * @author unattributed */ public class SslException extends RuntimeException { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactory.java index b7acd6d536..59ea312b43 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactory.java @@ -25,29 +25,30 @@ import javax.net.ssl.SSLServerSocketFactory; import org.apache.nifi.util.NiFiProperties; /** - * Implements a server socket factory for creating secure server sockets based on - * the application's configuration properties. If the properties are configured - * for SSL (one-way or two-way), then a SSLServerSocketFactory is created and used - * based on those properties. Otherwise, Java's default SSLServerSocketFactory - * is used. Specifically, SSLContext.getDefault().getServerSocketFactory(). + * Implements a server socket factory for creating secure server sockets based + * on the application's configuration properties. If the properties are + * configured for SSL (one-way or two-way), then a SSLServerSocketFactory is + * created and used based on those properties. Otherwise, Java's default + * SSLServerSocketFactory is used. Specifically, + * SSLContext.getDefault().getServerSocketFactory(). */ public class SslServerSocketFactory extends SSLServerSocketFactory { - + private SSLServerSocketFactory sslServerSocketFactory; public SslServerSocketFactory() { final SSLContext sslCtx = SslContextFactory.createSslContext(NiFiProperties.getInstance()); - if(sslCtx == null) { + if (sslCtx == null) { try { sslServerSocketFactory = SSLContext.getDefault().getServerSocketFactory(); - } catch(final NoSuchAlgorithmException nsae) { + } catch (final NoSuchAlgorithmException nsae) { throw new SslServerSocketFactoryCreationException(nsae); } } else { sslServerSocketFactory = sslCtx.getServerSocketFactory(); } } - + @Override public ServerSocket createServerSocket(int i, int i1, InetAddress ia) throws IOException { return sslServerSocketFactory.createServerSocket(i, i1, ia); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactoryCreationException.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactoryCreationException.java index 06c305c363..faa726a5b5 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactoryCreationException.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslServerSocketFactoryCreationException.java @@ -17,7 +17,9 @@ package org.apache.nifi.framework.security.util; /** - * Represents the exceptional case when a SslServerSocketFactory failed creation. + * Represents the exceptional case when a SslServerSocketFactory failed + * creation. + * * @author unattributed */ public class SslServerSocketFactoryCreationException extends SslException { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactory.java index 006b352d9f..da0e7fbcf8 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactory.java @@ -26,10 +26,11 @@ import javax.net.ssl.SSLSocketFactory; import org.apache.nifi.util.NiFiProperties; /** - * Implements a socket factory for creating secure sockets based on the application's - * configuration properties. If the properties are configured for SSL (one-way or two-way), - * then a SSLSocketFactory is created and used based on those properties. Otherwise, - * Java's default SSLSocketFactory is used. Specifically, SSLContext.getDefault().getSocketFactory(). + * Implements a socket factory for creating secure sockets based on the + * application's configuration properties. If the properties are configured for + * SSL (one-way or two-way), then a SSLSocketFactory is created and used based + * on those properties. Otherwise, Java's default SSLSocketFactory is used. + * Specifically, SSLContext.getDefault().getSocketFactory(). */ public class SslSocketFactory extends SSLSocketFactory { @@ -37,17 +38,17 @@ public class SslSocketFactory extends SSLSocketFactory { public SslSocketFactory() { final SSLContext sslCtx = SslContextFactory.createSslContext(NiFiProperties.getInstance()); - if(sslCtx == null) { + if (sslCtx == null) { try { sslSocketFactory = SSLContext.getDefault().getSocketFactory(); - } catch(final NoSuchAlgorithmException nsae) { + } catch (final NoSuchAlgorithmException nsae) { throw new SslSocketFactoryCreationException(nsae); } } else { sslSocketFactory = sslCtx.getSocketFactory(); } } - + @Override public String[] getSupportedCipherSuites() { return sslSocketFactory.getSupportedCipherSuites(); @@ -57,7 +58,7 @@ public class SslSocketFactory extends SSLSocketFactory { public String[] getDefaultCipherSuites() { return sslSocketFactory.getDefaultCipherSuites(); } - + @Override public Socket createSocket(Socket socket, String string, int i, boolean bln) throws IOException { return sslSocketFactory.createSocket(socket, string, i, bln); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactoryCreationException.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactoryCreationException.java index 6795f907c7..02c242ecf3 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactoryCreationException.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/main/java/org/apache/nifi/framework/security/util/SslSocketFactoryCreationException.java @@ -18,6 +18,7 @@ package org.apache.nifi.framework.security.util; /** * Represents the exceptional case when a SslSocketFactory failed creation. + * * @author unattributed */ public class SslSocketFactoryCreationException extends SslException { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/test/java/org/apache/nifi/framework/security/util/SslContextFactoryTest.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/test/java/org/apache/nifi/framework/security/util/SslContextFactoryTest.java index e619e80897..8ecb798a6d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/test/java/org/apache/nifi/framework/security/util/SslContextFactoryTest.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-security/src/test/java/org/apache/nifi/framework/security/util/SslContextFactoryTest.java @@ -16,14 +16,14 @@ */ package org.apache.nifi.framework.security.util; -import org.apache.nifi.framework.security.util.SslContextFactory; import org.apache.nifi.security.util.KeystoreType; import java.io.File; import org.apache.nifi.util.NiFiProperties; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** * @author unattributed @@ -38,13 +38,13 @@ public class SslContextFactoryTest { final File ksFile = new File(SslContextFactoryTest.class.getResource("/localhost-ks.jks").toURI()); final File trustFile = new File(SslContextFactoryTest.class.getResource("/localhost-ts.jks").toURI()); - + authProps = mock(NiFiProperties.class); when(authProps.getProperty(NiFiProperties.SECURITY_KEYSTORE)).thenReturn(ksFile.getAbsolutePath()); when(authProps.getProperty(NiFiProperties.SECURITY_KEYSTORE_TYPE)).thenReturn(KeystoreType.JKS.toString()); when(authProps.getProperty(NiFiProperties.SECURITY_KEYSTORE_PASSWD)).thenReturn("localtest"); when(authProps.getNeedClientAuth()).thenReturn(false); - + mutualAuthProps = mock(NiFiProperties.class); when(mutualAuthProps.getProperty(NiFiProperties.SECURITY_KEYSTORE)).thenReturn(ksFile.getAbsolutePath()); when(mutualAuthProps.getProperty(NiFiProperties.SECURITY_KEYSTORE_TYPE)).thenReturn(KeystoreType.JKS.toString()); @@ -53,17 +53,17 @@ public class SslContextFactoryTest { when(mutualAuthProps.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_TYPE)).thenReturn(KeystoreType.JKS.toString()); when(mutualAuthProps.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_PASSWD)).thenReturn("localtest"); when(mutualAuthProps.getNeedClientAuth()).thenReturn(true); - - } + + } @Test public void testCreateSslContextWithMutualAuth() { - Assert.assertNotNull(SslContextFactory.createSslContext(mutualAuthProps)); + Assert.assertNotNull(SslContextFactory.createSslContext(mutualAuthProps)); } @Test public void testCreateSslContextWithNoMutualAuth() { - Assert.assertNotNull(SslContextFactory.createSslContext(authProps)); + Assert.assertNotNull(SslContextFactory.createSslContext(authProps)); } - + } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/pom.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/pom.xml index 3b086bb176..173e2cf256 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/pom.xml @@ -59,8 +59,8 @@ nifi-utils - org.apache.nifi - nifi-site-to-site-client + org.apache.nifi + nifi-site-to-site-client org.apache.httpcomponents diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/controller/util/RemoteProcessGroupUtils.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/controller/util/RemoteProcessGroupUtils.java index 10208f89df..8f1f7f6076 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/controller/util/RemoteProcessGroupUtils.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/controller/util/RemoteProcessGroupUtils.java @@ -46,42 +46,41 @@ public class RemoteProcessGroupUtils { private static final int CONNECT_TIMEOUT = 10000; private static final int READ_TIMEOUT = 10000; - + private final Client client; - + public RemoteProcessGroupUtils(final SSLContext sslContext) { this.client = getClient(sslContext); } - /** * Gets the content at the specified URI. * - * @param uri - * @param timeoutMillis - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the URI to get the content of + * @param timeoutMillis the period of time to wait + * @return the response of the request + * @throws ClientHandlerException issues handling the response + * @throws UniformInterfaceException issues with the request */ public ClientResponse get(final URI uri, final int timeoutMillis) throws ClientHandlerException, UniformInterfaceException { return get(uri, timeoutMillis, null); } - + /** * Gets the content at the specified URI using the given query parameters. * - * @param uri - * @param timeoutMillis - * @param queryParams - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the uri to get the content of + * @param timeoutMillis the period of time to wait for a response + * @param queryParams the query params of the request + * @return the client response of the request + * @throws ClientHandlerException issues with the response + * @throws UniformInterfaceException issues with the request */ public ClientResponse get(final URI uri, final int timeoutMillis, final Map queryParams) throws ClientHandlerException, UniformInterfaceException { // perform the request WebResource webResource = client.resource(uri); - if ( queryParams != null ) { - for ( final Map.Entry queryEntry : queryParams.entrySet() ) { + if (queryParams != null) { + for (final Map.Entry queryEntry : queryParams.entrySet()) { webResource = webResource.queryParam(queryEntry.getKey(), queryEntry.getValue()); } } @@ -95,11 +94,11 @@ public class RemoteProcessGroupUtils { /** * Performs a HEAD request to the specified URI. * - * @param uri - * @param timeoutMillis - * @return - * @throws ClientHandlerException - * @throws UniformInterfaceException + * @param uri the uri to request the head of + * @param timeoutMillis the period of time to wait for a reponse + * @return the client response + * @throws ClientHandlerException issues with the request + * @throws UniformInterfaceException issues with the response */ public ClientResponse head(final URI uri, final int timeoutMillis) throws ClientHandlerException, UniformInterfaceException { // perform the request @@ -110,10 +109,10 @@ public class RemoteProcessGroupUtils { } /** - * Gets a client based on the specified URI. - * - * @param uri - * @return + * Gets a client for the given sslContext + * + * @param sslContext the ssl context to get a client for + * @return the client */ private Client getClient(final SSLContext sslContext) { final Client client; @@ -128,26 +127,28 @@ public class RemoteProcessGroupUtils { return client; } - - + /** - * Returns the port on which the remote instance is listening for Flow File transfers, or null if the remote instance - * is not configured to use Site-to-Site transfers. - * - * @param uri the base URI of the remote instance. This should include the path only to the nifi-api level, as well as the protocol, host, and port. - * @param timeoutMillis - * @return - * @throws IOException + * Returns the port on which the remote instance is listening for Flow File + * transfers, or null if the remote instance is not configured + * to use Site-to-Site transfers. + * + * @param uri the base URI of the remote instance. This should include the + * path only to the nifi-api level, as well as the protocol, host, and port. + * @param timeoutMillis the period of time to wait for the port + * @return the port + * @throws IOException if an error occurs getting the remote port + * information */ public Integer getRemoteListeningPort(final String uri, final int timeoutMillis) throws IOException { - try { - final URI uriObject = new URI(uri + CONTROLLER_URI_PATH); - return getRemoteListeningPort(uriObject, timeoutMillis); - } catch (URISyntaxException e) { - throw new IOException("Unable to establish connection to remote host because URI is invalid: " + uri); - } + try { + final URI uriObject = new URI(uri + CONTROLLER_URI_PATH); + return getRemoteListeningPort(uriObject, timeoutMillis); + } catch (URISyntaxException e) { + throw new IOException("Unable to establish connection to remote host because URI is invalid: " + uri); + } } - + public String getRemoteRootGroupId(final String uri, final int timeoutMillis) throws IOException { try { final URI uriObject = new URI(uri + CONTROLLER_URI_PATH); @@ -156,7 +157,7 @@ public class RemoteProcessGroupUtils { throw new IOException("Unable to establish connection to remote host because URI is invalid: " + uri); } } - + public String getRemoteInstanceId(final String uri, final int timeoutMillis) throws IOException { try { final URI uriObject = new URI(uri + CONTROLLER_URI_PATH); @@ -165,26 +166,27 @@ public class RemoteProcessGroupUtils { throw new IOException("Unable to establish connection to remote host because URI is invalid: " + uri); } } - + /** - * Returns the port on which the remote instance is listening for Flow File transfers, or null if the remote instance - * is not configured to use Site-to-Site transfers. - * + * Returns the port on which the remote instance is listening for Flow File + * transfers, or null if the remote instance is not configured + * to use Site-to-Site transfers. + * * @param uri the full URI to fetch, including the path. - * @return - * @throws IOException + * @return the remote listening port + * @throws IOException if unable to get port */ private Integer getRemoteListeningPort(final URI uri, final int timeoutMillis) throws IOException { - return getController(uri, timeoutMillis).getRemoteSiteListeningPort(); + return getController(uri, timeoutMillis).getRemoteSiteListeningPort(); } - + private String getRemoteRootGroupId(final URI uri, final int timeoutMillis) throws IOException { return getController(uri, timeoutMillis).getId(); } - + private ControllerDTO getController(final URI uri, final int timeoutMillis) throws IOException { final ClientResponse response = get(uri, timeoutMillis); - + if (Status.OK.getStatusCode() == response.getStatusInfo().getStatusCode()) { final ControllerEntity entity = response.getEntity(ControllerEntity.class); return entity.getController(); @@ -193,12 +195,12 @@ public class RemoteProcessGroupUtils { throw new IOException("Got HTTP response Code " + response.getStatusInfo().getStatusCode() + ": " + response.getStatusInfo().getReasonPhrase() + " with explanation: " + responseMessage); } } - + /** * Issues a registration request on behalf of the current user. - * - * @param baseApiUri - * @return + * + * @param baseApiUri the URI to issue a request to + * @return the response of the request */ public ClientResponse issueRegistrationRequest(String baseApiUri) { final URI uri = URI.create(String.format("%s/%s", baseApiUri, "/controller/users")); @@ -206,10 +208,10 @@ public class RemoteProcessGroupUtils { // set up the query params MultivaluedMapImpl entity = new MultivaluedMapImpl(); entity.add("justification", "A Remote instance of NiFi has attempted to create a reference to this NiFi. This action must be approved first."); - + // create the web resource WebResource webResource = client.resource(uri); - + // get the client utils and make the request return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED).entity(entity).post(ClientResponse.class); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceFactory.java index 2b27de27fe..b0ce357a02 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceFactory.java @@ -28,22 +28,22 @@ import org.apache.nifi.remote.protocol.ServerProtocol; public class RemoteResourceFactory extends RemoteResourceInitiator { - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") public static T receiveCodecNegotiation(final DataInputStream dis, final DataOutputStream dos) throws IOException, HandshakeException { final String codecName = dis.readUTF(); final int version = dis.readInt(); - + final T codec = (T) RemoteResourceManager.createCodec(codecName, version); final VersionNegotiator negotiator = codec.getVersionNegotiator(); - if ( negotiator.isVersionSupported(version) ) { + if (negotiator.isVersionSupported(version)) { dos.write(RESOURCE_OK); dos.flush(); - + negotiator.setVersion(version); return codec; } else { final Integer preferred = negotiator.getPreferredVersion(version); - if ( preferred == null ) { + if (preferred == null) { dos.write(ABORT); dos.flush(); throw new HandshakeException("Unable to negotiate an acceptable version of the FlowFileCodec " + codecName); @@ -51,36 +51,36 @@ public class RemoteResourceFactory extends RemoteResourceInitiator { dos.write(DIFFERENT_RESOURCE_VERSION); dos.writeInt(preferred); dos.flush(); - + return receiveCodecNegotiation(dis, dos); } - } - - public static void rejectCodecNegotiation(final DataInputStream dis, final DataOutputStream dos, final String explanation) throws IOException { - dis.readUTF(); // read codec name - dis.readInt(); // read codec version - - dos.write(ABORT); - dos.writeUTF(explanation); - dos.flush(); - } - - @SuppressWarnings("unchecked") + } + + public static void rejectCodecNegotiation(final DataInputStream dis, final DataOutputStream dos, final String explanation) throws IOException { + dis.readUTF(); // read codec name + dis.readInt(); // read codec version + + dos.write(ABORT); + dos.writeUTF(explanation); + dos.flush(); + } + + @SuppressWarnings("unchecked") public static T receiveClientProtocolNegotiation(final DataInputStream dis, final DataOutputStream dos) throws IOException, HandshakeException { final String protocolName = dis.readUTF(); final int version = dis.readInt(); - + final T protocol = (T) RemoteResourceManager.createClientProtocol(protocolName); final VersionNegotiator negotiator = protocol.getVersionNegotiator(); - if ( negotiator.isVersionSupported(version) ) { + if (negotiator.isVersionSupported(version)) { dos.write(RESOURCE_OK); dos.flush(); - + negotiator.setVersion(version); return protocol; } else { final Integer preferred = negotiator.getPreferredVersion(version); - if ( preferred == null ) { + if (preferred == null) { dos.write(ABORT); dos.flush(); throw new HandshakeException("Unable to negotiate an acceptable version of the ClientProtocol " + protocolName); @@ -88,28 +88,27 @@ public class RemoteResourceFactory extends RemoteResourceInitiator { dos.write(DIFFERENT_RESOURCE_VERSION); dos.writeInt(preferred); dos.flush(); - + return receiveClientProtocolNegotiation(dis, dos); } } - - - @SuppressWarnings("unchecked") + + @SuppressWarnings("unchecked") public static T receiveServerProtocolNegotiation(final DataInputStream dis, final DataOutputStream dos) throws IOException, HandshakeException { - final String protocolName = dis.readUTF(); + final String protocolName = dis.readUTF(); final int version = dis.readInt(); - + final T protocol = (T) RemoteResourceManager.createServerProtocol(protocolName); final VersionNegotiator negotiator = protocol.getVersionNegotiator(); - if ( negotiator.isVersionSupported(version) ) { + if (negotiator.isVersionSupported(version)) { dos.write(RESOURCE_OK); dos.flush(); - + negotiator.setVersion(version); return protocol; } else { final Integer preferred = negotiator.getPreferredVersion(version); - if ( preferred == null ) { + if (preferred == null) { dos.write(ABORT); dos.flush(); throw new HandshakeException("Unable to negotiate an acceptable version of the ServerProtocol " + protocolName); @@ -117,54 +116,53 @@ public class RemoteResourceFactory extends RemoteResourceInitiator { dos.write(DIFFERENT_RESOURCE_VERSION); dos.writeInt(preferred); dos.flush(); - + return receiveServerProtocolNegotiation(dis, dos); } } - - - - - public static T receiveResourceNegotiation(final Class cls, final DataInputStream dis, final DataOutputStream dos, final Class[] constructorArgClasses, final Object[] constructorArgs) throws IOException, HandshakeException { - final String resourceClassName = dis.readUTF(); - final T resource; - try { + + public static T + receiveResourceNegotiation(final Class cls, final DataInputStream dis, final DataOutputStream dos, final Class[] constructorArgClasses, final Object[] constructorArgs) + throws IOException, HandshakeException { + final String resourceClassName = dis.readUTF(); + final T resource; + try { @SuppressWarnings("unchecked") - final Class resourceClass = (Class) Class.forName(resourceClassName); - if ( !cls.isAssignableFrom(resourceClass) ) { - throw new HandshakeException("Expected to negotiate a Versioned Resource of type " + cls.getName() + " but received class name of " + resourceClassName); + final Class resourceClass = (Class) Class.forName(resourceClassName); + if (!cls.isAssignableFrom(resourceClass)) { + throw new HandshakeException("Expected to negotiate a Versioned Resource of type " + cls.getName() + " but received class name of " + resourceClassName); } - + final Constructor ctr = resourceClass.getConstructor(constructorArgClasses); resource = ctr.newInstance(constructorArgs); } catch (final Throwable t) { - dos.write(ABORT); - final String errorMsg = "Unable to instantiate Versioned Resource of type " + resourceClassName; - dos.writeUTF(errorMsg); - dos.flush(); - throw new HandshakeException(errorMsg); + dos.write(ABORT); + final String errorMsg = "Unable to instantiate Versioned Resource of type " + resourceClassName; + dos.writeUTF(errorMsg); + dos.flush(); + throw new HandshakeException(errorMsg); } - + final int version = dis.readInt(); final VersionNegotiator negotiator = resource.getVersionNegotiator(); - if ( negotiator.isVersionSupported(version) ) { + if (negotiator.isVersionSupported(version)) { dos.write(RESOURCE_OK); dos.flush(); - + negotiator.setVersion(version); return resource; } else { final Integer preferred = negotiator.getPreferredVersion(version); - if ( preferred == null ) { - dos.write(ABORT); - dos.flush(); - throw new HandshakeException("Unable to negotiate an acceptable version of the resource " + resourceClassName); + if (preferred == null) { + dos.write(ABORT); + dos.flush(); + throw new HandshakeException("Unable to negotiate an acceptable version of the resource " + resourceClassName); } dos.write(DIFFERENT_RESOURCE_VERSION); dos.writeInt(preferred); dos.flush(); - + return receiveResourceNegotiation(cls, dis, dos, constructorArgClasses, constructorArgs); } - } + } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceManager.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceManager.java index f86f066473..8bbe7aa518 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceManager.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteResourceManager.java @@ -34,20 +34,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RemoteResourceManager { + private static final Map> codecClassMap; private static final Map> desiredServerProtocolClassMap = new ConcurrentHashMap<>(); private static final Map> desiredClientProtocolClassMap = new ConcurrentHashMap<>(); - + private static final Map>> serverProtocolClassMap; private static final Map>> clientProtocolClassMap; - + private static final Logger logger = LoggerFactory.getLogger(RemoteResourceManager.class); - + static { final Map> codecMap = new HashMap<>(); final Map>> serverProtocolMap = new HashMap<>(); final Map>> clientProtocolMap = new HashMap<>(); - + // load all of the FlowFileCodecs that we know final ClassLoader classLoader = RemoteResourceManager.class.getClassLoader(); final ServiceLoader flowFileCodecLoader = ServiceLoader.load(FlowFileCodec.class, classLoader); @@ -58,12 +59,12 @@ public class RemoteResourceManager { final String codecName = codec.getResourceName(); final Class previousValue = codecMap.put(codecName, clazz); - if ( previousValue != null ) { - logger.warn("Multiple FlowFileCodec's found with name {}; choosing to use {} in place of {}", - new Object[] {codecName, clazz.getName(), previousValue.getName()}); + if (previousValue != null) { + logger.warn("Multiple FlowFileCodec's found with name {}; choosing to use {} in place of {}", + new Object[]{codecName, clazz.getName(), previousValue.getName()}); } } - + final ServiceLoader serverProtocolLoader = ServiceLoader.load(ServerProtocol.class, classLoader); final Iterator serverItr = serverProtocolLoader.iterator(); while (serverItr.hasNext()) { @@ -72,14 +73,14 @@ public class RemoteResourceManager { final String protocolName = protocol.getResourceName(); Set> classSet = serverProtocolMap.get(protocolName); - if ( classSet == null ) { + if (classSet == null) { classSet = new HashSet<>(); serverProtocolMap.put(protocolName, classSet); } - + classSet.add(clazz); } - + final ServiceLoader clientProtocolLoader = ServiceLoader.load(ClientProtocol.class, classLoader); final Iterator clientItr = clientProtocolLoader.iterator(); while (clientItr.hasNext()) { @@ -88,133 +89,132 @@ public class RemoteResourceManager { final String protocolName = protocol.getResourceName(); Set> classSet = clientProtocolMap.get(protocolName); - if ( classSet == null ) { + if (classSet == null) { classSet = new HashSet<>(); clientProtocolMap.put(protocolName, classSet); } - + classSet.add(clazz); } - + codecClassMap = Collections.unmodifiableMap(codecMap); clientProtocolClassMap = Collections.unmodifiableMap(clientProtocolMap); serverProtocolClassMap = Collections.unmodifiableMap(serverProtocolMap); } - public static boolean isCodecSupported(final String codecName) { return codecClassMap.containsKey(codecName); } - + public static boolean isCodecSupported(final String codecName, final int version) { - if ( !isCodecSupported(codecName) ) { + if (!isCodecSupported(codecName)) { return false; } - + final FlowFileCodec codec = createCodec(codecName); final VersionNegotiator negotiator = codec.getVersionNegotiator(); return (negotiator.isVersionSupported(version)); } - + public static FlowFileCodec createCodec(final String codecName, final int version) { final FlowFileCodec codec = createCodec(codecName); final VersionNegotiator negotiator = codec.getVersionNegotiator(); - if ( !negotiator.isVersionSupported(version) ) { + if (!negotiator.isVersionSupported(version)) { throw new IllegalArgumentException("FlowFile Codec " + codecName + " does not support version " + version); } - + negotiator.setVersion(version); return codec; } - + private static FlowFileCodec createCodec(final String codecName) { final Class codecClass = codecClassMap.get(codecName); - if ( codecClass == null ) { + if (codecClass == null) { throw new IllegalArgumentException("Unknown Codec: " + codecName); } - + try { return codecClass.newInstance(); } catch (final Exception e) { throw new RuntimeException("Unable to instantiate class " + codecClass.getName(), e); } } - + public static Set getSupportedCodecNames() { return codecClassMap.keySet(); } - + public static List getSupportedVersions(final String codecName) { final FlowFileCodec codec = createCodec(codecName); return codec.getSupportedVersions(); } - + public static Set> getClientProtocolClasses(final String protocolName) { final Set> classes = clientProtocolClassMap.get(protocolName); - if ( classes == null ) { + if (classes == null) { return new HashSet<>(); } return new HashSet<>(classes); } - + public static Set> getServerProtocolClasses(final String protocolName) { final Set> classes = serverProtocolClassMap.get(protocolName); - if ( classes == null ) { + if (classes == null) { return new HashSet<>(); } return new HashSet<>(classes); } - + public static void setServerProtocolImplementation(final String protocolName, final Class clazz) { desiredServerProtocolClassMap.put(protocolName, clazz); } - + public static void setClientProtocolImplementation(final String protocolName, final Class clazz) { desiredClientProtocolClassMap.put(protocolName, clazz); } - + public static ServerProtocol createServerProtocol(final String protocolName) { final Set> classSet = getServerProtocolClasses(protocolName); - if ( classSet.isEmpty() ) { + if (classSet.isEmpty()) { throw new IllegalArgumentException("Unknkown Server Protocol: " + protocolName); } Class desiredClass = desiredServerProtocolClassMap.get(protocolName); - if ( desiredClass == null && classSet.size() > 1 ) { + if (desiredClass == null && classSet.size() > 1) { throw new IllegalStateException("Multiple implementations of Server Protocol " + protocolName + " were found and no preferred implementation has been specified"); } - - if ( desiredClass != null && !classSet.contains(desiredClass) ) { + + if (desiredClass != null && !classSet.contains(desiredClass)) { throw new IllegalStateException("Desired implementation of Server Protocol " + protocolName + " is set to " + desiredClass + ", but that Protocol is not registered as a Server Protocol"); } - - if ( desiredClass == null ) { + + if (desiredClass == null) { desiredClass = classSet.iterator().next(); } - + try { return desiredClass.newInstance(); } catch (final Exception e) { throw new RuntimeException("Unable to instantiate class " + desiredClass.getName(), e); - } + } } - + public static ClientProtocol createClientProtocol(final String protocolName) { final Set> classSet = getClientProtocolClasses(protocolName); - if ( classSet.isEmpty() ) { + if (classSet.isEmpty()) { throw new IllegalArgumentException("Unknkown Client Protocol: " + protocolName); } Class desiredClass = desiredClientProtocolClassMap.get(protocolName); - if ( desiredClass == null && classSet.size() > 1 ) { + if (desiredClass == null && classSet.size() > 1) { throw new IllegalStateException("Multiple implementations of Client Protocol " + protocolName + " were found and no preferred implementation has been specified"); } - - if ( desiredClass != null && !classSet.contains(desiredClass) ) { + + if (desiredClass != null && !classSet.contains(desiredClass)) { throw new IllegalStateException("Desired implementation of Client Protocol " + protocolName + " is set to " + desiredClass + ", but that Protocol is not registered as a Client Protocol"); } - - if ( desiredClass == null ) { + + if (desiredClass == null) { desiredClass = classSet.iterator().next(); } @@ -222,6 +222,6 @@ public class RemoteResourceManager { return desiredClass.newInstance(); } catch (final Exception e) { throw new RuntimeException("Unable to instantiate class " + desiredClass.getName(), e); - } + } } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteSiteListener.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteSiteListener.java index 59e4d0a205..6f7b977059 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteSiteListener.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/RemoteSiteListener.java @@ -30,4 +30,4 @@ public interface RemoteSiteListener { void stop(); -} \ No newline at end of file +} diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java index 493d1fec0e..809147eb41 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java @@ -49,43 +49,42 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SocketRemoteSiteListener implements RemoteSiteListener { + public static final String DEFAULT_FLOWFILE_PATH = "./"; private final int socketPort; private final SSLContext sslContext; private final NodeInformant nodeInformant; private final AtomicReference rootGroup = new AtomicReference<>(); - + private final AtomicBoolean stopped = new AtomicBoolean(false); - + private static final Logger LOG = LoggerFactory.getLogger(SocketRemoteSiteListener.class); public SocketRemoteSiteListener(final int socketPort, final SSLContext sslContext) { this(socketPort, sslContext, null); } - + public SocketRemoteSiteListener(final int socketPort, final SSLContext sslContext, final NodeInformant nodeInformant) { this.socketPort = socketPort; this.sslContext = sslContext; this.nodeInformant = nodeInformant; } - @Override public void setRootGroup(final ProcessGroup rootGroup) { this.rootGroup.set(rootGroup); } - @Override public void start() throws IOException { final boolean secure = (sslContext != null); - + final ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.configureBlocking(true); serverSocketChannel.bind(new InetSocketAddress(socketPort)); stopped.set(false); - + final Thread listenerThread = new Thread(new Runnable() { private int threadCount = 0; @@ -95,19 +94,21 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { final ProcessGroup processGroup = rootGroup.get(); // If nodeInformant is not null, we are in clustered mode, which means that we don't care about // the processGroup. - if ( (nodeInformant == null) && (processGroup == null || (processGroup.getInputPorts().isEmpty() && processGroup.getOutputPorts().isEmpty())) ) { - try { Thread.sleep(2000L); } catch (final Exception e) {} + if ((nodeInformant == null) && (processGroup == null || (processGroup.getInputPorts().isEmpty() && processGroup.getOutputPorts().isEmpty()))) { + try { + Thread.sleep(2000L); + } catch (final Exception e) { + } continue; } - - + LOG.trace("Accepting Connection..."); Socket acceptedSocket = null; try { serverSocketChannel.configureBlocking(false); final ServerSocket serverSocket = serverSocketChannel.socket(); serverSocket.setSoTimeout(2000); - while ( !stopped.get() && acceptedSocket == null ) { + while (!stopped.get() && acceptedSocket == null) { try { acceptedSocket = serverSocket.accept(); } catch (final SocketTimeoutException ste) { @@ -116,14 +117,14 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } } catch (final IOException e) { LOG.error("RemoteSiteListener Unable to accept connection due to {}", e.toString()); - if ( LOG.isDebugEnabled() ) { + if (LOG.isDebugEnabled()) { LOG.error("", e); } continue; } LOG.trace("Got connection"); - - if ( stopped.get() ) { + + if (stopped.get()) { return; } final Socket socket = acceptedSocket; @@ -135,25 +136,25 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { final InetAddress inetAddress = socket.getInetAddress(); String hostname = inetAddress.getHostName(); final int slashIndex = hostname.indexOf("/"); - if ( slashIndex == 0 ) { + if (slashIndex == 0) { hostname = hostname.substring(1); - } else if ( slashIndex > 0 ) { + } else if (slashIndex > 0) { hostname = hostname.substring(0, slashIndex); } final int port = socket.getPort(); final String peerUri = "nifi://" + hostname + ":" + port; LOG.debug("{} Connection URL is {}", this, peerUri); - + final CommunicationsSession commsSession; final String dn; try { - if ( secure ) { + if (secure) { final SSLSocketChannel sslSocketChannel = new SSLSocketChannel(sslContext, socketChannel, false); LOG.trace("Channel is secure; connecting..."); sslSocketChannel.connect(); LOG.trace("Channel connected"); - + commsSession = new SSLSocketChannelCommunicationsSession(sslSocketChannel, peerUri); dn = sslSocketChannel.getDn(); commsSession.setUserDn(dn); @@ -164,7 +165,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } } catch (final Exception e) { LOG.error("RemoteSiteListener Unable to accept connection from {} due to {}", socket, e.toString()); - if ( LOG.isDebugEnabled() ) { + if (LOG.isDebugEnabled()) { LOG.error("", e); } try { @@ -173,135 +174,136 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } return; } - + LOG.info("Received connection from {}, User DN: {}", socket.getInetAddress(), dn); - + final InputStream socketIn; final OutputStream socketOut; - + try { socketIn = commsSession.getInput().getInputStream(); socketOut = commsSession.getOutput().getOutputStream(); } catch (final IOException e) { - LOG.error("Connection dropped from {} before any data was transmitted", peerUri); - try { - commsSession.close(); - } catch (final IOException ioe) {} - - return; - } - - final DataInputStream dis = new DataInputStream(socketIn); - final DataOutputStream dos = new DataOutputStream(socketOut); - - ServerProtocol protocol = null; - Peer peer = null; - try { - // ensure that we are communicating with another NiFi - LOG.debug("Verifying magic bytes..."); - verifyMagicBytes(dis, peerUri); + LOG.error("Connection dropped from {} before any data was transmitted", peerUri); + try { + commsSession.close(); + } catch (final IOException ioe) { + } + + return; + } + + final DataInputStream dis = new DataInputStream(socketIn); + final DataOutputStream dos = new DataOutputStream(socketOut); + + ServerProtocol protocol = null; + Peer peer = null; + try { + // ensure that we are communicating with another NiFi + LOG.debug("Verifying magic bytes..."); + verifyMagicBytes(dis, peerUri); + + LOG.debug("Receiving Server Protocol Negotiation"); + protocol = RemoteResourceFactory.receiveServerProtocolNegotiation(dis, dos); + protocol.setRootProcessGroup(rootGroup.get()); + protocol.setNodeInformant(nodeInformant); + + final PeerDescription description = new PeerDescription("localhost", getPort(), sslContext != null); + peer = new Peer(description, commsSession, peerUri, "nifi://localhost:" + getPort()); + LOG.debug("Handshaking...."); + protocol.handshake(peer); + + if (!protocol.isHandshakeSuccessful()) { + LOG.error("Handshake failed with {}; closing connection", peer); + try { + peer.close(); + } catch (final IOException e) { + LOG.warn("Failed to close {} due to {}", peer, e); + } + + // no need to shutdown protocol because we failed to perform handshake + return; + } + + commsSession.setTimeout((int) protocol.getRequestExpiration()); + + LOG.info("Successfully negotiated ServerProtocol {} Version {} with {}", new Object[]{ + protocol.getResourceName(), protocol.getVersionNegotiator().getVersion(), peer}); + + try { + while (!protocol.isShutdown()) { + LOG.trace("Getting Protocol Request Type..."); - LOG.debug("Receiving Server Protocol Negotiation"); - protocol = RemoteResourceFactory.receiveServerProtocolNegotiation(dis, dos); - protocol.setRootProcessGroup(rootGroup.get()); - protocol.setNodeInformant(nodeInformant); - - final PeerDescription description = new PeerDescription("localhost", getPort(), sslContext != null); - peer = new Peer(description, commsSession, peerUri, "nifi://localhost:" + getPort()); - LOG.debug("Handshaking...."); - protocol.handshake(peer); - - if (!protocol.isHandshakeSuccessful()) { - LOG.error("Handshake failed with {}; closing connection", peer); - try { - peer.close(); - } catch (final IOException e) { - LOG.warn("Failed to close {} due to {}", peer, e); - } - - // no need to shutdown protocol because we failed to perform handshake - return; - } - - commsSession.setTimeout((int) protocol.getRequestExpiration()); - - LOG.info("Successfully negotiated ServerProtocol {} Version {} with {}", new Object[] { - protocol.getResourceName(), protocol.getVersionNegotiator().getVersion(), peer}); - - try { - while (!protocol.isShutdown()) { - LOG.trace("Getting Protocol Request Type..."); - int timeoutCount = 0; RequestType requestType = null; - - while ( requestType == null ) { + + while (requestType == null) { try { requestType = protocol.getRequestType(peer); } catch (final SocketTimeoutException e) { // Give the timeout a bit longer (twice as long) to receive the Request Type, // in order to attempt to receive more data without shutting down the socket if we don't // have to. - LOG.debug("{} Timed out waiting to receive RequestType using {} with {}", new Object[] {this, protocol, peer}); + LOG.debug("{} Timed out waiting to receive RequestType using {} with {}", new Object[]{this, protocol, peer}); timeoutCount++; requestType = null; - - if ( timeoutCount >= 2 ) { + + if (timeoutCount >= 2) { throw e; } } } - + LOG.debug("Request type from {} is {}", protocol, requestType); - switch (requestType) { - case NEGOTIATE_FLOWFILE_CODEC: - protocol.negotiateCodec(peer); - break; - case RECEIVE_FLOWFILES: - // peer wants to receive FlowFiles, so we will transfer FlowFiles. - protocol.getPort().transferFlowFiles(peer, protocol, new HashMap()); - break; - case SEND_FLOWFILES: - // Peer wants to send FlowFiles, so we will receive. + switch (requestType) { + case NEGOTIATE_FLOWFILE_CODEC: + protocol.negotiateCodec(peer); + break; + case RECEIVE_FLOWFILES: + // peer wants to receive FlowFiles, so we will transfer FlowFiles. + protocol.getPort().transferFlowFiles(peer, protocol, new HashMap()); + break; + case SEND_FLOWFILES: + // Peer wants to send FlowFiles, so we will receive. protocol.getPort().receiveFlowFiles(peer, protocol, new HashMap()); - break; - case REQUEST_PEER_LIST: - protocol.sendPeerList(peer); - break; - case SHUTDOWN: - protocol.shutdown(peer); - break; - } - } - LOG.debug("Finished communicating with {} ({})", peer, protocol); - } catch (final Exception e) { - LOG.error("Unable to communicate with remote instance {} ({}) due to {}; closing connection", peer, protocol, e.toString()); - if ( LOG.isDebugEnabled() ) { - LOG.error("", e); - } - } + break; + case REQUEST_PEER_LIST: + protocol.sendPeerList(peer); + break; + case SHUTDOWN: + protocol.shutdown(peer); + break; + } + } + LOG.debug("Finished communicating with {} ({})", peer, protocol); + } catch (final Exception e) { + LOG.error("Unable to communicate with remote instance {} ({}) due to {}; closing connection", peer, protocol, e.toString()); + if (LOG.isDebugEnabled()) { + LOG.error("", e); + } + } } catch (final IOException e) { LOG.error("Unable to communicate with remote instance {} due to {}; closing connection", peer, e.toString()); - if ( LOG.isDebugEnabled() ) { + if (LOG.isDebugEnabled()) { LOG.error("", e); } } catch (final Throwable t) { LOG.error("Handshake failed when communicating with {}; closing connection. Reason for failure: {}", peerUri, t.toString()); - if ( LOG.isDebugEnabled() ) { + if (LOG.isDebugEnabled()) { LOG.error("", t); } } finally { LOG.trace("Cleaning up"); try { - if ( protocol != null && peer != null ) { + if (protocol != null && peer != null) { protocol.shutdown(peer); } } catch (final Exception protocolException) { LOG.warn("Failed to shutdown protocol due to {}", protocolException.toString()); } - + try { - if ( peer != null ) { + if (peer != null) { peer.close(); } } catch (final Exception peerException) { @@ -320,30 +322,30 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { listenerThread.setName("Site-to-Site Listener"); listenerThread.start(); } - + @Override public int getPort() { return socketPort; } - + @Override public void stop() { stopped.set(true); } - + private void verifyMagicBytes(final InputStream in, final String peerDescription) throws IOException, HandshakeException { final byte[] receivedMagicBytes = new byte[CommunicationsSession.MAGIC_BYTES.length]; // expect magic bytes try { - for (int i=0; i < receivedMagicBytes.length; i++) { + for (int i = 0; i < receivedMagicBytes.length; i++) { receivedMagicBytes[i] = (byte) in.read(); } } catch (final EOFException e) { throw new HandshakeException("Handshake failed (not enough bytes) when communicating with " + peerDescription); } - - if ( !Arrays.equals(CommunicationsSession.MAGIC_BYTES, receivedMagicBytes) ) { + + if (!Arrays.equals(CommunicationsSession.MAGIC_BYTES, receivedMagicBytes)) { throw new HandshakeException("Handshake with " + peerDescription + " failed because the Magic Header was not present"); } } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java index eec6ed58b5..982d9ffcab 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java @@ -56,14 +56,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class StandardRemoteGroupPort extends RemoteGroupPort { + private static final long BATCH_SEND_NANOS = TimeUnit.SECONDS.toNanos(5L); // send batches of up to 5 seconds public static final String USER_AGENT = "NiFi-Site-to-Site"; public static final String CONTENT_TYPE = "application/octet-stream"; - + public static final int GZIP_COMPRESSION_LEVEL = 1; - + private static final String CATEGORY = "Site to Site"; - + private static final Logger logger = LoggerFactory.getLogger(StandardRemoteGroupPort.class); private final RemoteProcessGroup remoteGroup; private final AtomicBoolean useCompression = new AtomicBoolean(false); @@ -71,28 +72,27 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { private final AtomicBoolean targetRunning = new AtomicBoolean(true); private final SSLContext sslContext; private final TransferDirection transferDirection; - + private final AtomicReference clientRef = new AtomicReference<>(); - - - public StandardRemoteGroupPort(final String id, final String name, final ProcessGroup processGroup, final RemoteProcessGroup remoteGroup, + + public StandardRemoteGroupPort(final String id, final String name, final ProcessGroup processGroup, final RemoteProcessGroup remoteGroup, final TransferDirection direction, final ConnectableType type, final SSLContext sslContext, final ProcessScheduler scheduler) { // remote group port id needs to be unique but cannot just be the id of the port // in the remote group instance. this supports referencing the same remote // instance more than once. super(id, name, processGroup, type, scheduler); - + this.remoteGroup = remoteGroup; this.transferDirection = direction; this.sslContext = sslContext; setScheduldingPeriod(MINIMUM_SCHEDULING_NANOS + " nanos"); } - + private static File getPeerPersistenceFile(final String portId) { final File stateDir = NiFiProperties.getInstance().getPersistentStateDirectory(); return new File(stateDir, portId + ".peers"); } - + @Override public boolean isTargetRunning() { return targetRunning.get(); @@ -101,18 +101,18 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { public void setTargetRunning(boolean targetRunning) { this.targetRunning.set(targetRunning); } - + @Override public boolean isTriggerWhenEmpty() { return getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT; } - + @Override public void shutdown() { - super.shutdown(); - + super.shutdown(); + final SiteToSiteClient client = clientRef.get(); - if ( client != null ) { + if (client != null) { try { client.close(); } catch (final IOException ioe) { @@ -120,58 +120,57 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { } } } - + @Override public void onSchedulingStart() { super.onSchedulingStart(); - + final SiteToSiteClient client = new SiteToSiteClient.Builder() - .url(remoteGroup.getTargetUri().toString()) - .portIdentifier(getIdentifier()) - .sslContext(sslContext) - .eventReporter(remoteGroup.getEventReporter()) - .peerPersistenceFile(getPeerPersistenceFile(getIdentifier())) - .build(); + .url(remoteGroup.getTargetUri().toString()) + .portIdentifier(getIdentifier()) + .sslContext(sslContext) + .eventReporter(remoteGroup.getEventReporter()) + .peerPersistenceFile(getPeerPersistenceFile(getIdentifier())) + .build(); clientRef.set(client); } - - + @Override public void onTrigger(final ProcessContext context, final ProcessSession session) { - if ( !remoteGroup.isTransmitting() ) { + if (!remoteGroup.isTransmitting()) { logger.debug("{} {} is not transmitting; will not send/receive", this, remoteGroup); return; } - if ( getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && session.getQueueSize().getObjectCount() == 0 ) { + if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && session.getQueueSize().getObjectCount() == 0) { logger.debug("{} No data to send", this); return; } - + String url = getRemoteProcessGroup().getTargetUri().toString(); - + // If we are sending data, we need to ensure that we have at least 1 FlowFile to send. Otherwise, // we don't want to create a transaction at all. final FlowFile firstFlowFile; - if ( getConnectableType() == ConnectableType.REMOTE_INPUT_PORT ) { + if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { firstFlowFile = session.get(); - if ( firstFlowFile == null ) { + if (firstFlowFile == null) { return; } } else { firstFlowFile = null; } - + final SiteToSiteClient client = clientRef.get(); final Transaction transaction; try { - transaction = client.createTransaction(transferDirection); + transaction = client.createTransaction(transferDirection); } catch (final PortNotRunningException e) { context.yield(); this.targetRunning.set(false); final String message = String.format("%s failed to communicate with %s because the remote instance indicates that the port is not in a valid state", this, url); logger.error(message); - session.rollback(); + session.rollback(); remoteGroup.getEventReporter().reportEvent(Severity.ERROR, CATEGORY, message); return; } catch (final UnknownPortException e) { @@ -179,22 +178,22 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { this.targetExists.set(false); final String message = String.format("%s failed to communicate with %s because the remote instance indicates that the port no longer exists", this, url); logger.error(message); - session.rollback(); + session.rollback(); remoteGroup.getEventReporter().reportEvent(Severity.ERROR, CATEGORY, message); return; } catch (final IOException e) { - context.yield(); + context.yield(); final String message = String.format("%s failed to communicate with %s due to %s", this, url, e.toString()); logger.error(message); - if ( logger.isDebugEnabled() ) { + if (logger.isDebugEnabled()) { logger.error("", e); } - session.rollback(); + session.rollback(); remoteGroup.getEventReporter().reportEvent(Severity.ERROR, CATEGORY, message); return; } - - if ( transaction == null ) { + + if (transaction == null) { logger.debug("{} Unable to create transaction to communicate with; all peers must be penalized, so yielding context", this); session.rollback(); context.yield(); @@ -202,11 +201,11 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { } try { - if ( getConnectableType() == ConnectableType.REMOTE_INPUT_PORT ) { + if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) { transferFlowFiles(transaction, context, session, firstFlowFile); } else { final int numReceived = receiveFlowFiles(transaction, context, session); - if ( numReceived == 0 ) { + if (numReceived == 0) { context.yield(); } } @@ -215,24 +214,22 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { } catch (final Throwable t) { final String message = String.format("%s failed to communicate with remote NiFi instance due to %s", this, t.toString()); logger.error("{} failed to communicate with remote NiFi instance due to {}", this, t.toString()); - if ( logger.isDebugEnabled() ) { + if (logger.isDebugEnabled()) { logger.error("", t); } - + remoteGroup.getEventReporter().reportEvent(Severity.ERROR, CATEGORY, message); transaction.error(); session.rollback(); } } - @Override public String getYieldPeriod() { // delegate yield duration to remote process group return remoteGroup.getYieldDuration(); } - - + private int transferFlowFiles(final Transaction transaction, final ProcessContext context, final ProcessSession session, FlowFile firstFlowFile) throws IOException, ProtocolException { FlowFile flowFile = firstFlowFile; @@ -241,7 +238,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { final long startSendingNanos = System.nanoTime(); final StopWatch stopWatch = new StopWatch(true); long bytesSent = 0L; - + final Set flowFilesSent = new HashSet<>(); boolean continueTransaction = true; while (continueTransaction) { @@ -255,79 +252,78 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { transaction.send(dataPacket); } }); - + final long transferNanos = System.nanoTime() - startNanos; final long transferMillis = TimeUnit.MILLISECONDS.convert(transferNanos, TimeUnit.NANOSECONDS); - + flowFilesSent.add(flowFile); bytesSent += flowFile.getSize(); logger.debug("{} Sent {} to {}", this, flowFile, transaction.getCommunicant().getUrl()); - + final String transitUri = transaction.getCommunicant().getUrl() + "/" + flowFile.getAttribute(CoreAttributes.UUID.key()); session.getProvenanceReporter().send(flowFile, transitUri, "Remote DN=" + userDn, transferMillis, false); session.remove(flowFile); - + final long sendingNanos = System.nanoTime() - startSendingNanos; - if ( sendingNanos < BATCH_SEND_NANOS ) { + if (sendingNanos < BATCH_SEND_NANOS) { flowFile = session.get(); } else { flowFile = null; } - + continueTransaction = (flowFile != null); } - + transaction.confirm(); - + // consume input stream entirely, ignoring its contents. If we // don't do this, the Connection will not be returned to the pool stopWatch.stop(); final String uploadDataRate = stopWatch.calculateDataRate(bytesSent); final long uploadMillis = stopWatch.getDuration(TimeUnit.MILLISECONDS); final String dataSize = FormatUtils.formatDataSize(bytesSent); - + session.commit(); transaction.complete(); - + final String flowFileDescription = (flowFilesSent.size() < 20) ? flowFilesSent.toString() : flowFilesSent.size() + " FlowFiles"; - logger.info("{} Successfully sent {} ({}) to {} in {} milliseconds at a rate of {}", new Object[] { + logger.info("{} Successfully sent {} ({}) to {} in {} milliseconds at a rate of {}", new Object[]{ this, flowFileDescription, dataSize, transaction.getCommunicant().getUrl(), uploadMillis, uploadDataRate}); - + return flowFilesSent.size(); } catch (final Exception e) { session.rollback(); throw e; } - } - + private int receiveFlowFiles(final Transaction transaction, final ProcessContext context, final ProcessSession session) throws IOException, ProtocolException { final String userDn = transaction.getCommunicant().getDistinguishedName(); - + final StopWatch stopWatch = new StopWatch(true); final Set flowFilesReceived = new HashSet<>(); long bytesReceived = 0L; - + while (true) { final long start = System.nanoTime(); final DataPacket dataPacket = transaction.receive(); - if ( dataPacket == null ) { + if (dataPacket == null) { break; } - + FlowFile flowFile = session.create(); flowFile = session.putAllAttributes(flowFile, dataPacket.getAttributes()); flowFile = session.importFrom(dataPacket.getData(), flowFile); final long receiveNanos = System.nanoTime() - start; - + String sourceFlowFileIdentifier = dataPacket.getAttributes().get(CoreAttributes.UUID.key()); - if ( sourceFlowFileIdentifier == null ) { + if (sourceFlowFileIdentifier == null) { sourceFlowFileIdentifier = ""; } - + final String transitUri = transaction.getCommunicant().getUrl() + sourceFlowFileIdentifier; - session.getProvenanceReporter().receive(flowFile, transitUri, "urn:nifi:" + sourceFlowFileIdentifier, + session.getProvenanceReporter().receive(flowFile, transitUri, "urn:nifi:" + sourceFlowFileIdentifier, "Remote DN=" + userDn, TimeUnit.NANOSECONDS.toMillis(receiveNanos)); session.transfer(flowFile, Relationship.ANONYMOUS); @@ -336,22 +332,22 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { // Confirm that what we received was the correct data. transaction.confirm(); - + // Commit the session so that we have persisted the data session.commit(); transaction.complete(); - if ( !flowFilesReceived.isEmpty() ) { + if (!flowFilesReceived.isEmpty()) { stopWatch.stop(); final String flowFileDescription = flowFilesReceived.size() < 20 ? flowFilesReceived.toString() : flowFilesReceived.size() + " FlowFiles"; final String uploadDataRate = stopWatch.calculateDataRate(bytesReceived); final long uploadMillis = stopWatch.getDuration(TimeUnit.MILLISECONDS); final String dataSize = FormatUtils.formatDataSize(bytesReceived); - logger.info("{} Successfully receveied {} ({}) from {} in {} milliseconds at a rate of {}", new Object[] { - this, flowFileDescription, dataSize, transaction.getCommunicant().getUrl(), uploadMillis, uploadDataRate }); + logger.info("{} Successfully receveied {} ({}) from {} in {} milliseconds at a rate of {}", new Object[]{ + this, flowFileDescription, dataSize, transaction.getCommunicant().getUrl(), uploadMillis, uploadDataRate}); } - + return flowFilesReceived.size(); } @@ -371,44 +367,44 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { ValidationResult error = null; if (!targetExists.get()) { error = new ValidationResult.Builder() - .explanation(String.format("Remote instance indicates that port '%s' no longer exists.", getName())) - .subject(String.format("Remote port '%s'", getName())) - .valid(false) - .build(); - } else if ( getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty() ) { + .explanation(String.format("Remote instance indicates that port '%s' no longer exists.", getName())) + .subject(String.format("Remote port '%s'", getName())) + .valid(false) + .build(); + } else if (getConnectableType() == ConnectableType.REMOTE_OUTPUT_PORT && getConnections(Relationship.ANONYMOUS).isEmpty()) { error = new ValidationResult.Builder() - .explanation(String.format("Port '%s' has no outbound connections", getName())) - .subject(String.format("Remote port '%s'", getName())) - .valid(false) - .build(); + .explanation(String.format("Port '%s' has no outbound connections", getName())) + .subject(String.format("Remote port '%s'", getName())) + .valid(false) + .build(); } - - if ( error != null ) { + + if (error != null) { validationErrors.add(error); } - + return validationErrors; } - + @Override public void verifyCanStart() { super.verifyCanStart(); - - if ( getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty() ) { + + if (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT && getIncomingConnections().isEmpty()) { throw new IllegalStateException("Port " + getName() + " has no incoming connections"); } } - + @Override public void setUseCompression(final boolean useCompression) { this.useCompression.set(useCompression); } - + @Override public boolean isUseCompression() { return useCompression.get(); } - + @Override public String toString() { return "RemoteGroupPort[name=" + getName() + ",target=" + remoteGroup.getTargetUri().toString() + "]"; @@ -418,34 +414,32 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { public RemoteProcessGroup getRemoteProcessGroup() { return remoteGroup; } - + @Override public TransferDirection getTransferDirection() { return (getConnectableType() == ConnectableType.REMOTE_INPUT_PORT) ? TransferDirection.SEND : TransferDirection.RECEIVE; } - + public void setTargetExists(final boolean exists) { this.targetExists.set(exists); } - + @Override public void removeConnection(final Connection connection) throws IllegalArgumentException, IllegalStateException { super.removeConnection(connection); - - // If the Port no longer exists on the remote instance and this is the last Connection, tell + + // If the Port no longer exists on the remote instance and this is the last Connection, tell // RemoteProcessGroup to remove me - if ( !getTargetExists() && !hasIncomingConnection() && getConnections().isEmpty() ) { + if (!getTargetExists() && !hasIncomingConnection() && getConnections().isEmpty()) { remoteGroup.removeNonExistentPort(this); } } - - + @Override public SchedulingStrategy getSchedulingStrategy() { return SchedulingStrategy.TIMER_DRIVEN; } - - + @Override public boolean isSideEffectFree() { return false; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java index 021531fec2..67f28d24d2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRootGroupPort.java @@ -68,10 +68,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class StandardRootGroupPort extends AbstractPort implements RootGroupPort { + private static final String CATEGORY = "Site to Site"; - + private static final Logger logger = LoggerFactory.getLogger(StandardRootGroupPort.class); - + private final AtomicReference> groupAccessControl = new AtomicReference>(new HashSet()); private final AtomicReference> userAccessControl = new AtomicReference>(new HashSet()); private final ProcessScheduler processScheduler; @@ -82,18 +83,18 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort private final EventReporter eventReporter; private final ProcessScheduler scheduler; private final Set relationships; - + private final BlockingQueue requestQueue = new ArrayBlockingQueue<>(1000); - + private final Set activeRequests = new HashSet<>(); private final Lock requestLock = new ReentrantLock(); private boolean shutdown = false; // guarded by requestLock - public StandardRootGroupPort(final String id, final String name, final ProcessGroup processGroup, + public StandardRootGroupPort(final String id, final String name, final ProcessGroup processGroup, final TransferDirection direction, final ConnectableType type, final UserService userService, final BulletinRepository bulletinRepository, final ProcessScheduler scheduler, final boolean secure) { super(id, name, processGroup, type, scheduler); - + this.processScheduler = scheduler; setScheduldingPeriod(MINIMUM_SCHEDULING_NANOS + " nanos"); this.userService = userService; @@ -110,20 +111,20 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort bulletinRepository.addBulletin(BulletinFactory.createBulletin(groupId, sourceId, sourceName, category, severity.name(), message)); } }; - + relationships = direction == TransferDirection.RECEIVE ? Collections.singleton(AbstractPort.PORT_RELATIONSHIP) : Collections.emptySet(); } - + @Override public Collection getRelationships() { - return relationships; + return relationships; } - + @Override public boolean isTriggerWhenEmpty() { return true; } - + @Override public void onTrigger(final ProcessContext context, final ProcessSessionFactory sessionFactory) { final FlowFileRequest flowFileRequest; @@ -132,29 +133,29 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } catch (final InterruptedException ie) { return; } - - if ( flowFileRequest == null ) { + + if (flowFileRequest == null) { return; } flowFileRequest.setServiceBegin(); - + requestLock.lock(); try { - if ( shutdown ) { + if (shutdown) { final CommunicationsSession commsSession = flowFileRequest.getPeer().getCommunicationsSession(); - if ( commsSession != null ) { + if (commsSession != null) { commsSession.interrupt(); } } - + activeRequests.add(flowFileRequest); } finally { requestLock.unlock(); } - + final ProcessSession session = sessionFactory.createSession(); - + try { onTrigger(context, session, flowFileRequest); // we leave the session open, because we send it back to the caller of #receiveFlowFile or #transmitFlowFile, @@ -162,11 +163,11 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } catch (final TransmissionDisabledException e) { session.rollback(); } catch (final Exception e) { - logger.error("{} Failed to process data due to {}", new Object[] {this, e}); - if ( logger.isDebugEnabled() ) { + logger.error("{} Failed to process data due to {}", new Object[]{this, e}); + if (logger.isDebugEnabled()) { logger.error("", e); } - + session.rollback(); } finally { requestLock.lock(); @@ -177,50 +178,50 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } } } - + @Override public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException { // nothing to do here -- we will never get called because we override onTrigger(ProcessContext, ProcessSessionFactory) } - + private void onTrigger(final ProcessContext context, final ProcessSession session, final FlowFileRequest flowFileRequest) { final ServerProtocol protocol = flowFileRequest.getProtocol(); final BlockingQueue responseQueue = flowFileRequest.getResponseQueue(); - if ( flowFileRequest.isExpired() ) { + if (flowFileRequest.isExpired()) { final String message = String.format("%s Cannot service request from %s because the request has timed out", this, flowFileRequest.getPeer()); logger.warn(message); eventReporter.reportEvent(Severity.WARNING, CATEGORY, message); - + responseQueue.add(new ProcessingResult(new RequestExpiredException())); return; } - + final Peer peer = flowFileRequest.getPeer(); final CommunicationsSession commsSession = peer.getCommunicationsSession(); final String sourceDn = commsSession.getUserDn(); logger.debug("{} Servicing request for {} (DN={})", this, peer, sourceDn); - + final PortAuthorizationResult authorizationResult = checkUserAuthorization(sourceDn); - if ( !authorizationResult.isAuthorized() ) { - final String message = String.format("%s Cannot service request from %s (DN=%s) because peer is not authorized to communicate with this port: %s", - this, flowFileRequest.getPeer(), flowFileRequest.getPeer().getCommunicationsSession().getUserDn(), authorizationResult.getExplanation()); + if (!authorizationResult.isAuthorized()) { + final String message = String.format("%s Cannot service request from %s (DN=%s) because peer is not authorized to communicate with this port: %s", + this, flowFileRequest.getPeer(), flowFileRequest.getPeer().getCommunicationsSession().getUserDn(), authorizationResult.getExplanation()); logger.error(message); eventReporter.reportEvent(Severity.ERROR, CATEGORY, message); - + responseQueue.add(new ProcessingResult(new NotAuthorizedException(authorizationResult.getExplanation()))); return; } final FlowFileCodec codec = protocol.getPreNegotiatedCodec(); - if ( codec == null ) { + if (codec == null) { responseQueue.add(new ProcessingResult(new BadRequestException("None of the supported FlowFile Codecs supplied is compatible with this instance"))); return; } final int transferCount; - + try { - if ( getConnectableType() == ConnectableType.INPUT_PORT ) { + if (getConnectableType() == ConnectableType.INPUT_PORT) { transferCount = receiveFlowFiles(context, session, codec, flowFileRequest); } else { transferCount = transferFlowFiles(context, session, codec, flowFileRequest); @@ -233,58 +234,55 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } catch (final Exception e) { session.rollback(); responseQueue.add(new ProcessingResult(e)); - + return; } - + session.commit(); responseQueue.add(new ProcessingResult(transferCount)); } - private int transferFlowFiles(final ProcessContext context, final ProcessSession session, final FlowFileCodec codec, final FlowFileRequest request) throws IOException, ProtocolException { return request.getProtocol().transferFlowFiles(request.getPeer(), context, session, codec); } - private int receiveFlowFiles(final ProcessContext context, final ProcessSession session, final FlowFileCodec codec, final FlowFileRequest receiveRequest) throws IOException, ProtocolException { return receiveRequest.getProtocol().receiveFlowFiles(receiveRequest.getPeer(), context, session, codec); } - + @Override public boolean isValid() { return (getConnectableType() == ConnectableType.INPUT_PORT) ? !getConnections(Relationship.ANONYMOUS).isEmpty() : true; } - + @Override public Collection getValidationErrors() { final Collection validationErrors = new ArrayList<>(); if (!isValid()) { final ValidationResult error = new ValidationResult.Builder() - .explanation(String.format("Output connection for port '%s' is not defined.", getName())) - .subject(String.format("Port '%s'", getName())) - .valid(false) - .build(); + .explanation(String.format("Output connection for port '%s' is not defined.", getName())) + .subject(String.format("Port '%s'", getName())) + .valid(false) + .build(); validationErrors.add(error); } return validationErrors; } - - + @Override public boolean isTransmitting() { - if ( !isRunning() ) { + if (!isRunning()) { return false; } - - if ( processScheduler.getActiveThreadCount(this) > 0 ) { + + if (processScheduler.getActiveThreadCount(this) > 0) { return true; } - - if ( requestQueue.isEmpty() ) { + + if (requestQueue.isEmpty()) { return false; } - + requestLock.lock(); try { return !activeRequests.isEmpty(); @@ -316,14 +314,14 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort @Override public void shutdown() { super.shutdown(); - + requestLock.lock(); try { this.shutdown = true; - - for ( final FlowFileRequest request : activeRequests ) { + + for (final FlowFileRequest request : activeRequests) { final CommunicationsSession commsSession = request.getPeer().getCommunicationsSession(); - if ( commsSession != null ) { + if (commsSession != null) { commsSession.interrupt(); } } @@ -331,11 +329,11 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort requestLock.unlock(); } } - + @Override public void onSchedulingStart() { super.onSchedulingStart(); - + requestLock.lock(); try { shutdown = false; @@ -343,14 +341,14 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort requestLock.unlock(); } } - + @Override public PortAuthorizationResult checkUserAuthorization(final String dn) { - if ( !secure ) { + if (!secure) { return new StandardPortAuthorizationResult(true, "Site-to-Site is not Secure"); } - if ( dn == null ) { + if (dn == null) { final String message = String.format("%s authorization failed for user %s because the DN is unknown", this, dn); logger.warn(message); eventReporter.reportEvent(Severity.WARNING, CATEGORY, message); @@ -359,9 +357,9 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort try { final NiFiUser user = userService.checkAuthorization(dn); - + final Set authorities = user.getAuthorities(); - if ( !authorities.contains(Authority.ROLE_NIFI) ) { + if (!authorities.contains(Authority.ROLE_NIFI)) { final String message = String.format("%s authorization failed for user %s because the user does not have Role NiFi", this, dn); logger.warn(message); eventReporter.reportEvent(Severity.WARNING, CATEGORY, message); @@ -369,12 +367,12 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } final Set allowedUsers = userAccessControl.get(); - if ( allowedUsers.contains(dn) ) { + if (allowedUsers.contains(dn)) { return new StandardPortAuthorizationResult(true, "User is Authorized"); } final String userGroup = user.getUserGroup(); - if ( userGroup == null ) { + if (userGroup == null) { final String message = String.format("%s authorization failed for user %s because the user does not have a group and is not in the set of Allowed Users for this Port", this, dn); logger.warn(message); eventReporter.reportEvent(Severity.WARNING, CATEGORY, message); @@ -383,13 +381,14 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort final Set allowedGroups = groupAccessControl.get(); final boolean allowed = allowedGroups.contains(userGroup); - if ( !allowed ) { - final String message = String.format("%s authorization failed for user %s because the user is not in the set of Allowed Users, and the user's group is not in the set of Allowed Groups for this Port", this, dn); + if (!allowed) { + final String message = String.format("%s authorization failed for user %s because the user " + + "is not in the set of Allowed Users, and the user's group is not in the set of Allowed Groups for this Port", this, dn); logger.warn(message); eventReporter.reportEvent(Severity.WARNING, CATEGORY, message); return new StandardPortAuthorizationResult(false, "User is not Authorized to communicate with " + this.toString()); } - + return new StandardPortAuthorizationResult(true, "User is part of group '" + userGroup + "', which is Authorized to communicate with " + this.toString()); } catch (final AccountNotFoundException anfe) { final String message = String.format("%s authorization failed for user %s because the DN is unknown", this, dn); @@ -418,145 +417,145 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort return new StandardPortAuthorizationResult(false, "Authorization failed because " + e); } } - + public static class StandardPortAuthorizationResult implements PortAuthorizationResult { + private final boolean isAuthorized; private final String explanation; - + public StandardPortAuthorizationResult(final boolean isAuthorized, final String explanation) { this.isAuthorized = isAuthorized; this.explanation = explanation; } - + @Override public boolean isAuthorized() { return isAuthorized; } - + @Override public String getExplanation() { return explanation; } } - - + private static class ProcessingResult { + private final int fileCount; private final Exception problem; - + public ProcessingResult(final int fileCount) { this.fileCount = fileCount; this.problem = null; } - + public ProcessingResult(final Exception problem) { this.fileCount = 0; this.problem = problem; } - + public Exception getProblem() { return problem; } - + public int getFileCount() { return fileCount; } } - - private static class FlowFileRequest { + private final Peer peer; private final ServerProtocol protocol; private final BlockingQueue queue; private final long creationTime; private final AtomicBoolean beingServiced = new AtomicBoolean(false); - + public FlowFileRequest(final Peer peer, final ServerProtocol protocol) { this.creationTime = System.currentTimeMillis(); this.peer = peer; this.protocol = protocol; this.queue = new ArrayBlockingQueue<>(1); } - - + public void setServiceBegin() { this.beingServiced.set(true); } - + public boolean isBeingServiced() { return beingServiced.get(); } - + public BlockingQueue getResponseQueue() { return queue; } - + public Peer getPeer() { return peer; } - + public ServerProtocol getProtocol() { return protocol; } - + public boolean isExpired() { // use double the protocol's expiration because the sender may send data for a bit before // the timeout starts being counted, and we don't want to timeout before the sender does. // is this a good idea...??? long expiration = protocol.getRequestExpiration() * 2; - if ( expiration <= 0L ) { + if (expiration <= 0L) { return false; } - + if (expiration < 500L) { expiration = 500L; } - + return System.currentTimeMillis() > creationTime + expiration; } } - @Override - public int receiveFlowFiles(final Peer peer, final ServerProtocol serverProtocol, final Map requestHeaders) throws NotAuthorizedException, BadRequestException, RequestExpiredException { - if ( getConnectableType() != ConnectableType.INPUT_PORT ) { + public int receiveFlowFiles(final Peer peer, final ServerProtocol serverProtocol, final Map requestHeaders) + throws NotAuthorizedException, BadRequestException, RequestExpiredException { + if (getConnectableType() != ConnectableType.INPUT_PORT) { throw new IllegalStateException("Cannot receive FlowFiles because this port is not an Input Port"); } - if ( !this.isRunning() ) { + if (!this.isRunning()) { throw new IllegalStateException("Port not running"); } - + try { final FlowFileRequest request = new FlowFileRequest(peer, serverProtocol); - if ( !this.requestQueue.offer(request) ) { + if (!this.requestQueue.offer(request)) { throw new RequestExpiredException(); } - + // Trigger this port to run. scheduler.registerEvent(this); - + // Get a response from the response queue but don't wait forever if the port is stopped ProcessingResult result = null; - + // wait for the request to start getting serviced... and time out if it doesn't happen // before the request expires - while ( !request.isBeingServiced() ) { - if ( request.isExpired() ) { + while (!request.isBeingServiced()) { + if (request.isExpired()) { throw new SocketTimeoutException("Read timed out"); } else { try { Thread.sleep(100L); - } catch (final InterruptedException e) {} + } catch (final InterruptedException e) { + } } } // we've started to service the request. Now just wait until it's finished result = request.getResponseQueue().take(); - + final Exception problem = result.getProblem(); - if ( problem == null ) { + if (problem == null) { return result.getFileCount(); } else { throw problem; @@ -571,44 +570,46 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort } @Override - public int transferFlowFiles(final Peer peer, final ServerProtocol serverProtocol, final Map requestHeaders) throws NotAuthorizedException, BadRequestException, RequestExpiredException { - if ( getConnectableType() != ConnectableType.OUTPUT_PORT ) { + public int transferFlowFiles(final Peer peer, final ServerProtocol serverProtocol, final Map requestHeaders) + throws NotAuthorizedException, BadRequestException, RequestExpiredException { + if (getConnectableType() != ConnectableType.OUTPUT_PORT) { throw new IllegalStateException("Cannot send FlowFiles because this port is not an Output Port"); } - - if ( !this.isRunning() ) { + + if (!this.isRunning()) { throw new IllegalStateException("Port not running"); } try { final FlowFileRequest request = new FlowFileRequest(peer, serverProtocol); - if ( !this.requestQueue.offer(request) ) { + if (!this.requestQueue.offer(request)) { throw new RequestExpiredException(); } // Trigger this port to run scheduler.registerEvent(this); - + // Get a response from the response queue but don't wait forever if the port is stopped ProcessingResult result = null; - + // wait for the request to start getting serviced... and time out if it doesn't happen // before the request expires - while ( !request.isBeingServiced() ) { - if ( request.isExpired() ) { + while (!request.isBeingServiced()) { + if (request.isExpired()) { throw new SocketTimeoutException("Read timed out"); - } else { + } else { try { Thread.sleep(100L); - } catch (final InterruptedException e) {} + } catch (final InterruptedException e) { + } } } // we've started to service the request. Now just wait until it's finished result = request.getResponseQueue().take(); - + final Exception problem = result.getProblem(); - if ( problem == null ) { + if (problem == null) { return result.getFileCount(); } else { throw problem; @@ -621,12 +622,12 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort throw new ProcessException(e); } } - + @Override public SchedulingStrategy getSchedulingStrategy() { return SchedulingStrategy.TIMER_DRIVEN; } - + @Override public boolean isSideEffectFree() { return false; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/exception/UnsupportedCodecException.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/exception/UnsupportedCodecException.java index 926809ca31..4a4f96b151 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/exception/UnsupportedCodecException.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/exception/UnsupportedCodecException.java @@ -19,9 +19,10 @@ package org.apache.nifi.remote.exception; import org.apache.nifi.remote.codec.FlowFileCodec; public class UnsupportedCodecException extends RuntimeException { - private static final long serialVersionUID = 198234789237L; - public UnsupportedCodecException(final String codecName) { + private static final long serialVersionUID = 198234789237L; + + public UnsupportedCodecException(final String codecName) { super("Codec " + codecName + " is not supported"); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/ClusterManagerServerProtocol.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/ClusterManagerServerProtocol.java index 391d52b55d..7d0ffab4b2 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/ClusterManagerServerProtocol.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/ClusterManagerServerProtocol.java @@ -40,12 +40,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ClusterManagerServerProtocol implements ServerProtocol { + public static final String RESOURCE_NAME = "SocketFlowFileProtocol"; private final VersionNegotiator versionNegotiator = new StandardVersionNegotiator(1); private final Logger logger = LoggerFactory.getLogger(ClusterManagerServerProtocol.class); private NodeInformant nodeInformant; - + private String commsIdentifier; private boolean shutdown = false; private boolean handshakeCompleted = false; @@ -53,52 +54,51 @@ public class ClusterManagerServerProtocol implements ServerProtocol { public ClusterManagerServerProtocol() { } - - + @Override public void setNodeInformant(final NodeInformant nodeInformant) { this.nodeInformant = nodeInformant; } - + @Override public void handshake(final Peer peer) throws IOException, HandshakeException { - if ( handshakeCompleted ) { + if (handshakeCompleted) { throw new IllegalStateException("Handshake has already been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } final CommunicationsSession commsSession = peer.getCommunicationsSession(); final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream()); final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); - + // read communications identifier commsIdentifier = dis.readUTF(); - + // read all of the properties. we don't really care what the properties are. final int numProperties = dis.readInt(); - for (int i=0; i < numProperties; i++) { + for (int i = 0; i < numProperties; i++) { final String propertyName = dis.readUTF(); final String propertyValue = dis.readUTF(); - + final HandshakeProperty property; try { property = HandshakeProperty.valueOf(propertyName); - if ( HandshakeProperty.REQUEST_EXPIRATION_MILLIS.equals(property) ) { + if (HandshakeProperty.REQUEST_EXPIRATION_MILLIS.equals(property)) { requestExpirationMillis = Long.parseLong(propertyValue); } } catch (final Exception e) { } } - + // send "OK" response ResponseCode.PROPERTIES_OK.writeResponse(dos); - + logger.debug("Successfully completed handshake with {}; CommsID={}", peer, commsIdentifier); handshakeCompleted = true; } - + @Override public boolean isHandshakeSuccessful() { return handshakeCompleted; @@ -106,10 +106,10 @@ public class ClusterManagerServerProtocol implements ServerProtocol { @Override public void sendPeerList(final Peer peer) throws IOException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } @@ -118,29 +118,29 @@ public class ClusterManagerServerProtocol implements ServerProtocol { final ClusterNodeInformation clusterNodeInfo = nodeInformant.getNodeInformation(); final Collection nodeInfos = clusterNodeInfo.getNodeInformation(); - + // determine how many nodes have Site-to-site enabled int numPeers = 0; - for ( final NodeInformation nodeInfo : nodeInfos ) { + for (final NodeInformation nodeInfo : nodeInfos) { if (nodeInfo.getSiteToSitePort() != null) { numPeers++; } } - + dos.writeInt(numPeers); - for ( final NodeInformation nodeInfo : nodeInfos ) { - if ( nodeInfo.getSiteToSitePort() == null ) { + for (final NodeInformation nodeInfo : nodeInfos) { + if (nodeInfo.getSiteToSitePort() == null) { continue; } - + dos.writeUTF(nodeInfo.getHostname()); dos.writeInt(nodeInfo.getSiteToSitePort()); dos.writeBoolean(nodeInfo.isSiteToSiteSecure()); dos.writeInt(nodeInfo.getTotalFlowFiles()); } - + logger.info("Redirected {} to {} nodes", peer, numPeers); - + dos.flush(); } @@ -153,7 +153,7 @@ public class ClusterManagerServerProtocol implements ServerProtocol { public boolean isShutdown() { return shutdown; } - + @Override public FlowFileCodec negotiateCodec(Peer peer) { throw new UnsupportedOperationException(); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/SocketFlowFileServerProtocol.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/SocketFlowFileServerProtocol.java index 21de646169..b931e26580 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/SocketFlowFileServerProtocol.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/socket/SocketFlowFileServerProtocol.java @@ -65,43 +65,42 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SocketFlowFileServerProtocol implements ServerProtocol { + public static final String RESOURCE_NAME = "SocketFlowFileProtocol"; - + private ProcessGroup rootGroup; private String commsIdentifier; private boolean handshakeCompleted; - + private Boolean useGzip; private long requestExpirationMillis; private RootGroupPort port; private boolean shutdown = false; private FlowFileCodec negotiatedFlowFileCodec = null; private String transitUriPrefix = null; - + private int requestedBatchCount = 0; private long requestedBatchBytes = 0L; private long requestedBatchNanos = 0L; private static final long DEFAULT_BATCH_NANOS = TimeUnit.SECONDS.toNanos(5L); - + private final VersionNegotiator versionNegotiator = new StandardVersionNegotiator(5, 4, 3, 2, 1); private final Logger logger = LoggerFactory.getLogger(SocketFlowFileServerProtocol.class); - - @Override public void setRootProcessGroup(final ProcessGroup group) { - if ( !group.isRootGroup() ) { + if (!group.isRootGroup()) { throw new IllegalArgumentException(); } this.rootGroup = group; } - + @Override public void handshake(final Peer peer) throws IOException, HandshakeException { - if ( handshakeCompleted ) { + if (handshakeCompleted) { throw new IllegalStateException("Handshake has already been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } @@ -109,30 +108,30 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { final CommunicationsSession commsSession = peer.getCommunicationsSession(); final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream()); final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); - + commsIdentifier = dis.readUTF(); - - if ( versionNegotiator.getVersion() >= 3 ) { + + if (versionNegotiator.getVersion() >= 3) { transitUriPrefix = dis.readUTF(); - if ( !transitUriPrefix.endsWith("/") ) { + if (!transitUriPrefix.endsWith("/")) { transitUriPrefix = transitUriPrefix + "/"; } } - + final Map properties = new HashMap<>(); final int numProperties = dis.readInt(); - for (int i=0; i < numProperties; i++) { + for (int i = 0; i < numProperties; i++) { final String propertyName = dis.readUTF(); final String propertyValue = dis.readUTF(); properties.put(propertyName, propertyValue); } - + // evaluate the properties received boolean responseWritten = false; - for ( final Map.Entry entry : properties.entrySet() ) { + for (final Map.Entry entry : properties.entrySet()) { final String propertyName = entry.getKey(); final String value = entry.getValue(); - + final HandshakeProperty property; try { property = HandshakeProperty.valueOf(propertyName); @@ -140,7 +139,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { ResponseCode.UNKNOWN_PROPERTY_NAME.writeResponse(dos, "Unknown Property Name: " + propertyName); throw new HandshakeException("Received unknown property: " + propertyName); } - + try { switch (property) { case GZIP: { @@ -152,66 +151,66 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { break; case BATCH_COUNT: requestedBatchCount = Integer.parseInt(value); - if ( requestedBatchCount < 0 ) { + if (requestedBatchCount < 0) { throw new HandshakeException("Cannot request Batch Count less than 1; requested value: " + value); } break; case BATCH_SIZE: requestedBatchBytes = Long.parseLong(value); - if ( requestedBatchBytes < 0 ) { + if (requestedBatchBytes < 0) { throw new HandshakeException("Cannot request Batch Size less than 1; requested value: " + value); } break; case BATCH_DURATION: requestedBatchNanos = TimeUnit.MILLISECONDS.toNanos(Long.parseLong(value)); - if ( requestedBatchNanos < 0 ) { + if (requestedBatchNanos < 0) { throw new HandshakeException("Cannot request Batch Duration less than 1; requested value: " + value); } break; case PORT_IDENTIFIER: { Port receivedPort = rootGroup.getInputPort(value); - if ( receivedPort == null ) { + if (receivedPort == null) { receivedPort = rootGroup.getOutputPort(value); } - if ( receivedPort == null ) { + if (receivedPort == null) { logger.debug("Responding with ResponseCode UNKNOWN_PORT for identifier {}", value); ResponseCode.UNKNOWN_PORT.writeResponse(dos); throw new HandshakeException("Received unknown port identifier: " + value); } - if ( !(receivedPort instanceof RootGroupPort) ) { + if (!(receivedPort instanceof RootGroupPort)) { logger.debug("Responding with ResponseCode UNKNOWN_PORT for identifier {}", value); ResponseCode.UNKNOWN_PORT.writeResponse(dos); throw new HandshakeException("Received port identifier " + value + ", but this Port is not a RootGroupPort"); } - + this.port = (RootGroupPort) receivedPort; final PortAuthorizationResult portAuthResult = this.port.checkUserAuthorization(peer.getCommunicationsSession().getUserDn()); - if ( !portAuthResult.isAuthorized() ) { + if (!portAuthResult.isAuthorized()) { logger.debug("Responding with ResponseCode UNAUTHORIZED: ", portAuthResult.getExplanation()); ResponseCode.UNAUTHORIZED.writeResponse(dos, portAuthResult.getExplanation()); responseWritten = true; break; } - - if ( !receivedPort.isValid() ) { + + if (!receivedPort.isValid()) { logger.debug("Responding with ResponseCode PORT_NOT_IN_VALID_STATE for {}", receivedPort); ResponseCode.PORT_NOT_IN_VALID_STATE.writeResponse(dos, "Port is not valid"); responseWritten = true; break; } - - if ( !receivedPort.isRunning() ) { + + if (!receivedPort.isRunning()) { logger.debug("Responding with ResponseCode PORT_NOT_IN_VALID_STATE for {}", receivedPort); ResponseCode.PORT_NOT_IN_VALID_STATE.writeResponse(dos, "Port not running"); responseWritten = true; break; } - + // PORTS_DESTINATION_FULL was introduced in version 2. If version 1, just ignore this // we we will simply not service the request but the sender will timeout - if ( getVersionNegotiator().getVersion() > 1 ) { - for ( final Connection connection : port.getConnections() ) { - if ( connection.getFlowFileQueue().isFull() ) { + if (getVersionNegotiator().getVersion() > 1) { + for (final Connection connection : port.getConnections()) { + if (connection.getFlowFileQueue().isFull()) { logger.debug("Responding with ResponseCode PORTS_DESTINATION_FULL for {}", receivedPort); ResponseCode.PORTS_DESTINATION_FULL.writeResponse(dos); responseWritten = true; @@ -219,7 +218,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { } } } - + break; } } @@ -227,54 +226,54 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { throw new HandshakeException("Received invalid value for property '" + property + "'; invalid value: " + value); } } - - if ( useGzip == null ) { + + if (useGzip == null) { logger.debug("Responding with ResponseCode MISSING_PROPERTY because GZIP Property missing"); ResponseCode.MISSING_PROPERTY.writeResponse(dos, HandshakeProperty.GZIP.name()); throw new HandshakeException("Missing Property " + HandshakeProperty.GZIP.name()); } - + // send "OK" response - if ( !responseWritten ) { + if (!responseWritten) { ResponseCode.PROPERTIES_OK.writeResponse(dos); } - + logger.debug("{} Finished handshake with {}", this, peer); handshakeCompleted = true; } - + @Override public boolean isHandshakeSuccessful() { return handshakeCompleted; } - + @Override public RootGroupPort getPort() { return port; } - + @Override public FlowFileCodec negotiateCodec(final Peer peer) throws IOException, ProtocolException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } - logger.debug("{} Negotiating Codec with {} using {}", new Object[] {this, peer, peer.getCommunicationsSession()}); + logger.debug("{} Negotiating Codec with {} using {}", new Object[]{this, peer, peer.getCommunicationsSession()}); final CommunicationsSession commsSession = peer.getCommunicationsSession(); final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream()); final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); - - if ( port == null ) { - RemoteResourceFactory.rejectCodecNegotiation(dis, dos, "Cannot transfer FlowFiles because no port was specified"); + + if (port == null) { + RemoteResourceFactory.rejectCodecNegotiation(dis, dos, "Cannot transfer FlowFiles because no port was specified"); } - + // Negotiate the FlowFileCodec to use. try { negotiatedFlowFileCodec = RemoteResourceFactory.receiveCodecNegotiation(dis, dos); - logger.debug("{} Negotiated Codec {} with {}", new Object[] {this, negotiatedFlowFileCodec, peer}); + logger.debug("{} Negotiated Codec {} with {}", new Object[]{this, negotiatedFlowFileCodec, peer}); return negotiatedFlowFileCodec; } catch (final HandshakeException e) { throw new ProtocolException(e.toString()); @@ -286,13 +285,12 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { return negotiatedFlowFileCodec; } - @Override public int transferFlowFiles(final Peer peer, final ProcessContext context, final ProcessSession session, final FlowFileCodec codec) throws IOException, ProtocolException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } @@ -301,22 +299,22 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream()); final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); String remoteDn = commsSession.getUserDn(); - if ( remoteDn == null ) { + if (remoteDn == null) { remoteDn = "none"; } FlowFile flowFile = session.get(); - if ( flowFile == null ) { + if (flowFile == null) { // we have no data to send. Notify the peer. logger.debug("{} No data to send to {}", this, peer); ResponseCode.NO_MORE_DATA.writeResponse(dos); return 0; } - + // we have data to send. logger.debug("{} Data is available to send to {}", this, peer); ResponseCode.MORE_DATA.writeResponse(dos); - + final StopWatch stopWatch = new StopWatch(true); long bytesSent = 0L; final Set flowFilesSent = new HashSet<>(); @@ -328,27 +326,27 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { String calculatedCRC = ""; while (continueTransaction) { final OutputStream flowFileOutputStream = useGzip ? new CompressionOutputStream(dos) : dos; - logger.debug("{} Sending {} to {}", new Object[] {this, flowFile, peer}); - + logger.debug("{} Sending {} to {}", new Object[]{this, flowFile, peer}); + final CheckedOutputStream checkedOutputStream = new CheckedOutputStream(flowFileOutputStream, crc); final StopWatch transferWatch = new StopWatch(true); - + final FlowFile toSend = flowFile; session.read(flowFile, new InputStreamCallback() { - @Override - public void process(final InputStream in) throws IOException { - final DataPacket dataPacket = new StandardDataPacket(toSend.getAttributes(), in, toSend.getSize()); - codec.encode(dataPacket, checkedOutputStream); - } + @Override + public void process(final InputStream in) throws IOException { + final DataPacket dataPacket = new StandardDataPacket(toSend.getAttributes(), in, toSend.getSize()); + codec.encode(dataPacket, checkedOutputStream); + } }); - + final long transmissionMillis = transferWatch.getElapsed(TimeUnit.MILLISECONDS); - + // need to close the CompressionOutputStream in order to force it write out any remaining bytes. // Otherwise, do NOT close it because we don't want to close the underlying stream // (CompressionOutputStream will not close the underlying stream when it's closed) - if ( useGzip ) { + if (useGzip) { checkedOutputStream.close(); } @@ -358,33 +356,33 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { final String transitUri = (transitUriPrefix == null) ? peer.getUrl() : transitUriPrefix + flowFile.getAttribute(CoreAttributes.UUID.key()); session.getProvenanceReporter().send(flowFile, transitUri, "Remote Host=" + peer.getHost() + ", Remote DN=" + remoteDn, transmissionMillis, false); session.remove(flowFile); - + // determine if we should check for more data on queue. final long sendingNanos = System.nanoTime() - startNanos; boolean poll = true; - if ( sendingNanos >= requestedBatchNanos && requestedBatchNanos > 0L ) { + if (sendingNanos >= requestedBatchNanos && requestedBatchNanos > 0L) { poll = false; } - if ( bytesSent >= requestedBatchBytes && requestedBatchBytes > 0L ) { + if (bytesSent >= requestedBatchBytes && requestedBatchBytes > 0L) { poll = false; } - if ( flowFilesSent.size() >= requestedBatchCount && requestedBatchCount > 0 ) { + if (flowFilesSent.size() >= requestedBatchCount && requestedBatchCount > 0) { poll = false; } - - if ( requestedBatchNanos == 0 && requestedBatchBytes == 0 && requestedBatchCount == 0 ) { + + if (requestedBatchNanos == 0 && requestedBatchBytes == 0 && requestedBatchCount == 0) { poll = (sendingNanos < DEFAULT_BATCH_NANOS); } - - if ( poll ) { + + if (poll) { // we've not elapsed the requested sending duration, so get more data. flowFile = session.get(); } else { flowFile = null; } - + continueTransaction = (flowFile != null); - if ( continueTransaction ) { + if (continueTransaction) { logger.debug("{} Sending ContinueTransaction indicator to {}", this, peer); ResponseCode.CONTINUE_TRANSACTION.writeResponse(dos); } else { @@ -393,19 +391,21 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { calculatedCRC = String.valueOf(checkedOutputStream.getChecksum().getValue()); } } - + // we've sent a FINISH_TRANSACTION. Now we'll wait for the peer to send a 'Confirm Transaction' response final Response transactionConfirmationResponse = Response.read(dis); - if ( transactionConfirmationResponse.getCode() == ResponseCode.CONFIRM_TRANSACTION ) { + if (transactionConfirmationResponse.getCode() == ResponseCode.CONFIRM_TRANSACTION) { // Confirm Checksum and echo back the confirmation. logger.debug("{} Received {} from {}", this, transactionConfirmationResponse, peer); final String receivedCRC = transactionConfirmationResponse.getMessage(); - if ( versionNegotiator.getVersion() > 3 ) { - if ( !receivedCRC.equals(calculatedCRC) ) { + if (versionNegotiator.getVersion() > 3) { + if (!receivedCRC.equals(calculatedCRC)) { ResponseCode.BAD_CHECKSUM.writeResponse(dos); session.rollback(); - throw new IOException(this + " Sent data to peer " + peer + " but calculated CRC32 Checksum as " + calculatedCRC + " while peer calculated CRC32 Checksum as " + receivedCRC + "; canceling transaction and rolling back session"); + throw new IOException(this + " Sent data to peer " + peer + " but calculated CRC32 Checksum as " + + calculatedCRC + " while peer calculated CRC32 Checksum as " + receivedCRC + + "; canceling transaction and rolling back session"); } } @@ -415,61 +415,60 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { } final String flowFileDescription = flowFilesSent.size() < 20 ? flowFilesSent.toString() : flowFilesSent.size() + " FlowFiles"; - + final Response transactionResponse; try { transactionResponse = Response.read(dis); } catch (final IOException e) { - logger.error("{} Failed to receive a response from {} when expecting a TransactionFinished Indicator." + - " It is unknown whether or not the peer successfully received/processed the data." + - " Therefore, {} will be rolled back, possibly resulting in data duplication of {}", - this, peer, session, flowFileDescription); + logger.error("{} Failed to receive a response from {} when expecting a TransactionFinished Indicator." + + " It is unknown whether or not the peer successfully received/processed the data." + + " Therefore, {} will be rolled back, possibly resulting in data duplication of {}", + this, peer, session, flowFileDescription); session.rollback(); throw e; } - - logger.debug("{} received {} from {}", new Object[] {this, transactionResponse, peer}); - if ( transactionResponse.getCode() == ResponseCode.TRANSACTION_FINISHED_BUT_DESTINATION_FULL ) { + + logger.debug("{} received {} from {}", new Object[]{this, transactionResponse, peer}); + if (transactionResponse.getCode() == ResponseCode.TRANSACTION_FINISHED_BUT_DESTINATION_FULL) { peer.penalize(port.getIdentifier(), port.getYieldPeriod(TimeUnit.MILLISECONDS)); - } else if ( transactionResponse.getCode() != ResponseCode.TRANSACTION_FINISHED ) { + } else if (transactionResponse.getCode() != ResponseCode.TRANSACTION_FINISHED) { throw new ProtocolException("After sending data, expected TRANSACTION_FINISHED response but got " + transactionResponse); } - + session.commit(); - + stopWatch.stop(); final String uploadDataRate = stopWatch.calculateDataRate(bytesSent); final long uploadMillis = stopWatch.getDuration(TimeUnit.MILLISECONDS); final String dataSize = FormatUtils.formatDataSize(bytesSent); - logger.info("{} Successfully sent {} ({}) to {} in {} milliseconds at a rate of {}", new Object[] { + logger.info("{} Successfully sent {} ({}) to {} in {} milliseconds at a rate of {}", new Object[]{ this, flowFileDescription, dataSize, peer, uploadMillis, uploadDataRate}); return flowFilesSent.size(); } - - + @Override public int receiveFlowFiles(final Peer peer, final ProcessContext context, final ProcessSession session, final FlowFileCodec codec) throws IOException, ProtocolException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } logger.debug("{} receiving FlowFiles from {}", this, peer); - + final CommunicationsSession commsSession = peer.getCommunicationsSession(); final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream()); final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); String remoteDn = commsSession.getUserDn(); - if ( remoteDn == null ) { + if (remoteDn == null) { remoteDn = "none"; } final StopWatch stopWatch = new StopWatch(true); final CRC32 crc = new CRC32(); - + // Peer has data. Otherwise, we would not have been called, because they would not have sent // a SEND_FLOWFILES request to use. Just decode the bytes into FlowFiles until peer says he's // finished sending data. @@ -486,18 +485,19 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { FlowFile flowFile = session.create(); flowFile = session.importFrom(dataPacket.getData(), flowFile); flowFile = session.putAllAttributes(flowFile, dataPacket.getAttributes()); - + final long transferNanos = System.nanoTime() - startNanos; final long transferMillis = TimeUnit.MILLISECONDS.convert(transferNanos, TimeUnit.NANOSECONDS); final String sourceSystemFlowFileUuid = dataPacket.getAttributes().get(CoreAttributes.UUID.key()); flowFile = session.putAttribute(flowFile, CoreAttributes.UUID.key(), UUID.randomUUID().toString()); - + final String transitUri = (transitUriPrefix == null) ? peer.getUrl() : transitUriPrefix + sourceSystemFlowFileUuid; - session.getProvenanceReporter().receive(flowFile, transitUri, sourceSystemFlowFileUuid == null ? null : "urn:nifi:" + sourceSystemFlowFileUuid, "Remote Host=" + peer.getHost() + ", Remote DN=" + remoteDn, transferMillis); + session.getProvenanceReporter().receive(flowFile, transitUri, sourceSystemFlowFileUuid == null + ? null : "urn:nifi:" + sourceSystemFlowFileUuid, "Remote Host=" + peer.getHost() + ", Remote DN=" + remoteDn, transferMillis); session.transfer(flowFile, Relationship.ANONYMOUS); flowFilesReceived.add(flowFile); bytesReceived += flowFile.getSize(); - + final Response transactionResponse = Response.read(dis); switch (transactionResponse.getCode()) { case CONTINUE_TRANSACTION: @@ -516,7 +516,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { throw new ProtocolException("Received unexpected response from peer: when expecting Continue Transaction or Finish Transaction, received" + transactionResponse); } } - + // we received a FINISH_TRANSACTION indicator. Send back a CONFIRM_TRANSACTION message // to peer so that we can verify that the connection is still open. This is a two-phase commit, // which helps to prevent the chances of data duplication. Without doing this, we may commit the @@ -526,7 +526,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { // time window involved in the entire transaction, it is reduced to a simple round-trip conversation. logger.debug("{} Sending CONFIRM_TRANSACTION Response Code to {}", this, peer); ResponseCode.CONFIRM_TRANSACTION.writeResponse(dos, calculatedCRC); - + final Response confirmTransactionResponse = Response.read(dis); logger.debug("{} Received {} from {}", this, confirmTransactionResponse, peer); @@ -539,11 +539,11 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { default: throw new ProtocolException(this + " Received unexpected Response Code from peer " + peer + " : " + confirmTransactionResponse + "; expected 'Confirm Transaction' Response Code"); } - + // Commit the session so that we have persisted the data session.commit(); - - if ( context.getAvailableRelationships().isEmpty() ) { + + if (context.getAvailableRelationships().isEmpty()) { // Confirm that we received the data and the peer can now discard it but that the peer should not // send any more data for a bit logger.debug("{} Sending TRANSACTION_FINISHED_BUT_DESTINATION_FULL to {}", this, peer); @@ -553,30 +553,30 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { logger.debug("{} Sending TRANSACTION_FINISHED to {}", this, peer); ResponseCode.TRANSACTION_FINISHED.writeResponse(dos); } - + stopWatch.stop(); final String flowFileDescription = flowFilesReceived.size() < 20 ? flowFilesReceived.toString() : flowFilesReceived.size() + " FlowFiles"; final String uploadDataRate = stopWatch.calculateDataRate(bytesReceived); final long uploadMillis = stopWatch.getDuration(TimeUnit.MILLISECONDS); final String dataSize = FormatUtils.formatDataSize(bytesReceived); - logger.info("{} Successfully received {} ({}) from {} in {} milliseconds at a rate of {}", new Object[] { + logger.info("{} Successfully received {} ({}) from {} in {} milliseconds at a rate of {}", new Object[]{ this, flowFileDescription, dataSize, peer, uploadMillis, uploadDataRate}); return flowFilesReceived.size(); } - + @Override public RequestType getRequestType(final Peer peer) throws IOException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } - logger.debug("{} Reading Request Type from {} using {}", new Object[] {this, peer, peer.getCommunicationsSession()}); + logger.debug("{} Reading Request Type from {} using {}", new Object[]{this, peer, peer.getCommunicationsSession()}); final RequestType requestType = RequestType.readRequestType(new DataInputStream(peer.getCommunicationsSession().getInput().getInputStream())); - logger.debug("{} Got Request Type {} from {}", new Object[] {this, requestType, peer}); + logger.debug("{} Got Request Type {} from {}", new Object[]{this, requestType, peer}); return requestType; } @@ -599,10 +599,10 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { @Override public void sendPeerList(final Peer peer) throws IOException { - if ( !handshakeCompleted ) { + if (!handshakeCompleted) { throw new IllegalStateException("Handshake has not been completed"); } - if ( shutdown ) { + if (shutdown) { throw new IllegalStateException("Protocol is shutdown"); } @@ -611,7 +611,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream()); final NiFiProperties properties = NiFiProperties.getInstance(); - + // we have only 1 peer: ourselves. dos.writeInt(1); dos.writeUTF(InetAddress.getLocalHost().getHostName()); @@ -620,12 +620,12 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { dos.writeInt(0); // doesn't matter how many FlowFiles we have, because we're the only host. dos.flush(); } - + @Override public String getResourceName() { return RESOURCE_NAME; } - + @Override public void setNodeInformant(final NodeInformant nodeInformant) { } @@ -634,7 +634,7 @@ public class SocketFlowFileServerProtocol implements ServerProtocol { public long getRequestExpiration() { return requestExpirationMillis; } - + @Override public String toString() { return "SocketFlowFileServerProtocol[CommsID=" + commsIdentifier + "]"; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardSiteToSiteProtocol.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardSiteToSiteProtocol.java index b9a567b160..8380f8b10c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardSiteToSiteProtocol.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/TestStandardSiteToSiteProtocol.java @@ -39,13 +39,13 @@ package org.apache.nifi.remote; // final Map destinationMap = new LinkedHashMap<>(); // final NodeInformation node1 = new NodeInformation("hostA", 80, 90, true, 3); // final NodeInformation node2 = new NodeInformation("hostB", 80, 90, true, 500); -// +// // final Destination node1Destination = new Destination(createRemoteGroupPort("PortA"), null, node1, TransferDirection.SEND, true, null); // final Destination node2Destination = new Destination(createRemoteGroupPort("PortB"), null, node2, TransferDirection.SEND, true, null); -// +// // destinationMap.put(node1, node1Destination); // destinationMap.put(node2, node2Destination); -// +// // final List destinations = StandardSiteToSiteProtocol.formulateDestinationList(destinationMap, TransferDirection.SEND); // int node1Count = 0, node2Count = 0; // for ( final Destination destination : destinations ) { @@ -57,30 +57,30 @@ package org.apache.nifi.remote; // Assert.fail("Got Destination for unknkown NodeInformation"); // } // } -// +// // System.out.println(node1Count); // System.out.println(node2Count); -// +// // final double node1Pct = (double) node1Count / (double) (node1Count + node2Count); // assertEquals(0.80, node1Pct, 0.01); -// // node1 should get the most but is not allowed to have more than approximately 80% of the data. +// // node1 should get the most but is not allowed to have more than approximately 80% of the data. // } -// +// // @Test // public void testWeightedDistributionWithThreeNodes() throws IOException { // final Map destinationMap = new LinkedHashMap<>(); // final NodeInformation node1 = new NodeInformation("hostA", 80, 90, true, 3); // final NodeInformation node2 = new NodeInformation("hostB", 80, 90, true, 500); // final NodeInformation node3 = new NodeInformation("hostC", 80, 90, true, 500); -// +// // final Destination node1Destination = new Destination(createRemoteGroupPort("PortA"), null, node1, TransferDirection.SEND, true, null); // final Destination node2Destination = new Destination(createRemoteGroupPort("PortB"), null, node2, TransferDirection.SEND, true, null); // final Destination node3Destination = new Destination(createRemoteGroupPort("PortC"), null, node3, TransferDirection.SEND, true, null); -// +// // destinationMap.put(node1, node1Destination); // destinationMap.put(node2, node2Destination); // destinationMap.put(node3, node3Destination); -// +// // final List destinations = StandardSiteToSiteProtocol.formulateDestinationList(destinationMap, TransferDirection.SEND); // int node1Count = 0, node2Count = 0, node3Count = 0; // for ( final Destination destination : destinations ) { @@ -94,20 +94,20 @@ package org.apache.nifi.remote; // Assert.fail("Got Destination for unknkown NodeInformation"); // } // } -// +// // System.out.println(node1Count); // System.out.println(node2Count); // System.out.println(node3Count); -// +// // final double node1Pct = (double) node1Count / (double) (node1Count + node2Count + node3Count); // final double node2Pct = (double) node2Count / (double) (node1Count + node2Count + node3Count); // final double node3Pct = (double) node3Count / (double) (node1Count + node2Count + node3Count); -// +// // assertEquals(0.5, node1Pct, 0.02); // assertEquals(0.25, node2Pct, 0.02); // assertEquals(node2Pct, node3Pct, 0.02); // } -// +// // private RemoteGroupPort createRemoteGroupPort(final String portName) { // RemoteGroupPort port = Mockito.mock(RemoteGroupPort.class); // Mockito.when(port.getName()).thenReturn(portName); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/TestSocketChannelStreams.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/TestSocketChannelStreams.java index 4e55f5f2cb..03f8190760 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/TestSocketChannelStreams.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/TestSocketChannelStreams.java @@ -65,7 +65,7 @@ package org.apache.nifi.remote.io.socket; // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); // final SocketChannel channel = SocketChannel.open(new InetSocketAddress("localhost", 5000)); // channel.configureBlocking(false); -// +// // final CommunicationsSession commsSession; // commsSession = new SocketChannelCommunicationsSession(channel, "", null); // commsSession.setUri("nifi://localhost:5000"); @@ -74,7 +74,7 @@ package org.apache.nifi.remote.io.socket; // // dos.write(CommunicationsProtocol.MAGIC_BYTES); // dos.flush(); -// +// // final EventReporter eventReporter = Mockito.mock(EventReporter.class); // final StandardSiteToSiteProtocol proposedProtocol = new StandardSiteToSiteProtocol(commsSession, eventReporter, NiFiProperties.getInstance()); // @@ -84,20 +84,20 @@ package org.apache.nifi.remote.io.socket; // final RemoteProcessGroup rpg = Mockito.mock(RemoteProcessGroup.class); // Mockito.when(rpg.getCommunicationsTimeout(Mockito.any(TimeUnit.class))).thenReturn(2000); // Mockito.when(rpg.getTargetUri()).thenReturn( new URI("https://localhost:5050/") ); -// +// // final RemoteGroupPort port = Mockito.mock(RemoteGroupPort.class); // Mockito.when(port.getIdentifier()).thenReturn("90880680-d6da-40be-b2cc-a15423de2e1a"); // Mockito.when(port.getName()).thenReturn("Data In"); // Mockito.when(port.getRemoteProcessGroup()).thenReturn(rpg); -// +// // negotiatedProtocol.initiateHandshake(port, TransferDirection.SEND); // } -// +// // @Test // public void testInputOutputStreams() throws IOException, InterruptedException { // final ServerThread server = new ServerThread(); // server.start(); -// +// // int port = server.getPort(); // while ( port <= 0 ) { // Thread.sleep(10L); @@ -106,11 +106,11 @@ package org.apache.nifi.remote.io.socket; // // final SocketChannel channel = SocketChannel.open(new InetSocketAddress("localhost", port)); // channel.configureBlocking(false); -// +// // final OutputStream out = new SocketChannelOutputStream(channel); // final InputStream in = new SocketChannelInputStream(channel); // final DataInputStream dataIn = new DataInputStream(in); -// +// // final byte[] sent = new byte[DATA_SIZE]; // for (int i=0; i < sent.length; i++) { // sent[i] = (byte) (i % 255); @@ -125,21 +125,21 @@ package org.apache.nifi.remote.io.socket; // final float megabytes = (float) DATA_SIZE / (1024F * 1024F); // final float MBperS = megabytes / seconds; // System.out.println("Millis: " + millis + "; MB/s: " + MBperS); -// +// // Thread.sleep(2500L); // final byte[] received = server.getReceivedData(); // System.out.println("Server received " + received.length + " bytes"); // server.clearReceivedData(); // assertTrue(Arrays.equals(sent, received)); -// +// // final long val = dataIn.readLong(); // assertEquals(DATA_SIZE, val); // System.out.println(val); // } -// +// // server.shutdown(); // } -// +// // public final long toLong(final byte[] buffer) throws IOException { // return (((long)buffer[0] << 56) + // ((long)(buffer[1] & 255) << 48) + @@ -150,82 +150,82 @@ package org.apache.nifi.remote.io.socket; // ((buffer[6] & 255) << 8) + // ((buffer[7] & 255) << 0)); // } -// +// // private static class ServerThread extends Thread { // private int listeningPort; // private final ByteArrayOutputStream received = new ByteArrayOutputStream(); -// +// // private volatile int readingDelay = 0; // private volatile boolean shutdown = false; -// +// // public ServerThread() { // } -// +// // public int getPort() { // return listeningPort; // } -// +// // public byte[] getReceivedData() { // return received.toByteArray(); // } -// +// // @Override // public void run() { // try { // final ServerSocketFactory serverSocketFactory = ServerSocketFactory.getDefault(); // final ServerSocket serverSocket = serverSocketFactory.createServerSocket(0); // this.listeningPort = serverSocket.getLocalPort(); -// +// // final Socket socket = serverSocket.accept(); // final InputStream stream = socket.getInputStream(); // final DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); -// +// // final byte[] buffer = new byte[4096]; // int len; -// +// // while (!shutdown) { // try { // len = stream.read(buffer); -// +// // System.out.println("Received " + len + " bytes"); -// +// // if ( readingDelay > 0 ) { // try { Thread.sleep(readingDelay); } catch (final InterruptedException e) {} // } // } catch (final SocketTimeoutException e) { // continue; // } -// +// // if ( len < 0 ) { // return; // } -// +// // received.write(buffer, 0, len); -// +// // final long length = received.size(); // if ( length % (DATA_SIZE) == 0 ) { // dos.writeLong(length); // dos.flush(); // } // } -// +// // System.out.println("Server successfully shutdown"); // } catch (final Exception e) { // e.printStackTrace(); // } // } -// +// // public void clearReceivedData() { // this.received.reset(); // } -// +// // public void shutdown() { // this.shutdown = true; // } -// +// // public void delayReading(final int millis) { // this.readingDelay = millis; // } // } -// +// //} diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/ssl/TestSSLSocketChannel.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/ssl/TestSSLSocketChannel.java index 4c91f75b9a..8fe7149161 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/ssl/TestSSLSocketChannel.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/io/socket/ssl/TestSSLSocketChannel.java @@ -61,19 +61,19 @@ package org.apache.nifi.remote.io.socket.ssl; ////@Ignore("For local testing only") //public class TestSSLSocketChannel { // public static final int DATA_SIZE = 4096; -// +// // @Test // @Ignore // public void testSendingToLocalInstance() throws IOException, InterruptedException, HandshakeException, UnknownPortException, PortNotRunningException, URISyntaxException { // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); -// +// // final NiFiProperties properties = NiFiProperties.getInstance(); // final SSLContext sslContext = SslContextFactory.createSslContext(properties); -// +// // final SSLSocketChannel channel = new SSLSocketChannel(sslContext, "localhost", 5000, true); // channel.setTimeout(2000000); // channel.connect(); -// +// // final CommunicationsSession commsSession; // commsSession = new SSLSocketChannelCommunicationsSession(channel, "", null); // commsSession.setUri("nifi://localhost:5000"); @@ -82,7 +82,7 @@ package org.apache.nifi.remote.io.socket.ssl; // // dos.write(CommunicationsProtocol.MAGIC_BYTES); // dos.flush(); -// +// // final EventReporter eventReporter = Mockito.mock(EventReporter.class); // final StandardSiteToSiteProtocol proposedProtocol = new StandardSiteToSiteProtocol(commsSession, eventReporter, NiFiProperties.getInstance()); // final StandardSiteToSiteProtocol negotiatedProtocol = (StandardSiteToSiteProtocol) RemoteResourceFactory.initiateResourceNegotiation(proposedProtocol, dis, dos); @@ -91,25 +91,25 @@ package org.apache.nifi.remote.io.socket.ssl; // final RemoteProcessGroup rpg = Mockito.mock(RemoteProcessGroup.class); // Mockito.when(rpg.getCommunicationsTimeout(Mockito.any(TimeUnit.class))).thenReturn(2000); // Mockito.when(rpg.getTargetUri()).thenReturn( new URI("https://localhost:5050/") ); -// +// // final RemoteGroupPort port = Mockito.mock(RemoteGroupPort.class); // Mockito.when(port.getIdentifier()).thenReturn("90880680-d6da-40be-b2cc-a15423de2e1a"); // Mockito.when(port.getName()).thenReturn("Data In"); // Mockito.when(port.getRemoteProcessGroup()).thenReturn(rpg); -// +// // negotiatedProtocol.initiateHandshake(port, TransferDirection.SEND); // } -// +// // @Test // public void testWithSimpleSSLSocket() throws IOException, InterruptedException { // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); -// +// // final NiFiProperties properties = NiFiProperties.getInstance(); // final SSLContext sslContext = SslContextFactory.createSslContext(properties); -// +// // final ServerThread server = new ServerThread(sslContext); // server.start(); -// +// // int port = server.getPort(); // while ( port <= 0 ) { // Thread.sleep(10L); @@ -118,7 +118,7 @@ package org.apache.nifi.remote.io.socket.ssl; // // final Socket socket = sslContext.getSocketFactory().createSocket("localhost", port); // final OutputStream out = socket.getOutputStream(); -// +// // final byte[] sent = new byte[DATA_SIZE]; // for (int i=0; i < sent.length; i++) { // sent[i] = (byte) (i % 255); @@ -133,17 +133,17 @@ package org.apache.nifi.remote.io.socket.ssl; // final float MBperS = megabytes / seconds; // System.out.println("Millis: " + millis + "; MB/s: " + MBperS); // } -// +// // @Test // public void testDirectChannelComms() throws IOException, InterruptedException { // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); -// +// // final NiFiProperties properties = NiFiProperties.getInstance(); // final SSLContext sslContext = SslContextFactory.createSslContext(properties); -// +// // final ServerThread server = new ServerThread(sslContext); // server.start(); -// +// // int port = server.getPort(); // while ( port <= 0 ) { // Thread.sleep(10L); @@ -161,12 +161,12 @@ package org.apache.nifi.remote.io.socket.ssl; // // for (int itr=0; itr < 2; itr++) { // channel.write(sent); -// +// // Thread.sleep(250L); // final byte[] received = server.getReceivedData(); // server.clearReceivedData(); // assertTrue(Arrays.equals(sent, received)); -// +// // int len; // final byte[] buffer = new byte[4096]; // final ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -183,23 +183,23 @@ package org.apache.nifi.remote.io.socket.ssl; // } // } // } -// +// // channel.close(); // server.shutdown(); // } // -// +// // @Test // public void testWriteTimesOut() throws IOException, InterruptedException { // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); -// +// // final NiFiProperties properties = NiFiProperties.getInstance(); // final SSLContext sslContext = SslContextFactory.createSslContext(properties); -// +// // final ServerThread server = new ServerThread(sslContext); // server.delayReading(2000); // server.start(); -// +// // int port = server.getPort(); // while ( port <= 0 ) { // Thread.sleep(10L); @@ -209,9 +209,9 @@ package org.apache.nifi.remote.io.socket.ssl; // final SSLSocketChannel channel = new SSLSocketChannel(sslContext, "localhost", port, true); // channel.setTimeout(1000); // channel.connect(); -// +// // final OutputStream out = new SSLSocketChannelOutputStream(channel); -// +// // final byte[] sent = new byte[1024 * 1024]; // for (int i=0; i < sent.length; i++) { // sent[i] = (byte) (i % 255); @@ -225,25 +225,25 @@ package org.apache.nifi.remote.io.socket.ssl; // } // // server.delayReading(0); -// +// // try { // channel.close(); // } catch (final Exception e) {} -// +// // server.shutdown(); // } -// -// +// +// // @Test // public void testInputOutputStreams() throws IOException, InterruptedException { // System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, "src/test/resources/nifi.properties"); -// +// // final NiFiProperties properties = NiFiProperties.getInstance(); // final SSLContext sslContext = SslContextFactory.createSslContext(properties); -// +// // final ServerThread server = new ServerThread(sslContext); // server.start(); -// +// // int port = server.getPort(); // while ( port <= 0 ) { // Thread.sleep(10L); @@ -253,11 +253,11 @@ package org.apache.nifi.remote.io.socket.ssl; // final SSLSocketChannel channel = new SSLSocketChannel(sslContext, "localhost", port, true); // channel.setTimeout(2000); // channel.connect(); -// +// // final OutputStream out = new SSLSocketChannelOutputStream(channel); // final InputStream in = new SSLSocketChannelInputStream(channel); // final DataInputStream dataIn = new DataInputStream(in); -// +// // final byte[] sent = new byte[DATA_SIZE]; // for (int i=0; i < sent.length; i++) { // sent[i] = (byte) (i % 255); @@ -272,22 +272,22 @@ package org.apache.nifi.remote.io.socket.ssl; // final float megabytes = (float) DATA_SIZE / (1024F * 1024F); // final float MBperS = megabytes / seconds; // System.out.println("Millis: " + millis + "; MB/s: " + MBperS); -// +// // Thread.sleep(500L); // final byte[] received = server.getReceivedData(); // System.out.println("Server received " + received.length + " bytes"); // server.clearReceivedData(); // assertTrue(Arrays.equals(sent, received)); -// +// // final long val = dataIn.readLong(); // assertEquals(DATA_SIZE, val); // System.out.println(val); // } -// +// // channel.close(); // server.shutdown(); // } -// +// // public final long toLong(final byte[] buffer) throws IOException { // return (((long)buffer[0] << 56) + // ((long)(buffer[1] & 255) << 48) + @@ -298,82 +298,82 @@ package org.apache.nifi.remote.io.socket.ssl; // ((buffer[6] & 255) << 8) + // ((buffer[7] & 255) << 0)); // } -// +// // private static class ServerThread extends Thread { // private final SSLContext sslContext; // private int listeningPort; // private final ByteArrayOutputStream received = new ByteArrayOutputStream(); -// +// // private volatile int readingDelay = 0; // private volatile boolean shutdown = false; -// +// // public ServerThread(final SSLContext sslContext) { // this.sslContext = sslContext; // } -// +// // public int getPort() { // return listeningPort; // } -// +// // public byte[] getReceivedData() { // return received.toByteArray(); // } -// +// // @Override // public void run() { // try { // final SSLServerSocketFactory sslServerSocketFactory = sslContext.getServerSocketFactory(); // final SSLServerSocket serverSocket = (SSLServerSocket) sslServerSocketFactory.createServerSocket(0); // serverSocket.setNeedClientAuth(true); -// +// // this.listeningPort = serverSocket.getLocalPort(); -// +// // final Socket socket = serverSocket.accept(); -//// socket.setSoTimeout(250); +// socket.setSoTimeout(250); // final InputStream stream = socket.getInputStream(); // final DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); -// +// // final byte[] buffer = new byte[1024]; // int len; -// +// // while (!shutdown) { // try { // len = stream.read(buffer); -// +// // if ( readingDelay > 0 ) { // try { Thread.sleep(readingDelay); } catch (final InterruptedException e) {} // } // } catch (final SocketTimeoutException e) { // continue; // } -// +// // if ( len < 0 ) { // return; // } -// +// // received.write(buffer, 0, len); -// +// // final long length = received.size(); // if ( length % (DATA_SIZE) == 0 ) { // dos.writeLong(length); // dos.flush(); // } // } -// +// // System.out.println("Server successfully shutdown"); // } catch (final Exception e) { // e.printStackTrace(); // } // } -// +// // public void clearReceivedData() { // this.received.reset(); // } -// +// // public void shutdown() { // this.shutdown = true; // } -// +// // public void delayReading(final int millis) { // this.readingDelay = millis; // } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentAccess.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentAccess.java index a093c59163..f28617a0aa 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentAccess.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentAccess.java @@ -18,7 +18,7 @@ package org.apache.nifi.web; /** * Provides access to content within NiFi. - * + * * @author unattributed */ public interface ContentAccess { @@ -26,8 +26,8 @@ public interface ContentAccess { /** * Gets the content for the specified claim. * - * @param request - * @return + * @param request the context of the request + * @return the downloadable content */ DownloadableContent getContent(ContentRequestContext request); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentRequestContext.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentRequestContext.java index f5744eea90..6154576607 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentRequestContext.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/ContentRequestContext.java @@ -20,32 +20,32 @@ package org.apache.nifi.web; * A request for content. */ public interface ContentRequestContext { - + /** * The URI to the data. - * - * @return + * + * @return the uri of the data */ String getDataUri(); - + /** * If clustered, this is the id of the node the data resides on. - * - * @return + * + * @return the the cluster node identifier */ String getClusterNodeId(); - + /** * The client id for the user making the request. - * - * @return + * + * @return the client identifier */ String getClientId(); - + /** * The proxy chain for the current request, if applicable. - * - * @return + * + * @return the proxied entities chain */ String getProxiedEntitiesChain(); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/DownloadableContent.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/DownloadableContent.java index a23673f5e8..5a34cbc13b 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/DownloadableContent.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-access/src/main/java/org/apache/nifi/web/DownloadableContent.java @@ -35,8 +35,8 @@ public final class DownloadableContent { /** * The filename of the content. - * - * @return + * + * @return the filename */ public String getFilename() { return filename; @@ -44,8 +44,8 @@ public final class DownloadableContent { /** * The content type of the content. - * - * @return + * + * @return the content type */ public String getType() { return type; @@ -53,8 +53,8 @@ public final class DownloadableContent { /** * The content stream. - * - * @return + * + * @return the intput stream of the content */ public InputStream getContent() { return content; diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/ProtocolHandshake.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/ProtocolHandshake.java index 55cf51f28d..f36ac15066 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/ProtocolHandshake.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/ProtocolHandshake.java @@ -27,47 +27,44 @@ import org.apache.nifi.remote.VersionNegotiator; public class ProtocolHandshake { - public static final byte[] MAGIC_HEADER = new byte[] { 'N', 'i', 'F', 'i' }; - + public static final byte[] MAGIC_HEADER = new byte[]{'N', 'i', 'F', 'i'}; + public static final int RESOURCE_OK = 20; public static final int DIFFERENT_RESOURCE_VERSION = 21; public static final int ABORT = 255; - public static void initiateHandshake(final InputStream in, final OutputStream out, final VersionNegotiator versionNegotiator) throws IOException, HandshakeException { final DataInputStream dis = new DataInputStream(in); final DataOutputStream dos = new DataOutputStream(out); - + try { dos.write(MAGIC_HEADER); - + initiateVersionNegotiation(versionNegotiator, dis, dos); } finally { dos.flush(); } } - public static void receiveHandshake(final InputStream in, final OutputStream out, final VersionNegotiator versionNegotiator) throws IOException, HandshakeException { final DataInputStream dis = new DataInputStream(in); final DataOutputStream dos = new DataOutputStream(out); - + try { final byte[] magicHeaderBuffer = new byte[MAGIC_HEADER.length]; dis.readFully(magicHeaderBuffer); - + receiveVersionNegotiation(versionNegotiator, dis, dos); } finally { dos.flush(); } } - - + private static void initiateVersionNegotiation(final VersionNegotiator negotiator, final DataInputStream dis, final DataOutputStream dos) throws IOException, HandshakeException { // Write the classname of the RemoteStreamCodec, followed by its version dos.writeInt(negotiator.getVersion()); dos.flush(); - + // wait for response from server. final int statusCode = dis.read(); switch (statusCode) { @@ -76,16 +73,16 @@ public class ProtocolHandshake { case DIFFERENT_RESOURCE_VERSION: // server accepted our proposal of codec name but not the version // Get server's preferred version final int newVersion = dis.readInt(); - + // Determine our new preferred version that is no greater than the server's preferred version. final Integer newPreference = negotiator.getPreferredVersion(newVersion); // If we could not agree with server on a version, fail now. - if ( newPreference == null ) { + if (newPreference == null) { throw new HandshakeException("Could not agree on protocol version"); } - + negotiator.setVersion(newPreference); - + // Attempt negotiation of resource based on our new preferred version. initiateVersionNegotiation(negotiator, dis, dos); case ABORT: @@ -94,17 +91,17 @@ public class ProtocolHandshake { throw new HandshakeException("Received unexpected response code " + statusCode + " when negotiating version with remote server"); } } - + private static void receiveVersionNegotiation(final VersionNegotiator negotiator, final DataInputStream dis, final DataOutputStream dos) throws IOException, HandshakeException { final int version = dis.readInt(); - if ( negotiator.isVersionSupported(version) ) { + if (negotiator.isVersionSupported(version)) { dos.write(RESOURCE_OK); dos.flush(); - + negotiator.setVersion(version); } else { final Integer preferred = negotiator.getPreferredVersion(version); - if ( preferred == null ) { + if (preferred == null) { dos.write(ABORT); dos.flush(); throw new HandshakeException("Unable to negotiate an acceptable version of the Distributed Cache Protocol"); @@ -112,7 +109,7 @@ public class ProtocolHandshake { dos.write(DIFFERENT_RESOURCE_VERSION); dos.writeInt(preferred); dos.flush(); - + receiveVersionNegotiation(negotiator, dis, dos); } } diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/exception/HandshakeException.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/exception/HandshakeException.java index 8049d42b20..9746da55c5 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/exception/HandshakeException.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-protocol/src/main/java/org/apache/nifi/distributed/cache/protocol/exception/HandshakeException.java @@ -17,10 +17,11 @@ package org.apache.nifi.distributed.cache.protocol.exception; public class HandshakeException extends Exception { + public HandshakeException(final String message) { super(message); } - + public HandshakeException(final Throwable cause) { super(cause); } diff --git a/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/Criteria.java b/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/Criteria.java index 471e30b1e0..345a923ae8 100644 --- a/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/Criteria.java +++ b/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/Criteria.java @@ -27,13 +27,13 @@ import java.util.Map; */ public class Criteria { - // note: this class does not need to be synchronized/locked due to + // note: this class does not need to be synchronized/locked due to // its usage. a new instance is used for getting or updating the // rule criteria due to the nature of how annotation data is set. // this will be a new instance for each request and the setting of // annotation data is protected by a rest api wide write-lock. - // likewise, the processor uses this class as a simple look up. if - // this ever changed (not likely) then we would have to introduce + // likewise, the processor uses this class as a simple look up. if + // this ever changed (not likely) then we would have to introduce // some thread safety here. private Map rules; private FlowFilePolicy flowFilePolicy; @@ -56,7 +56,7 @@ public class Criteria { /** * Adds the specified rule to the end of the rule collection. * - * @param rule + * @param rule the rule to add */ public void addRule(final Rule rule) { rules.put(rule.getId(), rule); @@ -65,8 +65,8 @@ public class Criteria { /** * Gets the specified rule from the rule collection. * - * @param ruleId - * @return + * @param ruleId the identifier of the rule to get + * @return the identified rule */ public Rule getRule(final String ruleId) { return rules.get(ruleId); @@ -75,7 +75,7 @@ public class Criteria { /** * Deletes the specified rule from the rule collection. * - * @param rule + * @param rule the rule to delete */ public void deleteRule(final Rule rule) { rules.remove(rule.getId()); @@ -84,7 +84,7 @@ public class Criteria { /** * Returns the rule ordering. * - * @return + * @return the rule keys in rule order */ public List getRuleOrder() { return Collections.unmodifiableList(new ArrayList<>(rules.keySet())); @@ -94,7 +94,7 @@ public class Criteria { * Reorders the rule collection. The specified new rule order must contain * the rule id for each rule in the collection. * - * @param newRuleOrder + * @param newRuleOrder the new rule order to use by key */ public void reorder(final List newRuleOrder) { // ensure all known rules are accounted for @@ -115,7 +115,7 @@ public class Criteria { /** * Returns a listing of all Rules. * - * @return + * @return all rules */ public List getRules() { return Collections.unmodifiableList(new ArrayList<>(rules.values())); @@ -124,7 +124,7 @@ public class Criteria { /** * Sets the flow file policy. * - * @param flowFilePolicy + * @param flowFilePolicy the new policy */ public void setFlowFilePolicy(FlowFilePolicy flowFilePolicy) { this.flowFilePolicy = flowFilePolicy; @@ -133,7 +133,7 @@ public class Criteria { /** * Gets the flow file policy. * - * @return + * @return the current policy */ public FlowFilePolicy getFlowFilePolicy() { return flowFilePolicy; diff --git a/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/serde/CriteriaSerDe.java b/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/serde/CriteriaSerDe.java index 4940d28eda..f1cd126e25 100644 --- a/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/serde/CriteriaSerDe.java +++ b/nifi/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-model/src/main/java/org/apache/nifi/update/attributes/serde/CriteriaSerDe.java @@ -73,8 +73,8 @@ public class CriteriaSerDe { /** * Serializes the specified criteria. * - * @param criteria - * @return + * @param criteria to serialize + * @return the string representation of the given criteria */ public static String serialize(final Criteria criteria) { final StringWriter writer = new StringWriter(); @@ -101,8 +101,8 @@ public class CriteriaSerDe { /** * Deserializes the specified criteria. * - * @param string - * @return + * @param string the string representation of the criteria + * @return the criteria object */ public static Criteria deserialize(final String string) { Criteria criteria = null;