wang-x-xia commented on a change in pull request #3376:
URL: https://github.com/apache/iceberg/pull/3376#discussion_r808803124



##########
File path: dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.iceberg.dell.ecs;
+
+import java.net.URI;
+import java.util.Objects;
+import java.util.Set;
+import org.apache.iceberg.exceptions.ValidationException;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+
+/**
+ * An immutable record class of ECS location
+ */
+class EcsURI {
+
+  private static final Set<String> VALID_SCHEME = ImmutableSet.of("ecs", "s3", 
"s3a", "s3n");
+
+  private final String location;
+  private final String bucket;
+  private final String name;
+
+  EcsURI(String location) {
+    Preconditions.checkNotNull(location == null, "Location %s can not be 
null", location);
+
+    this.location = location;
+
+    URI uri = URI.create(location);
+    ValidationException.check(
+        VALID_SCHEME.contains(uri.getScheme().toLowerCase()),
+        "Invalid ecs location: %s",
+        location);
+    this.bucket = uri.getHost();
+    this.name = uri.getPath().replaceAll("^/*", "");
+  }
+
+  EcsURI(String bucket, String name) {
+    this.location = String.format("ecs://%s/%s", bucket, name);
+    this.bucket = bucket;
+    this.name = name;
+  }
+
+  /**
+   * Returns ECS bucket name.
+   */
+  public String bucket() {
+    return bucket;
+  }
+
+  /**
+   * Returns ECS object name.
+   */
+  public String name() {
+    return name;
+  }
+
+  /**
+   * Returns original location.
+   */
+  public String location() {
+    return location;
+  }
+
+  @Override
+  public String toString() {
+    return location;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    EcsURI ecsURI = (EcsURI) o;
+    return Objects.equals(location, ecsURI.location) &&

Review comment:
       Removed. I had used this method to implement the mock client and now 
it's unnecessary.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to