alluxio.underfs.obs.ObsClientExt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alluxio-underfs-obs Show documentation
Show all versions of alluxio-underfs-obs Show documentation
Huawei OBS Under File System implementation
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.underfs.obs;
import com.obs.services.ObsClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
* An extension of ObsClient to support config.
*/
public class ObsClientExt extends ObsClient {
private static final Logger LOG = LoggerFactory.getLogger(ObsClientExt.class);
/**
* Construct obs client.
*
* @param accessKey ak in the access key secretKey
* @param secretKey sk in the access key endPoint
* @param endPoint OBS endpoint
* @param conf the map of OBS configuration
*/
public ObsClientExt(String accessKey, String secretKey, String endPoint,
Map conf) {
super(accessKey, secretKey, endPoint);
for (Map.Entry entry : conf.entrySet()) {
obsProperties.setProperty(entry.getKey(),
entry.getValue() == null ? null : entry.getValue().toString());
LOG.debug("Set obs client conf: {}={}", entry.getKey(), entry.getValue());
}
}
}