From bb9a4793d329eb9f2f955bd7b2e05b33b400bf0f Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Tue, 8 Aug 2017 13:36:05 -0700 Subject: [PATCH] HDFS-12259. Ozone: OzoneClient: Refactor move ozone client from hadoop-hdfs to hadoop-hdfs-client. Contributed by Nandakumar. --- .../hadoop/cblock/CBlockConfigKeys.java | 0 .../org/apache/hadoop/ozone/OzoneAcl.java | 5 + .../apache/hadoop/ozone/OzoneConfigKeys.java | 2 +- .../hadoop/ozone/OzoneConfiguration.java | 0 .../hadoop/ozone/client}/OzoneBucket.java | 5 +- .../hadoop/ozone/client}/OzoneClient.java | 9 +- .../ozone/client}/OzoneClientFactory.java | 30 +- .../ozone/client}/OzoneClientUtils.java | 8 +- .../apache/hadoop/ozone/client}/OzoneKey.java | 6 +- .../hadoop/ozone/client}/OzoneVolume.java | 6 +- .../client/io}/ChunkGroupInputStream.java | 7 +- .../client/io}/ChunkGroupOutputStream.java | 12 +- .../ozone/client/io/LengthInputStream.java | 49 ++ .../client/io/OzoneContainerTranslation.java | 51 ++ .../ozone/client}/io/OzoneInputStream.java | 3 +- .../ozone/client}/io/OzoneOutputStream.java | 4 +- .../hadoop/ozone/client}/io/package-info.java | 2 +- .../hadoop/ozone/client/package-info.java | 23 + .../ozone/client/rest/OzoneRestClient.java | 510 ++++++++++++++++++ .../ozone/client/rest}/headers/Header.java | 2 +- .../client/rest}/headers/package-info.java | 2 +- .../ozone/client/rest/package-info.java | 23 + .../ozone/client/rpc/OzoneRpcClient.java} | 52 +- .../hadoop/ozone/client/rpc/package-info.java | 23 + .../hadoop/ozone/ksm/KSMConfigKeys.java | 0 .../ksm/helpers/KsmBucketArgs.java | 2 +- .../ksm/helpers/KsmBucketInfo.java | 2 +- .../{ => ozone}/ksm/helpers/KsmKeyArgs.java | 2 +- .../{ => ozone}/ksm/helpers/KsmKeyInfo.java | 2 +- .../ksm/helpers/KsmKeyLocationInfo.java | 2 +- .../ksm/helpers/KsmOzoneAclMap.java | 2 +- .../ksm/helpers/KsmVolumeArgs.java | 2 +- .../{ => ozone}/ksm/helpers/VolumeArgs.java | 2 +- .../{ => ozone}/ksm/helpers/package-info.java | 2 +- .../hadoop/{ => ozone}/ksm/package-info.java | 2 +- .../ksm/protocol/KeySpaceManagerProtocol.java | 12 +- .../ksm/protocol/package-info.java | 2 +- ...ManagerProtocolClientSideTranslatorPB.java | 14 +- .../protocolPB/KeySpaceManagerProtocolPB.java | 2 +- .../ksm/protocolPB/package-info.java | 2 +- .../org/apache/hadoop/scm/TestArchive.java | 0 .../org/apache/hadoop/scm/package-info.java | 0 .../apache/hadoop/cblock/CBlockManager.java | 2 +- .../cblock/client/CBlockVolumeClient.java | 2 +- .../server/datanode/ObjectStoreHandler.java | 12 +- .../statemachine/DatanodeStateMachine.java | 2 +- .../statemachine/EndpointStateMachine.java | 2 +- .../statemachine/SCMConnectionManager.java | 2 +- .../states/datanode/InitDatanodeState.java | 2 +- .../hadoop/ozone/ksm/BucketManager.java | 4 +- .../hadoop/ozone/ksm/BucketManagerImpl.java | 4 +- .../apache/hadoop/ozone/ksm/KeyManager.java | 4 +- .../hadoop/ozone/ksm/KeyManagerImpl.java | 6 +- .../hadoop/ozone/ksm/KeySpaceManager.java | 16 +- .../hadoop/ozone/ksm/MetadataManager.java | 6 +- .../hadoop/ozone/ksm/MetadataManagerImpl.java | 6 +- .../hadoop/ozone/ksm/VolumeManager.java | 2 +- .../hadoop/ozone/ksm/VolumeManagerImpl.java | 8 +- ...ManagerProtocolServerSideTranslatorPB.java | 18 +- .../ozone/scm/StorageContainerManager.java | 2 +- .../hadoop/ozone/scm/node/SCMNodeManager.java | 2 +- .../hadoop/ozone/web/OzoneHttpServer.java | 2 +- .../hadoop/ozone/web/client/OzoneBucket.java | 4 +- .../ozone/web/client/OzoneRestClient.java | 4 +- .../hadoop/ozone/web/client/OzoneVolume.java | 4 +- .../ozone/web/handlers/BucketHandler.java | 2 +- .../web/handlers/BucketProcessTemplate.java | 2 +- .../hadoop/ozone/web/handlers/KeyHandler.java | 4 +- .../web/handlers/KeyProcessTemplate.java | 2 +- .../ozone/web/handlers/ServiceFilter.java | 2 +- .../ozone/web/handlers/VolumeHandler.java | 2 +- .../hadoop/ozone/web/interfaces/Bucket.java | 2 +- .../hadoop/ozone/web/interfaces/Keys.java | 2 +- .../ozone/web/interfaces/StorageHandler.java | 2 +- .../hadoop/ozone/web/interfaces/Volume.java | 2 +- .../web/localstorage/LocalStorageHandler.java | 2 +- .../localstorage/OzoneMetadataManager.java | 2 +- .../LengthInputStreamMessageBodyWriter.java | 2 +- .../web/ozShell/keys/ListKeyHandler.java | 2 - .../hadoop/ozone/web/request/OzoneQuota.java | 2 +- .../storage/DistributedStorageHandler.java | 19 +- .../storage/OzoneContainerTranslation.java | 261 --------- .../hadoop/ozone/web/userauth/Simple.java | 2 +- .../hadoop/ozone/web/utils/OzoneUtils.java | 4 +- .../java/org/apache/hadoop/ozone/Corona.java | 6 +- .../{ => client}/TestOzoneClientUtils.java | 40 +- .../hadoop/ozone/client/package-info.java | 23 + .../rpc/TestOzoneRpcClient.java} | 23 +- .../hadoop/ozone/client/rpc/package-info.java | 23 + .../ozoneimpl/TestOzoneContainer.java | 1 - .../ozone/ksm/TestBucketManagerImpl.java | 4 +- .../hadoop/ozone/ksm/TestChunkStreams.java | 4 +- .../hadoop/ozone/web/TestOzoneHelper.java | 2 +- .../hadoop/ozone/web/TestOzoneWebAccess.java | 2 +- .../hadoop/ozone/web/client/TestVolume.java | 2 +- 95 files changed, 989 insertions(+), 461 deletions(-) rename hadoop-hdfs-project/{hadoop-hdfs => hadoop-hdfs-client}/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java (100%) rename hadoop-hdfs-project/{hadoop-hdfs => hadoop-hdfs-client}/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java (99%) rename hadoop-hdfs-project/{hadoop-hdfs => hadoop-hdfs-client}/src/main/java/org/apache/hadoop/ozone/OzoneConfiguration.java (100%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneBucket.java (95%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneClient.java (97%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneClientFactory.java (68%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneClientUtils.java (99%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneKey.java (93%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/OzoneVolume.java (93%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io}/ChunkGroupInputStream.java (96%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io}/ChunkGroupOutputStream.java (96%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/LengthInputStream.java create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneContainerTranslation.java rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/io/OzoneInputStream.java (93%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/io/OzoneOutputStream.java (94%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client}/io/package-info.java (95%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/package-info.java create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/OzoneRestClient.java rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest}/headers/Header.java (98%) rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest}/headers/package-info.java (94%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/package-info.java rename hadoop-hdfs-project/{hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java => hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClient.java} (91%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/package-info.java rename hadoop-hdfs-project/{hadoop-hdfs => hadoop-hdfs-client}/src/main/java/org/apache/hadoop/ozone/ksm/KSMConfigKeys.java (100%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmBucketArgs.java (99%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmBucketInfo.java (99%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmKeyArgs.java (98%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmKeyInfo.java (99%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmKeyLocationInfo.java (98%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmOzoneAclMap.java (98%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/KsmVolumeArgs.java (99%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/VolumeArgs.java (98%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/helpers/package-info.java (94%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/package-info.java (96%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/protocol/KeySpaceManagerProtocol.java (95%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/protocol/package-info.java (94%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java (98%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/protocolPB/KeySpaceManagerProtocolPB.java (96%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/{ => ozone}/ksm/protocolPB/package-info.java (94%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/{src => }/test/java/org/apache/hadoop/scm/TestArchive.java (100%) rename hadoop-hdfs-project/hadoop-hdfs-client/src/{src => }/test/java/org/apache/hadoop/scm/package-info.java (100%) delete mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/OzoneContainerTranslation.java rename hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/{ => client}/TestOzoneClientUtils.java (92%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/package-info.java rename hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/{TestOzoneClientImpl.java => client/rpc/TestOzoneRpcClient.java} (94%) create mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/package-info.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/cblock/CBlockConfigKeys.java diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneAcl.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneAcl.java index 0aca0addc81..d7120746f5d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneAcl.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneAcl.java @@ -84,6 +84,11 @@ public class OzoneAcl { return new OzoneAcl(aclType, parts[1], rights); } + @Override + public String toString() { + return type+":" + name + ":" + rights; + } + /** * Returns a hash code value for the object. This method is * supported for the benefit of hash tables. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java index 8c7ac7eb7ca..55b5f88391f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java @@ -110,7 +110,7 @@ public final class OzoneConfigKeys { public static final String OZONE_SCM_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL = "ozone.web.authentication.kerberos.principal"; - + /** * There is no need to instantiate this class. */ diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneConfiguration.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConfiguration.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneConfiguration.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConfiguration.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneBucket.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java similarity index 95% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneBucket.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java index 51eefdc47d8..bfd571453c3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneBucket.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java @@ -16,11 +16,12 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.OzoneAcl; import org.apache.hadoop.ozone.OzoneConsts.Versioning; import java.util.List; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClient.java similarity index 97% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClient.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClient.java index dd52a5721f0..a7808d8d3de 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClient.java @@ -15,12 +15,13 @@ * the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; import org.apache.hadoop.fs.StorageType; +import org.apache.hadoop.ozone.OzoneAcl; import org.apache.hadoop.ozone.OzoneConsts.Versioning; -import org.apache.hadoop.ozone.io.OzoneInputStream; -import org.apache.hadoop.ozone.io.OzoneOutputStream; +import org.apache.hadoop.ozone.client.io.OzoneInputStream; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; import java.io.IOException; import java.util.Iterator; @@ -237,7 +238,7 @@ public interface OzoneClient { * @throws IOException */ void createBucket(String volumeName, String bucketName, - OzoneConsts.Versioning versioning, + Versioning versioning, StorageType storageType, OzoneAcl... acls) throws IOException; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientFactory.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java similarity index 68% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientFactory.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java index 7866f58ce00..b098be9b1a6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientFactory.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java @@ -16,9 +16,12 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.ozone.OzoneConfiguration; +import org.apache.hadoop.ozone.client.rest.OzoneRestClient; +import org.apache.hadoop.ozone.client.rpc.OzoneRpcClient; import java.io.IOException; @@ -34,6 +37,18 @@ public final class OzoneClientFactory { private static Configuration configuration; + /** + * Returns an OzoneClient which will use RPC protocol to perform + * client operations. + * + * @return OzoneClient + * @throws IOException + */ + public static OzoneClient getClient() throws IOException { + //TODO: get client based on ozone.client.protocol + return new OzoneRpcClient(getConfiguration()); + } + /** * Returns an OzoneClient which will use RPC protocol to perform * client operations. @@ -42,7 +57,18 @@ public final class OzoneClientFactory { * @throws IOException */ public static OzoneClient getRpcClient() throws IOException { - return new OzoneClientImpl(getConfiguration()); + return new OzoneRpcClient(getConfiguration()); + } + + /** + * Returns an OzoneClient which will use RPC protocol to perform + * client operations. + * + * @return OzoneClient + * @throws IOException + */ + public static OzoneClient getRestClient() throws IOException { + return new OzoneRestClient(getConfiguration()); } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientUtils.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientUtils.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientUtils.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientUtils.java index d92f49f555c..9390a8559aa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientUtils.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientUtils.java @@ -15,7 +15,7 @@ * the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; import com.google.common.base.Optional; @@ -25,6 +25,8 @@ import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; +import org.apache.hadoop.ozone.OzoneConfigKeys; +import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.scm.ScmConfigKeys; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpRequestBase; @@ -189,8 +191,8 @@ public final class OzoneClientUtils { throw new IllegalArgumentException( ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY + " must be defined. See" + - " https://wiki.apache.org/hadoop/Ozone#Configuration for details" + - " on configuring Ozone."); + " https://wiki.apache.org/hadoop/Ozone#Configuration" + + " for details on configuring Ozone."); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneKey.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneKey.java similarity index 93% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneKey.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneKey.java index b6b62d2b0b6..368736ae38c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneKey.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneKey.java @@ -16,10 +16,10 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyLocationInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyLocationInfo; import java.util.List; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneVolume.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java similarity index 93% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneVolume.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java index 3a5e886225f..9c2ec3d8fee 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneVolume.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java @@ -16,10 +16,10 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; -import org.apache.hadoop.ksm.helpers.KsmOzoneAclMap; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmOzoneAclMap; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; /** * A class that encapsulates OzoneVolume. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java similarity index 96% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupInputStream.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java index 12df012212c..8e4ce92d5f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupInputStream.java @@ -15,14 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ozone.web.storage; +package org.apache.hadoop.ozone.client.io; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.ozone.protocol.proto.ContainerProtos; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyLocationInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyLocationInfo; import org.apache.hadoop.scm.XceiverClientManager; import org.apache.hadoop.scm.XceiverClientSpi; import org.apache.hadoop.scm.container.common.helpers.Pipeline; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupOutputStream.java similarity index 96% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupOutputStream.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupOutputStream.java index 59c2639804b..2cc12f4cfc5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkGroupOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/ChunkGroupOutputStream.java @@ -15,18 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ozone.web.storage; +package org.apache.hadoop.ozone.client.io; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.ozone.protocol.proto.ContainerProtos.Result; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyLocationInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyLocationInfo; import org.apache.hadoop.scm.XceiverClientManager; import org.apache.hadoop.scm.XceiverClientSpi; import org.apache.hadoop.scm.container.common.helpers.Pipeline; -import org.apache.hadoop.scm.container.common.helpers.StorageContainerException; -import org.apache.hadoop.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB; +import org.apache.hadoop.scm.container.common.helpers + .StorageContainerException; +import org.apache.hadoop.scm.protocolPB + .StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.scm.storage.ChunkOutputStream; import org.apache.hadoop.scm.storage.ContainerProtocolCalls; import org.slf4j.Logger; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/LengthInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/LengthInputStream.java new file mode 100644 index 00000000000..baf1887c468 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/LengthInputStream.java @@ -0,0 +1,49 @@ +/** + * 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.ozone.client.io; + +import java.io.FilterInputStream; +import java.io.InputStream; + +/** + * An input stream with length. + */ +public class LengthInputStream extends FilterInputStream { + + private final long length; + + /** + * Create an stream. + * @param in the underlying input stream. + * @param length the length of the stream. + */ + public LengthInputStream(InputStream in, long length) { + super(in); + this.length = length; + } + + /** @return the length. */ + public long getLength() { + return length; + } + + public InputStream getWrappedStream() { + return in; + } +} diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneContainerTranslation.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneContainerTranslation.java new file mode 100644 index 00000000000..ca6f7aa260e --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneContainerTranslation.java @@ -0,0 +1,51 @@ +/* + * 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.ozone.client.io; + + +import org.apache.hadoop.hdfs.ozone.protocol.proto.ContainerProtos.KeyData; + +/** + * This class contains methods that define the translation between the Ozone + * domain model and the storage container domain model. + */ +final class OzoneContainerTranslation { + + /** + * Creates key data intended for reading a container key. + * + * @param containerName container name + * @param containerKey container key + * @return KeyData intended for reading the container key + */ + public static KeyData containerKeyDataForRead(String containerName, + String containerKey) { + return KeyData + .newBuilder() + .setContainerName(containerName) + .setName(containerKey) + .build(); + } + + /** + * There is no need to instantiate this class. + */ + private OzoneContainerTranslation() { + } +} diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java similarity index 93% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneInputStream.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java index 65d5d1b41b7..9551cdb48b8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneInputStream.java @@ -15,9 +15,8 @@ * the License. */ -package org.apache.hadoop.ozone.io; +package org.apache.hadoop.ozone.client.io; -import org.apache.hadoop.ozone.web.storage.ChunkGroupInputStream; import org.apache.hadoop.scm.storage.ChunkInputStream; import java.io.IOException; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneOutputStream.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java index 2421c4a84e8..5e2ad947781 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/OzoneOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneOutputStream.java @@ -15,9 +15,7 @@ * the License. */ -package org.apache.hadoop.ozone.io; - -import org.apache.hadoop.ozone.web.storage.ChunkGroupOutputStream; +package org.apache.hadoop.ozone.client.io; import java.io.IOException; import java.io.OutputStream; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/package-info.java similarity index 95% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/package-info.java index b56e367ebc0..493ece8074e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/io/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/io/package-info.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.ozone.io; +package org.apache.hadoop.ozone.client.io; /** * This package contains Ozone I/O classes. diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/package-info.java new file mode 100644 index 00000000000..7e2591a20ee --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/package-info.java @@ -0,0 +1,23 @@ +/** + * 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.ozone.client; + +/** + * This package contains Ozone Client classes. + */ \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/OzoneRestClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/OzoneRestClient.java new file mode 100644 index 00000000000..4955002c254 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/OzoneRestClient.java @@ -0,0 +1,510 @@ +/** + * 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.ozone.client.rest; + +import com.google.common.base.Preconditions; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.StorageType; +import org.apache.hadoop.ozone.OzoneAcl; +import org.apache.hadoop.ozone.OzoneConfiguration; +import org.apache.hadoop.ozone.OzoneConsts; +import org.apache.hadoop.ozone.OzoneConsts.Versioning; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneKey; +import org.apache.hadoop.ozone.client.OzoneVolume; +import org.apache.hadoop.ozone.client.io.OzoneInputStream; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; +import org.apache.hadoop.ozone.ksm.KSMConfigKeys; +import org.apache.hadoop.ozone.client.rest.headers.Header; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.util.Time; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.core.HttpHeaders; +import java.io.Closeable; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Set; + +import static java.net.HttpURLConnection.HTTP_CREATED; +import static java.net.HttpURLConnection.HTTP_OK; + +/** + * Ozone REST Client Implementation, it connects Ozone Handler to execute + * client calls. This uses REST protocol for the communication with server. + */ +public class OzoneRestClient implements OzoneClient, Closeable { + + private static final Logger LOG = + LoggerFactory.getLogger(OzoneRestClient.class); + + private static final String SCHEMA = "http://"; + private static final int DEFAULT_OZONE_PORT = 50070; + + private final URI uri; + private final UserGroupInformation ugi; + private final OzoneAcl.OzoneACLRights userRights; + private final OzoneAcl.OzoneACLRights groupRights; + + + /** + * Creates OzoneRpcClient instance with new OzoneConfiguration. + * + * @throws IOException + */ + public OzoneRestClient() throws IOException, URISyntaxException { + this(new OzoneConfiguration()); + } + + /** + * Creates OzoneRpcClient instance with the given configuration. + * + * @param conf + * + * @throws IOException + */ + public OzoneRestClient(Configuration conf) + throws IOException { + Preconditions.checkNotNull(conf); + this.ugi = UserGroupInformation.getCurrentUser(); + this.userRights = conf.getEnum(KSMConfigKeys.OZONE_KSM_USER_RIGHTS, + KSMConfigKeys.OZONE_KSM_USER_RIGHTS_DEFAULT); + this.groupRights = conf.getEnum(KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS, + KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS_DEFAULT); + + //TODO: get uri from property ozone.reset.servers + URIBuilder ozoneURI = null; + try { + ozoneURI = new URIBuilder(SCHEMA + "localhost"); + if (ozoneURI.getPort() == 0) { + ozoneURI.setPort(DEFAULT_OZONE_PORT); + } + uri = ozoneURI.build(); + } catch (URISyntaxException e) { + throw new IOException(e); + } + } + + @Override + public void createVolume(String volumeName) + throws IOException { + createVolume(volumeName, ugi.getUserName()); + } + + @Override + public void createVolume(String volumeName, String owner) + throws IOException { + + createVolume(volumeName, owner, OzoneConsts.MAX_QUOTA_IN_BYTES, + (OzoneAcl[])null); + } + + @Override + public void createVolume(String volumeName, String owner, + OzoneAcl... acls) + throws IOException { + createVolume(volumeName, owner, OzoneConsts.MAX_QUOTA_IN_BYTES, acls); + } + + @Override + public void createVolume(String volumeName, String owner, + long quota) + throws IOException { + createVolume(volumeName, owner, quota, (OzoneAcl[])null); + } + + @Override + public void createVolume(String volumeName, String owner, + long quota, OzoneAcl... acls) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(owner); + Preconditions.checkNotNull(quota); + Preconditions.checkState(quota >= 0); + + Set aclSet = new HashSet<>(); + + if(acls != null) { + aclSet.addAll(Arrays.asList(acls)); + } + + LOG.info("Creating Volume: {}, with {} as owner and " + + "quota set to {} bytes.", volumeName, owner, quota); + HttpPost httpPost = null; + HttpEntity entity = null; + try (CloseableHttpClient httpClient = OzoneClientUtils.newHttpClient()) { + URIBuilder builder = new URIBuilder(uri); + builder.setPath("/" + volumeName); + String quotaString = quota + Header.OZONE_QUOTA_BYTES; + builder.setParameter(Header.OZONE_QUOTA_QUERY_TAG, quotaString); + httpPost = getHttpPost(owner, builder.build().toString()); + for (OzoneAcl acl : aclSet) { + httpPost.addHeader( + Header.OZONE_ACLS, Header.OZONE_ACL_ADD + " " + acl.toString()); + } + + HttpResponse response = httpClient.execute(httpPost); + entity = response.getEntity(); + int errorCode = response.getStatusLine().getStatusCode(); + if ((errorCode == HTTP_OK) || (errorCode == HTTP_CREATED)) { + return; + } + if (entity != null) { + throw new IOException(EntityUtils.toString(entity)); + } else { + throw new IOException("Unexpected null in http payload"); + } + } catch (URISyntaxException | IllegalArgumentException ex) { + throw new IOException(ex.getMessage()); + } finally { + EntityUtils.consume(entity); + OzoneClientUtils.releaseConnection(httpPost); + } + } + + @Override + public void setVolumeOwner(String volumeName, String owner) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(owner); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void setVolumeQuota(String volumeName, long quota) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(quota); + Preconditions.checkState(quota >= 0); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public OzoneVolume getVolumeDetails(String volumeName) + throws IOException { + Preconditions.checkNotNull(volumeName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public boolean checkVolumeAccess(String volumeName, OzoneAcl acl) + throws IOException { + Preconditions.checkNotNull(volumeName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void deleteVolume(String volumeName) + throws IOException { + Preconditions.checkNotNull(volumeName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public Iterator listVolumes(String volumePrefix) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public Iterator listVolumes(String volumePrefix, + String user) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void createBucket(String volumeName, String bucketName) + throws IOException { + createBucket(volumeName, bucketName, Versioning.NOT_DEFINED, + StorageType.DEFAULT, (OzoneAcl[])null); + } + + @Override + public void createBucket(String volumeName, String bucketName, + Versioning versioning) + throws IOException { + createBucket(volumeName, bucketName, versioning, + StorageType.DEFAULT, (OzoneAcl[])null); + } + + @Override + public void createBucket(String volumeName, String bucketName, + StorageType storageType) + throws IOException { + createBucket(volumeName, bucketName, Versioning.NOT_DEFINED, + storageType, (OzoneAcl[])null); + } + + @Override + public void createBucket(String volumeName, String bucketName, + OzoneAcl... acls) + throws IOException { + createBucket(volumeName, bucketName, Versioning.NOT_DEFINED, + StorageType.DEFAULT, acls); + } + + @Override + public void createBucket(String volumeName, String bucketName, + Versioning versioning, StorageType storageType, + OzoneAcl... acls) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(versioning); + Preconditions.checkNotNull(storageType); + + String owner = ugi.getUserName(); + final List listOfAcls = new ArrayList<>(); + + //User ACL + OzoneAcl userAcl = + new OzoneAcl(OzoneAcl.OzoneACLType.USER, + owner, userRights); + listOfAcls.add(userAcl); + + //Group ACLs of the User + List userGroups = Arrays.asList(UserGroupInformation + .createRemoteUser(owner).getGroupNames()); + userGroups.stream().forEach((group) -> listOfAcls.add( + new OzoneAcl(OzoneAcl.OzoneACLType.GROUP, group, groupRights))); + + //ACLs passed as argument + if(acls != null) { + Arrays.stream(acls).forEach((acl) -> listOfAcls.add(acl)); + } + + LOG.info("Creating Bucket: {}/{}, with Versioning {} and " + + "Storage Type set to {}", volumeName, bucketName, versioning, + storageType); + throw new UnsupportedOperationException("Not yet implemented."); + } + + /** + * Converts OzoneConts.Versioning enum to boolean. + * + * @param version + * @return corresponding boolean value + */ + private boolean getBucketVersioningProtobuf( + Versioning version) { + if(version != null) { + switch(version) { + case ENABLED: + return true; + case NOT_DEFINED: + case DISABLED: + default: + return false; + } + } + return false; + } + + @Override + public void addBucketAcls(String volumeName, String bucketName, + List addAcls) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(addAcls); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void removeBucketAcls(String volumeName, String bucketName, + List removeAcls) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(removeAcls); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void setBucketVersioning(String volumeName, String bucketName, + Versioning versioning) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(versioning); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void setBucketStorageType(String volumeName, String bucketName, + StorageType storageType) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(storageType); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void deleteBucket(String volumeName, String bucketName) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void checkBucketAccess(String volumeName, String bucketName) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public OzoneBucket getBucketDetails(String volumeName, + String bucketName) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public Iterator listBuckets(String volumeName, + String bucketPrefix) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public OzoneOutputStream createKey(String volumeName, String bucketName, + String keyName, long size) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public OzoneInputStream getKey(String volumeName, String bucketName, + String keyName) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(keyName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public void deleteKey(String volumeName, String bucketName, + String keyName) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(keyName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public List listKeys(String volumeName, String bucketName, + String keyPrefix) + throws IOException { + throw new UnsupportedOperationException("Not yet implemented."); + } + + @Override + public OzoneKey getKeyDetails(String volumeName, String bucketName, + String keyName) + throws IOException { + Preconditions.checkNotNull(volumeName); + Preconditions.checkNotNull(bucketName); + Preconditions.checkNotNull(keyName); + throw new UnsupportedOperationException("Not yet implemented."); + } + + /** + * Converts Versioning to boolean. + * + * @param version + * @return corresponding boolean value + */ + private boolean getBucketVersioningFlag( + Versioning version) { + if(version != null) { + switch(version) { + case ENABLED: + return true; + case DISABLED: + case NOT_DEFINED: + default: + return false; + } + } + return false; + } + + /** + * Returns a standard HttpPost Object to use for ozone post requests. + * + * @param user - If the use is being made on behalf of user, that user + * @param uriString - UriString + * @return HttpPost + */ + public HttpPost getHttpPost(String user, String uriString) { + HttpPost httpPost = new HttpPost(uriString); + addOzoneHeaders(httpPost); + if (user != null) { + httpPost.addHeader(Header.OZONE_USER, user); + } + return httpPost; + } + + /** + * Add Ozone Headers. + * + * @param httpRequest - Http Request + */ + private void addOzoneHeaders(HttpRequestBase httpRequest) { + SimpleDateFormat format = + new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ZZZ", Locale.US); + + httpRequest.addHeader(Header.OZONE_VERSION_HEADER, + Header.OZONE_V1_VERSION_HEADER); + httpRequest.addHeader(HttpHeaders.DATE, + format.format(new Date(Time.monotonicNow()))); + httpRequest.addHeader(HttpHeaders.AUTHORIZATION, + Header.OZONE_SIMPLE_AUTHENTICATION_SCHEME + " " + + ugi.getUserName()); + } + + @Override + public void close() throws IOException { + } +} diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/Header.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/Header.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/Header.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/Header.java index 5c4263fd419..5221a0e7d85 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/Header.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/Header.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.ozone.web.headers; +package org.apache.hadoop.ozone.client.rest.headers; import org.apache.hadoop.classification.InterfaceAudience; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/package-info.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/package-info.java index abef63c9333..54157f0c024 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/headers/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/headers/package-info.java @@ -21,6 +21,6 @@ * Ozone HTTP header definitions. */ @InterfaceAudience.Private -package org.apache.hadoop.ozone.web.headers; +package org.apache.hadoop.ozone.client.rest.headers; import org.apache.hadoop.classification.InterfaceAudience; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/package-info.java new file mode 100644 index 00000000000..ebcc104811f --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/package-info.java @@ -0,0 +1,23 @@ +/** + * 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.ozone.client.rest; + +/** + * This package contains Ozone rest client library classes. + */ diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClient.java similarity index 91% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClient.java index feb45860350..daa96397573 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/OzoneClientImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClient.java @@ -15,33 +15,41 @@ * the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client.rpc; import com.google.common.base.Preconditions; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; -import org.apache.hadoop.ksm.protocolPB +import org.apache.hadoop.ozone.client.io.LengthInputStream; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.protocolPB .KeySpaceManagerProtocolClientSideTranslatorPB; -import org.apache.hadoop.ksm.protocolPB +import org.apache.hadoop.ozone.ksm.protocolPB .KeySpaceManagerProtocolPB; import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.ozone.web.storage.ChunkGroupInputStream; -import org.apache.hadoop.ozone.io.OzoneInputStream; -import org.apache.hadoop.ozone.io.OzoneOutputStream; +import org.apache.hadoop.ozone.OzoneAcl; +import org.apache.hadoop.ozone.OzoneConfiguration; +import org.apache.hadoop.ozone.OzoneConsts; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneKey; +import org.apache.hadoop.ozone.client.OzoneVolume; +import org.apache.hadoop.ozone.client.io.ChunkGroupInputStream; +import org.apache.hadoop.ozone.client.io.OzoneInputStream; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; import org.apache.hadoop.ozone.ksm.KSMConfigKeys; import org.apache.hadoop.ozone.OzoneConsts.Versioning; import org.apache.hadoop.ozone.protocolPB.KSMPBHelper; -import org.apache.hadoop.ozone.web.storage.ChunkGroupOutputStream; +import org.apache.hadoop.ozone.client.io.ChunkGroupOutputStream; import org.apache.hadoop.scm.ScmConfigKeys; import org.apache.hadoop.scm.XceiverClientManager; import org.apache.hadoop.scm.protocolPB @@ -63,14 +71,14 @@ import java.util.UUID; import java.util.stream.Collectors; /** - * Ozone Client Implementation, it connects to KSM, SCM and DataNode + * Ozone RPC Client Implementation, it connects to KSM, SCM and DataNode * to execute client calls. This uses RPC protocol for communication * with the servers. */ -public class OzoneClientImpl implements OzoneClient, Closeable { +public class OzoneRpcClient implements OzoneClient, Closeable { private static final Logger LOG = - LoggerFactory.getLogger(OzoneClient.class); + LoggerFactory.getLogger(OzoneRpcClient.class); private final StorageContainerLocationProtocolClientSideTranslatorPB storageContainerLocationClient; @@ -85,22 +93,22 @@ public class OzoneClientImpl implements OzoneClient, Closeable { private final OzoneAcl.OzoneACLRights groupRights; /** - * Creates OzoneClientImpl instance with new OzoneConfiguration. + * Creates OzoneRpcClient instance with new OzoneConfiguration. * * @throws IOException */ - public OzoneClientImpl() throws IOException { + public OzoneRpcClient() throws IOException { this(new OzoneConfiguration()); } /** - * Creates OzoneClientImpl instance with the given configuration. + * Creates OzoneRpcClient instance with the given configuration. * * @param conf * * @throws IOException */ - public OzoneClientImpl(Configuration conf) throws IOException { + public OzoneRpcClient(Configuration conf) throws IOException { Preconditions.checkNotNull(conf); this.ugi = UserGroupInformation.getCurrentUser(); this.userRights = conf.getEnum(KSMConfigKeys.OZONE_KSM_USER_RIGHTS, @@ -444,7 +452,7 @@ public class OzoneClientImpl implements OzoneClient, Closeable { @Override public OzoneBucket getBucketDetails(String volumeName, - String bucketName) + String bucketName) throws IOException { Preconditions.checkNotNull(volumeName); Preconditions.checkNotNull(bucketName); @@ -518,7 +526,7 @@ public class OzoneClientImpl implements OzoneClient, Closeable { @Override public List listKeys(String volumeName, String bucketName, - String keyPrefix) + String keyPrefix) throws IOException { throw new UnsupportedOperationException("Not yet implemented."); } diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/package-info.java new file mode 100644 index 00000000000..0fcc3fc3583 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rpc/package-info.java @@ -0,0 +1,23 @@ +/** + * 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.ozone.client.rpc; + +/** + * This package contains Ozone rpc client library classes. + */ diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/KSMConfigKeys.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMConfigKeys.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/KSMConfigKeys.java diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketArgs.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketArgs.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketArgs.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketArgs.java index a682f5faafb..1211b50c5cf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketArgs.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketArgs.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import java.util.List; import java.util.stream.Collectors; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketInfo.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketInfo.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketInfo.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketInfo.java index effbb1180ba..4de07aa814c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmBucketInfo.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmBucketInfo.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import com.google.common.base.Preconditions; import org.apache.hadoop.fs.StorageType; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyArgs.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyArgs.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyArgs.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyArgs.java index a034ed3b53a..7375ec5720d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyArgs.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyArgs.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; /** * Args for key. Client use this to specify key's attributes on key creation diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyInfo.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyInfo.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyInfo.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyInfo.java index f46ec89efee..6dea835c171 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyInfo.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyInfo.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos.KeyInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyLocationInfo.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyLocationInfo.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyLocationInfo.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyLocationInfo.java index 62d20f65039..039f8e0abfa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmKeyLocationInfo.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmKeyLocationInfo.java @@ -14,7 +14,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos.KeyLocation; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmOzoneAclMap.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmOzoneAclMap.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmOzoneAclMap.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmOzoneAclMap.java index 1c4c9cbf9a9..7d9efad15a5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmOzoneAclMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmOzoneAclMap.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.OzoneAclInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmVolumeArgs.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmVolumeArgs.java similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmVolumeArgs.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmVolumeArgs.java index f7c6593d0ec..4d60827e94f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/KsmVolumeArgs.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/KsmVolumeArgs.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import com.google.common.base.Preconditions; import org.apache.hadoop.ozone.protocol.proto diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/VolumeArgs.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/VolumeArgs.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/VolumeArgs.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/VolumeArgs.java index 472af65165e..1a3d486d129 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/VolumeArgs.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/VolumeArgs.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; +package org.apache.hadoop.ozone.ksm.helpers; import com.google.common.base.Preconditions; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/package-info.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/package-info.java index 8e487731054..ce627a5c394 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/helpers/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/helpers/package-info.java @@ -15,4 +15,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.helpers; \ No newline at end of file +package org.apache.hadoop.ozone.ksm.helpers; \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java similarity index 96% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java index 5b208fa8759..7698ee191ab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm; +package org.apache.hadoop.ozone.ksm; /** This package contains client side protocol library to communicate with KSM. */ \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/KeySpaceManagerProtocol.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/KeySpaceManagerProtocol.java similarity index 95% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/KeySpaceManagerProtocol.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/KeySpaceManagerProtocol.java index 2ff8e36be03..7d8411474c4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/KeySpaceManagerProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/KeySpaceManagerProtocol.java @@ -15,13 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.protocol; +package org.apache.hadoop.ozone.ksm.protocol; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.OzoneAclInfo; import java.io.IOException; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/package-info.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/package-info.java index d1d12dc34ed..f77e5fd0477 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocol/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocol/package-info.java @@ -16,4 +16,4 @@ * limitations under the License. */ -package org.apache.hadoop.ksm.protocol; \ No newline at end of file +package org.apache.hadoop.ozone.ksm.protocol; \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java index 2ff6be9427a..a13c4152cfe 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolClientSideTranslatorPB.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.protocolPB; +package org.apache.hadoop.ozone.ksm.protocolPB; import com.google.common.base.Strings; import com.google.common.collect.Lists; @@ -24,12 +24,12 @@ import com.google.protobuf.ServiceException; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtocolTranslator; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; -import org.apache.hadoop.ksm.protocol.KeySpaceManagerProtocol; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.protocol.KeySpaceManagerProtocol; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.BucketArgs; import org.apache.hadoop.ozone.protocol.proto diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolPB.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolPB.java similarity index 96% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolPB.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolPB.java index 8b960a949ab..8acca8adb7f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/KeySpaceManagerProtocolPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/KeySpaceManagerProtocolPB.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.ksm.protocolPB; +package org.apache.hadoop.ozone.ksm.protocolPB; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ipc.ProtocolInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/package-info.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/package-info.java index 5dfa5ea0839..67f9f7bc4f7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ksm/protocolPB/package-info.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/ksm/protocolPB/package-info.java @@ -16,4 +16,4 @@ * limitations under the License. */ -package org.apache.hadoop.ksm.protocolPB; \ No newline at end of file +package org.apache.hadoop.ozone.ksm.protocolPB; \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/src/test/java/org/apache/hadoop/scm/TestArchive.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/scm/TestArchive.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/src/test/java/org/apache/hadoop/scm/TestArchive.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/scm/TestArchive.java diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/src/test/java/org/apache/hadoop/scm/package-info.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/scm/package-info.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/src/test/java/org/apache/hadoop/scm/package-info.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/scm/package-info.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockManager.java index 144c3bb37b3..d7349cfc4b1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/CBlockManager.java @@ -34,7 +34,7 @@ import org.apache.hadoop.cblock.protocolPB.CBlockServiceProtocolPB; import org.apache.hadoop.cblock.protocolPB .CBlockServiceProtocolServerSideTranslatorPB; import org.apache.hadoop.ipc.Client; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.scm.XceiverClientManager; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/client/CBlockVolumeClient.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/client/CBlockVolumeClient.java index f70e8a4af12..90a16cef32c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/client/CBlockVolumeClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/cblock/client/CBlockVolumeClient.java @@ -22,7 +22,7 @@ import org.apache.hadoop.cblock.protocolPB.CBlockServiceProtocolPB; import org.apache.hadoop.io.retry.RetryPolicies; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.security.UserGroupInformation; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java index 5b761793945..e6dff981e66 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java @@ -31,12 +31,13 @@ import com.sun.jersey.api.container.ContainerFactory; import com.sun.jersey.api.core.ApplicationAdapter; import org.apache.hadoop.io.IOUtils; -import org.apache.hadoop.ksm.protocolPB +import org.apache.hadoop.ozone.ksm.protocolPB .KeySpaceManagerProtocolClientSideTranslatorPB; -import org.apache.hadoop.ksm.protocolPB.KeySpaceManagerProtocolPB; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.ksm.protocolPB.KeySpaceManagerProtocolPB; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConsts; -import org.apache.hadoop.scm.protocolPB.ScmBlockLocationProtocolClientSideTranslatorPB; +import org.apache.hadoop.scm.protocolPB + .ScmBlockLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.scm.protocolPB.ScmBlockLocationProtocolPB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +48,8 @@ import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.ozone.OzoneConfiguration; -import org.apache.hadoop.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB; +import org.apache.hadoop.scm.protocolPB + .StorageContainerLocationProtocolClientSideTranslatorPB; import org.apache.hadoop.scm.protocolPB.StorageContainerLocationProtocolPB; import org.apache.hadoop.ozone.web.handlers.ServiceFilter; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java index a15ce75f890..5e0a6561936 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java @@ -20,7 +20,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.protocol.DatanodeID; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.container.common.statemachine.commandhandler.CommandDispatcher; import org.apache.hadoop.ozone.container.common.statemachine.commandhandler.ContainerReportHandler; import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java index 683f3f82858..872412b6c5f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/EndpointStateMachine.java @@ -17,7 +17,7 @@ package org.apache.hadoop.ozone.container.common.statemachine; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.protocol.VersionResponse; import org.apache.hadoop.ozone.protocolPB .StorageContainerDatanodeProtocolClientSideTranslatorPB; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java index 902352660c8..963b6459dde 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/SCMConnectionManager.java @@ -21,7 +21,7 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.protocolPB .StorageContainerDatanodeProtocolClientSideTranslatorPB; import org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/InitDatanodeState.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/InitDatanodeState.java index 3720ec8035f..d35f64dabcd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/InitDatanodeState.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/InitDatanodeState.java @@ -19,7 +19,7 @@ package org.apache.hadoop.ozone.container.common.states.datanode; import com.google.common.base.Strings; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.protocol.DatanodeID; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.container.common.helpers.ContainerUtils; import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine; import org.apache.hadoop.ozone.container.common.statemachine.SCMConnectionManager; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManager.java index b3de2e84326..6c756913d59 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManager.java @@ -16,8 +16,8 @@ */ package org.apache.hadoop.ozone.ksm; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; import java.io.IOException; import java.util.List; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java index 56a1804d1f9..585dcff209b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java @@ -18,8 +18,8 @@ package org.apache.hadoop.ozone.ksm; import com.google.common.base.Preconditions; import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.BucketInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManager.java index 18e6b67eebf..753a564eeac 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManager.java @@ -16,8 +16,8 @@ */ package org.apache.hadoop.ozone.ksm; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; import java.io.IOException; import java.util.List; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java index 48e1049da89..f259d85eb4f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java @@ -17,9 +17,9 @@ package org.apache.hadoop.ozone.ksm; import com.google.common.base.Preconditions; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyLocationInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyLocationInfo; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; import org.apache.hadoop.ozone.ksm.exceptions.KSMException.ResultCodes; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java index 8b586b07dec..66bed5293da 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java @@ -24,17 +24,17 @@ import org.apache.hadoop.ipc.Client; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.jmx.ServiceRuntimeInfo; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; -import org.apache.hadoop.ksm.protocol.KeySpaceManagerProtocol; -import org.apache.hadoop.ksm.protocolPB.KeySpaceManagerProtocolPB; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.protocol.KeySpaceManagerProtocol; +import org.apache.hadoop.ozone.ksm.protocolPB.KeySpaceManagerProtocolPB; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.util.MBeans; import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.OzoneAclInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManager.java index d1a79031d5b..a08898f39cc 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManager.java @@ -17,9 +17,9 @@ package org.apache.hadoop.ozone.ksm; import com.google.common.annotations.VisibleForTesting; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; import org.apache.hadoop.utils.BatchOperation; import org.apache.hadoop.utils.MetadataStore; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java index 8bcd1f2c132..6be4675fcb4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java @@ -21,9 +21,9 @@ import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.hadoop.hdfs.DFSUtil; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManager.java index 39fb08dfe29..6ac78d6eaeb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManager.java @@ -16,7 +16,7 @@ */ package org.apache.hadoop.ozone.ksm; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.OzoneAclInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java index f4590a25320..1ebf509963e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java @@ -17,7 +17,7 @@ package org.apache.hadoop.ozone.ksm; import com.google.common.base.Preconditions; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; import org.apache.hadoop.ozone.protocol.proto @@ -34,10 +34,8 @@ import java.io.IOException; import java.util.LinkedList; import java.util.List; -import static org.apache.hadoop.ozone.ksm - .KSMConfigKeys.OZONE_KSM_USER_MAX_VOLUME_DEFAULT; -import static org.apache.hadoop.ozone.ksm - .KSMConfigKeys.OZONE_KSM_USER_MAX_VOLUME; +import static org.apache.hadoop.ozone.ksm.KSMConfigKeys.OZONE_KSM_USER_MAX_VOLUME_DEFAULT; +import static org.apache.hadoop.ozone.ksm.KSMConfigKeys.OZONE_KSM_USER_MAX_VOLUME; import static org.apache.hadoop.ozone.ksm.exceptions .KSMException.ResultCodes; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocolPB/KeySpaceManagerProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocolPB/KeySpaceManagerProtocolServerSideTranslatorPB.java index 0b131ee993d..46af39697fb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocolPB/KeySpaceManagerProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocolPB/KeySpaceManagerProtocolServerSideTranslatorPB.java @@ -19,13 +19,13 @@ package org.apache.hadoop.ozone.protocolPB; import com.google.common.collect.Lists; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; -import org.apache.hadoop.ksm.protocol.KeySpaceManagerProtocol; -import org.apache.hadoop.ksm.protocolPB.KeySpaceManagerProtocolPB; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.protocol.KeySpaceManagerProtocol; +import org.apache.hadoop.ozone.ksm.protocolPB.KeySpaceManagerProtocolPB; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; import org.apache.hadoop.ozone.protocol.proto .KeySpaceManagerProtocolProtos.CreateBucketRequest; @@ -89,8 +89,8 @@ import java.util.List; /** * This class is the server-side translator that forwards requests received on - * {@link org.apache.hadoop.ksm.protocolPB.KeySpaceManagerProtocolPB} to the - * KeySpaceManagerService server implementation. + * {@link org.apache.hadoop.ozone.ksm.protocolPB.KeySpaceManagerProtocolPB} + * to the KeySpaceManagerService server implementation. */ public class KeySpaceManagerProtocolServerSideTranslatorPB implements KeySpaceManagerProtocolPB { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java index 9d3df77fc29..d22ab23809d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java @@ -28,7 +28,7 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.metrics2.util.MBeans; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.protocol.StorageContainerDatanodeProtocol; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java index dc7db2df025..bcd3a02fe93 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/node/SCMNodeManager.java @@ -25,7 +25,7 @@ import org.apache.commons.collections.map.HashedMap; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException; import org.apache.hadoop.metrics2.util.MBeans; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.protocol.StorageContainerNodeProtocol; import org.apache.hadoop.ozone.protocol.VersionResponse; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java index 192b8bc4a4e..8d0da04e0f4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/OzoneHttpServer.java @@ -23,7 +23,7 @@ import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.http.HttpConfig; import org.apache.hadoop.http.HttpServer2; import org.apache.hadoop.net.NetUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneBucket.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneBucket.java index b9730950f44..e92a0d25551 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneBucket.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneBucket.java @@ -21,10 +21,10 @@ package org.apache.hadoop.ozone.web.client; import org.apache.commons.codec.digest.DigestUtils; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.io.IOUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.OzoneAcl; import org.apache.hadoop.ozone.web.response.BucketInfo; import org.apache.hadoop.ozone.web.response.KeyInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneRestClient.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneRestClient.java index 02a00b51c82..df8b7827120 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneRestClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneRestClient.java @@ -23,9 +23,9 @@ import com.google.common.base.Strings; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.io.IOUtils; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.response.ListVolumes; import org.apache.hadoop.ozone.web.response.VolumeInfo; import org.apache.hadoop.ozone.web.utils.OzoneUtils; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneVolume.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneVolume.java index f7cc649e9fc..0881e39145e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneVolume.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/client/OzoneVolume.java @@ -21,9 +21,9 @@ package org.apache.hadoop.ozone.web.client; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.request.OzoneQuota; import org.apache.hadoop.ozone.web.response.BucketInfo; import org.apache.hadoop.ozone.web.response.ListBuckets; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketHandler.java index c7d3eed7b42..e052f38e293 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketHandler.java @@ -22,7 +22,7 @@ package org.apache.hadoop.ozone.web.handlers; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.Bucket; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; import org.apache.hadoop.ozone.OzoneConsts; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketProcessTemplate.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketProcessTemplate.java index 5a96a84c764..db4a23cfbd6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketProcessTemplate.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/BucketProcessTemplate.java @@ -21,7 +21,7 @@ package org.apache.hadoop.ozone.web.handlers; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; import org.apache.hadoop.ozone.web.interfaces.UserAuth; import org.apache.hadoop.ozone.web.response.BucketInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyHandler.java index 66aeb62f729..06fd2b83475 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyHandler.java @@ -19,10 +19,10 @@ package org.apache.hadoop.ozone.web.handlers; import org.apache.commons.codec.binary.Hex; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.Keys; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; import org.apache.hadoop.ozone.web.response.KeyInfo; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyProcessTemplate.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyProcessTemplate.java index 015fcf989be..8a28c3f9901 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyProcessTemplate.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/KeyProcessTemplate.java @@ -22,7 +22,7 @@ import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; import org.apache.hadoop.ozone.web.interfaces.UserAuth; import org.apache.hadoop.ozone.web.utils.OzoneUtils; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/ServiceFilter.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/ServiceFilter.java index c9f20c26e2c..76aa2868ea7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/ServiceFilter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/ServiceFilter.java @@ -20,7 +20,7 @@ package org.apache.hadoop.ozone.web.handlers; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerRequestFilter; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.ext.Provider; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeHandler.java index 48d024c2d24..394a2a59243 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeHandler.java @@ -21,7 +21,7 @@ package org.apache.hadoop.ozone.web.handlers; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.StorageHandler; import org.apache.hadoop.ozone.web.interfaces.UserAuth; import org.apache.hadoop.ozone.web.interfaces.Volume; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java index 13866f01012..a123d694e11 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java @@ -19,7 +19,7 @@ package org.apache.hadoop.ozone.web.interfaces; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java index e64c8bab388..1e830b161c7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java @@ -19,7 +19,7 @@ package org.apache.hadoop.ozone.web.interfaces; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java index cbefba3078f..0cfef40973e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java @@ -19,7 +19,7 @@ package org.apache.hadoop.ozone.web.interfaces; import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.handlers.BucketArgs; import org.apache.hadoop.ozone.web.handlers.KeyArgs; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java index e74ded7a2ea..91ede366226 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java @@ -20,7 +20,7 @@ package org.apache.hadoop.ozone.web.interfaces; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ozone.web.exceptions.OzoneException; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java index 7b2bc539e6c..68f115f71d4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java @@ -20,7 +20,7 @@ package org.apache.hadoop.ozone.web.localstorage; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.handlers.BucketArgs; import org.apache.hadoop.ozone.web.handlers.KeyArgs; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java index f28555aeeac..c0f96302d78 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java @@ -20,9 +20,9 @@ package org.apache.hadoop.ozone.web.localstorage; import com.google.common.base.Preconditions; import org.apache.commons.codec.digest.DigestUtils; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConsts; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.handlers.BucketArgs; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/messages/LengthInputStreamMessageBodyWriter.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/messages/LengthInputStreamMessageBodyWriter.java index 502ccd5aadf..6db49d5428d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/messages/LengthInputStreamMessageBodyWriter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/messages/LengthInputStreamMessageBodyWriter.java @@ -18,8 +18,8 @@ package org.apache.hadoop.ozone.web.messages; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; import org.apache.hadoop.io.IOUtils; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java index c51fbd3ed6a..62cd0f869b6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/ListKeyHandler.java @@ -19,10 +19,8 @@ package org.apache.hadoop.ozone.web.ozShell.keys; import org.apache.commons.cli.CommandLine; -import org.apache.hadoop.ozone.web.client.OzoneBucket; import org.apache.hadoop.ozone.web.client.OzoneRestClientException; import org.apache.hadoop.ozone.web.client.OzoneKey; -import org.apache.hadoop.ozone.web.client.OzoneVolume; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.ozShell.Handler; import org.apache.hadoop.ozone.web.ozShell.Shell; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/request/OzoneQuota.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/request/OzoneQuota.java index f9ed45fe05e..9619ebdb7cd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/request/OzoneQuota.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/request/OzoneQuota.java @@ -20,7 +20,7 @@ package org.apache.hadoop.ozone.web.request; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ozone.OzoneConsts; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import com.fasterxml.jackson.annotation.JsonIgnore; /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java index 713a0851be5..76c9be0d30c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java @@ -19,20 +19,21 @@ package org.apache.hadoop.ozone.web.storage; import com.google.common.base.Strings; -import org.apache.hadoop.hdfs.server.datanode.fsdataset - .LengthInputStream; import org.apache.hadoop.io.IOUtils; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; -import org.apache.hadoop.ksm.helpers.KsmKeyArgs; -import org.apache.hadoop.ksm.helpers.KsmKeyInfo; -import org.apache.hadoop.ksm.helpers.KsmVolumeArgs; -import org.apache.hadoop.ksm.protocolPB +import org.apache.hadoop.ozone.client.io.LengthInputStream; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmKeyInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmVolumeArgs; +import org.apache.hadoop.ozone.ksm.protocolPB .KeySpaceManagerProtocolClientSideTranslatorPB; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.OzoneConsts.Versioning; -import org.apache.hadoop.ozone.io.OzoneOutputStream; +import org.apache.hadoop.ozone.client.io.ChunkGroupInputStream; +import org.apache.hadoop.ozone.client.io.ChunkGroupOutputStream; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos; import org.apache.hadoop.ozone.protocolPB.KSMPBHelper; import org.apache.hadoop.ozone.ksm.KSMConfigKeys; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/OzoneContainerTranslation.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/OzoneContainerTranslation.java deleted file mode 100644 index 18ade6e1035..00000000000 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/OzoneContainerTranslation.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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.ozone.web.storage; - -import java.util.List; - -import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.hdfs.ozone.protocol.proto.ContainerProtos.KeyData; -import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.KeyValue; -import org.apache.hadoop.ozone.OzoneConsts.Versioning; -import org.apache.hadoop.ozone.web.request.OzoneQuota; -import org.apache.hadoop.ozone.web.response.BucketInfo; -import org.apache.hadoop.ozone.web.response.KeyInfo; -import org.apache.hadoop.ozone.web.response.VolumeInfo; -import org.apache.hadoop.ozone.web.response.VolumeOwner; -import org.apache.hadoop.util.StringUtils; - -/** - * This class contains methods that define the translation between the Ozone - * domain model and the storage container domain model. - */ -final class OzoneContainerTranslation { - - private static final String ACLS = "ACLS"; - private static final String BUCKET = "BUCKET"; - private static final String BUCKET_NAME = "BUCKET_NAME"; - private static final String CREATED_BY = "CREATED_BY"; - private static final String CREATED_ON = "CREATED_ON"; - private static final String KEY = "KEY"; - private static final String OWNER = "OWNER"; - private static final String QUOTA = "QUOTA"; - private static final String STORAGE_TYPE = "STORAGE_TYPE"; - private static final String TYPE = "TYPE"; - private static final String VERSIONING = "VERSIONING"; - private static final String VOLUME = "VOLUME"; - private static final String VOLUME_NAME = "VOLUME_NAME"; - - /** - * Creates key data intended for reading a container key. - * - * @param containerName container name - * @param containerKey container key - * @return KeyData intended for reading the container key - */ - public static KeyData containerKeyDataForRead(String containerName, - String containerKey) { - return KeyData - .newBuilder() - .setContainerName(containerName) - .setName(containerKey) - .build(); - } - - /** - * Translates a bucket to its container representation. - * - * @param containerName container name - * @param containerKey container key - * @param bucket the bucket to translate - * @return KeyData representation of bucket - */ - public static KeyData fromBucketToContainerKeyData( - String containerName, String containerKey, BucketInfo bucket) { - KeyData.Builder containerKeyData = KeyData - .newBuilder() - .setContainerName(containerName) - .setName(containerKey) - .addMetadata(newKeyValue(TYPE, BUCKET)) - .addMetadata(newKeyValue(VOLUME_NAME, bucket.getVolumeName())) - .addMetadata(newKeyValue(BUCKET_NAME, bucket.getBucketName())); - - if (bucket.getAcls() != null) { - containerKeyData.addMetadata(newKeyValue(ACLS, - StringUtils.join(',', bucket.getAcls()))); - } - - if (bucket.getVersioning() != null && - bucket.getVersioning() != Versioning.NOT_DEFINED) { - containerKeyData.addMetadata(newKeyValue(VERSIONING, - bucket.getVersioning().name())); - } - - if (bucket.getStorageType() != StorageType.RAM_DISK) { - containerKeyData.addMetadata(newKeyValue(STORAGE_TYPE, - bucket.getStorageType().name())); - } - - return containerKeyData.build(); - } - - /** - * Translates a bucket from its container representation. - * - * @param metadata container metadata representing the bucket - * @return bucket translated from container representation - */ - public static BucketInfo fromContainerKeyValueListToBucket( - List metadata) { - BucketInfo bucket = new BucketInfo(); - for (KeyValue keyValue : metadata) { - switch (keyValue.getKey()) { - case VOLUME_NAME: - bucket.setVolumeName(keyValue.getValue()); - break; - case BUCKET_NAME: - bucket.setBucketName(keyValue.getValue()); - break; - case VERSIONING: - bucket.setVersioning( - Enum.valueOf(Versioning.class, keyValue.getValue())); - break; - case STORAGE_TYPE: - bucket.setStorageType( - Enum.valueOf(StorageType.class, keyValue.getValue())); - break; - default: - break; - } - } - return bucket; - } - - /** - * Translates a volume from its container representation. - * - * @param metadata container metadata representing the volume - * @return volume translated from container representation - */ - public static VolumeInfo fromContainerKeyValueListToVolume( - List metadata) { - VolumeInfo volume = new VolumeInfo(); - for (KeyValue keyValue : metadata) { - switch (keyValue.getKey()) { - case VOLUME_NAME: - volume.setVolumeName(keyValue.getValue()); - break; - case CREATED_BY: - volume.setCreatedBy(keyValue.getValue()); - break; - case CREATED_ON: - volume.setCreatedOn(keyValue.getValue()); - break; - case OWNER: - volume.setOwner(new VolumeOwner(keyValue.getValue())); - break; - case QUOTA: - volume.setQuota(OzoneQuota.parseQuota(keyValue.getValue())); - break; - default: - break; - } - } - return volume; - } - - /** - * Translates a key to its container representation. - * - * @param containerName container name - * @param containerKey container key - * @param keyInfo key information received from call - * @return KeyData intended for reading the container key - */ - public static KeyData fromKeyToContainerKeyData(String containerName, - String containerKey, KeyInfo key) { - return KeyData - .newBuilder() - .setContainerName(containerName) - .setName(containerKey) - .addMetadata(newKeyValue(TYPE, KEY)) - .build(); - } - - /** - * Translates a key to its container representation. The return value is a - * builder that can be manipulated further before building the result. - * - * @param containerName container name - * @param containerKey container key - * @param keyInfo key information received from call - * @return KeyData builder - */ - public static KeyData.Builder fromKeyToContainerKeyDataBuilder( - String containerName, String containerKey, KeyInfo key) { - return KeyData - .newBuilder() - .setContainerName(containerName) - .setName(containerKey) - .addMetadata(newKeyValue(TYPE, KEY)); - } - - /** - * Translates a volume to its container representation. - * - * @param containerName container name - * @param containerKey container key - * @param volume the volume to translate - * @return KeyData representation of volume - */ - public static KeyData fromVolumeToContainerKeyData( - String containerName, String containerKey, VolumeInfo volume) { - KeyData.Builder containerKeyData = KeyData - .newBuilder() - .setContainerName(containerName) - .setName(containerKey) - .addMetadata(newKeyValue(TYPE, VOLUME)) - .addMetadata(newKeyValue(VOLUME_NAME, volume.getVolumeName())) - .addMetadata(newKeyValue(CREATED_ON, volume.getCreatedOn())); - - if (volume.getQuota() != null && volume.getQuota().sizeInBytes() != -1L) { - containerKeyData.addMetadata(newKeyValue(QUOTA, - OzoneQuota.formatQuota(volume.getQuota()))); - } - - if (volume.getOwner() != null && volume.getOwner().getName() != null && - !volume.getOwner().getName().isEmpty()) { - containerKeyData.addMetadata(newKeyValue(OWNER, - volume.getOwner().getName())); - } - - if (volume.getCreatedBy() != null && !volume.getCreatedBy().isEmpty()) { - containerKeyData.addMetadata( - newKeyValue(CREATED_BY, volume.getCreatedBy())); - } - - return containerKeyData.build(); - } - - /** - * Translates a key-value pair to its container representation. - * - * @param key the key - * @param value the value - * @return container representation of key-value pair - */ - private static KeyValue newKeyValue(String key, Object value) { - return KeyValue.newBuilder().setKey(key).setValue(value.toString()).build(); - } - - /** - * There is no need to instantiate this class. - */ - private OzoneContainerTranslation() { - } -} diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/userauth/Simple.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/userauth/Simple.java index 609a47b4908..6cce47ec2a0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/userauth/Simple.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/userauth/Simple.java @@ -22,7 +22,7 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.handlers.UserArgs; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.web.interfaces.UserAuth; import org.apache.hadoop.ozone.OzoneConsts; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/utils/OzoneUtils.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/utils/OzoneUtils.java index c417601da33..2fe64d50b64 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/utils/OzoneUtils.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/utils/OzoneUtils.java @@ -23,11 +23,11 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConsts; -import org.apache.hadoop.hdfs.server.datanode.fsdataset.LengthInputStream; +import org.apache.hadoop.ozone.client.io.LengthInputStream; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.handlers.UserArgs; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.util.Time; import javax.ws.rs.core.HttpHeaders; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/Corona.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/Corona.java index 581ccc606af..4d69ba9f340 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/Corona.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/Corona.java @@ -26,7 +26,9 @@ import org.apache.commons.cli.Options; import org.apache.commons.lang.RandomStringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; -import org.apache.hadoop.ozone.io.OzoneOutputStream; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientFactory; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; @@ -132,7 +134,7 @@ public final class Corona extends Configured implements Tool { numberOfBucketsCreated = new AtomicInteger(); numberOfKeysAdded = new AtomicLong(); OzoneClientFactory.setConfiguration(conf); - ozoneClient = OzoneClientFactory.getRpcClient(); + ozoneClient = OzoneClientFactory.getClient(); } @Override diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientUtils.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientUtils.java similarity index 92% rename from hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientUtils.java rename to hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientUtils.java index a5dbea72df5..4ca5d83dbea 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientUtils.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientUtils.java @@ -16,9 +16,10 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.ksm.KSMConfigKeys; import org.apache.hadoop.scm.ScmConfigKeys; import org.junit.Test; @@ -106,24 +107,30 @@ public class TestOzoneClientUtils { conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4"); InetSocketAddress addr = OzoneClientUtils.getScmAddressForDataNodes(conf); assertThat(addr.getHostString(), is("1.2.3.4")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); - // Next try a client address with just a host name and port. Verify the port - // is ignored and the default DataNode port is used. + // Next try a client address with just a host name and port. + // Verify the port is ignored and the default DataNode port is used. conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100"); addr = OzoneClientUtils.getScmAddressForDataNodes(conf); assertThat(addr.getHostString(), is("1.2.3.4")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); - // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and OZONE_SCM_DATANODE_ADDRESS_KEY. - // Verify that the latter overrides and the port number is still the default. + // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and + // OZONE_SCM_DATANODE_ADDRESS_KEY. + // Verify that the latter overrides and the port number is still the + // default. conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100"); conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "5.6.7.8"); addr = OzoneClientUtils.getScmAddressForDataNodes(conf); assertThat(addr.getHostString(), is("5.6.7.8")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); - // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and OZONE_SCM_DATANODE_ADDRESS_KEY. + // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and + // OZONE_SCM_DATANODE_ADDRESS_KEY. // Verify that the latter overrides and the port number from the latter is // used. conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100"); @@ -165,7 +172,8 @@ public class TestOzoneClientUtils { conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_BIND_HOST_KEY, "5.6.7.8"); addr = OzoneClientUtils.getScmClientBindAddress(conf); assertThat(addr.getHostString(), is("5.6.7.8")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT)); // OZONE_SCM_CLIENT_BIND_HOST_KEY should be respected. // Port number from OZONE_SCM_CLIENT_ADDRESS_KEY should be @@ -191,7 +199,8 @@ public class TestOzoneClientUtils { conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4"); InetSocketAddress addr = OzoneClientUtils.getScmDataNodeBindAddress(conf); assertThat(addr.getHostString(), is("0.0.0.0")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); // The bind host should be 0.0.0.0 unless OZONE_SCM_DATANODE_BIND_HOST_KEY // is set differently. The port number from OZONE_SCM_DATANODE_ADDRESS_KEY @@ -210,7 +219,8 @@ public class TestOzoneClientUtils { conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_BIND_HOST_KEY, "5.6.7.8"); addr = OzoneClientUtils.getScmDataNodeBindAddress(conf); assertThat(addr.getHostString(), is("5.6.7.8")); - assertThat(addr.getPort(), is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); + assertThat(addr.getPort(), is( + ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT)); // OZONE_SCM_DATANODE_BIND_HOST_KEY should be respected. // Port number from OZONE_SCM_DATANODE_ADDRESS_KEY should be @@ -261,7 +271,8 @@ public class TestOzoneClientUtils { hostsAndPorts.put("scm3", 3456); // Verify multiple hosts and port - conf.setStrings(ScmConfigKeys.OZONE_SCM_NAMES, "scm1:1234,scm2:2345,scm3:3456"); + conf.setStrings( + ScmConfigKeys.OZONE_SCM_NAMES, "scm1:1234,scm2:2345,scm3:3456"); addresses = OzoneClientUtils.getSCMAddresses(conf); assertThat(addresses.size(), is(3)); it = addresses.iterator(); @@ -274,7 +285,8 @@ public class TestOzoneClientUtils { assertTrue(expected1.isEmpty()); // Verify names with spaces - conf.setStrings(ScmConfigKeys.OZONE_SCM_NAMES, " scm1:1234, scm2:2345 , scm3:3456 "); + conf.setStrings( + ScmConfigKeys.OZONE_SCM_NAMES, " scm1:1234, scm2:2345 , scm3:3456 "); addresses = OzoneClientUtils.getSCMAddresses(conf); assertThat(addresses.size(), is(3)); it = addresses.iterator(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/package-info.java new file mode 100644 index 00000000000..be63eab0c7a --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/package-info.java @@ -0,0 +1,23 @@ +/** + * 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.ozone.client; + +/** + * This package contains test classes for Ozone Client. + */ \ No newline at end of file diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java similarity index 94% rename from hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java rename to hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java index b861f7dfe0e..837d1b77b2f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestOzoneClientImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java @@ -16,11 +16,21 @@ * limitations under the License. */ -package org.apache.hadoop.ozone; +package org.apache.hadoop.ozone.client.rpc; import org.apache.hadoop.fs.StorageType; -import org.apache.hadoop.ozone.io.OzoneInputStream; -import org.apache.hadoop.ozone.io.OzoneOutputStream; +import org.apache.hadoop.ozone.MiniOzoneCluster; +import org.apache.hadoop.ozone.OzoneAcl; +import org.apache.hadoop.ozone.OzoneConfigKeys; +import org.apache.hadoop.ozone.OzoneConfiguration; +import org.apache.hadoop.ozone.OzoneConsts; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientFactory; +import org.apache.hadoop.ozone.client.OzoneKey; +import org.apache.hadoop.ozone.client.OzoneVolume; +import org.apache.hadoop.ozone.client.io.OzoneInputStream; +import org.apache.hadoop.ozone.client.io.OzoneOutputStream; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.junit.AfterClass; import org.junit.Assert; @@ -37,13 +47,13 @@ import java.util.UUID; /** * This class is to test all the public facing APIs of Ozone Client. */ -public class TestOzoneClientImpl { +public class TestOzoneRpcClient { @Rule public ExpectedException thrown = ExpectedException.none(); private static MiniOzoneCluster cluster = null; - private static OzoneClientImpl ozClient = null; + private static OzoneClient ozClient = null; /** * Create a MiniDFSCluster for testing. @@ -60,7 +70,8 @@ public class TestOzoneClientImpl { OzoneConsts.OZONE_HANDLER_DISTRIBUTED); cluster = new MiniOzoneCluster.Builder(conf) .setHandlerType(OzoneConsts.OZONE_HANDLER_DISTRIBUTED).build(); - ozClient = new OzoneClientImpl(conf); + OzoneClientFactory.setConfiguration(conf); + ozClient = OzoneClientFactory.getRpcClient(); } @Test diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/package-info.java new file mode 100644 index 00000000000..0f48495c614 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/client/rpc/package-info.java @@ -0,0 +1,23 @@ +/** + * 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.ozone.client.rpc; + +/** + * This package contains test class for Ozone rpc client library. + */ diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java index 754d2af5c7d..6eafdaac3c7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java @@ -28,7 +28,6 @@ import org.apache.hadoop.ozone.web.utils.OzoneUtils; import org.apache.hadoop.scm.XceiverClient; import org.apache.hadoop.scm.XceiverClientSpi; import org.apache.hadoop.scm.container.common.helpers.Pipeline; -import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestBucketManagerImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestBucketManagerImpl.java index a40a6d074de..852c1ffa155 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestBucketManagerImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestBucketManagerImpl.java @@ -18,8 +18,8 @@ package org.apache.hadoop.ozone.ksm; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.hdfs.DFSUtil; -import org.apache.hadoop.ksm.helpers.KsmBucketArgs; -import org.apache.hadoop.ksm.helpers.KsmBucketInfo; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketArgs; +import org.apache.hadoop.ozone.ksm.helpers.KsmBucketInfo; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.ksm.exceptions.KSMException; import org.apache.hadoop.ozone.ksm.exceptions diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestChunkStreams.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestChunkStreams.java index 2c936dfa84a..568f1eb9cfb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestChunkStreams.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/ksm/TestChunkStreams.java @@ -17,8 +17,8 @@ package org.apache.hadoop.ozone.ksm; import org.apache.commons.lang.RandomStringUtils; -import org.apache.hadoop.ozone.web.storage.ChunkGroupInputStream; -import org.apache.hadoop.ozone.web.storage.ChunkGroupOutputStream; +import org.apache.hadoop.ozone.client.io.ChunkGroupInputStream; +import org.apache.hadoop.ozone.client.io.ChunkGroupOutputStream; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneHelper.java index 791504e3fb2..5393f331a24 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneHelper.java @@ -18,7 +18,7 @@ package org.apache.hadoop.ozone.web; import org.apache.hadoop.ozone.web.exceptions.ErrorTable; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.web.utils.OzoneUtils; import org.apache.hadoop.util.Time; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneWebAccess.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneWebAccess.java index f7e54c77de9..09dd79798b2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneWebAccess.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/TestOzoneWebAccess.java @@ -23,7 +23,7 @@ import org.apache.hadoop.ozone.MiniOzoneCluster; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConsts; -import org.apache.hadoop.ozone.web.headers.Header; +import org.apache.hadoop.ozone.client.rest.headers.Header; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.Time; import org.apache.http.HttpResponse; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestVolume.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestVolume.java index 33002aef5d4..69e9dcfba59 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestVolume.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/web/client/TestVolume.java @@ -27,7 +27,7 @@ import org.apache.hadoop.ozone.OzoneConfiguration; import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos.Status; -import org.apache.hadoop.ozone.OzoneClientUtils; +import org.apache.hadoop.ozone.client.OzoneClientUtils; import org.apache.hadoop.ozone.web.exceptions.OzoneException; import org.apache.hadoop.ozone.web.request.OzoneQuota; import org.apache.hadoop.ozone.web.utils.OzoneUtils;