arina-ielchiieva commented on a change in pull request #1988: DRILL-7590: 
Refactor plugin registry
URL: https://github.com/apache/drill/pull/1988#discussion_r383992825
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/ConnectorHandle.java
 ##########
 @@ -0,0 +1,81 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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;
+
+import org.apache.drill.common.logical.StoragePluginConfig;
+import org.apache.drill.exec.store.PluginHandle.PluginType;
+import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
+
+/**
+ * Defines a storage connector: a storage plugin config along with the
+ * locator which can create a plugin instance given an instance of the
+ * config.
+ */
+public class ConnectorHandle {
+
+  private final ConnectorLocator locator;
+  private final Class<? extends StoragePluginConfig> configClass;
+
+  /**
+   * Intrinsic (system) plugins are created at start-up time and do
+   * not allow additional plugin instances.
+   */
+  private final boolean isIntrinsic;
+
+  public ConnectorHandle(ConnectorLocator locator,
 
 Review comment:
   Is it obvious if we pass config class so it is not intrinsic but if 
StoragePlugin instance it is?
   Maybe it's better to have this done using static methods for better 
readability?
   
   For example:
   
   We'll have only one constructor and two static methods:
   ```
   private ConnectorHandle(ConnectorLocator locator, Class<? extends 
StoragePluginConfig> configClass, boolean isIntrinsic) {
        this.locator = locator;
        this.configClass = configClass;
        this.isIntrinsic = isIntrinsic;
      }
   
   public static ConnectorHandle initIntrinsic(ConnectorLocator locator, 
   Class<? extends StoragePluginConfig> configClass) {
    return new ConnectorHandle(...);
   }
   
   public static ConnectorHandle initNonIntrinsic(ConnectorLocator locator, 
   Class<? extends StoragePluginConfig> configClass) {
    return new ConnectorHandle(...);
   }
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to