You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "takraj (via GitHub)" <gi...@apache.org> on 2024/06/05 08:09:31 UTC
Re: [PR] NIFI-13311: Turn DB adapters into controller services [nifi]
takraj commented on code in PR #8892:
URL: https://github.com/apache/nifi/pull/8892#discussion_r1627215863
##########
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:
@joewitt , @exceptionfactory
Do you have any thoughts regarding to this?
--
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-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org