Merge -r 1368307:1368308 from trunk to branch. FIXES: HDFS-3724
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1368310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6406fb59f7
commit
f5dfa69617
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.client;
|
package org.apache.hadoop.fs.http.client;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.ContentSummary;
|
import org.apache.hadoop.fs.ContentSummary;
|
||||||
import org.apache.hadoop.fs.DelegationTokenRenewer;
|
import org.apache.hadoop.fs.DelegationTokenRenewer;
|
||||||
|
@ -68,6 +69,7 @@ import java.util.concurrent.Callable;
|
||||||
* <p/>
|
* <p/>
|
||||||
* This implementation allows a user to access HDFS over HTTP via a HttpFSServer server.
|
* This implementation allows a user to access HDFS over HTTP via a HttpFSServer server.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSFileSystem extends FileSystem
|
public class HttpFSFileSystem extends FileSystem
|
||||||
implements DelegationTokenRenewer.Renewable {
|
implements DelegationTokenRenewer.Renewable {
|
||||||
|
|
||||||
|
@ -160,7 +162,8 @@ public class HttpFSFileSystem extends FileSystem
|
||||||
private static final String HTTP_POST = "POST";
|
private static final String HTTP_POST = "POST";
|
||||||
private static final String HTTP_DELETE = "DELETE";
|
private static final String HTTP_DELETE = "DELETE";
|
||||||
|
|
||||||
public enum Operation {
|
@InterfaceAudience.Private
|
||||||
|
public static enum Operation {
|
||||||
OPEN(HTTP_GET), GETFILESTATUS(HTTP_GET), LISTSTATUS(HTTP_GET),
|
OPEN(HTTP_GET), GETFILESTATUS(HTTP_GET), LISTSTATUS(HTTP_GET),
|
||||||
GETHOMEDIRECTORY(HTTP_GET), GETCONTENTSUMMARY(HTTP_GET),
|
GETHOMEDIRECTORY(HTTP_GET), GETCONTENTSUMMARY(HTTP_GET),
|
||||||
GETFILECHECKSUM(HTTP_GET), GETFILEBLOCKLOCATIONS(HTTP_GET),
|
GETFILECHECKSUM(HTTP_GET), GETFILEBLOCKLOCATIONS(HTTP_GET),
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.fs.http.client;
|
package org.apache.hadoop.fs.http.client;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
|
import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
|
||||||
|
@ -43,6 +44,7 @@ import java.util.Map;
|
||||||
* A <code>KerberosAuthenticator</code> subclass that fallback to
|
* A <code>KerberosAuthenticator</code> subclass that fallback to
|
||||||
* {@link HttpFSPseudoAuthenticator}.
|
* {@link HttpFSPseudoAuthenticator}.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSKerberosAuthenticator extends KerberosAuthenticator {
|
public class HttpFSKerberosAuthenticator extends KerberosAuthenticator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,6 +73,7 @@ public class HttpFSKerberosAuthenticator extends KerberosAuthenticator {
|
||||||
/**
|
/**
|
||||||
* DelegationToken operations.
|
* DelegationToken operations.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static enum DelegationTokenOperation {
|
public static enum DelegationTokenOperation {
|
||||||
GETDELEGATIONTOKEN(HTTP_GET, true),
|
GETDELEGATIONTOKEN(HTTP_GET, true),
|
||||||
GETDELEGATIONTOKENS(HTTP_GET, true),
|
GETDELEGATIONTOKENS(HTTP_GET, true),
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.fs.http.client;
|
package org.apache.hadoop.fs.http.client;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.authentication.client.PseudoAuthenticator;
|
import org.apache.hadoop.security.authentication.client.PseudoAuthenticator;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import java.io.IOException;
|
||||||
* A <code>PseudoAuthenticator</code> subclass that uses FileSystemAccess's
|
* A <code>PseudoAuthenticator</code> subclass that uses FileSystemAccess's
|
||||||
* <code>UserGroupInformation</code> to obtain the client user name (the UGI's login user).
|
* <code>UserGroupInformation</code> to obtain the client user name (the UGI's login user).
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSPseudoAuthenticator extends PseudoAuthenticator {
|
public class HttpFSPseudoAuthenticator extends PseudoAuthenticator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.client;
|
package org.apache.hadoop.fs.http.client;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
|
@ -35,6 +36,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* Utility methods used by HttpFS classes.
|
* Utility methods used by HttpFS classes.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSUtils {
|
public class HttpFSUtils {
|
||||||
|
|
||||||
public static final String SERVICE_NAME = "/webhdfs";
|
public static final String SERVICE_NAME = "/webhdfs";
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
|
@ -37,6 +38,7 @@ import java.util.Set;
|
||||||
* Filter that Enforces the content-type to be application/octet-stream for
|
* Filter that Enforces the content-type to be application/octet-stream for
|
||||||
* POST and PUT requests.
|
* POST and PUT requests.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class CheckUploadContentTypeFilter implements Filter {
|
public class CheckUploadContentTypeFilter implements Filter {
|
||||||
|
|
||||||
private static final Set<String> UPLOAD_OPERATIONS = new HashSet<String>();
|
private static final Set<String> UPLOAD_OPERATIONS = new HashSet<String>();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.ContentSummary;
|
import org.apache.hadoop.fs.ContentSummary;
|
||||||
import org.apache.hadoop.fs.FileChecksum;
|
import org.apache.hadoop.fs.FileChecksum;
|
||||||
import org.apache.hadoop.fs.FileStatus;
|
import org.apache.hadoop.fs.FileStatus;
|
||||||
|
@ -40,6 +41,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* FileSystem operation executors used by {@link HttpFSServer}.
|
* FileSystem operation executors used by {@link HttpFSServer}.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class FSOperations {
|
public class FSOperations {
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked", "deprecation"})
|
@SuppressWarnings({"unchecked", "deprecation"})
|
||||||
|
@ -160,6 +162,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs an append FileSystemAccess files system operation.
|
* Executor that performs an append FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSAppend implements FileSystemAccess.FileSystemExecutor<Void> {
|
public static class FSAppend implements FileSystemAccess.FileSystemExecutor<Void> {
|
||||||
private InputStream is;
|
private InputStream is;
|
||||||
private Path path;
|
private Path path;
|
||||||
|
@ -198,6 +201,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a content-summary FileSystemAccess files system operation.
|
* Executor that performs a content-summary FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSContentSummary implements FileSystemAccess.FileSystemExecutor<Map> {
|
public static class FSContentSummary implements FileSystemAccess.FileSystemExecutor<Map> {
|
||||||
private Path path;
|
private Path path;
|
||||||
|
|
||||||
|
@ -230,6 +234,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a create FileSystemAccess files system operation.
|
* Executor that performs a create FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSCreate implements FileSystemAccess.FileSystemExecutor<Void> {
|
public static class FSCreate implements FileSystemAccess.FileSystemExecutor<Void> {
|
||||||
private InputStream is;
|
private InputStream is;
|
||||||
private Path path;
|
private Path path;
|
||||||
|
@ -288,6 +293,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a delete FileSystemAccess files system operation.
|
* Executor that performs a delete FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSDelete implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
public static class FSDelete implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
||||||
private Path path;
|
private Path path;
|
||||||
private boolean recursive;
|
private boolean recursive;
|
||||||
|
@ -324,6 +330,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a file-checksum FileSystemAccess files system operation.
|
* Executor that performs a file-checksum FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSFileChecksum implements FileSystemAccess.FileSystemExecutor<Map> {
|
public static class FSFileChecksum implements FileSystemAccess.FileSystemExecutor<Map> {
|
||||||
private Path path;
|
private Path path;
|
||||||
|
|
||||||
|
@ -356,6 +363,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a file-status FileSystemAccess files system operation.
|
* Executor that performs a file-status FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSFileStatus implements FileSystemAccess.FileSystemExecutor<Map> {
|
public static class FSFileStatus implements FileSystemAccess.FileSystemExecutor<Map> {
|
||||||
private Path path;
|
private Path path;
|
||||||
|
|
||||||
|
@ -388,6 +396,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a home-dir FileSystemAccess files system operation.
|
* Executor that performs a home-dir FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSHomeDir implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
public static class FSHomeDir implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -413,6 +422,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a list-status FileSystemAccess files system operation.
|
* Executor that performs a list-status FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSListStatus implements FileSystemAccess.FileSystemExecutor<Map>, PathFilter {
|
public static class FSListStatus implements FileSystemAccess.FileSystemExecutor<Map>, PathFilter {
|
||||||
private Path path;
|
private Path path;
|
||||||
private PathFilter filter;
|
private PathFilter filter;
|
||||||
|
@ -456,6 +466,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a mkdirs FileSystemAccess files system operation.
|
* Executor that performs a mkdirs FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSMkdirs implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
public static class FSMkdirs implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
||||||
|
|
||||||
private Path path;
|
private Path path;
|
||||||
|
@ -494,6 +505,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a open FileSystemAccess files system operation.
|
* Executor that performs a open FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSOpen implements FileSystemAccess.FileSystemExecutor<InputStream> {
|
public static class FSOpen implements FileSystemAccess.FileSystemExecutor<InputStream> {
|
||||||
private Path path;
|
private Path path;
|
||||||
|
|
||||||
|
@ -526,6 +538,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a rename FileSystemAccess files system operation.
|
* Executor that performs a rename FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSRename implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
public static class FSRename implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
||||||
private Path path;
|
private Path path;
|
||||||
private Path toPath;
|
private Path toPath;
|
||||||
|
@ -562,6 +575,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a set-owner FileSystemAccess files system operation.
|
* Executor that performs a set-owner FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSSetOwner implements FileSystemAccess.FileSystemExecutor<Void> {
|
public static class FSSetOwner implements FileSystemAccess.FileSystemExecutor<Void> {
|
||||||
private Path path;
|
private Path path;
|
||||||
private String owner;
|
private String owner;
|
||||||
|
@ -600,6 +614,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a set-permission FileSystemAccess files system operation.
|
* Executor that performs a set-permission FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSSetPermission implements FileSystemAccess.FileSystemExecutor<Void> {
|
public static class FSSetPermission implements FileSystemAccess.FileSystemExecutor<Void> {
|
||||||
|
|
||||||
private Path path;
|
private Path path;
|
||||||
|
@ -637,6 +652,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a set-replication FileSystemAccess files system operation.
|
* Executor that performs a set-replication FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSSetReplication implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
public static class FSSetReplication implements FileSystemAccess.FileSystemExecutor<JSONObject> {
|
||||||
private Path path;
|
private Path path;
|
||||||
private short replication;
|
private short replication;
|
||||||
|
@ -676,6 +692,7 @@ public class FSOperations {
|
||||||
/**
|
/**
|
||||||
* Executor that performs a set-times FileSystemAccess files system operation.
|
* Executor that performs a set-times FileSystemAccess files system operation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FSSetTimes implements FileSystemAccess.FileSystemExecutor<Void> {
|
public static class FSSetTimes implements FileSystemAccess.FileSystemExecutor<Void> {
|
||||||
private Path path;
|
private Path path;
|
||||||
private long mTime;
|
private long mTime;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
|
import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
|
@ -30,6 +31,7 @@ import java.util.Properties;
|
||||||
* Subclass of hadoop-auth <code>AuthenticationFilter</code> that obtains its configuration
|
* Subclass of hadoop-auth <code>AuthenticationFilter</code> that obtains its configuration
|
||||||
* from HttpFSServer's server configuration.
|
* from HttpFSServer's server configuration.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSAuthenticationFilter extends AuthenticationFilter {
|
public class HttpFSAuthenticationFilter extends AuthenticationFilter {
|
||||||
private static final String CONF_PREFIX = "httpfs.authentication.";
|
private static final String CONF_PREFIX = "httpfs.authentication.";
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
import com.sun.jersey.api.container.ContainerException;
|
import com.sun.jersey.api.container.ContainerException;
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.service.FileSystemAccessException;
|
import org.apache.hadoop.lib.service.FileSystemAccessException;
|
||||||
import org.apache.hadoop.lib.wsrs.ExceptionProvider;
|
import org.apache.hadoop.lib.wsrs.ExceptionProvider;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -35,6 +36,7 @@ import java.io.IOException;
|
||||||
* exceptions to HTTP status codes.
|
* exceptions to HTTP status codes.
|
||||||
*/
|
*/
|
||||||
@Provider
|
@Provider
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSExceptionProvider extends ExceptionProvider {
|
public class HttpFSExceptionProvider extends ExceptionProvider {
|
||||||
private static Logger AUDIT_LOG = LoggerFactory.getLogger("httpfsaudit");
|
private static Logger AUDIT_LOG = LoggerFactory.getLogger("httpfsaudit");
|
||||||
private static Logger LOG = LoggerFactory.getLogger(HttpFSExceptionProvider.class);
|
private static Logger LOG = LoggerFactory.getLogger(HttpFSExceptionProvider.class);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator;
|
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator.DelegationTokenOperation;
|
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator.DelegationTokenOperation;
|
||||||
|
@ -52,6 +53,7 @@ import java.util.Set;
|
||||||
* If not delegation token is present in the request it delegates to the
|
* If not delegation token is present in the request it delegates to the
|
||||||
* {@link KerberosAuthenticationHandler}
|
* {@link KerberosAuthenticationHandler}
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSKerberosAuthenticationHandler
|
public class HttpFSKerberosAuthenticationHandler
|
||||||
extends KerberosAuthenticationHandler {
|
extends KerberosAuthenticationHandler {
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem.Operation;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem.Operation;
|
||||||
import org.apache.hadoop.lib.wsrs.BooleanParam;
|
import org.apache.hadoop.lib.wsrs.BooleanParam;
|
||||||
|
@ -38,6 +39,7 @@ import java.util.regex.Pattern;
|
||||||
* HttpFS ParametersProvider.
|
* HttpFS ParametersProvider.
|
||||||
*/
|
*/
|
||||||
@Provider
|
@Provider
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSParametersProvider extends ParametersProvider {
|
public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
|
|
||||||
private static final Map<Enum, Class<Param<?>>[]> PARAMS_DEF =
|
private static final Map<Enum, Class<Param<?>>[]> PARAMS_DEF =
|
||||||
|
@ -85,6 +87,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for access-time parameter.
|
* Class for access-time parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class AccessTimeParam extends LongParam {
|
public static class AccessTimeParam extends LongParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +105,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for block-size parameter.
|
* Class for block-size parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class BlockSizeParam extends LongParam {
|
public static class BlockSizeParam extends LongParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,6 +124,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for data parameter.
|
* Class for data parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class DataParam extends BooleanParam {
|
public static class DataParam extends BooleanParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +143,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for operation parameter.
|
* Class for operation parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class OperationParam extends EnumParam<HttpFSFileSystem.Operation> {
|
public static class OperationParam extends EnumParam<HttpFSFileSystem.Operation> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,6 +162,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for delete's recursive parameter.
|
* Class for delete's recursive parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class RecursiveParam extends BooleanParam {
|
public static class RecursiveParam extends BooleanParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,6 +181,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for do-as parameter.
|
* Class for do-as parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class DoAsParam extends StringParam {
|
public static class DoAsParam extends StringParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,6 +216,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for filter parameter.
|
* Class for filter parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class FilterParam extends StringParam {
|
public static class FilterParam extends StringParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,6 +236,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for group parameter.
|
* Class for group parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class GroupParam extends StringParam {
|
public static class GroupParam extends StringParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,6 +256,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for len parameter.
|
* Class for len parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class LenParam extends LongParam {
|
public static class LenParam extends LongParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,6 +275,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for modified-time parameter.
|
* Class for modified-time parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class ModifiedTimeParam extends LongParam {
|
public static class ModifiedTimeParam extends LongParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,6 +294,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for offset parameter.
|
* Class for offset parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class OffsetParam extends LongParam {
|
public static class OffsetParam extends LongParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,6 +313,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for overwrite parameter.
|
* Class for overwrite parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class OverwriteParam extends BooleanParam {
|
public static class OverwriteParam extends BooleanParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,6 +332,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for owner parameter.
|
* Class for owner parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class OwnerParam extends StringParam {
|
public static class OwnerParam extends StringParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,6 +352,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for permission parameter.
|
* Class for permission parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class PermissionParam extends ShortParam {
|
public static class PermissionParam extends ShortParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -357,6 +373,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for replication parameter.
|
* Class for replication parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class ReplicationParam extends ShortParam {
|
public static class ReplicationParam extends ShortParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -375,6 +392,7 @@ public class HttpFSParametersProvider extends ParametersProvider {
|
||||||
/**
|
/**
|
||||||
* Class for to-path parameter.
|
* Class for to-path parameter.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static class DestinationParam extends StringParam {
|
public static class DestinationParam extends StringParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.service.FileSystemAccess;
|
import org.apache.hadoop.lib.service.FileSystemAccess;
|
||||||
import org.apache.hadoop.lib.servlet.FileSystemReleaseFilter;
|
import org.apache.hadoop.lib.servlet.FileSystemReleaseFilter;
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ import org.apache.hadoop.lib.servlet.FileSystemReleaseFilter;
|
||||||
* Filter that releases FileSystemAccess filesystem instances upon HTTP request
|
* Filter that releases FileSystemAccess filesystem instances upon HTTP request
|
||||||
* completion.
|
* completion.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSReleaseFilter extends FileSystemReleaseFilter {
|
public class HttpFSReleaseFilter extends FileSystemReleaseFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
||||||
|
@ -82,6 +83,7 @@ import java.util.Map;
|
||||||
* different operations.
|
* different operations.
|
||||||
*/
|
*/
|
||||||
@Path(HttpFSFileSystem.SERVICE_VERSION)
|
@Path(HttpFSFileSystem.SERVICE_VERSION)
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSServer {
|
public class HttpFSServer {
|
||||||
private static Logger AUDIT_LOG = LoggerFactory.getLogger("httpfsaudit");
|
private static Logger AUDIT_LOG = LoggerFactory.getLogger("httpfsaudit");
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.fs.http.server;
|
package org.apache.hadoop.fs.http.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||||
import org.apache.hadoop.lib.server.ServerException;
|
import org.apache.hadoop.lib.server.ServerException;
|
||||||
|
@ -39,6 +40,7 @@ import java.io.IOException;
|
||||||
* All the configuration is loaded from configuration properties prefixed
|
* All the configuration is loaded from configuration properties prefixed
|
||||||
* with <code>httpfs.</code>.
|
* with <code>httpfs.</code>.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HttpFSServerWebApp extends ServerWebApp {
|
public class HttpFSServerWebApp extends ServerWebApp {
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
LoggerFactory.getLogger(HttpFSServerWebApp.class);
|
LoggerFactory.getLogger(HttpFSServerWebApp.class);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.lang;
|
package org.apache.hadoop.lib.lang;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.util.Check;
|
import org.apache.hadoop.lib.util.Check;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
@ -26,6 +27,7 @@ import java.util.concurrent.Callable;
|
||||||
* Adapter class that allows <code>Runnable</code>s and <code>Callable</code>s to
|
* Adapter class that allows <code>Runnable</code>s and <code>Callable</code>s to
|
||||||
* be treated as the other.
|
* be treated as the other.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class RunnableCallable implements Callable<Void>, Runnable {
|
public class RunnableCallable implements Callable<Void>, Runnable {
|
||||||
private Runnable runnable;
|
private Runnable runnable;
|
||||||
private Callable<?> callable;
|
private Callable<?> callable;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.lang;
|
package org.apache.hadoop.lib.lang;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.util.Check;
|
import org.apache.hadoop.lib.util.Check;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -26,6 +27,7 @@ import java.text.MessageFormat;
|
||||||
* Generic exception that requires error codes and uses the a message
|
* Generic exception that requires error codes and uses the a message
|
||||||
* template from the error code.
|
* template from the error code.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class XException extends Exception {
|
public class XException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.server;
|
package org.apache.hadoop.lib.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.lib.util.ConfigurationUtils;
|
import org.apache.hadoop.lib.util.ConfigurationUtils;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* Convenience class implementing the {@link Service} interface.
|
* Convenience class implementing the {@link Service} interface.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class BaseService implements Service {
|
public abstract class BaseService implements Service {
|
||||||
private String prefix;
|
private String prefix;
|
||||||
private Server server;
|
private Server server;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.server;
|
package org.apache.hadoop.lib.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.lib.util.Check;
|
import org.apache.hadoop.lib.util.Check;
|
||||||
import org.apache.hadoop.lib.util.ConfigurationUtils;
|
import org.apache.hadoop.lib.util.ConfigurationUtils;
|
||||||
|
@ -76,6 +77,7 @@ import java.util.Properties;
|
||||||
* post-initialized (this enables late/conditional service bindings).
|
* post-initialized (this enables late/conditional service bindings).
|
||||||
* <p/>
|
* <p/>
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class Server {
|
public class Server {
|
||||||
private Logger log;
|
private Logger log;
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ public class Server {
|
||||||
/**
|
/**
|
||||||
* Enumeration that defines the server status.
|
* Enumeration that defines the server status.
|
||||||
*/
|
*/
|
||||||
public enum Status {
|
@InterfaceAudience.Private
|
||||||
|
public static enum Status {
|
||||||
UNDEF(false, false),
|
UNDEF(false, false),
|
||||||
BOOTING(false, true),
|
BOOTING(false, true),
|
||||||
HALTED(true, true),
|
HALTED(true, true),
|
||||||
|
|
|
@ -18,16 +18,19 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.server;
|
package org.apache.hadoop.lib.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.XException;
|
import org.apache.hadoop.lib.lang.XException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception thrown by the {@link Server} class.
|
* Exception thrown by the {@link Server} class.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class ServerException extends XException {
|
public class ServerException extends XException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error codes use by the {@link Server} class.
|
* Error codes use by the {@link Server} class.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public static enum ERROR implements XException.ERROR {
|
public static enum ERROR implements XException.ERROR {
|
||||||
S01("Dir [{0}] does not exist"),
|
S01("Dir [{0}] does not exist"),
|
||||||
S02("[{0}] is not a directory"),
|
S02("[{0}] is not a directory"),
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.server;
|
package org.apache.hadoop.lib.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service interface for components to be managed by the {@link Server} class.
|
* Service interface for components to be managed by the {@link Server} class.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface Service {
|
public interface Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.server;
|
package org.apache.hadoop.lib.server;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.XException;
|
import org.apache.hadoop.lib.lang.XException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception thrown by {@link Service} implementations.
|
* Exception thrown by {@link Service} implementations.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class ServiceException extends ServerException {
|
public class ServiceException extends ServerException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator;
|
import org.apache.hadoop.fs.http.client.HttpFSKerberosAuthenticator;
|
||||||
import org.apache.hadoop.io.Text;
|
import org.apache.hadoop.io.Text;
|
||||||
import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
|
import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
|
||||||
|
@ -24,6 +25,7 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdenti
|
||||||
/**
|
/**
|
||||||
* HttpFS <code>DelegationTokenIdentifier</code> implementation.
|
* HttpFS <code>DelegationTokenIdentifier</code> implementation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class DelegationTokenIdentifier
|
public class DelegationTokenIdentifier
|
||||||
extends AbstractDelegationTokenIdentifier {
|
extends AbstractDelegationTokenIdentifier {
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service interface to manage HttpFS delegation tokens.
|
* Service interface to manage HttpFS delegation tokens.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface DelegationTokenManager {
|
public interface DelegationTokenManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,11 +17,13 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.XException;
|
import org.apache.hadoop.lib.lang.XException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception thrown by the {@link DelegationTokenManager} service implementation.
|
* Exception thrown by the {@link DelegationTokenManager} service implementation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class DelegationTokenManagerException extends XException {
|
public class DelegationTokenManagerException extends XException {
|
||||||
|
|
||||||
public enum ERROR implements XException.ERROR {
|
public enum ERROR implements XException.ERROR {
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface FileSystemAccess {
|
public interface FileSystemAccess {
|
||||||
|
|
||||||
public interface FileSystemExecutor<T> {
|
public interface FileSystemExecutor<T> {
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.XException;
|
import org.apache.hadoop.lib.lang.XException;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class FileSystemAccessException extends XException {
|
public class FileSystemAccessException extends XException {
|
||||||
|
|
||||||
public enum ERROR implements XException.ERROR {
|
public enum ERROR implements XException.ERROR {
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface Groups {
|
public interface Groups {
|
||||||
|
|
||||||
public List<String> getGroups(String user) throws IOException;
|
public List<String> getGroups(String user) throws IOException;
|
||||||
|
|
|
@ -18,8 +18,11 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface Instrumentation {
|
public interface Instrumentation {
|
||||||
|
|
||||||
public interface Cron {
|
public interface Cron {
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.AccessControlException;
|
import java.security.AccessControlException;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface ProxyUser {
|
public interface ProxyUser {
|
||||||
|
|
||||||
public void validate(String proxyUser, String proxyHost, String doAsUser) throws IOException, AccessControlException;
|
public void validate(String proxyUser, String proxyHost, String doAsUser) throws IOException, AccessControlException;
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service;
|
package org.apache.hadoop.lib.service;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public interface Scheduler {
|
public interface Scheduler {
|
||||||
|
|
||||||
public abstract void schedule(Callable<?> callable, long delay, long interval, TimeUnit unit);
|
public abstract void schedule(Callable<?> callable, long delay, long interval, TimeUnit unit);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service.hadoop;
|
package org.apache.hadoop.lib.service.hadoop;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
|
@ -47,6 +48,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class FileSystemAccessService extends BaseService implements FileSystemAccess {
|
public class FileSystemAccessService extends BaseService implements FileSystemAccess {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(FileSystemAccessService.class);
|
private static final Logger LOG = LoggerFactory.getLogger(FileSystemAccessService.class);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service.instrumentation;
|
package org.apache.hadoop.lib.service.instrumentation;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.server.BaseService;
|
import org.apache.hadoop.lib.server.BaseService;
|
||||||
import org.apache.hadoop.lib.server.ServiceException;
|
import org.apache.hadoop.lib.server.ServiceException;
|
||||||
import org.apache.hadoop.lib.service.Instrumentation;
|
import org.apache.hadoop.lib.service.Instrumentation;
|
||||||
|
@ -39,6 +40,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class InstrumentationService extends BaseService implements Instrumentation {
|
public class InstrumentationService extends BaseService implements Instrumentation {
|
||||||
public static final String PREFIX = "instrumentation";
|
public static final String PREFIX = "instrumentation";
|
||||||
public static final String CONF_TIMERS_SIZE = "timers.size";
|
public static final String CONF_TIMERS_SIZE = "timers.size";
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service.scheduler;
|
package org.apache.hadoop.lib.service.scheduler;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.RunnableCallable;
|
import org.apache.hadoop.lib.lang.RunnableCallable;
|
||||||
import org.apache.hadoop.lib.server.BaseService;
|
import org.apache.hadoop.lib.server.BaseService;
|
||||||
import org.apache.hadoop.lib.server.Server;
|
import org.apache.hadoop.lib.server.Server;
|
||||||
|
@ -35,6 +36,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class SchedulerService extends BaseService implements Scheduler {
|
public class SchedulerService extends BaseService implements Scheduler {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SchedulerService.class);
|
private static final Logger LOG = LoggerFactory.getLogger(SchedulerService.class);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.service.security;
|
package org.apache.hadoop.lib.service.security;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.server.HttpFSServerWebApp;
|
import org.apache.hadoop.fs.http.server.HttpFSServerWebApp;
|
||||||
import org.apache.hadoop.io.Text;
|
import org.apache.hadoop.io.Text;
|
||||||
import org.apache.hadoop.lib.server.BaseService;
|
import org.apache.hadoop.lib.server.BaseService;
|
||||||
|
@ -37,6 +38,7 @@ import java.io.IOException;
|
||||||
/**
|
/**
|
||||||
* DelegationTokenManager service implementation.
|
* DelegationTokenManager service implementation.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class DelegationTokenManagerService extends BaseService
|
public class DelegationTokenManagerService extends BaseService
|
||||||
implements DelegationTokenManager {
|
implements DelegationTokenManager {
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service.security;
|
package org.apache.hadoop.lib.service.security;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.lib.server.BaseService;
|
import org.apache.hadoop.lib.server.BaseService;
|
||||||
import org.apache.hadoop.lib.server.ServiceException;
|
import org.apache.hadoop.lib.server.ServiceException;
|
||||||
|
@ -27,6 +28,7 @@ import org.apache.hadoop.lib.util.ConfigurationUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class GroupsService extends BaseService implements Groups {
|
public class GroupsService extends BaseService implements Groups {
|
||||||
private static final String PREFIX = "groups";
|
private static final String PREFIX = "groups";
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.service.security;
|
package org.apache.hadoop.lib.service.security;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.lib.lang.XException;
|
import org.apache.hadoop.lib.lang.XException;
|
||||||
import org.apache.hadoop.lib.server.BaseService;
|
import org.apache.hadoop.lib.server.BaseService;
|
||||||
import org.apache.hadoop.lib.server.ServiceException;
|
import org.apache.hadoop.lib.server.ServiceException;
|
||||||
|
@ -38,10 +39,12 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class ProxyUserService extends BaseService implements ProxyUser {
|
public class ProxyUserService extends BaseService implements ProxyUser {
|
||||||
private static Logger LOG = LoggerFactory.getLogger(ProxyUserService.class);
|
private static Logger LOG = LoggerFactory.getLogger(ProxyUserService.class);
|
||||||
|
|
||||||
public enum ERROR implements XException.ERROR {
|
@InterfaceAudience.Private
|
||||||
|
public static enum ERROR implements XException.ERROR {
|
||||||
PRXU01("Could not normalize host name [{0}], {1}"),
|
PRXU01("Could not normalize host name [{0}], {1}"),
|
||||||
PRXU02("Missing [{0}] property");
|
PRXU02("Missing [{0}] property");
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.servlet;
|
package org.apache.hadoop.lib.servlet;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.lib.service.FileSystemAccess;
|
import org.apache.hadoop.lib.service.FileSystemAccess;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ import java.io.IOException;
|
||||||
* is streaming out HDFS data and the corresponding filesystem
|
* is streaming out HDFS data and the corresponding filesystem
|
||||||
* instance have to be closed after the streaming completes.
|
* instance have to be closed after the streaming completes.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class FileSystemReleaseFilter implements Filter {
|
public abstract class FileSystemReleaseFilter implements Filter {
|
||||||
private static final ThreadLocal<FileSystem> FILE_SYSTEM_TL = new ThreadLocal<FileSystem>();
|
private static final ThreadLocal<FileSystem> FILE_SYSTEM_TL = new ThreadLocal<FileSystem>();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
package org.apache.hadoop.lib.servlet;
|
package org.apache.hadoop.lib.servlet;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
|
@ -31,6 +33,7 @@ import java.net.InetAddress;
|
||||||
/**
|
/**
|
||||||
* Filter that resolves the requester hostname.
|
* Filter that resolves the requester hostname.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class HostnameFilter implements Filter {
|
public class HostnameFilter implements Filter {
|
||||||
static final ThreadLocal<String> HOSTNAME_TL = new ThreadLocal<String>();
|
static final ThreadLocal<String> HOSTNAME_TL = new ThreadLocal<String>();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.servlet;
|
package org.apache.hadoop.lib.servlet;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
|
@ -42,6 +43,7 @@ import java.security.Principal;
|
||||||
* <li>path: the path of the request URL</li>
|
* <li>path: the path of the request URL</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class MDCFilter implements Filter {
|
public class MDCFilter implements Filter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package org.apache.hadoop.lib.servlet;
|
package org.apache.hadoop.lib.servlet;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.lib.server.Server;
|
import org.apache.hadoop.lib.server.Server;
|
||||||
import org.apache.hadoop.lib.server.ServerException;
|
import org.apache.hadoop.lib.server.ServerException;
|
||||||
|
@ -34,6 +35,7 @@ import java.text.MessageFormat;
|
||||||
* {@link Server} subclass that implements <code>ServletContextListener</code>
|
* {@link Server} subclass that implements <code>ServletContextListener</code>
|
||||||
* and uses its lifecycle to start and stop the server.
|
* and uses its lifecycle to start and stop the server.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class ServerWebApp extends Server implements ServletContextListener {
|
public abstract class ServerWebApp extends Server implements ServletContextListener {
|
||||||
|
|
||||||
private static final String HOME_DIR = ".home.dir";
|
private static final String HOME_DIR = ".home.dir";
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.util;
|
package org.apache.hadoop.lib.util;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -27,6 +29,7 @@ import java.util.regex.Pattern;
|
||||||
* <p/>
|
* <p/>
|
||||||
* Commonly used for method arguments preconditions.
|
* Commonly used for method arguments preconditions.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class Check {
|
public class Check {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.util;
|
package org.apache.hadoop.lib.util;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.w3c.dom.DOMException;
|
import org.w3c.dom.DOMException;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -37,6 +38,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* Configuration utilities.
|
* Configuration utilities.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class ConfigurationUtils {
|
public abstract class ConfigurationUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,8 +18,11 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class BooleanParam extends Param<Boolean> {
|
public abstract class BooleanParam extends Param<Boolean> {
|
||||||
|
|
||||||
public BooleanParam(String name, Boolean defaultValue) {
|
public BooleanParam(String name, Boolean defaultValue) {
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class ByteParam extends Param<Byte> {
|
public abstract class ByteParam extends Param<Byte> {
|
||||||
|
|
||||||
public ByteParam(String name, Byte defaultValue) {
|
public ByteParam(String name, Byte defaultValue) {
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.util.StringUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class EnumParam<E extends Enum<E>> extends Param<E> {
|
public abstract class EnumParam<E extends Enum<E>> extends Param<E> {
|
||||||
Class<E> klass;
|
Class<E> klass;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -28,6 +29,7 @@ import javax.ws.rs.ext.ExceptionMapper;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class ExceptionProvider implements ExceptionMapper<Throwable> {
|
public class ExceptionProvider implements ExceptionMapper<Throwable> {
|
||||||
private static Logger LOG = LoggerFactory.getLogger(ExceptionProvider.class);
|
private static Logger LOG = LoggerFactory.getLogger(ExceptionProvider.class);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.io.IOUtils;
|
import org.apache.hadoop.io.IOUtils;
|
||||||
|
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
@ -25,6 +26,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class InputStreamEntity implements StreamingOutput {
|
public class InputStreamEntity implements StreamingOutput {
|
||||||
private InputStream is;
|
private InputStream is;
|
||||||
private long offset;
|
private long offset;
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class IntegerParam extends Param<Integer> {
|
public abstract class IntegerParam extends Param<Integer> {
|
||||||
|
|
||||||
public IntegerParam(String name, Integer defaultValue) {
|
public IntegerParam(String name, Integer defaultValue) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
@ -36,6 +37,7 @@ import java.util.Map;
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class JSONMapProvider implements MessageBodyWriter<Map> {
|
public class JSONMapProvider implements MessageBodyWriter<Map> {
|
||||||
private static final String ENTER = System.getProperty("line.separator");
|
private static final String ENTER = System.getProperty("line.separator");
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.json.simple.JSONStreamAware;
|
import org.json.simple.JSONStreamAware;
|
||||||
|
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
@ -35,6 +36,7 @@ import java.lang.reflect.Type;
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class JSONProvider implements MessageBodyWriter<JSONStreamAware> {
|
public class JSONProvider implements MessageBodyWriter<JSONStreamAware> {
|
||||||
private static final String ENTER = System.getProperty("line.separator");
|
private static final String ENTER = System.getProperty("line.separator");
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class LongParam extends Param<Long> {
|
public abstract class LongParam extends Param<Long> {
|
||||||
|
|
||||||
public LongParam(String name, Long defaultValue) {
|
public LongParam(String name, Long defaultValue) {
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
import org.apache.hadoop.lib.util.Check;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class Param<T> {
|
public abstract class Param<T> {
|
||||||
private String name;
|
private String name;
|
||||||
protected T value;
|
protected T value;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +26,7 @@ import java.util.Map;
|
||||||
* <p/>
|
* <p/>
|
||||||
* Instances are created by the {@link ParametersProvider} class.
|
* Instances are created by the {@link ParametersProvider} class.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class Parameters {
|
public class Parameters {
|
||||||
private Map<String, Param<?>> params;
|
private Map<String, Param<?>> params;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.sun.jersey.core.spi.component.ComponentScope;
|
||||||
import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
|
import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
|
||||||
import com.sun.jersey.spi.inject.Injectable;
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
import com.sun.jersey.spi.inject.InjectableProvider;
|
import com.sun.jersey.spi.inject.InjectableProvider;
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MultivaluedMap;
|
import javax.ws.rs.core.MultivaluedMap;
|
||||||
|
@ -36,6 +37,7 @@ import java.util.Map;
|
||||||
* Jersey provider that parses the request parameters based on the
|
* Jersey provider that parses the request parameters based on the
|
||||||
* given parameter definition.
|
* given parameter definition.
|
||||||
*/
|
*/
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class ParametersProvider
|
public class ParametersProvider
|
||||||
extends AbstractHttpContextInjectable<Parameters>
|
extends AbstractHttpContextInjectable<Parameters>
|
||||||
implements InjectableProvider<Context, Type> {
|
implements InjectableProvider<Context, Type> {
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class ShortParam extends Param<Short> {
|
public abstract class ShortParam extends Param<Short> {
|
||||||
|
|
||||||
private int radix;
|
private int radix;
|
||||||
|
|
|
@ -17,9 +17,12 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.lib.wsrs;
|
package org.apache.hadoop.lib.wsrs;
|
||||||
|
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@InterfaceAudience.Private
|
||||||
public abstract class StringParam extends Param<String> {
|
public abstract class StringParam extends Param<String> {
|
||||||
private Pattern pattern;
|
private Pattern pattern;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.sun.jersey.core.spi.component.ComponentScope;
|
||||||
import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
|
import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
|
||||||
import com.sun.jersey.spi.inject.Injectable;
|
import com.sun.jersey.spi.inject.Injectable;
|
||||||
import com.sun.jersey.spi.inject.InjectableProvider;
|
import com.sun.jersey.spi.inject.InjectableProvider;
|
||||||
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
|
@ -33,6 +34,7 @@ import java.security.Principal;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
|
@InterfaceAudience.Private
|
||||||
public class UserProvider extends AbstractHttpContextInjectable<Principal> implements
|
public class UserProvider extends AbstractHttpContextInjectable<Principal> implements
|
||||||
InjectableProvider<Context, Type> {
|
InjectableProvider<Context, Type> {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue