drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [2/8] drill git commit: DRILL-4361: Let FileSystemPlugin FormatCreator class be overridable by subclasses
Date Tue, 09 Feb 2016 00:26:53 GMT
DRILL-4361: Let FileSystemPlugin FormatCreator class be overridable by subclasses

Allow for FileSystemPlugin subclasses to customize FormatPlugin by injecting
their own version of FormatCreator.

This closes #365.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/5e57b0e3
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/5e57b0e3
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/5e57b0e3

Branch: refs/heads/master
Commit: 5e57b0e3b44f46aa93bf82f366eb3a3f61990da3
Parents: 6b1b4d2
Author: Laurent Goujon <laurent@dremio.com>
Authored: Fri Feb 5 14:38:10 2016 -0800
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Sat Feb 6 18:33:30 2016 -0800

----------------------------------------------------------------------
 .../drill/exec/store/dfs/FileSystemPlugin.java      | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/5e57b0e3/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
index ac30410..6a9bddb 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
@@ -73,7 +73,7 @@ public class FileSystemPlugin extends AbstractStoragePlugin{
       fsConf.set("fs.classpath.impl", ClassPathFileSystem.class.getName());
       fsConf.set("fs.drill-local.impl", LocalSyncableFileSystem.class.getName());
 
-      formatCreator = new FormatCreator(context, fsConf, config, context.getClasspathScan());
+      formatCreator = newFormatCreator(config, context, fsConf);
       List<FormatMatcher> matchers = Lists.newArrayList();
       formatPluginsByConfig = Maps.newHashMap();
       for (FormatPlugin p : formatCreator.getConfiguredFormatPlugins()) {
@@ -100,6 +100,20 @@ public class FileSystemPlugin extends AbstractStoragePlugin{
     }
   }
 
+  /**
+   * Creates a new FormatCreator instance.
+   *
+   * To be used by subclasses to return custom formats if required.
+   * Note that this method is called by the constructor, which fields may not be initialized
yet.
+   *
+   * @param config the plugin configuration
+   * @param context the drillbit context
+   * @return a new FormatCreator instance
+   */
+  protected FormatCreator newFormatCreator(FileSystemConfig config, DrillbitContext context,
Configuration fsConf) {
+    return new FormatCreator(context, fsConf, config, context.getClasspathScan());
+  }
+
   @Override
   public boolean supportsRead() {
     return true;


Mime
View raw message