Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("requester-pays", REQUESTER_PAYS.getName());
config.renameProperty("write-s3-user-metadata", WRITE_USER_METADATA.getName());
config.renameProperty("record-writer", RECORD_WRITER.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, TRACKING_STATE_CACHE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, TRACKING_TIME_WINDOW.getName());
config.renameProperty(ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, INITIAL_LISTING_TARGET.getName());
}

protected ListedEntityTracker<ListableEntityWrapper<S3VersionSummary>> createListedEntityTracker() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ public void migrateProperties(PropertyConfiguration config) {
config.renameProperty(AzureStorageUtils.OLD_CONTAINER_DESCRIPTOR_NAME, CONTAINER.getName());
config.renameProperty(AzureStorageUtils.OLD_BLOB_STORAGE_CREDENTIALS_SERVICE_DESCRIPTOR_NAME, AzureStorageUtils.BLOB_STORAGE_CREDENTIALS_SERVICE.getName());
config.renameProperty("blob-name-prefix", BLOB_NAME_PREFIX.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, TRACKING_STATE_CACHE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, TRACKING_TIME_WINDOW.getName());
config.renameProperty(ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, INITIAL_LISTING_TARGET.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.nifi.migration.PropertyConfiguration;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.util.StandardValidators;
import org.apache.nifi.processor.util.list.ListedEntityTracker;
import org.apache.nifi.processors.azure.storage.utils.ADLSFileInfo;
import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
import org.apache.nifi.processors.azure.storage.utils.DataLakeServiceClientFactory;
Expand Down Expand Up @@ -203,6 +204,9 @@ public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("file-filter", FILE_FILTER.getName());
config.renameProperty("path-filter", PATH_FILTER.getName());
config.renameProperty("include-temporary-files", INCLUDE_TEMPORARY_FILES.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, TRACKING_STATE_CACHE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, TRACKING_TIME_WINDOW.getName());
config.renameProperty(ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, INITIAL_LISTING_TARGET.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.nifi.processors.azure.storage;

import org.apache.nifi.processor.util.list.ListedEntityTracker;
import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
import org.apache.nifi.util.PropertyMigrationResult;
import org.apache.nifi.util.TestRunner;
Expand All @@ -34,8 +35,12 @@ void testMigration() {
final Map<String, String> expectedRenamed =
Map.of(AzureStorageUtils.OLD_CONTAINER_DESCRIPTOR_NAME, ListAzureBlobStorage_v12.CONTAINER.getName(),
AzureStorageUtils.OLD_BLOB_STORAGE_CREDENTIALS_SERVICE_DESCRIPTOR_NAME, AzureStorageUtils.BLOB_STORAGE_CREDENTIALS_SERVICE.getName(),
"blob-name-prefix", ListAzureBlobStorage_v12.BLOB_NAME_PREFIX.getName());
"blob-name-prefix", ListAzureBlobStorage_v12.BLOB_NAME_PREFIX.getName(),
ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, ListAzureBlobStorage_v12.TRACKING_STATE_CACHE.getName(),
ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, ListAzureBlobStorage_v12.TRACKING_TIME_WINDOW.getName(),
ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, ListAzureBlobStorage_v12.INITIAL_LISTING_TARGET.getName());

assertEquals(expectedRenamed, propertyMigrationResult.getPropertiesRenamed());
final Map<String, String> actualRenamed = propertyMigrationResult.getPropertiesRenamed();
expectedRenamed.forEach((key, value) -> assertEquals(actualRenamed.get(key), value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("box-folder-id", FOLDER_ID.getName());
config.renameProperty("recursive-search", RECURSIVE_SEARCH.getName());
config.renameProperty("min-age", MIN_AGE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, TRACKING_STATE_CACHE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, TRACKING_TIME_WINDOW.getName());
config.renameProperty(ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, INITIAL_LISTING_TARGET.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("folder", FOLDER.getName());
config.renameProperty("recursive-search", RECURSIVE_SEARCH.getName());
config.renameProperty("min-age", MIN_AGE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_STATE_CACHE_PROPERTY_NAME, TRACKING_STATE_CACHE.getName());
config.renameProperty(ListedEntityTracker.OLD_TRACKING_TIME_WINDOW_PROPERTY_NAME, TRACKING_TIME_WINDOW.getName());
config.renameProperty(ListedEntityTracker.OLD_INITIAL_LISTING_TARGET_PROPERTY_NAME, INITIAL_LISTING_TARGET.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.migration.PropertyConfiguration;
import org.apache.nifi.oauth2.AccessToken;
import org.apache.nifi.oauth2.OAuth2AccessTokenProvider;
import org.apache.nifi.processor.AbstractProcessor;
Expand Down Expand Up @@ -70,48 +71,42 @@ abstract class AbstractEmailProcessor<T extends AbstractMailReceiver> extends Ab
"Use OAuth2 to acquire access token"
);
public static final PropertyDescriptor HOST = new PropertyDescriptor.Builder()
.name("host")
.displayName("Host Name")
.name("Host Name")
.description("Network address of Email server (e.g., pop.gmail.com, imap.gmail.com . . .)")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
public static final PropertyDescriptor PORT = new PropertyDescriptor.Builder()
.name("port")
.displayName("Port")
.name("Port")
.description("Numeric value identifying Port of Email server (e.g., 993)")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.addValidator(StandardValidators.PORT_VALIDATOR)
.build();
public static final PropertyDescriptor AUTHORIZATION_MODE = new PropertyDescriptor.Builder()
.name("authorization-mode")
.displayName("Authorization Mode")
.name("Authorization Mode")
.description("How to authorize sending email on the user's behalf.")
.required(true)
.allowableValues(PASSWORD_BASED_AUTHORIZATION_MODE, OAUTH_AUTHORIZATION_MODE)
.defaultValue(PASSWORD_BASED_AUTHORIZATION_MODE)
.build();
public static final PropertyDescriptor OAUTH2_ACCESS_TOKEN_PROVIDER = new PropertyDescriptor.Builder()
.name("oauth2-access-token-provider")
.displayName("OAuth2 Access Token Provider")
.name("OAuth2 Access Token Provider")
.description("OAuth2 service that can provide access tokens.")
.identifiesControllerService(OAuth2AccessTokenProvider.class)
.dependsOn(AUTHORIZATION_MODE, OAUTH_AUTHORIZATION_MODE)
.required(true)
.build();
public static final PropertyDescriptor USER = new PropertyDescriptor.Builder()
.name("user")
.displayName("User Name")
.name("User Name")
.description("User Name used for authentication and authorization with Email server.")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
public static final PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
.name("password")
.displayName("Password")
.name("Password")
.description("Password used for authentication and authorization with Email server.")
.dependsOn(AUTHORIZATION_MODE, PASSWORD_BASED_AUTHORIZATION_MODE)
.required(true)
Expand All @@ -120,35 +115,31 @@ abstract class AbstractEmailProcessor<T extends AbstractMailReceiver> extends Ab
.sensitive(true)
.build();
public static final PropertyDescriptor FOLDER = new PropertyDescriptor.Builder()
.name("folder")
.displayName("Folder")
.name("Folder")
.description("Email folder to retrieve messages from (e.g., INBOX)")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.defaultValue("INBOX")
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
public static final PropertyDescriptor FETCH_SIZE = new PropertyDescriptor.Builder()
.name("fetch.size")
.displayName("Fetch Size")
.name("Fetch Size")
.description("Specify the maximum number of Messages to fetch per call to Email Server.")
.required(true)
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.defaultValue("10")
.addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
.build();
public static final PropertyDescriptor SHOULD_DELETE_MESSAGES = new PropertyDescriptor.Builder()
.name("delete.messages")
.displayName("Delete Messages")
.name("Delete Messages")
.description("Specify whether mail messages should be deleted after retrieval.")
.required(true)
.allowableValues("true", "false")
.defaultValue("false")
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
.build();
static final PropertyDescriptor CONNECTION_TIMEOUT = new PropertyDescriptor.Builder()
.name("connection.timeout")
.displayName("Connection timeout")
.name("Connection Timeout")
.description("The amount of time to wait to connect to Email server")
.required(true)
.addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
Expand Down Expand Up @@ -238,6 +229,20 @@ public void onTrigger(ProcessContext context, ProcessSession processSession) thr
}
}

@Override
public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("host", HOST.getName());
config.renameProperty("port", PORT.getName());
config.renameProperty("authorization-mode", AUTHORIZATION_MODE.getName());
config.renameProperty("oauth2-access-token-provider", OAUTH2_ACCESS_TOKEN_PROVIDER.getName());
config.renameProperty("user", USER.getName());
config.renameProperty("password", PASSWORD.getName());
config.renameProperty("folder", FOLDER.getName());
config.renameProperty("fetch.size", FETCH_SIZE.getName());
config.renameProperty("delete.messages", SHOULD_DELETE_MESSAGES.getName());
config.renameProperty("connection.timeout", CONNECTION_TIMEOUT.getName());
}

@Override
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
return new PropertyDescriptor.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.migration.PropertyConfiguration;
import org.apache.nifi.processor.AbstractProcessor;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
Expand Down Expand Up @@ -87,8 +88,7 @@ public class ExtractEmailHeaders extends AbstractProcessor {
public static final String EMAIL_ATTACHMENT_COUNT = "email.attachment_count";

public static final PropertyDescriptor CAPTURED_HEADERS = new PropertyDescriptor.Builder()
.name("CAPTURED_HEADERS")
.displayName("Additional Header List")
.name("Additional Header List")
.description("COLON separated list of additional headers to be extracted from the flowfile content." +
"NOTE the header key is case insensitive and will be matched as lower-case." +
" Values will respect email contents.")
Expand All @@ -103,8 +103,7 @@ public class ExtractEmailHeaders extends AbstractProcessor {
private static final AllowableValue NONSTRICT_ADDRESSING = new AllowableValue("false", "Non-Strict Address Parsing",
"Accept emails, even if the address is poorly formed and doesn't strictly comply with RFC Validation.");
public static final PropertyDescriptor STRICT_PARSING = new PropertyDescriptor.Builder()
.name("STRICT_ADDRESS_PARSING")
.displayName("Email Address Parsing")
.name("Email Address Parsing")
.description("If \"strict\", strict address format parsing rules are applied to mailbox and mailbox list fields, " +
"such as \"to\" and \"from\" headers, and FlowFiles with poorly formed addresses will be routed " +
"to the failure relationship, similar to messages that fail RFC compliant format validation. " +
Expand Down Expand Up @@ -229,6 +228,12 @@ public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return PROPERTY_DESCRIPTORS;
}

@Override
public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("CAPTURED_HEADERS", CAPTURED_HEADERS.getName());
config.renameProperty("STRICT_ADDRESS_PARSING", STRICT_PARSING.getName());
}

private static void putAddressListInAttributes(
Map<String, String> attributes,
final String attributePrefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.nifi.components.resource.ResourceType;
import org.apache.nifi.expression.AttributeExpression;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.migration.PropertyConfiguration;
import org.apache.nifi.processor.AbstractProcessor;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.Relationship;
Expand All @@ -46,10 +47,7 @@
public abstract class AbstractEnrichIP extends AbstractProcessor {

public static final PropertyDescriptor GEO_DATABASE_FILE = new PropertyDescriptor.Builder()
// Name has been left untouched so that we don't cause a breaking change
// but ideally this should be renamed to MaxMind Database File or something similar
.name("Geo Database File")
.displayName("MaxMind Database File")
.name("MaxMind Database File")
.description("Path to Maxmind IP Enrichment Database File")
.required(true)
.identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE, ResourceType.DIRECTORY)
Expand Down Expand Up @@ -133,6 +131,11 @@ protected void loadDatabaseFile() throws IOException {
databaseReaderRef.set(reader);
}

@Override
public void migrateProperties(PropertyConfiguration config) {
config.renameProperty("Geo Database File", GEO_DATABASE_FILE.getName());
}

@OnStopped
public void closeReader() throws IOException {
final DatabaseReader reader = databaseReaderRef.get();
Expand Down
Loading