You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ae...@apache.org on 2018/03/15 16:32:30 UTC
[15/51] [partial] hadoop git commit: HDFS-13258. Ozone: restructure
Hdsl/Ozone code to separated maven subprojects. Contributed by Elek Marton,
Mukul Kumar Singh, Xiaoyu Yao, Ajay Kumar, Anu Engineer, Lokesh Jain,
Nanda Kumar.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeProcessTemplate.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeProcessTemplate.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeProcessTemplate.java
deleted file mode 100644
index 0cd652a..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/VolumeProcessTemplate.java
+++ /dev/null
@@ -1,274 +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.handlers;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.ozone.protocol.proto.KeySpaceManagerProtocolProtos;
-import org.apache.hadoop.ozone.web.exceptions.ErrorTable;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.web.interfaces.StorageHandler;
-import org.apache.hadoop.ozone.web.interfaces.UserAuth;
-import org.apache.hadoop.ozone.web.response.ListBuckets;
-import org.apache.hadoop.ozone.web.response.ListVolumes;
-import org.apache.hadoop.ozone.web.response.VolumeInfo;
-import org.apache.hadoop.ozone.web.utils.OzoneUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import java.io.IOException;
-import java.nio.file.DirectoryNotEmptyException;
-import java.nio.file.FileAlreadyExistsException;
-import java.nio.file.NoSuchFileException;
-
-import static java.net.HttpURLConnection.HTTP_OK;
-import static org.apache.hadoop.ozone.OzoneConsts.OZONE_COMPONENT;
-import static org.apache.hadoop.ozone.OzoneConsts.OZONE_RESOURCE;
-import static org.apache.hadoop.ozone.OzoneConsts.OZONE_REQUEST;
-import static org.apache.hadoop.ozone.OzoneConsts.OZONE_USER;
-
-
-/**
- * This class abstracts way the repetitive tasks in
- * handling volume related code.
- */
-@InterfaceAudience.Private
-public abstract class VolumeProcessTemplate {
- private static final Logger LOG =
- LoggerFactory.getLogger(VolumeProcessTemplate.class);
-
-
- /**
- * The handle call is the common functionality for Volume
- * handling code.
- *
- * @param volume - Name of the Volume
- * @param request - request
- * @param info - UriInfo
- * @param headers - Http Headers
- *
- * @return Response
- *
- * @throws OzoneException
- */
- public Response handleCall(String volume, Request request, UriInfo info,
- HttpHeaders headers) throws OzoneException {
- String reqID = OzoneUtils.getRequestID();
- String hostName = OzoneUtils.getHostName();
- MDC.put(OZONE_COMPONENT, "ozone");
- MDC.put(OZONE_REQUEST, reqID);
- UserArgs userArgs = null;
- try {
- userArgs = new UserArgs(reqID, hostName, request, info, headers);
- OzoneUtils.validate(request, headers, reqID, volume, hostName);
-
- // we use the same logic for both bucket and volume names
- OzoneUtils.verifyResourceName(volume);
- UserAuth auth = UserHandlerBuilder.getAuthHandler();
-
- userArgs.setUserName(auth.getUser(userArgs));
- MDC.put(OZONE_USER, userArgs.getUserName());
- VolumeArgs args = new VolumeArgs(volume, userArgs);
-
- MDC.put(OZONE_RESOURCE, args.getResourceName());
- Response response = doProcess(args);
- LOG.info("Success");
- MDC.clear();
- return response;
-
- } catch (IllegalArgumentException ex) {
- LOG.error("Illegal argument.", ex);
- throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex);
- } catch (IOException ex) {
- handleIOException(volume, reqID, hostName, ex);
- }
- return null;
- }
-
- /**
- * Specific handler for each call.
- *
- * @param args - Volume Args
- *
- * @return - Response
- *
- * @throws IOException
- * @throws OzoneException
- */
- public abstract Response doProcess(VolumeArgs args)
- throws IOException, OzoneException;
-
- /**
- * Maps Java File System Exceptions to Ozone Exceptions in the Volume path.
- *
- * @param volume - Name of the Volume
- * @param reqID - Request ID
- * @param hostName - HostName
- * @param fsExp - Exception
- *
- * @throws OzoneException
- */
- private void handleIOException(String volume, String reqID, String hostName,
- IOException fsExp) throws OzoneException {
- LOG.error("IOException:", fsExp);
- OzoneException exp = null;
-
- if ((fsExp != null && fsExp.getMessage().endsWith(
- KeySpaceManagerProtocolProtos.Status.VOLUME_ALREADY_EXISTS.name()))
- || fsExp instanceof FileAlreadyExistsException) {
- exp = ErrorTable
- .newError(ErrorTable.VOLUME_ALREADY_EXISTS, reqID, volume, hostName);
- }
-
- if (fsExp instanceof DirectoryNotEmptyException) {
- exp = ErrorTable
- .newError(ErrorTable.VOLUME_NOT_EMPTY, reqID, volume, hostName);
- }
-
- if (fsExp instanceof NoSuchFileException) {
- exp = ErrorTable
- .newError(ErrorTable.INVALID_VOLUME_NAME, reqID, volume, hostName);
- }
-
- if ((fsExp != null) && (exp != null)) {
- exp.setMessage(fsExp.getMessage());
- }
-
- // We don't handle that FS error yet, report a Server Internal Error
- if (exp == null) {
- exp =
- ErrorTable.newError(ErrorTable.SERVER_ERROR, reqID, volume, hostName);
- if (fsExp != null) {
- exp.setMessage(fsExp.getMessage());
- }
- }
- throw exp;
- }
-
- /**
- * Set the user provided string into args and throw ozone exception
- * if needed.
- *
- * @param args - volume args
- * @param quota - quota sting
- *
- * @throws OzoneException
- */
- void setQuotaArgs(VolumeArgs args, String quota) throws OzoneException {
- try {
- args.setQuota(quota);
- } catch (IllegalArgumentException ex) {
- LOG.debug("Malformed Quota.", ex);
- throw ErrorTable.newError(ErrorTable.MALFORMED_QUOTA, args, ex);
- }
- }
-
- /**
- * Wraps calls into volumeInfo data.
- *
- * @param args - volumeArgs
- *
- * @return - VolumeInfo
- *
- * @throws IOException
- * @throws OzoneException
- */
- Response getVolumeInfoResponse(VolumeArgs args)
- throws IOException, OzoneException {
- StorageHandler fs = StorageHandlerBuilder.getStorageHandler();
- VolumeInfo info = fs.getVolumeInfo(args);
- return OzoneUtils.getResponse(args, HTTP_OK, info.toJsonString());
- }
-
- /**
- * Returns all the volumes belonging to a user.
- *
- * @param user - userArgs
- * @return - Response
- * @throws OzoneException
- * @throws IOException
- */
- Response getVolumesByUser(UserArgs user, String prefix, int maxKeys,
- String prevKey, boolean rootScan) throws OzoneException, IOException {
-
- String validatedUser = user.getUserName();
- try {
- UserAuth auth = UserHandlerBuilder.getAuthHandler();
- if(rootScan && !auth.isAdmin(user)) {
- throw ErrorTable.newError(ErrorTable.UNAUTHORIZED, user);
- }
- if (auth.isAdmin(user)) {
- validatedUser = auth.getOzoneUser(user);
- if (validatedUser == null) {
- validatedUser = auth.getUser(user);
- }
- }
-
- UserArgs onBehalfOf =
- new UserArgs(validatedUser, user.getRequestID(), user.getHostName(),
- user.getRequest(), user.getUri(), user.getHeaders());
-
- StorageHandler fs = StorageHandlerBuilder.getStorageHandler();
- ListArgs<UserArgs> listArgs = new ListArgs<>(onBehalfOf, prefix,
- maxKeys, prevKey);
- listArgs.setRootScan(rootScan);
- ListVolumes volumes = fs.listVolumes(listArgs);
- return OzoneUtils.getResponse(user, HTTP_OK, volumes.toJsonString());
- } catch (IOException ex) {
- LOG.debug("unable to get the volume list for the user.", ex);
- OzoneException exp = ErrorTable.newError(ErrorTable.SERVER_ERROR,
- user, ex);
- exp.setMessage("unable to get the volume list for the user");
- throw exp;
- }
- }
-
- /**
- * Returns a list of Buckets in a Volume.
- *
- * @param args - VolumeArgs
- * @param prefix - Prefix to Match
- * @param maxKeys - Max results to return.
- * @param prevKey - PrevKey
- * @return List of Buckets
- * @throws OzoneException
- */
- Response getBucketsInVolume(VolumeArgs args, String prefix, int maxKeys,
- String prevKey) throws OzoneException {
- try {
- // UserAuth auth = UserHandlerBuilder.getAuthHandler();
- // TODO : Check ACLS.
- StorageHandler fs = StorageHandlerBuilder.getStorageHandler();
- ListArgs<VolumeArgs> listArgs = new ListArgs<>(args, prefix,
- maxKeys, prevKey);
- ListBuckets bucketList = fs.listBuckets(listArgs);
- return OzoneUtils.getResponse(args, HTTP_OK, bucketList.toJsonString());
- } catch (IOException ex) {
- LOG.debug("unable to get the bucket list for the specified volume.", ex);
- OzoneException exp =
- ErrorTable.newError(ErrorTable.SERVER_ERROR, args, ex);
- exp.setMessage("unable to get the bucket list for the specified volume.");
- throw exp;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/package-info.java
deleted file mode 100644
index 4d34c2d..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/handlers/package-info.java
+++ /dev/null
@@ -1,22 +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.handlers;
-
-/**
- This package contains ozone client side libraries.
- */
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Accounting.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Accounting.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Accounting.java
deleted file mode 100644
index f03276c..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Accounting.java
+++ /dev/null
@@ -1,57 +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.interfaces;
-
-/**
- * This in the accounting interface, Ozone Rest interface will call into this
- * interface whenever a put or delete key happens.
- * <p>
- * TODO : Technically we need to report bucket creation and deletion too
- * since the bucket names and metadata consume storage.
- * <p>
- * TODO : We should separate out reporting metadata & data --
- * <p>
- * In some cases end users will only want to account for the data they are
- * storing since metadata is mostly a cost of business.
- */
-public interface Accounting {
- /**
- * This call is made when ever a put key call is made.
- * <p>
- * In case of a Put which causes a over write of a key accounting system will
- * see two calls, a removeByte call followed by an addByte call.
- *
- * @param owner - Volume Owner
- * @param volume - Name of the Volume
- * @param bucket - Name of the bucket
- * @param bytes - How many bytes are put
- */
- void addBytes(String owner, String volume, String bucket, int bytes);
-
- /**
- * This call is made whenever a delete call is made.
- *
- * @param owner - Volume Owner
- * @param volume - Name of the Volume
- * @param bucket - Name of the bucket
- * @param bytes - How many bytes are deleted
- */
- void removeBytes(String owner, String volume, String bucket, int bytes);
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 4c8b85b..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Bucket.java
+++ /dev/null
@@ -1,183 +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.interfaces;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.client.rest.headers.Header;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-/**
- * Bucket Interface acts as the HTTP entry point for
- * bucket related functionality.
- */
-@Path("/{volume}/{bucket}")
-@Api(tags = "bucket")
-public interface Bucket {
- /**
- * createBucket call handles the POST request for Creating a Bucket.
- *
- * @param volume - Volume name
- * @param bucket - Bucket Name
- * @param req - Http request
- * @param info - Uri Info
- * @param headers - Http headers
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @POST
- @ApiOperation("Create new bucket to a volume")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response createBucket(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket,
- @Context Request req, @Context UriInfo info,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * updateBucket call handles the PUT request for updating a Bucket.
- *
- * @param volume - Volume name
- * @param bucket - Bucket name
- * @param req - Http request
- * @param info - Uri Info
- * @param headers - Http headers
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @PUT
- @ApiOperation("Update bucket")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response updateBucket(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket,
- @Context Request req, @Context UriInfo info,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Deletes an empty bucket.
- *
- * @param volume Volume name
- * @param bucket Bucket Name
- * @param req - Http request
- * @param info - Uri Info
- * @param headers - Http headers
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @DELETE
- @ApiOperation("Deletes an empty bucket.")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response deleteBucket(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket,
- @Context Request req, @Context UriInfo info,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * List Buckets lists the contents of a bucket.
- *
- * @param volume - Storage Volume Name
- * @param bucket - Bucket Name
- * @param info - Information type needed
- * @param prefix - Prefix for the keys to be fetched
- * @param maxKeys - MaxNumber of Keys to Return
- * @param prevKey - Continuation Token
- * @param req - Http request
- * @param headers - Http headers
- *
- * @return - Json Body
- *
- * @throws OzoneException
- */
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @ApiOperation("List contents of a bucket")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response listBucket(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket,
- @DefaultValue(Header.OZONE_INFO_QUERY_KEY)
- @QueryParam(Header.OZONE_INFO_QUERY_TAG)
- String info,
- @QueryParam(Header.OZONE_LIST_QUERY_PREFIX)
- String prefix,
- @DefaultValue(Header.OZONE_DEFAULT_LIST_SIZE)
- @QueryParam(Header.OZONE_LIST_QUERY_MAXKEYS)
- int maxKeys,
- @QueryParam(Header.OZONE_LIST_QUERY_PREVKEY)
- String prevKey,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java
----------------------------------------------------------------------
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
deleted file mode 100644
index f9255f2..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Keys.java
+++ /dev/null
@@ -1,146 +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.interfaces;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.client.rest.headers.Header;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import java.io.InputStream;
-
-/**
- * This interface defines operations permitted on a key.
- */
-@Path("/{volume}/{bucket}/{keys:.*}")
-@Api(tags = "key")
-public interface Keys {
-
- /**
- * Adds a key to an existing bucket. If the object already exists
- * this call will overwrite or add with new version number if the bucket
- * versioning is turned on.
- *
- * @param volume Storage Volume Name
- * @param bucket Name of the bucket
- * @param keys Name of the Object
- * @param is InputStream or File Data
- * @param req Request
- * @param headers http headers
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @PUT
- @Consumes(MediaType.WILDCARD)
- @ApiOperation(value = "Adds a key to an existing bucket.", notes = "If the "
- + "object already exists this call will overwrite or add with new version"
- + " number if the bucket versioning is turned on.")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response putKey(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket, @PathParam("keys") String keys,
- InputStream is, @Context Request req, @Context UriInfo info,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Gets the Key if it exists.
- *
- * @param volume Storage Volume
- * @param bucket Name of the bucket
- * @param keys Object Name
- * @param info Tag info
- * @param req Request
- * @param uriInfo Uri info
- * @param headers Http Header
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @GET
- @ApiOperation("Gets the Key if it exists.")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response getKey(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket, @PathParam("keys") String keys,
- @QueryParam(Header.OZONE_INFO_QUERY_TAG) String info,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Deletes an existing key.
- *
- * @param volume Storage Volume Name
- * @param bucket Name of the bucket
- * @param keys Name of the Object
- * @param req http Request
- * @param headers HttpHeaders
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @DELETE
- @ApiOperation("Deletes an existing key")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response deleteKey(@PathParam("volume") String volume,
- @PathParam("bucket") String bucket, @PathParam("keys") String keys,
- @Context Request req, @Context UriInfo info, @Context HttpHeaders headers)
- throws OzoneException;
-}
-
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 6336c90..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
+++ /dev/null
@@ -1,295 +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.interfaces;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.ozone.client.io.LengthInputStream;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.web.handlers.BucketArgs;
-import org.apache.hadoop.ozone.web.handlers.KeyArgs;
-import org.apache.hadoop.ozone.web.handlers.ListArgs;
-import org.apache.hadoop.ozone.web.handlers.VolumeArgs;
-import org.apache.hadoop.ozone.OzoneAcl;
-import org.apache.hadoop.ozone.web.response.BucketInfo;
-import org.apache.hadoop.ozone.web.response.KeyInfo;
-import org.apache.hadoop.ozone.web.response.ListBuckets;
-import org.apache.hadoop.ozone.web.response.ListKeys;
-import org.apache.hadoop.ozone.web.response.ListVolumes;
-import org.apache.hadoop.ozone.web.response.VolumeInfo;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Storage handler Interface is the Interface between
- * REST protocol and file system.
- *
- * We will have two default implementations of this interface.
- * One for the local file system that is handy while testing
- * and another which will point to the HDFS backend.
- */
-@InterfaceAudience.Private
-public interface StorageHandler extends Closeable{
-
- /**
- * Creates a Storage Volume.
- *
- * @param args - Volume Name
- *
- * @throws IOException
- * @throws OzoneException
- */
- void createVolume(VolumeArgs args) throws IOException, OzoneException;
-
-
- /**
- * setVolumeOwner - sets the owner of the volume.
- *
- * @param args owner info is present in the args
- *
- * @throws IOException
- * @throws OzoneException
- */
- void setVolumeOwner(VolumeArgs args) throws IOException, OzoneException;
-
-
- /**
- * Set Volume Quota.
- *
- * @param args - Has Quota info
- * @param remove - true if the request is to remove the quota
- *
- * @throws IOException
- * @throws OzoneException
- */
- void setVolumeQuota(VolumeArgs args, boolean remove)
- throws IOException, OzoneException;
-
- /**
- * Checks if a Volume exists and the user with a role specified has access
- * to the Volume.
- *
- * @param volume - Volume Name whose access permissions needs to be checked
- * @param acl - requested acls which needs to be checked for access
- *
- * @return - Boolean - True if the user with a role can access the volume.
- * This is possible for owners of the volume and admin users
- *
- * @throws IOException
- * @throws OzoneException
- */
- boolean checkVolumeAccess(String volume, OzoneAcl acl)
- throws IOException, OzoneException;
-
-
- /**
- * Returns the List of Volumes owned by the specific user.
- *
- * @param args - ListArgs
- *
- * @return - List of Volumes
- *
- * @throws IOException
- * @throws OzoneException
- */
- ListVolumes listVolumes(ListArgs args) throws IOException, OzoneException;
-
- /**
- * Deletes an Empty Volume.
- *
- * @param args - Volume Args
- *
- * @throws IOException
- * @throws OzoneException
- */
- void deleteVolume(VolumeArgs args) throws IOException, OzoneException;
-
-
- /**
- * Returns Info about the specified Volume.
- *
- * @param args - Volume Args
- *
- * @return VolumeInfo
- *
- * @throws IOException
- * @throws OzoneException
- */
- VolumeInfo getVolumeInfo(VolumeArgs args) throws IOException, OzoneException;
-
- /**
- * Creates a Bucket in specified Volume.
- *
- * @param args BucketArgs- BucketName, UserName and Acls
- *
- * @throws IOException
- */
- void createBucket(BucketArgs args) throws IOException, OzoneException;
-
- /**
- * Adds or Removes ACLs from a Bucket.
- *
- * @param args - BucketArgs
- *
- * @throws IOException
- */
- void setBucketAcls(BucketArgs args) throws IOException, OzoneException;
-
- /**
- * Enables or disables Bucket Versioning.
- *
- * @param args - BucketArgs
- *
- * @throws IOException
- */
- void setBucketVersioning(BucketArgs args) throws IOException, OzoneException;
-
- /**
- * Sets the Storage Class of a Bucket.
- *
- * @param args - BucketArgs
- *
- * @throws IOException
- */
- void setBucketStorageClass(BucketArgs args)
- throws IOException, OzoneException;
-
- /**
- * Deletes a bucket if it is empty.
- *
- * @param args Bucket args structure
- *
- * @throws IOException
- */
- void deleteBucket(BucketArgs args) throws IOException, OzoneException;
-
- /**
- * true if the bucket exists and user has read access
- * to the bucket else throws Exception.
- *
- * @param args Bucket args structure
- *
- * @throws IOException
- */
- void checkBucketAccess(BucketArgs args) throws IOException, OzoneException;
-
-
- /**
- * Returns all Buckets of a specified Volume.
- *
- * @param listArgs -- List Args.
- *
- * @return ListAllBuckets
- *
- * @throws OzoneException
- */
- ListBuckets listBuckets(ListArgs listArgs) throws
- IOException, OzoneException;
-
-
- /**
- * Returns Bucket's Metadata as a String.
- *
- * @param args Bucket args structure
- *
- * @return Info about the bucket
- *
- * @throws IOException
- */
- BucketInfo getBucketInfo(BucketArgs args) throws IOException, OzoneException;
-
- /**
- * Writes a key in an existing bucket.
- *
- * @param args KeyArgs
- *
- * @return InputStream
- *
- * @throws OzoneException
- */
- OutputStream newKeyWriter(KeyArgs args)
- throws IOException, OzoneException;
-
-
- /**
- * Tells the file system that the object has been written out
- * completely and it can do any house keeping operation that needs
- * to be done.
- *
- * @param args Key Args
- *
- * @param stream
- * @throws IOException
- */
- void commitKey(KeyArgs args, OutputStream stream)
- throws IOException, OzoneException;
-
-
- /**
- * Reads a key from an existing bucket.
- *
- * @param args KeyArgs
- *
- * @return LengthInputStream
- *
- * @throws IOException
- */
- LengthInputStream newKeyReader(KeyArgs args)
- throws IOException, OzoneException;
-
-
- /**
- * Deletes an existing key.
- *
- * @param args KeyArgs
- *
- * @throws OzoneException
- */
- void deleteKey(KeyArgs args) throws IOException, OzoneException;
-
-
- /**
- * Returns a list of Key.
- *
- * @param args KeyArgs
- *
- * @return BucketList
- *
- * @throws IOException
- */
- ListKeys listKeys(ListArgs args) throws IOException, OzoneException;
-
- /**
- * Get information of the specified Key.
- *
- * @param args Key Args
- *
- * @return KeyInfo
- *
- * @throws IOException
- * @throws OzoneException
- */
- KeyInfo getKeyInfo(KeyArgs args) throws IOException, OzoneException;
-
- /**
- * Closes all the opened resources.
- */
- void close();
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/UserAuth.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/UserAuth.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/UserAuth.java
deleted file mode 100644
index a1d2e7c..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/UserAuth.java
+++ /dev/null
@@ -1,101 +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.interfaces;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.web.handlers.UserArgs;
-
-/**
- * This interface is used by Ozone to determine user identity.
- *
- * Please see concrete implementations for more information
- */
-@InterfaceAudience.Private
-public interface UserAuth {
- /**
- * Returns the user name as a string from the URI and HTTP headers.
- *
- * @param userArgs - userArgs
- *
- * @return String - User name
- *
- * @throws OzoneException
- */
- String getUser(UserArgs userArgs) throws OzoneException;
-
- /**
- * Returns all the Groups that user is a member of.
- *
- * @param userArgs - userArgs
- *
- * @return Array of Groups
- *
- * @throws OzoneException
- */
- String[] getGroups(UserArgs userArgs) throws OzoneException;
-
- /**
- * Returns true if a user is a Admin.
- *
- * @param userArgs - userArgs
- *
- * @return true if Admin , false otherwise
- *
- * @throws OzoneException -- Allows the underlying system
- * to throw, that error will get propagated to clients
- */
- boolean isAdmin(UserArgs userArgs) throws OzoneException;
-
- /**
- * Returns true if the request is Anonymous.
- *
- * @param userArgs - userArgs
- *
- * @return true if the request is anonymous, false otherwise.
- *
- * @throws OzoneException - Will be propagated back to end user
- */
- boolean isAnonymous(UserArgs userArgs) throws OzoneException;
-
- /**
- * Returns true if the name is a recognizable user in the system.
- *
- * @param userName - User Name to check
- * @param userArgs - userArgs
- *
- * @return true if the username string is the name of a valid user.
- *
- * @throws OzoneException - Will be propagated back to end user
- */
- boolean isUser(String userName, UserArgs userArgs) throws OzoneException;
-
- /**
- * Returns the x-ozone-user or the user on behalf of, This is
- * used in Volume creation path.
- *
- * @param userArgs - userArgs
- *
- * @return a user name if it has x-ozone-user args in header.
- *
- * @throws OzoneException
- */
- String getOzoneUser(UserArgs userArgs) throws OzoneException;
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 85b2240..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/Volume.java
+++ /dev/null
@@ -1,182 +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.interfaces;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.client.rest.headers.Header;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-/**
- * Volume Interface acts as the HTTP entry point for
- * volume related functionality.
- */
-@InterfaceAudience.Private
-@Path("/{volume}")
-@Api(tags = "volume")
-public interface Volume {
-
- /**
- * Creates a Volume owned by the user.
- *
- * Params :
- * Quota - Specifies the Maximum usable size by the user
- * the valid parameters for quota are <int>(<BYTES| MB|GB|TB>) | remove.
- * For example 10GB or "remove".
- *
- * @param volume Volume Name, this has to be unique at Ozone Level
- * @param quota Quota for this Storage Volume - <int>(<MB|GB|TB>) | remove
- * @param req - Request Object - Request Object
- * @param uriInfo - Http UriInfo
- * @param headers Http Headers HttpHeaders
- *
- * @return Response
- *
- * @throws OzoneException
- */
-
- @POST
- @ApiOperation("Creates a Volume owned by the user")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response createVolume(@PathParam("volume") String volume,
- @DefaultValue(Header.OZONE_QUOTA_UNDEFINED)
- @QueryParam(Header.OZONE_QUOTA_QUERY_TAG) String quota,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Updates a Volume owned by the user.
- *
- * Params :
- * Owner - Specifies the name of the owner
- * Quota - Specifies the Maximum usable size by the user
- * the valid parameters for quota are <int>(<MB|GB|TB>) | remove.
- * For example 10GB or "remove".
- *
- * @param volume Volume Name, this has to be unique at Ozone Level
- * @param quota Quota for this Storage Volume - <int>(<MB|GB|TB>) | remove
- * @param req - Request Object - Request Object
- * @param headers Http Headers HttpHeaders
- *
- * @return Response
- *
- * @throws OzoneException
- */
- @PUT
- @ApiOperation("Updates a Volume owned by the user")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response updateVolume(@PathParam("volume") String volume,
- @DefaultValue(Header.OZONE_QUOTA_UNDEFINED)
- @QueryParam(Header.OZONE_QUOTA_QUERY_TAG) String quota,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Deletes a Volume if it is empty.
- *
- * @param volume Storage Volume Name
- *
- * @return Response Response
- *
- * @throws OzoneException
- */
- @DELETE
- @ApiOperation("Deletes a Volume if it is empty")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response deleteVolume(@PathParam("volume") String volume,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
- /**
- * Returns Volume info. This API can be invoked either
- * by admin or the owner
- *
- * @param volume - Storage Volume Name
- * @param req - Http Req
- * @param headers - Http headers
- *
- * @return - Response
- *
- * @throws OzoneException
- */
- @GET
- @ApiOperation(value = "Returns Volume info", notes = "This API can be "
- + "invoked either by admin or the owner")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "x-ozone-version", example = "v1", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "x-ozone-user", example = "user", required =
- true, paramType = "header"),
- @ApiImplicitParam(name = "Date", example = "Date: Mon, 26 Jun 2017 "
- + "04:23:30 GMT", required = true, paramType = "header"),
- @ApiImplicitParam(name = "Authorization", example = "OZONE", required =
- true, paramType = "header")})
- Response getVolumeInfo(@PathParam("volume") String volume,
- @DefaultValue(Header.OZONE_INFO_QUERY_BUCKET)
- @QueryParam(Header.OZONE_INFO_QUERY_TAG) String info,
- @QueryParam(Header.OZONE_LIST_QUERY_PREFIX) String prefix,
- @DefaultValue(Header.OZONE_DEFAULT_LIST_SIZE)
- @QueryParam(Header.OZONE_LIST_QUERY_MAXKEYS) int keys,
- @QueryParam(Header.OZONE_LIST_QUERY_PREVKEY) String prevKey,
- @QueryParam(Header.OZONE_LIST_QUERY_ROOTSCAN) boolean rootScan,
- @Context Request req, @Context UriInfo uriInfo,
- @Context HttpHeaders headers) throws OzoneException;
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/package-info.java
deleted file mode 100644
index 940f179..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/package-info.java
+++ /dev/null
@@ -1,22 +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.interfaces;
-
-/**
- This package contains ozone client side libraries.
- */
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 9747eac..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
+++ /dev/null
@@ -1,379 +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.localstorage;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.ozone.client.io.LengthInputStream;
-import org.apache.hadoop.ozone.client.rest.OzoneException;
-import org.apache.hadoop.ozone.web.handlers.BucketArgs;
-import org.apache.hadoop.ozone.web.handlers.KeyArgs;
-import org.apache.hadoop.ozone.web.handlers.ListArgs;
-import org.apache.hadoop.ozone.web.handlers.VolumeArgs;
-import org.apache.hadoop.ozone.web.interfaces.StorageHandler;
-import org.apache.hadoop.ozone.OzoneAcl;
-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.ListBuckets;
-import org.apache.hadoop.ozone.web.response.ListKeys;
-import org.apache.hadoop.ozone.web.response.ListVolumes;
-import org.apache.hadoop.ozone.web.response.VolumeInfo;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * PLEASE NOTE : This file is a dummy backend for test purposes and prototyping
- * effort only. It does not handle any Object semantics correctly, neither does
- * it take care of security.
- */
-@InterfaceAudience.Private
-public class LocalStorageHandler implements StorageHandler {
- private final Configuration conf;
-
- /**
- * Constructs LocalStorageHandler.
- *
- * @param conf ozone conf.
- */
- public LocalStorageHandler(Configuration conf) {
- this.conf = conf;
- }
-
- /**
- * Creates Storage Volume.
- *
- * @param args - volumeArgs
- * @throws IOException
- */
- @Override
- public void createVolume(VolumeArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.createVolume(args);
-
- }
-
- /**
- * setVolumeOwner - sets the owner of the volume.
- *
- * @param args volumeArgs
- * @throws IOException
- */
- @Override
- public void setVolumeOwner(VolumeArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.setVolumeProperty(args, OzoneMetadataManager.VolumeProperty.OWNER);
- }
-
- /**
- * Set Volume Quota Info.
- *
- * @param args - volumeArgs
- * @param remove - true if the request is to remove the quota
- * @throws IOException
- */
- @Override
- public void setVolumeQuota(VolumeArgs args, boolean remove)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
-
- if (remove) {
- OzoneQuota quota = new OzoneQuota();
- args.setQuota(quota);
- }
- oz.setVolumeProperty(args, OzoneMetadataManager.VolumeProperty.QUOTA);
- }
-
- /**
- * Checks if a Volume exists and the user specified has access to the volume.
- *
- * @param volume - Volume Name
- * @param acl - Ozone acl which needs to be compared for access
- * @return - Boolean - True if the user can modify the volume. This is
- * possible for owners of the volume and admin users
- * @throws IOException
- */
- @Override
- public boolean checkVolumeAccess(String volume, OzoneAcl acl)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.checkVolumeAccess(volume, acl);
- }
-
- /**
- * Returns Info about the specified Volume.
- *
- * @param args - volumeArgs
- * @return VolumeInfo
- * @throws IOException
- */
- @Override
- public VolumeInfo getVolumeInfo(VolumeArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.getVolumeInfo(args);
- }
-
- /**
- * Deletes an Empty Volume.
- *
- * @param args - Volume Args
- * @throws IOException
- */
- @Override
- public void deleteVolume(VolumeArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.deleteVolume(args);
-
- }
-
- /**
- * Returns the List of Volumes owned by the specific user.
- *
- * @param args - ListArgs
- * @return - List of Volumes
- * @throws IOException
- */
- @Override
- public ListVolumes listVolumes(ListArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.listVolumes(args);
- }
-
- /**
- * true if the bucket exists and user has read access to the bucket else
- * throws Exception.
- *
- * @param args Bucket args structure
- * @throws IOException
- */
- @Override
- public void checkBucketAccess(BucketArgs args)
- throws IOException, OzoneException {
-
- }
-
- /**
- * Creates a Bucket in specified Volume.
- *
- * @param args BucketArgs- BucketName, UserName and Acls
- * @throws IOException
- */
- @Override
- public void createBucket(BucketArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.createBucket(args);
- }
-
- /**
- * Adds or Removes ACLs from a Bucket.
- *
- * @param args - BucketArgs
- * @throws IOException
- */
- @Override
- public void setBucketAcls(BucketArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.setBucketProperty(args, OzoneMetadataManager.BucketProperty.ACLS);
- }
-
- /**
- * Enables or disables Bucket Versioning.
- *
- * @param args - BucketArgs
- * @throws IOException
- */
- @Override
- public void setBucketVersioning(BucketArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.setBucketProperty(args, OzoneMetadataManager.BucketProperty.VERSIONING);
-
- }
-
- /**
- * Sets the Storage Class of a Bucket.
- *
- * @param args - BucketArgs
- * @throws IOException
- */
- @Override
- public void setBucketStorageClass(BucketArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.setBucketProperty(args, OzoneMetadataManager.BucketProperty.STORAGETYPE);
-
- }
-
- /**
- * Deletes a bucket if it is empty.
- *
- * @param args Bucket args structure
- * @throws IOException
- */
- @Override
- public void deleteBucket(BucketArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.deleteBucket(args);
- }
-
- /**
- * Returns all Buckets of a specified Volume.
- *
- * @param args --User Args
- * @return ListAllBuckets
- * @throws OzoneException
- */
- @Override
- public ListBuckets listBuckets(ListArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.listBuckets(args);
- }
-
- /**
- * Returns Bucket's Metadata as a String.
- *
- * @param args Bucket args structure
- * @return Info about the bucket
- * @throws IOException
- */
- @Override
- public BucketInfo getBucketInfo(BucketArgs args)
- throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.getBucketInfo(args);
- }
-
- /**
- * Writes a key in an existing bucket.
- *
- * @param args KeyArgs
- * @return InputStream
- * @throws OzoneException
- */
- @Override
- public OutputStream newKeyWriter(KeyArgs args) throws IOException,
- OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.createKey(args);
- }
-
- /**
- * Tells the file system that the object has been written out completely and
- * it can do any house keeping operation that needs to be done.
- *
- * @param args Key Args
- * @param stream
- * @throws IOException
- */
- @Override
- public void commitKey(KeyArgs args, OutputStream stream) throws
- IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.commitKey(args, stream);
-
- }
-
- /**
- * Reads a key from an existing bucket.
- *
- * @param args KeyArgs
- * @return LengthInputStream
- * @throws IOException
- */
- @Override
- public LengthInputStream newKeyReader(KeyArgs args) throws IOException,
- OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.newKeyReader(args);
- }
-
- /**
- * Deletes an existing key.
- *
- * @param args KeyArgs
- * @throws OzoneException
- */
- @Override
- public void deleteKey(KeyArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- oz.deleteKey(args);
- }
-
- /**
- * Returns a list of Key.
- *
- * @param args KeyArgs
- * @return BucketList
- * @throws IOException
- */
- @Override
- public ListKeys listKeys(ListArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz =
- OzoneMetadataManager.getOzoneMetadataManager(conf);
- return oz.listKeys(args);
-
- }
-
- /**
- * Get information of the specified Key.
- *
- * @param args Key Args
- *
- * @return KeyInfo
- *
- * @throws IOException
- * @throws OzoneException
- */
- @Override
- public KeyInfo getKeyInfo(KeyArgs args) throws IOException, OzoneException {
- OzoneMetadataManager oz = OzoneMetadataManager
- .getOzoneMetadataManager(conf);
- return oz.getKeyInfo(args);
- }
-
- @Override
- public void close() {
- //No resource to close, do nothing.
- }
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org