You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2025/12/30 19:41:22 UTC
(nifi) branch main updated: NIFI-15405 Added Checkstyle indentation and comments indentation rules (#10710)
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 3beed0da3e NIFI-15405 Added Checkstyle indentation and comments indentation rules (#10710)
3beed0da3e is described below
commit 3beed0da3e36e0c64d0fe0db74492d83410b055f
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Tue Dec 30 20:41:16 2025 +0100
NIFI-15405 Added Checkstyle indentation and comments indentation rules (#10710)
Signed-off-by: David Handermann <ex...@apache.org>
---
.../c2/client/http/url/LegacyC2UrlProvider.java | 4 +-
.../nifi/c2/client/service/C2HeartbeatManager.java | 6 +-
.../operation/StartFlowOperationHandler.java | 12 +-
.../operation/StopFlowOperationHandler.java | 12 +-
.../operation/SyncResourceOperationHandler.java | 2 +-
checkstyle.xml | 9 +
.../bootstrap/command/CommandRunnerFactory.java | 6 +-
...dFlowPropertyAssetReferenceResolverService.java | 2 +-
.../service/StandardFlowPropertyEncryptorTest.java | 11 +-
.../c2/command/AgentPropertyValidationContext.java | 158 +-
.../nifi/minifi/validator/FlowValidator.java | 22 +-
.../DefaultSyncResourceStrategyTest.java | 2 +-
.../nifi/provenance/NoOpProvenanceRepository.java | 296 +-
.../language/compile/ExpressionCompiler.java | 38 +-
.../functions/CharSequenceTranslatorEvaluator.java | 20 +-
.../evaluation/functions/Uuid5Evaluator.java | 14 +-
.../attribute/expression/language/TestQuery.java | 13 +-
.../java/org/apache/nifi/hl7/query/HL7Query.java | 18 +-
.../AbstractBootstrapPropertiesLoader.java | 2 +-
.../java/org/apache/nifi/util/StringUtilsTest.java | 216 +-
.../nifi/record/path/paths/RecordPathCompiler.java | 4 +-
.../apache/nifi/record/path/TestRecordPath.java | 6 +-
.../nifi/serialization/record/RecordFieldType.java | 2 +-
.../serialization/record/ResultSetRecordSet.java | 6 +-
.../field/ObjectLocalDateTimeFieldConverter.java | 82 +-
.../TestObjectLocalDateTimeFieldConverter.java | 21 +-
.../apache/nifi/remote/client/http/HttpClient.java | 2 +-
.../protocol/http/HttpClientTransaction.java | 14 +-
.../nifi/swagger/integration/StandardReader.java | 2 +-
.../src/test/java/org/wali/DummyRecordSerde.java | 12 +-
.../apache/nifi/amqp/processors/PublishAMQP.java | 2 +-
.../java/org/apache/nifi/jasn1/JASN1Reader.java | 18 +-
.../processors/aws/kinesis/ConsumeKinesis.java | 8 +-
.../aws/kinesis/ConsumeKinesisAttributes.java | 2 +-
.../aws/rds/AwsRdsIamDatabasePasswordProvider.java | 6 +-
.../apache/nifi/processors/aws/s3/PutS3Object.java | 26 +-
.../nifi/processors/aws/s3/AbstractS3IT.java | 2 +-
.../nifi/processors/aws/s3/ITPutS3Object.java | 10 +-
.../azure/ClientSideEncryptionSupport.java | 2 +-
.../azure/eventhub/ConsumeAzureEventHub.java | 6 +-
.../AzureLogAnalyticsProvenanceReportingTask.java | 810 +-
.../api/AzureLogAnalyticsMetricsFactory.java | 8 +-
.../org/apache/nifi/processors/box/PutBoxFile.java | 10 +-
.../apache/nifi/processors/box/PutBoxFileTest.java | 2 +-
.../nifi/processors/box/utils/BoxDateTest.java | 2 +-
.../processors/compress/ModifyCompression.java | 2 +-
.../elasticsearch/AbstractPutElasticsearch.java | 2 +-
.../AbstractByQueryElasticsearchTest.java | 12 +-
.../nifi/processors/elasticsearch/JsonUtils.java | 6 +-
.../integration/AbstractElasticsearchITBase.java | 16 +-
.../java/org/apache/nifi/util/db/JdbcCommon.java | 10 +-
.../processor/util/listen/FlowFileEventBatch.java | 30 +-
.../processors/hadoop/AbstractHadoopProcessor.java | 91 +-
.../processor/util/list/AbstractListProcessor.java | 4 +-
.../processor/util/pattern/ExceptionHandler.java | 2 +-
.../processor/util/pattern/PartialFunctions.java | 2 +-
.../java/org/apache/nifi/avro/AvroTypeUtil.java | 2 +-
.../schema/access/InferenceSchemaStrategy.java | 2 +-
.../org/apache/nifi/avro/TestAvroTypeUtil.java | 48 +-
.../processors/hadoop/AbstractPutHDFSRecord.java | 2 +-
.../reporting/util/metrics/MetricsService.java | 4 +-
.../reporting/util/metrics/api/MetricBuilder.java | 2 +-
.../reporting/util/metrics/api/MetricsBuilder.java | 2 +-
.../apache/nifi/syslog/parsers/SyslogParser.java | 2 +-
.../processors/gcp/bigquery/proto/ProtoUtils.java | 182 +-
.../processors/gcp/pubsub/ConsumeGCPubSub.java | 12 +-
.../apache/nifi/processors/gcp/storage/Util.java | 2 +-
.../processors/gcp/drive/PutGoogleDriveIT.java | 2 +-
.../nifi/processors/gcp/storage/AbstractGCSIT.java | 2 +-
.../processors/gcp/storage/PutGCSObjectIT.java | 2 +-
.../processors/graph/ExecuteGraphQueryRecord.java | 2 +-
.../apache/nifi/processors/groovyx/util/Files.java | 2 +-
.../nifi/processors/groovyx/util/Throwables.java | 4 +-
.../org/apache/nifi/processors/hadoop/GetHDFS.java | 108 +-
.../apache/nifi/processors/hadoop/ListHDFS.java | 2 +-
.../nifi/processors/hadoop/MoveHDFSTest.java | 40 +-
.../processors/hadoop/TestGetHDFSFileInfo.java | 8 +-
.../TestStandardHashiCorpVaultClientService.java | 54 +-
.../apache/nifi/processors/AbstractIoTDBTest.java | 4 +-
.../nifi/processors/jolt/JoltTransformRecord.java | 4 +-
.../kafka/service/Kafka3ConnectionService.java | 6 +-
.../apache/nifi/mongodb/MongoDBClientService.java | 46 +-
.../processors/mqtt/common/MqttClientFactory.java | 2 +-
.../nifi/processors/network/pcap/SplitPCAP.java | 44 +-
.../nifi/parquet/stream/NifiParquetOutputFile.java | 30 +-
.../processors/parquet/ConvertAvroToParquet.java | 2 +-
.../nifi/processors/pgp/VerifyContentPGP.java | 6 +-
.../excel/TestExcelStartingRowSchemaInference.java | 4 +-
.../protobuf/converter/ProtobufDataConverter.java | 32 +-
.../redis/service/RedisConnectionPoolService.java | 3 +-
.../TestSiteToSiteBulletinReportingTask.java | 16 +-
.../TestSiteToSiteMetricsReportingTask.java | 16 +-
.../TestSiteToSiteProvenanceReportingTask.java | 14 +-
.../TestSiteToSiteStatusReportingTask.java | 18 +-
.../org/apache/nifi/processors/smb/GetSmbFile.java | 274 +-
.../apache/nifi/processors/splunk/GetSplunk.java | 7 +-
.../apache/nifi/processors/splunk/PutSplunk.java | 2 +-
.../EnvironmentVariableParameterProvider.java | 2 +-
.../parameter/OnePasswordParameterProvider.java | 2 +-
.../nifi/processors/standard/AttributesToCSV.java | 12 +-
.../nifi/processors/standard/DistributeLoad.java | 4 +-
.../processors/standard/DuplicateFlowFile.java | 24 +-
.../nifi/processors/standard/EncodeContent.java | 4 +-
.../nifi/processors/standard/EvaluateJsonPath.java | 4 +-
.../nifi/processors/standard/ExecuteProcess.java | 74 +-
.../processors/standard/ExecuteStreamCommand.java | 4 +-
.../nifi/processors/standard/GenerateFlowFile.java | 2 +-
.../apache/nifi/processors/standard/GetFile.java | 6 +-
.../nifi/processors/standard/GetFileResource.java | 4 +-
.../processors/standard/HandleHttpRequest.java | 334 +-
.../processors/standard/ListDatabaseTables.java | 4 +-
.../nifi/processors/standard/ListenSyslog.java | 8 +-
.../nifi/processors/standard/MergeContent.java | 6 +-
.../nifi/processors/standard/ParseSyslog5424.java | 2 +-
.../processors/standard/PutDatabaseRecord.java | 4 +-
.../apache/nifi/processors/standard/PutEmail.java | 16 +-
.../apache/nifi/processors/standard/SplitJson.java | 7 +-
.../nifi/processors/standard/SplitRecord.java | 32 +-
.../nifi/processors/standard/UnpackContent.java | 48 +-
.../nifi/processors/standard/ValidateJson.java | 2 +-
.../standard/db/impl/Oracle12DatabaseAdapter.java | 2 +-
.../standard/db/impl/OracleDatabaseAdapter.java | 2 +-
.../processors/standard/encoding/EncodingMode.java | 2 +-
.../standard/servlets/ListenHTTPServlet.java | 17 +-
.../processors/standard/util/SFTPTransfer.java | 2 +-
.../processors/standard/PutDatabaseRecordTest.java | 22 +-
.../processors/standard/TestEncodeContent.java | 42 +-
.../processors/standard/TestLookupAttribute.java | 18 +-
.../nifi/processors/standard/TestMergeRecord.java | 2 +-
.../nifi/processors/standard/TestPutUDP.java | 8 +-
.../nifi/processors/standard/TestReplaceText.java | 6 +-
.../processors/standard/TestValidateRecord.java | 4 +-
.../apache/nifi/processors/standard/TestWait.java | 2 +-
.../rules/RestrictBackpressureSettings.java | 2 +-
.../rules/RestrictBackpressureSettingsTest.java | 6 +-
.../service/StandardDatabaseDialectService.java | 6 +-
.../DatabaseTableSchemaRegistry.java | 4 +-
.../org/apache/nifi/dbcp/DBCPConnectionPool.java | 2 +-
.../apache/nifi/dbcp/HikariCPConnectionPool.java | 2 +-
.../cache/client/SetCacheClientService.java | 2 +-
.../apache/nifi/csv/JacksonCSVRecordReader.java | 8 +-
.../org/apache/nifi/csv/WriteFastCSVResult.java | 6 +-
.../windowsevent/WindowsEventLogRecordReader.java | 2 +-
.../java/org/apache/nifi/xml/XMLRecordReader.java | 102 +-
.../org/apache/nifi/avro/TestWriteAvroResult.java | 14 +-
.../nifi/json/TestJsonTreeRowRecordReader.java | 6 +-
.../apache/nifi/xml/TestXMLRecordSetWriter.java | 2 +-
.../nifi/yaml/TestYamlTreeRowRecordReader.java | 46 +-
.../apache/nifi/record/sink/HttpRecordSink.java | 4 +-
.../nifi/record/sink/TestHttpRecordSink.java | 6 +-
.../org/apache/nifi/record/sink/TestProcessor.java | 10 +-
.../nifi/ssl/PEMEncodedSSLContextProvider.java | 6 +-
.../analysis/AttributeRollingWindowIT.java | 2 +-
.../processors/attributes/UpdateAttribute.java | 99 +-
.../event/log/ConsumeWindowsEventLogTest.java | 22 +-
.../JsonPointerPropertyNameValidator.java | 36 +-
.../cluster/zookeeper/ZooKeeperClientConfig.java | 4 +-
.../ldap/tenants/LdapUserGroupProviderTest.java | 142 +-
.../provenance/WriteAheadProvenanceRepository.java | 2 +-
.../nifi/provenance/index/lucene/QueryTask.java | 2 +-
.../provenance/schema/LookupTableEventRecord.java | 4 +-
.../provenance/store/PartitionedEventStore.java | 2 +-
.../provenance/AbstractTestRecordReaderWriter.java | 10 +-
.../index/lucene/TestLuceneEventIndex.java | 2 +-
.../dto/status/ProcessGroupStatusSnapshotDTO.java | 2 +-
.../web/api/entity/TransactionResultEntity.java | 2 +-
.../CompositeUserGroupProviderTest.java | 2 +-
.../protocol/impl/SocketProtocolListener.java | 2 +-
.../endpoints/FlowAnalysisRuleEndpointMerger.java | 6 +-
.../coordination/node/NodeClusterCoordinator.java | 2 +-
.../manager/PropertyDescriptorDtoMergerTest.java | 2 +-
.../nifi/controller/StandardProcessorNode.java | 2 +-
.../parameter/StandardParameterProviderNode.java | 64 +-
.../service/StandardControllerServiceNode.java | 2 +-
.../flow/mapping/NiFiRegistryFlowMapper.java | 54 +-
.../apache/nifi/util/FlowDifferenceFilters.java | 4 +-
.../controller/service/ControllerServiceNode.java | 2 +-
.../apache/nifi/controller/ExtensionBuilder.java | 1696 ++--
.../async/nio/NioAsyncLoadBalanceClient.java | 18 +-
.../clustered/client/async/nio/PeerChannel.java | 2 +-
.../serialization/RunningComponentSetFilter.java | 2 +-
.../tasks/ProcessorTimingDiagnosticTask.java | 2 +-
.../validation/StandardRuleViolationsManager.java | 2 +-
.../controller/DummyPrimaryNodeOnlyProcessor.java | 10 +-
.../repository/StandardProcessSessionIT.java | 2 +-
.../repository/TestFileSystemRepository.java | 4 +-
...ComponentStatusRepositoryForComponentsTest.java | 392 +-
.../status/history/ConnectionStatusDescriptor.java | 8 +-
.../status/history/NodeStatusDescriptor.java | 70 +-
.../history/ProcessGroupStatusDescriptor.java | 8 +-
.../status/history/ProcessorStatusDescriptor.java | 390 +-
.../RemoteProcessGroupStatusDescriptor.java | 44 +-
.../java/org/apache/nifi/nar/NarClassLoaders.java | 4 +-
.../nifi/remote/PeerDescriptionModifier.java | 18 +-
.../org/apache/nifi/audit/ProcessGroupAuditor.java | 38 -
.../org/apache/nifi/audit/ProcessorAuditor.java | 18 +-
.../AuthorizeControllerServiceReference.java | 2 +-
.../apache/nifi/web/StandardNiFiServiceFacade.java | 11 +-
.../java/org/apache/nifi/web/api/FlowResource.java | 25 +-
.../nifi/web/api/RemoteProcessGroupResource.java | 8 +-
.../org/apache/nifi/web/api/dto/DtoFactory.java | 8982 ++++++++++----------
.../metrics/JsonFormatPrometheusMetricsWriter.java | 2 +-
.../apache/nifi/audit/TestProcessGroupAuditor.java | 137 +-
.../nifi/web/StandardNiFiServiceFacadeTest.java | 8 +-
.../nifi/web/api/TestDataTransferResource.java | 4 +-
.../org/apache/nifi/web/api/TestFlowResource.java | 89 +-
.../metrics/jmx/JmxMetricsResultConverterTest.java | 8 +-
.../jwt/key/StandardJWSVerifierFactory.java | 2 +-
.../StandardAuthorizedClientConverter.java | 2 +-
.../org/apache/nifi/util/MockProcessContext.java | 28 +-
.../org/apache/nifi/util/MockPropertyValue.java | 5 +-
.../main/java/org/apache/nifi/util/TestRunner.java | 4 +-
.../apache/nifi/util/TestMockPropertyValue.java | 30 +-
.../client/impl/JerseyBundleVersionClient.java | 4 +-
.../client/impl/JerseyExtensionClient.java | 6 +-
.../client/impl/JerseyExtensionRepoClient.java | 4 +-
.../registry/extension/bundle/BundleVersion.java | 2 +-
.../org/apache/nifi/registry/link/LinkAdapter.java | 2 +-
.../apache/nifi/registry/event/EventFactory.java | 2 +-
.../file/FileAccessPolicyProvider.java | 4 +-
.../extension/docs/HtmlExtensionDocWriter.java | 4 +-
.../registry/db/TestDatabaseMetadataService.java | 2 +-
.../ldap/tenants/LdapUserGroupProviderTest.java | 142 +-
.../org/apache/nifi/registry/util/DataUnit.java | 300 +-
.../registry/web/api/AccessPolicyResource.java | 28 +-
.../registry/web/api/BucketBundleResource.java | 8 +-
.../nifi/registry/web/api/BucketFlowResource.java | 52 +-
.../nifi/registry/web/api/BucketResource.java | 16 +-
.../nifi/registry/web/api/BundleResource.java | 40 +-
.../nifi/registry/web/api/ConfigResource.java | 4 +-
.../registry/web/api/ExtensionRepoResource.java | 40 +-
.../apache/nifi/registry/web/api/FlowResource.java | 20 +-
.../apache/nifi/registry/web/api/ItemResource.java | 4 +-
.../nifi/registry/web/api/TenantResource.java | 40 +-
.../registry/NiFiRegistryTestApiApplication.java | 10 +-
.../engine/StatelessEngineConfiguration.java | 2 +-
.../apache/nifi/stateless/StatelessSystemIT.java | 4 +-
.../nifi/stateless/VersionedFlowBuilder.java | 12 +-
.../tests/system/PropertiesParameterProvider.java | 2 +-
.../tests/system/GenerateAndCountCallbacks.java | 20 +-
.../cli/impl/client/NiFiRegistryClientFactory.java | 3 +-
.../command/nifi/pg/cs/ControllerServiceUtil.java | 28 +-
242 files changed, 8584 insertions(+), 8860 deletions(-)
diff --git a/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/LegacyC2UrlProvider.java b/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/LegacyC2UrlProvider.java
index 9040754486..19f41168c0 100644
--- a/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/LegacyC2UrlProvider.java
+++ b/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/LegacyC2UrlProvider.java
@@ -49,8 +49,8 @@ public class LegacyC2UrlProvider implements C2UrlProvider {
return Optional.ofNullable(absoluteUrl)
.filter(StringUtils::isNotBlank)
.orElseThrow( () -> {
- LOG.error("Provided absolute url was empty or null. Relative urls are not supported with this configuration");
- throw new IllegalArgumentException("Provided absolute url was empty or null. Relative C2 urls are not supported with this configuration");
+ LOG.error("Provided absolute url was empty or null. Relative urls are not supported with this configuration");
+ throw new IllegalArgumentException("Provided absolute url was empty or null. Relative C2 urls are not supported with this configuration");
});
}
}
diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/C2HeartbeatManager.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/C2HeartbeatManager.java
index 6840a84981..ce3758fd70 100644
--- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/C2HeartbeatManager.java
+++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/C2HeartbeatManager.java
@@ -72,9 +72,9 @@ public class C2HeartbeatManager implements Runnable {
ofNullable(response.getRequestedOperations())
.filter(not(List::isEmpty))
.ifPresentOrElse(operations -> {
- LOGGER.info("Received {} operations from the C2 server", operations.size());
- operations.forEach(c2OperationManager::add);
- },
+ LOGGER.info("Received {} operations from the C2 server", operations.size());
+ operations.forEach(c2OperationManager::add);
+ },
() -> LOGGER.debug("No operations received from the C2 server")
);
}
diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StartFlowOperationHandler.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StartFlowOperationHandler.java
index 478e6b1b7d..d06c143b08 100644
--- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StartFlowOperationHandler.java
+++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StartFlowOperationHandler.java
@@ -64,12 +64,12 @@ public class StartFlowOperationHandler implements C2OperationHandler {
C2OperationState resultState = operationState(
operationState,
- switch (operationState) {
- case NOT_APPLIED -> NOT_APPLIED_DETAILS;
- case FULLY_APPLIED -> FULLY_APPLIED_DETAILS;
- case PARTIALLY_APPLIED -> PARTIALLY_APPLIED_DETAILS;
- default -> UNEXPECTED_DETAILS;
- }
+ switch (operationState) {
+ case NOT_APPLIED -> NOT_APPLIED_DETAILS;
+ case FULLY_APPLIED -> FULLY_APPLIED_DETAILS;
+ case PARTIALLY_APPLIED -> PARTIALLY_APPLIED_DETAILS;
+ default -> UNEXPECTED_DETAILS;
+ }
);
return operationAck(operationId, resultState);
diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StopFlowOperationHandler.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StopFlowOperationHandler.java
index 29afb6e0ab..f94cc271c0 100644
--- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StopFlowOperationHandler.java
+++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/StopFlowOperationHandler.java
@@ -64,12 +64,12 @@ public class StopFlowOperationHandler implements C2OperationHandler {
C2OperationState resultState = operationState(
operationState,
- switch (operationState) {
- case NOT_APPLIED -> NOT_APPLIED_DETAILS;
- case FULLY_APPLIED -> FULLY_APPLIED_DETAILS;
- case PARTIALLY_APPLIED -> PARTIALLY_APPLIED_DETAILS;
- default -> UNEXPECTED_DETAILS;
- }
+ switch (operationState) {
+ case NOT_APPLIED -> NOT_APPLIED_DETAILS;
+ case FULLY_APPLIED -> FULLY_APPLIED_DETAILS;
+ case PARTIALLY_APPLIED -> PARTIALLY_APPLIED_DETAILS;
+ default -> UNEXPECTED_DETAILS;
+ }
);
return operationAck(operationId, resultState);
diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SyncResourceOperationHandler.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SyncResourceOperationHandler.java
index 01153be856..a2d05eca99 100644
--- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SyncResourceOperationHandler.java
+++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SyncResourceOperationHandler.java
@@ -98,7 +98,7 @@ public class SyncResourceOperationHandler implements C2OperationHandler {
List<ResourceItem> resourceItems;
try {
- resourceItems = getOperationArg(operation, RESOURCE_LIST_FIELD, new TypeReference<>() { }, c2Serializer);
+ resourceItems = getOperationArg(operation, RESOURCE_LIST_FIELD, new TypeReference<>() { }, c2Serializer);
} catch (Exception e) {
LOG.error("Resource item list could not be constructed from C2 request");
diff --git a/checkstyle.xml b/checkstyle.xml
index 41ca359774..8c3850ef38 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -87,5 +87,14 @@
<property name="allowedAnnotations" value="Override,Test,BeforeClass,AfterClass,Before,After"/>
</module>
<module name="SingleLineJavadoc"/>
+ <module name="Indentation">
+ <property name="basicOffset" value="4"/>
+ <property name="braceAdjustment" value="0"/>
+ <property name="caseIndent" value="4"/>
+ <property name="throwsIndent" value="4"/>
+ <property name="lineWrappingIndentation" value="4"/>
+ <property name="arrayInitIndent" value="8"/>
+ </module>
+ <module name="CommentsIndentation"/>
</module>
</module>
diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/CommandRunnerFactory.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/CommandRunnerFactory.java
index b39a6702df..ac9b7dadb9 100644
--- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/CommandRunnerFactory.java
+++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/CommandRunnerFactory.java
@@ -78,10 +78,10 @@ public class CommandRunnerFactory {
public CommandRunner getRunner(BootstrapCommand command) {
CommandRunner commandRunner = switch (command) {
case START, RUN ->
- new StartRunner(currentPortProvider, bootstrapFileProvider, periodicStatusReporterManager, miNiFiStdLogHandler, miNiFiParameters,
- bootstrapConfigFile, runMiNiFi, miNiFiExecCommandProvider, configurationChangeListener);
+ new StartRunner(currentPortProvider, bootstrapFileProvider, periodicStatusReporterManager, miNiFiStdLogHandler, miNiFiParameters,
+ bootstrapConfigFile, runMiNiFi, miNiFiExecCommandProvider, configurationChangeListener);
case STOP ->
- new StopRunner(bootstrapFileProvider, miNiFiParameters, miNiFiCommandSender, currentPortProvider, gracefulShutdownParameterProvider, processUtils);
+ new StopRunner(bootstrapFileProvider, miNiFiParameters, miNiFiCommandSender, currentPortProvider, gracefulShutdownParameterProvider, processUtils);
case STATUS -> new StatusRunner(miNiFiParameters, miNiFiStatusProvider);
case RESTART -> new CompositeCommandRunner(getRestartServices());
case DUMP -> new DumpRunner(miNiFiCommandSender, currentPortProvider);
diff --git a/minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyAssetReferenceResolverService.java b/minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyAssetReferenceResolverService.java
index e056984f4c..2321766893 100644
--- a/minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyAssetReferenceResolverService.java
+++ b/minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyAssetReferenceResolverService.java
@@ -49,7 +49,7 @@ public class StandardFlowPropertyAssetReferenceResolverService implements FlowPr
component.getProperties().entrySet().stream()
.filter(e -> isAssetReference(e.getValue()))
.forEach(entry -> entry.setValue(getAssetAbsolutePathOrThrowIllegalStateException(entry.getValue())));
- });
+ });
}
private boolean isAssetReference(String value) {
diff --git a/minifi/minifi-commons/minifi-commons-framework/src/test/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyEncryptorTest.java b/minifi/minifi-commons/minifi-commons-framework/src/test/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyEncryptorTest.java
index e86964605e..511862bc39 100644
--- a/minifi/minifi-commons/minifi-commons-framework/src/test/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyEncryptorTest.java
+++ b/minifi/minifi-commons/minifi-commons-framework/src/test/java/org/apache/nifi/minifi/commons/service/StandardFlowPropertyEncryptorTest.java
@@ -309,12 +309,11 @@ public class StandardFlowPropertyEncryptorTest {
.map(VersionedConfigurableExtension::getProperties)
.flatMap(properties -> properties.entrySet().stream())
.forEach(propertyEntry -> {
- if (propertyEntry.getKey().startsWith(SENSITIVE_PROPERTY_NAME_PREFIX)) {
- assertTrue(propertyEntry.getValue().startsWith(FlowSerializer.ENC_PREFIX));
- } else {
- assertFalse(propertyEntry.getValue().startsWith(FlowSerializer.ENC_PREFIX));
- }
+ if (propertyEntry.getKey().startsWith(SENSITIVE_PROPERTY_NAME_PREFIX)) {
+ assertTrue(propertyEntry.getValue().startsWith(FlowSerializer.ENC_PREFIX));
+ } else {
+ assertFalse(propertyEntry.getValue().startsWith(FlowSerializer.ENC_PREFIX));
}
- );
+ });
}
}
diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/AgentPropertyValidationContext.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/AgentPropertyValidationContext.java
index 173e3fc52d..c63e568954 100644
--- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/AgentPropertyValidationContext.java
+++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/AgentPropertyValidationContext.java
@@ -29,83 +29,83 @@ import org.apache.nifi.expression.ExpressionLanguageCompiler;
public class AgentPropertyValidationContext implements ValidationContext {
- @Override
- public boolean isExpressionLanguageSupported(String propertyName) {
- return false;
- }
-
- @Override
- public Map<PropertyDescriptor, String> getProperties() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Map<String, String> getAllProperties() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ControllerServiceLookup getControllerServiceLookup() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ValidationContext getControllerServiceValidationContext(ControllerService controllerService) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ExpressionLanguageCompiler newExpressionLanguageCompiler() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public PropertyValue newPropertyValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getAnnotationData() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isValidationRequired(ControllerService service) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isExpressionLanguagePresent(String value) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getProcessGroupIdentifier() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Collection<String> getReferencedParameters(String propertyName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isParameterDefined(String parameterName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isParameterSet(String parameterName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isDependencySatisfied(PropertyDescriptor propertyDescriptor, Function<String, PropertyDescriptor> propertyDescriptorLookup) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public PropertyValue getProperty(PropertyDescriptor descriptor) {
- throw new UnsupportedOperationException();
- }
+ @Override
+ public boolean isExpressionLanguageSupported(String propertyName) {
+ return false;
+ }
+
+ @Override
+ public Map<PropertyDescriptor, String> getProperties() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Map<String, String> getAllProperties() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ControllerServiceLookup getControllerServiceLookup() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ValidationContext getControllerServiceValidationContext(ControllerService controllerService) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ExpressionLanguageCompiler newExpressionLanguageCompiler() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public PropertyValue newPropertyValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getAnnotationData() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isValidationRequired(ControllerService service) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isExpressionLanguagePresent(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getProcessGroupIdentifier() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<String> getReferencedParameters(String propertyName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isParameterDefined(String parameterName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isParameterSet(String parameterName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isDependencySatisfied(PropertyDescriptor propertyDescriptor, Function<String, PropertyDescriptor> propertyDescriptorLookup) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public PropertyValue getProperty(PropertyDescriptor descriptor) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/validator/FlowValidator.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/validator/FlowValidator.java
index cabf7e4bdd..864bd0d03e 100644
--- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/validator/FlowValidator.java
+++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/validator/FlowValidator.java
@@ -81,10 +81,10 @@ public final class FlowValidator {
ASYNC_LOADING_COMPONENT_INIT_MAX_RETRIES,
ASYNC_LOADING_COMPONENT_INIT_RETRY_PAUSE_DURATION_MS
)
- .ifPresent(components -> {
- LOGGER.error("The following components are async loading components and are still initializing: {}", components);
- throw new IllegalStateException("Maximum retry number exceeded while waiting for async loading components to be initialized");
- });
+ .ifPresent(components -> {
+ LOGGER.error("The following components are async loading components and are still initializing: {}", components);
+ throw new IllegalStateException("Maximum retry number exceeded while waiting for async loading components to be initialized");
+ });
}
private static List<? extends ComponentNode> initializingAsyncLoadingComponents(List<? extends ComponentNode> componentNodes) {
@@ -102,9 +102,9 @@ public final class FlowValidator {
CONTROLLER_SERVICE_ENABLEMENT_MAX_RETRIES,
CONTROLLER_SERVICE_ENABLEMENT_RETRY_PAUSE_DURATION_MS
)
- .ifPresent(controllerServices -> {
- LOGGER.error("The following controller services are still in ENABLING state: {}", controllerServices);
- });
+ .ifPresent(controllerServices -> {
+ LOGGER.error("The following controller services are still in ENABLING state: {}", controllerServices);
+ });
}
private static List<? extends ComponentNode> controllerServicesInEnablingState(List<? extends ComponentNode> componentNodes) {
@@ -120,10 +120,10 @@ public final class FlowValidator {
VALIDATION_MAX_RETRIES,
VALIDATION_RETRY_PAUSE_DURATION_MS
)
- .ifPresent(components -> {
- LOGGER.error("The following components are still in VALIDATING state: {}", components);
- throw new IllegalStateException("Maximum retry number exceeded while waiting for components to be validated");
- });
+ .ifPresent(components -> {
+ LOGGER.error("The following components are still in VALIDATING state: {}", components);
+ throw new IllegalStateException("Maximum retry number exceeded while waiting for components to be validated");
+ });
}
private static List<? extends ComponentNode> componentsInValidatingState(List<? extends ComponentNode> componentNodes) {
diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/test/java/org/apache/nifi/minifi/c2/command/syncresource/DefaultSyncResourceStrategyTest.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/test/java/org/apache/nifi/minifi/c2/command/syncresource/DefaultSyncResourceStrategyTest.java
index 0717ca5f74..645db14cc3 100644
--- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/test/java/org/apache/nifi/minifi/c2/command/syncresource/DefaultSyncResourceStrategyTest.java
+++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/test/java/org/apache/nifi/minifi/c2/command/syncresource/DefaultSyncResourceStrategyTest.java
@@ -88,7 +88,7 @@ public class DefaultSyncResourceStrategyTest {
final Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
try (DirectoryStream<Path> directoryStream = newDirectoryStream(tempDir, "[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*[0-9]*.tmp")) {
for (Path tmpFile : directoryStream) {
- Files.deleteIfExists(tmpFile);
+ Files.deleteIfExists(tmpFile);
}
} catch (Exception ignored) {
}
diff --git a/minifi/minifi-nar-bundles/minifi-provenance-repository-bundle/minifi-provenance-repositories/src/main/java/org/apache/nifi/provenance/NoOpProvenanceRepository.java b/minifi/minifi-nar-bundles/minifi-provenance-repository-bundle/minifi-provenance-repositories/src/main/java/org/apache/nifi/provenance/NoOpProvenanceRepository.java
index 2327cf9978..f413ae482b 100644
--- a/minifi/minifi-nar-bundles/minifi-provenance-repository-bundle/minifi-provenance-repositories/src/main/java/org/apache/nifi/provenance/NoOpProvenanceRepository.java
+++ b/minifi/minifi-nar-bundles/minifi-provenance-repository-bundle/minifi-provenance-repositories/src/main/java/org/apache/nifi/provenance/NoOpProvenanceRepository.java
@@ -1,19 +1,19 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.nifi.provenance;
import org.apache.nifi.authorization.Authorizer;
@@ -32,140 +32,140 @@ import static java.util.Collections.EMPTY_SET;
import static java.util.Collections.emptyList;
/**
- * Implementation of {@link ProvenanceRepository} that does not
- * store events.
- *
- */
+ * Implementation of {@link ProvenanceRepository} that does not
+ * store events.
+ *
+ */
public class NoOpProvenanceRepository implements ProvenanceRepository {
- @Override
- public void initialize(EventReporter eventReporter, Authorizer authorizer,
- ProvenanceAuthorizableFactory factory, IdentifierLookup identifierLookup)
- throws IOException {
-
- }
-
- @Override
- public void close() throws IOException {
-
- }
-
- @Override
- public ProvenanceEventBuilder eventBuilder() {
- return new StandardProvenanceEventRecord.Builder();
- }
-
- @Override
- public ProvenanceEventRecord getEvent(long id) throws IOException {
- return null;
- }
-
- @Override
- public ProvenanceEventRecord getEvent(final long id, final NiFiUser user) throws IOException {
- return null;
- }
-
- @Override
- public List<ProvenanceEventRecord> getEvents(long firstRecordId, int maxRecords)
- throws IOException {
- return emptyList();
- }
-
- @Override
- public List<ProvenanceEventRecord> getEvents(long firstRecordId,
- int maxRecords, NiFiUser niFiUser) throws IOException {
- return emptyList();
- }
-
- @Override
- public Long getMaxEventId() {
- return null;
- }
-
- @Override
- public void registerEvent(ProvenanceEventRecord records) {
-
- }
-
- @Override
- public void registerEvents(Iterable<ProvenanceEventRecord> records) {
-
- }
-
- @Override
- public ProvenanceEventRepository getProvenanceEventRepository() {
- return this;
- }
-
- @Override
- public QuerySubmission submitQuery(Query query, NiFiUser niFiUser) {
- return null;
- }
-
- @Override
- public List<ProvenanceEventRecord> getLatestCachedEvents(final String componentId, final int eventLimit) {
- return List.of();
- }
-
- @Override
- public QuerySubmission retrieveQuerySubmission(String queryIdentifier, NiFiUser niFiUser) {
- return null;
- }
-
- @Override
- public ComputeLineageSubmission submitLineageComputation(String s, NiFiUser niFiUser) {
- return null;
- }
-
- @Override
- public ComputeLineageSubmission submitLineageComputation(long eventId, NiFiUser user) {
- return null;
- }
-
- @Override
- public List<SearchableField> getSearchableFields() {
- return null;
- }
-
- @Override
- public List<SearchableField> getSearchableAttributes() {
- return null;
- }
-
- @Override
- public Set<String> getContainerNames() {
- return EMPTY_SET;
- }
-
- @Override
- public long getContainerCapacity(String s) throws IOException {
- return 0;
- }
-
- @Override
- public String getContainerFileStoreName(String s) {
- return null;
- }
-
- @Override
- public long getContainerUsableSpace(String s) throws IOException {
- return 0;
- }
-
- @Override
- public AsyncLineageSubmission retrieveLineageSubmission(final String lineageIdentifier,
- final NiFiUser user) {
- return null;
- }
-
- @Override
- public AsyncLineageSubmission submitExpandParents(final long eventId, final NiFiUser user) {
- return null;
- }
-
- @Override
- public AsyncLineageSubmission submitExpandChildren(final long eventId, final NiFiUser user) {
- return null;
- }
+ @Override
+ public void initialize(EventReporter eventReporter, Authorizer authorizer,
+ ProvenanceAuthorizableFactory factory, IdentifierLookup identifierLookup)
+ throws IOException {
+
+ }
+
+ @Override
+ public void close() throws IOException {
+
+ }
+
+ @Override
+ public ProvenanceEventBuilder eventBuilder() {
+ return new StandardProvenanceEventRecord.Builder();
+ }
+
+ @Override
+ public ProvenanceEventRecord getEvent(long id) throws IOException {
+ return null;
+ }
+
+ @Override
+ public ProvenanceEventRecord getEvent(final long id, final NiFiUser user) throws IOException {
+ return null;
+ }
+
+ @Override
+ public List<ProvenanceEventRecord> getEvents(long firstRecordId, int maxRecords)
+ throws IOException {
+ return emptyList();
+ }
+
+ @Override
+ public List<ProvenanceEventRecord> getEvents(long firstRecordId,
+ int maxRecords, NiFiUser niFiUser) throws IOException {
+ return emptyList();
+ }
+
+ @Override
+ public Long getMaxEventId() {
+ return null;
+ }
+
+ @Override
+ public void registerEvent(ProvenanceEventRecord records) {
+
+ }
+
+ @Override
+ public void registerEvents(Iterable<ProvenanceEventRecord> records) {
+
+ }
+
+ @Override
+ public ProvenanceEventRepository getProvenanceEventRepository() {
+ return this;
+ }
+
+ @Override
+ public QuerySubmission submitQuery(Query query, NiFiUser niFiUser) {
+ return null;
+ }
+
+ @Override
+ public List<ProvenanceEventRecord> getLatestCachedEvents(final String componentId, final int eventLimit) {
+ return List.of();
+ }
+
+ @Override
+ public QuerySubmission retrieveQuerySubmission(String queryIdentifier, NiFiUser niFiUser) {
+ return null;
+ }
+
+ @Override
+ public ComputeLineageSubmission submitLineageComputation(String s, NiFiUser niFiUser) {
+ return null;
+ }
+
+ @Override
+ public ComputeLineageSubmission submitLineageComputation(long eventId, NiFiUser user) {
+ return null;
+ }
+
+ @Override
+ public List<SearchableField> getSearchableFields() {
+ return null;
+ }
+
+ @Override
+ public List<SearchableField> getSearchableAttributes() {
+ return null;
+ }
+
+ @Override
+ public Set<String> getContainerNames() {
+ return EMPTY_SET;
+ }
+
+ @Override
+ public long getContainerCapacity(String s) throws IOException {
+ return 0;
+ }
+
+ @Override
+ public String getContainerFileStoreName(String s) {
+ return null;
+ }
+
+ @Override
+ public long getContainerUsableSpace(String s) throws IOException {
+ return 0;
+ }
+
+ @Override
+ public AsyncLineageSubmission retrieveLineageSubmission(final String lineageIdentifier,
+ final NiFiUser user) {
+ return null;
+ }
+
+ @Override
+ public AsyncLineageSubmission submitExpandParents(final long eventId, final NiFiUser user) {
+ return null;
+ }
+
+ @Override
+ public AsyncLineageSubmission submitExpandChildren(final long eventId, final NiFiUser user) {
+ return null;
+ }
}
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
index 1a17d9fa49..c78e7799ec 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
@@ -514,10 +514,10 @@ public class ExpressionCompiler {
return switch (evaluator.getResultType()) {
case WHOLE_NUMBER -> (Evaluator<Long>) evaluator;
case STRING, DATE, INSTANT, DECIMAL, NUMBER ->
- addToken(new WholeNumberCastEvaluator(evaluator), evaluator.getToken());
+ addToken(new WholeNumberCastEvaluator(evaluator), evaluator.getToken());
default ->
- throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.WHOLE_NUMBER
- + (location == null ? "" : " at location [" + location + "]"));
+ throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.WHOLE_NUMBER
+ + (location == null ? "" : " at location [" + location + "]"));
};
}
@@ -530,10 +530,10 @@ public class ExpressionCompiler {
return switch (evaluator.getResultType()) {
case DECIMAL -> (Evaluator<Double>) evaluator;
case WHOLE_NUMBER, STRING, DATE, NUMBER ->
- addToken(new DecimalCastEvaluator(evaluator), evaluator.getToken());
+ addToken(new DecimalCastEvaluator(evaluator), evaluator.getToken());
default ->
- throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.DECIMAL
- + (location == null ? "" : " at location [" + location + "]"));
+ throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.DECIMAL
+ + (location == null ? "" : " at location [" + location + "]"));
};
}
@@ -546,10 +546,10 @@ public class ExpressionCompiler {
return switch (evaluator.getResultType()) {
case NUMBER -> (Evaluator<Number>) evaluator;
case STRING, DATE, INSTANT, DECIMAL, WHOLE_NUMBER ->
- addToken(new NumberCastEvaluator(evaluator), evaluator.getToken());
+ addToken(new NumberCastEvaluator(evaluator), evaluator.getToken());
default ->
- throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.WHOLE_NUMBER
- + (location == null ? "" : " at location [" + location + "]"));
+ throw new AttributeExpressionLanguageParsingException("Cannot implicitly convert Data Type " + evaluator.getResultType() + " to " + ResultType.WHOLE_NUMBER
+ + (location == null ? "" : " at location [" + location + "]"));
};
}
@@ -882,10 +882,10 @@ public class ExpressionCompiler {
verifyArgCount(argEvaluators, 0, "toNumber");
return switch (subjectEvaluator.getResultType()) {
case STRING, WHOLE_NUMBER, DECIMAL, NUMBER, DATE, INSTANT ->
- addToken(toWholeNumberEvaluator(subjectEvaluator), "toNumber");
+ addToken(toWholeNumberEvaluator(subjectEvaluator), "toNumber");
default ->
- throw new AttributeExpressionLanguageParsingException(subjectEvaluator + " returns type " + subjectEvaluator.getResultType() + " but expected to get " + ResultType.STRING +
- ", " + ResultType.DECIMAL + ", or " + ResultType.DATE);
+ throw new AttributeExpressionLanguageParsingException(subjectEvaluator + " returns type " + subjectEvaluator.getResultType() + " but expected to get " + ResultType.STRING +
+ ", " + ResultType.DECIMAL + ", or " + ResultType.DATE);
};
}
// fallthrough
@@ -893,10 +893,10 @@ public class ExpressionCompiler {
verifyArgCount(argEvaluators, 0, "toDecimal");
return switch (subjectEvaluator.getResultType()) {
case WHOLE_NUMBER, DECIMAL, STRING, NUMBER, DATE, INSTANT ->
- addToken(toDecimalEvaluator(subjectEvaluator), "toDecimal");
+ addToken(toDecimalEvaluator(subjectEvaluator), "toDecimal");
default ->
- throw new AttributeExpressionLanguageParsingException(subjectEvaluator + " returns type " + subjectEvaluator.getResultType() + " but expected to get " + ResultType.STRING +
- ", " + ResultType.WHOLE_NUMBER + ", or " + ResultType.DATE);
+ throw new AttributeExpressionLanguageParsingException(subjectEvaluator + " returns type " + subjectEvaluator.getResultType() + " but expected to get " + ResultType.STRING +
+ ", " + ResultType.WHOLE_NUMBER + ", or " + ResultType.DATE);
};
}
// fallthrough
@@ -976,7 +976,7 @@ public class ExpressionCompiler {
}
}
case FORMAT_INSTANT: {
- if (argEvaluators.size() == 2) {
+ if (argEvaluators.size() == 2) {
return addToken(new InstantFormatEvaluator(toInstantEvaluator(subjectEvaluator), toStringEvaluator(argEvaluators.get(0)), toStringEvaluator(argEvaluators.get(1))), "format");
} else {
throw new AttributeExpressionLanguageParsingException("format() function takes 2 arguments");
@@ -1158,7 +1158,7 @@ public class ExpressionCompiler {
yield addToken(new MultiNamedAttributeEvaluator(attributeNames, ALL_ATTRIBUTES), "allAttributes");
}
case ALL_MATCHING_ATTRIBUTES ->
- addToken(new MultiMatchAttributeEvaluator(attributeNames, ALL_MATCHING_ATTRIBUTES), "allMatchingAttributes");
+ addToken(new MultiMatchAttributeEvaluator(attributeNames, ALL_MATCHING_ATTRIBUTES), "allMatchingAttributes");
case ANY_ATTRIBUTE -> {
for (final String attributeName : attributeNames) {
try {
@@ -1170,9 +1170,9 @@ public class ExpressionCompiler {
yield addToken(new MultiNamedAttributeEvaluator(attributeNames, ANY_ATTRIBUTE), "anyAttribute");
}
case ANY_MATCHING_ATTRIBUTE ->
- addToken(new MultiMatchAttributeEvaluator(attributeNames, ANY_MATCHING_ATTRIBUTE), "anyMatchingAttribute");
+ addToken(new MultiMatchAttributeEvaluator(attributeNames, ANY_MATCHING_ATTRIBUTE), "anyMatchingAttribute");
default ->
- throw new AssertionError("Illegal Multi-Attribute Reference: " + functionTypeTree.toString());
+ throw new AssertionError("Illegal Multi-Attribute Reference: " + functionTypeTree.toString());
};
}
case ATTR_NAME: {
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/CharSequenceTranslatorEvaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/CharSequenceTranslatorEvaluator.java
index 8920b244a2..b3deb1c4c5 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/CharSequenceTranslatorEvaluator.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/CharSequenceTranslatorEvaluator.java
@@ -26,43 +26,43 @@ import org.apache.nifi.attribute.expression.language.evaluation.StringQueryResul
public class CharSequenceTranslatorEvaluator extends StringEvaluator {
public static StringEvaluator jsonEscapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_JSON);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_JSON);
}
public static StringEvaluator xmlEscapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_XML10);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_XML10);
}
public static StringEvaluator csvEscapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_CSV);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_CSV);
}
public static StringEvaluator html3EscapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_HTML3);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_HTML3);
}
public static StringEvaluator html4EscapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_HTML4);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.ESCAPE_HTML4);
}
public static StringEvaluator jsonUnescapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_JSON);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_JSON);
}
public static StringEvaluator xmlUnescapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_XML);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_XML);
}
public static StringEvaluator csvUnescapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_CSV);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_CSV);
}
public static StringEvaluator html3UnescapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_HTML3);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_HTML3);
}
public static StringEvaluator html4UnescapeEvaluator(final Evaluator<String> subject) {
- return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_HTML4);
+ return new CharSequenceTranslatorEvaluator(subject, StringEscapeUtils.UNESCAPE_HTML4);
}
private final Evaluator<String> subject;
diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/Uuid5Evaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/Uuid5Evaluator.java
index 3fd3a3706d..1ef3e67483 100644
--- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/Uuid5Evaluator.java
+++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/Uuid5Evaluator.java
@@ -36,15 +36,15 @@ public class Uuid5Evaluator extends StringEvaluator {
@Override
public QueryResult<String> evaluate(final EvaluationContext evaluationContext) {
- final String subjectValue = subject.evaluate(evaluationContext).getValue();
- if (subjectValue == null) {
- return new StringQueryResult(null);
- }
- final String nsValue = namespace.evaluate(evaluationContext).getValue();
+ final String subjectValue = subject.evaluate(evaluationContext).getValue();
+ if (subjectValue == null) {
+ return new StringQueryResult(null);
+ }
+ final String nsValue = namespace.evaluate(evaluationContext).getValue();
- String uuid = Uuid5Util.fromString(subjectValue, nsValue);
+ String uuid = Uuid5Util.fromString(subjectValue, nsValue);
- return new StringQueryResult(uuid);
+ return new StringQueryResult(uuid);
}
@Override
diff --git a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
index 30eeb8160c..e2a9fad312 100644
--- a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
+++ b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
@@ -486,10 +486,9 @@ public class TestQuery {
phoneBookAttributes.stream()
.filter(currentAttribute -> !currentAttribute.equals(updatedAttribute))
.forEach(currentAttribute -> {
- String expected = Query.evaluateExpressions(currentAttribute, originalAttributes, null, null, ParameterLookup.EMPTY);
- verifyEquals(currentAttribute, attributes, expected);
- }
- );
+ String expected = Query.evaluateExpressions(currentAttribute, originalAttributes, null, null, ParameterLookup.EMPTY);
+ verifyEquals(currentAttribute, attributes, expected);
+ });
if (!ADDRESS_BOOK_JSON_PATH_EMPTY.equals(updatedAttribute) ) {
verifyEquals(updatedAttribute, attributes, updatedValue);
}
@@ -525,7 +524,7 @@ public class TestQuery {
@Test
public void testJsonPathDeleteMissingPath() throws IOException {
- verifyJsonPathExpressions(
+ verifyJsonPathExpressions(
ADDRESS_BOOK_JSON_PATH_EMPTY,
"",
"${json:jsonPathDelete('$.missing-path')}",
@@ -603,7 +602,7 @@ public class TestQuery {
"",
"${json:jsonPathAdd('$.missing-path', 'Jimmy')}",
"");
- verifyEquals("${json:jsonPath('$.missing-path')}", attributes, "");
+ verifyEquals("${json:jsonPath('$.missing-path')}", attributes, "");
}
@Test
@@ -2333,7 +2332,7 @@ public class TestQuery {
attributes.put("string", "special ♣");
verifyEquals("${string:escapeHtml4()}", attributes, "special ♣");
- }
+ }
@Test
public void testUnescapeFunctions() {
diff --git a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
index 70777c6d00..0dfd0347e6 100644
--- a/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
+++ b/nifi-commons/nifi-hl7-query-language/src/main/java/org/apache/nifi/hl7/query/HL7Query.java
@@ -218,26 +218,26 @@ public class HL7Query {
return switch (tree.getType()) {
case EQUALS ->
- new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new EqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case NOT_EQUALS ->
- new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new NotEqualsEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case GT ->
- new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new GreaterThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case LT ->
- new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new LessThanEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case GE ->
- new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new GreaterThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case LE ->
- new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
+ new LessThanOrEqualEvaluator(buildReferenceEvaluator(tree.getChild(0)), buildReferenceEvaluator(tree.getChild(1)));
case NOT -> new NotEvaluator(buildBooleanEvaluator(tree.getChild(0)));
case AND ->
- new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
+ new AndEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
case OR ->
- new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
+ new OrEvaluator(buildBooleanEvaluator(tree.getChild(0)), buildBooleanEvaluator(tree.getChild(1)));
case IS_NULL -> new IsNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
case NOT_NULL -> new NotNullEvaluator(buildReferenceEvaluator(tree.getChild(0)));
default ->
- throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'");
+ throw new HL7QueryParsingException("Cannot build boolean evaluator for '" + tree.getText() + "'");
};
}
diff --git a/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/properties/AbstractBootstrapPropertiesLoader.java b/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/properties/AbstractBootstrapPropertiesLoader.java
index 1132d01eba..20bc9f5a53 100644
--- a/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/properties/AbstractBootstrapPropertiesLoader.java
+++ b/nifi-commons/nifi-property-utils/src/main/java/org/apache/nifi/properties/AbstractBootstrapPropertiesLoader.java
@@ -60,7 +60,7 @@ public abstract class AbstractBootstrapPropertiesLoader {
*/
public BootstrapProperties loadBootstrapProperties(final String bootstrapPath) throws IOException {
final Path bootstrapFilePath = getBootstrapFile(bootstrapPath).toPath();
- return loadBootstrapProperties(bootstrapFilePath, getApplicationPrefix());
+ return loadBootstrapProperties(bootstrapFilePath, getApplicationPrefix());
}
/**
diff --git a/nifi-commons/nifi-property-utils/src/test/java/org/apache/nifi/util/StringUtilsTest.java b/nifi-commons/nifi-property-utils/src/test/java/org/apache/nifi/util/StringUtilsTest.java
index 8b1a39604d..1c4562eec4 100644
--- a/nifi-commons/nifi-property-utils/src/test/java/org/apache/nifi/util/StringUtilsTest.java
+++ b/nifi-commons/nifi-property-utils/src/test/java/org/apache/nifi/util/StringUtilsTest.java
@@ -1,19 +1,19 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.nifi.util;
import org.junit.jupiter.api.Test;
@@ -30,97 +30,97 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class StringUtilsTest {
- @Test
- public void testIsBlank() {
- assertFalse(StringUtils.isBlank("0"));
- assertFalse(StringUtils.isBlank("\u0000"));
- assertFalse(StringUtils.isBlank(" \u0000 "));
- assertFalse(StringUtils.isBlank(" \u5678 "));
-
- assertTrue(StringUtils.isBlank(" "));
- assertTrue(StringUtils.isBlank(""));
- }
-
- @Test
- public void testStartsWith() {
- assertFalse(StringUtils.startsWith("!", "something"));
-
- assertTrue(StringUtils.startsWith("!!!!!test", "!!!!"));
- assertTrue(StringUtils.startsWith("!something", "!"));
- assertTrue(StringUtils.startsWith(null, null));
- }
-
- @Test
- public void testPadRight() {
- assertEquals("sample", StringUtils.rightPad("sample", 0, '0'));
- assertEquals("sample", StringUtils.rightPad("sample", -5, '0'));
- assertEquals("sample0000", StringUtils.rightPad("sample", 10, '0'));
- assertEquals("0000000000", StringUtils.rightPad("", 10, '0'));
- assertEquals("samplexyxy", StringUtils.rightPad("sample", 10, "xy")); // multiple pads
- assertEquals("samplexy", StringUtils.rightPad("sample", 8, "xyz")); // less than 1 pad
- assertEquals("samplexy", StringUtils.rightPad("sample", 8, "xy")); // exactly 1 pad
- assertEquals("sample ", StringUtils.rightPad("sample", 10, null)); // null pad
-
- assertNull(StringUtils.rightPad(null, 0, '0'));
- }
-
- @Test
- public void testPadLeft() {
- assertEquals("sample", StringUtils.leftPad("sample", 0, '0'));
- assertEquals("0000sample", StringUtils.leftPad("sample", 10, '0'));
- assertEquals("0000000000", StringUtils.leftPad("", 10, '0'));
- assertEquals("xyxysample", StringUtils.leftPad("sample", 10, "xy")); // multiple pads
- assertEquals("xysample", StringUtils.leftPad("sample", 8, "xyz")); // less than 1 pad
- assertEquals("xysample", StringUtils.leftPad("sample", 8, "xy")); // exactly 1 pad
- assertEquals(" sample", StringUtils.leftPad("sample", 10, null)); // null pad
-
- assertNull(StringUtils.leftPad(null, 0, '0'));
- }
-
- @Test
- public void testIsEmpty() {
- assertFalse(StringUtils.isEmpty("AAAAAAAA"));
- assertFalse(StringUtils.isEmpty(" "));
-
- assertTrue(StringUtils.isEmpty(""));
- assertTrue(StringUtils.isEmpty(null));
- }
-
- @Test
- public void testSubstringAfter() {
- assertEquals("", StringUtils.substringAfter("", ""));
- assertEquals("", StringUtils.substringAfter("", ">>"));
- assertEquals("after", StringUtils.substringAfter("substring>>after", ">>"));
- assertEquals("after>>another", StringUtils.substringAfter("substring>>after>>another", ">>"));
- assertEquals("", StringUtils.substringAfter("substring>>after", null));
- assertEquals("", StringUtils.substringAfter("substring.after", ">>"));
- }
-
- @Test
- public void testJoin() {
- final List<String> collection = new ArrayList<>();
- assertEquals("", StringUtils.join(collection, ","));
-
- collection.add("test1");
- assertEquals("test1", StringUtils.join(collection, ","));
-
- collection.add("test2");
- assertEquals("test1,test2", StringUtils.join(collection, ","));
-
- collection.add(null);
- assertEquals("test1,test2,null", StringUtils.join(collection, ","));
- }
-
- @Test
- public void testShouldTitleCaseStrings() {
- // Arrange
- List<String> inputs = Arrays.asList(null, "", " leading space", "trailing space ", "multiple spaces", "this is a sentence", "allOneWord", "PREVIOUSLY UPPERCASE");
- List<String> expected = Arrays.asList("", "", "Leading Space", "Trailing Space", "Multiple Spaces", "This Is A Sentence", "Alloneword", "Previously Uppercase");
-
- // Act
- List<String> titleCased = inputs.stream().map(StringUtils::toTitleCase).collect(Collectors.toList());
-
- // Assert
- assertEquals(titleCased, expected);
- }
+ @Test
+ public void testIsBlank() {
+ assertFalse(StringUtils.isBlank("0"));
+ assertFalse(StringUtils.isBlank("\u0000"));
+ assertFalse(StringUtils.isBlank(" \u0000 "));
+ assertFalse(StringUtils.isBlank(" \u5678 "));
+
+ assertTrue(StringUtils.isBlank(" "));
+ assertTrue(StringUtils.isBlank(""));
+ }
+
+ @Test
+ public void testStartsWith() {
+ assertFalse(StringUtils.startsWith("!", "something"));
+
+ assertTrue(StringUtils.startsWith("!!!!!test", "!!!!"));
+ assertTrue(StringUtils.startsWith("!something", "!"));
+ assertTrue(StringUtils.startsWith(null, null));
+ }
+
+ @Test
+ public void testPadRight() {
+ assertEquals("sample", StringUtils.rightPad("sample", 0, '0'));
+ assertEquals("sample", StringUtils.rightPad("sample", -5, '0'));
+ assertEquals("sample0000", StringUtils.rightPad("sample", 10, '0'));
+ assertEquals("0000000000", StringUtils.rightPad("", 10, '0'));
+ assertEquals("samplexyxy", StringUtils.rightPad("sample", 10, "xy")); // multiple pads
+ assertEquals("samplexy", StringUtils.rightPad("sample", 8, "xyz")); // less than 1 pad
+ assertEquals("samplexy", StringUtils.rightPad("sample", 8, "xy")); // exactly 1 pad
+ assertEquals("sample ", StringUtils.rightPad("sample", 10, null)); // null pad
+
+ assertNull(StringUtils.rightPad(null, 0, '0'));
+ }
+
+ @Test
+ public void testPadLeft() {
+ assertEquals("sample", StringUtils.leftPad("sample", 0, '0'));
+ assertEquals("0000sample", StringUtils.leftPad("sample", 10, '0'));
+ assertEquals("0000000000", StringUtils.leftPad("", 10, '0'));
+ assertEquals("xyxysample", StringUtils.leftPad("sample", 10, "xy")); // multiple pads
+ assertEquals("xysample", StringUtils.leftPad("sample", 8, "xyz")); // less than 1 pad
+ assertEquals("xysample", StringUtils.leftPad("sample", 8, "xy")); // exactly 1 pad
+ assertEquals(" sample", StringUtils.leftPad("sample", 10, null)); // null pad
+
+ assertNull(StringUtils.leftPad(null, 0, '0'));
+ }
+
+ @Test
+ public void testIsEmpty() {
+ assertFalse(StringUtils.isEmpty("AAAAAAAA"));
+ assertFalse(StringUtils.isEmpty(" "));
+
+ assertTrue(StringUtils.isEmpty(""));
+ assertTrue(StringUtils.isEmpty(null));
+ }
+
+ @Test
+ public void testSubstringAfter() {
+ assertEquals("", StringUtils.substringAfter("", ""));
+ assertEquals("", StringUtils.substringAfter("", ">>"));
+ assertEquals("after", StringUtils.substringAfter("substring>>after", ">>"));
+ assertEquals("after>>another", StringUtils.substringAfter("substring>>after>>another", ">>"));
+ assertEquals("", StringUtils.substringAfter("substring>>after", null));
+ assertEquals("", StringUtils.substringAfter("substring.after", ">>"));
+ }
+
+ @Test
+ public void testJoin() {
+ final List<String> collection = new ArrayList<>();
+ assertEquals("", StringUtils.join(collection, ","));
+
+ collection.add("test1");
+ assertEquals("test1", StringUtils.join(collection, ","));
+
+ collection.add("test2");
+ assertEquals("test1,test2", StringUtils.join(collection, ","));
+
+ collection.add(null);
+ assertEquals("test1,test2,null", StringUtils.join(collection, ","));
+ }
+
+ @Test
+ public void testShouldTitleCaseStrings() {
+ // Arrange
+ List<String> inputs = Arrays.asList(null, "", " leading space", "trailing space ", "multiple spaces", "this is a sentence", "allOneWord", "PREVIOUSLY UPPERCASE");
+ List<String> expected = Arrays.asList("", "", "Leading Space", "Trailing Space", "Multiple Spaces", "This Is A Sentence", "Alloneword", "Previously Uppercase");
+
+ // Act
+ List<String> titleCased = inputs.stream().map(StringUtils::toTitleCase).collect(Collectors.toList());
+
+ // Assert
+ assertEquals(titleCased, expected);
+ }
}
diff --git a/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java b/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java
index 36e69442e4..73a2ca7fc6 100644
--- a/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java
+++ b/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/paths/RecordPathCompiler.java
@@ -497,10 +497,10 @@ public class RecordPathCompiler {
case NOT_EQUAL -> createBinaryOperationFilter(operatorTree, parent, NotEqualsFilter::new, absolute);
case LESS_THAN -> createBinaryOperationFilter(operatorTree, parent, LessThanFilter::new, absolute);
case LESS_THAN_EQUAL ->
- createBinaryOperationFilter(operatorTree, parent, LessThanOrEqualFilter::new, absolute);
+ createBinaryOperationFilter(operatorTree, parent, LessThanOrEqualFilter::new, absolute);
case GREATER_THAN -> createBinaryOperationFilter(operatorTree, parent, GreaterThanFilter::new, absolute);
case GREATER_THAN_EQUAL ->
- createBinaryOperationFilter(operatorTree, parent, GreaterThanOrEqualFilter::new, absolute);
+ createBinaryOperationFilter(operatorTree, parent, GreaterThanOrEqualFilter::new, absolute);
case FUNCTION -> createFunctionFilter(operatorTree, absolute);
default ->
throw new RecordPathException("Expected an Expression of form <value> <operator> <value> to follow '[' Token but found " + operatorTree);
diff --git a/nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java b/nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java
index 6c2fac85b6..605632a6cf 100644
--- a/nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java
+++ b/nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java
@@ -1169,9 +1169,9 @@ public class TestRecordPath {
public void yieldsOneForReferencesToASingleFieldRegardlessOfItsValue() {
assertAll(Stream.of("id", "name", "missing", "attributes", "friends", "mainAccount")
.map(fieldName -> () -> {
- FieldValue fieldValue = evaluateSingleFieldValue("count(/%s)".formatted(fieldName), record);
- assertEquals(1L, fieldValue.getValue());
- }
+ FieldValue fieldValue = evaluateSingleFieldValue("count(/%s)".formatted(fieldName), record);
+ assertEquals(1L, fieldValue.getValue());
+ }
));
}
diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordFieldType.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordFieldType.java
index 61045ae596..8e2f87c40e 100644
--- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordFieldType.java
+++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordFieldType.java
@@ -441,7 +441,7 @@ public enum RecordFieldType {
}
public static RecordFieldType of(final String typeString) {
- return SIMPLE_NAME_MAP.get(typeString);
+ return SIMPLE_NAME_MAP.get(typeString);
}
public Set<RecordFieldType> getNarrowDataTypes() {
diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
index 1ddf5700db..9a9470bae5 100644
--- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
+++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
@@ -236,10 +236,10 @@ public class ResultSetRecordSet implements RecordSet, Closeable {
final Object obj = rs.getObject(columnIndex);
if (!(obj instanceof Record)) {
final List<DataType> dataTypes = Stream.of(RecordFieldType.BIGINT, RecordFieldType.BOOLEAN, RecordFieldType.BYTE, RecordFieldType.CHAR, RecordFieldType.DATE,
- RecordFieldType.DECIMAL, RecordFieldType.DOUBLE, RecordFieldType.FLOAT, RecordFieldType.INT, RecordFieldType.LONG, RecordFieldType.SHORT, RecordFieldType.STRING,
+ RecordFieldType.DECIMAL, RecordFieldType.DOUBLE, RecordFieldType.FLOAT, RecordFieldType.INT, RecordFieldType.LONG, RecordFieldType.SHORT, RecordFieldType.STRING,
RecordFieldType.TIME, TIMESTAMP)
- .map(RecordFieldType::getDataType)
- .collect(Collectors.toList());
+ .map(RecordFieldType::getDataType)
+ .collect(Collectors.toList());
return RecordFieldType.CHOICE.getChoiceDataType(dataTypes);
}
diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/field/ObjectLocalDateTimeFieldConverter.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/field/ObjectLocalDateTimeFieldConverter.java
index 3c84ad8d3a..b5573cc9e7 100644
--- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/field/ObjectLocalDateTimeFieldConverter.java
+++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/field/ObjectLocalDateTimeFieldConverter.java
@@ -25,7 +25,6 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
-import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalQuery;
@@ -37,11 +36,6 @@ import java.util.Optional;
*/
class ObjectLocalDateTimeFieldConverter implements FieldConverter<Object, LocalDateTime> {
private static final long YEAR_TEN_THOUSAND = 253_402_300_800_000L;
- private static final long YEAR_TEN_THOUSAND_SECONDS = 253_402_300_800L;
- private static final char PERIOD = '.';
-
- private static final long MILLISECONDS_TO_MICROSECONDS = 1_000;
- private static final long SECONDS_TO_MICROSECONDS = 1_000_000;
private static final TemporalQuery<LocalDateTime> LOCAL_DATE_TIME_TEMPORAL_QUERY = new LocalDateTimeQuery();
@@ -72,10 +66,9 @@ class ObjectLocalDateTimeFieldConverter implements FieldConverter<Object, LocalD
return ofInstant(instant);
}
case final Number number -> {
- // Handle floating point numbers with integral and fractional components
+ // If value is a floating point number, we consider it as seconds since epoch plus a decimal part for fractions of a second.
if (field instanceof Double || field instanceof Float) {
- final double floatingPointNumber = number.doubleValue();
- return convertDouble(floatingPointNumber);
+ return toLocalDateTime(number.doubleValue());
}
return toLocalDateTime(number.longValue());
@@ -106,71 +99,40 @@ class ObjectLocalDateTimeFieldConverter implements FieldConverter<Object, LocalD
private LocalDateTime tryParseAsNumber(final String value, final String fieldName) {
try {
- final LocalDateTime localDateTime;
-
- final int periodIndex = value.indexOf(PERIOD);
- if (periodIndex >= 0) {
- // Parse Double to support both decimal notation and exponent notation
- final double floatingPointNumber = Double.parseDouble(value);
- localDateTime = convertDouble(floatingPointNumber);
- } else {
- final long number = Long.parseLong(value);
- localDateTime = toLocalDateTime(number);
+ // If decimal, treat as a double and convert to seconds and nanoseconds.
+ if (value.contains(".")) {
+ final double number = Double.parseDouble(value);
+ return toLocalDateTime(number);
}
- return localDateTime;
+ // attempt to parse as a long value
+ final long number = Long.parseLong(value);
+ return toLocalDateTime(number);
} catch (final NumberFormatException e) {
throw new FieldConversionException(LocalDateTime.class, value, fieldName, e);
}
}
- /**
- * Convert double to LocalDateTime after evaluating integral and fractional components.
- * Handles integral numbers greater than the year 10,000 in seconds as milliseconds, otherwise as seconds.
- * Multiplies fractional number to microseconds based on size of integral number.
- *
- * @param number Number of milliseconds or seconds
- * @return Local Date Time
- */
- private LocalDateTime convertDouble(final double number) {
- // Cast to long for integral part of the number
- final long integral = (long) number;
-
- // Calculate fractional part of the number for subsequent precision evaluation
- final double fractional = number - integral;
- final Instant epoch;
- final long fractionalMultiplier;
-
- if (integral > YEAR_TEN_THOUSAND_SECONDS) {
- // Handle large numbers as milliseconds instead of seconds
- epoch = Instant.ofEpochMilli(integral);
-
- // Convert fractional part from milliseconds to microseconds
- fractionalMultiplier = MILLISECONDS_TO_MICROSECONDS;
- } else {
- // Handle smaller numbers as seconds
- epoch = Instant.ofEpochSecond(integral);
-
- // Convert fractional part from seconds to microseconds
- fractionalMultiplier = SECONDS_TO_MICROSECONDS;
- }
+ private LocalDateTime toLocalDateTime(final double secondsSinceEpoch) {
+ // Determine the number of micros past the second by subtracting the number of seconds from the decimal value and multiplying by 1 million.
+ final double micros = 1_000_000 * (secondsSinceEpoch - (long) secondsSinceEpoch);
+ // Convert micros to nanos. Note that we perform this as a separate operation, rather than multiplying by 1_000,000,000 in order to avoid
+ // issues that occur with rounding at high precision.
+ final long nanos = (long) micros * 1000L;
- // Calculate microseconds according to multiplier for expected precision
- final double fractionalMicroseconds = fractional * fractionalMultiplier;
- final long microseconds = Math.round(fractionalMicroseconds);
- final Instant instant = epoch.plus(microseconds, ChronoUnit.MICROS);
+ return toLocalDateTime((long) secondsSinceEpoch, nanos);
+ }
+ private LocalDateTime toLocalDateTime(final long epochSeconds, final long nanosPastSecond) {
+ final Instant instant = Instant.ofEpochSecond(epochSeconds).plusNanos(nanosPastSecond);
return ofInstant(instant);
}
private LocalDateTime toLocalDateTime(final long value) {
if (value > YEAR_TEN_THOUSAND) {
- // Handle number as microseconds for large values
- final long epochSecond = value / SECONDS_TO_MICROSECONDS;
- // Calculate microseconds from remainder
- final long microseconds = value % SECONDS_TO_MICROSECONDS;
- final Instant instant = Instant.ofEpochSecond(epochSecond).plus(microseconds, ChronoUnit.MICROS);
- return ofInstant(instant);
+ // Value is too large. Assume microseconds instead of milliseconds.
+ final Instant microsInstant = Instant.ofEpochSecond(value / 1_000_000, (value % 1_000_000) * 1_000);
+ return ofInstant(microsInstant);
}
final Instant instant = Instant.ofEpochMilli(value);
diff --git a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/field/TestObjectLocalDateTimeFieldConverter.java b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/field/TestObjectLocalDateTimeFieldConverter.java
index 1aeabfc527..d44826d45b 100644
--- a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/field/TestObjectLocalDateTimeFieldConverter.java
+++ b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/field/TestObjectLocalDateTimeFieldConverter.java
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
-import java.time.temporal.ChronoUnit;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -41,16 +40,9 @@ public class TestObjectLocalDateTimeFieldConverter {
private static final LocalDateTime LOCAL_DATE_TIME_MILLIS_PRECISION = LocalDateTime.ofInstant(INSTANT_MILLIS_PRECISION, ZoneId.systemDefault());
private static final LocalDateTime LOCAL_DATE_TIME_MICROS_PRECISION = LocalDateTime.ofInstant(INSTANT_MICROS_PRECISION, ZoneId.systemDefault());
- private static final long INPUT_MILLISECONDS = 1765056655230L;
- private static final long INPUT_MICROSECONDS = 746;
- private static final int EXPECTED_NANOSECONDS = 230746000;
- private static final String MILLIS_WITH_FRACTIONAL_MICROS = "%d.%d".formatted(INPUT_MILLISECONDS, INPUT_MICROSECONDS);
-
- private static final Instant INSTANT_MICROSECOND_PRECISION = Instant.ofEpochMilli(INPUT_MILLISECONDS).plus(INPUT_MICROSECONDS, ChronoUnit.MICROS);
- private static final LocalDateTime LOCAL_DATE_TIME_FRACTIONAL_MICROS = LocalDateTime.ofInstant(INSTANT_MICROSECOND_PRECISION, ZoneId.systemDefault());
-
private final ObjectLocalDateTimeFieldConverter converter = new ObjectLocalDateTimeFieldConverter();
+
@Test
public void testConvertTimestampMillis() {
final LocalDateTime result = converter.convertField(MILLIS_TIMESTAMP_LONG, Optional.empty(), FIELD_NAME);
@@ -77,15 +69,8 @@ public class TestObjectLocalDateTimeFieldConverter {
public void testDoubleAsEpochSecondsAsString() {
final LocalDateTime result = converter.convertField(MICROS_TIMESTAMP_STRING, Optional.empty(), FIELD_NAME);
assertEquals(LOCAL_DATE_TIME_MICROS_PRECISION, result);
- assertEquals(NANOS_AFTER_SECOND, result.getNano(), 1D);
- }
-
- @Test
- public void testDoubleAsEpochMillisecondsWithMicroseconds() {
- final LocalDateTime result = converter.convertField(MILLIS_WITH_FRACTIONAL_MICROS, Optional.empty(), FIELD_NAME);
- assertEquals(LOCAL_DATE_TIME_FRACTIONAL_MICROS, result);
- final int nano = result.getNano();
- assertEquals(EXPECTED_NANOSECONDS, nano);
+ final double expectedNanos = 351567000L;
+ assertEquals(expectedNanos, result.getNano(), 1D);
}
@Test
diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
index 0c7c1cddc1..5182c749b7 100644
--- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
+++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
@@ -104,7 +104,7 @@ public class HttpClient extends AbstractSiteToSiteClient implements PeerStatusPr
apiClient.setCacheExpirationMillis(config.getCacheExpiration(TimeUnit.MILLISECONDS));
apiClient.setLocalAddress(config.getLocalAddress());
- return fetchRemotePeerStatuses(apiClient);
+ return fetchRemotePeerStatuses(apiClient);
}
}
diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/http/HttpClientTransaction.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/http/HttpClientTransaction.java
index f027ef9ffd..83a8a2016b 100644
--- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/http/HttpClientTransaction.java
+++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/protocol/http/HttpClientTransaction.java
@@ -138,30 +138,30 @@ public class HttpClientTransaction extends AbstractTransaction {
logger.debug("{} Finished sending flow files.", this);
break;
case BAD_CHECKSUM: {
- TransactionResultEntity resultEntity = apiClient.commitTransferFlowFiles(transactionUrl, ResponseCode.BAD_CHECKSUM);
- ResponseCode badChecksumCancelResponse = ResponseCode.fromCode(resultEntity.getResponseCode());
+ TransactionResultEntity resultEntity = apiClient.commitTransferFlowFiles(transactionUrl, ResponseCode.BAD_CHECKSUM);
+ ResponseCode badChecksumCancelResponse = ResponseCode.fromCode(resultEntity.getResponseCode());
if (badChecksumCancelResponse == ResponseCode.CANCEL_TRANSACTION) {
logger.debug("{} BAD_CHECKSUM, The transaction is canceled on server properly.", this);
} else {
logger.warn("{} BAD_CHECKSUM, Expected the transaction is canceled on server, but received {}.", this, badChecksumCancelResponse);
}
- }
+ }
break;
case CONFIRM_TRANSACTION:
// The actual HTTP request will be sent in readTransactionResponse.
logger.debug("{} Transaction is confirmed.", this);
break;
case CANCEL_TRANSACTION: {
- logger.debug("{} Canceling transaction.", this);
- TransactionResultEntity resultEntity = apiClient.commitTransferFlowFiles(transactionUrl, ResponseCode.CANCEL_TRANSACTION);
- ResponseCode cancelResponse = ResponseCode.fromCode(resultEntity.getResponseCode());
+ logger.debug("{} Canceling transaction.", this);
+ TransactionResultEntity resultEntity = apiClient.commitTransferFlowFiles(transactionUrl, ResponseCode.CANCEL_TRANSACTION);
+ ResponseCode cancelResponse = ResponseCode.fromCode(resultEntity.getResponseCode());
if (cancelResponse == ResponseCode.CANCEL_TRANSACTION) {
logger.debug("{} CANCEL_TRANSACTION, The transaction is canceled on server properly.", this);
} else {
logger.warn("{} CANCEL_TRANSACTION, Expected the transaction is canceled on server, but received {}.", this, cancelResponse);
}
- }
+ }
break;
}
}
diff --git a/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardReader.java b/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardReader.java
index cc5ab89848..09eea22792 100644
--- a/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardReader.java
+++ b/nifi-commons/nifi-swagger-integration/src/main/java/org/apache/nifi/swagger/integration/StandardReader.java
@@ -60,7 +60,7 @@ public class StandardReader extends Reader {
final JsonView jsonViewAnnotation,
final ApiResponse[] classResponses,
final AnnotatedMethod annotatedMethod
- ) {
+ ) {
final Operation operation = super.parseMethod(
resourceClass,
method,
diff --git a/nifi-commons/nifi-write-ahead-log/src/test/java/org/wali/DummyRecordSerde.java b/nifi-commons/nifi-write-ahead-log/src/test/java/org/wali/DummyRecordSerde.java
index 01021809da..5647c98d06 100644
--- a/nifi-commons/nifi-write-ahead-log/src/test/java/org/wali/DummyRecordSerde.java
+++ b/nifi-commons/nifi-write-ahead-log/src/test/java/org/wali/DummyRecordSerde.java
@@ -65,14 +65,14 @@ public class DummyRecordSerde implements SerDe<DummyRecord> {
// fallthrough
case CREATE:
case UPDATE: {
- final Map<String, String> props = record.getProperties();
- out.writeInt(props.size());
- for (final Map.Entry<String, String> entry : props.entrySet()) {
- out.writeUTF(entry.getKey());
- out.writeUTF(entry.getValue());
- }
+ final Map<String, String> props = record.getProperties();
+ out.writeInt(props.size());
+ for (final Map.Entry<String, String> entry : props.entrySet()) {
+ out.writeUTF(entry.getKey());
+ out.writeUTF(entry.getValue());
}
break;
+ }
case SWAP_OUT:
out.writeUTF(record.getSwapLocation());
break;
diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java
index 01da38ee64..c95a4bb862 100644
--- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java
+++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java
@@ -283,7 +283,7 @@ public class PublishAMQP extends AbstractAMQPProcessor<AMQPPublisher> {
private Map<String, Object> prepareAMQPHeaders(final FlowFile flowFile, final InputHeaderSource selectedHeaderSource, final Character headerSeparator, final Pattern pattern) {
final Map<String, Object> headers = new HashMap<>();
if (InputHeaderSource.FLOWFILE_ATTRIBUTES.equals(selectedHeaderSource)) {
- headers.putAll(getMatchedAttributes(flowFile.getAttributes(), pattern));
+ headers.putAll(getMatchedAttributes(flowFile.getAttributes(), pattern));
} else if (InputHeaderSource.AMQP_HEADERS_ATTRIBUTE.equals(selectedHeaderSource)) {
readAmqpAttribute(flowFile, AMQP_HEADERS_ATTRIBUTE, value -> headers.putAll(validateAMQPHeaderProperty(value, headerSeparator)));
}
diff --git a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java
index 8f91f8fe68..41cbf4e6b1 100644
--- a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java
+++ b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java
@@ -154,15 +154,15 @@ public class JASN1Reader extends AbstractConfigurableComponent implements Record
.defaultValue(DEFAULT.getValue())
.build();
- static final PropertyDescriptor SCHEMA_PREPARATION_DIRECTORY = new PropertyDescriptor.Builder()
- .name("Schema Preparation Directory")
- .description("When the processor is configured to do additional preprocessing, new modified schema files will be created in this directory." +
- " For more information about additional preprocessing please see description of the 'Do Additional Preprocessing' property or Additional Details - Additional Preprocessing.")
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.createDirectoryExistsValidator(true, false))
- .dependsOn(SCHEMA_PREPARATION_STRATEGY, ADDITIONAL_PREPROCESSING)
- .required(true)
- .build();
+ static final PropertyDescriptor SCHEMA_PREPARATION_DIRECTORY = new PropertyDescriptor.Builder()
+ .name("Schema Preparation Directory")
+ .description("When the processor is configured to do additional preprocessing, new modified schema files will be created in this directory." +
+ " For more information about additional preprocessing please see description of the 'Do Additional Preprocessing' property or Additional Details - Additional Preprocessing.")
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.createDirectoryExistsValidator(true, false))
+ .dependsOn(SCHEMA_PREPARATION_STRATEGY, ADDITIONAL_PREPROCESSING)
+ .required(true)
+ .build();
private final List<PropertyDescriptor> propertyDescriptors = Arrays.asList(
ROOT_MODEL_NAME,
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
index 67d2f3589c..5173c0842f 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesis.java
@@ -448,9 +448,9 @@ public class ConsumeKinesis extends AbstractProcessor {
switch (result) {
case InitializationResult.Success ignored ->
- getLogger().info(
- "Started Kinesis Scheduler for stream [{}] with application name [{}] and workerId [{}]",
- streamName, applicationName, workerId);
+ getLogger().info(
+ "Started Kinesis Scheduler for stream [{}] with application name [{}] and workerId [{}]",
+ streamName, applicationName, workerId);
case InitializationResult.Failure failure -> {
cleanUpState();
@@ -524,7 +524,7 @@ public class ConsumeKinesis extends AbstractProcessor {
final InitialPosition initialPosition = context.getProperty(INITIAL_STREAM_POSITION).asAllowableValue(InitialPosition.class);
return switch (initialPosition) {
case TRIM_HORIZON ->
- InitialPositionInStreamExtended.newInitialPosition(InitialPositionInStream.TRIM_HORIZON);
+ InitialPositionInStreamExtended.newInitialPosition(InitialPositionInStream.TRIM_HORIZON);
case LATEST -> InitialPositionInStreamExtended.newInitialPosition(InitialPositionInStream.LATEST);
case AT_TIMESTAMP -> {
final String timestampValue = context.getProperty(STREAM_POSITION_TIMESTAMP).getValue();
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisAttributes.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisAttributes.java
index 9011c2a367..acfc91b74e 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisAttributes.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-kinesis/src/main/java/org/apache/nifi/processors/aws/kinesis/ConsumeKinesisAttributes.java
@@ -69,7 +69,7 @@ final class ConsumeKinesisAttributes {
attributes.put(PARTITION_KEY, lastRecord.partitionKey());
if (lastRecord.approximateArrivalTimestamp() != null) {
- attributes.put(APPROXIMATE_ARRIVAL_TIMESTAMP, String.valueOf(lastRecord.approximateArrivalTimestamp().toEpochMilli()));
+ attributes.put(APPROXIMATE_ARRIVAL_TIMESTAMP, String.valueOf(lastRecord.approximateArrivalTimestamp().toEpochMilli()));
}
return attributes;
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/rds/AwsRdsIamDatabasePasswordProvider.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/rds/AwsRdsIamDatabasePasswordProvider.java
index a38f952ae8..675c8488dd 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/rds/AwsRdsIamDatabasePasswordProvider.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/rds/AwsRdsIamDatabasePasswordProvider.java
@@ -48,9 +48,9 @@ import static org.apache.nifi.processors.aws.region.RegionUtil.isDynamicRegion;
@Tags({"aws", "rds", "iam", "jdbc", "password"})
@CapabilityDescription("""
-Generates Amazon RDS IAM authentication tokens each time a JDBC connection is requested.
-The generated token replaces the database user password so that NiFi does not need to store long-lived credentials inside DBCP services.
-""")
+ Generates Amazon RDS IAM authentication tokens each time a JDBC connection is requested.
+ The generated token replaces the database user password so that NiFi does not need to store long-lived credentials inside DBCP services.
+ """)
public class AwsRdsIamDatabasePasswordProvider extends AbstractControllerService implements DatabasePasswordProvider {
static final PropertyDescriptor AWS_CREDENTIALS_PROVIDER_SERVICE = new PropertyDescriptor.Builder()
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
index 812ee6bee6..906f5bb87c 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java
@@ -535,7 +535,7 @@ public class PutS3Object extends AbstractS3Processor {
final S3Client client;
try {
- client = getClient(context, flowFile.getAttributes());
+ client = getClient(context, flowFile.getAttributes());
} catch (Exception e) {
getLogger().error("Failed to initialize S3 client", e);
flowFile = session.penalize(flowFile);
@@ -978,19 +978,19 @@ public class PutS3Object extends AbstractS3Processor {
final Map<String, String> attributesMap = flowFile.getAttributes();
attributesMap.entrySet().stream()
- .filter(attribute -> attribute.getKey().startsWith(prefix))
- .forEach(attribute -> {
- String tagKey = attribute.getKey();
- String tagValue = attribute.getValue();
+ .filter(attribute -> attribute.getKey().startsWith(prefix))
+ .forEach(attribute -> {
+ String tagKey = attribute.getKey();
+ String tagValue = attribute.getValue();
- if (context.getProperty(REMOVE_TAG_PREFIX).asBoolean()) {
- tagKey = tagKey.replace(prefix, "");
- }
- objectTags.add(Tag.builder()
- .key(tagKey)
- .value(tagValue)
- .build());
- });
+ if (context.getProperty(REMOVE_TAG_PREFIX).asBoolean()) {
+ tagKey = tagKey.replace(prefix, "");
+ }
+ objectTags.add(Tag.builder()
+ .key(tagKey)
+ .value(tagValue)
+ .build());
+ });
return objectTags;
}
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
index aab8495f06..7f8cc03903 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
@@ -254,7 +254,7 @@ public abstract class AbstractS3IT {
try {
path = Paths.get(getClass().getResource(resourceName).toURI());
} catch (URISyntaxException e) {
- fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());
+ fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());
}
return path;
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java
index 4aa5f3a32b..e678b88743 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java
@@ -441,7 +441,7 @@ public class ITPutS3Object extends AbstractS3IT {
assertEquals(BUCKET_NAME, context.getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).evaluateAttributeExpressions((FlowFile) null).toString());
assertEquals(SAMPLE_FILE_RESOURCE_NAME, context.getProperty(PutS3Object.KEY).evaluateAttributeExpressions(Collections.emptyMap()).toString());
assertEquals(TEST_PARTSIZE_LONG.longValue(),
- context.getProperty(PutS3Object.MULTIPART_PART_SIZE).asDataSize(DataUnit.B).longValue());
+ context.getProperty(PutS3Object.MULTIPART_PART_SIZE).asDataSize(DataUnit.B).longValue());
}
@Test
@@ -699,7 +699,7 @@ public class ITPutS3Object extends AbstractS3IT {
assertEquals(FILE1_NAME, ff1.getAttribute(CoreAttributes.FILENAME.key()));
assertEquals(BUCKET_NAME, ff1.getAttribute(PutS3Object.S3_BUCKET_KEY));
assertEquals(FILE1_NAME, ff1.getAttribute(PutS3Object.S3_OBJECT_KEY));
- assertTrue(reS3ETag.matcher(ff1.getAttribute(PutS3Object.S3_ETAG_ATTR_KEY)).matches());
+ assertTrue(reS3ETag.matcher(ff1.getAttribute(PutS3Object.S3_ETAG_ATTR_KEY)).matches());
assertEquals(tempByteCount, ff1.getSize());
}
@@ -720,9 +720,9 @@ public class ITPutS3Object extends AbstractS3IT {
runner.assertAllFlowFilesTransferred(PutS3Object.REL_SUCCESS, 1);
final GetObjectTaggingRequest request = GetObjectTaggingRequest.builder()
- .bucket(BUCKET_NAME)
- .key("tag-test.txt")
- .build();
+ .bucket(BUCKET_NAME)
+ .key("tag-test.txt")
+ .build();
GetObjectTaggingResponse response = getClient().getObjectTagging(request);
List<Tag> objectTags = response.tagSet();
diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/ClientSideEncryptionSupport.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/ClientSideEncryptionSupport.java
index d31c2c0bee..ba554acdda 100644
--- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/ClientSideEncryptionSupport.java
+++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/ClientSideEncryptionSupport.java
@@ -144,7 +144,7 @@ public interface ClientSideEncryptionSupport {
case keySize192 -> Optional.of(KeyWrapAlgorithm.A192KW.toString());
case keySize256, keySize384, keySize512 ->
// Default to the longest allowed key length for wrap
- Optional.of(KeyWrapAlgorithm.A256KW.toString());
+ Optional.of(KeyWrapAlgorithm.A256KW.toString());
default -> Optional.empty();
};
}
diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java
index 925de43de2..2510814761 100644
--- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java
+++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java
@@ -920,11 +920,11 @@ public class ConsumeAzureEventHub extends AbstractSessionFactoryProcessor implem
final String storageSasToken = context.getProperty(STORAGE_SAS_TOKEN).evaluateAttributeExpressions().getValue();
return switch (blobStorageAuthenticationStrategy) {
case STORAGE_ACCOUNT_KEY ->
- String.format(FORMAT_STORAGE_CONNECTION_STRING_FOR_ACCOUNT_KEY, storageAccountName, storageAccountKey, domainName);
+ String.format(FORMAT_STORAGE_CONNECTION_STRING_FOR_ACCOUNT_KEY, storageAccountName, storageAccountKey, domainName);
case SHARED_ACCESS_SIGNATURE ->
- String.format(FORMAT_STORAGE_CONNECTION_STRING_FOR_SAS_TOKEN, storageAccountName, domainName, storageSasToken);
+ String.format(FORMAT_STORAGE_CONNECTION_STRING_FOR_SAS_TOKEN, storageAccountName, domainName, storageSasToken);
case OAUTH2 -> throw new IllegalArgumentException(String.format(
- "Blob Storage Authentication Strategy %s does not support connection string authentication", blobStorageAuthenticationStrategy));
+ "Blob Storage Authentication Strategy %s does not support connection string authentication", blobStorageAuthenticationStrategy));
};
}
diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java
index ee4d3921e6..7d3d930e2d 100644
--- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java
+++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java
@@ -1,19 +1,19 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.nifi.reporting.azure.loganalytics;
import org.apache.commons.lang3.StringUtils;
@@ -56,418 +56,418 @@ import java.util.UUID;
@CapabilityDescription("Publishes Provenance events to to a Azure Log Analytics workspace.")
public class AzureLogAnalyticsProvenanceReportingTask extends AbstractAzureLogAnalyticsReportingTask {
- protected static final String LAST_EVENT_ID_KEY = "last_event_id";
- protected static final String DESTINATION_URL_PATH = "/nifi";
- protected static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
- private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(TIMESTAMP_FORMAT);
-
- static final PropertyDescriptor LOG_ANALYTICS_CUSTOM_LOG_NAME = new PropertyDescriptor.Builder()
- .name("Log Analytics Custom Log Name").description("Log Analytics Custom Log Name").required(false)
- .defaultValue("nifiprovenance").addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT).build();
-
- static final AllowableValue BEGINNING_OF_STREAM = new AllowableValue("beginning-of-stream",
- "Beginning of Stream",
- "Start reading provenance Events from the beginning of the stream (the oldest event first)");
-
- static final AllowableValue END_OF_STREAM = new AllowableValue("end-of-stream", "End of Stream",
- "Start reading provenance Events from the end of the stream, ignoring old events");
-
- static final PropertyDescriptor FILTER_EVENT_TYPE = new PropertyDescriptor.Builder()
- .name("Event Type to Include")
- .description("Comma-separated list of event types that will be used to filter the provenance events sent by the reporting task. "
- + "Available event types are "
- + Arrays.deepToString(ProvenanceEventType.values())
- + ". If no filter is set, all the events are sent. If "
- + "multiple filters are set, the filters are cumulative.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_EVENT_TYPE_EXCLUDE = new PropertyDescriptor.Builder()
- .name("Event Type to Exclude")
- .description("Comma-separated list of event types that will be used to exclude the provenance events sent by the reporting task. "
- + "Available event types are "
- + Arrays.deepToString(ProvenanceEventType.values())
- + ". If no filter is set, all the events are sent. If "
- + "multiple filters are set, the filters are cumulative. If an event type is included in Event Type to Include and excluded here, then the "
- + "exclusion takes precedence and the event will not be sent.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_TYPE = new PropertyDescriptor.Builder()
- .name("Component Type to Include")
- .description("Regular expression to filter the provenance events based on the component type. Only the events matching the regular "
- + "expression will be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_TYPE_EXCLUDE = new PropertyDescriptor.Builder()
- .name("Component Type to Exclude")
- .description("Regular expression to exclude the provenance events based on the component type. The events matching the regular "
- + "expression will not be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. "
- + "If a component type is included in Component Type to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_ID = new PropertyDescriptor.Builder()
- .name("Component ID to Include")
- .description("Comma-separated list of component UUID that will be used to filter the provenance events sent by the reporting task. If no "
- + "filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_ID_EXCLUDE = new PropertyDescriptor.Builder()
- .name("Component ID to Exclude")
- .description("Comma-separated list of component UUID that will be used to exclude the provenance events sent by the reporting task. If no "
- + "filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. If a component UUID is included in "
- + "Component ID to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_NAME = new PropertyDescriptor.Builder()
- .name("Component Name to Include")
- .description("Regular expression to filter the provenance events based on the component name. Only the events matching the regular "
- + "expression will be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
-
- static final PropertyDescriptor FILTER_COMPONENT_NAME_EXCLUDE = new PropertyDescriptor.Builder()
- .name("Component Name to Exclude")
- .description("Regular expression to exclude the provenance events based on the component name. The events matching the regular "
- + "expression will not be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. "
- + "If a component name is included in Component Name to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
- .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
-
- static final PropertyDescriptor START_POSITION = new PropertyDescriptor.Builder()
- .name("Start Position")
- .description("If the Reporting Task has never been run, or if its state has been reset by a user, "
- + "specifies where in the stream of Provenance Events the Reporting Task should start")
- .allowableValues(BEGINNING_OF_STREAM, END_OF_STREAM)
- .defaultValue(BEGINNING_OF_STREAM).required(true).build();
-
- static final PropertyDescriptor ALLOW_NULL_VALUES = new PropertyDescriptor.Builder()
- .name("Include Null Values")
- .description("Indicate if null values should be included in records. Default will be false")
- .required(true).allowableValues("true", "false").defaultValue("false").build();
-
- static final PropertyDescriptor PLATFORM = new PropertyDescriptor.Builder().name("Platform")
- .description("The value to use for the platform field in each event.").required(true)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT).defaultValue("nifi")
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
-
- static final PropertyDescriptor INSTANCE_URL = new PropertyDescriptor.Builder()
- .name("Instance URL")
- .description("The URL of this instance to use in the Content URI of each event.").required(true)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .defaultValue("http://${hostname(true)}:8080/nifi")
- .addValidator(StandardValidators.URL_VALIDATOR).build();
-
- static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder()
- .name("Batch Size")
- .description("Specifies how many records to send in a single batch, at most.").required(true)
- .defaultValue("1000").addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR).build();
-
- private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
- LOG_ANALYTICS_WORKSPACE_ID,
- LOG_ANALYTICS_CUSTOM_LOG_NAME,
- LOG_ANALYTICS_WORKSPACE_KEY,
- APPLICATION_ID,
- INSTANCE_ID,
- JOB_NAME,
- LOG_ANALYTICS_URL_ENDPOINT_FORMAT,
- FILTER_EVENT_TYPE,
- FILTER_EVENT_TYPE_EXCLUDE,
- FILTER_COMPONENT_TYPE,
- FILTER_COMPONENT_TYPE_EXCLUDE,
- FILTER_COMPONENT_ID,
- FILTER_COMPONENT_ID_EXCLUDE,
- FILTER_COMPONENT_NAME,
- FILTER_COMPONENT_NAME_EXCLUDE,
- START_POSITION,
- ALLOW_NULL_VALUES,
- PLATFORM,
- INSTANCE_URL,
- BATCH_SIZE
- );
-
- private volatile ProvenanceEventConsumer consumer;
-
- @Override
- protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- return PROPERTY_DESCRIPTORS;
- }
-
- public void CreateConsumer(final ReportingContext context) {
- if (consumer != null)
- return;
- consumer = new ProvenanceEventConsumer();
- consumer.setStartPositionValue(context.getProperty(START_POSITION).getValue());
- consumer.setBatchSize(context.getProperty(BATCH_SIZE).asInteger());
- consumer.setLogger(getLogger());
- // initialize component type filtering
- consumer.setComponentTypeRegex(
- context.getProperty(FILTER_COMPONENT_TYPE).evaluateAttributeExpressions().getValue());
- consumer.setComponentTypeRegexExclude(context.getProperty(FILTER_COMPONENT_TYPE_EXCLUDE)
- .evaluateAttributeExpressions().getValue());
- consumer.setComponentNameRegex(
- context.getProperty(FILTER_COMPONENT_NAME).evaluateAttributeExpressions().getValue());
- consumer.setComponentNameRegexExclude(context.getProperty(FILTER_COMPONENT_NAME_EXCLUDE)
- .evaluateAttributeExpressions().getValue());
-
- final String[] targetEventTypes = StringUtils.stripAll(StringUtils.split(
- context.getProperty(FILTER_EVENT_TYPE).evaluateAttributeExpressions().getValue(), ','));
- if (targetEventTypes != null) {
- for (final String type : targetEventTypes) {
- try {
- consumer.addTargetEventType(ProvenanceEventType.valueOf(type));
- } catch (final Exception e) {
- getLogger().warn(type
- + " is not a correct event type, removed from the filtering.");
- }
- }
- }
-
- final String[] targetEventTypesExclude = StringUtils
- .stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE_EXCLUDE)
- .evaluateAttributeExpressions().getValue(), ','));
- if (targetEventTypesExclude != null) {
- for (final String type : targetEventTypesExclude) {
- try {
- consumer.addTargetEventTypeExclude(ProvenanceEventType.valueOf(type));
- } catch (final Exception e) {
- getLogger().warn(type
- + " is not a correct event type, removed from the exclude filtering.");
- }
- }
- }
-
- // initialize component ID filtering
- final String[] targetComponentIds = StringUtils.stripAll(StringUtils.split(
- context.getProperty(FILTER_COMPONENT_ID).evaluateAttributeExpressions().getValue(),
- ','));
- if (targetComponentIds != null) {
- consumer.addTargetComponentId(targetComponentIds);
- }
-
- final String[] targetComponentIdsExclude = StringUtils
- .stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID_EXCLUDE)
- .evaluateAttributeExpressions().getValue(), ','));
- if (targetComponentIdsExclude != null) {
- consumer.addTargetComponentIdExclude(targetComponentIdsExclude);
+ protected static final String LAST_EVENT_ID_KEY = "last_event_id";
+ protected static final String DESTINATION_URL_PATH = "/nifi";
+ protected static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+ private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(TIMESTAMP_FORMAT);
+
+ static final PropertyDescriptor LOG_ANALYTICS_CUSTOM_LOG_NAME = new PropertyDescriptor.Builder()
+ .name("Log Analytics Custom Log Name").description("Log Analytics Custom Log Name").required(false)
+ .defaultValue("nifiprovenance").addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT).build();
+
+ static final AllowableValue BEGINNING_OF_STREAM = new AllowableValue("beginning-of-stream",
+ "Beginning of Stream",
+ "Start reading provenance Events from the beginning of the stream (the oldest event first)");
+
+ static final AllowableValue END_OF_STREAM = new AllowableValue("end-of-stream", "End of Stream",
+ "Start reading provenance Events from the end of the stream, ignoring old events");
+
+ static final PropertyDescriptor FILTER_EVENT_TYPE = new PropertyDescriptor.Builder()
+ .name("Event Type to Include")
+ .description("Comma-separated list of event types that will be used to filter the provenance events sent by the reporting task. "
+ + "Available event types are "
+ + Arrays.deepToString(ProvenanceEventType.values())
+ + ". If no filter is set, all the events are sent. If "
+ + "multiple filters are set, the filters are cumulative.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_EVENT_TYPE_EXCLUDE = new PropertyDescriptor.Builder()
+ .name("Event Type to Exclude")
+ .description("Comma-separated list of event types that will be used to exclude the provenance events sent by the reporting task. "
+ + "Available event types are "
+ + Arrays.deepToString(ProvenanceEventType.values())
+ + ". If no filter is set, all the events are sent. If "
+ + "multiple filters are set, the filters are cumulative. If an event type is included in Event Type to Include and excluded here, then the "
+ + "exclusion takes precedence and the event will not be sent.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_TYPE = new PropertyDescriptor.Builder()
+ .name("Component Type to Include")
+ .description("Regular expression to filter the provenance events based on the component type. Only the events matching the regular "
+ + "expression will be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_TYPE_EXCLUDE = new PropertyDescriptor.Builder()
+ .name("Component Type to Exclude")
+ .description("Regular expression to exclude the provenance events based on the component type. The events matching the regular "
+ + "expression will not be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. "
+ + "If a component type is included in Component Type to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_ID = new PropertyDescriptor.Builder()
+ .name("Component ID to Include")
+ .description("Comma-separated list of component UUID that will be used to filter the provenance events sent by the reporting task. If no "
+ + "filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_ID_EXCLUDE = new PropertyDescriptor.Builder()
+ .name("Component ID to Exclude")
+ .description("Comma-separated list of component UUID that will be used to exclude the provenance events sent by the reporting task. If no "
+ + "filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. If a component UUID is included in "
+ + "Component ID to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_NAME = new PropertyDescriptor.Builder()
+ .name("Component Name to Include")
+ .description("Regular expression to filter the provenance events based on the component name. Only the events matching the regular "
+ + "expression will be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
+
+ static final PropertyDescriptor FILTER_COMPONENT_NAME_EXCLUDE = new PropertyDescriptor.Builder()
+ .name("Component Name to Exclude")
+ .description("Regular expression to exclude the provenance events based on the component name. The events matching the regular "
+ + "expression will not be sent. If no filter is set, all the events are sent. If multiple filters are set, the filters are cumulative. "
+ + "If a component name is included in Component Name to Include and excluded here, then the exclusion takes precedence and the event will not be sent.")
+ .required(false).expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR).build();
+
+ static final PropertyDescriptor START_POSITION = new PropertyDescriptor.Builder()
+ .name("Start Position")
+ .description("If the Reporting Task has never been run, or if its state has been reset by a user, "
+ + "specifies where in the stream of Provenance Events the Reporting Task should start")
+ .allowableValues(BEGINNING_OF_STREAM, END_OF_STREAM)
+ .defaultValue(BEGINNING_OF_STREAM).required(true).build();
+
+ static final PropertyDescriptor ALLOW_NULL_VALUES = new PropertyDescriptor.Builder()
+ .name("Include Null Values")
+ .description("Indicate if null values should be included in records. Default will be false")
+ .required(true).allowableValues("true", "false").defaultValue("false").build();
+
+ static final PropertyDescriptor PLATFORM = new PropertyDescriptor.Builder().name("Platform")
+ .description("The value to use for the platform field in each event.").required(true)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT).defaultValue("nifi")
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR).build();
+
+ static final PropertyDescriptor INSTANCE_URL = new PropertyDescriptor.Builder()
+ .name("Instance URL")
+ .description("The URL of this instance to use in the Content URI of each event.").required(true)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .defaultValue("http://${hostname(true)}:8080/nifi")
+ .addValidator(StandardValidators.URL_VALIDATOR).build();
+
+ static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder()
+ .name("Batch Size")
+ .description("Specifies how many records to send in a single batch, at most.").required(true)
+ .defaultValue("1000").addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR).build();
+
+ private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
+ LOG_ANALYTICS_WORKSPACE_ID,
+ LOG_ANALYTICS_CUSTOM_LOG_NAME,
+ LOG_ANALYTICS_WORKSPACE_KEY,
+ APPLICATION_ID,
+ INSTANCE_ID,
+ JOB_NAME,
+ LOG_ANALYTICS_URL_ENDPOINT_FORMAT,
+ FILTER_EVENT_TYPE,
+ FILTER_EVENT_TYPE_EXCLUDE,
+ FILTER_COMPONENT_TYPE,
+ FILTER_COMPONENT_TYPE_EXCLUDE,
+ FILTER_COMPONENT_ID,
+ FILTER_COMPONENT_ID_EXCLUDE,
+ FILTER_COMPONENT_NAME,
+ FILTER_COMPONENT_NAME_EXCLUDE,
+ START_POSITION,
+ ALLOW_NULL_VALUES,
+ PLATFORM,
+ INSTANCE_URL,
+ BATCH_SIZE
+ );
+
+ private volatile ProvenanceEventConsumer consumer;
+
+ @Override
+ protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+ return PROPERTY_DESCRIPTORS;
+ }
+
+ public void CreateConsumer(final ReportingContext context) {
+ if (consumer != null)
+ return;
+ consumer = new ProvenanceEventConsumer();
+ consumer.setStartPositionValue(context.getProperty(START_POSITION).getValue());
+ consumer.setBatchSize(context.getProperty(BATCH_SIZE).asInteger());
+ consumer.setLogger(getLogger());
+ // initialize component type filtering
+ consumer.setComponentTypeRegex(
+ context.getProperty(FILTER_COMPONENT_TYPE).evaluateAttributeExpressions().getValue());
+ consumer.setComponentTypeRegexExclude(context.getProperty(FILTER_COMPONENT_TYPE_EXCLUDE)
+ .evaluateAttributeExpressions().getValue());
+ consumer.setComponentNameRegex(
+ context.getProperty(FILTER_COMPONENT_NAME).evaluateAttributeExpressions().getValue());
+ consumer.setComponentNameRegexExclude(context.getProperty(FILTER_COMPONENT_NAME_EXCLUDE)
+ .evaluateAttributeExpressions().getValue());
+
+ final String[] targetEventTypes = StringUtils.stripAll(StringUtils.split(
+ context.getProperty(FILTER_EVENT_TYPE).evaluateAttributeExpressions().getValue(), ','));
+ if (targetEventTypes != null) {
+ for (final String type : targetEventTypes) {
+ try {
+ consumer.addTargetEventType(ProvenanceEventType.valueOf(type));
+ } catch (final Exception e) {
+ getLogger().warn(type
+ + " is not a correct event type, removed from the filtering.");
}
-
- consumer.setScheduled(true);
+ }
}
- @Override
- public void onTrigger(ReportingContext context) {
- final boolean isClustered = context.isClustered();
- final String nodeId = context.getClusterNodeIdentifier();
- if (nodeId == null && isClustered) {
- getLogger().debug(
- "This instance of NiFi is configured for clustering, but the Cluster Node Identifier is not yet available. "
- + "Will wait for Node Identifier to be established.");
- return;
- }
-
+ final String[] targetEventTypesExclude = StringUtils
+ .stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE_EXCLUDE)
+ .evaluateAttributeExpressions().getValue(), ','));
+ if (targetEventTypesExclude != null) {
+ for (final String type : targetEventTypesExclude) {
try {
- processProvenanceData(context);
-
+ consumer.addTargetEventTypeExclude(ProvenanceEventType.valueOf(type));
} catch (final Exception e) {
- getLogger().error("Failed to publish metrics to Azure Log Analytics", e);
+ getLogger().warn(type
+ + " is not a correct event type, removed from the exclude filtering.");
}
+ }
}
- @Override
- public void migrateProperties(PropertyConfiguration config) {
- config.renameProperty("s2s-prov-task-event-filter", FILTER_EVENT_TYPE.getName());
- config.renameProperty("s2s-prov-task-event-filter-exclude", FILTER_EVENT_TYPE_EXCLUDE.getName());
- config.renameProperty("s2s-prov-task-type-filter", FILTER_COMPONENT_TYPE.getName());
- config.renameProperty("s2s-prov-task-type-filter-exclude", FILTER_COMPONENT_TYPE_EXCLUDE.getName());
- config.renameProperty("s2s-prov-task-id-filter", FILTER_COMPONENT_ID.getName());
- config.renameProperty("s2s-prov-task-id-filter-exclude", FILTER_COMPONENT_ID_EXCLUDE.getName());
- config.renameProperty("s2s-prov-task-name-filter", FILTER_COMPONENT_NAME.getName());
- config.renameProperty("s2s-prov-task-name-filter-exclude", FILTER_COMPONENT_NAME_EXCLUDE.getName());
- config.renameProperty("start-position", START_POSITION.getName());
- config.renameProperty("include-null-values", ALLOW_NULL_VALUES.getName());
+ // initialize component ID filtering
+ final String[] targetComponentIds = StringUtils.stripAll(StringUtils.split(
+ context.getProperty(FILTER_COMPONENT_ID).evaluateAttributeExpressions().getValue(),
+ ','));
+ if (targetComponentIds != null) {
+ consumer.addTargetComponentId(targetComponentIds);
}
- public void processProvenanceData(final ReportingContext context) {
- getLogger().debug("Starting to process provenance data");
- final String workspaceId = context.getProperty(LOG_ANALYTICS_WORKSPACE_ID)
- .evaluateAttributeExpressions().getValue();
- final String linuxPrimaryKey = context.getProperty(LOG_ANALYTICS_WORKSPACE_KEY)
- .evaluateAttributeExpressions().getValue();
- final String logName = context.getProperty(LOG_ANALYTICS_CUSTOM_LOG_NAME).evaluateAttributeExpressions()
- .getValue();
- final String urlEndpointFormat = context.getProperty(LOG_ANALYTICS_URL_ENDPOINT_FORMAT)
- .evaluateAttributeExpressions().getValue();
- final Integer batchSize = context.getProperty(BATCH_SIZE).asInteger();
- final String dataCollectorEndpoint = MessageFormat.format(urlEndpointFormat, workspaceId);
- final ProcessGroupStatus procGroupStatus = context.getEventAccess().getControllerStatus();
- final String nodeId = context.getClusterNodeIdentifier();
- final String rootGroupName = procGroupStatus == null ? null : procGroupStatus.getName();
- final String platform = context.getProperty(PLATFORM).evaluateAttributeExpressions().getValue();
- final Boolean allowNullValues = context.getProperty(ALLOW_NULL_VALUES).asBoolean();
- final String nifiUrl = context.getProperty(INSTANCE_URL).evaluateAttributeExpressions().getValue();
- URL url;
- try {
- url = URI.create(nifiUrl).toURL();
- } catch (IllegalArgumentException | MalformedURLException e) {
- throw new AssertionError();
- }
+ final String[] targetComponentIdsExclude = StringUtils
+ .stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID_EXCLUDE)
+ .evaluateAttributeExpressions().getValue(), ','));
+ if (targetComponentIdsExclude != null) {
+ consumer.addTargetComponentIdExclude(targetComponentIdsExclude);
+ }
- final String hostname = url.getHost();
- final Map<String, Object> config = Collections.emptyMap();
- final JsonBuilderFactory factory = Json.createBuilderFactory(config);
- final JsonObjectBuilder builder = factory.createObjectBuilder();
- CreateConsumer(context);
- consumer.consumeEvents(context, (mapHolder, events) -> {
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append('[');
- for (final ProvenanceEventRecord event : events) {
- final String componentName = mapHolder.getComponentName(event.getComponentId());
- final String processGroupId = mapHolder.getProcessGroupId(event.getComponentId(),
- event.getComponentType());
- final String processGroupName = mapHolder.getComponentName(processGroupId);
- final JsonObject jo = serialize(factory, builder, event, componentName,
- processGroupId, processGroupName, hostname, url, rootGroupName,
- platform, nodeId, allowNullValues);
- stringBuilder.append(jo.toString());
- stringBuilder.append(',');
- }
- if (stringBuilder.charAt(stringBuilder.length() - 1) == ',')
- stringBuilder.deleteCharAt(stringBuilder.length() - 1);
- stringBuilder.append(']');
- String str = stringBuilder.toString();
- if (!str.equals("[]")) {
- final HttpPost httpPost = new HttpPost(dataCollectorEndpoint);
- httpPost.addHeader("Content-Type", "application/json");
- httpPost.addHeader("Log-Type", logName);
- getLogger().debug("Sending {} events of length {} to azure log analytics {}", batchSize, str.length(), logName);
- try {
- sendToLogAnalytics(httpPost, workspaceId, linuxPrimaryKey, str);
-
- } catch (final Exception e) {
- getLogger().error("Failed to publish provenance data to Azure Log Analytics", e);
- }
- }
- });
- getLogger().debug("Done processing provenance data");
+ consumer.setScheduled(true);
+ }
+
+ @Override
+ public void onTrigger(ReportingContext context) {
+ final boolean isClustered = context.isClustered();
+ final String nodeId = context.getClusterNodeIdentifier();
+ if (nodeId == null && isClustered) {
+ getLogger().debug(
+ "This instance of NiFi is configured for clustering, but the Cluster Node Identifier is not yet available. "
+ + "Will wait for Node Identifier to be established.");
+ return;
}
- private JsonObject serialize(final JsonBuilderFactory factory, final JsonObjectBuilder builder,
- final ProvenanceEventRecord event, final String componentName,
- final String processGroupId, final String processGroupName, final String hostname,
- final URL nifiUrl, final String applicationName, final String platform,
- final String nodeIdentifier, Boolean allowNullValues) {
- addField(builder, "eventId", UUID.randomUUID().toString(), allowNullValues);
- addField(builder, "eventOrdinal", event.getEventId(), allowNullValues);
- addField(builder, "eventType", event.getEventType().name(), allowNullValues);
- addField(builder, "timestampMillis", event.getEventTime(), allowNullValues);
- addField(builder, "timestamp", DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(event.getEventTime()).atOffset(ZoneOffset.UTC)), allowNullValues);
- addField(builder, "durationMillis", event.getEventDuration(), allowNullValues);
- addField(builder, "lineageStart", event.getLineageStartDate(), allowNullValues);
- addField(builder, "details", event.getDetails(), allowNullValues);
- addField(builder, "componentId", event.getComponentId(), allowNullValues);
- addField(builder, "componentType", event.getComponentType(), allowNullValues);
- addField(builder, "componentName", componentName, allowNullValues);
- addField(builder, "processGroupId", processGroupId, allowNullValues);
- addField(builder, "processGroupName", processGroupName, allowNullValues);
- addField(builder, "entityId", event.getFlowFileUuid(), allowNullValues);
- addField(builder, "entityType", "org.apache.nifi.flowfile.FlowFile", allowNullValues);
- addField(builder, "entitySize", event.getFileSize(), allowNullValues);
- addField(builder, "previousEntitySize", event.getPreviousFileSize(), allowNullValues);
- addField(builder, factory, "updatedAttributes", event.getUpdatedAttributes(), allowNullValues);
- addField(builder, factory, "previousAttributes", event.getPreviousAttributes(), allowNullValues);
-
- addField(builder, "actorHostname", hostname, allowNullValues);
- if (nifiUrl != null) {
- // TO get URL Prefix, we just remove the /nifi from the end of the URL. We know
- // that the URL ends with
- // "/nifi" because the Property Validator enforces it
- final String urlString = nifiUrl.toString();
- final String urlPrefix = urlString.substring(0,
- urlString.length() - DESTINATION_URL_PATH.length());
-
- final String contentUriBase = urlPrefix + "/nifi-api/provenance-events/" + event.getEventId()
- + "/content/";
- final String nodeIdSuffix = nodeIdentifier == null ? "" : "?clusterNodeId=" + nodeIdentifier;
- addField(builder, "contentURI", contentUriBase + "output" + nodeIdSuffix, allowNullValues);
- addField(builder, "previousContentURI", contentUriBase + "input" + nodeIdSuffix,
- allowNullValues);
- }
+ try {
+ processProvenanceData(context);
- addField(builder, factory, "parentIds", event.getParentUuids(), allowNullValues);
- addField(builder, factory, "childIds", event.getChildUuids(), allowNullValues);
- addField(builder, "transitUri", event.getTransitUri(), allowNullValues);
- addField(builder, "remoteIdentifier", event.getSourceSystemFlowFileIdentifier(), allowNullValues);
- addField(builder, "alternateIdentifier", event.getAlternateIdentifierUri(), allowNullValues);
- addField(builder, "platform", platform, allowNullValues);
- addField(builder, "application", applicationName, allowNullValues);
- return builder.build();
+ } catch (final Exception e) {
+ getLogger().error("Failed to publish metrics to Azure Log Analytics", e);
}
-
- @OnUnscheduled
- public void onUnscheduled() {
- if (consumer != null) {
- getLogger().debug("Disabling schedule to consume provenance data.");
- consumer.setScheduled(false);
- }
+ }
+
+ @Override
+ public void migrateProperties(PropertyConfiguration config) {
+ config.renameProperty("s2s-prov-task-event-filter", FILTER_EVENT_TYPE.getName());
+ config.renameProperty("s2s-prov-task-event-filter-exclude", FILTER_EVENT_TYPE_EXCLUDE.getName());
+ config.renameProperty("s2s-prov-task-type-filter", FILTER_COMPONENT_TYPE.getName());
+ config.renameProperty("s2s-prov-task-type-filter-exclude", FILTER_COMPONENT_TYPE_EXCLUDE.getName());
+ config.renameProperty("s2s-prov-task-id-filter", FILTER_COMPONENT_ID.getName());
+ config.renameProperty("s2s-prov-task-id-filter-exclude", FILTER_COMPONENT_ID_EXCLUDE.getName());
+ config.renameProperty("s2s-prov-task-name-filter", FILTER_COMPONENT_NAME.getName());
+ config.renameProperty("s2s-prov-task-name-filter-exclude", FILTER_COMPONENT_NAME_EXCLUDE.getName());
+ config.renameProperty("start-position", START_POSITION.getName());
+ config.renameProperty("include-null-values", ALLOW_NULL_VALUES.getName());
+ }
+
+ public void processProvenanceData(final ReportingContext context) {
+ getLogger().debug("Starting to process provenance data");
+ final String workspaceId = context.getProperty(LOG_ANALYTICS_WORKSPACE_ID)
+ .evaluateAttributeExpressions().getValue();
+ final String linuxPrimaryKey = context.getProperty(LOG_ANALYTICS_WORKSPACE_KEY)
+ .evaluateAttributeExpressions().getValue();
+ final String logName = context.getProperty(LOG_ANALYTICS_CUSTOM_LOG_NAME).evaluateAttributeExpressions()
+ .getValue();
+ final String urlEndpointFormat = context.getProperty(LOG_ANALYTICS_URL_ENDPOINT_FORMAT)
+ .evaluateAttributeExpressions().getValue();
+ final Integer batchSize = context.getProperty(BATCH_SIZE).asInteger();
+ final String dataCollectorEndpoint = MessageFormat.format(urlEndpointFormat, workspaceId);
+ final ProcessGroupStatus procGroupStatus = context.getEventAccess().getControllerStatus();
+ final String nodeId = context.getClusterNodeIdentifier();
+ final String rootGroupName = procGroupStatus == null ? null : procGroupStatus.getName();
+ final String platform = context.getProperty(PLATFORM).evaluateAttributeExpressions().getValue();
+ final Boolean allowNullValues = context.getProperty(ALLOW_NULL_VALUES).asBoolean();
+ final String nifiUrl = context.getProperty(INSTANCE_URL).evaluateAttributeExpressions().getValue();
+ URL url;
+ try {
+ url = URI.create(nifiUrl).toURL();
+ } catch (IllegalArgumentException | MalformedURLException e) {
+ throw new AssertionError();
}
- public static void addField(final JsonObjectBuilder builder, final String key, final Object value,
- boolean allowNullValues) {
- switch (value) {
- case String s -> builder.add(key, s);
- case Integer i -> builder.add(key, i);
- case Boolean b -> builder.add(key, b);
- case Long l -> builder.add(key, l);
- case null -> {
- if (allowNullValues) builder.add(key, JsonValue.NULL);
- }
- default -> builder.add(key, value.toString());
- }
- }
+ final String hostname = url.getHost();
+ final Map<String, Object> config = Collections.emptyMap();
+ final JsonBuilderFactory factory = Json.createBuilderFactory(config);
+ final JsonObjectBuilder builder = factory.createObjectBuilder();
+ CreateConsumer(context);
+ consumer.consumeEvents(context, (mapHolder, events) -> {
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append('[');
+ for (final ProvenanceEventRecord event : events) {
+ final String componentName = mapHolder.getComponentName(event.getComponentId());
+ final String processGroupId = mapHolder.getProcessGroupId(event.getComponentId(),
+ event.getComponentType());
+ final String processGroupName = mapHolder.getComponentName(processGroupId);
+ final JsonObject jo = serialize(factory, builder, event, componentName,
+ processGroupId, processGroupName, hostname, url, rootGroupName,
+ platform, nodeId, allowNullValues);
+ stringBuilder.append(jo.toString());
+ stringBuilder.append(',');
+ }
+ if (stringBuilder.charAt(stringBuilder.length() - 1) == ',')
+ stringBuilder.deleteCharAt(stringBuilder.length() - 1);
+ stringBuilder.append(']');
+ String str = stringBuilder.toString();
+ if (!str.equals("[]")) {
+ final HttpPost httpPost = new HttpPost(dataCollectorEndpoint);
+ httpPost.addHeader("Content-Type", "application/json");
+ httpPost.addHeader("Log-Type", logName);
+ getLogger().debug("Sending {} events of length {} to azure log analytics {}", batchSize, str.length(), logName);
+ try {
+ sendToLogAnalytics(httpPost, workspaceId, linuxPrimaryKey, str);
- public static void addField(final JsonObjectBuilder builder, final JsonBuilderFactory factory, final String key,
- final Map<String, String> values, Boolean allowNullValues) {
- if (values != null) {
- final JsonObjectBuilder mapBuilder = factory.createObjectBuilder();
- for (final Map.Entry<String, String> entry : values.entrySet()) {
- if (entry.getKey() == null) continue;
- if (entry.getValue() == null) {
- if (allowNullValues) {
- mapBuilder.add(entry.getKey(), JsonValue.NULL);
- }
- } else {
- mapBuilder.add(entry.getKey(), entry.getValue());
- }
- }
-
- builder.add(key, mapBuilder);
- } else if (allowNullValues) {
- builder.add(key, JsonValue.NULL);
+ } catch (final Exception e) {
+ getLogger().error("Failed to publish provenance data to Azure Log Analytics", e);
}
+ }
+ });
+ getLogger().debug("Done processing provenance data");
+ }
+
+ private JsonObject serialize(final JsonBuilderFactory factory, final JsonObjectBuilder builder,
+ final ProvenanceEventRecord event, final String componentName,
+ final String processGroupId, final String processGroupName, final String hostname,
+ final URL nifiUrl, final String applicationName, final String platform,
+ final String nodeIdentifier, Boolean allowNullValues) {
+ addField(builder, "eventId", UUID.randomUUID().toString(), allowNullValues);
+ addField(builder, "eventOrdinal", event.getEventId(), allowNullValues);
+ addField(builder, "eventType", event.getEventType().name(), allowNullValues);
+ addField(builder, "timestampMillis", event.getEventTime(), allowNullValues);
+ addField(builder, "timestamp", DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(event.getEventTime()).atOffset(ZoneOffset.UTC)), allowNullValues);
+ addField(builder, "durationMillis", event.getEventDuration(), allowNullValues);
+ addField(builder, "lineageStart", event.getLineageStartDate(), allowNullValues);
+ addField(builder, "details", event.getDetails(), allowNullValues);
+ addField(builder, "componentId", event.getComponentId(), allowNullValues);
+ addField(builder, "componentType", event.getComponentType(), allowNullValues);
+ addField(builder, "componentName", componentName, allowNullValues);
+ addField(builder, "processGroupId", processGroupId, allowNullValues);
+ addField(builder, "processGroupName", processGroupName, allowNullValues);
+ addField(builder, "entityId", event.getFlowFileUuid(), allowNullValues);
+ addField(builder, "entityType", "org.apache.nifi.flowfile.FlowFile", allowNullValues);
+ addField(builder, "entitySize", event.getFileSize(), allowNullValues);
+ addField(builder, "previousEntitySize", event.getPreviousFileSize(), allowNullValues);
+ addField(builder, factory, "updatedAttributes", event.getUpdatedAttributes(), allowNullValues);
+ addField(builder, factory, "previousAttributes", event.getPreviousAttributes(), allowNullValues);
+
+ addField(builder, "actorHostname", hostname, allowNullValues);
+ if (nifiUrl != null) {
+ // TO get URL Prefix, we just remove the /nifi from the end of the URL. We know
+ // that the URL ends with
+ // "/nifi" because the Property Validator enforces it
+ final String urlString = nifiUrl.toString();
+ final String urlPrefix = urlString.substring(0,
+ urlString.length() - DESTINATION_URL_PATH.length());
+
+ final String contentUriBase = urlPrefix + "/nifi-api/provenance-events/" + event.getEventId()
+ + "/content/";
+ final String nodeIdSuffix = nodeIdentifier == null ? "" : "?clusterNodeId=" + nodeIdentifier;
+ addField(builder, "contentURI", contentUriBase + "output" + nodeIdSuffix, allowNullValues);
+ addField(builder, "previousContentURI", contentUriBase + "input" + nodeIdSuffix,
+ allowNullValues);
}
- public static void addField(final JsonObjectBuilder builder, final JsonBuilderFactory factory, final String key,
- final Collection<String> values, Boolean allowNullValues) {
- if (values != null) {
- builder.add(key, createJsonArray(factory, values));
- } else if (allowNullValues) {
- builder.add(key, JsonValue.NULL);
- }
+ addField(builder, factory, "parentIds", event.getParentUuids(), allowNullValues);
+ addField(builder, factory, "childIds", event.getChildUuids(), allowNullValues);
+ addField(builder, "transitUri", event.getTransitUri(), allowNullValues);
+ addField(builder, "remoteIdentifier", event.getSourceSystemFlowFileIdentifier(), allowNullValues);
+ addField(builder, "alternateIdentifier", event.getAlternateIdentifierUri(), allowNullValues);
+ addField(builder, "platform", platform, allowNullValues);
+ addField(builder, "application", applicationName, allowNullValues);
+ return builder.build();
+ }
+
+ @OnUnscheduled
+ public void onUnscheduled() {
+ if (consumer != null) {
+ getLogger().debug("Disabling schedule to consume provenance data.");
+ consumer.setScheduled(false);
}
-
- private static JsonArrayBuilder createJsonArray(JsonBuilderFactory factory, final Collection<String> values) {
- final JsonArrayBuilder builder = factory.createArrayBuilder();
- for (final String value : values) {
- if (value != null) {
- builder.add(value);
- }
+ }
+
+ public static void addField(final JsonObjectBuilder builder, final String key, final Object value,
+ boolean allowNullValues) {
+ switch (value) {
+ case String s -> builder.add(key, s);
+ case Integer i -> builder.add(key, i);
+ case Boolean b -> builder.add(key, b);
+ case Long l -> builder.add(key, l);
+ case null -> {
+ if (allowNullValues) builder.add(key, JsonValue.NULL);
+ }
+ default -> builder.add(key, value.toString());
+ }
+ }
+
+ public static void addField(final JsonObjectBuilder builder, final JsonBuilderFactory factory, final String key,
+ final Map<String, String> values, Boolean allowNullValues) {
+ if (values != null) {
+ final JsonObjectBuilder mapBuilder = factory.createObjectBuilder();
+ for (final Map.Entry<String, String> entry : values.entrySet()) {
+ if (entry.getKey() == null) continue;
+ if (entry.getValue() == null) {
+ if (allowNullValues) {
+ mapBuilder.add(entry.getKey(), JsonValue.NULL);
+ }
+ } else {
+ mapBuilder.add(entry.getKey(), entry.getValue());
}
- return builder;
+ }
+
+ builder.add(key, mapBuilder);
+ } else if (allowNullValues) {
+ builder.add(key, JsonValue.NULL);
+ }
+ }
+
+ public static void addField(final JsonObjectBuilder builder, final JsonBuilderFactory factory, final String key,
+ final Collection<String> values, Boolean allowNullValues) {
+ if (values != null) {
+ builder.add(key, createJsonArray(factory, values));
+ } else if (allowNullValues) {
+ builder.add(key, JsonValue.NULL);
+ }
+ }
+
+ private static JsonArrayBuilder createJsonArray(JsonBuilderFactory factory, final Collection<String> values) {
+ final JsonArrayBuilder builder = factory.createArrayBuilder();
+ for (final String value : values) {
+ if (value != null) {
+ builder.add(value);
+ }
}
+ return builder;
+ }
}
diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/api/AzureLogAnalyticsMetricsFactory.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/api/AzureLogAnalyticsMetricsFactory.java
index 8dbe58cdbe..a87184a4fa 100644
--- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/api/AzureLogAnalyticsMetricsFactory.java
+++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/api/AzureLogAnalyticsMetricsFactory.java
@@ -116,10 +116,10 @@ public class AzureLogAnalyticsMetricsFactory {
// Append pool stats
virtualMachineMetrics.memoryPoolUsage()
- .forEach((name, usage) -> {
- name = name.toLowerCase().replaceAll("\\s", "_");
- builder.metric("jvm.mem_pool_" + name, usage);
- });
+ .forEach((name, usage) -> {
+ name = name.toLowerCase().replaceAll("\\s", "_");
+ builder.metric("jvm.mem_pool_" + name, usage);
+ });
return builder.build();
diff --git a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/main/java/org/apache/nifi/processors/box/PutBoxFile.java b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/main/java/org/apache/nifi/processors/box/PutBoxFile.java
index 4943240673..5b3bcdb77f 100644
--- a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/main/java/org/apache/nifi/processors/box/PutBoxFile.java
+++ b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/main/java/org/apache/nifi/processors/box/PutBoxFile.java
@@ -233,7 +233,7 @@ public class PutBoxFile extends AbstractBoxProcessor {
}
if (uploadedFileInfo == null) {
- uploadedFileInfo = createBoxFile(parentFolder, filename, rawIn, size, chunkUploadThreshold);
+ uploadedFileInfo = createBoxFile(parentFolder, filename, rawIn, size, chunkUploadThreshold);
}
} catch (BoxAPIResponseException e) {
if (e.getResponseCode() == CONFLICT_RESPONSE_CODE) {
@@ -325,7 +325,7 @@ public class PutBoxFile extends AbstractBoxProcessor {
final BoxFolder newParentFolder = getOrCreateFolder(subFolderNames.poll(), parentFolder, createFolder);
if (!subFolderNames.isEmpty()) {
- return getOrCreateSubfolders(subFolderNames, newParentFolder, createFolder);
+ return getOrCreateSubfolders(subFolderNames, newParentFolder, createFolder);
} else {
return newParentFolder;
}
@@ -339,8 +339,8 @@ public class PutBoxFile extends AbstractBoxProcessor {
}
if (!createFolder) {
- throw new ProcessException(format("The specified subfolder [%s] does not exist and [%s] is false.",
- folderName, CREATE_SUBFOLDER.getDisplayName()));
+ throw new ProcessException(format("The specified subfolder [%s] does not exist and [%s] is false.",
+ folderName, CREATE_SUBFOLDER.getDisplayName()));
}
return createFolder(folderName, parentFolder);
@@ -350,7 +350,7 @@ public class PutBoxFile extends AbstractBoxProcessor {
getLogger().info("Creating Folder [{}], Parent [{}]", folderName, parentFolder.getID());
try {
- return parentFolder.createFolder(folderName).getResource();
+ return parentFolder.createFolder(folderName).getResource();
} catch (BoxAPIResponseException e) {
if (e.getResponseCode() != CONFLICT_RESPONSE_CODE) {
throw e;
diff --git a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/PutBoxFileTest.java b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/PutBoxFileTest.java
index 1c1032cbd3..6c620a786b 100644
--- a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/PutBoxFileTest.java
+++ b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/PutBoxFileTest.java
@@ -71,7 +71,7 @@ public class PutBoxFileTest extends AbstractBoxFileTest {
final PutBoxFile testSubject = new PutBoxFile() {
@Override
BoxFolder getFolder(String folderId) {
- return mockBoxFolders.get(folderId);
+ return mockBoxFolders.get(folderId);
}
};
diff --git a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/utils/BoxDateTest.java b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/utils/BoxDateTest.java
index ce6ebcccaa..045fa703bb 100644
--- a/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/utils/BoxDateTest.java
+++ b/nifi-extension-bundles/nifi-box-bundle/nifi-box-processors/src/test/java/org/apache/nifi/processors/box/utils/BoxDateTest.java
@@ -30,7 +30,7 @@ class BoxDateTest {
"2025-01-01, 2025-01-01T00:00:00.000Z",
"2025-02-25, 2025-02-25T00:00:00.000Z",
"2025-11-10, 2025-11-10T00:00:00.000Z",
- })
+ })
void format(final LocalDate date, final String expected) {
final BoxDate boxDate = BoxDate.of(date);
final String formatted = boxDate.format();
diff --git a/nifi-extension-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java b/nifi-extension-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java
index 5591cfde1b..9003d68ac5 100644
--- a/nifi-extension-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java
+++ b/nifi-extension-bundles/nifi-compress-bundle/nifi-compress-processors/src/main/java/org/apache/nifi/processors/compress/ModifyCompression.java
@@ -273,7 +273,7 @@ public class ModifyCompression extends AbstractProcessor {
case LZMA -> new LzmaInputStream(parentInputStream, new Decoder());
case XZ_LZMA2 -> new XZInputStream(parentInputStream);
case BZIP2 -> // need this two-arg constructor to support concatenated streams
- new BZip2CompressorInputStream(parentInputStream, true);
+ new BZip2CompressorInputStream(parentInputStream, true);
case GZIP -> GzipCompressorInputStream.builder().setInputStream(parentInputStream).setDecompressConcatenated(true).get();
case DEFLATE -> new InflaterInputStream(parentInputStream);
case SNAPPY -> new SnappyInputStream(parentInputStream);
diff --git a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPutElasticsearch.java b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPutElasticsearch.java
index bc9ea062e7..a24eabeaa2 100644
--- a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPutElasticsearch.java
+++ b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/AbstractPutElasticsearch.java
@@ -215,7 +215,7 @@ public abstract class AbstractPutElasticsearch extends AbstractProcessor impleme
indexOpValidationResult.valid(false)
.explanation(String.format("%s must be Expression Language or one of %s",
INDEX_OP.getDisplayName(), ALLOWED_INDEX_OPERATIONS)
- );
+ );
} else {
indexOpValidationResult.valid(true);
}
diff --git a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/AbstractByQueryElasticsearchTest.java b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/AbstractByQueryElasticsearchTest.java
index 78da85cd97..873adfd790 100644
--- a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/AbstractByQueryElasticsearchTest.java
+++ b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/AbstractByQueryElasticsearchTest.java
@@ -130,12 +130,12 @@ public abstract class AbstractByQueryElasticsearchTest {
'%s' validated against 'not-a-service' is invalid because Property references a Controller Service that does not exist
'%s' validated against 'not-a-service' is invalid because Invalid Controller Service: not-a-service is not a valid Controller Service Identifier
""",
- ElasticsearchRestProcessor.QUERY_DEFINITION_STYLE.getName(),
- Arrays.stream(QueryDefinitionType.values()).map(QueryDefinitionType::getValue).collect(Collectors.joining(", ")),
- ElasticsearchRestProcessor.INDEX.getName(), ElasticsearchRestProcessor.INDEX.getName(),
- ElasticsearchRestProcessor.TYPE.getName(), ElasticsearchRestProcessor.TYPE.getName(),
- ElasticsearchRestProcessor.MAX_JSON_FIELD_STRING_LENGTH.getName(),
- ElasticsearchRestProcessor.CLIENT_SERVICE.getDisplayName(), ElasticsearchRestProcessor.CLIENT_SERVICE.getDisplayName());
+ ElasticsearchRestProcessor.QUERY_DEFINITION_STYLE.getName(),
+ Arrays.stream(QueryDefinitionType.values()).map(QueryDefinitionType::getValue).collect(Collectors.joining(", ")),
+ ElasticsearchRestProcessor.INDEX.getName(), ElasticsearchRestProcessor.INDEX.getName(),
+ ElasticsearchRestProcessor.TYPE.getName(), ElasticsearchRestProcessor.TYPE.getName(),
+ ElasticsearchRestProcessor.MAX_JSON_FIELD_STRING_LENGTH.getName(),
+ ElasticsearchRestProcessor.CLIENT_SERVICE.getDisplayName(), ElasticsearchRestProcessor.CLIENT_SERVICE.getDisplayName());
assertEquals(expected, assertionError.getMessage());
}
diff --git a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/JsonUtils.java b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/JsonUtils.java
index f2e96c7c48..e5d296ac0e 100644
--- a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/JsonUtils.java
+++ b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/JsonUtils.java
@@ -60,9 +60,9 @@ public class JsonUtils {
}
static List<String> readListOfMapsAsIndividualJson(final String json) {
- return readListOfMaps(json).stream()
- .map(JsonUtils::prettyPrint)
- .collect(Collectors.toList());
+ return readListOfMaps(json).stream()
+ .map(JsonUtils::prettyPrint)
+ .collect(Collectors.toList());
}
@SuppressWarnings("unchecked")
diff --git a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-test-utils/src/main/java/org/apache/nifi/elasticsearch/integration/AbstractElasticsearchITBase.java b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-test-utils/src/main/java/org/apache/nifi/elasticsearch/integration/AbstractElasticsearchITBase.java
index a27b0c195d..3ccc53bd92 100644
--- a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-test-utils/src/main/java/org/apache/nifi/elasticsearch/integration/AbstractElasticsearchITBase.java
+++ b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-test-utils/src/main/java/org/apache/nifi/elasticsearch/integration/AbstractElasticsearchITBase.java
@@ -70,7 +70,7 @@ public abstract class AbstractElasticsearchITBase {
.withEnv("http.port", String.valueOf(PORT))
.withExposedPorts(PORT)
.withCreateContainerCmdModifier(cmd -> cmd.withHostConfig(
- new HostConfig().withPortBindings(new PortBinding(Ports.Binding.bindPort(PORT), new ExposedPort(PORT)))
+ new HostConfig().withPortBindings(new PortBinding(Ports.Binding.bindPort(PORT), new ExposedPort(PORT)))
));
protected static final String CLIENT_SERVICE_NAME = "Client Service";
protected static final String INDEX = "messages";
@@ -107,7 +107,7 @@ public abstract class AbstractElasticsearchITBase {
type = "";
}
System.out.printf("%n%n%n%n%n%n%n%n%n%n%n%n%n%n%nTYPE: %s%nIMAGE: %s:%s%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n",
- type, IMAGE.getRepository(), IMAGE.getVersionPart());
+ type, IMAGE.getRepository(), IMAGE.getVersionPart());
setupTestData();
}
@@ -200,11 +200,11 @@ public abstract class AbstractElasticsearchITBase {
private record SetupAction(String verb, String path, String json) {
@Override
- public String toString() {
- return "SetupAction{" +
- "verb='" + verb + '\'' +
- ", path='" + path + '\'' +
- '}';
- }
+ public String toString() {
+ return "SetupAction{" +
+ "verb='" + verb + '\'' +
+ ", path='" + path + '\'' +
+ '}';
}
+ }
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java b/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java
index 227ed1de01..9ac4a94aa9 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java
@@ -533,11 +533,11 @@ public class JdbcCommon {
* Some missing Avro types - Decimal, Date types. May need some additional work.
*/
for (int i = 1; i <= nrOfColumns; i++) {
- /**
- * as per jdbc 4 specs, getColumnLabel will have the alias for the column, if not it will have the column name.
- * so it may be a better option to check for columnlabel first and if in case it is null is someimplementation,
- * check for alias. Postgres is the one that has the null column names for calculated fields.
- */
+ /**
+ * As per JDBC 4 specs, getColumnLabel will have the alias for the column, if not it will have the column name.
+ * So it may be a better option to check for columnLabel first and if in case it is null in some implementation,
+ * check for alias. Postgres is the one that has the null column names for calculated fields.
+ */
String nameOrLabel = StringUtils.isNotEmpty(meta.getColumnLabel(i)) ? meta.getColumnLabel(i) : meta.getColumnName(i);
String columnName = options.convertNames ? normalizeNameForAvro(nameOrLabel) : nameOrLabel;
switch (meta.getColumnType(i)) {
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/FlowFileEventBatch.java b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/FlowFileEventBatch.java
index 37eacab347..719d058479 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/FlowFileEventBatch.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/FlowFileEventBatch.java
@@ -23,23 +23,23 @@ import java.util.List;
public final class FlowFileEventBatch<E extends NetworkEvent> {
- private FlowFile flowFile;
- private List<E> events;
+ private FlowFile flowFile;
+ private List<E> events;
- public FlowFileEventBatch(final FlowFile flowFile, final List<E> events) {
- this.flowFile = flowFile;
- this.events = events;
- }
+ public FlowFileEventBatch(final FlowFile flowFile, final List<E> events) {
+ this.flowFile = flowFile;
+ this.events = events;
+ }
- public FlowFile getFlowFile() {
- return flowFile;
- }
+ public FlowFile getFlowFile() {
+ return flowFile;
+ }
- public List<E> getEvents() {
- return events;
- }
+ public List<E> getEvents() {
+ return events;
+ }
- public void setFlowFile(FlowFile flowFile) {
- this.flowFile = flowFile;
- }
+ public void setFlowFile(FlowFile flowFile) {
+ this.flowFile = flowFile;
+ }
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
index 6f101f5444..1f85ac3171 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
@@ -84,52 +84,52 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
private static final Pattern LOCAL_FILE_SYSTEM_URI = Pattern.compile("^file:.*");
private static final String NORMALIZE_ERROR_WITH_PROPERTY = "The filesystem component of the URI configured in the '{}' property ({}) does not match " +
- "the filesystem URI from the Hadoop configuration file ({}) and will be ignored.";
+ "the filesystem URI from the Hadoop configuration file ({}) and will be ignored.";
private static final String NORMALIZE_ERROR_WITHOUT_PROPERTY = "The filesystem component of the URI configured ({}) does not match the filesystem URI from " +
- "the Hadoop configuration file ({}) and will be ignored.";
+ "the Hadoop configuration file ({}) and will be ignored.";
// properties
public static final PropertyDescriptor HADOOP_CONFIGURATION_RESOURCES = new PropertyDescriptor.Builder()
- .name("Hadoop Configuration Resources")
- .description("A file or comma separated list of files which contains the Hadoop file system configuration. Without this, Hadoop "
- + "will search the classpath for a 'core-site.xml' and 'hdfs-site.xml' file or will revert to a default configuration. "
- + "To use swebhdfs, see 'Additional Details' section of PutHDFS's documentation.")
- .required(false)
- .identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .build();
+ .name("Hadoop Configuration Resources")
+ .description("A file or comma separated list of files which contains the Hadoop file system configuration. Without this, Hadoop "
+ + "will search the classpath for a 'core-site.xml' and 'hdfs-site.xml' file or will revert to a default configuration. "
+ + "To use swebhdfs, see 'Additional Details' section of PutHDFS's documentation.")
+ .required(false)
+ .identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .build();
public static final PropertyDescriptor DIRECTORY = new PropertyDescriptor.Builder()
- .name("Directory")
- .description("The HDFS directory from which files should be read")
- .required(true)
- .addValidator(StandardValidators.ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
- .build();
+ .name("Directory")
+ .description("The HDFS directory from which files should be read")
+ .required(true)
+ .addValidator(StandardValidators.ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR)
+ .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
+ .build();
public static final PropertyDescriptor COMPRESSION_CODEC = new PropertyDescriptor.Builder()
- .name("Compression Codec")
- .required(true)
- .allowableValues(CompressionType.allowableValues())
- .defaultValue(CompressionType.NONE.toString())
- .build();
+ .name("Compression Codec")
+ .required(true)
+ .allowableValues(CompressionType.allowableValues())
+ .defaultValue(CompressionType.NONE.toString())
+ .build();
public static final PropertyDescriptor ADDITIONAL_CLASSPATH_RESOURCES = new PropertyDescriptor.Builder()
- .name("Additional Classpath Resources")
- .description("A comma-separated list of paths to files and/or directories that will be added to the classpath and used for loading native libraries. " +
- "When specifying a directory, all files with in the directory will be added to the classpath, but further sub-directories will not be included.")
- .required(false)
- .identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY)
- .dynamicallyModifiesClasspath(true)
- .build();
+ .name("Additional Classpath Resources")
+ .description("A comma-separated list of paths to files and/or directories that will be added to the classpath and used for loading native libraries. " +
+ "When specifying a directory, all files with in the directory will be added to the classpath, but further sub-directories will not be included.")
+ .required(false)
+ .identifiesExternalResource(ResourceCardinality.MULTIPLE, ResourceType.FILE, ResourceType.DIRECTORY)
+ .dynamicallyModifiesClasspath(true)
+ .build();
public static final PropertyDescriptor KERBEROS_USER_SERVICE = new PropertyDescriptor.Builder()
- .name("Kerberos User Service")
- .description("Specifies the Kerberos User Controller Service that should be used for authenticating with Kerberos")
- .identifiesControllerService(KerberosUserService.class)
- .required(false)
- .build();
+ .name("Kerberos User Service")
+ .description("Specifies the Kerberos User Controller Service that should be used for authenticating with Kerberos")
+ .identifiesControllerService(KerberosUserService.class)
+ .required(false)
+ .build();
public static final String ABSOLUTE_HDFS_PATH_ATTRIBUTE = "absolute.hdfs.path";
@@ -141,9 +141,9 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
private static final HdfsResources EMPTY_HDFS_RESOURCES = new HdfsResources(null, null, null, null);
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
- HADOOP_CONFIGURATION_RESOURCES,
- KERBEROS_USER_SERVICE,
- ADDITIONAL_CLASSPATH_RESOURCES
+ HADOOP_CONFIGURATION_RESOURCES,
+ KERBEROS_USER_SERVICE,
+ ADDITIONAL_CLASSPATH_RESOURCES
);
// variables shared by all threads of this processor
@@ -291,9 +291,9 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
}
protected List<String> getConfigLocations(PropertyContext context) {
- final ResourceReferences configResources = context.getProperty(HADOOP_CONFIGURATION_RESOURCES).evaluateAttributeExpressions().asResources();
- final List<String> locations = configResources.asLocations();
- return locations;
+ final ResourceReferences configResources = context.getProperty(HADOOP_CONFIGURATION_RESOURCES).evaluateAttributeExpressions().asResources();
+ final List<String> locations = configResources.asLocations();
+ return locations;
}
@OnStopped
@@ -374,7 +374,7 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
final Path workingDir = fs.getWorkingDirectory();
getLogger().info("Initialized a new HDFS File System with working dir: {} default block size: {} default replication: {} config: {}",
- workingDir, fs.getDefaultBlockSize(workingDir), fs.getDefaultReplication(workingDir), config.toString());
+ workingDir, fs.getDefaultBlockSize(workingDir), fs.getDefaultReplication(workingDir), config.toString());
return new HdfsResources(config, fs, ugi, kerberosUser);
}
@@ -546,7 +546,7 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
}
protected Path getNormalizedPath(final String rawPath) {
- return getNormalizedPath(rawPath, Optional.empty());
+ return getNormalizedPath(rawPath, Optional.empty());
}
protected Path getNormalizedPath(final ProcessContext context, final PropertyDescriptor property, final FlowFile flowFile) {
@@ -585,16 +585,15 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen
protected <T extends Throwable> Optional<T> findCause(Throwable t, Class<T> expectedCauseType, Predicate<T> causePredicate) {
Stream<Throwable> causalChain = Throwables.getCausalChain(t).stream();
return causalChain
- .filter(expectedCauseType::isInstance)
- .map(expectedCauseType::cast)
- .filter(causePredicate)
- .findFirst();
+ .filter(expectedCauseType::isInstance)
+ .map(expectedCauseType::cast)
+ .filter(causePredicate)
+ .findFirst();
}
protected boolean handleAuthErrors(Throwable t, ProcessSession session, ProcessContext context, BiConsumer<ProcessSession, ProcessContext> sessionHandler) {
Optional<GSSException> causeOptional = findCause(t, GSSException.class, gsse -> GSSException.NO_CRED == gsse.getMajor());
if (causeOptional.isPresent()) {
-
getLogger().error("An error occurred while connecting to HDFS. Rolling back session and, and resetting HDFS resources", causeOptional.get());
try {
hdfsResources.set(resetHDFSResources(getConfigLocations(context), context));
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java
index 41c7c249ff..893f8f1899 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java
@@ -289,7 +289,7 @@ public abstract class AbstractListProcessor<T extends ListableEntity> extends Ab
@Override
public Set<Relationship> getRelationships() {
- return RELATIONSHIPS;
+ return RELATIONSHIPS;
}
/**
@@ -553,7 +553,7 @@ public abstract class AbstractListProcessor<T extends ListableEntity> extends Ab
.forEach(entity -> orderedEntries
.computeIfAbsent(entity.getTimestamp(), __ -> new ArrayList<>())
.add(entity)
- );
+ );
if (getLogger().isTraceEnabled()) {
getLogger().trace("orderedEntries: {}",
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/ExceptionHandler.java b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/ExceptionHandler.java
index a9d14a82ea..719361b05b 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/ExceptionHandler.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/ExceptionHandler.java
@@ -215,7 +215,7 @@ public class ExceptionHandler<C> {
case 0 -> "[]";
case 1 -> flowFiles.getFirst();
default ->
- String.format("%d FlowFiles including %s", flowFiles.size(), flowFiles.get(0));
+ String.format("%d FlowFiles including %s", flowFiles.size(), flowFiles.get(0));
};
}
throw new ProcessException(String.format("Failed to process %s due to %s", inputs, e), e);
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/PartialFunctions.java b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/PartialFunctions.java
index 824a423dfa..4b18db5301 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/PartialFunctions.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/main/java/org/apache/nifi/processor/util/pattern/PartialFunctions.java
@@ -84,7 +84,7 @@ public class PartialFunctions {
public static <FCT> PartialFunctions.TransferFlowFiles<FCT> transferRoutedFlowFiles() {
return (context, session, functionContext, result)
-> result.getRoutedFlowFiles().forEach(((relationship, routedFlowFiles)
- -> session.transfer(routedFlowFiles, relationship)));
+ -> session.transfer(routedFlowFiles, relationship)));
}
@FunctionalInterface
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
index 4a038ec0f7..c2a1643455 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
@@ -204,7 +204,7 @@ public class AvroTypeUtil {
}
private static Schema buildAvroSchema(final DataType dataType, final String fieldName, String fieldNamePrefix, final boolean nullable) {
- Schema schema = null;
+ Schema schema = null;
switch (dataType.getFieldType()) {
case ARRAY:
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/InferenceSchemaStrategy.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/InferenceSchemaStrategy.java
index 0d1ade301d..263c116c4c 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/InferenceSchemaStrategy.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/InferenceSchemaStrategy.java
@@ -68,7 +68,7 @@ public class InferenceSchemaStrategy implements JsonSchemaAccessStrategy {
case Date ignored -> RecordFieldType.DATE.getDataType();
case BigDecimal bigDecimal ->
- RecordFieldType.DECIMAL.getDecimalDataType(bigDecimal.precision(), bigDecimal.scale());
+ RecordFieldType.DECIMAL.getDecimalDataType(bigDecimal.precision(), bigDecimal.scale());
case List listField -> {
DataType mergedDataType = null;
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
index 3c12109ab0..b8a3b863eb 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
@@ -379,27 +379,27 @@ public class TestAvroTypeUtil {
* @throws IOException
* schema not found.
*/
- @Test
- public void testDefaultArrayValuesInRecordsCase2() throws IOException {
- Schema avroSchema = new Schema.Parser().parse(getClass().getResourceAsStream("defaultArrayInRecords2.json"));
- GenericRecordBuilder builder = new GenericRecordBuilder(avroSchema);
- Record field1Record = new GenericRecordBuilder(avroSchema.getField("field1").schema()).build();
- builder.set("field1", field1Record);
- Record r = builder.build();
-
- @SuppressWarnings("unchecked")
- GenericArray<Integer> values = (GenericArray<Integer>) ((GenericRecord) r.get("field1")).get("listOfInt");
- assertArrayEquals(new Object[] {1, 2, 3}, values.toArray());
- RecordSchema record = AvroTypeUtil.createSchema(avroSchema);
- RecordField field = record.getField("field1").get();
- assertEquals(RecordFieldType.RECORD, field.getDataType().getFieldType());
- RecordDataType data = (RecordDataType) field.getDataType();
- RecordSchema childSchema = data.getChildSchema();
- RecordField childField = childSchema.getField("listOfInt").get();
- assertEquals(RecordFieldType.ARRAY, childField.getDataType().getFieldType());
- assertInstanceOf(Object[].class, childField.getDefaultValue());
- assertArrayEquals(new Object[] {1, 2, 3}, ((Object[]) childField.getDefaultValue()));
- }
+ @Test
+ public void testDefaultArrayValuesInRecordsCase2() throws IOException {
+ Schema avroSchema = new Schema.Parser().parse(getClass().getResourceAsStream("defaultArrayInRecords2.json"));
+ GenericRecordBuilder builder = new GenericRecordBuilder(avroSchema);
+ Record field1Record = new GenericRecordBuilder(avroSchema.getField("field1").schema()).build();
+ builder.set("field1", field1Record);
+ Record r = builder.build();
+
+ @SuppressWarnings("unchecked")
+ GenericArray<Integer> values = (GenericArray<Integer>) ((GenericRecord) r.get("field1")).get("listOfInt");
+ assertArrayEquals(new Object[] {1, 2, 3}, values.toArray());
+ RecordSchema record = AvroTypeUtil.createSchema(avroSchema);
+ RecordField field = record.getField("field1").get();
+ assertEquals(RecordFieldType.RECORD, field.getDataType().getFieldType());
+ RecordDataType data = (RecordDataType) field.getDataType();
+ RecordSchema childSchema = data.getChildSchema();
+ RecordField childField = childSchema.getField("listOfInt").get();
+ assertEquals(RecordFieldType.ARRAY, childField.getDataType().getFieldType());
+ assertInstanceOf(Object[].class, childField.getDefaultValue());
+ assertArrayEquals(new Object[] {1, 2, 3}, ((Object[]) childField.getDefaultValue()));
+ }
@Test
// Simple recursion is a record A composing itself (similar to a LinkedList Node
// referencing 'next')
@@ -608,8 +608,8 @@ public class TestAvroTypeUtil {
@Test
public void testConvertAvroRecordToMapWithFieldTypeOfFixedAndLogicalTypeDecimal() {
- // Create a field schema like {"type":"fixed","name":"amount","size":16,"logicalType":"decimal","precision":18,"scale":8}
- final LogicalTypes.Decimal decimalType = LogicalTypes.decimal(18, 8);
+ // Create a field schema like {"type":"fixed","name":"amount","size":16,"logicalType":"decimal","precision":18,"scale":8}
+ final LogicalTypes.Decimal decimalType = LogicalTypes.decimal(18, 8);
final Schema fieldSchema = Schema.createFixed("amount", null, null, 16);
decimalType.addToSchema(fieldSchema);
@@ -1336,7 +1336,7 @@ public class TestAvroTypeUtil {
}
private Schema givenAvroSchemaContainingNumericMap() {
- Map<String, Long> defaultLongMap = new HashMap<>();
+ Map<String, Long> defaultLongMap = new HashMap<>();
final List<Field> avroFields = Arrays.asList(
new Field("id", Schema.create(Type.INT), "", 0),
new Field("numbers", Schema.createMap(Schema.create(Type.LONG)), "", defaultLongMap)
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
index 711ec075ab..7882297900 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
@@ -199,7 +199,7 @@ public abstract class AbstractPutHDFSRecord extends AbstractHadoopProcessor {
@Override
public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- return putHdfsRecordProperties;
+ return putHdfsRecordProperties;
}
@Override
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/MetricsService.java b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/MetricsService.java
index 7f7a17d93d..bee56fc0ad 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/MetricsService.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/MetricsService.java
@@ -213,8 +213,8 @@ public class MetricsService {
.add(MetricFields.TIMESTAMP, currentTimeMillis);
objectBuilder
- .add(MetricNames.CORES, availableProcessors)
- .add(MetricNames.LOAD1MN, systemLoad);
+ .add(MetricNames.CORES, availableProcessors)
+ .add(MetricNames.LOAD1MN, systemLoad);
Map<String, Integer> integerMetrics = getIntegerMetrics(virtualMachineMetrics);
for (String key : integerMetrics.keySet()) {
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricBuilder.java b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricBuilder.java
index fbbf45f08c..51f36f4bbb 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricBuilder.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricBuilder.java
@@ -86,7 +86,7 @@ public class MetricBuilder {
}
public JsonObject build() {
- return build(false);
+ return build(false);
}
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricsBuilder.java b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricsBuilder.java
index 8425d1fff4..1050b9594f 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricsBuilder.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/metrics/api/MetricsBuilder.java
@@ -92,6 +92,6 @@ public class MetricsBuilder {
}
public JsonObject build() {
- return build(false);
+ return build(false);
}
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-syslog-utils/src/main/java/org/apache/nifi/syslog/parsers/SyslogParser.java b/nifi-extension-bundles/nifi-extension-utils/nifi-syslog-utils/src/main/java/org/apache/nifi/syslog/parsers/SyslogParser.java
index 165dc395d5..6a139eae60 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-syslog-utils/src/main/java/org/apache/nifi/syslog/parsers/SyslogParser.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-syslog-utils/src/main/java/org/apache/nifi/syslog/parsers/SyslogParser.java
@@ -39,7 +39,7 @@ public class SyslogParser {
public static final String SYSLOG_MSG_RFC5424_0 =
"(?:\\<(\\d{1,3})\\>)" + // priority
"(?:(\\d)?\\s?)" + // version
- /* yyyy-MM-dd'T'HH:mm:ss.SZ or yyyy-MM-dd'T'HH:mm:ss.S+hh:mm or - (null stamp) */
+ /* yyyy-MM-dd'T'HH:mm:ss.SZ or yyyy-MM-dd'T'HH:mm:ss.S+hh:mm or - (null stamp) */
"(?:" +
"(\\d{4}[-]\\d{2}[-]\\d{2}[T]\\d{2}[:]\\d{2}[:]\\d{2}" +
"(?:\\.\\d{1,6})?(?:[+-]\\d{2}[:]\\d{2}|Z)?)|-)" + // stamp
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/proto/ProtoUtils.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/proto/ProtoUtils.java
index 8dfda739e0..c1abf0ab73 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/proto/ProtoUtils.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/proto/ProtoUtils.java
@@ -33,94 +33,94 @@ import java.util.Map;
*/
public class ProtoUtils {
- public static DynamicMessage createMessage(Descriptors.Descriptor descriptor, Map<String, Object> valueMap, TableSchema tableSchema) {
- final DynamicMessage.Builder builder = DynamicMessage.newBuilder(descriptor);
-
- for (final Descriptors.FieldDescriptor field : descriptor.getFields()) {
- final String name = field.getName();
- Object value = valueMap.get(name);
- if (value == null) {
- continue;
- }
-
- switch (field.getType()) {
- case MESSAGE:
- if (field.isRepeated()) {
- final Collection<Map<String, Object>> valueMaps;
- if (value instanceof Object[] arrayValue) {
- valueMaps = Arrays.stream(arrayValue)
- .map(item -> (Map<String, Object>) item).toList();
- } else if (value instanceof Map<?, ?> mapValue) {
- valueMaps = mapValue.entrySet().stream()
- .map(entry -> Map.of(
- "key", entry.getKey(),
- "value", entry.getValue()
- )).toList();
- } else {
- valueMaps = (Collection<Map<String, Object>>) value;
- }
- valueMaps.forEach(act -> builder.addRepeatedField(field, createMessage(field.getMessageType(), act, tableSchema)));
- } else {
- builder.setField(field, createMessage(field.getMessageType(), (Map<String, Object>) value, tableSchema));
- }
- break;
-
- // INT64 with alias INT, SMALLINT, INTEGER, BIGINT, TINYINT, BYTEINT
- case INT64:
- // Integer in the bigquery table schema maps back to INT64 which is considered to be Long on Java side:
- // https://developers.google.com/protocol-buffers/docs/proto3
- if (value instanceof Integer) {
- value = Long.valueOf((Integer) value);
- }
-
- setField(value, field, builder);
- break;
-
- // FLOAT64
- case DOUBLE:
- if (value instanceof Float) {
- value = Double.valueOf(value.toString());
- }
- setField(value, field, builder);
- break;
-
- // matches NUMERIC and BIGNUMERIC types in BigQuery
- // BQTableSchemaToProtoDescriptor.class
- case BYTES:
- if (value instanceof Integer) {
- value = new BigDecimal((int) value);
- } else if (value instanceof Long) {
- value = new BigDecimal((long) value);
- } else if (value instanceof Float || value instanceof Double) {
- value = new BigDecimal(value.toString());
- }
-
- if (value instanceof BigDecimal) {
- if (tableSchema.getFields(field.getIndex()).getType().equals(Type.BIGNUMERIC)) {
- value = BigDecimalByteStringEncoder.encodeToBigNumericByteString((BigDecimal) value);
- } else if (tableSchema.getFields(field.getIndex()).getType().equals(Type.NUMERIC)) {
- value = BigDecimalByteStringEncoder.encodeToNumericByteString((BigDecimal) value);
- }
- }
-
- setField(value, field, builder);
- break;
-
- default:
- setField(value, field, builder);
- break;
- }
- }
-
- return builder.build();
- }
-
- private static void setField(final Object value, final Descriptors.FieldDescriptor field, final DynamicMessage.Builder builder) {
- if (field.isRepeated()) {
- Collection collection = value.getClass().isArray() ? Arrays.asList((Object[]) value) : (Collection) value;
- collection.forEach(act -> builder.addRepeatedField(field, act));
- } else {
- builder.setField(field, value);
- }
- }
-}
\ No newline at end of file
+ public static DynamicMessage createMessage(Descriptors.Descriptor descriptor, Map<String, Object> valueMap, TableSchema tableSchema) {
+ final DynamicMessage.Builder builder = DynamicMessage.newBuilder(descriptor);
+
+ for (final Descriptors.FieldDescriptor field : descriptor.getFields()) {
+ final String name = field.getName();
+ Object value = valueMap.get(name);
+ if (value == null) {
+ continue;
+ }
+
+ switch (field.getType()) {
+ case MESSAGE:
+ if (field.isRepeated()) {
+ final Collection<Map<String, Object>> valueMaps;
+ if (value instanceof Object[] arrayValue) {
+ valueMaps = Arrays.stream(arrayValue)
+ .map(item -> (Map<String, Object>) item).toList();
+ } else if (value instanceof Map<?, ?> mapValue) {
+ valueMaps = mapValue.entrySet().stream()
+ .map(entry -> Map.of(
+ "key", entry.getKey(),
+ "value", entry.getValue()
+ )).toList();
+ } else {
+ valueMaps = (Collection<Map<String, Object>>) value;
+ }
+ valueMaps.forEach(act -> builder.addRepeatedField(field, createMessage(field.getMessageType(), act, tableSchema)));
+ } else {
+ builder.setField(field, createMessage(field.getMessageType(), (Map<String, Object>) value, tableSchema));
+ }
+ break;
+
+ // INT64 with alias INT, SMALLINT, INTEGER, BIGINT, TINYINT, BYTEINT
+ case INT64:
+ // Integer in the bigquery table schema maps back to INT64 which is considered to be Long on Java side:
+ // https://developers.google.com/protocol-buffers/docs/proto3
+ if (value instanceof Integer) {
+ value = Long.valueOf((Integer) value);
+ }
+
+ setField(value, field, builder);
+ break;
+
+ // FLOAT64
+ case DOUBLE:
+ if (value instanceof Float) {
+ value = Double.valueOf(value.toString());
+ }
+ setField(value, field, builder);
+ break;
+
+ // matches NUMERIC and BIGNUMERIC types in BigQuery
+ // BQTableSchemaToProtoDescriptor.class
+ case BYTES:
+ if (value instanceof Integer) {
+ value = new BigDecimal((int) value);
+ } else if (value instanceof Long) {
+ value = new BigDecimal((long) value);
+ } else if (value instanceof Float || value instanceof Double) {
+ value = new BigDecimal(value.toString());
+ }
+
+ if (value instanceof BigDecimal) {
+ if (tableSchema.getFields(field.getIndex()).getType().equals(Type.BIGNUMERIC)) {
+ value = BigDecimalByteStringEncoder.encodeToBigNumericByteString((BigDecimal) value);
+ } else if (tableSchema.getFields(field.getIndex()).getType().equals(Type.NUMERIC)) {
+ value = BigDecimalByteStringEncoder.encodeToNumericByteString((BigDecimal) value);
+ }
+ }
+
+ setField(value, field, builder);
+ break;
+
+ default:
+ setField(value, field, builder);
+ break;
+ }
+ }
+
+ return builder.build();
+ }
+
+ private static void setField(final Object value, final Descriptors.FieldDescriptor field, final DynamicMessage.Builder builder) {
+ if (field.isRepeated()) {
+ Collection collection = value.getClass().isArray() ? Arrays.asList((Object[]) value) : (Collection) value;
+ collection.forEach(act -> builder.addRepeatedField(field, act));
+ } else {
+ builder.setField(field, value);
+ }
+ }
+}
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java
index b85e99884b..b5d2ef0fbb 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSub.java
@@ -100,12 +100,12 @@ import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.SUBSCRIPTIO
)
@WritesAttributes(
{
- @WritesAttribute(attribute = ACK_ID_ATTRIBUTE, description = ACK_ID_DESCRIPTION),
- @WritesAttribute(attribute = SERIALIZED_SIZE_ATTRIBUTE, description = SERIALIZED_SIZE_DESCRIPTION),
- @WritesAttribute(attribute = MSG_ATTRIBUTES_COUNT_ATTRIBUTE, description = MSG_ATTRIBUTES_COUNT_DESCRIPTION),
- @WritesAttribute(attribute = MSG_PUBLISH_TIME_ATTRIBUTE, description = MSG_PUBLISH_TIME_DESCRIPTION),
- @WritesAttribute(attribute = SUBSCRIPTION_NAME_ATTRIBUTE, description = SUBSCRIPTION_NAME_DESCRIPTION),
- @WritesAttribute(attribute = DYNAMIC_ATTRIBUTES_ATTRIBUTE, description = DYNAMIC_ATTRIBUTES_DESCRIPTION)
+ @WritesAttribute(attribute = ACK_ID_ATTRIBUTE, description = ACK_ID_DESCRIPTION),
+ @WritesAttribute(attribute = SERIALIZED_SIZE_ATTRIBUTE, description = SERIALIZED_SIZE_DESCRIPTION),
+ @WritesAttribute(attribute = MSG_ATTRIBUTES_COUNT_ATTRIBUTE, description = MSG_ATTRIBUTES_COUNT_DESCRIPTION),
+ @WritesAttribute(attribute = MSG_PUBLISH_TIME_ATTRIBUTE, description = MSG_PUBLISH_TIME_DESCRIPTION),
+ @WritesAttribute(attribute = SUBSCRIPTION_NAME_ATTRIBUTE, description = SUBSCRIPTION_NAME_DESCRIPTION),
+ @WritesAttribute(attribute = DYNAMIC_ATTRIBUTES_ATTRIBUTE, description = DYNAMIC_ATTRIBUTES_DESCRIPTION)
}
)
public class ConsumeGCPubSub extends AbstractGCPubSubProcessor {
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/Util.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/Util.java
index b84a56097c..58ae3c2208 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/Util.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/Util.java
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
*/
class Util {
- private static final Pattern CONTENT_DISPOSITION_PATTERN =
+ private static final Pattern CONTENT_DISPOSITION_PATTERN =
Pattern.compile("^(.+);\\s*filename\\s*=\\s*\"([^\"]*)\"");
/**
* Parses the filename from a <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1">Content-Disposition</a>
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/drive/PutGoogleDriveIT.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/drive/PutGoogleDriveIT.java
index 6f57e30222..0d3632f0a6 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/drive/PutGoogleDriveIT.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/drive/PutGoogleDriveIT.java
@@ -135,7 +135,7 @@ public class PutGoogleDriveIT extends AbstractGoogleDriveIT<PutGoogleDrive> {
private void runWithFileContent() {
- runWithFileContent(DEFAULT_FILE_CONTENT);
+ runWithFileContent(DEFAULT_FILE_CONTENT);
}
private void runWithFileContent(String content) {
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java
index 34bbf97918..225d6e61fb 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java
@@ -131,7 +131,7 @@ public abstract class AbstractGCSIT {
*/
protected void putTestFileEncrypted(String key, byte[] bytes) throws StorageException {
storage.create(BlobInfo.newBuilder(BlobId.of(BUCKET, key))
- .build(), bytes, Storage.BlobTargetOption.encryptionKey(ENCRYPTION_KEY));
+ .build(), bytes, Storage.BlobTargetOption.encryptionKey(ENCRYPTION_KEY));
}
/**
diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java
index e435ee85ad..18632705a0 100644
--- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java
+++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java
@@ -55,7 +55,7 @@ public class PutGCSObjectIT extends AbstractGCSIT {
flowFile.assertAttributeNotExists(ENCRYPTION_ALGORITHM_ATTR);
for (Map.Entry<String, String> entry : flowFile.getAttributes().entrySet()) {
- logger.info("{}:{}", entry.getKey(), entry.getValue());
+ logger.info("{}:{}", entry.getKey(), entry.getValue());
}
}
diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
index bbaf4c75f0..f70fad5c33 100644
--- a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
+++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java
@@ -220,7 +220,7 @@ public class ExecuteGraphQueryRecord extends AbstractGraphExecutor {
.getProperty(it.getName())
.evaluateAttributeExpressions(finalInput)
.getValue()))
- );
+ );
long delta;
FlowFile failedRecords = session.create(input);
diff --git a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Files.java b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Files.java
index 6a27f63c88..c1f83c1e20 100644
--- a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Files.java
+++ b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Files.java
@@ -59,7 +59,7 @@ public class Files {
return list == null ? Collections.emptyList() : Arrays.asList(list);
}
if (!f.exists()) {
- logger.warn("path not found for {}", f);
+ logger.warn("path not found for {}", f);
}
return List.of(f);
}
diff --git a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Throwables.java b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Throwables.java
index 48b352addf..7610a314e8 100644
--- a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Throwables.java
+++ b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/util/Throwables.java
@@ -97,9 +97,7 @@ public class Throwables {
String cl = trace[i].getClassName();
if (cl.startsWith("java.") || cl.startsWith("javax.") || cl.startsWith("org.omg.") || cl.startsWith("org.w3c.") || cl.startsWith("org.xml.") || cl.startsWith("groovy.lang.") || cl
.startsWith("groovy.util.") || cl.startsWith("org.codehaus.") || cl.startsWith("com.springsource.") || cl.startsWith("org.springframework.") || cl.startsWith("org.apache.")
- || cl.startsWith("sun.") || cl.startsWith("com.sun.") || cl.startsWith("org.junit.") || cl.startsWith("junit.framework.")
-
- ) {
+ || cl.startsWith("sun.") || cl.startsWith("com.sun.") || cl.startsWith("org.junit.") || cl.startsWith("junit.framework.")) {
//skip standard classes
} else {
traceIndex = i;
diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java
index 244467cdd5..3826c8820a 100644
--- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java
+++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java
@@ -95,88 +95,88 @@ public class GetHDFS extends AbstractHadoopProcessor {
// relationships
public static final Relationship REL_SUCCESS = new Relationship.Builder()
- .name("success")
- .description("All files retrieved from HDFS are transferred to this relationship")
- .build();
+ .name("success")
+ .description("All files retrieved from HDFS are transferred to this relationship")
+ .build();
// properties
public static final PropertyDescriptor RECURSE_SUBDIRS = new PropertyDescriptor.Builder()
- .name("Recurse Subdirectories")
- .description("Indicates whether to pull files from subdirectories of the HDFS directory")
- .required(true)
- .allowableValues("true", "false")
- .defaultValue("true")
- .build();
+ .name("Recurse Subdirectories")
+ .description("Indicates whether to pull files from subdirectories of the HDFS directory")
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("true")
+ .build();
public static final PropertyDescriptor KEEP_SOURCE_FILE = new PropertyDescriptor.Builder()
- .name("Keep Source File")
- .description("Determines whether to delete the file from HDFS after it has been successfully transferred. If true, the file will be fetched repeatedly. This is intended for testing only.")
- .required(true)
- .allowableValues("true", "false")
- .defaultValue("false")
- .build();
+ .name("Keep Source File")
+ .description("Determines whether to delete the file from HDFS after it has been successfully transferred. If true, the file will be fetched repeatedly. This is intended for testing only.")
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("false")
+ .build();
public static final PropertyDescriptor FILE_FILTER_REGEX = new PropertyDescriptor.Builder()
- .name("File Filter Regex")
- .description("A Java Regular Expression for filtering Filenames; if a filter is supplied then only files whose names match that Regular "
- + "Expression will be fetched, otherwise all files will be fetched")
+ .name("File Filter Regex")
+ .description("A Java Regular Expression for filtering Filenames; if a filter is supplied then only files whose names match that Regular "
+ + "Expression will be fetched, otherwise all files will be fetched")
.required(false)
.addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR)
.build();
public static final PropertyDescriptor FILTER_MATCH_NAME_ONLY = new PropertyDescriptor.Builder()
- .name("Filter Match Name Only")
- .description("If true then File Filter Regex will match on just the filename, otherwise subdirectory names will be included with filename "
- + "in the regex comparison")
+ .name("Filter Match Name Only")
+ .description("If true then File Filter Regex will match on just the filename, otherwise subdirectory names will be included with filename "
+ + "in the regex comparison")
.required(true)
.allowableValues("true", "false")
.defaultValue("true")
.build();
public static final PropertyDescriptor IGNORE_DOTTED_FILES = new PropertyDescriptor.Builder()
- .name("Ignore Dotted Files")
- .description("If true, files whose names begin with a dot (\".\") will be ignored")
- .required(true)
- .allowableValues("true", "false")
- .defaultValue("true")
- .build();
+ .name("Ignore Dotted Files")
+ .description("If true, files whose names begin with a dot (\".\") will be ignored")
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("true")
+ .build();
public static final PropertyDescriptor MIN_AGE = new PropertyDescriptor.Builder()
- .name("Minimum File Age")
- .description("The minimum age that a file must be in order to be pulled; any file younger than this amount of time (based on last modification date) will be ignored")
- .required(true)
- .addValidator(StandardValidators.createTimePeriodValidator(0, TimeUnit.MILLISECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS))
- .defaultValue("0 sec")
- .build();
+ .name("Minimum File Age")
+ .description("The minimum age that a file must be in order to be pulled; any file younger than this amount of time (based on last modification date) will be ignored")
+ .required(true)
+ .addValidator(StandardValidators.createTimePeriodValidator(0, TimeUnit.MILLISECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS))
+ .defaultValue("0 sec")
+ .build();
public static final PropertyDescriptor MAX_AGE = new PropertyDescriptor.Builder()
- .name("Maximum File Age")
- .description("The maximum age that a file must be in order to be pulled; any file older than this amount of time (based on last modification date) will be ignored")
- .required(false)
- .addValidator(StandardValidators.createTimePeriodValidator(100, TimeUnit.MILLISECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS))
- .build();
+ .name("Maximum File Age")
+ .description("The maximum age that a file must be in order to be pulled; any file older than this amount of time (based on last modification date) will be ignored")
+ .required(false)
+ .addValidator(StandardValidators.createTimePeriodValidator(100, TimeUnit.MILLISECONDS, Long.MAX_VALUE, TimeUnit.NANOSECONDS))
+ .build();
public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder()
- .name("Batch Size")
- .description("The maximum number of files to pull in each iteration, based on run schedule.")
- .required(true)
- .defaultValue("100")
- .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
- .build();
+ .name("Batch Size")
+ .description("The maximum number of files to pull in each iteration, based on run schedule.")
+ .required(true)
+ .defaultValue("100")
+ .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
+ .build();
public static final PropertyDescriptor POLLING_INTERVAL = new PropertyDescriptor.Builder()
- .name("Polling Interval")
- .description("Indicates how long to wait between performing directory listings")
- .required(true)
- .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
- .defaultValue("0 sec")
- .build();
+ .name("Polling Interval")
+ .description("Indicates how long to wait between performing directory listings")
+ .required(true)
+ .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
+ .defaultValue("0 sec")
+ .build();
public static final PropertyDescriptor BUFFER_SIZE = new PropertyDescriptor.Builder()
- .name("IO Buffer Size")
- .description("Amount of memory to use to buffer file contents during IO. This overrides the Hadoop Configuration")
- .addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
- .build();
+ .name("IO Buffer Size")
+ .description("Amount of memory to use to buffer file contents during IO. This overrides the Hadoop Configuration")
+ .addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
+ .build();
private static final Set<Relationship> RELATIONSHIPS = Set.of(
REL_SUCCESS
diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
index 10e2aa6cc2..434990cc67 100644
--- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
+++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
@@ -186,7 +186,7 @@ public class ListHDFS extends AbstractHadoopProcessor {
@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- return PROPERTY_DESCRIPTORS;
+ return PROPERTY_DESCRIPTORS;
}
@Override
diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/MoveHDFSTest.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/MoveHDFSTest.java
index 19024c1c1b..f8856bf52c 100644
--- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/MoveHDFSTest.java
+++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/MoveHDFSTest.java
@@ -283,34 +283,34 @@ public class MoveHDFSTest {
}
private void testPutWhenAlreadyExisting(String conflictResolution, Relationship expectedDestination, String expectedContent) throws IOException {
- // GIVEN
- Files.createDirectories(Paths.get(INPUT_DIRECTORY));
- Files.createDirectories(Paths.get(OUTPUT_DIRECTORY));
- Files.copy(Paths.get(TEST_DATA_DIRECTORY, "randombytes-2"), Paths.get(INPUT_DIRECTORY, "randombytes-1"));
- Files.copy(Paths.get(TEST_DATA_DIRECTORY, "randombytes-1"), Paths.get(OUTPUT_DIRECTORY, "randombytes-1"));
+ // GIVEN
+ Files.createDirectories(Paths.get(INPUT_DIRECTORY));
+ Files.createDirectories(Paths.get(OUTPUT_DIRECTORY));
+ Files.copy(Paths.get(TEST_DATA_DIRECTORY, "randombytes-2"), Paths.get(INPUT_DIRECTORY, "randombytes-1"));
+ Files.copy(Paths.get(TEST_DATA_DIRECTORY, "randombytes-1"), Paths.get(OUTPUT_DIRECTORY, "randombytes-1"));
- MoveHDFS processor = new MoveHDFS();
+ MoveHDFS processor = new MoveHDFS();
- TestRunner runner = TestRunners.newTestRunner(processor);
- runner.setProperty(MoveHDFS.INPUT_DIRECTORY_OR_FILE, INPUT_DIRECTORY);
- runner.setProperty(MoveHDFS.OUTPUT_DIRECTORY, OUTPUT_DIRECTORY);
- runner.setProperty(MoveHDFS.CONFLICT_RESOLUTION, conflictResolution);
+ TestRunner runner = TestRunners.newTestRunner(processor);
+ runner.setProperty(MoveHDFS.INPUT_DIRECTORY_OR_FILE, INPUT_DIRECTORY);
+ runner.setProperty(MoveHDFS.OUTPUT_DIRECTORY, OUTPUT_DIRECTORY);
+ runner.setProperty(MoveHDFS.CONFLICT_RESOLUTION, conflictResolution);
- byte[] expected = Files.readAllBytes(Paths.get(TEST_DATA_DIRECTORY, expectedContent));
+ byte[] expected = Files.readAllBytes(Paths.get(TEST_DATA_DIRECTORY, expectedContent));
- // WHEN
- runner.enqueue(new byte[0]);
- runner.run();
+ // WHEN
+ runner.enqueue(new byte[0]);
+ runner.run();
- // THEN
- runner.assertAllFlowFilesTransferred(expectedDestination);
+ // THEN
+ runner.assertAllFlowFilesTransferred(expectedDestination);
- List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(expectedDestination);
- assertEquals(1, flowFiles.size());
+ List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(expectedDestination);
+ assertEquals(1, flowFiles.size());
- byte[] actual = Files.readAllBytes(Paths.get(OUTPUT_DIRECTORY, "randombytes-1"));
+ byte[] actual = Files.readAllBytes(Paths.get(OUTPUT_DIRECTORY, "randombytes-1"));
- assertArrayEquals(expected, actual);
+ assertArrayEquals(expected, actual);
}
private static class TestableMoveHDFS extends MoveHDFS {
diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestGetHDFSFileInfo.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestGetHDFSFileInfo.java
index 05d3870f73..7bb38e2723 100644
--- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestGetHDFSFileInfo.java
+++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestGetHDFSFileInfo.java
@@ -512,8 +512,8 @@ public class TestGetHDFSFileInfo {
mff.assertAttributeEquals("hdfs.replication", "" + 3);
mff.assertAttributeEquals("hdfs.permissions", "rw-r--r--");
mff.assertAttributeNotExists("hdfs.status");
- } else if (mff.getAttribute("hdfs.objectName").equals("regFile5")) {
- matchCount++;
+ } else if (mff.getAttribute("hdfs.objectName").equals("regFile5")) {
+ matchCount++;
mff.assertAttributeEquals("hdfs.path", "/some/home/mydir");
mff.assertAttributeEquals("hdfs.type", "file");
mff.assertAttributeEquals("hdfs.owner", "owner");
@@ -526,7 +526,7 @@ public class TestGetHDFSFileInfo {
mff.assertAttributeEquals("hdfs.permissions", "rw-r--r--");
mff.assertAttributeNotExists("hdfs.status");
} else {
- runner.assertNotValid();
+ runner.assertNotValid();
}
}
assertEquals(matchCount, 9);
@@ -630,7 +630,7 @@ public class TestGetHDFSFileInfo {
final String expected = new String(Files.readAllBytes(Paths.get("src/test/resources/TestGetHDFSFileInfo/testRecursiveGroupDirToAttributes-regDir2.json")));
mff.assertAttributeEquals("hdfs.full.tree", expected);
} else {
- runner.assertNotValid();
+ runner.assertNotValid();
}
}
assertEquals(matchCount, 5);
diff --git a/nifi-extension-bundles/nifi-hashicorp-vault-bundle/nifi-hashicorp-vault-client-service/src/test/java/org/apache/nifi/vault/hashicorp/TestStandardHashiCorpVaultClientService.java b/nifi-extension-bundles/nifi-hashicorp-vault-bundle/nifi-hashicorp-vault-client-service/src/test/java/org/apache/nifi/vault/hashicorp/TestStandardHashiCorpVaultClientService.java
index 050ace4bb5..62391b6b19 100644
--- a/nifi-extension-bundles/nifi-hashicorp-vault-bundle/nifi-hashicorp-vault-client-service/src/test/java/org/apache/nifi/vault/hashicorp/TestStandardHashiCorpVaultClientService.java
+++ b/nifi-extension-bundles/nifi-hashicorp-vault-bundle/nifi-hashicorp-vault-client-service/src/test/java/org/apache/nifi/vault/hashicorp/TestStandardHashiCorpVaultClientService.java
@@ -51,9 +51,9 @@ public class TestStandardHashiCorpVaultClientService {
final PropertyValue propertiesFilesProperty = mock(PropertyValue.class);
final ResourceReferences resources = mock(ResourceReferences.class);
when(resources.asList()).thenReturn(Arrays.stream(properties.get(HashiCorpVaultClientService.VAULT_PROPERTIES_FILES)
- .split(","))
- .map(SimpleResourceReference::new)
- .collect(Collectors.toList()));
+ .split(","))
+ .map(SimpleResourceReference::new)
+ .collect(Collectors.toList()));
when(propertiesFilesProperty.asResources()).thenReturn(resources);
when(context.getProperty(HashiCorpVaultClientService.VAULT_PROPERTIES_FILES)).thenReturn(propertiesFilesProperty);
}
@@ -62,7 +62,7 @@ public class TestStandardHashiCorpVaultClientService {
when(sslContextServicePropertyValue.isSet()).thenReturn(false);
when(context.getProperty(HashiCorpVaultClientService.SSL_CONTEXT_SERVICE)).thenReturn(sslContextServicePropertyValue);
when(context.getAllProperties()).thenReturn(properties.entrySet().stream()
- .collect(Collectors.toMap(e -> e.getKey().getName(), Map.Entry::getValue)));
+ .collect(Collectors.toMap(e -> e.getKey().getName(), Map.Entry::getValue)));
return context;
}
@@ -100,33 +100,33 @@ public class TestStandardHashiCorpVaultClientService {
private record SimpleResourceReference(String filename) implements ResourceReference {
@Override
- public File asFile() {
- return null;
- }
+ public File asFile() {
+ return null;
+ }
- @Override
- public URL asURL() {
- return null;
- }
+ @Override
+ public URL asURL() {
+ return null;
+ }
- @Override
- public InputStream read() {
- return null;
- }
+ @Override
+ public InputStream read() {
+ return null;
+ }
- @Override
- public boolean isAccessible() {
- return false;
- }
+ @Override
+ public boolean isAccessible() {
+ return false;
+ }
- @Override
- public String getLocation() {
- return filename;
- }
+ @Override
+ public String getLocation() {
+ return filename;
+ }
- @Override
- public ResourceType getResourceType() {
- return null;
- }
+ @Override
+ public ResourceType getResourceType() {
+ return null;
}
+ }
}
diff --git a/nifi-extension-bundles/nifi-iotdb-bundle/nifi-iotdb-processors/src/test/java/org/apache/nifi/processors/AbstractIoTDBTest.java b/nifi-extension-bundles/nifi-iotdb-bundle/nifi-iotdb-processors/src/test/java/org/apache/nifi/processors/AbstractIoTDBTest.java
index beea298b84..518e9d7cb0 100755
--- a/nifi-extension-bundles/nifi-iotdb-bundle/nifi-iotdb-processors/src/test/java/org/apache/nifi/processors/AbstractIoTDBTest.java
+++ b/nifi-extension-bundles/nifi-iotdb-bundle/nifi-iotdb-processors/src/test/java/org/apache/nifi/processors/AbstractIoTDBTest.java
@@ -222,8 +222,8 @@ public class AbstractIoTDBTest {
Map<String, Tablet> exceptedTablets = new HashMap<>();
List<IMeasurementSchema> schemas = Arrays.asList(
- new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.RLE),
- new MeasurementSchema("s2", TSDataType.DOUBLE, TSEncoding.PLAIN));
+ new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.RLE),
+ new MeasurementSchema("s2", TSDataType.DOUBLE, TSEncoding.PLAIN));
exceptedTablets.put("root.test_sg.test_d1", new Tablet("root.test_sg.test_d1", schemas, 1));
assertEquals("root.test_sg.test_d1", tablets.keySet().toArray()[0]);
diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
index d0f0da1d7c..70ac8466f2 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
+++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
@@ -248,8 +248,8 @@ public class JoltTransformRecord extends AbstractJoltTransform {
@Override
public void migrateProperties(PropertyConfiguration config) {
- config.renameProperty("jolt-record-record-reader", RECORD_READER.getName());
- config.renameProperty("jolt-record-record-writer", RECORD_WRITER.getName());
+ config.renameProperty("jolt-record-record-reader", RECORD_READER.getName());
+ config.renameProperty("jolt-record-record-writer", RECORD_WRITER.getName());
}
private List<Record> transform(final Record record, final JoltTransform transform) {
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/Kafka3ConnectionService.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/Kafka3ConnectionService.java
index 72f58cf771..a03c0ecac3 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/Kafka3ConnectionService.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/Kafka3ConnectionService.java
@@ -194,8 +194,8 @@ public class Kafka3ConnectionService extends AbstractControllerService implement
final SecurityProtocol securityProtocol = context.getProperty(SECURITY_PROTOCOL).asAllowableValue(SecurityProtocol.class);
final String protocol = switch (securityProtocol) {
- case SSL, SASL_SSL -> "kafkas";
- case SASL_PLAINTEXT, PLAINTEXT -> "kafka";
+ case SSL, SASL_SSL -> "kafkas";
+ case SASL_PLAINTEXT, PLAINTEXT -> "kafka";
};
return String.format("%s://%s", protocol, firstBootstrapServer);
@@ -274,9 +274,9 @@ public class Kafka3ConnectionService extends AbstractControllerService implement
properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, producerConfiguration.getCompressionCodec());
}
final String partitionClass = producerConfiguration.getPartitionClass();
- if (partitionClass != null && partitionClass.startsWith("org.apache.kafka")
// Default Partitioner is removed in Kafka 4.0, and partitioner class should be
// null by default - see KIP-794
+ if (partitionClass != null && partitionClass.startsWith("org.apache.kafka")
&& !partitionClass.equals("org.apache.kafka.clients.producer.internals.DefaultPartitioner")) {
properties.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, partitionClass);
}
diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-client-service-api/src/main/java/org/apache/nifi/mongodb/MongoDBClientService.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-client-service-api/src/main/java/org/apache/nifi/mongodb/MongoDBClientService.java
index 460a277706..24f84bd2cc 100644
--- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-client-service-api/src/main/java/org/apache/nifi/mongodb/MongoDBClientService.java
+++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-client-service-api/src/main/java/org/apache/nifi/mongodb/MongoDBClientService.java
@@ -29,61 +29,61 @@ import org.apache.nifi.ssl.SSLContextProvider;
import org.bson.Document;
public interface MongoDBClientService extends ControllerService, VerifiableControllerService {
- String WRITE_CONCERN_ACKNOWLEDGED = "ACKNOWLEDGED";
- String WRITE_CONCERN_UNACKNOWLEDGED = "UNACKNOWLEDGED";
- String WRITE_CONCERN_FSYNCED = "FSYNCED";
- String WRITE_CONCERN_JOURNALED = "JOURNALED";
- String WRITE_CONCERN_REPLICA_ACKNOWLEDGED = "REPLICA_ACKNOWLEDGED";
- String WRITE_CONCERN_MAJORITY = "MAJORITY";
- String WRITE_CONCERN_W1 = "W1";
- String WRITE_CONCERN_W2 = "W2";
- String WRITE_CONCERN_W3 = "W3";
+ String WRITE_CONCERN_ACKNOWLEDGED = "ACKNOWLEDGED";
+ String WRITE_CONCERN_UNACKNOWLEDGED = "UNACKNOWLEDGED";
+ String WRITE_CONCERN_FSYNCED = "FSYNCED";
+ String WRITE_CONCERN_JOURNALED = "JOURNALED";
+ String WRITE_CONCERN_REPLICA_ACKNOWLEDGED = "REPLICA_ACKNOWLEDGED";
+ String WRITE_CONCERN_MAJORITY = "MAJORITY";
+ String WRITE_CONCERN_W1 = "W1";
+ String WRITE_CONCERN_W2 = "W2";
+ String WRITE_CONCERN_W3 = "W3";
- AllowableValue WRITE_CONCERN_ACKNOWLEDGED_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_ACKNOWLEDGED_VALUE = new AllowableValue(
WRITE_CONCERN_ACKNOWLEDGED, WRITE_CONCERN_ACKNOWLEDGED,
"Write operations that use this write concern will wait for acknowledgement, " +
"using the default write concern configured on the server");
- AllowableValue WRITE_CONCERN_UNACKNOWLEDGED_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_UNACKNOWLEDGED_VALUE = new AllowableValue(
WRITE_CONCERN_UNACKNOWLEDGED, WRITE_CONCERN_UNACKNOWLEDGED,
"Write operations that use this write concern will return as soon as the message is written to the socket. " +
"Exceptions are raised for network issues, but not server errors");
- AllowableValue WRITE_CONCERN_FSYNCED_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_FSYNCED_VALUE = new AllowableValue(
WRITE_CONCERN_FSYNCED, WRITE_CONCERN_FSYNCED,
"Deprecated. Use of \"" + WRITE_CONCERN_JOURNALED + "\" is preferred");
- AllowableValue WRITE_CONCERN_JOURNALED_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_JOURNALED_VALUE = new AllowableValue(
WRITE_CONCERN_JOURNALED, WRITE_CONCERN_JOURNALED,
"Write operations wait for the server to group commit to the journal file on disk");
- AllowableValue WRITE_CONCERN_REPLICA_ACKNOWLEDGED_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_REPLICA_ACKNOWLEDGED_VALUE = new AllowableValue(
WRITE_CONCERN_REPLICA_ACKNOWLEDGED, WRITE_CONCERN_REPLICA_ACKNOWLEDGED,
"Deprecated. Use of \"" + WRITE_CONCERN_W2 + "\" is preferred");
- AllowableValue WRITE_CONCERN_MAJORITY_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_MAJORITY_VALUE = new AllowableValue(
WRITE_CONCERN_MAJORITY, WRITE_CONCERN_MAJORITY,
"Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation");
- AllowableValue WRITE_CONCERN_W1_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_W1_VALUE = new AllowableValue(
WRITE_CONCERN_W1, WRITE_CONCERN_W1,
"Write operations that use this write concern will wait for acknowledgement from a single member");
- AllowableValue WRITE_CONCERN_W2_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_W2_VALUE = new AllowableValue(
WRITE_CONCERN_W2, WRITE_CONCERN_W2,
"Write operations that use this write concern will wait for acknowledgement from two members");
- AllowableValue WRITE_CONCERN_W3_VALUE = new AllowableValue(
+ AllowableValue WRITE_CONCERN_W3_VALUE = new AllowableValue(
WRITE_CONCERN_W3, WRITE_CONCERN_W3,
"Write operations that use this write concern will wait for acknowledgement from three members");
- PropertyDescriptor URI = new PropertyDescriptor.Builder()
+ PropertyDescriptor URI = new PropertyDescriptor.Builder()
.name("Mongo URI")
.description("MongoURI, typically of the form: mongodb://host1[:port1][,host2[:port2],...]")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.addValidator(StandardValidators.URI_VALIDATOR)
.build();
- PropertyDescriptor DB_USER = new PropertyDescriptor.Builder()
+ PropertyDescriptor DB_USER = new PropertyDescriptor.Builder()
.name("Database User")
.description("Database user name")
.required(false)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.build();
- PropertyDescriptor DB_PASSWORD = new PropertyDescriptor.Builder()
+ PropertyDescriptor DB_PASSWORD = new PropertyDescriptor.Builder()
.name("Password")
.description("The password for the database user")
.required(false)
@@ -91,7 +91,7 @@ public interface MongoDBClientService extends ControllerService, VerifiableContr
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.build();
- PropertyDescriptor SSL_CONTEXT_SERVICE = new PropertyDescriptor.Builder()
+ PropertyDescriptor SSL_CONTEXT_SERVICE = new PropertyDescriptor.Builder()
.name("SSL Context Service")
.description("The SSL Context Service used to provide client certificate information for TLS/SSL "
+ "connections.")
@@ -99,7 +99,7 @@ public interface MongoDBClientService extends ControllerService, VerifiableContr
.identifiesControllerService(SSLContextProvider.class)
.build();
- PropertyDescriptor WRITE_CONCERN = new PropertyDescriptor.Builder()
+ PropertyDescriptor WRITE_CONCERN = new PropertyDescriptor.Builder()
.name("Write Concern")
.description("The write concern to use")
.required(true)
diff --git a/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/MqttClientFactory.java b/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/MqttClientFactory.java
index f2dcb8651e..07292c4076 100644
--- a/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/MqttClientFactory.java
+++ b/nifi-extension-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/MqttClientFactory.java
@@ -41,7 +41,7 @@ public class MqttClientFactory {
public MqttClient create() throws TlsException {
return switch (clientProperties.getMqttVersion()) {
case MQTT_VERSION_3_AUTO, MQTT_VERSION_3_1, MQTT_VERSION_3_1_1 ->
- new PahoMqttClientAdapter(brokerUris.next(), clientProperties, logger);
+ new PahoMqttClientAdapter(brokerUris.next(), clientProperties, logger);
case MQTT_VERSION_5_0 -> new HiveMqV5ClientAdapter(brokerUris.next(), clientProperties, logger);
};
}
diff --git a/nifi-extension-bundles/nifi-network-bundle/nifi-network-processors/src/main/java/org/apache/nifi/processors/network/pcap/SplitPCAP.java b/nifi-extension-bundles/nifi-network-bundle/nifi-network-processors/src/main/java/org/apache/nifi/processors/network/pcap/SplitPCAP.java
index 0b792bf4c7..cc7ddbee83 100644
--- a/nifi-extension-bundles/nifi-network-bundle/nifi-network-processors/src/main/java/org/apache/nifi/processors/network/pcap/SplitPCAP.java
+++ b/nifi-extension-bundles/nifi-network-bundle/nifi-network-processors/src/main/java/org/apache/nifi/processors/network/pcap/SplitPCAP.java
@@ -54,28 +54,28 @@ import java.util.stream.IntStream;
@Tags({"PCAP", "Splitter", "Network", "Packet", "Capture", "Wireshark", "TShark", "TcpDump", "WinDump", "sniffers"})
@CapabilityDescription("Splits one pcap file into multiple pcap files based on a maximum size.")
@WritesAttributes(
- {
- @WritesAttribute(
- attribute = SplitPCAP.ERROR_REASON_LABEL,
- description = "The reason the FlowFile was sent to the failure relationship."
- ),
- @WritesAttribute(
- attribute = "fragment.identifier",
- description = "All split PCAP FlowFiles produced from the same parent PCAP FlowFile will have the same randomly generated UUID added for this attribute"
- ),
- @WritesAttribute(
- attribute = "fragment.index",
- description = "A one-up number that indicates the ordering of the split PCAP FlowFiles that were created from a single parent PCAP FlowFile"
- ),
- @WritesAttribute(
- attribute = "fragment.count",
- description = "The number of split PCAP FlowFiles generated from the parent PCAP FlowFile"
- ),
- @WritesAttribute(
- attribute = "segment.original.filename",
- description = "The filename of the parent PCAP FlowFile"
- )
- }
+ {
+ @WritesAttribute(
+ attribute = SplitPCAP.ERROR_REASON_LABEL,
+ description = "The reason the FlowFile was sent to the failure relationship."
+ ),
+ @WritesAttribute(
+ attribute = "fragment.identifier",
+ description = "All split PCAP FlowFiles produced from the same parent PCAP FlowFile will have the same randomly generated UUID added for this attribute"
+ ),
+ @WritesAttribute(
+ attribute = "fragment.index",
+ description = "A one-up number that indicates the ordering of the split PCAP FlowFiles that were created from a single parent PCAP FlowFile"
+ ),
+ @WritesAttribute(
+ attribute = "fragment.count",
+ description = "The number of split PCAP FlowFiles generated from the parent PCAP FlowFile"
+ ),
+ @WritesAttribute(
+ attribute = "segment.original.filename",
+ description = "The filename of the parent PCAP FlowFile"
+ )
+ }
)
public class SplitPCAP extends AbstractProcessor {
diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetOutputFile.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetOutputFile.java
index 2125e81a09..72760a8484 100644
--- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetOutputFile.java
+++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/stream/NifiParquetOutputFile.java
@@ -25,30 +25,30 @@ import java.io.OutputStream;
public class NifiParquetOutputFile implements OutputFile {
- private OutputStream outputStream;
+ private OutputStream outputStream;
- public NifiParquetOutputFile(OutputStream outputStream) {
+ public NifiParquetOutputFile(OutputStream outputStream) {
this.outputStream = outputStream;
- }
+ }
- @Override
- public PositionOutputStream create(long blockSizeHint) {
+ @Override
+ public PositionOutputStream create(long blockSizeHint) {
return new NifiOutputStream(outputStream);
- }
+ }
- @Override
- public PositionOutputStream createOrOverwrite(long blockSizeHint) {
+ @Override
+ public PositionOutputStream createOrOverwrite(long blockSizeHint) {
return new NifiOutputStream(outputStream);
- }
+ }
- @Override
- public boolean supportsBlockSize() {
+ @Override
+ public boolean supportsBlockSize() {
return false;
- }
+ }
- @Override
- public long defaultBlockSize() {
+ @Override
+ public long defaultBlockSize() {
return 0;
- }
+ }
}
diff --git a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/ConvertAvroToParquet.java b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/ConvertAvroToParquet.java
index 5a100113c0..4bfff54c94 100644
--- a/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/ConvertAvroToParquet.java
+++ b/nifi-extension-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/processors/parquet/ConvertAvroToParquet.java
@@ -70,7 +70,7 @@ import static org.apache.nifi.parquet.utils.ParquetUtils.createParquetConfig;
})
@DeprecationNotice(reason = "ConvertAvroToParquet is no longer needed since there is the AvroReader which along with ParquetRecordSetWriter can be used in ConvertRecord to achieve the same thing.",
classNames = {"org.apache.nifi.processors.standard.ConvertRecord",
- "org.apache.nifi.avro.AvroReader", "org.apache.nifi.parquet.ParquetRecordSetWriter"})
+ "org.apache.nifi.avro.AvroReader", "org.apache.nifi.parquet.ParquetRecordSetWriter"})
public class ConvertAvroToParquet extends AbstractProcessor {
// Attributes
diff --git a/nifi-extension-bundles/nifi-pgp-bundle/nifi-pgp-processors/src/main/java/org/apache/nifi/processors/pgp/VerifyContentPGP.java b/nifi-extension-bundles/nifi-pgp-bundle/nifi-pgp-processors/src/main/java/org/apache/nifi/processors/pgp/VerifyContentPGP.java
index 7bdece2baa..040afaac5d 100644
--- a/nifi-extension-bundles/nifi-pgp-bundle/nifi-pgp-processors/src/main/java/org/apache/nifi/processors/pgp/VerifyContentPGP.java
+++ b/nifi-extension-bundles/nifi-pgp-bundle/nifi-pgp-processors/src/main/java/org/apache/nifi/processors/pgp/VerifyContentPGP.java
@@ -216,11 +216,11 @@ public class VerifyContentPGP extends AbstractProcessor {
}
}
case PGPOnePassSignatureList onePassSignatureList ->
- onePassSignature = processOnePassSignatures(onePassSignatureList);
+ onePassSignature = processOnePassSignatures(onePassSignatureList);
case PGPLiteralData literalData ->
- processLiteralData(literalData, outputStream, onePassSignature);
+ processLiteralData(literalData, outputStream, onePassSignature);
case PGPSignatureList signatureList ->
- processSignatures(signatureList, onePassSignature);
+ processSignatures(signatureList, onePassSignature);
default -> {
}
}
diff --git a/nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/test/java/org/apache/nifi/excel/TestExcelStartingRowSchemaInference.java b/nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/test/java/org/apache/nifi/excel/TestExcelStartingRowSchemaInference.java
index 00f898a188..5df963eabf 100644
--- a/nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/test/java/org/apache/nifi/excel/TestExcelStartingRowSchemaInference.java
+++ b/nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/test/java/org/apache/nifi/excel/TestExcelStartingRowSchemaInference.java
@@ -210,9 +210,9 @@ public class TestExcelStartingRowSchemaInference {
final String dateColumnName = "Date";
final Object[] columnNames = {dateColumnName, "Something", "Name"};
final Object[][] firstSheet =
- {columnNames, {LocalDate.of(2025, 2, 1), "test1", "Sheet1"}, {LocalDate.of(2024, 2, 12), "test2", "Sheet1"}};
+ {columnNames, {LocalDate.of(2025, 2, 1), "test1", "Sheet1"}, {LocalDate.of(2024, 2, 12), "test2", "Sheet1"}};
Object[][] secondSheet =
- {columnNames, {LocalDate.of(1976, 9, 11), "test1", "Sheet2"}, {LocalDate.of(1987, 2, 12), "test2", "Sheet2"}};
+ {columnNames, {LocalDate.of(1976, 9, 11), "test1", "Sheet2"}, {LocalDate.of(1987, 2, 12), "test2", "Sheet2"}};
final ByteArrayOutputStream outputStream = createWorkbook(firstSheet, secondSheet);
try (final InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray())) {
diff --git a/nifi-extension-bundles/nifi-protobuf-bundle/nifi-protobuf-services/src/main/java/org/apache/nifi/services/protobuf/converter/ProtobufDataConverter.java b/nifi-extension-bundles/nifi-protobuf-bundle/nifi-protobuf-services/src/main/java/org/apache/nifi/services/protobuf/converter/ProtobufDataConverter.java
index 90a519b3f7..d87bae8e25 100644
--- a/nifi-extension-bundles/nifi-protobuf-bundle/nifi-protobuf-services/src/main/java/org/apache/nifi/services/protobuf/converter/ProtobufDataConverter.java
+++ b/nifi-extension-bundles/nifi-protobuf-bundle/nifi-protobuf-services/src/main/java/org/apache/nifi/services/protobuf/converter/ProtobufDataConverter.java
@@ -259,14 +259,14 @@ public class ProtobufDataConverter {
private Object convertFixed32Fields(ProtoField protoField, List<Integer> values, RecordSchema recordSchema) {
final String typeName = protoField.getProtoType().getSimpleName();
final Function<Integer, Object> valueConverter =
- switch (FieldType.findValue(typeName)) {
- case FIXED32 -> Integer::toUnsignedLong;
- case SFIXED32 -> value -> value;
- case FLOAT -> Float::intBitsToFloat;
- default ->
- throw new IllegalStateException(String.format("Incompatible value was received for field [%s]," +
- " [%s] is not Fixed32 field type", protoField.getFieldName(), typeName));
- };
+ switch (FieldType.findValue(typeName)) {
+ case FIXED32 -> Integer::toUnsignedLong;
+ case SFIXED32 -> value -> value;
+ case FLOAT -> Float::intBitsToFloat;
+ default ->
+ throw new IllegalStateException(String.format("Incompatible value was received for field [%s]," +
+ " [%s] is not Fixed32 field type", protoField.getFieldName(), typeName));
+ };
return resolveFieldValue(protoField, values, valueConverter, recordSchema);
}
@@ -281,14 +281,14 @@ public class ProtobufDataConverter {
private Object convertFixed64Fields(ProtoField protoField, List<Long> values, RecordSchema recordSchema) {
final String typeName = protoField.getProtoType().getSimpleName();
final Function<Long, Object> valueConverter =
- switch (FieldType.findValue(typeName)) {
- case FIXED64 -> value -> new BigInteger(unsignedToString(value));
- case SFIXED64 -> value -> value;
- case DOUBLE -> Double::longBitsToDouble;
- default ->
- throw new IllegalStateException(String.format("Incompatible value was received for field [%s]," +
- " [%s] is not Fixed64 field type", protoField.getFieldName(), typeName));
- };
+ switch (FieldType.findValue(typeName)) {
+ case FIXED64 -> value -> new BigInteger(unsignedToString(value));
+ case SFIXED64 -> value -> value;
+ case DOUBLE -> Double::longBitsToDouble;
+ default ->
+ throw new IllegalStateException(String.format("Incompatible value was received for field [%s]," +
+ " [%s] is not Fixed64 field type", protoField.getFieldName(), typeName));
+ };
return resolveFieldValue(protoField, values, valueConverter, recordSchema);
}
diff --git a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisConnectionPoolService.java b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisConnectionPoolService.java
index 6d543a9ea2..2cd2f76437 100644
--- a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisConnectionPoolService.java
+++ b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/RedisConnectionPoolService.java
@@ -39,8 +39,7 @@ import java.util.List;
@Tags({"redis", "cache"})
@CapabilityDescription("A service that provides connections to Redis.")
-public class
-RedisConnectionPoolService extends AbstractControllerService implements RedisConnectionPool {
+public class RedisConnectionPoolService extends AbstractControllerService implements RedisConnectionPool {
private volatile PropertyContext context;
private volatile RedisType redisType;
diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java
index 854e4d984e..1f5653235a 100644
--- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java
+++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java
@@ -181,14 +181,14 @@ public class TestSiteToSiteBulletinReportingTask {
final Transaction transaction = Mockito.mock(Transaction.class);
assertDoesNotThrow(() -> {
- Mockito.doAnswer((Answer<Object>) invocation -> {
- final byte[] data = invocation.getArgument(0, byte[].class);
- dataSent.add(data);
- return null;
- }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
-
- when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
- });
+ Mockito.doAnswer((Answer<Object>) invocation -> {
+ final byte[] data = invocation.getArgument(0, byte[].class);
+ dataSent.add(data);
+ return null;
+ }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
+
+ when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
+ });
siteToSiteClient = client;
}
}
diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java
index c9e0064744..17bce23b57 100644
--- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java
+++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java
@@ -292,14 +292,14 @@ public class TestSiteToSiteMetricsReportingTask {
final Transaction transaction = Mockito.mock(Transaction.class);
assertDoesNotThrow(() -> {
- Mockito.doAnswer((Answer<Object>) invocation -> {
- final byte[] data = invocation.getArgument(0, byte[].class);
- dataSent.add(data);
- return null;
- }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
-
- when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
- });
+ Mockito.doAnswer((Answer<Object>) invocation -> {
+ final byte[] data = invocation.getArgument(0, byte[].class);
+ dataSent.add(data);
+ return null;
+ }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
+
+ when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
+ });
siteToSiteClient = client;
}
}
diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java
index 26edb96ee4..afc3f42652 100644
--- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java
+++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java
@@ -661,15 +661,15 @@ public class TestSiteToSiteProvenanceReportingTask {
final Transaction transaction = Mockito.mock(Transaction.class);
assertDoesNotThrow(() -> {
- Mockito.doAnswer((Answer<Object>) invocation -> {
- final byte[] data = invocation.getArgument(0, byte[].class);
- dataSent.add(data);
- return null;
- }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
+ Mockito.doAnswer((Answer<Object>) invocation -> {
+ final byte[] data = invocation.getArgument(0, byte[].class);
+ dataSent.add(data);
+ return null;
+ }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
- when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
+ when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
- });
+ });
siteToSiteClient = client;
}
}
diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
index 288c7a5cce..f924a77199 100644
--- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
+++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
@@ -187,7 +187,7 @@ public class TestSiteToSiteStatusReportingTask {
JsonValue destination = object.get("destinationName");
assertEquals(destination, JsonValue.NULL);
- }
+ }
@Test
public void testComponentNameFilter() throws IOException, InitializationException {
@@ -536,14 +536,14 @@ public class TestSiteToSiteStatusReportingTask {
final Transaction transaction = Mockito.mock(Transaction.class);
assertDoesNotThrow(() -> {
- Mockito.doAnswer((Answer<Object>) invocation -> {
- final byte[] data = invocation.getArgument(0, byte[].class);
- dataSent.add(data);
- return null;
- }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
-
- when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
- });
+ Mockito.doAnswer((Answer<Object>) invocation -> {
+ final byte[] data = invocation.getArgument(0, byte[].class);
+ dataSent.add(data);
+ return null;
+ }).when(transaction).send(Mockito.any(byte[].class), Mockito.any(Map.class));
+
+ when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
+ });
siteToSiteClient = client;
}
}
diff --git a/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/main/java/org/apache/nifi/processors/smb/GetSmbFile.java b/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/main/java/org/apache/nifi/processors/smb/GetSmbFile.java
index f46c9d4574..b417fb56a1 100644
--- a/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/main/java/org/apache/nifi/processors/smb/GetSmbFile.java
+++ b/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/main/java/org/apache/nifi/processors/smb/GetSmbFile.java
@@ -100,14 +100,14 @@ import static org.apache.nifi.smb.common.SmbUtils.buildSmbClient;
@WritesAttributes({
@WritesAttribute(attribute = "filename", description = "The filename is set to the name of the file on the network share"),
@WritesAttribute(attribute = "path", description = "The path is set to the relative path of the file's network share name. For example, "
- + "if the input is set to \\\\hostname\\share\\tmp, files picked up from \\tmp will have the path attribute set to tmp"),
+ + "if the input is set to \\\\hostname\\share\\tmp, files picked up from \\tmp will have the path attribute set to tmp"),
@WritesAttribute(attribute = "file.creationTime", description = "The date and time that the file was created. May not work on all file systems"),
@WritesAttribute(attribute = "file.lastModifiedTime", description = "The date and time that the file was last modified. May not work on all "
- + "file systems"),
+ + "file systems"),
@WritesAttribute(attribute = "file.lastAccessTime", description = "The date and time that the file was last accessed. May not work on all "
- + "file systems"),
+ + "file systems"),
@WritesAttribute(attribute = "absolute.path", description = "The full path from where a file was picked up. This includes "
- + "the hostname and the share name")})
+ + "the hostname and the share name")})
public class GetSmbFile extends AbstractProcessor {
public static final String SHARE_ACCESS_NONE = "none";
public static final String SHARE_ACCESS_READ = "read";
@@ -123,7 +123,7 @@ public class GetSmbFile extends AbstractProcessor {
public static final PropertyDescriptor SHARE = new PropertyDescriptor.Builder()
.name("Share")
.description("The network share to which files should be written. This is the \"first folder\"" +
- "after the hostname: \\\\hostname\\[share]\\dir1\\dir2")
+ "after the hostname: \\\\hostname\\[share]\\dir1\\dir2")
.required(true)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
@@ -157,7 +157,7 @@ public class GetSmbFile extends AbstractProcessor {
public static final PropertyDescriptor SHARE_ACCESS = new PropertyDescriptor.Builder()
.name("Share Access Strategy")
.description("Indicates which shared access are granted on the file during the read. " +
- "None is the most restrictive, but the safest setting to prevent corruption.")
+ "None is the most restrictive, but the safest setting to prevent corruption.")
.required(true)
.defaultValue(SHARE_ACCESS_NONE)
.allowableValues(SHARE_ACCESS_NONE, SHARE_ACCESS_READ, SHARE_ACCESS_READDELETE, SHARE_ACCESS_READWRITEDELETE)
@@ -172,9 +172,9 @@ public class GetSmbFile extends AbstractProcessor {
public static final PropertyDescriptor KEEP_SOURCE_FILE = new PropertyDescriptor.Builder()
.name("Keep Source File")
.description("If true, the file is not deleted after it has been copied to the Content Repository; "
- + "this causes the file to be picked up continually and is useful for testing purposes. "
- + "If not keeping original NiFi will need write permissions on the directory it is pulling "
- + "from otherwise it will ignore the file.")
+ + "this causes the file to be picked up continually and is useful for testing purposes. "
+ + "If not keeping original NiFi will need write permissions on the directory it is pulling "
+ + "from otherwise it will ignore the file.")
.required(true)
.allowableValues("true", "false")
.defaultValue("false")
@@ -409,156 +409,156 @@ public class GetSmbFile extends AbstractProcessor {
try (Connection connection = smbClient.connect(hostname);
Session smbSession = connection.authenticate(ac);
DiskShare share = (DiskShare) smbSession.connectShare(shareName)) {
- String directory = context.getProperty(DIRECTORY).evaluateAttributeExpressions().getValue();
- if (directory == null) {
- directory = "";
- }
- final boolean keepingSourceFile = context.getProperty(KEEP_SOURCE_FILE).asBoolean();
- final String filter = context.getProperty(FILE_FILTER).getValue();
+ String directory = context.getProperty(DIRECTORY).evaluateAttributeExpressions().getValue();
+ if (directory == null) {
+ directory = "";
+ }
+ final boolean keepingSourceFile = context.getProperty(KEEP_SOURCE_FILE).asBoolean();
+ final String filter = context.getProperty(FILE_FILTER).getValue();
- if (fileQueue.size() < 100) {
- final long pollingMillis = context.getProperty(POLLING_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
- if ((queueLastUpdated.get() < System.currentTimeMillis() - pollingMillis) && listingLock.tryLock()) {
+ if (fileQueue.size() < 100) {
+ final long pollingMillis = context.getProperty(POLLING_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
+ if ((queueLastUpdated.get() < System.currentTimeMillis() - pollingMillis) && listingLock.tryLock()) {
+ try {
+ final Set<String> listing = performListing(share, directory, filter, context.getProperty(RECURSE).asBoolean().booleanValue());
+
+ queueLock.lock();
try {
- final Set<String> listing = performListing(share, directory, filter, context.getProperty(RECURSE).asBoolean().booleanValue());
-
- queueLock.lock();
- try {
- listing.removeAll(inProcess);
- if (!keepingSourceFile) {
- listing.removeAll(recentlyProcessed);
- }
-
- fileQueue.clear();
- fileQueue.addAll(listing);
-
- queueLastUpdated.set(System.currentTimeMillis());
- recentlyProcessed.clear();
-
- if (listing.isEmpty()) {
- context.yield();
- }
- } finally {
- queueLock.unlock();
+ listing.removeAll(inProcess);
+ if (!keepingSourceFile) {
+ listing.removeAll(recentlyProcessed);
+ }
+
+ fileQueue.clear();
+ fileQueue.addAll(listing);
+
+ queueLastUpdated.set(System.currentTimeMillis());
+ recentlyProcessed.clear();
+
+ if (listing.isEmpty()) {
+ context.yield();
}
} finally {
- listingLock.unlock();
+ queueLock.unlock();
}
+ } finally {
+ listingLock.unlock();
}
}
+ }
- final int batchSize = context.getProperty(BATCH_SIZE).asInteger();
- final List<String> files = new ArrayList<>(batchSize);
- queueLock.lock();
- try {
- fileQueue.drainTo(files, batchSize);
- if (files.isEmpty()) {
- return;
- } else {
- inProcess.addAll(files);
- }
- } finally {
- queueLock.unlock();
+ final int batchSize = context.getProperty(BATCH_SIZE).asInteger();
+ final List<String> files = new ArrayList<>(batchSize);
+ queueLock.lock();
+ try {
+ fileQueue.drainTo(files, batchSize);
+ if (files.isEmpty()) {
+ return;
+ } else {
+ inProcess.addAll(files);
}
+ } finally {
+ queueLock.unlock();
+ }
- final ListIterator<String> itr = files.listIterator();
- FlowFile flowFile = null;
-
- try {
- while (itr.hasNext()) {
- final String file = itr.next();
- final String[] fileSplits = file.split("\\\\");
- final String filename = fileSplits[fileSplits.length - 1];
- final String filePath = String.join("\\", Arrays.copyOf(fileSplits, fileSplits.length - 1));
- final URI uri = new URI("smb", hostname, "/" + file.replace('\\', '/'), null);
-
- flowFile = session.create();
- final long importStart = System.nanoTime();
-
- try (File f = share.openFile(
- file,
- EnumSet.of(AccessMask.GENERIC_READ),
- EnumSet.of(FileAttributes.FILE_ATTRIBUTE_NORMAL),
- sharedAccess,
- SMB2CreateDisposition.FILE_OPEN,
- EnumSet.of(SMB2CreateOptions.FILE_SEQUENTIAL_ONLY));
- InputStream is = f.getInputStream()) {
-
- flowFile = session.importFrom(is, flowFile);
-
- final long importNanos = System.nanoTime() - importStart;
- final long importMillis = TimeUnit.MILLISECONDS.convert(importNanos, TimeUnit.NANOSECONDS);
- final FileAllInformation fileInfo = f.getFileInformation();
- final FileBasicInformation fileBasicInfo = fileInfo.getBasicInformation();
- final long fileSize = fileInfo.getStandardInformation().getEndOfFile();
-
- final Map<String, String> attributes = new HashMap<>();
- attributes.put(CoreAttributes.FILENAME.key(), filename);
- attributes.put(CoreAttributes.PATH.key(), filePath);
- attributes.put(CoreAttributes.ABSOLUTE_PATH.key(), "\\\\" + hostname + "\\" + shareName + "\\" + file);
- attributes.put(FILE_CREATION_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getCreationTime().toInstant().atZone(ZoneId.systemDefault())));
- attributes.put(FILE_LAST_ACCESS_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getLastAccessTime().toInstant().atZone(ZoneId.systemDefault())));
- attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getLastWriteTime().toInstant().atZone(ZoneId.systemDefault())));
- attributes.put(FILE_SIZE_ATTRIBUTE, String.valueOf(fileSize));
- attributes.put(HOSTNAME.getName(), hostname);
- attributes.put(SHARE.getName(), shareName);
-
- flowFile = session.putAllAttributes(flowFile, attributes);
- session.getProvenanceReporter().receive(flowFile, uri.toString(), importMillis);
-
- session.transfer(flowFile, REL_SUCCESS);
- } catch (SMBApiException e) {
- // do not fail whole batch if a single file cannot be accessed
- if (e.getStatus() == NtStatus.STATUS_SHARING_VIOLATION) {
- logger.info("Could not acquire sharing access for file {}", file);
- if (flowFile != null) {
- session.remove(flowFile);
- }
- continue;
- } else {
- throw e;
+ final ListIterator<String> itr = files.listIterator();
+ FlowFile flowFile = null;
+
+ try {
+ while (itr.hasNext()) {
+ final String file = itr.next();
+ final String[] fileSplits = file.split("\\\\");
+ final String filename = fileSplits[fileSplits.length - 1];
+ final String filePath = String.join("\\", Arrays.copyOf(fileSplits, fileSplits.length - 1));
+ final URI uri = new URI("smb", hostname, "/" + file.replace('\\', '/'), null);
+
+ flowFile = session.create();
+ final long importStart = System.nanoTime();
+
+ try (File f = share.openFile(
+ file,
+ EnumSet.of(AccessMask.GENERIC_READ),
+ EnumSet.of(FileAttributes.FILE_ATTRIBUTE_NORMAL),
+ sharedAccess,
+ SMB2CreateDisposition.FILE_OPEN,
+ EnumSet.of(SMB2CreateOptions.FILE_SEQUENTIAL_ONLY));
+ InputStream is = f.getInputStream()) {
+
+ flowFile = session.importFrom(is, flowFile);
+
+ final long importNanos = System.nanoTime() - importStart;
+ final long importMillis = TimeUnit.MILLISECONDS.convert(importNanos, TimeUnit.NANOSECONDS);
+ final FileAllInformation fileInfo = f.getFileInformation();
+ final FileBasicInformation fileBasicInfo = fileInfo.getBasicInformation();
+ final long fileSize = fileInfo.getStandardInformation().getEndOfFile();
+
+ final Map<String, String> attributes = new HashMap<>();
+ attributes.put(CoreAttributes.FILENAME.key(), filename);
+ attributes.put(CoreAttributes.PATH.key(), filePath);
+ attributes.put(CoreAttributes.ABSOLUTE_PATH.key(), "\\\\" + hostname + "\\" + shareName + "\\" + file);
+ attributes.put(FILE_CREATION_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getCreationTime().toInstant().atZone(ZoneId.systemDefault())));
+ attributes.put(FILE_LAST_ACCESS_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getLastAccessTime().toInstant().atZone(ZoneId.systemDefault())));
+ attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, dateFormatter.format(fileBasicInfo.getLastWriteTime().toInstant().atZone(ZoneId.systemDefault())));
+ attributes.put(FILE_SIZE_ATTRIBUTE, String.valueOf(fileSize));
+ attributes.put(HOSTNAME.getName(), hostname);
+ attributes.put(SHARE.getName(), shareName);
+
+ flowFile = session.putAllAttributes(flowFile, attributes);
+ session.getProvenanceReporter().receive(flowFile, uri.toString(), importMillis);
+
+ session.transfer(flowFile, REL_SUCCESS);
+ } catch (SMBApiException e) {
+ // do not fail whole batch if a single file cannot be accessed
+ if (e.getStatus() == NtStatus.STATUS_SHARING_VIOLATION) {
+ logger.info("Could not acquire sharing access for file {}", file);
+ if (flowFile != null) {
+ session.remove(flowFile);
}
+ continue;
+ } else {
+ throw e;
}
+ }
- try {
- if (!keepingSourceFile) {
- share.rm(file);
- }
- } catch (SMBApiException e) {
- logger.error("Could not remove file {}", file);
+ try {
+ if (!keepingSourceFile) {
+ share.rm(file);
}
+ } catch (SMBApiException e) {
+ logger.error("Could not remove file {}", file);
+ }
- if (!isScheduled()) { // if processor stopped, put the rest of the files back on the queue.
- queueLock.lock();
- try {
- while (itr.hasNext()) {
- final String nextFile = itr.next();
- fileQueue.add(nextFile);
- inProcess.remove(nextFile);
- }
- } finally {
- queueLock.unlock();
+ if (!isScheduled()) { // if processor stopped, put the rest of the files back on the queue.
+ queueLock.lock();
+ try {
+ while (itr.hasNext()) {
+ final String nextFile = itr.next();
+ fileQueue.add(nextFile);
+ inProcess.remove(nextFile);
}
+ } finally {
+ queueLock.unlock();
}
}
+ }
- session.commitAsync();
- } catch (final Exception e) {
- logger.error("Failed to retrieve files due to {}", e);
+ session.commitAsync();
+ } catch (final Exception e) {
+ logger.error("Failed to retrieve files due to {}", e);
- // anything that we've not already processed needs to be put back on the queue
- if (flowFile != null) {
- session.remove(flowFile);
- }
+ // anything that we've not already processed needs to be put back on the queue
+ if (flowFile != null) {
+ session.remove(flowFile);
+ }
+ } finally {
+ queueLock.lock();
+ try {
+ inProcess.removeAll(files);
+ recentlyProcessed.addAll(files);
} finally {
- queueLock.lock();
- try {
- inProcess.removeAll(files);
- recentlyProcessed.addAll(files);
- } finally {
- queueLock.unlock();
- }
+ queueLock.unlock();
}
+ }
} catch (Exception e) {
logger.error("Could not establish smb connection", e);
context.yield();
diff --git a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java
index 817fa3d784..8a2f77e73c 100644
--- a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java
+++ b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java
@@ -354,8 +354,7 @@ public class GetSplunk extends AbstractProcessor implements ClassloaderIsolation
|| descriptor.equals(TIME_RANGE_STRATEGY)
|| descriptor.equals(EARLIEST_TIME)
|| descriptor.equals(LATEST_TIME)
- || descriptor.equals(HOSTNAME))
- ) {
+ || descriptor.equals(HOSTNAME))) {
getLogger().debug("A property that require resetting state was modified - {} oldValue {} newValue {}",
descriptor.getDisplayName(), oldValue, newValue);
resetState = true;
@@ -395,7 +394,7 @@ public class GetSplunk extends AbstractProcessor implements ClassloaderIsolation
try {
context.getStateManager().clear(Scope.CLUSTER);
} catch (IOException e) {
- getLogger().error("Unable to clear processor state due to {}", e.getMessage(), e);
+ getLogger().error("Unable to clear processor state due to {}", e.getMessage(), e);
}
}
@@ -459,7 +458,7 @@ public class GetSplunk extends AbstractProcessor implements ClassloaderIsolation
earliestTime = dateTimeFormatter.format(previousLastDate.plusSeconds(1));
latestTime = dateTimeFormatter.format(currentTime);
} catch (DateTimeParseException e) {
- throw new ProcessException(e);
+ throw new ProcessException(e);
}
}
diff --git a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/PutSplunk.java b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/PutSplunk.java
index 950b288434..4f5ea1de1d 100644
--- a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/PutSplunk.java
+++ b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/PutSplunk.java
@@ -261,7 +261,7 @@ public class PutSplunk extends AbstractPutEventProcessor<byte[]> {
byte[] message = new byte[length + 1];
for (int i = 0; i < length; i++) {
- message[i] = buf[i];
+ message[i] = buf[i];
}
message[message.length - 1] = NEW_LINE_CHAR;
return message;
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/EnvironmentVariableParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/EnvironmentVariableParameterProvider.java
index 8e89a04a2b..89f0b95980 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/EnvironmentVariableParameterProvider.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/EnvironmentVariableParameterProvider.java
@@ -156,7 +156,7 @@ public class EnvironmentVariableParameterProvider extends AbstractParameterProvi
.provided(true)
.build());
}
- });
+ });
return Collections.singletonList(new ParameterGroup(parameterGroupName, parameters));
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/OnePasswordParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/OnePasswordParameterProvider.java
index 7924dea4e3..0eb380a6e5 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/OnePasswordParameterProvider.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/OnePasswordParameterProvider.java
@@ -163,7 +163,7 @@ public class OnePasswordParameterProvider extends AbstractParameterProvider impl
if (vaultID != null) {
uriBuilder.addPathSegment(vaultID)
- .addPathSegment(GET_ITEMS);
+ .addPathSegment(GET_ITEMS);
}
if (itemID != null) {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
index e88c25ada4..c358f03d91 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AttributesToCSV.java
@@ -259,7 +259,7 @@ public class AttributesToCSV extends AbstractProcessor {
destinationContent = OUTPUT_OVERWRITE_CONTENT.getValue().equals(context.getProperty(DESTINATION).getValue());
nullValForEmptyString = context.getProperty(NULL_VALUE_FOR_EMPTY_STRING).asBoolean();
includeSchema = context.getProperty(INCLUDE_SCHEMA).asBoolean();
- }
+ }
@Override
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
@@ -296,11 +296,11 @@ public class AttributesToCSV extends AbstractProcessor {
try {
if (destinationContent) {
FlowFile conFlowfile = session.write(original, (in, out) -> {
- if (includeSchema) {
- sbNames.append(System.lineSeparator());
- out.write(sbNames.toString().getBytes());
- }
- out.write(sbValues.toString().getBytes());
+ if (includeSchema) {
+ sbNames.append(System.lineSeparator());
+ out.write(sbNames.toString().getBytes());
+ }
+ out.write(sbValues.toString().getBytes());
});
conFlowfile = session.putAttribute(conFlowfile, CoreAttributes.MIME_TYPE.key(), OUTPUT_MIME_TYPE);
session.transfer(conFlowfile, REL_SUCCESS);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DistributeLoad.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DistributeLoad.java
index 8077bc2b91..39a3ec2a8f 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DistributeLoad.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DistributeLoad.java
@@ -152,8 +152,8 @@ public class DistributeLoad extends AbstractProcessor {
@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- if (doSetProps.getAndSet(false)) {
- this.properties = List.of(NUM_RELATIONSHIPS, DISTRIBUTION_STRATEGY);
+ if (doSetProps.getAndSet(false)) {
+ this.properties = List.of(NUM_RELATIONSHIPS, DISTRIBUTION_STRATEGY);
}
return properties;
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DuplicateFlowFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DuplicateFlowFile.java
index 17f4564dea..3297dc6217 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DuplicateFlowFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DuplicateFlowFile.java
@@ -40,8 +40,8 @@ import java.util.Set;
@Tags({"test", "load", "duplicate"})
@InputRequirement(Requirement.INPUT_REQUIRED)
@CapabilityDescription("Intended for load testing, this processor will create the configured number of copies of each incoming FlowFile. The original FlowFile as well as all "
-+ "generated copies are sent to the 'success' relationship. In addition, each FlowFile gets an attribute 'copy.index' set to the copy number, where the original FlowFile gets "
-+ "a value of zero, and all copies receive incremented integer values.")
+ + "generated copies are sent to the 'success' relationship. In addition, each FlowFile gets an attribute 'copy.index' set to the copy number, where the original FlowFile gets "
+ + "a value of zero, and all copies receive incremented integer values.")
@WritesAttributes({
@WritesAttribute(attribute = "copy.index", description = "A zero-based incrementing integer value based on which copy the FlowFile is.")
})
@@ -50,22 +50,22 @@ public class DuplicateFlowFile extends AbstractProcessor {
public static final String COPY_INDEX_ATTRIBUTE = "copy.index";
static final PropertyDescriptor NUM_COPIES = new PropertyDescriptor.Builder()
- .name("Number of Copies")
- .description("Specifies how many copies of each incoming FlowFile will be made")
- .required(true)
- .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
- .defaultValue("100")
- .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
- .build();
+ .name("Number of Copies")
+ .description("Specifies how many copies of each incoming FlowFile will be made")
+ .required(true)
+ .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
+ .defaultValue("100")
+ .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
+ .build();
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
NUM_COPIES
);
static final Relationship REL_SUCCESS = new Relationship.Builder()
- .name("success")
- .description("The original FlowFile and all copies will be sent to this relationship")
- .build();
+ .name("success")
+ .description("The original FlowFile and all copies will be sent to this relationship")
+ .build();
private static final Set<Relationship> RELATIONSHIPS = Set.of(
REL_SUCCESS
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java
index 52fcd0583a..3dbfa12f30 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java
@@ -181,8 +181,8 @@ public class EncodeContent extends AbstractProcessor {
private static class EncodeBase64 implements StreamCallback {
- private final int lineLength;
- private final String lineSeparator;
+ private final int lineLength;
+ private final String lineSeparator;
private EncodeBase64(final int lineLength,
final String lineSeparator) {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
index 6bdcb8b6ba..e48e4edb56 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EvaluateJsonPath.java
@@ -211,8 +211,8 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor {
public boolean isStale(String subject, String input) {
return cachedJsonPathMap.get(input) == null;
}
- })
- .required(false).dynamic(true).build();
+ })
+ .required(false).dynamic(true).build();
}
@Override
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteProcess.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteProcess.java
index 0b6a7eb161..88feb421f5 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteProcess.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteProcess.java
@@ -91,43 +91,43 @@ public class ExecuteProcess extends AbstractProcessor {
final static String ATTRIBUTE_COMMAND_ARGS = "command.arguments";
public static final PropertyDescriptor COMMAND = new PropertyDescriptor.Builder()
- .name("Command")
- .description("Specifies the command to be executed; if just the name of an executable is provided, it must be in the user's environment PATH.")
- .required(true)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .build();
+ .name("Command")
+ .description("Specifies the command to be executed; if just the name of an executable is provided, it must be in the user's environment PATH.")
+ .required(true)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
public static final PropertyDescriptor COMMAND_ARGUMENTS = new PropertyDescriptor.Builder()
- .name("Command Arguments")
- .description("The arguments to supply to the executable delimited by white space. White space can be escaped by enclosing it in double-quotes.")
- .required(false)
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
- .build();
+ .name("Command Arguments")
+ .description("The arguments to supply to the executable delimited by white space. White space can be escaped by enclosing it in double-quotes.")
+ .required(false)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
public static final PropertyDescriptor WORKING_DIR = new PropertyDescriptor.Builder()
- .name("Working Directory")
- .description("The directory to use as the current working directory when executing the command")
- .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
- .addValidator(StandardValidators.createDirectoryExistsValidator(false, true))
- .required(false)
- .build();
+ .name("Working Directory")
+ .description("The directory to use as the current working directory when executing the command")
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.createDirectoryExistsValidator(false, true))
+ .required(false)
+ .build();
public static final PropertyDescriptor BATCH_DURATION = new PropertyDescriptor.Builder()
- .name("Batch Duration")
- .description("If the process is expected to be long-running and produce textual output, a batch duration can be specified so "
- + "that the output will be captured for this amount of time and a FlowFile will then be sent out with the results "
- + "and a new FlowFile will be started, rather than waiting for the process to finish before sending out the results")
+ .name("Batch Duration")
+ .description("If the process is expected to be long-running and produce textual output, a batch duration can be specified so "
+ + "that the output will be captured for this amount of time and a FlowFile will then be sent out with the results "
+ + "and a new FlowFile will be started, rather than waiting for the process to finish before sending out the results")
.required(false)
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
.build();
public static final PropertyDescriptor REDIRECT_ERROR_STREAM = new PropertyDescriptor.Builder()
- .name("Redirect Error Stream")
- .description("If true will redirect any error stream output of the process to the output stream. "
- + "This is particularly helpful for processes which write extensively to the error stream or for troubleshooting.")
+ .name("Redirect Error Stream")
+ .description("If true will redirect any error stream output of the process to the output stream. "
+ + "This is particularly helpful for processes which write extensively to the error stream or for troubleshooting.")
.required(false)
.allowableValues("true", "false")
.defaultValue("false")
@@ -138,13 +138,13 @@ public class ExecuteProcess extends AbstractProcessor {
private static final Validator characterValidator = new StandardValidators.StringLengthValidator(1, 1);
static final PropertyDescriptor ARG_DELIMITER = new PropertyDescriptor.Builder()
- .name("Argument Delimiter")
- .description("Delimiter to use to separate arguments for a command [default: space]. Must be a single character.")
- .addValidator(Validator.VALID)
- .addValidator(characterValidator)
- .required(true)
- .defaultValue(" ")
- .build();
+ .name("Argument Delimiter")
+ .description("Delimiter to use to separate arguments for a command [default: space]. Must be a single character.")
+ .addValidator(Validator.VALID)
+ .addValidator(characterValidator)
+ .required(true)
+ .defaultValue(" ")
+ .build();
static final PropertyDescriptor MIME_TYPE = new PropertyDescriptor.Builder()
.name("MIME Type")
@@ -164,9 +164,9 @@ public class ExecuteProcess extends AbstractProcessor {
);
public static final Relationship REL_SUCCESS = new Relationship.Builder()
- .name("success")
- .description("All created FlowFiles are routed to this relationship")
- .build();
+ .name("success")
+ .description("All created FlowFiles are routed to this relationship")
+ .build();
private static final Set<Relationship> RELATIONSHIPS = Set.of(REL_SUCCESS);
@@ -235,8 +235,8 @@ public class ExecuteProcess extends AbstractProcessor {
final String command = context.getProperty(COMMAND).evaluateAttributeExpressions().getValue();
final String arguments = context.getProperty(COMMAND_ARGUMENTS).isSet()
- ? context.getProperty(COMMAND_ARGUMENTS).evaluateAttributeExpressions().getValue()
- : null;
+ ? context.getProperty(COMMAND_ARGUMENTS).evaluateAttributeExpressions().getValue()
+ : null;
final List<String> commandStrings = createCommandStrings(context, command, arguments);
final String commandString = StringUtils.join(commandStrings, " ");
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
index 0b35c1d26c..2b9812c2b0 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
@@ -201,7 +201,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
static final AllowableValue DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY = new AllowableValue("Dynamic Property Arguments", "Dynamic Property Arguments",
"Arguments to be supplied to the executable are taken from dynamic properties with pattern of 'command.argument.<commandIndex>'");
- static final PropertyDescriptor WORKING_DIR = new PropertyDescriptor.Builder()
+ static final PropertyDescriptor WORKING_DIR = new PropertyDescriptor.Builder()
.name("Working Directory")
.description("The directory to use as the current working directory when executing the command")
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
@@ -246,7 +246,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
return result;
}).build();
- static final PropertyDescriptor ARG_DELIMITER = new PropertyDescriptor.Builder()
+ static final PropertyDescriptor ARG_DELIMITER = new PropertyDescriptor.Builder()
.name("Argument Delimiter")
.description("Delimiter to use to separate arguments for a command [default: ;]. Must be a single character")
.dependsOn(ARGUMENTS_STRATEGY, COMMAND_ARGUMENTS_PROPERTY_STRATEGY)
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateFlowFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateFlowFile.java
index 6e21ef4d08..52066b4736 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateFlowFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateFlowFile.java
@@ -238,7 +238,7 @@ public class GenerateFlowFile extends AbstractProcessor {
}
for (int i = 0; i < context.getProperty(BATCH_SIZE).asInteger(); i++) {
- FlowFile flowFile = session.create();
+ FlowFile flowFile = session.create();
final byte[] writtenData = uniqueData ? generateData(context) : data;
if (writtenData.length > 0) {
flowFile = session.write(flowFile, out -> out.write(writtenData));
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFile.java
index c92f00ec7d..e11d0668b5 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFile.java
@@ -74,9 +74,9 @@ import java.util.regex.Pattern;
@InputRequirement(Requirement.INPUT_FORBIDDEN)
@Tags({"local", "files", "filesystem", "ingest", "ingress", "get", "source", "input"})
@CapabilityDescription("""
- Reads files from a directory and streams them into the contents of new FlowFiles.
- NiFi will ignore files it doesn't have at least read permissions for.
-""")
+ Reads files from a directory and streams them into the contents of new FlowFiles.
+ NiFi will ignore files it doesn't have at least read permissions for.
+ """)
@WritesAttributes({
@WritesAttribute(attribute = "filename", description = "The filename is set to the name of the file on disk"),
@WritesAttribute(attribute = "path", description = "The path is set to the relative path of the file's directory on disk. For example, "
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFileResource.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFileResource.java
index 1c329a1878..17e2662857 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFileResource.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GetFileResource.java
@@ -61,8 +61,8 @@ import java.util.Set;
)
@WritesAttributes(
{
- @WritesAttribute(attribute = "mime.type", description = "Sets the MIME type of the output if the 'MIME Type' property is set"),
- @WritesAttribute(attribute = "Dynamic property key", description = "Value for the corresponding dynamic property, if any is set")
+ @WritesAttribute(attribute = "mime.type", description = "Sets the MIME type of the output if the 'MIME Type' property is set"),
+ @WritesAttribute(attribute = "Dynamic property key", description = "Value for the corresponding dynamic property, if any is set")
}
)
@DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min")
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java
index 7e00aa7ce1..415bf0d2e3 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java
@@ -152,7 +152,7 @@ import static jakarta.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
@WritesAttribute(attribute = "http.multipart.fragments.sequence.number",
description = "For requests with Content-Type \"multipart/form-data\", the part's index is recorded into this attribute. The index starts with 1."),
@WritesAttribute(attribute = "http.multipart.fragments.total.number",
- description = "For requests with Content-Type \"multipart/form-data\", the count of all parts is recorded into this attribute.")})
+ description = "For requests with Content-Type \"multipart/form-data\", the count of all parts is recorded into this attribute.")})
@SeeAlso(value = {HandleHttpResponse.class})
public class HandleHttpRequest extends AbstractProcessor implements ListenComponent {
@@ -646,60 +646,60 @@ public class HandleHttpRequest extends AbstractProcessor implements ListenCompon
final HttpServletRequest request = container.getRequest();
if (Strings.CS.contains(request.getContentType(), MIME_TYPE__MULTIPART_FORM_DATA)) {
- final long requestMaxSize = context.getProperty(MULTIPART_REQUEST_MAX_SIZE).asDataSize(DataUnit.B).longValue();
- final int readBufferSize = context.getProperty(MULTIPART_READ_BUFFER_SIZE).asDataSize(DataUnit.B).intValue();
- String tempDir = System.getProperty("java.io.tmpdir");
- request.setAttribute(ServletContextRequest.MULTIPART_CONFIG_ELEMENT, new MultipartConfigElement(tempDir, requestMaxSize, requestMaxSize, readBufferSize));
- List<Part> parts = null;
- try {
- parts = List.copyOf(request.getParts());
- int allPartsCount = parts.size();
- final String contextIdentifier = UUID.randomUUID().toString();
- for (int i = 0; i < allPartsCount; i++) {
- Part part = parts.get(i);
- FlowFile flowFile = session.create();
- try (OutputStream flowFileOut = session.write(flowFile)) {
- StreamUtils.copy(part.getInputStream(), flowFileOut);
- } catch (IOException e) {
- handleFlowContentStreamingError(session, container, Optional.of(flowFile), e);
- return;
- }
- flowFile = savePartAttributes(session, part, flowFile, i, allPartsCount);
- flowFile = saveRequestAttributes(context, session, request, flowFile, contextIdentifier);
- if (i == 0) {
- // each one of multipart comes from a single request, thus registering only once per loop.
- boolean requestRegistrationSuccess = registerRequest(context, session, container, flowFile);
- if (!requestRegistrationSuccess)
- break;
- }
- forwardFlowFile(session, start, request, flowFile);
- }
- } catch (IOException | ServletException | IllegalStateException e) {
- handleFlowContentStreamingError(session, container, Optional.empty(), e);
- } finally {
- if (parts != null) {
- for (Part part : parts) {
- try {
- part.delete();
- } catch (Exception e) {
- getLogger().error("Couldn't delete underlying storage for {}", part, e);
+ final long requestMaxSize = context.getProperty(MULTIPART_REQUEST_MAX_SIZE).asDataSize(DataUnit.B).longValue();
+ final int readBufferSize = context.getProperty(MULTIPART_READ_BUFFER_SIZE).asDataSize(DataUnit.B).intValue();
+ String tempDir = System.getProperty("java.io.tmpdir");
+ request.setAttribute(ServletContextRequest.MULTIPART_CONFIG_ELEMENT, new MultipartConfigElement(tempDir, requestMaxSize, requestMaxSize, readBufferSize));
+ List<Part> parts = null;
+ try {
+ parts = List.copyOf(request.getParts());
+ int allPartsCount = parts.size();
+ final String contextIdentifier = UUID.randomUUID().toString();
+ for (int i = 0; i < allPartsCount; i++) {
+ Part part = parts.get(i);
+ FlowFile flowFile = session.create();
+ try (OutputStream flowFileOut = session.write(flowFile)) {
+ StreamUtils.copy(part.getInputStream(), flowFileOut);
+ } catch (IOException e) {
+ handleFlowContentStreamingError(session, container, Optional.of(flowFile), e);
+ return;
+ }
+ flowFile = savePartAttributes(session, part, flowFile, i, allPartsCount);
+ flowFile = saveRequestAttributes(context, session, request, flowFile, contextIdentifier);
+ if (i == 0) {
+ // each one of multipart comes from a single request, thus registering only once per loop.
+ boolean requestRegistrationSuccess = registerRequest(context, session, container, flowFile);
+ if (!requestRegistrationSuccess)
+ break;
+ }
+ forwardFlowFile(session, start, request, flowFile);
+ }
+ } catch (IOException | ServletException | IllegalStateException e) {
+ handleFlowContentStreamingError(session, container, Optional.empty(), e);
+ } finally {
+ if (parts != null) {
+ for (Part part : parts) {
+ try {
+ part.delete();
+ } catch (Exception e) {
+ getLogger().error("Couldn't delete underlying storage for {}", part, e);
+ }
+ }
}
- }
}
- }
} else {
- FlowFile flowFile = session.create();
- try (OutputStream flowFileOut = session.write(flowFile)) {
- StreamUtils.copy(request.getInputStream(), flowFileOut);
- } catch (final IOException e) {
- handleFlowContentStreamingError(session, container, Optional.of(flowFile), e);
- return;
- }
- final String contextIdentifier = UUID.randomUUID().toString();
- flowFile = saveRequestAttributes(context, session, request, flowFile, contextIdentifier);
- boolean requestRegistrationSuccess = registerRequest(context, session, container, flowFile);
- if (requestRegistrationSuccess)
- forwardFlowFile(session, start, request, flowFile);
+ FlowFile flowFile = session.create();
+ try (OutputStream flowFileOut = session.write(flowFile)) {
+ StreamUtils.copy(request.getInputStream(), flowFileOut);
+ } catch (final IOException e) {
+ handleFlowContentStreamingError(session, container, Optional.of(flowFile), e);
+ return;
+ }
+ final String contextIdentifier = UUID.randomUUID().toString();
+ flowFile = saveRequestAttributes(context, session, request, flowFile, contextIdentifier);
+ boolean requestRegistrationSuccess = registerRequest(context, session, container, flowFile);
+ if (requestRegistrationSuccess)
+ forwardFlowFile(session, start, request, flowFile);
}
}
@@ -712,128 +712,128 @@ public class HandleHttpRequest extends AbstractProcessor implements ListenCompon
}
private FlowFile savePartAttributes(ProcessSession session, Part part, FlowFile flowFile, final int i, final int allPartsCount) {
- final Map<String, String> attributes = new HashMap<>();
- for (String headerName : part.getHeaderNames()) {
- final String headerValue = part.getHeader(headerName);
- putAttribute(attributes, "http.headers.multipart." + headerName, headerValue);
- }
- putAttribute(attributes, "http.multipart.size", part.getSize());
- putAttribute(attributes, "http.multipart.content.type", part.getContentType());
- putAttribute(attributes, "http.multipart.name", part.getName());
- putAttribute(attributes, "http.multipart.filename", part.getSubmittedFileName());
- putAttribute(attributes, "http.multipart.fragments.sequence.number", i + 1);
- putAttribute(attributes, "http.multipart.fragments.total.number", allPartsCount);
- return session.putAllAttributes(flowFile, attributes);
+ final Map<String, String> attributes = new HashMap<>();
+ for (String headerName : part.getHeaderNames()) {
+ final String headerValue = part.getHeader(headerName);
+ putAttribute(attributes, "http.headers.multipart." + headerName, headerValue);
+ }
+ putAttribute(attributes, "http.multipart.size", part.getSize());
+ putAttribute(attributes, "http.multipart.content.type", part.getContentType());
+ putAttribute(attributes, "http.multipart.name", part.getName());
+ putAttribute(attributes, "http.multipart.filename", part.getSubmittedFileName());
+ putAttribute(attributes, "http.multipart.fragments.sequence.number", i + 1);
+ putAttribute(attributes, "http.multipart.fragments.total.number", allPartsCount);
+ return session.putAllAttributes(flowFile, attributes);
}
private FlowFile saveRequestAttributes(final ProcessContext context, final ProcessSession session, HttpServletRequest request, FlowFile flowFile, String contextIdentifier) {
- final String charset = request.getCharacterEncoding() == null ? context.getProperty(URL_CHARACTER_SET).getValue() : request.getCharacterEncoding();
-
- final Map<String, String> attributes = new HashMap<>();
- try {
- putAttribute(attributes, HTTPUtils.HTTP_CONTEXT_ID, contextIdentifier);
- putAttribute(attributes, "mime.type", request.getContentType());
- putAttribute(attributes, "http.servlet.path", request.getServletPath());
- putAttribute(attributes, "http.context.path", request.getContextPath());
- putAttribute(attributes, "http.method", request.getMethod());
- putAttribute(attributes, "http.local.addr", request.getLocalAddr());
- putAttribute(attributes, HTTPUtils.HTTP_LOCAL_NAME, request.getLocalName());
- final String queryString = request.getQueryString();
- if (queryString != null) {
- putAttribute(attributes, "http.query.string", URLDecoder.decode(queryString, charset));
- }
- putAttribute(attributes, HTTPUtils.HTTP_REMOTE_HOST, request.getRemoteHost());
- putAttribute(attributes, "http.remote.addr", request.getRemoteAddr());
- putAttribute(attributes, "http.remote.user", request.getRemoteUser());
- putAttribute(attributes, "http.protocol", request.getProtocol());
- putAttribute(attributes, HTTPUtils.HTTP_REQUEST_URI, request.getRequestURI());
- putAttribute(attributes, "http.request.url", request.getRequestURL().toString());
- putAttribute(attributes, "http.auth.type", request.getAuthType());
-
- putAttribute(attributes, "http.requested.session.id", request.getRequestedSessionId());
- final DispatcherType dispatcherType = request.getDispatcherType();
- if (dispatcherType != null) {
- putAttribute(attributes, "http.dispatcher.type", dispatcherType.name());
- }
- putAttribute(attributes, "http.character.encoding", request.getCharacterEncoding());
- putAttribute(attributes, "http.locale", request.getLocale());
- putAttribute(attributes, "http.server.name", request.getServerName());
- putAttribute(attributes, HTTPUtils.HTTP_PORT, request.getServerPort());
-
- Set<String> parametersToAttributes = parameterToAttributesReference.get();
- if (parametersToAttributes != null && !parametersToAttributes.isEmpty()) {
- final Enumeration<String> paramEnumeration = request.getParameterNames();
- while (paramEnumeration.hasMoreElements()) {
- final String paramName = paramEnumeration.nextElement();
- if (parametersToAttributes.contains(paramName)) {
- attributes.put("http.param." + paramName, request.getParameter(paramName));
+ final String charset = request.getCharacterEncoding() == null ? context.getProperty(URL_CHARACTER_SET).getValue() : request.getCharacterEncoding();
+
+ final Map<String, String> attributes = new HashMap<>();
+ try {
+ putAttribute(attributes, HTTPUtils.HTTP_CONTEXT_ID, contextIdentifier);
+ putAttribute(attributes, "mime.type", request.getContentType());
+ putAttribute(attributes, "http.servlet.path", request.getServletPath());
+ putAttribute(attributes, "http.context.path", request.getContextPath());
+ putAttribute(attributes, "http.method", request.getMethod());
+ putAttribute(attributes, "http.local.addr", request.getLocalAddr());
+ putAttribute(attributes, HTTPUtils.HTTP_LOCAL_NAME, request.getLocalName());
+ final String queryString = request.getQueryString();
+ if (queryString != null) {
+ putAttribute(attributes, "http.query.string", URLDecoder.decode(queryString, charset));
+ }
+ putAttribute(attributes, HTTPUtils.HTTP_REMOTE_HOST, request.getRemoteHost());
+ putAttribute(attributes, "http.remote.addr", request.getRemoteAddr());
+ putAttribute(attributes, "http.remote.user", request.getRemoteUser());
+ putAttribute(attributes, "http.protocol", request.getProtocol());
+ putAttribute(attributes, HTTPUtils.HTTP_REQUEST_URI, request.getRequestURI());
+ putAttribute(attributes, "http.request.url", request.getRequestURL().toString());
+ putAttribute(attributes, "http.auth.type", request.getAuthType());
+
+ putAttribute(attributes, "http.requested.session.id", request.getRequestedSessionId());
+ final DispatcherType dispatcherType = request.getDispatcherType();
+ if (dispatcherType != null) {
+ putAttribute(attributes, "http.dispatcher.type", dispatcherType.name());
+ }
+ putAttribute(attributes, "http.character.encoding", request.getCharacterEncoding());
+ putAttribute(attributes, "http.locale", request.getLocale());
+ putAttribute(attributes, "http.server.name", request.getServerName());
+ putAttribute(attributes, HTTPUtils.HTTP_PORT, request.getServerPort());
+
+ Set<String> parametersToAttributes = parameterToAttributesReference.get();
+ if (parametersToAttributes != null && !parametersToAttributes.isEmpty()) {
+ final Enumeration<String> paramEnumeration = request.getParameterNames();
+ while (paramEnumeration.hasMoreElements()) {
+ final String paramName = paramEnumeration.nextElement();
+ if (parametersToAttributes.contains(paramName)) {
+ attributes.put("http.param." + paramName, request.getParameter(paramName));
+ }
+ }
+ }
+
+ final Cookie[] cookies = request.getCookies();
+ if (cookies != null) {
+ for (final Cookie cookie : cookies) {
+ final String name = cookie.getName();
+ final String cookiePrefix = "http.cookie." + name + ".";
+ attributes.put(cookiePrefix + "value", cookie.getValue());
+ attributes.put(cookiePrefix + "domain", cookie.getDomain());
+ attributes.put(cookiePrefix + "path", cookie.getPath());
+ attributes.put(cookiePrefix + "max.age", String.valueOf(cookie.getMaxAge()));
+ attributes.put(cookiePrefix + "secure", String.valueOf(cookie.getSecure()));
+ }
+ }
+
+ if (queryString != null) {
+ final String[] params = URL_QUERY_PARAM_DELIMITER.split(queryString);
+ for (final String keyValueString : params) {
+ final int indexOf = keyValueString.indexOf("=");
+ if (indexOf < 0) {
+ // no =, then it's just a key with no value
+ attributes.put("http.query.param." + URLDecoder.decode(keyValueString, charset), "");
+ } else {
+ final String key = keyValueString.substring(0, indexOf);
+ final String value;
+
+ if (indexOf == keyValueString.length() - 1) {
+ value = "";
+ } else {
+ value = keyValueString.substring(indexOf + 1);
+ }
+
+ attributes.put("http.query.param." + URLDecoder.decode(key, charset), URLDecoder.decode(value, charset));
+ }
}
- }
- }
-
- final Cookie[] cookies = request.getCookies();
- if (cookies != null) {
- for (final Cookie cookie : cookies) {
- final String name = cookie.getName();
- final String cookiePrefix = "http.cookie." + name + ".";
- attributes.put(cookiePrefix + "value", cookie.getValue());
- attributes.put(cookiePrefix + "domain", cookie.getDomain());
- attributes.put(cookiePrefix + "path", cookie.getPath());
- attributes.put(cookiePrefix + "max.age", String.valueOf(cookie.getMaxAge()));
- attributes.put(cookiePrefix + "secure", String.valueOf(cookie.getSecure()));
- }
- }
-
- if (queryString != null) {
- final String[] params = URL_QUERY_PARAM_DELIMITER.split(queryString);
- for (final String keyValueString : params) {
- final int indexOf = keyValueString.indexOf("=");
- if (indexOf < 0) {
- // no =, then it's just a key with no value
- attributes.put("http.query.param." + URLDecoder.decode(keyValueString, charset), "");
- } else {
- final String key = keyValueString.substring(0, indexOf);
- final String value;
-
- if (indexOf == keyValueString.length() - 1) {
- value = "";
- } else {
- value = keyValueString.substring(indexOf + 1);
- }
-
- attributes.put("http.query.param." + URLDecoder.decode(key, charset), URLDecoder.decode(value, charset));
- }
- }
- }
- } catch (final UnsupportedEncodingException uee) {
- throw new ProcessException("Invalid character encoding", uee); // won't happen because charset has been validated
- }
-
- final Enumeration<String> headerNames = request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- final String headerName = headerNames.nextElement();
- final String headerValue = request.getHeader(headerName);
- putAttribute(attributes, "http.headers." + headerName, headerValue);
- }
-
- final Principal principal = request.getUserPrincipal();
- if (principal != null) {
- putAttribute(attributes, "http.principal.name", principal.getName());
- }
-
- final Map<String, String> certificateAttributes = certificateAttributesProvider.getCertificateAttributes(request);
- attributes.putAll(certificateAttributes);
-
- return session.putAllAttributes(flowFile, attributes);
+ }
+ } catch (final UnsupportedEncodingException uee) {
+ throw new ProcessException("Invalid character encoding", uee); // won't happen because charset has been validated
+ }
+
+ final Enumeration<String> headerNames = request.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ final String headerName = headerNames.nextElement();
+ final String headerValue = request.getHeader(headerName);
+ putAttribute(attributes, "http.headers." + headerName, headerValue);
+ }
+
+ final Principal principal = request.getUserPrincipal();
+ if (principal != null) {
+ putAttribute(attributes, "http.principal.name", principal.getName());
+ }
+
+ final Map<String, String> certificateAttributes = certificateAttributesProvider.getCertificateAttributes(request);
+ attributes.putAll(certificateAttributes);
+
+ return session.putAllAttributes(flowFile, attributes);
}
private void forwardFlowFile(final ProcessSession session, final long start, final HttpServletRequest request, final FlowFile flowFile) {
- final long receiveMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
- final String subjectDn = flowFile.getAttribute(CertificateAttribute.HTTP_SUBJECT_DN.getName());
- session.getProvenanceReporter().receive(flowFile, HTTPUtils.getURI(flowFile.getAttributes()),
- "Received from " + request.getRemoteAddr() + (subjectDn == null ? "" : " with DN=" + subjectDn), receiveMillis);
- session.transfer(flowFile, REL_SUCCESS);
- getLogger().debug("Transferred {} to [{}] Remote Address [{}] ", flowFile, REL_SUCCESS, request.getRemoteAddr());
+ final long receiveMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
+ final String subjectDn = flowFile.getAttribute(CertificateAttribute.HTTP_SUBJECT_DN.getName());
+ session.getProvenanceReporter().receive(flowFile, HTTPUtils.getURI(flowFile.getAttributes()),
+ "Received from " + request.getRemoteAddr() + (subjectDn == null ? "" : " with DN=" + subjectDn), receiveMillis);
+ session.transfer(flowFile, REL_SUCCESS);
+ getLogger().debug("Transferred {} to [{}] Remote Address [{}] ", flowFile, REL_SUCCESS, request.getRemoteAddr());
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListDatabaseTables.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListDatabaseTables.java
index db63cb4b8d..2f7b53400a 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListDatabaseTables.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListDatabaseTables.java
@@ -312,8 +312,8 @@ public class ListDatabaseTables extends AbstractProcessor {
}
} catch (final NumberFormatException nfe) {
getLogger().error(
- "Failed to retrieve observed last table fetches from the State Manager. Will not perform "
- + "query until this is accomplished.", nfe);
+ "Failed to retrieve observed last table fetches from the State Manager. Will not perform "
+ + "query until this is accomplished.", nfe);
context.yield();
return;
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
index 24a00598fc..637ee9d758 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
@@ -445,10 +445,10 @@ public class ListenSyslog extends AbstractSyslogProcessor implements ListenCompo
final boolean writeDemarcator = (i > 0);
final byte[] messageBytes = (event == null) ? rawSyslogEvent.getMessage() : event.getRawMessage();
flowFile = session.append(flowFile, outputStream -> {
- if (writeDemarcator) {
- outputStream.write(messageDemarcatorBytes);
- }
- outputStream.write(messageBytes);
+ if (writeDemarcator) {
+ outputStream.write(messageDemarcatorBytes);
+ }
+ outputStream.write(messageBytes);
});
flowFilePerSender.put(sender, flowFile);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
index a0284e75ba..a1850e04d1 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
@@ -474,11 +474,11 @@ public class MergeContent extends BinFiles {
case TAR -> new TarMerge();
case ZIP -> new ZipMerge(context.getProperty(COMPRESSION_LEVEL).asInteger());
case FLOWFILE_STREAM_V3 ->
- new FlowFileStreamMerger(new FlowFilePackagerV3(), StandardFlowFileMediaType.VERSION_3.getMediaType());
+ new FlowFileStreamMerger(new FlowFilePackagerV3(), StandardFlowFileMediaType.VERSION_3.getMediaType());
case FLOWFILE_STREAM_V2 ->
- new FlowFileStreamMerger(new FlowFilePackagerV2(), StandardFlowFileMediaType.VERSION_2.getMediaType());
+ new FlowFileStreamMerger(new FlowFilePackagerV2(), StandardFlowFileMediaType.VERSION_2.getMediaType());
case FLOWFILE_TAR_V1 ->
- new FlowFileStreamMerger(new FlowFilePackagerV1(), StandardFlowFileMediaType.VERSION_1.getMediaType());
+ new FlowFileStreamMerger(new FlowFilePackagerV1(), StandardFlowFileMediaType.VERSION_1.getMediaType());
case CONCAT -> new BinaryConcatenationMerge();
case AVRO -> new AvroMerge();
};
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseSyslog5424.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseSyslog5424.java
index 5132474469..3c244b1ec7 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseSyslog5424.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseSyslog5424.java
@@ -160,7 +160,7 @@ public class ParseSyslog5424 extends AbstractProcessor {
boolean includeBody = true;
if (context.getProperty(INCLUDE_BODY_IN_ATTRIBUTES).isSet()) {
- includeBody = context.getProperty(INCLUDE_BODY_IN_ATTRIBUTES).asBoolean();
+ includeBody = context.getProperty(INCLUDE_BODY_IN_ATTRIBUTES).asBoolean();
}
final byte[] buffer = new byte[(int) flowFile.getSize()];
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java
index 39bdda9c24..6e50245e19 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java
@@ -780,12 +780,12 @@ public class PutDatabaseRecord extends AbstractProcessor {
final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue();
final String updateKeys = switch (configuredStatementType) {
case UPDATE_TYPE, UPSERT_TYPE, SQL_TYPE, USE_ATTR_TYPE, USE_RECORD_PATH ->
- context.getProperty(UPDATE_KEYS).evaluateAttributeExpressions(flowFile).getValue();
+ context.getProperty(UPDATE_KEYS).evaluateAttributeExpressions(flowFile).getValue();
default -> null;
};
final String deleteKeys = switch (configuredStatementType) {
case DELETE_TYPE, SQL_TYPE, USE_ATTR_TYPE, USE_RECORD_PATH ->
- context.getProperty(DELETE_KEYS).evaluateAttributeExpressions(flowFile).getValue();
+ context.getProperty(DELETE_KEYS).evaluateAttributeExpressions(flowFile).getValue();
default -> null;
};
final int maxBatchSize = context.getProperty(MAX_BATCH_SIZE).evaluateAttributeExpressions(flowFile).asInteger();
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
index 8e1cde1d90..41ddcfef22 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutEmail.java
@@ -334,14 +334,14 @@ public class PutEmail extends AbstractProcessor {
* Mapping of the mail properties to the NiFi PropertyDescriptors that will be evaluated at runtime
*/
private static final Map<String, PropertyDescriptor> propertyToContext = Map.of(
- "mail.smtp.host", SMTP_HOSTNAME,
- "mail.smtp.port", SMTP_PORT,
- "mail.smtp.socketFactory.port", SMTP_PORT,
- "mail.smtp.socketFactory.class", SMTP_SOCKET_FACTORY,
- "mail.smtp.auth", SMTP_AUTH,
- "mail.smtp.starttls.enable", SMTP_TLS,
- "mail.smtp.user", SMTP_USERNAME,
- "mail.smtp.password", SMTP_PASSWORD
+ "mail.smtp.host", SMTP_HOSTNAME,
+ "mail.smtp.port", SMTP_PORT,
+ "mail.smtp.socketFactory.port", SMTP_PORT,
+ "mail.smtp.socketFactory.class", SMTP_SOCKET_FACTORY,
+ "mail.smtp.auth", SMTP_AUTH,
+ "mail.smtp.starttls.enable", SMTP_TLS,
+ "mail.smtp.user", SMTP_USERNAME,
+ "mail.smtp.password", SMTP_PASSWORD
);
@Override
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
index 7b5b3a2e77..77aca251b1 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitJson.java
@@ -212,10 +212,9 @@ public class SplitJson extends AbstractJsonPathProcessor {
Object resultSegment = resultList.get(i);
FlowFile split = processSession.create(original);
split = processSession.write(split, (out) -> {
- String resultSegmentContent = getResultRepresentation(jsonPathConfiguration.jsonProvider(), resultSegment, nullDefaultValue);
- out.write(resultSegmentContent.getBytes(StandardCharsets.UTF_8));
- }
- );
+ String resultSegmentContent = getResultRepresentation(jsonPathConfiguration.jsonProvider(), resultSegment, nullDefaultValue);
+ out.write(resultSegmentContent.getBytes(StandardCharsets.UTF_8));
+ });
attributes.put(SEGMENT_ORIGINAL_FILENAME.key(), split.getAttribute(CoreAttributes.FILENAME.key()));
attributes.put(FRAGMENT_INDEX.key(), Integer.toString(i));
processSession.transfer(processSession.putAllAttributes(split, attributes), REL_SPLIT);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitRecord.java
index 311292519d..65e4b3a077 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitRecord.java
@@ -166,22 +166,22 @@ public class SplitRecord extends AbstractProcessor {
try (final OutputStream out = session.write(split);
final RecordSetWriter writer = writerFactory.createWriter(getLogger(), schema, out, split)) {
- if (maxRecords == 1) {
- final Record record = pushbackSet.next();
- writeResult = writer.write(record);
- } else {
- final RecordSet limitedSet = pushbackSet.limit(maxRecords);
- writeResult = writer.write(limitedSet);
- }
-
- attributes.put("record.count", String.valueOf(writeResult.getRecordCount()));
- attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType());
- attributes.put(FRAGMENT_INDEX, String.valueOf(fragmentIndex));
- attributes.put(FRAGMENT_ID, fragmentId);
- attributes.put(SEGMENT_ORIGINAL_FILENAME, original.getAttribute(CoreAttributes.FILENAME.key()));
- attributes.putAll(writeResult.getAttributes());
-
- session.adjustCounter("Records Split", writeResult.getRecordCount(), false);
+ if (maxRecords == 1) {
+ final Record record = pushbackSet.next();
+ writeResult = writer.write(record);
+ } else {
+ final RecordSet limitedSet = pushbackSet.limit(maxRecords);
+ writeResult = writer.write(limitedSet);
+ }
+
+ attributes.put("record.count", String.valueOf(writeResult.getRecordCount()));
+ attributes.put(CoreAttributes.MIME_TYPE.key(), writer.getMimeType());
+ attributes.put(FRAGMENT_INDEX, String.valueOf(fragmentIndex));
+ attributes.put(FRAGMENT_ID, fragmentId);
+ attributes.put(SEGMENT_ORIGINAL_FILENAME, original.getAttribute(CoreAttributes.FILENAME.key()));
+ attributes.putAll(writeResult.getAttributes());
+
+ session.adjustCounter("Records Split", writeResult.getRecordCount(), false);
}
split = session.putAllAttributes(split, attributes);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
index 29fada575d..12217221fe 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
@@ -314,32 +314,32 @@ public class UnpackContent extends AbstractProcessor {
// set the Unpacker to use for this FlowFile. FlowFileUnpackager objects maintain state and are not reusable.
final Unpacker unpacker;
final boolean addFragmentAttrs = switch (packagingFormat) {
- case TAR_FORMAT -> {
- unpacker = tarUnpacker;
- yield true;
- }
- case ZIP_FORMAT -> {
- unpacker = zipUnpacker;
- yield true;
- }
- case FLOWFILE_STREAM_FORMAT_V2 -> {
- unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV2());
- yield false;
- }
- case FLOWFILE_STREAM_FORMAT_V3 -> {
- unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV3());
- yield false;
- }
- case FLOWFILE_TAR_FORMAT -> {
- unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV1());
- yield false;
- }
- default ->
- // The format of the unpacker should be known before initialization
- throw new ProcessException(packagingFormat + " is not a valid packaging format");
+ case TAR_FORMAT -> {
+ unpacker = tarUnpacker;
+ yield true;
+ }
+ case ZIP_FORMAT -> {
+ unpacker = zipUnpacker;
+ yield true;
+ }
+ case FLOWFILE_STREAM_FORMAT_V2 -> {
+ unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV2());
+ yield false;
+ }
+ case FLOWFILE_STREAM_FORMAT_V3 -> {
+ unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV3());
+ yield false;
+ }
+ case FLOWFILE_TAR_FORMAT -> {
+ unpacker = new FlowFileStreamUnpacker(new FlowFileUnpackagerV1());
+ yield false;
+ }
+ default ->
+ // The format of the unpacker should be known before initialization
+ throw new ProcessException(packagingFormat + " is not a valid packaging format");
};
- final List<FlowFile> unpacked = new ArrayList<>();
+ final List<FlowFile> unpacked = new ArrayList<>();
try {
unpacker.unpack(session, flowFile, unpacked);
if (unpacked.isEmpty()) {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java
index 91584b68d1..40039d2929 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateJson.java
@@ -262,7 +262,7 @@ public class ValidateJson extends AbstractProcessor {
public void onScheduled(final ProcessContext context) throws IOException {
switch (getSchemaAccessStrategy(context)) {
case SCHEMA_NAME_PROPERTY ->
- jsonSchemaRegistry = context.getProperty(SCHEMA_REGISTRY).asControllerService(JsonSchemaRegistry.class);
+ jsonSchemaRegistry = context.getProperty(SCHEMA_REGISTRY).asControllerService(JsonSchemaRegistry.class);
case SCHEMA_CONTENT_PROPERTY -> {
try (final InputStream inputStream = context.getProperty(SCHEMA_CONTENT).asResource().read()) {
final SchemaVersion schemaVersion = SchemaVersion.valueOf(context.getProperty(SCHEMA_VERSION).getValue());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/Oracle12DatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/Oracle12DatabaseAdapter.java
index 0ca1c44dd5..deb8d64aca 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/Oracle12DatabaseAdapter.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/Oracle12DatabaseAdapter.java
@@ -228,7 +228,7 @@ public class Oracle12DatabaseAdapter implements DatabaseAdapter {
case Types.DOUBLE -> "DOUBLE PRECISION";
case CHAR, LONGNVARCHAR, LONGVARCHAR, NCHAR, NVARCHAR, VARCHAR, CLOB, NCLOB, OTHER, SQLXML ->
// Must have a max length specified (the Oracle docs say 2000), and use VARCHAR2 instead of VARCHAR for consistent comparison semantics
- "VARCHAR2(2000)";
+ "VARCHAR2(2000)";
default -> JDBCType.valueOf(sqlType).getName();
};
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/OracleDatabaseAdapter.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/OracleDatabaseAdapter.java
index 8c83168e88..49f0cf7f8b 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/OracleDatabaseAdapter.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/impl/OracleDatabaseAdapter.java
@@ -156,7 +156,7 @@ public class OracleDatabaseAdapter implements DatabaseAdapter {
case Types.DOUBLE -> "DOUBLE PRECISION";
case CHAR, LONGNVARCHAR, LONGVARCHAR, NCHAR, NVARCHAR, VARCHAR, CLOB, NCLOB, OTHER, SQLXML ->
// Must have a max length specified (the Oracle docs say 2000), and use VARCHAR2 instead of VARCHAR for consistent comparison semantics
- "VARCHAR2(2000)";
+ "VARCHAR2(2000)";
default -> JDBCType.valueOf(sqlType).getName();
};
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/encoding/EncodingMode.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/encoding/EncodingMode.java
index 710c5ac1b7..8701c8303a 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/encoding/EncodingMode.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/encoding/EncodingMode.java
@@ -44,4 +44,4 @@ public enum EncodingMode implements DescribedValue {
public String getDescription() {
return description;
}
- }
+}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
index 196487772f..c823acd610 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
@@ -415,15 +415,14 @@ public class ListenHTTPServlet extends HttpServlet {
final AsyncContext asyncContext = request.startAsync();
session.commitAsync(() -> {
- response.setStatus(this.returnCode);
- asyncContext.complete();
- }, t -> {
- logger.error("Failed to commit session. Returning error response to Remote Host: [{}] Port [{}] SubjectDN [{}] IssuerDN [{}]",
- request.getRemoteHost(), request.getRemotePort(), foundSubject, foundIssuer, t);
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- asyncContext.complete();
- }
- );
+ response.setStatus(this.returnCode);
+ asyncContext.complete();
+ }, t -> {
+ logger.error("Failed to commit session. Returning error response to Remote Host: [{}] Port [{}] SubjectDN [{}] IssuerDN [{}]",
+ request.getRemoteHost(), request.getRemotePort(), foundSubject, foundIssuer, t);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ asyncContext.complete();
+ });
}
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
index 99d526e8fd..21d4d15595 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java
@@ -108,7 +108,7 @@ public class SFTPTransfer implements FileTransfer {
private static String buildFullPath(String path, String filename) {
if (path == null) {
- return filename;
+ return filename;
}
if (path.endsWith("/")) {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
index 53f84fd50d..91b1733166 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/PutDatabaseRecordTest.java
@@ -2015,11 +2015,11 @@ class PutDatabaseRecordTest extends AbstractDatabaseConnectionServiceTest {
setRunner(TestCaseEnum.DEFAULT_0.getTestCase());
recreateTable("""
- CREATE TABLE ENUM_TEST (
- id integer primary key,
- suit varchar(8) not null
- )
- """);
+ CREATE TABLE ENUM_TEST (
+ id integer primary key,
+ suit varchar(8) not null
+ )
+ """);
try (
Connection conn = dbcp.getConnection();
@@ -2027,12 +2027,12 @@ class PutDatabaseRecordTest extends AbstractDatabaseConnectionServiceTest {
) {
// Add constraint for Apache Derby
stmt.execute("""
- ALTER TABLE ENUM_TEST
- ADD CONSTRAINT suit
- CHECK (
- suit IN ('clubs', 'diamonds', 'hearts', 'spades')
- )
- """
+ ALTER TABLE ENUM_TEST
+ ADD CONSTRAINT suit
+ CHECK (
+ suit IN ('clubs', 'diamonds', 'hearts', 'spades')
+ )
+ """
);
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java
index fea5aac022..bf875ef491 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java
@@ -140,13 +140,13 @@ class TestEncodeContent {
}
private static Stream<Arguments> encodeHexArgs() {
- return Stream.of(
- Arguments.of("hello", "68656C6C6F"),
- Arguments.of("foo", "666F6F"),
- Arguments.of("你好", "E4BDA0E5A5BD"),
- Arguments.of("Здравствуйте", "D097D0B4D180D0B0D0B2D181D182D0B2D183D0B9D182D0B5")
- );
- }
+ return Stream.of(
+ Arguments.of("hello", "68656C6C6F"),
+ Arguments.of("foo", "666F6F"),
+ Arguments.of("你好", "E4BDA0E5A5BD"),
+ Arguments.of("Здравствуйте", "D097D0B4D180D0B0D0B2D181D182D0B2D183D0B9D182D0B5")
+ );
+ }
@ParameterizedTest
@MethodSource("encodeBase32Args")
@@ -155,13 +155,13 @@ class TestEncodeContent {
}
private static Stream<Arguments> encodeBase32Args() {
- return Stream.of(
- Arguments.of("hello", "NBSWY3DP\n"),
- Arguments.of("foo", "MZXW6===\n"),
- Arguments.of("你好", "4S62BZNFXU======\n"),
- Arguments.of("Здравствуйте", "2CL5BNGRQDILBUFS2GA5DAWQWLIYHUFZ2GBNBNI=\n")
- );
- }
+ return Stream.of(
+ Arguments.of("hello", "NBSWY3DP\n"),
+ Arguments.of("foo", "MZXW6===\n"),
+ Arguments.of("你好", "4S62BZNFXU======\n"),
+ Arguments.of("Здравствуйте", "2CL5BNGRQDILBUFS2GA5DAWQWLIYHUFZ2GBNBNI=\n")
+ );
+ }
@ParameterizedTest
@MethodSource("encodeBase64Args")
@@ -170,13 +170,13 @@ class TestEncodeContent {
}
private static Stream<Arguments> encodeBase64Args() {
- return Stream.of(
- Arguments.of("hello", "aGVsbG8=\n"),
- Arguments.of("foo", "Zm9v\n"),
- Arguments.of("你好", "5L2g5aW9\n"),
- Arguments.of("Здравствуйте", "0JfQtNGA0LDQstGB0YLQstGD0LnRgtC1\n")
- );
- }
+ return Stream.of(
+ Arguments.of("hello", "aGVsbG8=\n"),
+ Arguments.of("foo", "Zm9v\n"),
+ Arguments.of("你好", "5L2g5aW9\n"),
+ Arguments.of("Здравствуйте", "0JfQtNGA0LDQstGB0YLQstGD0LnRgtC1\n")
+ );
+ }
@Test
void testBlankValueShouldNotFail() {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLookupAttribute.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLookupAttribute.java
index 1cc5868711..7b248ca050 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLookupAttribute.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLookupAttribute.java
@@ -163,15 +163,15 @@ public class TestLookupAttribute {
}
private static class InvalidLookupService extends AbstractControllerService implements StringLookupService {
- @Override
- public Optional<String> lookup(Map<String, Object> coordinates) {
- return Optional.empty();
- }
-
- @Override
- public Set<String> getRequiredKeys() {
- return Set.of("key1", "key2");
- }
+ @Override
+ public Optional<String> lookup(Map<String, Object> coordinates) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Set<String> getRequiredKeys() {
+ return Set.of("key1", "key2");
+ }
}
static class TestService extends AbstractControllerService implements StringLookupService {
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeRecord.java
index 656b4d5af2..b90ed8a851 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeRecord.java
@@ -104,7 +104,7 @@ public class TestMergeRecord {
public void testMergeSimpleDifferentWriteSchema() throws InitializationException {
// Exclude Age field
List<RecordField> writeFields = Collections.singletonList(
- new RecordField("Name", RecordFieldType.STRING.getDataType())
+ new RecordField("Name", RecordFieldType.STRING.getDataType())
);
RecordSchema writeSchema = new SimpleRecordSchema(writeFields);
writerService = new MockRecordWriter("header", false, -1, true, writeSchema);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutUDP.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutUDP.java
index f51a3f8559..432d8e7aaf 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutUDP.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutUDP.java
@@ -158,10 +158,10 @@ public class TestPutUDP {
private void assertMessagesReceived(final String[] sentMessages) throws Exception {
// check each sent FlowFile was successfully sent and received.
- for (String item : sentMessages) {
- ByteArrayMessage packet = messages.take();
- assertNotNull(packet);
- assertArrayEquals(item.getBytes(), packet.getMessage());
+ for (String item : sentMessages) {
+ ByteArrayMessage packet = messages.take();
+ assertNotNull(packet);
+ assertArrayEquals(item.getBytes(), packet.getMessage());
}
runner.assertTransferCount(PutUDP.REL_SUCCESS, sentMessages.length);
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
index 125bda88a1..c907d384de 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
@@ -1473,8 +1473,8 @@ public class TestReplaceText {
+ "2009,8-8-2008,10aug2008";
final String expectedCsvOut =
"2006,10-01-2004,2004/05/10\n"
- + "2007,15-05-2006,2005/06/10\r\n"
- + "2009,8-8-2008,2008/08/10";
+ + "2007,15-05-2006,2005/06/10\r\n"
+ + "2009,8-8-2008,2008/08/10";
runner.enqueue(csvIn.getBytes());
@@ -1497,7 +1497,7 @@ public class TestReplaceText {
+ "3,2,1,https://321.jpg,other.email@mydomain.com";
final String expectedCsvOut =
"1,2,3,https://1.png,email@mydomain.com\n"
- + "3,2,1,https://3.png,other.email@mydomain.com";
+ + "3,2,1,https://3.png,other.email@mydomain.com";
runner.enqueue(csvIn.getBytes());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateRecord.java
index b85c4e9c2b..44455d7da1 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestValidateRecord.java
@@ -289,8 +289,8 @@ public class TestValidateRecord {
final MockFlowFile validFlowFile = runner.getFlowFilesForRelationship(ValidateRecord.REL_VALID).getFirst();
final byte[] validFlowFileBytes = validFlowFile.toByteArray();
try (
- final ByteArrayInputStream resultContentStream = new ByteArrayInputStream(validFlowFileBytes);
- final RecordReader recordReader = avroReader.createRecordReader(validFlowFile.getAttributes(), resultContentStream, validFlowFileBytes.length, runner.getLogger())
+ final ByteArrayInputStream resultContentStream = new ByteArrayInputStream(validFlowFileBytes);
+ final RecordReader recordReader = avroReader.createRecordReader(validFlowFile.getAttributes(), resultContentStream, validFlowFileBytes.length, runner.getLogger())
) {
final RecordSchema resultSchema = recordReader.getSchema();
assertEquals(3, resultSchema.getFieldCount());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
index 9cbb624ab2..b0c5178a87 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
@@ -203,7 +203,7 @@ public class TestWait {
props.put("releaseSignalAttribute", "2");
runner.enqueue(new byte[]{}, props);
final AssertionError e = assertThrows(AssertionError.class, () -> {
- runner.run();
+ runner.run();
});
assertInstanceOf(ProcessException.class, e.getCause());
assertInstanceOf(IOException.class, e.getCause().getCause());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/main/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettings.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/main/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettings.java
index 9f8094b69e..a0531dedd3 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/main/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettings.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/main/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettings.java
@@ -159,7 +159,7 @@ public class RestrictBackpressureSettings extends AbstractFlowAnalysisRule {
context.getProperty(SIZE_MAX).getValue()));
}
}
- );
+ );
return FlowAnalysisRuleUtils.convertToGroupAnalysisResults(pg, violations);
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/test/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettingsTest.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/test/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettingsTest.java
index 976250823a..24a3f0f445 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/test/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettingsTest.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-rules/src/test/java/org/apache/nifi/flowanalysis/rules/RestrictBackpressureSettingsTest.java
@@ -75,7 +75,7 @@ public class RestrictBackpressureSettingsTest extends AbstractFlowAnalaysisRuleT
testAnalyzeProcessGroup(
"src/test/resources/RestrictBackpressureSettings/RestrictBackpressureSettings_noViolation.json",
List.of()
- );
+ );
}
@Test
@@ -89,8 +89,8 @@ public class RestrictBackpressureSettingsTest extends AbstractFlowAnalaysisRuleT
"e26fd0d5-0192-1000-ee3d-f90141590475", // connection from funnel to funnel
"e27073f8-0192-1000-cf43-9c41e69eadd2", // connection from output port to funnel
"e270eaa4-0192-1000-0622-8f9af5319328" // connection from funnel to input port
- )
- );
+ )
+ );
}
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-database-dialect-service-bundle/nifi-database-dialect-service/src/main/java/org/apache/nifi/database/dialect/service/StandardDatabaseDialectService.java b/nifi-extension-bundles/nifi-standard-services/nifi-database-dialect-service-bundle/nifi-database-dialect-service/src/main/java/org/apache/nifi/database/dialect/service/StandardDatabaseDialectService.java
index 693f0e7413..5e0826acac 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-database-dialect-service-bundle/nifi-database-dialect-service/src/main/java/org/apache/nifi/database/dialect/service/StandardDatabaseDialectService.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-database-dialect-service-bundle/nifi-database-dialect-service/src/main/java/org/apache/nifi/database/dialect/service/StandardDatabaseDialectService.java
@@ -38,9 +38,9 @@ import java.util.OptionalLong;
import java.util.Set;
@CapabilityDescription("""
- Database Dialect Service supporting ANSI SQL.
- Supported Statement Types: ALTER, CREATE, SELECT
-"""
+ Database Dialect Service supporting ANSI SQL.
+ Supported Statement Types: ALTER, CREATE, SELECT
+ """
)
@Tags({ "Relational", "Database", "JDBC", "SQL" })
public class StandardDatabaseDialectService extends AbstractControllerService implements DatabaseDialectService {
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-db-schema-registry-bundle/nifi-db-schema-registry-service/src/main/java/org/apache/nifi/db/schemaregistry/DatabaseTableSchemaRegistry.java b/nifi-extension-bundles/nifi-standard-services/nifi-db-schema-registry-bundle/nifi-db-schema-registry-service/src/main/java/org/apache/nifi/db/schemaregistry/DatabaseTableSchemaRegistry.java
index 38a90a3a06..e4f23c6617 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-db-schema-registry-bundle/nifi-db-schema-registry-service/src/main/java/org/apache/nifi/db/schemaregistry/DatabaseTableSchemaRegistry.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-db-schema-registry-bundle/nifi-db-schema-registry-service/src/main/java/org/apache/nifi/db/schemaregistry/DatabaseTableSchemaRegistry.java
@@ -126,8 +126,8 @@ public class DatabaseTableSchemaRegistry extends AbstractControllerService imple
try {
try (final Connection conn = dbcpService.getConnection()) {
final DatabaseMetaData databaseMetaData = conn.getMetaData();
- return getRecordSchemaFromMetadata(databaseMetaData, tableName);
- }
+ return getRecordSchemaFromMetadata(databaseMetaData, tableName);
+ }
} catch (SQLException sqle) {
throw new IOException("Error retrieving schema for table " + schemaName.get(), sqle);
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
index db27a8160c..8464fc76b5 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
@@ -139,7 +139,7 @@ public class DBCPConnectionPool extends AbstractDBCPConnectionPool implements DB
config.removeProperty("kerberos-credentials-service");
DBCPProperties.OLD_DB_DRIVER_LOCATION_PROPERTY_NAMES.forEach(oldPropertyName ->
config.renameProperty(oldPropertyName, DB_DRIVER_LOCATION.getName())
- );
+ );
config.renameProperty(DBCPProperties.OLD_VALIDATION_QUERY_PROPERTY_NAME, VALIDATION_QUERY.getName());
config.renameProperty(DBCPProperties.OLD_MIN_IDLE_PROPERTY_NAME, MIN_IDLE.getName());
config.renameProperty(DBCPProperties.OLD_MAX_IDLE_PROPERTY_NAME, MAX_IDLE.getName());
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
index 319b64eebc..a412e1a642 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-hikari-dbcp-service/src/main/java/org/apache/nifi/dbcp/HikariCPConnectionPool.java
@@ -576,7 +576,7 @@ public class HikariCPConnectionPool extends AbstractControllerService implements
}
}
- @Override
+ @Override
public String toString() {
return String.format("%s[id=%s]", getClass().getSimpleName(), getIdentifier());
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/SetCacheClientService.java b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/SetCacheClientService.java
index 8634c91839..2928eea610 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/SetCacheClientService.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/SetCacheClientService.java
@@ -86,7 +86,7 @@ public class SetCacheClientService extends AbstractControllerService implements
@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
- return PROPERTY_DESCRIPTORS;
+ return PROPERTY_DESCRIPTORS;
}
@OnEnabled
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
index 406e48ff78..79e24fb170 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/JacksonCSVRecordReader.java
@@ -120,10 +120,10 @@ public class JacksonCSVRecordReader extends AbstractCSVRecordReader {
final Set<String> deDupe = new HashSet<>(schema.getFieldCount());
for (final String name : rawFieldNames) {
if (!deDupe.add(name)) {
- throw new IllegalArgumentException(String.format(
- "The header contains a duplicate name: \"%s\" in %s. If this is valid then use CSVFormat.withAllowDuplicateHeaderNames().",
- name, rawFieldNames
- ));
+ throw new IllegalArgumentException(String.format(
+ "The header contains a duplicate name: \"%s\" in %s. If this is valid then use CSVFormat.withAllowDuplicateHeaderNames().",
+ name, rawFieldNames
+ ));
}
}
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/WriteFastCSVResult.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/WriteFastCSVResult.java
index 301a86824a..2e2f0ae331 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/WriteFastCSVResult.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/WriteFastCSVResult.java
@@ -112,10 +112,10 @@ public class WriteFastCSVResult extends AbstractRecordSetWriter implements Recor
private String getFormat(final RecordField field) {
final DataType dataType = field.getDataType();
return switch (dataType.getFieldType()) {
- case DATE -> dateFormat;
- case TIME -> timeFormat;
+ case DATE -> dateFormat;
+ case TIME -> timeFormat;
case TIMESTAMP -> timestampFormat;
- default -> dataType.getFormat();
+ default -> dataType.getFormat();
};
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
index 7872de39a4..9ec2fbcec9 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/windowsevent/WindowsEventLogRecordReader.java
@@ -490,7 +490,7 @@ public class WindowsEventLogRecordReader implements RecordReader {
private Object parseStringForType(String data, String fieldName, DataType dataType) {
return switch (dataType.getFieldType()) {
case BOOLEAN, BYTE, CHAR, DECIMAL, DOUBLE, FLOAT, INT, LONG, SHORT, STRING, DATE, TIME, TIMESTAMP ->
- DataTypeUtils.convertType(data, dataType, Optional.ofNullable(dateFormat), Optional.ofNullable(timeFormat), Optional.ofNullable(timestampFormat), fieldName);
+ DataTypeUtils.convertType(data, dataType, Optional.ofNullable(dateFormat), Optional.ofNullable(timeFormat), Optional.ofNullable(timestampFormat), fieldName);
default -> null;
};
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java
index 70c8208cb1..8885c5e5db 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java
@@ -339,25 +339,25 @@ public class XMLRecordReader implements RecordReader {
}
}
- private void parseAttributesForUnknownField(StartElement startElement, RecordSchema schema, boolean dropUnknown, Map<String, Object> recordValues) {
- final Iterator iterator = startElement.getAttributes();
- while (iterator.hasNext()) {
- final Attribute attribute = (Attribute) iterator.next();
- final String attributeName = attribute.getName().toString();
- final String fieldName = ((attributePrefix == null) ? attributeName : (attributePrefix + attributeName));
-
- if (dropUnknown) {
- if (schema != null) {
- final boolean allowed = schema.getField(fieldName).isPresent() || schema.getField(attributeName).isPresent();
- if (allowed) {
- recordValues.put(fieldName, attribute.getValue());
- }
- }
- } else {
- recordValues.put(fieldName, attribute.getValue());
- }
- }
- }
+ private void parseAttributesForUnknownField(StartElement startElement, RecordSchema schema, boolean dropUnknown, Map<String, Object> recordValues) {
+ final Iterator iterator = startElement.getAttributes();
+ while (iterator.hasNext()) {
+ final Attribute attribute = (Attribute) iterator.next();
+ final String attributeName = attribute.getName().toString();
+ final String fieldName = ((attributePrefix == null) ? attributeName : (attributePrefix + attributeName));
+
+ if (dropUnknown) {
+ if (schema != null) {
+ final boolean allowed = schema.getField(fieldName).isPresent() || schema.getField(attributeName).isPresent();
+ if (allowed) {
+ recordValues.put(fieldName, attribute.getValue());
+ }
+ }
+ } else {
+ recordValues.put(fieldName, attribute.getValue());
+ }
+ }
+ }
private Record parseRecord(StartElement startElement, RecordSchema schema, boolean coerceTypes, boolean dropUnknown) throws XMLStreamException, MalformedRecordException {
final Map<String, Object> recordValues = new LinkedHashMap<>();
@@ -479,37 +479,37 @@ public class XMLRecordReader implements RecordReader {
final Attribute attribute = (Attribute) iterator.next();
final String attributeName = attribute.getName().toString();
- final String targetFieldName = attributePrefix == null ? attributeName : attributePrefix + attributeName;
-
- if (dropUnknown) {
- final Optional<RecordField> fieldPrefixed = schema.getField(targetFieldName);
- final Optional<RecordField> fieldRaw = schema.getField(attributeName);
- if (fieldPrefixed.isPresent() || fieldRaw.isPresent()) {
- if (coerceTypes) {
- final Object value;
- final DataType dataType = fieldPrefixed.map(RecordField::getDataType).orElseGet(() -> fieldRaw.get().getDataType());
- if ((value = parseStringForType(attribute.getValue(), targetFieldName, dataType)) != null) {
- recordValues.put(targetFieldName, value);
- }
- } else {
- recordValues.put(targetFieldName, attribute.getValue());
- }
- }
- } else {
-
- // dropUnknown == false && coerceTypes == true
- if (coerceTypes) {
- final Object value;
- final Optional<RecordField> fieldPrefixed = schema.getField(targetFieldName);
- final Optional<RecordField> fieldRaw = schema.getField(attributeName);
- if (fieldPrefixed.isPresent() || fieldRaw.isPresent()) {
- final DataType dataType = fieldPrefixed.map(RecordField::getDataType).orElseGet(() -> fieldRaw.get().getDataType());
- if ((value = parseStringForType(attribute.getValue(), targetFieldName, dataType)) != null) {
- recordValues.put(targetFieldName, value);
- }
- } else {
- recordValues.put(targetFieldName, attribute.getValue());
- }
+ final String targetFieldName = attributePrefix == null ? attributeName : attributePrefix + attributeName;
+
+ if (dropUnknown) {
+ final Optional<RecordField> fieldPrefixed = schema.getField(targetFieldName);
+ final Optional<RecordField> fieldRaw = schema.getField(attributeName);
+ if (fieldPrefixed.isPresent() || fieldRaw.isPresent()) {
+ if (coerceTypes) {
+ final Object value;
+ final DataType dataType = fieldPrefixed.map(RecordField::getDataType).orElseGet(() -> fieldRaw.get().getDataType());
+ if ((value = parseStringForType(attribute.getValue(), targetFieldName, dataType)) != null) {
+ recordValues.put(targetFieldName, value);
+ }
+ } else {
+ recordValues.put(targetFieldName, attribute.getValue());
+ }
+ }
+ } else {
+
+ // dropUnknown == false && coerceTypes == true
+ if (coerceTypes) {
+ final Object value;
+ final Optional<RecordField> fieldPrefixed = schema.getField(targetFieldName);
+ final Optional<RecordField> fieldRaw = schema.getField(attributeName);
+ if (fieldPrefixed.isPresent() || fieldRaw.isPresent()) {
+ final DataType dataType = fieldPrefixed.map(RecordField::getDataType).orElseGet(() -> fieldRaw.get().getDataType());
+ if ((value = parseStringForType(attribute.getValue(), targetFieldName, dataType)) != null) {
+ recordValues.put(targetFieldName, value);
+ }
+ } else {
+ recordValues.put(targetFieldName, attribute.getValue());
+ }
// dropUnknown == false && coerceTypes == false
} else {
@@ -540,7 +540,7 @@ public class XMLRecordReader implements RecordReader {
private Object parseStringForType(String data, String fieldName, DataType dataType) {
return switch (dataType.getFieldType()) {
case BOOLEAN, BYTE, CHAR, CHOICE, DECIMAL, DOUBLE, FLOAT, INT, LONG, SHORT, STRING, DATE, TIME, TIMESTAMP ->
- DataTypeUtils.convertType(data, dataType, Optional.ofNullable(dateFormat), Optional.ofNullable(timeFormat), Optional.ofNullable(timestampFormat), fieldName);
+ DataTypeUtils.convertType(data, dataType, Optional.ofNullable(dateFormat), Optional.ofNullable(timeFormat), Optional.ofNullable(timestampFormat), fieldName);
default -> null;
};
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
index 1701476c99..896f0d0747 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
@@ -473,13 +473,13 @@ public abstract class TestWriteAvroResult {
fieldName + " not equal");
} else if (recordValue instanceof Map) {
assertInstanceOf(Map.class, avroValue, fieldName + " should have been instanceof Map");
- final Map<?, ?> avroMap = (Map<?, ?>) avroValue;
- final Map<?, ?> recordMap = (Map<?, ?>) recordValue;
- assertEquals(recordMap.size(), avroMap.size(),
- fieldName + " not equal");
- for (Object s : avroMap.keySet()) {
- assertMatch((Record) recordMap.get(s.toString()), (GenericRecord) avroMap.get(s));
- }
+ final Map<?, ?> avroMap = (Map<?, ?>) avroValue;
+ final Map<?, ?> recordMap = (Map<?, ?>) recordValue;
+ assertEquals(recordMap.size(), avroMap.size(),
+ fieldName + " not equal");
+ for (Object s : avroMap.keySet()) {
+ assertMatch((Record) recordMap.get(s.toString()), (GenericRecord) avroMap.get(s));
+ }
} else if (recordValue instanceof Record) {
assertMatch((Record) recordValue, (GenericRecord) avroValue);
} else {
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
index 6dc012f0c7..f2d6863b95 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
@@ -158,9 +158,9 @@ class TestJsonTreeRowRecordReader {
for (int i = 0; i < iterations; i++) {
try (final InputStream in = new ByteArrayInputStream(data);
final JsonTreeRowRecordReader reader = createJsonTreeRowRecordReader(in, schema)) {
- while (reader.nextRecord() != null) {
- recordCount++;
- }
+ while (reader.nextRecord() != null) {
+ recordCount++;
+ }
}
}
final long nanos = System.nanoTime() - start;
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLRecordSetWriter.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLRecordSetWriter.java
index d24cd43a10..be0c795624 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLRecordSetWriter.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLRecordSetWriter.java
@@ -151,7 +151,7 @@ public class TestXMLRecordSetWriter {
"<name1>val1</name1><name2></name2></array_record></ROOT_NODE>";
String actual = new String(runner.getContentAsByteArray(runner.getFlowFilesForRelationship(TestXMLRecordSetWriterProcessor.SUCCESS).get(0)));
assertThat(expected, CompareMatcher.isSimilarTo(actual).ignoreWhitespace().withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)));
- }
+ }
@Test
public void testNullSuppression() throws IOException, InitializationException {
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
index 8e477f8e96..de3ed27fee 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
@@ -715,31 +715,29 @@ class TestYamlTreeRowRecordReader {
// so we take the first one (INT, BOOLEAN) - as best effort - for both cases
List<Object> expected = Arrays.asList(
new MapRecord(expectedRecordChoiceSchema, Map.of("record", new Object[]{
- new MapRecord(expectedChildSchema1, Map.of(
- "integer", 11,
- "boolean", true,
- "extraString", "extraStringValue11"
- )),
- new MapRecord(expectedChildSchema1, Map.of(
- "integer", 12,
- "boolean", false,
- "extraString", "extraStringValue12"
- ))
- })
- ),
+ new MapRecord(expectedChildSchema1, Map.of(
+ "integer", 11,
+ "boolean", true,
+ "extraString", "extraStringValue11"
+ )),
+ new MapRecord(expectedChildSchema1, Map.of(
+ "integer", 12,
+ "boolean", false,
+ "extraString", "extraStringValue12"
+ ))
+ })),
new MapRecord(expectedRecordChoiceSchema, Map.of("record", new Object[]{
- new MapRecord(expectedChildSchema1, Map.of(
- "integer", 21,
- "extraString", "extraStringValue21",
- "string", "stringValue21"
- )),
- new MapRecord(expectedChildSchema1, Map.of(
- "integer", 22,
- "extraString", "extraStringValue22",
- "string", "stringValue22"
- ))
- })
- )
+ new MapRecord(expectedChildSchema1, Map.of(
+ "integer", 21,
+ "extraString", "extraStringValue21",
+ "string", "stringValue21"
+ )),
+ new MapRecord(expectedChildSchema1, Map.of(
+ "integer", 22,
+ "extraString", "extraStringValue22",
+ "string", "stringValue22"
+ ))
+ }))
);
testReadRecords(yamlPath, schema, expected);
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/HttpRecordSink.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/HttpRecordSink.java
index 74ae092896..a2d9403796 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/HttpRecordSink.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/HttpRecordSink.java
@@ -59,7 +59,7 @@ public class HttpRecordSink extends AbstractControllerService implements RecordS
protected static final String HEADER_AUTHORIZATION = "Authorization";
protected static final String HEADER_CONTENT_TYPE = "Content-Type";
- public static final PropertyDescriptor API_URL = new PropertyDescriptor.Builder()
+ public static final PropertyDescriptor API_URL = new PropertyDescriptor.Builder()
.name("API URL")
.description("The URL which receives the HTTP requests.")
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
@@ -190,7 +190,7 @@ public class HttpRecordSink extends AbstractControllerService implements RecordS
WriteResult writeResult;
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final RecordSetWriter writer = writerFactory.createWriter(getLogger(), recordSet.getSchema(), baos, attributes)) {
- writeResult = sendRecords(recordSet, writer, baos, maxBatchSize);
+ writeResult = sendRecords(recordSet, writer, baos, maxBatchSize);
} catch (SchemaNotFoundException e) {
final String errorMessage = String.format("RecordSetWriter could not be created because the schema was not found. The schema name for the RecordSet to write is %s",
recordSet.getSchema().getSchemaName());
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestHttpRecordSink.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestHttpRecordSink.java
index 8e33144c48..7eaf488eef 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestHttpRecordSink.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestHttpRecordSink.java
@@ -266,9 +266,9 @@ public class TestHttpRecordSink {
Person[] people =
(maxBatchSize == 1)
? new Person[] {
- // For maxBatchSize 1, person is not in a Json array
- mapper.readValue(requestBody, Person.class)
- }
+ // For maxBatchSize 1, person is not in a Json array
+ mapper.readValue(requestBody, Person.class)
+ }
: mapper.readValue(requestBody, Person[].class); // Otherwise the body is a json array
for (int personIndex = 0; personIndex < people.length; personIndex++) {
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestProcessor.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestProcessor.java
index 23a0519c11..b0a6c5a83b 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestProcessor.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/test/java/org/apache/nifi/record/sink/TestProcessor.java
@@ -35,11 +35,11 @@ public class TestProcessor extends AbstractProcessor {
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
List<PropertyDescriptor> propDescs = new ArrayList<>();
propDescs.add(new PropertyDescriptor.Builder()
- .name("RecordSinkService test processor")
- .description("RecordSinkService test processor")
- .identifiesControllerService(RecordSinkService.class)
- .required(true)
- .build());
+ .name("RecordSinkService test processor")
+ .description("RecordSinkService test processor")
+ .identifiesControllerService(RecordSinkService.class)
+ .required(true)
+ .build());
return propDescs;
}
}
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/main/java/org/apache/nifi/ssl/PEMEncodedSSLContextProvider.java b/nifi-extension-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/main/java/org/apache/nifi/ssl/PEMEncodedSSLContextProvider.java
index 16fe1cdd59..de931b6867 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/main/java/org/apache/nifi/ssl/PEMEncodedSSLContextProvider.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-ssl-context-bundle/nifi-ssl-context-service/src/main/java/org/apache/nifi/ssl/PEMEncodedSSLContextProvider.java
@@ -59,9 +59,9 @@ import java.util.Optional;
@Tags({"PEM", "SSL", "TLS", "Key", "Certificate", "PKCS1", "PKCS8", "X.509", "ECDSA", "Ed25519", "RSA"})
@CapabilityDescription("""
- SSLContext Provider configurable using PEM Private Key and Certificate files.
- Supports PKCS1 and PKCS8 encoding for Private Keys as well as X.509 encoding for Certificates.
-""")
+ SSLContext Provider configurable using PEM Private Key and Certificate files.
+ Supports PKCS1 and PKCS8 encoding for Private Keys as well as X.509 encoding for Certificates.
+ """)
public class PEMEncodedSSLContextProvider extends AbstractControllerService implements SSLContextProvider, VerifiableControllerService {
static final String DEFAULT_PROTOCOL = "TLS";
diff --git a/nifi-extension-bundles/nifi-stateful-analysis-bundle/nifi-stateful-analysis-processors/src/test/java/org/apache/nifi/processors/stateful/analysis/AttributeRollingWindowIT.java b/nifi-extension-bundles/nifi-stateful-analysis-bundle/nifi-stateful-analysis-processors/src/test/java/org/apache/nifi/processors/stateful/analysis/AttributeRollingWindowIT.java
index a844422cab..48f05163f3 100644
--- a/nifi-extension-bundles/nifi-stateful-analysis-bundle/nifi-stateful-analysis-processors/src/test/java/org/apache/nifi/processors/stateful/analysis/AttributeRollingWindowIT.java
+++ b/nifi-extension-bundles/nifi-stateful-analysis-bundle/nifi-stateful-analysis-processors/src/test/java/org/apache/nifi/processors/stateful/analysis/AttributeRollingWindowIT.java
@@ -138,7 +138,7 @@ public class AttributeRollingWindowIT {
runner.enqueue("2".getBytes(), attributes);
runner.run(1);
runner.assertAllFlowFilesTransferred(AttributeRollingWindow.REL_SUCCESS, 1);
- flowFile = runner.getFlowFilesForRelationship(AttributeRollingWindow.REL_SUCCESS).getFirst();
+ flowFile = runner.getFlowFilesForRelationship(AttributeRollingWindow.REL_SUCCESS).getFirst();
runner.clearTransferState();
flowFile.assertAttributeEquals(ROLLING_WINDOW_VALUE_KEY, "2.0");
flowFile.assertAttributeEquals(ROLLING_WINDOW_COUNT_KEY, "2");
diff --git a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
index 09eda30a35..3a8e73c953 100644
--- a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
+++ b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
@@ -148,17 +148,17 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
// relationships
public static final Relationship REL_SUCCESS = new Relationship.Builder()
- .description("All successful FlowFiles are routed to this relationship").name("success").build();
+ .description("All successful FlowFiles are routed to this relationship").name("success").build();
public static final Relationship REL_FAILED_SET_STATE = new Relationship.Builder()
- .description("A failure to set the state after adding the attributes to the FlowFile will route the FlowFile here.").name("set state fail").build();
+ .description("A failure to set the state after adding the attributes to the FlowFile will route the FlowFile here.").name("set state fail").build();
private final static Set<Relationship> STATELESS_RELATIONSHIP_SET = Set.of(
- REL_SUCCESS
+ REL_SUCCESS
);
private final static Set<Relationship> STATEFUL_RELATIONSHIP_SET = Set.of(
- REL_SUCCESS,
- REL_FAILED_SET_STATE
+ REL_SUCCESS,
+ REL_FAILED_SET_STATE
);
@@ -194,46 +194,46 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
// static properties
public static final String DELETE_ATTRIBUTES_EXPRESSION_NAME = "Delete Attributes Expression";
public static final PropertyDescriptor DELETE_ATTRIBUTES = new PropertyDescriptor.Builder()
- .name(DELETE_ATTRIBUTES_EXPRESSION_NAME)
- .description("Regular expression for attributes to be deleted from FlowFiles. Existing attributes that match will be deleted regardless of whether they are updated by this processor.")
- .required(false)
- .addValidator(DELETE_PROPERTY_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
- .build();
+ .name(DELETE_ATTRIBUTES_EXPRESSION_NAME)
+ .description("Regular expression for attributes to be deleted from FlowFiles. Existing attributes that match will be deleted regardless of whether they are updated by this processor.")
+ .required(false)
+ .addValidator(DELETE_PROPERTY_VALIDATOR)
+ .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
+ .build();
public static final String STORE_STATE_NAME = "Store State";
public static final PropertyDescriptor STORE_STATE = new PropertyDescriptor.Builder()
- .name(STORE_STATE_NAME)
- .description("Select whether or not state will be stored. Selecting 'Stateless' will offer the default functionality of purely updating the attributes on a " +
- "FlowFile in a stateless manner. Selecting a stateful option will not only store the attributes on the FlowFile but also in the Processors " +
- "state. See the 'Stateful Usage' topic of the 'Additional Details' section of this processor's documentation for more information")
- .required(true)
- .allowableValues(DO_NOT_STORE_STATE, STORE_STATE_LOCALLY)
- .defaultValue(DO_NOT_STORE_STATE)
- .build();
+ .name(STORE_STATE_NAME)
+ .description("Select whether or not state will be stored. Selecting 'Stateless' will offer the default functionality of purely updating the attributes on a " +
+ "FlowFile in a stateless manner. Selecting a stateful option will not only store the attributes on the FlowFile but also in the Processors " +
+ "state. See the 'Stateful Usage' topic of the 'Additional Details' section of this processor's documentation for more information")
+ .required(true)
+ .allowableValues(DO_NOT_STORE_STATE, STORE_STATE_LOCALLY)
+ .defaultValue(DO_NOT_STORE_STATE)
+ .build();
public static final String STATEFUL_VARIABLES_INIT_VALUE_NAME = "Stateful Variables Initial Value";
public static final PropertyDescriptor STATEFUL_VARIABLES_INIT_VALUE = new PropertyDescriptor.Builder()
- .name(STATEFUL_VARIABLES_INIT_VALUE_NAME)
- .description("If using state to set/reference variables then this value is used to set the initial value of the stateful variable. This will only be used in the @OnScheduled method " +
- "when state does not contain a value for the variable. This is required if running statefully but can be empty if needed.")
- .required(false)
- .addValidator(Validator.VALID)
- .build();
+ .name(STATEFUL_VARIABLES_INIT_VALUE_NAME)
+ .description("If using state to set/reference variables then this value is used to set the initial value of the stateful variable. This will only be used in the @OnScheduled method " +
+ "when state does not contain a value for the variable. This is required if running statefully but can be empty if needed.")
+ .required(false)
+ .addValidator(Validator.VALID)
+ .build();
public static final PropertyDescriptor CANONICAL_VALUE_LOOKUP_CACHE_SIZE = new PropertyDescriptor.Builder()
- .name("Cache Value Lookup Cache Size")
- .description("Specifies how many canonical lookup values should be stored in the cache")
- .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
- .defaultValue("100")
- .required(true)
- .build();
+ .name("Cache Value Lookup Cache Size")
+ .description("Specifies how many canonical lookup values should be stored in the cache")
+ .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR)
+ .defaultValue("100")
+ .required(true)
+ .build();
private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
- DELETE_ATTRIBUTES,
- STORE_STATE,
- STATEFUL_VARIABLES_INIT_VALUE,
- CANONICAL_VALUE_LOOKUP_CACHE_SIZE
+ DELETE_ATTRIBUTES,
+ STORE_STATE,
+ STATEFUL_VARIABLES_INIT_VALUE,
+ CANONICAL_VALUE_LOOKUP_CACHE_SIZE
);
private volatile Map<String, Action> defaultActions;
@@ -263,13 +263,13 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new PropertyDescriptor.Builder()
- .name(propertyDescriptorName)
- .required(false)
- .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING, true))
- .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR)
- .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
- .dynamic(true)
- .build();
+ .name(propertyDescriptorName)
+ .required(false)
+ .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING, true))
+ .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR)
+ .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
+ .dynamic(true)
+ .build();
}
@Override
@@ -291,8 +291,8 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
public void onScheduled(final ProcessContext context) throws IOException {
final int cacheSize = context.getProperty(CANONICAL_VALUE_LOOKUP_CACHE_SIZE).asInteger();
canonicalValueLookup = Caffeine.newBuilder()
- .maximumSize(cacheSize)
- .build(attributeValue -> attributeValue);
+ .maximumSize(cacheSize)
+ .build(attributeValue -> attributeValue);
criteriaCache.set(CriteriaSerDe.deserialize(context.getAnnotationData()));
@@ -498,7 +498,7 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
if (stateful) {
stateMap = session.getState(Scope.LOCAL);
stateInitialAttributes = stateMap.toMap();
- stateWorkingAttributes = new HashMap<>(stateMap.toMap());
+ stateWorkingAttributes = new HashMap<>(stateMap.toMap());
} else {
stateInitialAttributes = null;
stateWorkingAttributes = null;
@@ -595,8 +595,8 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
//Evaluates the specified Criteria on the specified flowfile. Clones the
// specified flow file for each rule that is applied.
private boolean evaluateCriteria(final ProcessSession session, final ProcessContext context, final Criteria criteria, final FlowFile flowfile, final Map<FlowFile,
- List<Rule>> matchedRules, final Map<String, String> statefulAttributes) {
- final ComponentLog logger = getLogger();
+ List<Rule>> matchedRules, final Map<String, String> statefulAttributes) {
+ final ComponentLog logger = getLogger();
final List<Rule> rules = criteria.getRules();
// consider each rule and hold a copy of the flowfile for each matched rule
@@ -631,7 +631,6 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
private boolean evaluateRule(final ProcessContext context, final Rule rule, FlowFile flowfile, final Map<String, String> statefulAttributes) {
// go through each condition
for (final Condition condition : rule.getConditions()) {
-
// fail if any condition is not met
if (!evaluateCondition(context, condition, flowfile, statefulAttributes)) {
return false;
@@ -658,8 +657,8 @@ public class UpdateAttribute extends AbstractProcessor implements Searchable {
// Executes the specified action on the specified flowfile.
private FlowFile executeActions(final ProcessSession session, final ProcessContext context, final List<Rule> rules, final Map<String, Action> defaultActions, final FlowFile flowfile,
- final Map<String, String> stateInitialAttributes, final Map<String, String> stateWorkingAttributes) {
- final ComponentLog logger = getLogger();
+ final Map<String, String> stateInitialAttributes, final Map<String, String> stateWorkingAttributes) {
+ final ComponentLog logger = getLogger();
final Map<String, Action> actions = new HashMap<>(defaultActions);
final String ruleName = (rules == null || rules.isEmpty()) ? "default" : rules.getLast().getName();
diff --git a/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLogTest.java b/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLogTest.java
index 60e82214e7..713fc8c6be 100644
--- a/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLogTest.java
+++ b/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/ConsumeWindowsEventLogTest.java
@@ -249,17 +249,17 @@ public class ConsumeWindowsEventLogTest {
WinNT.HANDLE eventHandle = mock(WinNT.HANDLE.class);
when(wEvtApi.EvtRender(isNull(), eq(eventHandle), eq(WEvtApi.EvtRenderFlags.EVENT_XML),
anyInt(), any(Pointer.class), any(Pointer.class), any(Pointer.class))).thenAnswer(invocation -> {
- Object[] arguments = invocation.getArguments();
- Pointer bufferUsed = (Pointer) arguments[5];
- byte[] array = StandardCharsets.UTF_16LE.encode(eventXml).array();
- if (array.length > (int) arguments[3]) {
- when(kernel32.GetLastError()).thenReturn(W32Errors.ERROR_INSUFFICIENT_BUFFER).thenReturn(W32Errors.ERROR_SUCCESS);
- } else {
- ((Pointer) arguments[4]).write(0, array, 0, array.length);
- }
- bufferUsed.setInt(0, array.length);
- return false;
- });
+ Object[] arguments = invocation.getArguments();
+ Pointer bufferUsed = (Pointer) arguments[5];
+ byte[] array = StandardCharsets.UTF_16LE.encode(eventXml).array();
+ if (array.length > (int) arguments[3]) {
+ when(kernel32.GetLastError()).thenReturn(W32Errors.ERROR_INSUFFICIENT_BUFFER).thenReturn(W32Errors.ERROR_SUCCESS);
+ } else {
+ ((Pointer) arguments[4]).write(0, array, 0, array.length);
+ }
+ bufferUsed.setInt(0, array.length);
+ return false;
+ });
eventHandles.add(eventHandle);
}
return eventHandles;
diff --git a/nifi-extension-bundles/nifi-zendesk-bundle/nifi-zendesk-common/src/main/java/org/apache/nifi/common/zendesk/validation/JsonPointerPropertyNameValidator.java b/nifi-extension-bundles/nifi-zendesk-bundle/nifi-zendesk-common/src/main/java/org/apache/nifi/common/zendesk/validation/JsonPointerPropertyNameValidator.java
index 5833408c9d..b8e1398897 100644
--- a/nifi-extension-bundles/nifi-zendesk-bundle/nifi-zendesk-common/src/main/java/org/apache/nifi/common/zendesk/validation/JsonPointerPropertyNameValidator.java
+++ b/nifi-extension-bundles/nifi-zendesk-bundle/nifi-zendesk-common/src/main/java/org/apache/nifi/common/zendesk/validation/JsonPointerPropertyNameValidator.java
@@ -24,23 +24,23 @@ import org.apache.nifi.record.path.exception.RecordPathException;
public class JsonPointerPropertyNameValidator implements Validator {
- @Override
- public ValidationResult validate(final String subject, final String input, final ValidationContext context) {
- try {
- JsonPointer.compile(subject);
- return new ValidationResult.Builder()
- .input(input)
- .subject(subject)
- .valid(true)
- .explanation("Valid JsonPointer")
- .build();
- } catch (final RecordPathException e) {
- return new ValidationResult.Builder()
- .input(input)
- .subject(subject)
- .valid(false)
- .explanation("Property Name is not a valid JsonPointer value: " + e.getMessage())
- .build();
- }
+ @Override
+ public ValidationResult validate(final String subject, final String input, final ValidationContext context) {
+ try {
+ JsonPointer.compile(subject);
+ return new ValidationResult.Builder()
+ .input(input)
+ .subject(subject)
+ .valid(true)
+ .explanation("Valid JsonPointer")
+ .build();
+ } catch (final RecordPathException e) {
+ return new ValidationResult.Builder()
+ .input(input)
+ .subject(subject)
+ .valid(false)
+ .explanation("Property Name is not a valid JsonPointer value: " + e.getMessage())
+ .build();
}
+ }
}
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-zookeeper-bundle/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-zookeeper-bundle/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java
index 3b4da9b830..9dfdbbe57a 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-zookeeper-bundle/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-framework-zookeeper-bundle/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java
@@ -278,8 +278,8 @@ public class ZooKeeperClientConfig {
if (PORT_PATTERN.matcher(pairSplits[1]).matches()) {
cleanedEntries.add(pairSplits[0] + ":" + pairSplits[1]);
} else {
- throw new IllegalStateException("The port specified in this pair must be 1 to 5 digits only but was '" +
- pair + "' in nifi.properties " + NiFiProperties.ZOOKEEPER_CONNECT_STRING + "' property");
+ throw new IllegalStateException("The port specified in this pair must be 1 to 5 digits only but was '" +
+ pair + "' in nifi.properties " + NiFiProperties.ZOOKEEPER_CONNECT_STRING + "' property");
}
}
}
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/test/java/org/apache/nifi/ldap/tenants/LdapUserGroupProviderTest.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/test/java/org/apache/nifi/ldap/tenants/LdapUserGroupProviderTest.java
index d05e3763c4..27aedee5ed 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/test/java/org/apache/nifi/ldap/tenants/LdapUserGroupProviderTest.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/test/java/org/apache/nifi/ldap/tenants/LdapUserGroupProviderTest.java
@@ -298,7 +298,8 @@ public class LdapUserGroupProviderTest {
final Set<Group> groups = ldapUserGroupProvider.getGroups();
assertEquals(5, groups.size());
- assertEquals(1, groups.stream().filter(group -> "cn=admins,ou=groups,o=nifi".equals(group.getName())).count());
+ assertEquals(1, groups.stream().filter(group -> "cn=admins,ou=groups,o=nifi".equals(group.getName()))
+ .count());
}
@Test
@@ -365,7 +366,8 @@ public class LdapUserGroupProviderTest {
assertFalse(admins.getUsers().isEmpty());
assertEquals(1, admins.getUsers().stream().map(
userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "cn=User 1,ou=users,o=nifi".equals(user.getIdentity())).count());
+ user -> "cn=User 1,ou=users,o=nifi".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -381,9 +383,10 @@ public class LdapUserGroupProviderTest {
final Group admins = groups.stream().filter(group -> "cn=admins,ou=groups,o=nifi".equals(group.getName())).findFirst().orElse(null);
assertNotNull(admins);
assertFalse(admins.getUsers().isEmpty());
- assertEquals(1, admins.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity())).count());
+ assertEquals(1, admins.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -400,9 +403,10 @@ public class LdapUserGroupProviderTest {
final Group admins = groups.stream().filter(group -> "admins".equals(group.getName())).findFirst().orElse(null);
assertNotNull(admins);
assertFalse(admins.getUsers().isEmpty());
- assertEquals(1, admins.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "User 1".equals(user.getIdentity())).count());
+ assertEquals(1, admins.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "User 1".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -414,7 +418,8 @@ public class LdapUserGroupProviderTest {
final Set<Group> groups = ldapUserGroupProvider.getGroups();
assertEquals(1, groups.size());
- assertEquals(1, groups.stream().filter(group -> "cn=admins,ou=groups,o=nifi".equals(group.getName())).count());
+ assertEquals(1, groups.stream().filter(group -> "cn=admins,ou=groups,o=nifi".equals(group.getName()))
+ .count());
}
@Test
@@ -445,16 +450,18 @@ public class LdapUserGroupProviderTest {
final Group team1 = groups.stream().filter(group -> "team1".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team1);
assertEquals(2, team1.getUsers().size());
- assertEquals(2, team1.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity())).count());
+ assertEquals(2, team1.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity()))
+ .count());
final Group team2 = groups.stream().filter(group -> "team2".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team2);
assertEquals(2, team2.getUsers().size());
- assertEquals(2, team2.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity())).count());
+ assertEquals(2, team2.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -473,30 +480,34 @@ public class LdapUserGroupProviderTest {
final Group admins = groups.stream().filter(group -> "admins".equals(group.getName())).findFirst().orElse(null);
assertNotNull(admins);
assertEquals(2, admins.getUsers().size());
- assertEquals(2, admins.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity()) || "user3".equals(user.getIdentity())).count());
+ assertEquals(2, admins.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()) || "user3".equals(user.getIdentity()))
+ .count());
final Group readOnly = groups.stream().filter(group -> "read-only".equals(group.getName())).findFirst().orElse(null);
assertNotNull(readOnly);
assertEquals(1, readOnly.getUsers().size());
- assertEquals(1, readOnly.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user2".equals(user.getIdentity())).count());
+ assertEquals(1, readOnly.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user2".equals(user.getIdentity()))
+ .count());
final Group team1 = groups.stream().filter(group -> "team1".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team1);
assertEquals(1, team1.getUsers().size());
- assertEquals(1, team1.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity())).count());
+ assertEquals(1, team1.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()))
+ .count());
final Group team2 = groups.stream().filter(group -> "team2".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team2);
assertEquals(1, team2.getUsers().size());
- assertEquals(1, team2.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity())).count());
+ assertEquals(1, team2.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -516,30 +527,34 @@ public class LdapUserGroupProviderTest {
final Group admins = groups.stream().filter(group -> "admins".equals(group.getName())).findFirst().orElse(null);
assertNotNull(admins);
assertEquals(2, admins.getUsers().size());
- assertEquals(2, admins.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity()) || "user3".equals(user.getIdentity())).count());
+ assertEquals(2, admins.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()) || "user3".equals(user.getIdentity()))
+ .count());
final Group readOnly = groups.stream().filter(group -> "read-only".equals(group.getName())).findFirst().orElse(null);
assertNotNull(readOnly);
assertEquals(1, readOnly.getUsers().size());
- assertEquals(1, readOnly.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user2".equals(user.getIdentity())).count());
+ assertEquals(1, readOnly.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user2".equals(user.getIdentity()))
+ .count());
final Group team1 = groups.stream().filter(group -> "team1".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team1);
assertEquals(3, team1.getUsers().size());
- assertEquals(3, team1.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity()) || "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity())).count());
+ assertEquals(3, team1.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()) || "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity()))
+ .count());
final Group team2 = groups.stream().filter(group -> "team2".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team2);
assertEquals(3, team2.getUsers().size());
- assertEquals(3, team2.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity()) || "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity())).count());
+ assertEquals(3, team2.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()) || "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -643,9 +658,10 @@ public class LdapUserGroupProviderTest {
final Group team3 = groups.stream().filter(group -> "team3".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team3);
assertEquals(1, team3.getUsers().size());
- assertEquals(1, team3.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user9".equals(user.getIdentity())).count());
+ assertEquals(1, team3.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user9".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -689,9 +705,10 @@ public class LdapUserGroupProviderTest {
final Group team3 = groups.stream().filter(group -> "team3".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team3);
assertEquals(1, team3.getUsers().size());
- assertEquals(1, team3.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "User9".equals(user.getIdentity())).count());
+ assertEquals(1, team3.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "User9".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -711,12 +728,14 @@ public class LdapUserGroupProviderTest {
final Group team4 = groups.stream().filter(group -> "team4".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team4);
assertEquals(2, team4.getUsers().size());
- assertEquals(1, team4.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity())).count());
- assertEquals(1, team4.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user2".equals(user.getIdentity())).count());
+ assertEquals(1, team4.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()))
+ .count());
+ assertEquals(1, team4.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user2".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -735,9 +754,10 @@ public class LdapUserGroupProviderTest {
final Group team4 = groups.stream().filter(group -> "team4".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team4);
assertEquals(1, team4.getUsers().size());
- assertEquals(1, team4.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user1".equals(user.getIdentity())).count());
+ assertEquals(1, team4.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user1".equals(user.getIdentity()))
+ .count());
}
@Test
@@ -757,16 +777,18 @@ public class LdapUserGroupProviderTest {
final Group team1 = groups.stream().filter(group -> "team1".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team1);
assertEquals(2, team1.getUsers().size());
- assertEquals(2, team1.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity())).count());
+ assertEquals(2, team1.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user4".equals(user.getIdentity()) || "user5".equals(user.getIdentity()))
+ .count());
final Group team2 = groups.stream().filter(group -> "team2".equals(group.getName())).findFirst().orElse(null);
assertNotNull(team2);
assertEquals(3, team2.getUsers().size());
- assertEquals(3, team2.getUsers().stream().map(
- userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier)).filter(
- user -> "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity()) || "user8".equals(user.getIdentity())).count());
+ assertEquals(3, team2.getUsers().stream()
+ .map(userIdentifier -> ldapUserGroupProvider.getUser(userIdentifier))
+ .filter(user -> "user6".equals(user.getIdentity()) || "user7".equals(user.getIdentity()) || "user8".equals(user.getIdentity()))
+ .count());
}
private AuthorizerConfigurationContext getBaseConfiguration(final String userSearchBase, final String groupSearchBase) {
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/WriteAheadProvenanceRepository.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/WriteAheadProvenanceRepository.java
index 9b5afc7243..51bcdd3de0 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/WriteAheadProvenanceRepository.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/WriteAheadProvenanceRepository.java
@@ -136,7 +136,7 @@ public class WriteAheadProvenanceRepository implements ProvenanceRepository {
}
};
- init(recordWriterFactory, recordReaderFactory, eventReporter, authorizer, resourceFactory, fileManager);
+ init(recordWriterFactory, recordReaderFactory, eventReporter, authorizer, resourceFactory, fileManager);
}
protected synchronized void init(RecordWriterFactory recordWriterFactory, RecordReaderFactory recordReaderFactory,
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
index 24c5a633e3..e741033275 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java
@@ -128,7 +128,7 @@ public class QueryTask implements Runnable {
final TopDocs topDocs;
final StoredFields storedFields;
try {
- storedFields = indexReader.storedFields();
+ storedFields = indexReader.storedFields();
// Sort based on document id, descending. This gives us most recent events first.
final Sort sort = new Sort(new SortField(null, SortField.Type.DOC, true));
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecord.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecord.java
index 5a6aecf74c..615604e72d 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecord.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/schema/LookupTableEventRecord.java
@@ -188,7 +188,7 @@ public class LookupTableEventRecord implements Record {
case EventFieldNames.COMPONENT_ID -> createLookupValue(event.getComponentId(), componentIdMap);
case EventFieldNames.COMPONENT_TYPE -> createLookupValue(event.getComponentType(), componentTypeMap);
case EventFieldNames.CONTENT_CLAIM ->
- createExplicitSameOrNoneValue(contentClaimRecord, previousClaimRecord, () -> contentClaimRecord);
+ createExplicitSameOrNoneValue(contentClaimRecord, previousClaimRecord, () -> contentClaimRecord);
case EventFieldNames.EVENT_DETAILS -> event.getDetails();
case EventFieldNames.EVENT_DURATION -> (int) event.getEventDuration();
case EventFieldNames.EVENT_TIME -> (int) (event.getEventTime() - startTimeOffset);
@@ -200,7 +200,7 @@ public class LookupTableEventRecord implements Record {
case EventFieldNames.PREVIOUS_CONTENT_CLAIM -> previousClaimRecord;
case EventFieldNames.RELATIONSHIP -> event.getRelationship();
case EventFieldNames.SOURCE_QUEUE_IDENTIFIER ->
- createLookupValue(event.getSourceQueueIdentifier(), queueIdMap);
+ createLookupValue(event.getSourceQueueIdentifier(), queueIdMap);
case EventFieldNames.SOURCE_SYSTEM_FLOWFILE_IDENTIFIER -> event.getSourceSystemFlowFileIdentifier();
case EventFieldNames.TRANSIT_URI -> event.getTransitUri();
case EventFieldNames.UPDATED_ATTRIBUTES -> event.getUpdatedAttributes();
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java
index e4e0950ff8..5f0acb1042 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java
@@ -81,7 +81,7 @@ public abstract class PartitionedEventStore implements EventStore {
for (final EventStorePartition partition : getPartitions()) {
try {
- partition.close();
+ partition.close();
} catch (final IOException ioe) {
if (thrown == null) {
thrown = ioe;
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/AbstractTestRecordReaderWriter.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/AbstractTestRecordReaderWriter.java
index 2b38c27544..cefa88703e 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/AbstractTestRecordReaderWriter.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/AbstractTestRecordReaderWriter.java
@@ -63,7 +63,7 @@ public abstract class AbstractTestRecordReaderWriter {
final TocReader tocReader = new StandardTocReader(tocFile);
final String expectedTransitUri = "nifi://unit-test";
- final int expectedBlockIndex = 0;
+ final int expectedBlockIndex = 0;
assertRecoveredRecord(journalFile, tocReader, expectedTransitUri, expectedBlockIndex);
@@ -120,7 +120,7 @@ public abstract class AbstractTestRecordReaderWriter {
final TocReader tocReader = new StandardTocReader(tocFile);
try (final FileInputStream fis = new FileInputStream(journalFile);
- final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
+ final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
for (int i = 0; i < 10; i++) {
assertEquals(0, reader.getBlockIndex());
@@ -159,7 +159,7 @@ public abstract class AbstractTestRecordReaderWriter {
final TocReader tocReader = new StandardTocReader(tocFile);
try (final FileInputStream fis = new FileInputStream(journalFile);
- final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
+ final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
for (int i = 0; i < 10; i++) {
final StandardProvenanceEventRecord recovered = reader.nextRecord();
assertNotNull(recovered);
@@ -200,7 +200,7 @@ public abstract class AbstractTestRecordReaderWriter {
final TocReader tocReader = new StandardTocReader(tocFile);
try (final FileInputStream fis = new FileInputStream(journalFile);
- final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
+ final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
for (int i = 0; i < numEvents; i++) {
final Optional<ProvenanceEventRecord> eventOption = reader.skipToEvent(i);
@@ -216,7 +216,7 @@ public abstract class AbstractTestRecordReaderWriter {
}
try (final FileInputStream fis = new FileInputStream(journalFile);
- final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
+ final RecordReader reader = createReader(fis, journalFile.getName(), tocReader, 2048)) {
for (int i = 0; i < 3; i++) {
final Optional<ProvenanceEventRecord> eventOption = reader.skipToEvent(8);
diff --git a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/index/lucene/TestLuceneEventIndex.java b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/index/lucene/TestLuceneEventIndex.java
index 39f331f736..e902caf2db 100644
--- a/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/index/lucene/TestLuceneEventIndex.java
+++ b/nifi-framework-bundle/nifi-framework-extensions/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/index/lucene/TestLuceneEventIndex.java
@@ -454,7 +454,7 @@ public class TestLuceneEventIndex {
index.addEvent(event1, new StorageSummary(event1.getEventId(), "1.prov", "1", 1, 2L, 2L));
index.addEvent(event2, new StorageSummary(event2.getEventId(), "1.prov", "1", 1, 2L, 2L));
- // Create a query that searches for the event with the FlowFile UUID that is NOT equal to the first event's
+ // Create a query that searches for the event with the FlowFile UUID that is NOT equal to the first event's
final Query query = new Query(UUID.randomUUID().toString());
query.addSearchTerm(SearchTerms.newSearchTerm(SearchableFields.FlowFileUUID, event1.getFlowFileUuid(), Boolean.TRUE));
diff --git a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java
index 78a3c93006..2065e8600e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ProcessGroupStatusSnapshotDTO.java
@@ -619,7 +619,7 @@ public class ProcessGroupStatusSnapshotDTO implements Cloneable {
if (portStatusSnapshots != null) {
final List<PortStatusSnapshotEntity> portStatusSnapshotEntities = new ArrayList<>();
for (final PortStatusSnapshotEntity portStatusSnapshotEntity : portStatusSnapshots) {
- portStatusSnapshotEntities.add(portStatusSnapshotEntity.clone());
+ portStatusSnapshotEntities.add(portStatusSnapshotEntity.clone());
}
return portStatusSnapshotEntities;
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TransactionResultEntity.java b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TransactionResultEntity.java
index 5dfff41165..d737dcf232 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TransactionResultEntity.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/TransactionResultEntity.java
@@ -43,7 +43,7 @@ public class TransactionResultEntity extends Entity {
this.responseCode = responseCode;
}
- public int getFlowFileSent() {
+ public int getFlowFileSent() {
return flowFileSent;
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTest.java
index 4f08b85f65..0e0ea8ec58 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/CompositeUserGroupProviderTest.java
@@ -147,7 +147,7 @@ public class CompositeUserGroupProviderTest extends CompositeUserGroupProviderTe
assertTrue(exception.getMessage().contains(USER_1_IDENTITY));
exception = assertThrows(IllegalStateException.class, () -> {
- testConflictingUserGroupProvider(userGroupProvider);
+ testConflictingUserGroupProvider(userGroupProvider);
});
assertTrue(exception.getMessage().contains(USER_1_IDENTITY));
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java
index 99c6cd0e36..44cda87dde 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java
@@ -249,7 +249,7 @@ public class SocketProtocolListener extends SocketListener implements ProtocolLi
return switch (message.getType()) {
case CONNECTION_REQUEST ->
- ((ConnectionRequestMessage) message).getConnectionRequest().getProposedNodeIdentifier();
+ ((ConnectionRequestMessage) message).getConnectionRequest().getProposedNodeIdentifier();
case HEARTBEAT -> ((HeartbeatMessage) message).getHeartbeat().getNodeIdentifier();
case OFFLOAD_REQUEST -> ((OffloadMessage) message).getNodeId();
case DISCONNECTION_REQUEST -> ((DisconnectMessage) message).getNodeId();
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowAnalysisRuleEndpointMerger.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowAnalysisRuleEndpointMerger.java
index 1f123fd59b..30a89cba3f 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowAnalysisRuleEndpointMerger.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/FlowAnalysisRuleEndpointMerger.java
@@ -33,9 +33,9 @@ import java.util.regex.Pattern;
public class FlowAnalysisRuleEndpointMerger extends AbstractSingleEntityEndpoint<FlowAnalysisRuleEntity> implements EndpointResponseMerger {
private static final Collection<Endpoint> SUPPORTED_ENDPOINTS = Arrays.asList(
- new Endpoint("/nifi-api/controller/flow-analysis-rules", "POST"),
- new Endpoint(Pattern.compile("/nifi-api/controller/flow-analysis-rules/[a-f0-9\\-]{36}"), "GET", "PUT", "DELETE"),
- new Endpoint(Pattern.compile("/nifi-api/controller/flow-analysis-rules/[a-f0-9\\-]{36}/run-status"), "PUT")
+ new Endpoint("/nifi-api/controller/flow-analysis-rules", "POST"),
+ new Endpoint(Pattern.compile("/nifi-api/controller/flow-analysis-rules/[a-f0-9\\-]{36}"), "GET", "PUT", "DELETE"),
+ new Endpoint(Pattern.compile("/nifi-api/controller/flow-analysis-rules/[a-f0-9\\-]{36}/run-status"), "PUT")
);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
index abeedc57ab..fa33d2ef57 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java
@@ -1131,7 +1131,7 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl
public ProtocolMessage handle(final ProtocolMessage protocolMessage, final Set<String> nodeIdentities) throws ProtocolException {
return switch (protocolMessage.getType()) {
case CONNECTION_REQUEST ->
- handleConnectionRequest((ConnectionRequestMessage) protocolMessage, nodeIdentities);
+ handleConnectionRequest((ConnectionRequestMessage) protocolMessage, nodeIdentities);
case NODE_STATUS_CHANGE -> {
handleNodeStatusChange((NodeStatusChangeMessage) protocolMessage);
yield null;
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/manager/PropertyDescriptorDtoMergerTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/manager/PropertyDescriptorDtoMergerTest.java
index 264cecdcdb..18405a0525 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/manager/PropertyDescriptorDtoMergerTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/manager/PropertyDescriptorDtoMergerTest.java
@@ -79,7 +79,7 @@ public class PropertyDescriptorDtoMergerTest {
void testMergeWithOverlappingAllowableValues() {
testMerge(
createPropertyDescriptorDTO(v("value1"), v("value2"), v("value3")),
- Map.of(createNodeIdentifier("node1"), createPropertyDescriptorDTO(v("value1"), v("value2"), v("value3")),
+ Map.of(createNodeIdentifier("node1"), createPropertyDescriptorDTO(v("value1"), v("value2"), v("value3")),
createNodeIdentifier("node2"), createPropertyDescriptorDTO(v("value2"), v("value3", false))),
createPropertyDescriptorDTO(v("value2"), v("value3", false))
);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
index 4d0860bd9a..f5b2ec39c6 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
@@ -1770,7 +1770,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
return;
}
- monitorAsyncTask(taskFuture, monitoringFuture, completionTimestampRef.get());
+ monitorAsyncTask(taskFuture, monitoringFuture, completionTimestampRef.get());
};
final Future<?> future = taskScheduler.scheduleWithFixedDelay(monitoringTask, 1, 10, TimeUnit.MILLISECONDS);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
index cf07875660..ee2a47a6c7 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/parameter/StandardParameterProviderNode.java
@@ -494,9 +494,9 @@ public class StandardParameterProviderNode extends AbstractComponentNode impleme
final Map<ParameterDescriptor, Parameter> currentParameters = parameterContext.getParameters();
// Find parameters that were removed
currentParameters.keySet().forEach(descriptor -> {
- if (!fetchedParameterMap.containsKey(descriptor)) {
- parameterUpdateMap.put(descriptor.getName(), null);
- }
+ if (!fetchedParameterMap.containsKey(descriptor)) {
+ parameterUpdateMap.put(descriptor.getName(), null);
+ }
});
// Add all changed and new parameters
for (final Map.Entry<ParameterDescriptor, Parameter> entry : fetchedParameterMap.entrySet()) {
@@ -569,38 +569,38 @@ public class StandardParameterProviderNode extends AbstractComponentNode impleme
.collect(Collectors.toMap(context -> context.getParameterProviderConfiguration().getParameterGroupName(), Function.identity()));
final Collection<ParameterGroupConfiguration> parameterGroupConfigurations = new ArrayList<>();
fetchedParameterGroups.forEach(parameterGroup -> {
- final ParameterContext parameterContext = parameterContextMap.get(parameterGroup.getGroupName());
- final Set<String> fetchedParameterNames = parameterGroup.getParameters().stream()
- .map(parameter -> parameter.getDescriptor().getName())
- .collect(Collectors.toSet());
- final Map<String, ParameterSensitivity> parameterSensitivities = new HashMap<>();
- final ParameterGroupConfiguration groupConfiguration;
- final String parameterContextName;
- final Boolean isSynchronized;
- if (parameterContext != null) {
- isSynchronized = parameterContext.getParameterProviderConfiguration().isSynchronized();
- parameterContextName = parameterContext.getName();
- parameterContext.getParameters().forEach((descriptor, parameter) -> {
- // Don't add it at all if it was not fetched
- if (fetchedParameterNames.contains(descriptor.getName())) {
- final ParameterSensitivity sensitivity = descriptor.isSensitive() ? ParameterSensitivity.SENSITIVE : ParameterSensitivity.NON_SENSITIVE;
- parameterSensitivities.put(descriptor.getName(), sensitivity);
- }
- });
- } else {
- parameterContextName = parameterGroup.getGroupName();
- isSynchronized = null;
- }
- parameterGroup.getParameters().forEach(parameter -> {
- final String parameterName = parameter.getDescriptor().getName();
- if (!parameterSensitivities.containsKey(parameterName)) {
- // Null means not configured yet.
- parameterSensitivities.put(parameterName, null);
+ final ParameterContext parameterContext = parameterContextMap.get(parameterGroup.getGroupName());
+ final Set<String> fetchedParameterNames = parameterGroup.getParameters().stream()
+ .map(parameter -> parameter.getDescriptor().getName())
+ .collect(Collectors.toSet());
+ final Map<String, ParameterSensitivity> parameterSensitivities = new HashMap<>();
+ final ParameterGroupConfiguration groupConfiguration;
+ final String parameterContextName;
+ final Boolean isSynchronized;
+ if (parameterContext != null) {
+ isSynchronized = parameterContext.getParameterProviderConfiguration().isSynchronized();
+ parameterContextName = parameterContext.getName();
+ parameterContext.getParameters().forEach((descriptor, parameter) -> {
+ // Don't add it at all if it was not fetched
+ if (fetchedParameterNames.contains(descriptor.getName())) {
+ final ParameterSensitivity sensitivity = descriptor.isSensitive() ? ParameterSensitivity.SENSITIVE : ParameterSensitivity.NON_SENSITIVE;
+ parameterSensitivities.put(descriptor.getName(), sensitivity);
}
});
+ } else {
+ parameterContextName = parameterGroup.getGroupName();
+ isSynchronized = null;
+ }
+ parameterGroup.getParameters().forEach(parameter -> {
+ final String parameterName = parameter.getDescriptor().getName();
+ if (!parameterSensitivities.containsKey(parameterName)) {
+ // Null means not configured yet.
+ parameterSensitivities.put(parameterName, null);
+ }
+ });
- groupConfiguration = new ParameterGroupConfiguration(parameterGroup.getGroupName(), parameterContextName, parameterSensitivities, isSynchronized);
- parameterGroupConfigurations.add(groupConfiguration);
+ groupConfiguration = new ParameterGroupConfiguration(parameterGroup.getGroupName(), parameterContextName, parameterSensitivities, isSynchronized);
+ parameterGroupConfigurations.add(groupConfiguration);
});
return parameterGroupConfigurations;
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
index 5d81e96ba4..11fa60cf2b 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceNode.java
@@ -580,7 +580,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
case ENABLING ->
// If enabling and currently not valid, then we must trigger validation to occur. This allows the #enable method
// to continue running in the background and complete enabling when the service becomes valid.
- getValidationStatus() != ValidationStatus.VALID;
+ getValidationStatus() != ValidationStatus.VALID;
default -> false;
};
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/mapping/NiFiRegistryFlowMapper.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/mapping/NiFiRegistryFlowMapper.java
index d4818e6bbc..c400d03caf 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/mapping/NiFiRegistryFlowMapper.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/mapping/NiFiRegistryFlowMapper.java
@@ -138,13 +138,13 @@ public class NiFiRegistryFlowMapper {
}
/**
- * Map the given process group to a versioned process group without any use of an actual flow registry even if the
- * group is currently versioned in a registry.
- *
- * @param group the process group to map
- * @param serviceProvider the controller service provider to use for mapping
- * @return a complete versioned process group without any registry related details
- */
+ * Map the given process group to a versioned process group without any use of an actual flow registry even if the
+ * group is currently versioned in a registry.
+ *
+ * @param group the process group to map
+ * @param serviceProvider the controller service provider to use for mapping
+ * @return a complete versioned process group without any registry related details
+ */
public InstantiatedVersionedProcessGroup mapNonVersionedProcessGroup(final ProcessGroup group, final ControllerServiceProvider serviceProvider) {
versionedComponentIds.clear();
@@ -153,17 +153,17 @@ public class NiFiRegistryFlowMapper {
}
/**
- * Map the given process group to a versioned process group using the provided registry client.
- *
- * @param group the process group to map
- * @param serviceProvider the controller service provider to use for mapping
- * @param flowManager the registry client to use when retrieving versioning details
- * @param mapDescendantVersionedFlows true in order to include descendant flows in the mapped result
- * @return a complete versioned process group with applicable registry related details
- */
+ * Map the given process group to a versioned process group using the provided registry client.
+ *
+ * @param group the process group to map
+ * @param serviceProvider the controller service provider to use for mapping
+ * @param flowManager the registry client to use when retrieving versioning details
+ * @param mapDescendantVersionedFlows true in order to include descendant flows in the mapped result
+ * @return a complete versioned process group with applicable registry related details
+ */
public InstantiatedVersionedProcessGroup mapProcessGroup(final ProcessGroup group, final ControllerServiceProvider serviceProvider,
- final FlowManager flowManager,
- final boolean mapDescendantVersionedFlows) {
+ final FlowManager flowManager,
+ final boolean mapDescendantVersionedFlows) {
versionedComponentIds.clear();
// apply registry versioning according to the lambda below
@@ -318,12 +318,12 @@ public class NiFiRegistryFlowMapper {
}
/**
- * Generate a versioned component identifier based on the given component identifier. The result for a given
- * component identifier is deterministic.
- *
- * @param componentId the component identifier to generate a versioned component identifier for
- * @return a deterministic versioned component identifier
- */
+ * Generate a versioned component identifier based on the given component identifier. The result for a given
+ * component identifier is deterministic.
+ *
+ * @param componentId the component identifier to generate a versioned component identifier for
+ * @return a deterministic versioned component identifier
+ */
public static String generateVersionedComponentId(final String componentId) {
return UUID.nameUUIDFromBytes(componentId.getBytes(StandardCharsets.UTF_8)).toString();
}
@@ -894,7 +894,7 @@ public class NiFiRegistryFlowMapper {
}
private void mapParameterContext(final ParameterContext parameterContext, final Map<String, VersionedParameterContext> parameterContexts,
- final Map<String, ParameterProviderReference> parameterProviderReferences) {
+ final Map<String, ParameterProviderReference> parameterProviderReferences) {
if (parameterContexts.containsKey(parameterContext.getName())) {
return;
}
@@ -1017,8 +1017,8 @@ public class NiFiRegistryFlowMapper {
}
private org.apache.nifi.flow.ScheduledState mapScheduledState(final ScheduledState scheduledState) {
- return scheduledState == ScheduledState.DISABLED
- ? org.apache.nifi.flow.ScheduledState.DISABLED
- : org.apache.nifi.flow.ScheduledState.ENABLED;
+ return scheduledState == ScheduledState.DISABLED
+ ? org.apache.nifi.flow.ScheduledState.DISABLED
+ : org.apache.nifi.flow.ScheduledState.ENABLED;
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
index 5f8da2e20e..318aa1e1e6 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java
@@ -301,9 +301,9 @@ public class FlowDifferenceFilters {
case RETRIED_RELATIONSHIPS_CHANGED -> processorNode.getRetriedRelationships().isEmpty();
case RETRY_COUNT_CHANGED -> processorNode.getRetryCount() == ProcessorNode.DEFAULT_RETRY_COUNT;
case MAX_BACKOFF_PERIOD_CHANGED ->
- ProcessorNode.DEFAULT_MAX_BACKOFF_PERIOD.equals(processorNode.getMaxBackoffPeriod());
+ ProcessorNode.DEFAULT_MAX_BACKOFF_PERIOD.equals(processorNode.getMaxBackoffPeriod());
case BACKOFF_MECHANISM_CHANGED ->
- ProcessorNode.DEFAULT_BACKOFF_MECHANISM == processorNode.getBackoffMechanism();
+ ProcessorNode.DEFAULT_BACKOFF_MECHANISM == processorNode.getBackoffMechanism();
default -> false;
};
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
index a1d2ee31b1..f32cbaaebc 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/service/ControllerServiceNode.java
@@ -99,7 +99,7 @@ public interface ControllerServiceNode extends ComponentNode, VersionedComponent
*/
ControllerServiceState getState();
- /**
+ /**
* Enables this service, calling any method annotated with @OnEnabled and updating the state of the service
*
* @param scheduler implementation of {@link ScheduledExecutorService} used to initiate service enabling task as well as its retries
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
index 5cd1729ef5..8e2f679d4e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java
@@ -96,852 +96,852 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
public class ExtensionBuilder {
- private static final Logger logger = LoggerFactory.getLogger(ExtensionBuilder.class);
-
- private String type;
- private String identifier;
- private BundleCoordinate bundleCoordinate;
- private ExtensionManager extensionManager;
- private Set<URL> classpathUrls;
- private KerberosConfig kerberosConfig = KerberosConfig.NOT_CONFIGURED;
- private ControllerServiceProvider serviceProvider;
- private NodeTypeProvider nodeTypeProvider;
- private ProcessScheduler processScheduler;
- private ValidationTrigger validationTrigger;
- private ReloadComponent reloadComponent;
- private FlowController flowController;
- private StateManagerProvider stateManagerProvider;
- private RuleViolationsManager ruleViolationsManager;
- private FlowAnalyzer flowAnalyzer;
- private boolean flowAnalysisAtRegistryCommit;
- private String classloaderIsolationKey;
- private SSLContext systemSslContext;
- private PythonBridge pythonBridge;
-
- public ExtensionBuilder type(final String type) {
- this.type = type;
- return this;
- }
-
- public ExtensionBuilder identifier(final String identifier) {
- this.identifier = identifier;
- return this;
- }
-
- public ExtensionBuilder bundleCoordinate(final BundleCoordinate coordinate) {
- this.bundleCoordinate = coordinate;
- return this;
- }
-
- public ExtensionBuilder addClasspathUrls(final Set<URL> urls) {
- if (urls == null || urls.isEmpty()) {
- return this;
- }
-
- if (this.classpathUrls == null) {
- this.classpathUrls = new HashSet<>();
- }
-
- this.classpathUrls.addAll(urls);
- return this;
- }
-
- public ExtensionBuilder kerberosConfig(final KerberosConfig kerberosConfig) {
- this.kerberosConfig = kerberosConfig;
- return this;
- }
-
- public ExtensionBuilder controllerServiceProvider(final ControllerServiceProvider serviceProvider) {
- this.serviceProvider = serviceProvider;
- return this;
- }
-
- public ExtensionBuilder nodeTypeProvider(final NodeTypeProvider nodeTypeProvider) {
- this.nodeTypeProvider = nodeTypeProvider;
- return this;
- }
-
- public ExtensionBuilder processScheduler(final ProcessScheduler scheduler) {
- this.processScheduler = scheduler;
- return this;
- }
-
- public ExtensionBuilder validationTrigger(final ValidationTrigger validationTrigger) {
- this.validationTrigger = validationTrigger;
- return this;
- }
-
- public ExtensionBuilder reloadComponent(final ReloadComponent reloadComponent) {
- this.reloadComponent = reloadComponent;
- return this;
- }
-
- public ExtensionBuilder flowController(final FlowController flowController) {
- this.flowController = flowController;
- return this;
- }
-
- public ExtensionBuilder flowAnalysisAtRegistryCommit(final boolean flowAnalysisAtRegistryCommit) {
- this.flowAnalysisAtRegistryCommit = flowAnalysisAtRegistryCommit;
- return this;
- }
-
- public ExtensionBuilder stateManagerProvider(final StateManagerProvider stateManagerProvider) {
- this.stateManagerProvider = stateManagerProvider;
- return this;
- }
-
- public ExtensionBuilder ruleViolationsManager(RuleViolationsManager ruleViolationsManager) {
- this.ruleViolationsManager = ruleViolationsManager;
- return this;
- }
-
- public ExtensionBuilder flowAnalyzer(FlowAnalyzer flowAnalyzer) {
- this.flowAnalyzer = flowAnalyzer;
- return this;
- }
-
- public ExtensionBuilder extensionManager(final ExtensionManager extensionManager) {
- this.extensionManager = extensionManager;
- return this;
- }
-
- public ExtensionBuilder classloaderIsolationKey(final String classloaderIsolationKey) {
- this.classloaderIsolationKey = classloaderIsolationKey;
- return this;
- }
-
- public ExtensionBuilder systemSslContext(final SSLContext systemSslContext) {
- this.systemSslContext = systemSslContext;
- return this;
- }
-
- public ExtensionBuilder pythonBridge(final PythonBridge pythonBridge) {
- this.pythonBridge = pythonBridge;
- return this;
- }
-
- public ProcessorNode buildProcessor() {
- if (identifier == null) {
- throw new IllegalStateException("Processor ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("Processor Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
-
- boolean creationSuccessful = true;
- final StandardLoggingContext loggingContext = new StandardLoggingContext();
- LoggableComponent<Processor> loggableComponent;
- try {
- loggableComponent = createLoggableProcessor(loggingContext);
- } catch (final ProcessorInstantiationException pie) {
- logger.error("Could not create Processor of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, pie.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(pie.getMessage(), pie);
- }
- final GhostProcessor ghostProc = new GhostProcessor();
- ghostProc.setIdentifier(identifier);
- ghostProc.setCanonicalClassName(type);
- loggableComponent = new LoggableComponent<>(ghostProc, bundleCoordinate, null);
- creationSuccessful = false;
- }
-
- final String componentType;
- if (PythonBundle.isPythonCoordinate(bundleCoordinate)) {
- componentType = type;
- } else if (creationSuccessful) {
- componentType = loggableComponent.getComponent().getClass().getSimpleName();
- } else {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- componentType = "(Missing) " + simpleClassName;
- }
-
- final ProcessorNode processorNode = createProcessorNode(loggableComponent, componentType, !creationSuccessful);
- loggingContext.setComponent(processorNode);
- return processorNode;
- }
-
- public FlowRegistryClientNode buildFlowRegistryClient() {
- if (identifier == null) {
- throw new IllegalStateException("ReportingTask ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("ReportingTask Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
- if (flowController == null) {
- throw new IllegalStateException("FlowController must be specified");
- }
-
- boolean creationSuccessful = true;
- LoggableComponent<FlowRegistryClient> loggableComponent;
- try {
- loggableComponent = createLoggableFlowRegistryClient();
- } catch (final FlowRepositoryClientInstantiationException e) {
- logger.error("Could not create Flow Registry Component of type {} from {} for ID {} due to {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, e.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(e.getMessage(), e);
- }
- final GhostFlowRegistryClient ghostFlowRegistryClient = new GhostFlowRegistryClient(identifier, type);
- loggableComponent = new LoggableComponent<>(ghostFlowRegistryClient, bundleCoordinate, null);
- creationSuccessful = false;
- }
-
- final FlowRegistryClientNode clientNode = createFlowRegistryClientNode(loggableComponent, creationSuccessful);
- return clientNode;
- }
-
- public ReportingTaskNode buildReportingTask() {
- if (identifier == null) {
- throw new IllegalStateException("ReportingTask ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("ReportingTask Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
- if (flowController == null) {
- throw new IllegalStateException("FlowController must be specified");
- }
-
- boolean creationSuccessful = true;
- LoggableComponent<ReportingTask> loggableComponent;
- try {
- loggableComponent = createLoggableReportingTask();
- } catch (final ReportingTaskInstantiationException rtie) {
- logger.error("Could not create ReportingTask of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(rtie.getMessage(), rtie);
- }
- final GhostReportingTask ghostReportingTask = new GhostReportingTask();
- ghostReportingTask.setIdentifier(identifier);
- ghostReportingTask.setCanonicalClassName(type);
- loggableComponent = new LoggableComponent<>(ghostReportingTask, bundleCoordinate, null);
- creationSuccessful = false;
- }
-
- final ReportingTaskNode taskNode = createReportingTaskNode(loggableComponent, creationSuccessful);
- return taskNode;
- }
-
- public ParameterProviderNode buildParameterProvider() {
- if (identifier == null) {
- throw new IllegalStateException("ParameterProvider ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("ParameterProvider Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
- if (flowController == null) {
- throw new IllegalStateException("FlowController must be specified");
- }
-
- boolean creationSuccessful = true;
- LoggableComponent<ParameterProvider> loggableComponent;
- try {
- loggableComponent = createLoggableParameterProvider();
- } catch (final ParameterProviderInstantiationException rtie) {
- logger.error("Could not create ParameterProvider of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(rtie.getMessage(), rtie);
- }
- final GhostParameterProvider ghostParameterProvider = new GhostParameterProvider();
- ghostParameterProvider.setIdentifier(identifier);
- ghostParameterProvider.setCanonicalClassName(type);
- loggableComponent = new LoggableComponent<>(ghostParameterProvider, bundleCoordinate, null);
- creationSuccessful = false;
- }
-
- final ParameterProviderNode taskNode = createParameterProviderNode(loggableComponent, creationSuccessful);
- return taskNode;
- }
-
- public ControllerServiceNode buildControllerService() {
- if (identifier == null) {
- throw new IllegalStateException("ReportingTask ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("ReportingTask Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
- if (stateManagerProvider == null) {
- throw new IllegalStateException("State Manager Provider must be specified");
- }
-
- try {
- return createControllerServiceNode();
- } catch (final Throwable t) {
- logger.error("Could not create Controller Service of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, t.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(t.getMessage(), t);
- }
-
- return createGhostControllerServiceNode();
- }
- }
-
- public FlowAnalysisRuleNode buildFlowAnalysisRuleNode() {
- if (identifier == null) {
- throw new IllegalStateException("FlowAnalysisRule ID must be specified");
- }
- if (type == null) {
- throw new IllegalStateException("FlowAnalysisRule Type must be specified");
- }
- if (bundleCoordinate == null) {
- throw new IllegalStateException("Bundle Coordinate must be specified");
- }
- if (extensionManager == null) {
- throw new IllegalStateException("Extension Manager must be specified");
- }
- if (serviceProvider == null) {
- throw new IllegalStateException("Controller Service Provider must be specified");
- }
- if (nodeTypeProvider == null) {
- throw new IllegalStateException("Node Type Provider must be specified");
- }
- if (reloadComponent == null) {
- throw new IllegalStateException("Reload Component must be specified");
- }
- if (flowController == null) {
- throw new IllegalStateException("FlowController must be specified");
- }
-
- boolean creationSuccessful = true;
- LoggableComponent<FlowAnalysisRule> loggableComponent;
- try {
- loggableComponent = createLoggableFlowAnalysisRule();
- } catch (final FlowAnalysisRuleInstantiationException rtie) {
- logger.error("Could not create FlowAnalysisRule of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
- if (logger.isDebugEnabled()) {
- logger.error(rtie.getMessage(), rtie);
- }
- final GhostFlowAnalysisRule ghostFlowAnalysisRule = new GhostFlowAnalysisRule();
- ghostFlowAnalysisRule.setIdentifier(identifier);
- ghostFlowAnalysisRule.setCanonicalClassName(type);
- loggableComponent = new LoggableComponent<>(ghostFlowAnalysisRule, bundleCoordinate, null);
- creationSuccessful = false;
- }
-
- final FlowAnalysisRuleNode flowAnalysisRuleNode = createFlowAnalysisRuleNode(loggableComponent, creationSuccessful);
-
- return flowAnalysisRuleNode;
- }
-
-
- private ProcessorNode createProcessorNode(final LoggableComponent<Processor> processor, final String componentType, final boolean extensionMissing) {
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
-
- final ProcessorNode procNode = new StandardProcessorNode(processor, identifier, validationContextFactory, processScheduler, serviceProvider,
- componentType, type, reloadComponent, extensionManager, validationTrigger, extensionMissing);
-
- applyDefaultSettings(procNode);
- applyDefaultRunDuration(procNode);
-
- return procNode;
- }
-
- private ReportingTaskNode createReportingTaskNode(final LoggableComponent<ReportingTask> reportingTask, final boolean creationSuccessful) {
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- final ReportingTaskNode taskNode;
- if (creationSuccessful) {
- stateManagerProvider.getStateManager(identifier, reportingTask.getComponent().getClass());
- taskNode = new StandardReportingTaskNode(reportingTask, identifier, flowController, processScheduler,
- validationContextFactory, reloadComponent, extensionManager, validationTrigger);
- taskNode.setName(taskNode.getReportingTask().getClass().getSimpleName());
- } else {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- final String componentType = "(Missing) " + simpleClassName;
-
- taskNode = new StandardReportingTaskNode(reportingTask, identifier, flowController, processScheduler, validationContextFactory,
- componentType, type, reloadComponent, extensionManager, validationTrigger, true);
- taskNode.setName(componentType);
- }
-
- return taskNode;
- }
-
- private StandardValidationContextFactory createValidationContextFactory(ControllerServiceProvider serviceProvider) {
- return new StandardValidationContextFactory(serviceProvider, ruleViolationsManager, flowAnalyzer);
- }
-
- private ParameterProviderNode createParameterProviderNode(final LoggableComponent<ParameterProvider> parameterProvider, final boolean creationSuccessful) {
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- final ParameterProviderNode parameterProviderNode;
- if (creationSuccessful) {
- stateManagerProvider.getStateManager(identifier, parameterProvider.getComponent().getClass());
- parameterProviderNode = new StandardParameterProviderNode(parameterProvider, identifier, flowController,
- flowController.getControllerServiceProvider(), validationContextFactory, reloadComponent, extensionManager,
- validationTrigger);
- parameterProviderNode.setName(parameterProviderNode.getParameterProvider().getClass().getSimpleName());
- } else {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- final String componentType = "(Missing) " + simpleClassName;
-
- parameterProviderNode = new StandardParameterProviderNode(parameterProvider, identifier, flowController,
- flowController.getControllerServiceProvider(), validationContextFactory, componentType, type, reloadComponent,
- extensionManager, validationTrigger, true);
- parameterProviderNode.setName(componentType);
- }
-
- return parameterProviderNode;
- }
-
- private FlowRegistryClientNode createFlowRegistryClientNode(final LoggableComponent<FlowRegistryClient> client, final boolean creationSuccessful) {
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- final StandardFlowRegistryClientNode clientNode;
-
- if (creationSuccessful) {
- clientNode = new StandardFlowRegistryClientNode(
- flowController,
- flowController.getFlowManager(),
- client,
- identifier,
- validationContextFactory,
- serviceProvider,
- type,
- client.getComponent().getClass().getCanonicalName(),
- reloadComponent,
- extensionManager,
- validationTrigger,
- false
- );
- } else {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- final String componentType = "(Missing) " + simpleClassName;
-
- clientNode = new StandardFlowRegistryClientNode(
- flowController,
- flowController.getFlowManager(),
- client,
- identifier,
- validationContextFactory,
- serviceProvider,
- componentType,
- type,
- reloadComponent,
- extensionManager,
- validationTrigger,
- true);
- }
-
- if (flowAnalysisAtRegistryCommit) {
- return new FlowAnalyzingRegistryClientNode(
- clientNode,
- serviceProvider,
- flowAnalyzer,
- ruleViolationsManager,
- flowController.getFlowManager(),
- FlowAnalysisUtil.createMapper(extensionManager)
- );
- } else {
- return clientNode;
- }
- }
-
- private void applyDefaultSettings(final ProcessorNode processorNode) {
- try {
- final Class<?> procClass = processorNode.getProcessor().getClass();
-
- final DefaultSettings ds = procClass.getAnnotation(DefaultSettings.class);
- if (ds != null) {
- processorNode.setYieldPeriod(ds.yieldDuration());
- processorNode.setPenalizationPeriod(ds.penaltyDuration());
- processorNode.setBulletinLevel(ds.bulletinLevel());
- }
- } catch (final Exception ex) {
- logger.error("Error while setting default settings from DefaultSettings annotation", ex);
- }
- }
-
- private void applyDefaultRunDuration(final ProcessorNode processorNode) {
- try {
- final Class<?> procClass = processorNode.getProcessor().getClass();
-
- final SupportsBatching sb = procClass.getAnnotation(SupportsBatching.class);
- if (sb != null) {
- processorNode.setRunDuration(sb.defaultDuration().getDuration().toMillis(), TimeUnit.MILLISECONDS);
- }
- } catch (final Exception ex) {
- logger.error("Set Default Run Duration failed", ex);
- }
- }
-
- private ControllerServiceNode createControllerServiceNode()
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, InitializationException, NoSuchMethodException, InvocationTargetException {
-
- final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- if (bundle == null) {
- throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
- }
-
- final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls);
- final Class<?> rawClass = Class.forName(type, true, detectedClassLoader);
- Thread.currentThread().setContextClassLoader(detectedClassLoader);
-
- final Class<? extends ControllerService> controllerServiceClass = rawClass.asSubclass(ControllerService.class);
- final ControllerService serviceImpl = controllerServiceClass.getDeclaredConstructor().newInstance();
-
- final StandardControllerServiceInvocationHandler invocationHandler = new StandardControllerServiceInvocationHandler(extensionManager, serviceImpl);
-
- // extract all interfaces... controllerServiceClass is non null so getAllInterfaces is non null
- final List<Class<?>> interfaceList = ClassUtils.getAllInterfaces(controllerServiceClass);
- final Class<?>[] interfaces = interfaceList.toArray(new Class<?>[0]);
-
- final ControllerService proxiedService;
- if (detectedClassLoader == null) {
- proxiedService = (ControllerService) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces, invocationHandler);
- } else {
- proxiedService = (ControllerService) Proxy.newProxyInstance(detectedClassLoader, interfaces, invocationHandler);
- }
-
- logger.info("Created Controller Service of type {} with identifier {}", type, identifier);
- final StandardLoggingContext loggingContext = new StandardLoggingContext();
- final ComponentLog serviceLogger = new SimpleProcessLogger(identifier, serviceImpl, loggingContext);
- final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(serviceLogger);
-
- final StateManager stateManager = stateManagerProvider.getStateManager(identifier, serviceImpl.getClass());
- final ControllerServiceInitializationContext initContext = new StandardControllerServiceInitializationContext(identifier, terminationAwareLogger,
- serviceProvider, stateManager, kerberosConfig, nodeTypeProvider);
- serviceImpl.initialize(initContext);
-
- verifyControllerServiceReferences(serviceImpl, bundle.getClassLoader());
-
- final LoggableComponent<ControllerService> originalLoggableComponent = new LoggableComponent<>(serviceImpl, bundleCoordinate, terminationAwareLogger);
- final LoggableComponent<ControllerService> proxiedLoggableComponent = new LoggableComponent<>(proxiedService, bundleCoordinate, terminationAwareLogger);
-
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- final ControllerServiceNode serviceNode = new StandardControllerServiceNode(originalLoggableComponent, proxiedLoggableComponent, invocationHandler,
- identifier, validationContextFactory, serviceProvider, reloadComponent, extensionManager, validationTrigger);
- serviceNode.setName(rawClass.getSimpleName());
- // Set Controller Service Node in Logging Context to populate Process Group information
- loggingContext.setComponent(serviceNode);
-
- invocationHandler.setServiceNode(serviceNode);
- return serviceNode;
- } finally {
- if (ctxClassLoader != null) {
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- }
- }
- }
-
- private static void verifyControllerServiceReferences(final ConfigurableComponent component, final ClassLoader bundleClassLoader) throws InstantiationException {
- // If a component lives in the same NAR as a Controller Service API, and the component references the Controller Service API (either
- // by itself implementing the API or by having a Property Descriptor that identifies the Controller Service), then the component is not
- // allowed to Require Instance Class Loading. This is done because when a component requires Instance Class Loading, the jars within the
- // NAR and its parents must be copied to a new class loader all the way up to the point of the Controller Service APIs. If the Controller
- // Service API lives in the same NAR as the implementation itself, then we cannot duplicate the NAR ClassLoader. Otherwise, we would have
- // two different NAR ClassLoaders that each define the Service API. And the Service API class must live in the parent ClassLoader for both
- // the referencing component AND the implementing component.
-
- // if the extension does not require instance classloading, there is no concern.
- final boolean requiresInstanceClassLoading = component.getClass().isAnnotationPresent(RequiresInstanceClassLoading.class);
- if (!requiresInstanceClassLoading) {
- logger.debug("Instance ClassLoading is not required for {}", component);
- return;
- }
-
- logger.debug("Component {} requires Instance Class Loading", component);
-
- final Class<?> originalExtensionType = component.getClass();
- final ClassLoader originalExtensionClassLoader = originalExtensionType.getClassLoader();
-
- // Find any Controller Service API's that are bundled in the same NAR.
- final Set<Class<?>> cobundledApis = new HashSet<>();
- try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
- final List<PropertyDescriptor> descriptors = component.getPropertyDescriptors();
- if (descriptors != null && !descriptors.isEmpty()) {
- for (final PropertyDescriptor descriptor : descriptors) {
- final Class<? extends ControllerService> serviceApi = descriptor.getControllerServiceDefinition();
- if (serviceApi != null && bundleClassLoader.equals(serviceApi.getClassLoader())) {
- cobundledApis.add(serviceApi);
- }
- }
- }
- }
-
- logger.debug("Component {} is co-bundled with {} Controller Service APIs based on referenced Controller Services: {}", component, cobundledApis.size(), cobundledApis);
-
- // If the component is a Controller Service, it should also not extend from any API that is in the same class loader.
- if (component instanceof ControllerService) {
- Class<?> extensionType = component.getClass();
- while (extensionType != null) {
- for (final Class<?> ifc : extensionType.getInterfaces()) {
- if (originalExtensionClassLoader.equals(ifc.getClassLoader())) {
- cobundledApis.add(ifc);
- }
- }
-
- extensionType = extensionType.getSuperclass();
- }
-
- logger.debug("Component {} is co-bundled with {} Controller Service APIs based on referenced Controller Services and services that are implemented: {}",
- component, cobundledApis.size(), cobundledApis);
- }
-
- if (!cobundledApis.isEmpty()) {
- final String message = String.format("Controller Service %s is bundled with its supporting APIs %s. The service APIs should not be bundled with the implementations.",
- originalExtensionType.getName(), org.apache.nifi.util.StringUtils.join(cobundledApis.stream().map(Class::getName).collect(Collectors.toSet()), ", "));
- throw new InstantiationException(message);
- }
- }
-
-
- private ControllerServiceNode createGhostControllerServiceNode() {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- final String componentType = "(Missing) " + simpleClassName;
-
- final GhostControllerService ghostService = new GhostControllerService(identifier, type);
- final LoggableComponent<ControllerService> proxiedLoggableComponent = new LoggableComponent<>(ghostService, bundleCoordinate, null);
-
- final ControllerServiceInvocationHandler invocationHandler = new StandardControllerServiceInvocationHandler(extensionManager, ghostService);
-
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- return new StandardControllerServiceNode(proxiedLoggableComponent, proxiedLoggableComponent, invocationHandler, identifier,
- validationContextFactory, serviceProvider, componentType, type, reloadComponent, extensionManager, validationTrigger, true);
- }
-
- private LoggableComponent<Processor> createLoggableProcessor(final LoggingContext loggingContext) throws ProcessorInstantiationException {
- try {
- final LoggableComponent<Processor> processorComponent;
- if (PythonBundle.isPythonCoordinate(bundleCoordinate)) {
- processorComponent = createLoggablePythonProcessor(loggingContext);
- } else {
- processorComponent = createLoggableComponent(Processor.class, loggingContext);
- }
-
- final Processor processor = processorComponent.getComponent();
-
- final ProcessorInitializationContext initContext = new StandardProcessorInitializationContext(identifier, processorComponent.getLogger(),
- serviceProvider, nodeTypeProvider, kerberosConfig);
- processor.initialize(initContext);
-
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- verifyControllerServiceReferences(processor, bundle.getClassLoader());
-
- return processorComponent;
- } catch (final Throwable t) {
- throw new ProcessorInstantiationException(type, t);
- }
- }
-
-
- private LoggableComponent<ReportingTask> createLoggableReportingTask() throws ReportingTaskInstantiationException {
- try {
- final LoggableComponent<ReportingTask> taskComponent = createLoggableComponent(ReportingTask.class, new StandardLoggingContext());
-
- final String taskName = taskComponent.getComponent().getClass().getSimpleName();
- final ReportingInitializationContext config = new StandardReportingInitializationContext(identifier, taskName,
- SchedulingStrategy.TIMER_DRIVEN, "1 min", taskComponent.getLogger(), serviceProvider, kerberosConfig, nodeTypeProvider);
-
- taskComponent.getComponent().initialize(config);
-
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- verifyControllerServiceReferences(taskComponent.getComponent(), bundle.getClassLoader());
-
- return taskComponent;
- } catch (final Throwable t) {
- throw new ReportingTaskInstantiationException(type, t);
- }
- }
-
- private LoggableComponent<FlowAnalysisRule> createLoggableFlowAnalysisRule() throws FlowAnalysisRuleInstantiationException {
- try {
- final LoggableComponent<FlowAnalysisRule> loggableComponent = createLoggableComponent(FlowAnalysisRule.class, new StandardLoggingContext());
-
- final FlowAnalysisRuleInitializationContext config = new StandardFlowAnalysisInitializationContext(identifier,
- loggableComponent.getLogger(), serviceProvider, kerberosConfig, nodeTypeProvider);
-
- loggableComponent.getComponent().initialize(config);
-
- return loggableComponent;
- } catch (final Throwable t) {
- throw new FlowAnalysisRuleInstantiationException(type, t);
- }
- }
-
- private FlowAnalysisRuleNode createFlowAnalysisRuleNode(final LoggableComponent<FlowAnalysisRule> flowAnalysisRule, final boolean creationSuccessful) {
- final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
- final FlowAnalysisRuleNode ruleNode;
- if (creationSuccessful) {
- stateManagerProvider.getStateManager(identifier, flowAnalysisRule.getComponent().getClass());
- ruleNode = new StandardFlowAnalysisRuleNode(flowAnalysisRule, identifier, flowController,
- validationContextFactory, ruleViolationsManager, reloadComponent, extensionManager, validationTrigger);
- ruleNode.setName(ruleNode.getFlowAnalysisRule().getClass().getSimpleName());
- } else {
- final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
- final String componentType = "(Missing) " + simpleClassName;
-
- ruleNode = new StandardFlowAnalysisRuleNode(flowAnalysisRule, identifier, flowController, validationContextFactory, ruleViolationsManager,
- componentType, type, reloadComponent, extensionManager, validationTrigger, true);
- ruleNode.setName(componentType);
- }
-
- return ruleNode;
- }
-
- private LoggableComponent<FlowRegistryClient> createLoggableFlowRegistryClient() throws FlowRepositoryClientInstantiationException {
- try {
- final LoggableComponent<FlowRegistryClient> clientComponent = createLoggableComponent(FlowRegistryClient.class, new StandardLoggingContext());
-
- final FlowRegistryClientInitializationContext context = new StandardFlowRegistryClientInitializationContext(
- identifier, clientComponent.getLogger(), systemSslContext);
-
- clientComponent.getComponent().initialize(context);
- return clientComponent;
-
-
- } catch (final Throwable t) {
- throw new FlowRepositoryClientInstantiationException(type, t);
- }
- }
-
- private LoggableComponent<ParameterProvider> createLoggableParameterProvider() throws ParameterProviderInstantiationException {
- try {
- final LoggableComponent<ParameterProvider> providerComponent = createLoggableComponent(ParameterProvider.class, new StandardLoggingContext());
-
- final String taskName = providerComponent.getComponent().getClass().getSimpleName();
- final ParameterProviderInitializationContext config = new StandardParameterProviderInitializationContext(identifier, taskName,
- providerComponent.getLogger(), kerberosConfig, nodeTypeProvider);
-
- providerComponent.getComponent().initialize(config);
-
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- verifyControllerServiceReferences(providerComponent.getComponent(), bundle.getClassLoader());
-
- return providerComponent;
- } catch (final Throwable t) {
- throw new ParameterProviderInstantiationException(type, t);
- }
- }
-
- private LoggableComponent<Processor> createLoggablePythonProcessor(final LoggingContext loggingContext) {
- final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- if (bundle == null) {
- throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
- }
-
- final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls, true,
- classloaderIsolationKey);
- Thread.currentThread().setContextClassLoader(detectedClassLoader);
-
- final Processor processor = pythonBridge.createProcessor(identifier, type, bundleCoordinate.getVersion(), true, true);
-
- final ComponentLog componentLog = new SimpleProcessLogger(identifier, processor, loggingContext);
- final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(componentLog);
-
- final ProcessorInitializationContext initContext = new StandardProcessorInitializationContext(identifier, terminationAwareLogger,
- serviceProvider, nodeTypeProvider, kerberosConfig);
- processor.initialize(initContext);
-
- return new LoggableComponent<>(processor, bundleCoordinate, terminationAwareLogger);
- } finally {
- if (ctxClassLoader != null) {
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- }
- }
- }
-
- private <T extends ConfigurableComponent> LoggableComponent<T> createLoggableComponent(Class<T> nodeType, LoggingContext loggingContext)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
-
- final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
- if (bundle == null) {
- throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
- }
-
- final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls, true,
- classloaderIsolationKey);
- final Class<?> rawClass = Class.forName(type, true, detectedClassLoader);
- Thread.currentThread().setContextClassLoader(detectedClassLoader);
-
- final Object extensionInstance = rawClass.getDeclaredConstructor().newInstance();
-
- final ComponentLog componentLog = new SimpleProcessLogger(identifier, extensionInstance, loggingContext);
- final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(componentLog);
-
- final T cast = nodeType.cast(extensionInstance);
- return new LoggableComponent<>(cast, bundleCoordinate, terminationAwareLogger);
- } finally {
- if (ctxClassLoader != null) {
- Thread.currentThread().setContextClassLoader(ctxClassLoader);
- }
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(ExtensionBuilder.class);
+
+ private String type;
+ private String identifier;
+ private BundleCoordinate bundleCoordinate;
+ private ExtensionManager extensionManager;
+ private Set<URL> classpathUrls;
+ private KerberosConfig kerberosConfig = KerberosConfig.NOT_CONFIGURED;
+ private ControllerServiceProvider serviceProvider;
+ private NodeTypeProvider nodeTypeProvider;
+ private ProcessScheduler processScheduler;
+ private ValidationTrigger validationTrigger;
+ private ReloadComponent reloadComponent;
+ private FlowController flowController;
+ private StateManagerProvider stateManagerProvider;
+ private RuleViolationsManager ruleViolationsManager;
+ private FlowAnalyzer flowAnalyzer;
+ private boolean flowAnalysisAtRegistryCommit;
+ private String classloaderIsolationKey;
+ private SSLContext systemSslContext;
+ private PythonBridge pythonBridge;
+
+ public ExtensionBuilder type(final String type) {
+ this.type = type;
+ return this;
+ }
+
+ public ExtensionBuilder identifier(final String identifier) {
+ this.identifier = identifier;
+ return this;
+ }
+
+ public ExtensionBuilder bundleCoordinate(final BundleCoordinate coordinate) {
+ this.bundleCoordinate = coordinate;
+ return this;
+ }
+
+ public ExtensionBuilder addClasspathUrls(final Set<URL> urls) {
+ if (urls == null || urls.isEmpty()) {
+ return this;
+ }
+
+ if (this.classpathUrls == null) {
+ this.classpathUrls = new HashSet<>();
+ }
+
+ this.classpathUrls.addAll(urls);
+ return this;
+ }
+
+ public ExtensionBuilder kerberosConfig(final KerberosConfig kerberosConfig) {
+ this.kerberosConfig = kerberosConfig;
+ return this;
+ }
+
+ public ExtensionBuilder controllerServiceProvider(final ControllerServiceProvider serviceProvider) {
+ this.serviceProvider = serviceProvider;
+ return this;
+ }
+
+ public ExtensionBuilder nodeTypeProvider(final NodeTypeProvider nodeTypeProvider) {
+ this.nodeTypeProvider = nodeTypeProvider;
+ return this;
+ }
+
+ public ExtensionBuilder processScheduler(final ProcessScheduler scheduler) {
+ this.processScheduler = scheduler;
+ return this;
+ }
+
+ public ExtensionBuilder validationTrigger(final ValidationTrigger validationTrigger) {
+ this.validationTrigger = validationTrigger;
+ return this;
+ }
+
+ public ExtensionBuilder reloadComponent(final ReloadComponent reloadComponent) {
+ this.reloadComponent = reloadComponent;
+ return this;
+ }
+
+ public ExtensionBuilder flowController(final FlowController flowController) {
+ this.flowController = flowController;
+ return this;
+ }
+
+ public ExtensionBuilder flowAnalysisAtRegistryCommit(final boolean flowAnalysisAtRegistryCommit) {
+ this.flowAnalysisAtRegistryCommit = flowAnalysisAtRegistryCommit;
+ return this;
+ }
+
+ public ExtensionBuilder stateManagerProvider(final StateManagerProvider stateManagerProvider) {
+ this.stateManagerProvider = stateManagerProvider;
+ return this;
+ }
+
+ public ExtensionBuilder ruleViolationsManager(RuleViolationsManager ruleViolationsManager) {
+ this.ruleViolationsManager = ruleViolationsManager;
+ return this;
+ }
+
+ public ExtensionBuilder flowAnalyzer(FlowAnalyzer flowAnalyzer) {
+ this.flowAnalyzer = flowAnalyzer;
+ return this;
+ }
+
+ public ExtensionBuilder extensionManager(final ExtensionManager extensionManager) {
+ this.extensionManager = extensionManager;
+ return this;
+ }
+
+ public ExtensionBuilder classloaderIsolationKey(final String classloaderIsolationKey) {
+ this.classloaderIsolationKey = classloaderIsolationKey;
+ return this;
+ }
+
+ public ExtensionBuilder systemSslContext(final SSLContext systemSslContext) {
+ this.systemSslContext = systemSslContext;
+ return this;
+ }
+
+ public ExtensionBuilder pythonBridge(final PythonBridge pythonBridge) {
+ this.pythonBridge = pythonBridge;
+ return this;
+ }
+
+ public ProcessorNode buildProcessor() {
+ if (identifier == null) {
+ throw new IllegalStateException("Processor ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("Processor Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+
+ boolean creationSuccessful = true;
+ final StandardLoggingContext loggingContext = new StandardLoggingContext();
+ LoggableComponent<Processor> loggableComponent;
+ try {
+ loggableComponent = createLoggableProcessor(loggingContext);
+ } catch (final ProcessorInstantiationException pie) {
+ logger.error("Could not create Processor of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, pie.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug(pie.getMessage(), pie);
+ }
+ final GhostProcessor ghostProc = new GhostProcessor();
+ ghostProc.setIdentifier(identifier);
+ ghostProc.setCanonicalClassName(type);
+ loggableComponent = new LoggableComponent<>(ghostProc, bundleCoordinate, null);
+ creationSuccessful = false;
+ }
+
+ final String componentType;
+ if (PythonBundle.isPythonCoordinate(bundleCoordinate)) {
+ componentType = type;
+ } else if (creationSuccessful) {
+ componentType = loggableComponent.getComponent().getClass().getSimpleName();
+ } else {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ componentType = "(Missing) " + simpleClassName;
+ }
+
+ final ProcessorNode processorNode = createProcessorNode(loggableComponent, componentType, !creationSuccessful);
+ loggingContext.setComponent(processorNode);
+ return processorNode;
+ }
+
+ public FlowRegistryClientNode buildFlowRegistryClient() {
+ if (identifier == null) {
+ throw new IllegalStateException("ReportingTask ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("ReportingTask Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+ if (flowController == null) {
+ throw new IllegalStateException("FlowController must be specified");
+ }
+
+ boolean creationSuccessful = true;
+ LoggableComponent<FlowRegistryClient> loggableComponent;
+ try {
+ loggableComponent = createLoggableFlowRegistryClient();
+ } catch (final FlowRepositoryClientInstantiationException e) {
+ logger.error("Could not create Flow Registry Component of type {} from {} for ID {} due to {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, e.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug(e.getMessage(), e);
+ }
+ final GhostFlowRegistryClient ghostFlowRegistryClient = new GhostFlowRegistryClient(identifier, type);
+ loggableComponent = new LoggableComponent<>(ghostFlowRegistryClient, bundleCoordinate, null);
+ creationSuccessful = false;
+ }
+
+ final FlowRegistryClientNode clientNode = createFlowRegistryClientNode(loggableComponent, creationSuccessful);
+ return clientNode;
+ }
+
+ public ReportingTaskNode buildReportingTask() {
+ if (identifier == null) {
+ throw new IllegalStateException("ReportingTask ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("ReportingTask Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+ if (flowController == null) {
+ throw new IllegalStateException("FlowController must be specified");
+ }
+
+ boolean creationSuccessful = true;
+ LoggableComponent<ReportingTask> loggableComponent;
+ try {
+ loggableComponent = createLoggableReportingTask();
+ } catch (final ReportingTaskInstantiationException rtie) {
+ logger.error("Could not create ReportingTask of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug(rtie.getMessage(), rtie);
+ }
+ final GhostReportingTask ghostReportingTask = new GhostReportingTask();
+ ghostReportingTask.setIdentifier(identifier);
+ ghostReportingTask.setCanonicalClassName(type);
+ loggableComponent = new LoggableComponent<>(ghostReportingTask, bundleCoordinate, null);
+ creationSuccessful = false;
+ }
+
+ final ReportingTaskNode taskNode = createReportingTaskNode(loggableComponent, creationSuccessful);
+ return taskNode;
+ }
+
+ public ParameterProviderNode buildParameterProvider() {
+ if (identifier == null) {
+ throw new IllegalStateException("ParameterProvider ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("ParameterProvider Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+ if (flowController == null) {
+ throw new IllegalStateException("FlowController must be specified");
+ }
+
+ boolean creationSuccessful = true;
+ LoggableComponent<ParameterProvider> loggableComponent;
+ try {
+ loggableComponent = createLoggableParameterProvider();
+ } catch (final ParameterProviderInstantiationException rtie) {
+ logger.error("Could not create ParameterProvider of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug(rtie.getMessage(), rtie);
+ }
+ final GhostParameterProvider ghostParameterProvider = new GhostParameterProvider();
+ ghostParameterProvider.setIdentifier(identifier);
+ ghostParameterProvider.setCanonicalClassName(type);
+ loggableComponent = new LoggableComponent<>(ghostParameterProvider, bundleCoordinate, null);
+ creationSuccessful = false;
+ }
+
+ final ParameterProviderNode taskNode = createParameterProviderNode(loggableComponent, creationSuccessful);
+ return taskNode;
+ }
+
+ public ControllerServiceNode buildControllerService() {
+ if (identifier == null) {
+ throw new IllegalStateException("ReportingTask ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("ReportingTask Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+ if (stateManagerProvider == null) {
+ throw new IllegalStateException("State Manager Provider must be specified");
+ }
+
+ try {
+ return createControllerServiceNode();
+ } catch (final Throwable t) {
+ logger.error("Could not create Controller Service of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, t.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.debug(t.getMessage(), t);
+ }
+
+ return createGhostControllerServiceNode();
+ }
+ }
+
+ public FlowAnalysisRuleNode buildFlowAnalysisRuleNode() {
+ if (identifier == null) {
+ throw new IllegalStateException("FlowAnalysisRule ID must be specified");
+ }
+ if (type == null) {
+ throw new IllegalStateException("FlowAnalysisRule Type must be specified");
+ }
+ if (bundleCoordinate == null) {
+ throw new IllegalStateException("Bundle Coordinate must be specified");
+ }
+ if (extensionManager == null) {
+ throw new IllegalStateException("Extension Manager must be specified");
+ }
+ if (serviceProvider == null) {
+ throw new IllegalStateException("Controller Service Provider must be specified");
+ }
+ if (nodeTypeProvider == null) {
+ throw new IllegalStateException("Node Type Provider must be specified");
+ }
+ if (reloadComponent == null) {
+ throw new IllegalStateException("Reload Component must be specified");
+ }
+ if (flowController == null) {
+ throw new IllegalStateException("FlowController must be specified");
+ }
+
+ boolean creationSuccessful = true;
+ LoggableComponent<FlowAnalysisRule> loggableComponent;
+ try {
+ loggableComponent = createLoggableFlowAnalysisRule();
+ } catch (final FlowAnalysisRuleInstantiationException rtie) {
+ logger.error("Could not create FlowAnalysisRule of type {} from {} for ID {} due to: {}; creating \"Ghost\" implementation", type, bundleCoordinate, identifier, rtie.getMessage());
+ if (logger.isDebugEnabled()) {
+ logger.error(rtie.getMessage(), rtie);
+ }
+ final GhostFlowAnalysisRule ghostFlowAnalysisRule = new GhostFlowAnalysisRule();
+ ghostFlowAnalysisRule.setIdentifier(identifier);
+ ghostFlowAnalysisRule.setCanonicalClassName(type);
+ loggableComponent = new LoggableComponent<>(ghostFlowAnalysisRule, bundleCoordinate, null);
+ creationSuccessful = false;
+ }
+
+ final FlowAnalysisRuleNode flowAnalysisRuleNode = createFlowAnalysisRuleNode(loggableComponent, creationSuccessful);
+
+ return flowAnalysisRuleNode;
+ }
+
+
+ private ProcessorNode createProcessorNode(final LoggableComponent<Processor> processor, final String componentType, final boolean extensionMissing) {
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+
+ final ProcessorNode procNode = new StandardProcessorNode(processor, identifier, validationContextFactory, processScheduler, serviceProvider,
+ componentType, type, reloadComponent, extensionManager, validationTrigger, extensionMissing);
+
+ applyDefaultSettings(procNode);
+ applyDefaultRunDuration(procNode);
+
+ return procNode;
+ }
+
+ private ReportingTaskNode createReportingTaskNode(final LoggableComponent<ReportingTask> reportingTask, final boolean creationSuccessful) {
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ final ReportingTaskNode taskNode;
+ if (creationSuccessful) {
+ stateManagerProvider.getStateManager(identifier, reportingTask.getComponent().getClass());
+ taskNode = new StandardReportingTaskNode(reportingTask, identifier, flowController, processScheduler,
+ validationContextFactory, reloadComponent, extensionManager, validationTrigger);
+ taskNode.setName(taskNode.getReportingTask().getClass().getSimpleName());
+ } else {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ final String componentType = "(Missing) " + simpleClassName;
+
+ taskNode = new StandardReportingTaskNode(reportingTask, identifier, flowController, processScheduler, validationContextFactory,
+ componentType, type, reloadComponent, extensionManager, validationTrigger, true);
+ taskNode.setName(componentType);
+ }
+
+ return taskNode;
+ }
+
+ private StandardValidationContextFactory createValidationContextFactory(ControllerServiceProvider serviceProvider) {
+ return new StandardValidationContextFactory(serviceProvider, ruleViolationsManager, flowAnalyzer);
+ }
+
+ private ParameterProviderNode createParameterProviderNode(final LoggableComponent<ParameterProvider> parameterProvider, final boolean creationSuccessful) {
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ final ParameterProviderNode parameterProviderNode;
+ if (creationSuccessful) {
+ stateManagerProvider.getStateManager(identifier, parameterProvider.getComponent().getClass());
+ parameterProviderNode = new StandardParameterProviderNode(parameterProvider, identifier, flowController,
+ flowController.getControllerServiceProvider(), validationContextFactory, reloadComponent, extensionManager,
+ validationTrigger);
+ parameterProviderNode.setName(parameterProviderNode.getParameterProvider().getClass().getSimpleName());
+ } else {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ final String componentType = "(Missing) " + simpleClassName;
+
+ parameterProviderNode = new StandardParameterProviderNode(parameterProvider, identifier, flowController,
+ flowController.getControllerServiceProvider(), validationContextFactory, componentType, type, reloadComponent,
+ extensionManager, validationTrigger, true);
+ parameterProviderNode.setName(componentType);
+ }
+
+ return parameterProviderNode;
+ }
+
+ private FlowRegistryClientNode createFlowRegistryClientNode(final LoggableComponent<FlowRegistryClient> client, final boolean creationSuccessful) {
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ final StandardFlowRegistryClientNode clientNode;
+
+ if (creationSuccessful) {
+ clientNode = new StandardFlowRegistryClientNode(
+ flowController,
+ flowController.getFlowManager(),
+ client,
+ identifier,
+ validationContextFactory,
+ serviceProvider,
+ type,
+ client.getComponent().getClass().getCanonicalName(),
+ reloadComponent,
+ extensionManager,
+ validationTrigger,
+ false
+ );
+ } else {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ final String componentType = "(Missing) " + simpleClassName;
+
+ clientNode = new StandardFlowRegistryClientNode(
+ flowController,
+ flowController.getFlowManager(),
+ client,
+ identifier,
+ validationContextFactory,
+ serviceProvider,
+ componentType,
+ type,
+ reloadComponent,
+ extensionManager,
+ validationTrigger,
+ true);
+ }
+
+ if (flowAnalysisAtRegistryCommit) {
+ return new FlowAnalyzingRegistryClientNode(
+ clientNode,
+ serviceProvider,
+ flowAnalyzer,
+ ruleViolationsManager,
+ flowController.getFlowManager(),
+ FlowAnalysisUtil.createMapper(extensionManager)
+ );
+ } else {
+ return clientNode;
+ }
+ }
+
+ private void applyDefaultSettings(final ProcessorNode processorNode) {
+ try {
+ final Class<?> procClass = processorNode.getProcessor().getClass();
+
+ final DefaultSettings ds = procClass.getAnnotation(DefaultSettings.class);
+ if (ds != null) {
+ processorNode.setYieldPeriod(ds.yieldDuration());
+ processorNode.setPenalizationPeriod(ds.penaltyDuration());
+ processorNode.setBulletinLevel(ds.bulletinLevel());
+ }
+ } catch (final Exception ex) {
+ logger.error("Error while setting default settings from DefaultSettings annotation", ex);
+ }
+ }
+
+ private void applyDefaultRunDuration(final ProcessorNode processorNode) {
+ try {
+ final Class<?> procClass = processorNode.getProcessor().getClass();
+
+ final SupportsBatching sb = procClass.getAnnotation(SupportsBatching.class);
+ if (sb != null) {
+ processorNode.setRunDuration(sb.defaultDuration().getDuration().toMillis(), TimeUnit.MILLISECONDS);
+ }
+ } catch (final Exception ex) {
+ logger.error("Set Default Run Duration failed", ex);
+ }
+ }
+
+ private ControllerServiceNode createControllerServiceNode()
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException, InitializationException, NoSuchMethodException, InvocationTargetException {
+
+ final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ if (bundle == null) {
+ throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
+ }
+
+ final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls);
+ final Class<?> rawClass = Class.forName(type, true, detectedClassLoader);
+ Thread.currentThread().setContextClassLoader(detectedClassLoader);
+
+ final Class<? extends ControllerService> controllerServiceClass = rawClass.asSubclass(ControllerService.class);
+ final ControllerService serviceImpl = controllerServiceClass.getDeclaredConstructor().newInstance();
+
+ final StandardControllerServiceInvocationHandler invocationHandler = new StandardControllerServiceInvocationHandler(extensionManager, serviceImpl);
+
+ // extract all interfaces... controllerServiceClass is non null so getAllInterfaces is non null
+ final List<Class<?>> interfaceList = ClassUtils.getAllInterfaces(controllerServiceClass);
+ final Class<?>[] interfaces = interfaceList.toArray(new Class<?>[0]);
+
+ final ControllerService proxiedService;
+ if (detectedClassLoader == null) {
+ proxiedService = (ControllerService) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces, invocationHandler);
+ } else {
+ proxiedService = (ControllerService) Proxy.newProxyInstance(detectedClassLoader, interfaces, invocationHandler);
+ }
+
+ logger.info("Created Controller Service of type {} with identifier {}", type, identifier);
+ final StandardLoggingContext loggingContext = new StandardLoggingContext();
+ final ComponentLog serviceLogger = new SimpleProcessLogger(identifier, serviceImpl, loggingContext);
+ final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(serviceLogger);
+
+ final StateManager stateManager = stateManagerProvider.getStateManager(identifier, serviceImpl.getClass());
+ final ControllerServiceInitializationContext initContext = new StandardControllerServiceInitializationContext(identifier, terminationAwareLogger,
+ serviceProvider, stateManager, kerberosConfig, nodeTypeProvider);
+ serviceImpl.initialize(initContext);
+
+ verifyControllerServiceReferences(serviceImpl, bundle.getClassLoader());
+
+ final LoggableComponent<ControllerService> originalLoggableComponent = new LoggableComponent<>(serviceImpl, bundleCoordinate, terminationAwareLogger);
+ final LoggableComponent<ControllerService> proxiedLoggableComponent = new LoggableComponent<>(proxiedService, bundleCoordinate, terminationAwareLogger);
+
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ final ControllerServiceNode serviceNode = new StandardControllerServiceNode(originalLoggableComponent, proxiedLoggableComponent, invocationHandler,
+ identifier, validationContextFactory, serviceProvider, reloadComponent, extensionManager, validationTrigger);
+ serviceNode.setName(rawClass.getSimpleName());
+ // Set Controller Service Node in Logging Context to populate Process Group information
+ loggingContext.setComponent(serviceNode);
+
+ invocationHandler.setServiceNode(serviceNode);
+ return serviceNode;
+ } finally {
+ if (ctxClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ }
+ }
+ }
+
+ private static void verifyControllerServiceReferences(final ConfigurableComponent component, final ClassLoader bundleClassLoader) throws InstantiationException {
+ // If a component lives in the same NAR as a Controller Service API, and the component references the Controller Service API (either
+ // by itself implementing the API or by having a Property Descriptor that identifies the Controller Service), then the component is not
+ // allowed to Require Instance Class Loading. This is done because when a component requires Instance Class Loading, the jars within the
+ // NAR and its parents must be copied to a new class loader all the way up to the point of the Controller Service APIs. If the Controller
+ // Service API lives in the same NAR as the implementation itself, then we cannot duplicate the NAR ClassLoader. Otherwise, we would have
+ // two different NAR ClassLoaders that each define the Service API. And the Service API class must live in the parent ClassLoader for both
+ // the referencing component AND the implementing component.
+
+ // if the extension does not require instance classloading, there is no concern.
+ final boolean requiresInstanceClassLoading = component.getClass().isAnnotationPresent(RequiresInstanceClassLoading.class);
+ if (!requiresInstanceClassLoading) {
+ logger.debug("Instance ClassLoading is not required for {}", component);
+ return;
+ }
+
+ logger.debug("Component {} requires Instance Class Loading", component);
+
+ final Class<?> originalExtensionType = component.getClass();
+ final ClassLoader originalExtensionClassLoader = originalExtensionType.getClassLoader();
+
+ // Find any Controller Service API's that are bundled in the same NAR.
+ final Set<Class<?>> cobundledApis = new HashSet<>();
+ try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(component.getClass().getClassLoader())) {
+ final List<PropertyDescriptor> descriptors = component.getPropertyDescriptors();
+ if (descriptors != null && !descriptors.isEmpty()) {
+ for (final PropertyDescriptor descriptor : descriptors) {
+ final Class<? extends ControllerService> serviceApi = descriptor.getControllerServiceDefinition();
+ if (serviceApi != null && bundleClassLoader.equals(serviceApi.getClassLoader())) {
+ cobundledApis.add(serviceApi);
+ }
+ }
+ }
+ }
+
+ logger.debug("Component {} is co-bundled with {} Controller Service APIs based on referenced Controller Services: {}", component, cobundledApis.size(), cobundledApis);
+
+ // If the component is a Controller Service, it should also not extend from any API that is in the same class loader.
+ if (component instanceof ControllerService) {
+ Class<?> extensionType = component.getClass();
+ while (extensionType != null) {
+ for (final Class<?> ifc : extensionType.getInterfaces()) {
+ if (originalExtensionClassLoader.equals(ifc.getClassLoader())) {
+ cobundledApis.add(ifc);
+ }
+ }
+
+ extensionType = extensionType.getSuperclass();
+ }
+
+ logger.debug("Component {} is co-bundled with {} Controller Service APIs based on referenced Controller Services and services that are implemented: {}",
+ component, cobundledApis.size(), cobundledApis);
+ }
+
+ if (!cobundledApis.isEmpty()) {
+ final String message = String.format("Controller Service %s is bundled with its supporting APIs %s. The service APIs should not be bundled with the implementations.",
+ originalExtensionType.getName(), org.apache.nifi.util.StringUtils.join(cobundledApis.stream().map(Class::getName).collect(Collectors.toSet()), ", "));
+ throw new InstantiationException(message);
+ }
+ }
+
+
+ private ControllerServiceNode createGhostControllerServiceNode() {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ final String componentType = "(Missing) " + simpleClassName;
+
+ final GhostControllerService ghostService = new GhostControllerService(identifier, type);
+ final LoggableComponent<ControllerService> proxiedLoggableComponent = new LoggableComponent<>(ghostService, bundleCoordinate, null);
+
+ final ControllerServiceInvocationHandler invocationHandler = new StandardControllerServiceInvocationHandler(extensionManager, ghostService);
+
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ return new StandardControllerServiceNode(proxiedLoggableComponent, proxiedLoggableComponent, invocationHandler, identifier,
+ validationContextFactory, serviceProvider, componentType, type, reloadComponent, extensionManager, validationTrigger, true);
+ }
+
+ private LoggableComponent<Processor> createLoggableProcessor(final LoggingContext loggingContext) throws ProcessorInstantiationException {
+ try {
+ final LoggableComponent<Processor> processorComponent;
+ if (PythonBundle.isPythonCoordinate(bundleCoordinate)) {
+ processorComponent = createLoggablePythonProcessor(loggingContext);
+ } else {
+ processorComponent = createLoggableComponent(Processor.class, loggingContext);
+ }
+
+ final Processor processor = processorComponent.getComponent();
+
+ final ProcessorInitializationContext initContext = new StandardProcessorInitializationContext(identifier, processorComponent.getLogger(),
+ serviceProvider, nodeTypeProvider, kerberosConfig);
+ processor.initialize(initContext);
+
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ verifyControllerServiceReferences(processor, bundle.getClassLoader());
+
+ return processorComponent;
+ } catch (final Throwable t) {
+ throw new ProcessorInstantiationException(type, t);
+ }
+ }
+
+
+ private LoggableComponent<ReportingTask> createLoggableReportingTask() throws ReportingTaskInstantiationException {
+ try {
+ final LoggableComponent<ReportingTask> taskComponent = createLoggableComponent(ReportingTask.class, new StandardLoggingContext());
+
+ final String taskName = taskComponent.getComponent().getClass().getSimpleName();
+ final ReportingInitializationContext config = new StandardReportingInitializationContext(identifier, taskName,
+ SchedulingStrategy.TIMER_DRIVEN, "1 min", taskComponent.getLogger(), serviceProvider, kerberosConfig, nodeTypeProvider);
+
+ taskComponent.getComponent().initialize(config);
+
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ verifyControllerServiceReferences(taskComponent.getComponent(), bundle.getClassLoader());
+
+ return taskComponent;
+ } catch (final Throwable t) {
+ throw new ReportingTaskInstantiationException(type, t);
+ }
+ }
+
+ private LoggableComponent<FlowAnalysisRule> createLoggableFlowAnalysisRule() throws FlowAnalysisRuleInstantiationException {
+ try {
+ final LoggableComponent<FlowAnalysisRule> loggableComponent = createLoggableComponent(FlowAnalysisRule.class, new StandardLoggingContext());
+
+ final FlowAnalysisRuleInitializationContext config = new StandardFlowAnalysisInitializationContext(identifier,
+ loggableComponent.getLogger(), serviceProvider, kerberosConfig, nodeTypeProvider);
+
+ loggableComponent.getComponent().initialize(config);
+
+ return loggableComponent;
+ } catch (final Throwable t) {
+ throw new FlowAnalysisRuleInstantiationException(type, t);
+ }
+ }
+
+ private FlowAnalysisRuleNode createFlowAnalysisRuleNode(final LoggableComponent<FlowAnalysisRule> flowAnalysisRule, final boolean creationSuccessful) {
+ final ValidationContextFactory validationContextFactory = createValidationContextFactory(serviceProvider);
+ final FlowAnalysisRuleNode ruleNode;
+ if (creationSuccessful) {
+ stateManagerProvider.getStateManager(identifier, flowAnalysisRule.getComponent().getClass());
+ ruleNode = new StandardFlowAnalysisRuleNode(flowAnalysisRule, identifier, flowController,
+ validationContextFactory, ruleViolationsManager, reloadComponent, extensionManager, validationTrigger);
+ ruleNode.setName(ruleNode.getFlowAnalysisRule().getClass().getSimpleName());
+ } else {
+ final String simpleClassName = type.contains(".") ? StringUtils.substringAfterLast(type, ".") : type;
+ final String componentType = "(Missing) " + simpleClassName;
+
+ ruleNode = new StandardFlowAnalysisRuleNode(flowAnalysisRule, identifier, flowController, validationContextFactory, ruleViolationsManager,
+ componentType, type, reloadComponent, extensionManager, validationTrigger, true);
+ ruleNode.setName(componentType);
+ }
+
+ return ruleNode;
+ }
+
+ private LoggableComponent<FlowRegistryClient> createLoggableFlowRegistryClient() throws FlowRepositoryClientInstantiationException {
+ try {
+ final LoggableComponent<FlowRegistryClient> clientComponent = createLoggableComponent(FlowRegistryClient.class, new StandardLoggingContext());
+
+ final FlowRegistryClientInitializationContext context = new StandardFlowRegistryClientInitializationContext(
+ identifier, clientComponent.getLogger(), systemSslContext);
+
+ clientComponent.getComponent().initialize(context);
+ return clientComponent;
+
+
+ } catch (final Throwable t) {
+ throw new FlowRepositoryClientInstantiationException(type, t);
+ }
+ }
+
+ private LoggableComponent<ParameterProvider> createLoggableParameterProvider() throws ParameterProviderInstantiationException {
+ try {
+ final LoggableComponent<ParameterProvider> providerComponent = createLoggableComponent(ParameterProvider.class, new StandardLoggingContext());
+
+ final String taskName = providerComponent.getComponent().getClass().getSimpleName();
+ final ParameterProviderInitializationContext config = new StandardParameterProviderInitializationContext(identifier, taskName,
+ providerComponent.getLogger(), kerberosConfig, nodeTypeProvider);
+
+ providerComponent.getComponent().initialize(config);
+
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ verifyControllerServiceReferences(providerComponent.getComponent(), bundle.getClassLoader());
+
+ return providerComponent;
+ } catch (final Throwable t) {
+ throw new ParameterProviderInstantiationException(type, t);
+ }
+ }
+
+ private LoggableComponent<Processor> createLoggablePythonProcessor(final LoggingContext loggingContext) {
+ final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ if (bundle == null) {
+ throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
+ }
+
+ final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls, true,
+ classloaderIsolationKey);
+ Thread.currentThread().setContextClassLoader(detectedClassLoader);
+
+ final Processor processor = pythonBridge.createProcessor(identifier, type, bundleCoordinate.getVersion(), true, true);
+
+ final ComponentLog componentLog = new SimpleProcessLogger(identifier, processor, loggingContext);
+ final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(componentLog);
+
+ final ProcessorInitializationContext initContext = new StandardProcessorInitializationContext(identifier, terminationAwareLogger,
+ serviceProvider, nodeTypeProvider, kerberosConfig);
+ processor.initialize(initContext);
+
+ return new LoggableComponent<>(processor, bundleCoordinate, terminationAwareLogger);
+ } finally {
+ if (ctxClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ }
+ }
+ }
+
+ private <T extends ConfigurableComponent> LoggableComponent<T> createLoggableComponent(Class<T> nodeType, LoggingContext loggingContext)
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
+
+ final ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ final Bundle bundle = extensionManager.getBundle(bundleCoordinate);
+ if (bundle == null) {
+ throw new IllegalStateException("Unable to find bundle for coordinate " + bundleCoordinate.getCoordinate());
+ }
+
+ final ClassLoader detectedClassLoader = extensionManager.createInstanceClassLoader(type, identifier, bundle, classpathUrls == null ? Collections.emptySet() : classpathUrls, true,
+ classloaderIsolationKey);
+ final Class<?> rawClass = Class.forName(type, true, detectedClassLoader);
+ Thread.currentThread().setContextClassLoader(detectedClassLoader);
+
+ final Object extensionInstance = rawClass.getDeclaredConstructor().newInstance();
+
+ final ComponentLog componentLog = new SimpleProcessLogger(identifier, extensionInstance, loggingContext);
+ final TerminationAwareLogger terminationAwareLogger = new TerminationAwareLogger(componentLog);
+
+ final T cast = nodeType.cast(extensionInstance);
+ return new LoggableComponent<>(cast, bundleCoordinate, terminationAwareLogger);
+ } finally {
+ if (ctxClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(ctxClassLoader);
+ }
+ }
+ }
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java
index 3ac7cadd4c..4e78b257a6 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java
@@ -92,7 +92,7 @@ public class NioAsyncLoadBalanceClient implements AsyncLoadBalanceClient {
public NioAsyncLoadBalanceClient(final NodeIdentifier nodeIdentifier, final SSLContext sslContext, final int timeoutMillis, final FlowFileContentAccess flowFileContentAccess,
- final LoadBalanceFlowFileCodec flowFileCodec, final EventReporter eventReporter, final ClusterCoordinator clusterCoordinator) {
+ final LoadBalanceFlowFileCodec flowFileCodec, final EventReporter eventReporter, final ClusterCoordinator clusterCoordinator) {
this.nodeIdentifier = nodeIdentifier;
this.sslContext = sslContext;
this.timeoutMillis = timeoutMillis;
@@ -301,13 +301,13 @@ public class NioAsyncLoadBalanceClient implements AsyncLoadBalanceClient {
}
/**
- * If any FlowFiles have been transferred in an active session, fail the transaction. Otherwise, gather up to the Transaction Threshold's limits
- * worth of FlowFiles and treat them as a failed transaction. In either case, terminate the session. This allows us to transfer FlowFiles from
- * queue partitions where the partitioner indicates that the data should be rebalanced, but does so in a way that we don't immediately rebalance
- * all FlowFiles. This is desirable in a case such as when we have a lot of data queued up in a connection and then a node temporarily disconnects.
- * We don't want to then just push all data to other nodes. We'd rather push the data out to other nodes slowly while waiting for the disconnected
- * node to reconnect. And if the node reconnects, we want to keep sending it data.
- */
+ * If any FlowFiles have been transferred in an active session, fail the transaction. Otherwise, gather up to the Transaction Threshold's limits
+ * worth of FlowFiles and treat them as a failed transaction. In either case, terminate the session. This allows us to transfer FlowFiles from
+ * queue partitions where the partitioner indicates that the data should be rebalanced, but does so in a way that we don't immediately rebalance
+ * all FlowFiles. This is desirable in a case such as when we have a lot of data queued up in a connection and then a node temporarily disconnects.
+ * We don't want to then just push all data to other nodes. We'd rather push the data out to other nodes slowly while waiting for the disconnected
+ * node to reconnect. And if the node reconnects, we want to keep sending it data.
+ */
@Override
public void nodeDisconnected() {
if (!loadBalanceSessionLock.tryLock()) {
@@ -427,7 +427,7 @@ public class NioAsyncLoadBalanceClient implements AsyncLoadBalanceClient {
}
private TransactionThreshold newTransactionThreshold() {
- return new SimpleLimitThreshold(1000, 10_000_000L);
+ return new SimpleLimitThreshold(1000, 10_000_000L);
}
private synchronized boolean isConnectionEstablished() {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java
index abb69a3e87..55e55e852e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/PeerChannel.java
@@ -132,7 +132,7 @@ public class PeerChannel implements Closeable {
singleByteBuffer.clear();
final int bytesRead = read(singleByteBuffer);
if (bytesRead < 0) {
- return OptionalInt.of(END_OF_FILE);
+ return OptionalInt.of(END_OF_FILE);
} else if (bytesRead == EMPTY_BUFFER) {
return OptionalInt.empty();
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/RunningComponentSetFilter.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/RunningComponentSetFilter.java
index 3fa49c3cac..3e8ba78271 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/RunningComponentSetFilter.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/RunningComponentSetFilter.java
@@ -135,7 +135,7 @@ public class RunningComponentSetFilter implements ComponentSetFilter {
@Override
public boolean testFlowRegistryClient(final FlowRegistryClientNode flowRegistryClient) {
- return false;
+ return false;
}
@Override
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/tasks/ProcessorTimingDiagnosticTask.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/tasks/ProcessorTimingDiagnosticTask.java
index c319fb7247..947ba06642 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/tasks/ProcessorTimingDiagnosticTask.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/tasks/ProcessorTimingDiagnosticTask.java
@@ -41,8 +41,8 @@ public class ProcessorTimingDiagnosticTask implements DiagnosticTask {
private final FlowManager flowManager;
// | Proc ID | Proc Name | Proc Type | Group Name | Proc Secs | CPU Secs | %CPU used by Proc |
- private static final String PROCESSOR_TIMING_FORMAT = "| %1$-36.36s | %2$-36.36s | %3$-36.36s | %4$-36.36s | %5$15.15s | %6$27.27s | %7$25.25s | " +
// Read Secs | Write Secs| Commit Sec | GC millis | MB Read | MB Write |
+ private static final String PROCESSOR_TIMING_FORMAT = "| %1$-36.36s | %2$-36.36s | %3$-36.36s | %4$-36.36s | %5$15.15s | %6$27.27s | %7$25.25s | " +
"%8$16.16s | %9$16.16s | %10$20.20s | %11$13.13s | %12$11.11s | %13$11.11s |";
public ProcessorTimingDiagnosticTask(final FlowFileEventRepository flowFileEventRepository, final FlowManager flowManager) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/validation/StandardRuleViolationsManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/validation/StandardRuleViolationsManager.java
index 415d40e450..751e1e00a8 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/validation/StandardRuleViolationsManager.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/validation/StandardRuleViolationsManager.java
@@ -190,7 +190,7 @@ public class StandardRuleViolationsManager implements RuleViolationsManager {
violationMap -> violationMap
.entrySet()
.removeIf(keyAndViolation -> keyAndViolation.getValue().getRuleId().equals(ruleId))
- );
+ );
}
@Override
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/DummyPrimaryNodeOnlyProcessor.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/DummyPrimaryNodeOnlyProcessor.java
index 379abb1595..8c9aab2cda 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/DummyPrimaryNodeOnlyProcessor.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/DummyPrimaryNodeOnlyProcessor.java
@@ -17,11 +17,11 @@
package org.apache.nifi.controller;
- import org.apache.nifi.annotation.behavior.PrimaryNodeOnly;
- import org.apache.nifi.processor.AbstractProcessor;
- import org.apache.nifi.processor.ProcessContext;
- import org.apache.nifi.processor.ProcessSession;
- import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.annotation.behavior.PrimaryNodeOnly;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
/**
* Dummy processor implementation to test {@link PrimaryNodeOnly} marker annotation
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
index 2ed9e0be14..978a6ff042 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/StandardProcessSessionIT.java
@@ -1000,7 +1000,7 @@ public class StandardProcessSessionIT {
// Force an IOException. This will decrement out claim count for the resource claim.
assertThrows(ProcessException.class, () -> session.write(finalChild, out -> {
- throw new IOException(); }),
+ throw new IOException(); }),
"write() callback threw IOException but it was not wrapped in ProcessException");
session.remove(child);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
index 41b0a33a80..21203c7fd5 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/repository/TestFileSystemRepository.java
@@ -600,8 +600,8 @@ public class TestFileSystemRepository {
@Test
public void testSizeWithNoContent() {
final ContentClaim claim =
- new StandardContentClaim(new StandardResourceClaim(claimManager,
- "container1", "section 1", "1", false), 0L);
+ new StandardContentClaim(new StandardResourceClaim(claimManager,
+ "container1", "section 1", "1", false), 0L);
assertThrows(ContentNotFoundException.class, () -> repository.size(claim));
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepositoryForComponentsTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepositoryForComponentsTest.java
index 0410808224..ea3116680b 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepositoryForComponentsTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/VolatileComponentStatusRepositoryForComponentsTest.java
@@ -1,19 +1,19 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.nifi.controller.status.history;
import org.apache.nifi.util.NiFiProperties;
@@ -32,194 +32,194 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
- * This class verifies the VolatileComponentStatusRepository getConnectionStatusHistory method
- * honors the start/end/preferredDataPoints variables by testing the filterDates function.
- */
+ * This class verifies the VolatileComponentStatusRepository getConnectionStatusHistory method
+ * honors the start/end/preferredDataPoints variables by testing the filterDates function.
+ */
public class VolatileComponentStatusRepositoryForComponentsTest {
- private static VolatileComponentStatusRepository filledRepo;
- private static VolatileComponentStatusRepository partiallyFilledRepo;
- private static VolatileComponentStatusRepository emptyRepo;
- private static final int FIVE_MINUTES = 300000;
- private static final int BUFSIZE3 = 10;
+ private static VolatileComponentStatusRepository filledRepo;
+ private static VolatileComponentStatusRepository partiallyFilledRepo;
+ private static VolatileComponentStatusRepository emptyRepo;
+ private static final int FIVE_MINUTES = 300000;
+ private static final int BUFSIZE3 = 10;
- @BeforeAll
- public static void createBuffers() {
- // Fill the repo1 buffer completely with Date objects at five-minute intervals
- // This provides dates up to around Jul 1979
- filledRepo = initRepo(1_000_000, 0);
+ @BeforeAll
+ public static void createBuffers() {
+ // Fill the repo1 buffer completely with Date objects at five-minute intervals
+ // This provides dates up to around Jul 1979
+ filledRepo = initRepo(1_000_000, 0);
- // Verify partially filled buffers work as expected.
- partiallyFilledRepo = initRepo(1000, 10);
+ // Verify partially filled buffers work as expected.
+ partiallyFilledRepo = initRepo(1000, 10);
- emptyRepo = createRepo(BUFSIZE3);
- }
+ emptyRepo = createRepo(BUFSIZE3);
+ }
+
+ private static VolatileComponentStatusRepository initRepo(int bufferSize, int offset) {
+ VolatileComponentStatusRepository repo = createRepo(bufferSize);
+
+ for (long i = 0; i < bufferSize - offset; i++) {
+ repo.timestamps.add(new Date(i * FIVE_MINUTES));
+ }
+ assertEquals(bufferSize - offset, repo.timestamps.getSize());
+
+ return repo;
+ }
+
+ private static VolatileComponentStatusRepository createRepo(int bufferSize) {
+ final NiFiProperties niFiProperties = Mockito.mock(NiFiProperties.class);
+ Mockito.when(niFiProperties.getIntegerProperty(VolatileComponentStatusRepository.NUM_DATA_POINTS_PROPERTY, VolatileComponentStatusRepository.DEFAULT_NUM_DATA_POINTS)).thenReturn(bufferSize);
+ return new VolatileComponentStatusRepository(niFiProperties);
+ }
+
+ private static Date asDate(LocalDateTime localDateTime) {
+ return Date.from(localDateTime.toInstant(ZoneOffset.UTC));
+ }
+
+ @Test
+ public void testFilterDatesReturnAll() {
+ testFilterDatesReturnAll(filledRepo);
+ testFilterDatesReturnAll(partiallyFilledRepo);
+ }
+
+ private void testFilterDatesReturnAll(VolatileComponentStatusRepository repo) {
+ List<Date> dates = repo.filterDates(null, null, Integer.MAX_VALUE);
+ assertNotNull(repo.timestamps);
+ assertEquals(repo.timestamps.getSize(), dates.size());
+ assertEquals(dates, repo.timestamps.asList());
+ repo.timestamps.add(new Date());
+ }
+
+ @Test
+ public void testFilterDatesUsingPreferredDataPoints() {
+ List<Date> dates = filledRepo.filterDates(null, null, 1);
+ assertEquals(1, dates.size());
+ assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(0));
+
+ testFilterDatesUsingPreferredDataPoints(filledRepo, 14);
+ testFilterDatesUsingPreferredDataPoints(partiallyFilledRepo, 22);
+ }
+
+ private void testFilterDatesUsingPreferredDataPoints(VolatileComponentStatusRepository repo, int numPoints) {
+ List<Date> dates = repo.filterDates(null, null, numPoints);
+ assertEquals(numPoints, dates.size());
+ assertEquals(repo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
+ assertEquals(repo.timestamps.asList().get(repo.timestamps.getSize() - numPoints), dates.get(0));
+ }
- private static VolatileComponentStatusRepository initRepo(int bufferSize, int offset) {
- VolatileComponentStatusRepository repo = createRepo(bufferSize);
+ @Test
+ public void testFilterDatesUsingStartFilter() {
+ // Filter with date that exactly matches an entry in timestamps buffer
+ Date start = asDate(LocalDateTime.of(1978, 1, 1, 0, 45, 0));
+ List<Date> dates = filledRepo.filterDates(start, null, Integer.MAX_VALUE);
+ assertEquals(start, dates.get(0));
+ assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
+
+ // filter using a date that does not exactly match the time, i.e., not on a five-minute mark
+ start = asDate(LocalDateTime.of(1974, 1, 1, 3, 2, 0));
+ dates = filledRepo.filterDates(start, null, Integer.MAX_VALUE);
+ assertTrue(start.getTime() < dates.get(0).getTime());
+ assertTrue(dates.get(0).getTime() < (start.getTime() + FIVE_MINUTES));
+ assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
+
+ start = asDate(LocalDateTime.of(1970, 1, 1, 0, 0, 0));
+ dates = partiallyFilledRepo.filterDates(start, null, Integer.MAX_VALUE);
+ assertEquals(start, dates.get(0));
+ assertEquals(partiallyFilledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
+ }
+
+ @Test
+ public void testFilterDatesUsingEndFilter() {
+ // Filter with date that exactly matches an entry in timestamps buffer
+ Date end = asDate(LocalDateTime.of(1970, 2, 1, 1, 10, 0));
+ List<Date> dates = filledRepo.filterDates(null, end, Integer.MAX_VALUE);
+ assertEquals(end, dates.get(dates.size() - 1));
+ assertEquals(filledRepo.timestamps.getOldestElement(), dates.get(0));
+
+ // filter using a date that does not exactly match the times in buffer
+ end = asDate(LocalDateTime.of(1970, 2, 1, 1, 7, 0));
+ dates = filledRepo.filterDates(null, end, Integer.MAX_VALUE);
+ assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
+ assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
+ assertEquals(dates.get(0), filledRepo.timestamps.getOldestElement());
+
+ end = asDate(LocalDateTime.of(1970, 1, 2, 1, 7, 0));
+ dates = partiallyFilledRepo.filterDates(null, end, Integer.MAX_VALUE);
+ assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
+ assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
+ assertEquals(partiallyFilledRepo.timestamps.asList().get(0), dates.get(0));
+ }
- for (long i = 0; i < bufferSize - offset; i++) {
- repo.timestamps.add(new Date(i * FIVE_MINUTES));
+ @Test
+ public void testFilterDatesUsingStartAndEndFilter() {
+ // Filter with dates that exactly matches entries in timestamps buffer
+ Date start = asDate(LocalDateTime.of(1975, 3, 1, 3, 15, 0));
+ Date end = asDate(LocalDateTime.of(1978, 4, 2, 4, 25, 0));
+ List<Date> dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
+ assertEquals(start, dates.get(0));
+ assertEquals(end, dates.get(dates.size() - 1));
+
+ // Filter with dates that do not exactly matches entries in timestamps buffer
+ start = asDate(LocalDateTime.of(1975, 3, 1, 3, 3, 0));
+ end = asDate(LocalDateTime.of(1977, 4, 2, 4, 8, 0));
+ dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
+ assertTrue(start.getTime() < dates.get(0).getTime());
+ assertTrue(dates.get(0).getTime() < (start.getTime() + FIVE_MINUTES));
+ assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
+ assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
+
+ start = asDate(LocalDateTime.of(1970, 1, 1, 3, 15, 0));
+ end = asDate(LocalDateTime.of(1970, 1, 2, 4, 25, 0));
+ dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
+ assertEquals(start, dates.get(0));
+ assertEquals(end, dates.get(dates.size() - 1));
}
- assertEquals(bufferSize - offset, repo.timestamps.getSize());
-
- return repo;
- }
-
- private static VolatileComponentStatusRepository createRepo(int bufferSize) {
- final NiFiProperties niFiProperties = Mockito.mock(NiFiProperties.class);
- Mockito.when(niFiProperties.getIntegerProperty(VolatileComponentStatusRepository.NUM_DATA_POINTS_PROPERTY, VolatileComponentStatusRepository.DEFAULT_NUM_DATA_POINTS)).thenReturn(bufferSize);
- return new VolatileComponentStatusRepository(niFiProperties);
- }
-
- private static Date asDate(LocalDateTime localDateTime) {
- return Date.from(localDateTime.toInstant(ZoneOffset.UTC));
- }
-
- @Test
- public void testFilterDatesReturnAll() {
- testFilterDatesReturnAll(filledRepo);
- testFilterDatesReturnAll(partiallyFilledRepo);
- }
-
- private void testFilterDatesReturnAll(VolatileComponentStatusRepository repo) {
- List<Date> dates = repo.filterDates(null, null, Integer.MAX_VALUE);
- assertNotNull(repo.timestamps);
- assertEquals(repo.timestamps.getSize(), dates.size());
- assertEquals(dates, repo.timestamps.asList());
- repo.timestamps.add(new Date());
- }
-
- @Test
- public void testFilterDatesUsingPreferredDataPoints() {
- List<Date> dates = filledRepo.filterDates(null, null, 1);
- assertEquals(1, dates.size());
- assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(0));
-
- testFilterDatesUsingPreferredDataPoints(filledRepo, 14);
- testFilterDatesUsingPreferredDataPoints(partiallyFilledRepo, 22);
- }
-
- private void testFilterDatesUsingPreferredDataPoints(VolatileComponentStatusRepository repo, int numPoints) {
- List<Date> dates = repo.filterDates(null, null, numPoints);
- assertEquals(numPoints, dates.size());
- assertEquals(repo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
- assertEquals(repo.timestamps.asList().get(repo.timestamps.getSize() - numPoints), dates.get(0));
- }
-
- @Test
- public void testFilterDatesUsingStartFilter() {
- // Filter with date that exactly matches an entry in timestamps buffer
- Date start = asDate(LocalDateTime.of(1978, 1, 1, 0, 45, 0));
- List<Date> dates = filledRepo.filterDates(start, null, Integer.MAX_VALUE);
- assertEquals(start, dates.get(0));
- assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
-
- // filter using a date that does not exactly match the time, i.e., not on a five-minute mark
- start = asDate(LocalDateTime.of(1974, 1, 1, 3, 2, 0));
- dates = filledRepo.filterDates(start, null, Integer.MAX_VALUE);
- assertTrue(start.getTime() < dates.get(0).getTime());
- assertTrue(dates.get(0).getTime() < (start.getTime() + FIVE_MINUTES));
- assertEquals(filledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
-
- start = asDate(LocalDateTime.of(1970, 1, 1, 0, 0, 0));
- dates = partiallyFilledRepo.filterDates(start, null, Integer.MAX_VALUE);
- assertEquals(start, dates.get(0));
- assertEquals(partiallyFilledRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
- }
-
- @Test
- public void testFilterDatesUsingEndFilter() {
- // Filter with date that exactly matches an entry in timestamps buffer
- Date end = asDate(LocalDateTime.of(1970, 2, 1, 1, 10, 0));
- List<Date> dates = filledRepo.filterDates(null, end, Integer.MAX_VALUE);
- assertEquals(end, dates.get(dates.size() - 1));
- assertEquals(filledRepo.timestamps.getOldestElement(), dates.get(0));
-
- // filter using a date that does not exactly match the times in buffer
- end = asDate(LocalDateTime.of(1970, 2, 1, 1, 7, 0));
- dates = filledRepo.filterDates(null, end, Integer.MAX_VALUE);
- assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
- assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
- assertEquals(dates.get(0), filledRepo.timestamps.getOldestElement());
-
- end = asDate(LocalDateTime.of(1970, 1, 2, 1, 7, 0));
- dates = partiallyFilledRepo.filterDates(null, end, Integer.MAX_VALUE);
- assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
- assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
- assertEquals(partiallyFilledRepo.timestamps.asList().get(0), dates.get(0));
- }
-
- @Test
- public void testFilterDatesUsingStartAndEndFilter() {
- // Filter with dates that exactly matches entries in timestamps buffer
- Date start = asDate(LocalDateTime.of(1975, 3, 1, 3, 15, 0));
- Date end = asDate(LocalDateTime.of(1978, 4, 2, 4, 25, 0));
- List<Date> dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
- assertEquals(start, dates.get(0));
- assertEquals(end, dates.get(dates.size() - 1));
-
- // Filter with dates that do not exactly matches entries in timestamps buffer
- start = asDate(LocalDateTime.of(1975, 3, 1, 3, 3, 0));
- end = asDate(LocalDateTime.of(1977, 4, 2, 4, 8, 0));
- dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
- assertTrue(start.getTime() < dates.get(0).getTime());
- assertTrue(dates.get(0).getTime() < (start.getTime() + FIVE_MINUTES));
- assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
- assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
-
- start = asDate(LocalDateTime.of(1970, 1, 1, 3, 15, 0));
- end = asDate(LocalDateTime.of(1970, 1, 2, 4, 25, 0));
- dates = filledRepo.filterDates(start, end, Integer.MAX_VALUE);
- assertEquals(start, dates.get(0));
- assertEquals(end, dates.get(dates.size() - 1));
- }
-
- @Test
- public void testFilterDatesUsingStartEndAndPreferredFilter() {
- // Filter with dates that exactly matches entries in timestamps buffer
- int numPoints = 5;
- Date start = asDate(LocalDateTime.of(1977, 1, 1, 0, 30, 0));
- Date end = asDate(LocalDateTime.of(1977, 2, 1, 1, 0, 0));
- List<Date> dates = filledRepo.filterDates(start, end, numPoints);
- assertEquals(numPoints, dates.size());
- assertEquals(dates.get(dates.size() - 1), end);
- assertEquals(dates.get(dates.size() - numPoints), new Date(end.getTime() - (numPoints - 1) * FIVE_MINUTES));
-
- // Filter with dates that do not exactly matches entries in timestamps buffer
- start = asDate(LocalDateTime.of(1975, 1, 1, 0, 31, 0));
- end = asDate(LocalDateTime.of(1978, 2, 1, 1, 59, 0));
- dates = filledRepo.filterDates(start, end, numPoints);
- assertTrue(dates.get(0).getTime() < new Date(end.getTime() - (numPoints - 1) * FIVE_MINUTES).getTime());
- assertTrue(new Date(end.getTime() - (numPoints * FIVE_MINUTES)).getTime() < dates.get(0).getTime());
- assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
- assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
- assertEquals(numPoints, dates.size());
-
- start = asDate(LocalDateTime.of(1970, 1, 1, 0, 31, 0));
- end = asDate(LocalDateTime.of(1970, 1, 1, 1, 59, 0));
- dates = partiallyFilledRepo.filterDates(start, end, numPoints);
- assertTrue(dates.get(0).getTime() < new Date(end.getTime() - (numPoints - 1) * FIVE_MINUTES).getTime());
- assertTrue(new Date(end.getTime() - (numPoints * FIVE_MINUTES)).getTime() < dates.get(0).getTime());
- assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
- assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
- assertEquals(numPoints, dates.size());
- }
-
- @Test
- public void testFilterWorksWithCircularBuffer() {
- // Fill repo3 with Date objects at five-minute intervals
- // This repository is used to verify circular actions behave as expected.
- for (int i = 0; i < BUFSIZE3 + 15; i++) {
- emptyRepo.timestamps.add(new Date(i * FIVE_MINUTES));
- List<Date> dates = emptyRepo.filterDates(null, null, Integer.MAX_VALUE);
- if (i < BUFSIZE3 - 1) {
- assertNull(emptyRepo.timestamps.getOldestElement());
- } else {
- assertEquals(emptyRepo.timestamps.getOldestElement(), dates.get(0));
- }
- assertEquals(emptyRepo.timestamps.asList().get(0), dates.get(0));
- assertEquals(emptyRepo.timestamps.getNewestElement(), dates.get(dates.size() - 1));
+
+ @Test
+ public void testFilterDatesUsingStartEndAndPreferredFilter() {
+ // Filter with dates that exactly matches entries in timestamps buffer
+ int numPoints = 5;
+ Date start = asDate(LocalDateTime.of(1977, 1, 1, 0, 30, 0));
+ Date end = asDate(LocalDateTime.of(1977, 2, 1, 1, 0, 0));
+ List<Date> dates = filledRepo.filterDates(start, end, numPoints);
+ assertEquals(numPoints, dates.size());
+ assertEquals(dates.get(dates.size() - 1), end);
+ assertEquals(dates.get(dates.size() - numPoints), new Date(end.getTime() - (numPoints - 1) * FIVE_MINUTES));
+
+ // Filter with dates that do not exactly matches entries in timestamps buffer
+ start = asDate(LocalDateTime.of(1975, 1, 1, 0, 31, 0));
+ end = asDate(LocalDateTime.of(1978, 2, 1, 1, 59, 0));
+ dates = filledRepo.filterDates(start, end, numPoints);
+ assertTrue(dates.get(0).getTime() < new Date(end.getTime() - (numPoints - 1) * FIVE_MINUTES).getTime());
+ assertTrue(new Date(end.getTime() - (numPoints * FIVE_MINUTES)).getTime() < dates.get(0).getTime());
+ assertTrue(dates.get(dates.size() - 1).getTime() < end.getTime());
+ assertTrue((end.getTime() - FIVE_MINUTES) < dates.get(dates.size() - 1).getTime());
... 12639 lines suppressed ...