[
https://issues.apache.org/jira/browse/DRILL-4603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15239813#comment-15239813
]
ASF GitHub Bot commented on DRILL-4603:
---------------------------------------
Github user adityakishore commented on a diff in the pull request:
https://github.com/apache/drill/pull/476#discussion_r59603934
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPluginImplementationProvider.java
---
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.store.dfs;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import org.apache.drill.common.exceptions.ExecutionSetupException;
+import org.apache.drill.exec.server.DrillbitContext;
+import org.apache.drill.exec.store.ClassPathFileSystem;
+import org.apache.drill.exec.store.LocalSyncableFileSystem;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import static
org.apache.drill.exec.store.dfs.FileSystemSchemaFactory.DEFAULT_WS_NAME;
+
+/**
+ * Provides needed component by the {@link FileSystemPlugin}. This can be
overridden to supply customized components
+ * (such as custom schema factory) to {@link FileSystemPlugin}.
+ */
+public class FileSystemPluginImplementationProvider {
+
+ protected final FileSystemConfig fsConfig;
+ protected final String fsPluginName;
+ protected final DrillbitContext dContext;
+
+ private FormatCreator formatCreator; /** Don't use this directly, use
{@link #getFormatCreator(Configuration)} */
+
+ /**
+ * Instantiate an object
+ * @param dContext {@link DrillbitContext} instance.
+ * @param fsPluginName Name of the FileSystemPlugin storage
+ * @param fsConfig FileSystemPlugin configuration
+ */
+ public FileSystemPluginImplementationProvider(
+ final DrillbitContext dContext,
+ final String fsPluginName,
+ final FileSystemConfig fsConfig) {
+ this.dContext = dContext;
+ this.fsConfig = fsConfig;
+ this.fsPluginName = fsPluginName;
+ }
+
+ /**
+ * @return Return any properties needed for {@link Configuration} object
that are not set in
+ * {@link FileSystemPlugin}'s configuration.
+ */
+ public Map<String, String> getFsProps() {
+ return ImmutableMap.of(
+ "fs.classpath.impl", ClassPathFileSystem.class.getName(),
+ "fs.drill-local.impl", LocalSyncableFileSystem.class.getName()
+ );
+ }
+
+ /**
+ * @return Create and return {@link FormatCreator} based on the storage
plugin configuration.
+ */
+ public FormatCreator getFormatCreator(final Configuration fsConf) {
+ if (formatCreator == null) {
--- End diff --
Is the `FormatCreator` instance tied to some settings in `fsConf`?
If yes, wouldn't a subsequent invocation of this function ignore the passed
`fsConf` with different values of such settings?
> Refactor FileSystem plugin code to allow customizations
> -------------------------------------------------------
>
> Key: DRILL-4603
> URL: https://issues.apache.org/jira/browse/DRILL-4603
> Project: Apache Drill
> Issue Type: Improvement
> Components: Storage - Other
> Reporter: Venki Korukanti
> Assignee: Venki Korukanti
> Fix For: 1.7.0
>
>
> Currently FileSystemPlugin is hard to extend, lot of logic for creating
> component implementations ({{WorkspaceSchemaFactory}}s, {{FormatCreator},
> defining default workspaces and configuration (implicit to FileSystem
> implementation)) are hard coded in constructor.
>
> This JIRA is to track
> * refactoring the FileSystemPlugin to allow custom component implementations
> (Configuration, WorkSpaceSchemaFactory, FileSystemSchemaFactory or
> FormatCreator).
> * Share a single Hadoop {{Configuration}} object to create new
> {{Configuration}} objects. Creating a new {{Configuration}} without an
> existing copy is not efficient, because it involves scanning the classpath
> for *-site files.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)