Github user julienledem commented on a diff in the pull request:
https://github.com/apache/drill/pull/246#discussion_r44204801
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java
---
@@ -92,10 +118,39 @@
logger.warn("Failure initializing storage config named '{}' of
type '{}'.", e.getKey(), e.getValue().getClass().getName(), e1);
}
}
-
}
+ this.configuredPlugins = Collections.unmodifiableMap(plugins);
+ }
+
+ /**
+ * @param name the name of the formatplugin instance in the drill config
+ * @return The configured FormatPlugin for this name
+ */
+ FormatPlugin getFormatPluginByName(String name) {
+ return configuredPlugins.get(name);
+ }
- return plugins;
+ /**
+ * @return all the format plugins from the Drill config
+ */
+ Collection<FormatPlugin> getConfiguredFormatPlugins() {
+ return configuredPlugins.values();
}
+ /**
+ * Instantiate a new format plugin instance from the provided config
object
+ * @param fpconfig the conf for the plugin
+ * @return the newly created instance of a FormatPlugin based on
provided config
+ */
+ FormatPlugin newFormatPlugin(FormatPluginConfig fpconfig) {
+ Constructor<?> c = configConstructors.get(fpconfig.getClass());
+ if (c == null) {
+ throw new RuntimeException("Unable to find constructor for storage
config of type " + fpconfig.getClass().getName());
+ }
+ try {
+ return (FormatPlugin) c.newInstance(null, context, fsConf,
storageConfig, fpconfig);
+ } catch (InstantiationException | IllegalAccessException |
IllegalArgumentException | InvocationTargetException e1) {
+ throw new RuntimeException("Failure initializing storage config of
type " + fpconfig.getClass().getName(), e1);
--- End diff --
todo: exception
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---