[ 
https://issues.apache.org/jira/browse/HADOOP-18820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746573#comment-17746573
 ] 

ASF GitHub Bot commented on HADOOP-18820:
-----------------------------------------

ahmarsuhail commented on code in PR #5872:
URL: https://github.com/apache/hadoop/pull/5872#discussion_r1272548061


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/adapter/AwsV1BindingSupport.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.hadoop.fs.s3a.adapter;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Optional;
+import javax.annotation.Nullable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.s3a.Tristate;
+
+/**
+ * Binding support; the sole way which the rest of the code should instantiate 
v1 SDK libraries.
+ * Uses this class's Classloader for its analysis/loading.
+ */
+@SuppressWarnings("StaticNonFinalField")
+public class AwsV1BindingSupport {
+
+  private static final Logger LOG = LoggerFactory.getLogger(
+      AwsV1BindingSupport.class);
+
+  public static final String CREDENTIAL_PROVIDER_CLASSNAME =
+      "com.amazonaws.auth.AWSCredentialsProvider";
+
+  public static final String NOT_AWS_PROVIDER =
+      "does not implement AWSCredentialsProvider";
+
+  public static final String NOT_AWS_V2_PROVIDER =
+      "does not implement AwsCredentialsProvider";
+
+  public static final String ABSTRACT_PROVIDER =
+      "is abstract and therefore cannot be created";

Review Comment:
   these constants are unused



##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/adapter/AwsV1BindingSupport.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.hadoop.fs.s3a.adapter;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Optional;
+import javax.annotation.Nullable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.s3a.Tristate;
+
+/**
+ * Binding support; the sole way which the rest of the code should instantiate 
v1 SDK libraries.
+ * Uses this class's Classloader for its analysis/loading.
+ */
+@SuppressWarnings("StaticNonFinalField")
+public class AwsV1BindingSupport {
+
+  private static final Logger LOG = LoggerFactory.getLogger(
+      AwsV1BindingSupport.class);
+
+  public static final String CREDENTIAL_PROVIDER_CLASSNAME =
+      "com.amazonaws.auth.AWSCredentialsProvider";
+
+  public static final String NOT_AWS_PROVIDER =
+      "does not implement AWSCredentialsProvider";
+
+  public static final String NOT_AWS_V2_PROVIDER =
+      "does not implement AwsCredentialsProvider";
+
+  public static final String ABSTRACT_PROVIDER =
+      "is abstract and therefore cannot be created";
+
+  /**
+   * Tack availability.
+   */
+  private static Tristate sdkAvailability = Tristate.UNKNOWN;
+
+  @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
+  private static Class<?> credentialProviderClass;
+
+  static {
+    isAwsV1SdkAvailable();
+  }
+
+  /**
+   * Is the AWS v1 SDK available
+   * @param cl classloader to look in.

Review Comment:
   nit: no params in the method, update javadocs





> AWS SDK v2: make the v1 bridging support optional
> -------------------------------------------------
>
>                 Key: HADOOP-18820
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18820
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>    Affects Versions: 3.4.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Major
>              Labels: pull-request-available
>
> The AWS SDK v2 code includes the v1 sdk core for plugin support of
> * existing credential providers
> * delegation token binding
> I propose we break #2 and rely on those who have implemented to to upgrade. 
> apart from all the needless changes the v2 SDK did to the api (why?) this is 
> fairly straighforward
> for #1: fix through reflection, retaining a v1 sdk dependency at test time so 
> we can verify that the binder works. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to