joewitt commented on code in PR #8892:
URL: https://github.com/apache/nifi/pull/8892#discussion_r1621458711
##########
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,
+ // and removing the old 'db-type'.
+ public static final PropertyDescriptor DATABASE_ADAPTER_PROVIDER = new
Builder()
Review Comment:
Yeah so i'm back to my provider vs not provider questions here then. So
here we have a processor property which references a controller service. That
will be a listing of controller services that implement the 'DatabaseAdapter'
api. Then we should just call this the 'database adapter' and the user selects
a particular concrete impl.
We need to have less terms. It is also somewhat confusing given the todo
references a parameter provider and here we're talking about a database adapter
provider. I really don't think we need so many words to describe these
concepts.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]