takraj commented on code in PR #8892: URL: https://github.com/apache/nifi/pull/8892#discussion_r1622011949
########## nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java: ########## @@ -38,37 +26,34 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.ServiceLoader; import java.util.stream.Collectors; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.ConfigVerificationResult; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyDescriptor.Builder; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.db.DatabaseAdapter; +import org.apache.nifi.dbcp.DBCPService; +import org.apache.nifi.logging.ComponentLog; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.util.StringUtils; @Tags({"database", "dbcp", "sql"}) @CapabilityDescription("Fetches parameters from database tables") public class DatabaseParameterProvider extends AbstractParameterProvider implements VerifiableParameterProvider { - protected final static Map<String, DatabaseAdapter> dbAdapters = new HashMap<>(); - - public static final PropertyDescriptor DB_TYPE; - - static { - // Load the DatabaseAdapters - ArrayList<AllowableValue> dbAdapterValues = new ArrayList<>(); - ServiceLoader<DatabaseAdapter> dbAdapterLoader = ServiceLoader.load(DatabaseAdapter.class); - dbAdapterLoader.forEach(it -> { - dbAdapters.put(it.getName(), it); - dbAdapterValues.add(new AllowableValue(it.getName(), it.getName(), it.getDescription())); - }); - - DB_TYPE = new PropertyDescriptor.Builder() - .name("db-type") - .displayName("Database Type") - .description("The type/flavor of database, used for generating database-specific code. In many cases the Generic type " - + "should suffice, but some databases (such as Oracle) require custom SQL clauses. ") - .allowableValues(dbAdapterValues.toArray(new AllowableValue[dbAdapterValues.size()])) - .defaultValue("Generic") - .required(true) - .build(); - } + // TODO: There was no migration facility for Parameter Providers by the time of introducing this property, Review Comment: What would be the good strategy, given that there is no way to apply migration on Parameter Providers? 1. Have the fixed list of Db adapters in the {{DatabaseParameterProvider}}? 2. Replace the fixed list with the new controller service concept, and require a manual migration step from the user after upgrade? 3. Block this commit until the issue is resolved? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org