Java Code Examples for org.apache.hadoop.classification.InterfaceAudience#LimitedPrivate

The following examples show how to use org.apache.hadoop.classification.InterfaceAudience#LimitedPrivate . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataNode.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a dummy DataNode for testing purpose.
 */
@VisibleForTesting
@InterfaceAudience.LimitedPrivate("HDFS")
DataNode(final Configuration conf) {
  super(conf);
  this.blockScanner = new BlockScanner(this, conf);
  this.fileDescriptorPassingDisabledReason = null;
  this.maxNumberOfBlocksToLog = 0;
  this.confVersion = null;
  this.usersWithLocalPathAccess = null;
  this.connectToDnViaHostname = false;
  this.getHdfsBlockLocationsEnabled = false;
  this.pipelineSupportECN = false;
}
 
Example 2
Source File: DataNode.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a dummy DataNode for testing purpose.
 */
@VisibleForTesting
@InterfaceAudience.LimitedPrivate("HDFS")
DataNode(final Configuration conf) {
  super(conf);
  this.blockScanner = new BlockScanner(this, conf);
  this.fileDescriptorPassingDisabledReason = null;
  this.maxNumberOfBlocksToLog = 0;
  this.confVersion = null;
  this.usersWithLocalPathAccess = null;
  this.connectToDnViaHostname = false;
  this.getHdfsBlockLocationsEnabled = false;
  this.pipelineSupportECN = false;
}
 
Example 3
Source File: FileContext.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Get delegation tokens for the file systems accessed for a given
 * path.
 * @param p Path for which delegations tokens are requested.
 * @param renewer the account name that is allowed to renew the token.
 * @return List of delegation tokens.
 * @throws IOException
 */
@InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" })
public List<Token<?>> getDelegationTokens(
    Path p, String renewer) throws IOException {
  Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p);
  List<Token<?>> tokenList = 
      new ArrayList<Token<?>>();
  for (AbstractFileSystem afs : afsSet) {
    List<Token<?>> afsTokens = afs.getDelegationTokens(renewer);
    tokenList.addAll(afsTokens);
  }
  return tokenList;
}
 
Example 4
Source File: FileContext.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Get delegation tokens for the file systems accessed for a given
 * path.
 * @param p Path for which delegations tokens are requested.
 * @param renewer the account name that is allowed to renew the token.
 * @return List of delegation tokens.
 * @throws IOException
 */
@InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" })
public List<Token<?>> getDelegationTokens(
    Path p, String renewer) throws IOException {
  Set<AbstractFileSystem> afsSet = resolveAbstractFileSystems(p);
  List<Token<?>> tokenList = 
      new ArrayList<Token<?>>();
  for (AbstractFileSystem afs : afsSet) {
    List<Token<?>> afsTokens = afs.getDelegationTokens(renewer);
    tokenList.addAll(afsTokens);
  }
  return tokenList;
}
 
Example 5
Source File: Server.java    From big-c with Apache License 2.0 4 votes vote down vote up
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public ServiceAuthorizationManager getServiceAuthorizationManager() {
  return serviceAuthorizationManager;
}
 
Example 6
Source File: Server.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public ServiceAuthorizationManager getServiceAuthorizationManager() {
  return serviceAuthorizationManager;
}
 
Example 7
Source File: FileContext.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Return blockLocation of the given file for the given offset and len.
 *  For a nonexistent file or regions, null will be returned.
 *
 * This call is most helpful with DFS, where it returns 
 * hostnames of machines that contain the given file.
 * 
 * @param f - get blocklocations of this file
 * @param start position (byte offset)
 * @param len (in bytes)
 *
 * @return block locations for given file at specified offset of len
 *
 * @throws AccessControlException If access is denied
 * @throws FileNotFoundException If <code>f</code> does not exist
 * @throws UnsupportedFileSystemException If file system for <code>f</code> is
 *           not supported
 * @throws IOException If an I/O error occurred
 * 
 * Exceptions applicable to file systems accessed over RPC:
 * @throws RpcClientException If an exception occurred in the RPC client
 * @throws RpcServerException If an exception occurred in the RPC server
 * @throws UnexpectedServerException If server implementation throws 
 *           undeclared exception to RPC server
 * 
 * RuntimeExceptions:
 * @throws InvalidPathException If path <code>f</code> is invalid
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public BlockLocation[] getFileBlockLocations(final Path f, final long start,
    final long len) throws AccessControlException, FileNotFoundException,
    UnsupportedFileSystemException, IOException {
  final Path absF = fixRelativePart(f);
  return new FSLinkResolver<BlockLocation[]>() {
    @Override
    public BlockLocation[] next(final AbstractFileSystem fs, final Path p) 
      throws IOException, UnresolvedLinkException {
      return fs.getFileBlockLocations(p, start, len);
    }
  }.resolve(this, absF);
}
 
Example 8
Source File: FileSystem.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Get a canonical service name for this file system.  The token cache is
 * the only user of the canonical service name, and uses it to lookup this
 * filesystem's service tokens.
 * If file system provides a token of its own then it must have a canonical
 * name, otherwise canonical name can be null.
 * 
 * Default Impl: If the file system has child file systems 
 * (such as an embedded file system) then it is assumed that the fs has no
 * tokens of its own and hence returns a null name; otherwise a service
 * name is built using Uri and port.
 * 
 * @return a service string that uniquely identifies this file system, null
 *         if the filesystem does not implement tokens
 * @see SecurityUtil#buildDTServiceName(URI, int) 
 */
@InterfaceAudience.LimitedPrivate({ "HDFS", "MapReduce" })
public String getCanonicalServiceName() {
  return (getChildFileSystems() == null)
    ? SecurityUtil.buildDTServiceName(getUri(), getDefaultPort())
    : null;
}
 
Example 9
Source File: FileContext.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Return blockLocation of the given file for the given offset and len.
 *  For a nonexistent file or regions, null will be returned.
 *
 * This call is most helpful with DFS, where it returns 
 * hostnames of machines that contain the given file.
 * 
 * @param f - get blocklocations of this file
 * @param start position (byte offset)
 * @param len (in bytes)
 *
 * @return block locations for given file at specified offset of len
 *
 * @throws AccessControlException If access is denied
 * @throws FileNotFoundException If <code>f</code> does not exist
 * @throws UnsupportedFileSystemException If file system for <code>f</code> is
 *           not supported
 * @throws IOException If an I/O error occurred
 * 
 * Exceptions applicable to file systems accessed over RPC:
 * @throws RpcClientException If an exception occurred in the RPC client
 * @throws RpcServerException If an exception occurred in the RPC server
 * @throws UnexpectedServerException If server implementation throws 
 *           undeclared exception to RPC server
 * 
 * RuntimeExceptions:
 * @throws InvalidPathException If path <code>f</code> is invalid
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public BlockLocation[] getFileBlockLocations(final Path f, final long start,
    final long len) throws AccessControlException, FileNotFoundException,
    UnsupportedFileSystemException, IOException {
  final Path absF = fixRelativePart(f);
  return new FSLinkResolver<BlockLocation[]>() {
    @Override
    public BlockLocation[] next(final AbstractFileSystem fs, final Path p) 
      throws IOException, UnresolvedLinkException {
      return fs.getFileBlockLocations(p, start, len);
    }
  }.resolve(this, absF);
}
 
Example 10
Source File: FileContext.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Checks if the user can access a path.  The mode specifies which access
 * checks to perform.  If the requested permissions are granted, then the
 * method returns normally.  If access is denied, then the method throws an
 * {@link AccessControlException}.
 * <p/>
 * The default implementation of this method calls {@link #getFileStatus(Path)}
 * and checks the returned permissions against the requested permissions.
 * Note that the getFileStatus call will be subject to authorization checks.
 * Typically, this requires search (execute) permissions on each directory in
 * the path's prefix, but this is implementation-defined.  Any file system
 * that provides a richer authorization model (such as ACLs) may override the
 * default implementation so that it checks against that model instead.
 * <p>
 * In general, applications should avoid using this method, due to the risk of
 * time-of-check/time-of-use race conditions.  The permissions on a file may
 * change immediately after the access call returns.  Most applications should
 * prefer running specific file system actions as the desired user represented
 * by a {@link UserGroupInformation}.
 *
 * @param path Path to check
 * @param mode type of access to check
 * @throws AccessControlException if access is denied
 * @throws FileNotFoundException if the path does not exist
 * @throws UnsupportedFileSystemException if file system for <code>path</code>
 *   is not supported
 * @throws IOException see specific implementation
 * 
 * Exceptions applicable to file systems accessed over RPC:
 * @throws RpcClientException If an exception occurred in the RPC client
 * @throws RpcServerException If an exception occurred in the RPC server
 * @throws UnexpectedServerException If server implementation throws 
 *           undeclared exception to RPC server
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "Hive"})
public void access(final Path path, final FsAction mode)
    throws AccessControlException, FileNotFoundException,
    UnsupportedFileSystemException, IOException {
  final Path absPath = fixRelativePart(path);
  new FSLinkResolver<Void>() {
    @Override
    public Void next(AbstractFileSystem fs, Path p) throws IOException,
        UnresolvedLinkException {
      fs.access(p, mode);
      return null;
    }
  }.resolve(this, absPath);
}
 
Example 11
Source File: FileContext.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Checks if the user can access a path.  The mode specifies which access
 * checks to perform.  If the requested permissions are granted, then the
 * method returns normally.  If access is denied, then the method throws an
 * {@link AccessControlException}.
 * <p/>
 * The default implementation of this method calls {@link #getFileStatus(Path)}
 * and checks the returned permissions against the requested permissions.
 * Note that the getFileStatus call will be subject to authorization checks.
 * Typically, this requires search (execute) permissions on each directory in
 * the path's prefix, but this is implementation-defined.  Any file system
 * that provides a richer authorization model (such as ACLs) may override the
 * default implementation so that it checks against that model instead.
 * <p>
 * In general, applications should avoid using this method, due to the risk of
 * time-of-check/time-of-use race conditions.  The permissions on a file may
 * change immediately after the access call returns.  Most applications should
 * prefer running specific file system actions as the desired user represented
 * by a {@link UserGroupInformation}.
 *
 * @param path Path to check
 * @param mode type of access to check
 * @throws AccessControlException if access is denied
 * @throws FileNotFoundException if the path does not exist
 * @throws UnsupportedFileSystemException if file system for <code>path</code>
 *   is not supported
 * @throws IOException see specific implementation
 * 
 * Exceptions applicable to file systems accessed over RPC:
 * @throws RpcClientException If an exception occurred in the RPC client
 * @throws RpcServerException If an exception occurred in the RPC server
 * @throws UnexpectedServerException If server implementation throws 
 *           undeclared exception to RPC server
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "Hive"})
public void access(final Path path, final FsAction mode)
    throws AccessControlException, FileNotFoundException,
    UnsupportedFileSystemException, IOException {
  final Path absPath = fixRelativePart(path);
  new FSLinkResolver<Void>() {
    @Override
    public Void next(AbstractFileSystem fs, Path p) throws IOException,
        UnresolvedLinkException {
      fs.access(p, mode);
      return null;
    }
  }.resolve(this, absPath);
}
 
Example 12
Source File: AbstractFileSystem.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * The specification of this method matches that of
 * {@link FileContext#access(Path, FsAction)}
 * except that an UnresolvedLinkException may be thrown if a symlink is
 * encountered in the path.
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "Hive"})
public void access(Path path, FsAction mode) throws AccessControlException,
    FileNotFoundException, UnresolvedLinkException, IOException {
  FileSystem.checkAccessPermissions(this.getFileStatus(path), mode);
}
 
Example 13
Source File: FSDataOutputStream.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get a reference to the wrapped output stream.
 *
 * @return the underlying output stream
 */
@InterfaceAudience.LimitedPrivate({"HDFS"})
public OutputStream getWrappedStream() {
  return wrappedStream;
}
 
Example 14
Source File: FSDataInputStream.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get a reference to the wrapped input stream. Used by unit tests.
 *
 * @return the underlying input stream
 */
@InterfaceAudience.LimitedPrivate({"HDFS"})
public InputStream getWrappedStream() {
  return in;
}
 
Example 15
Source File: AbstractFileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get one or more delegation tokens associated with the filesystem. Normally
 * a file system returns a single delegation token. A file system that manages
 * multiple file systems underneath, could return set of delegation tokens for
 * all the file systems it manages
 * 
 * @param renewer the account name that is allowed to renew the token.
 * @return List of delegation tokens.
 *   If delegation tokens not supported then return a list of size zero.
 * @throws IOException
 */
@InterfaceAudience.LimitedPrivate( { "HDFS", "MapReduce" })
public List<Token<?>> getDelegationTokens(String renewer) throws IOException {
  return new ArrayList<Token<?>>(0);
}
 
Example 16
Source File: FileSystem.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get all the immediate child FileSystems embedded in this FileSystem.
 * It does not recurse and get grand children.  If a FileSystem
 * has multiple child FileSystems, then it should return a unique list
 * of those FileSystems.  Default is to return null to signify no children.
 * 
 * @return FileSystems used by this FileSystem
 */
@InterfaceAudience.LimitedPrivate({ "HDFS" })
@VisibleForTesting
public FileSystem[] getChildFileSystems() {
  return null;
}
 
Example 17
Source File: AbstractFileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * The specification of this method matches that of
 * {@link FileContext#access(Path, FsAction)}
 * except that an UnresolvedLinkException may be thrown if a symlink is
 * encountered in the path.
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "Hive"})
public void access(Path path, FsAction mode) throws AccessControlException,
    FileNotFoundException, UnresolvedLinkException, IOException {
  FileSystem.checkAccessPermissions(this.getFileStatus(path), mode);
}
 
Example 18
Source File: FileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get all the immediate child FileSystems embedded in this FileSystem.
 * It does not recurse and get grand children.  If a FileSystem
 * has multiple child FileSystems, then it should return a unique list
 * of those FileSystems.  Default is to return null to signify no children.
 * 
 * @return FileSystems used by this FileSystem
 */
@InterfaceAudience.LimitedPrivate({ "HDFS" })
@VisibleForTesting
public FileSystem[] getChildFileSystems() {
  return null;
}
 
Example 19
Source File: FileSystem.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Checks if the user can access a path.  The mode specifies which access
 * checks to perform.  If the requested permissions are granted, then the
 * method returns normally.  If access is denied, then the method throws an
 * {@link AccessControlException}.
 * <p/>
 * The default implementation of this method calls {@link #getFileStatus(Path)}
 * and checks the returned permissions against the requested permissions.
 * Note that the getFileStatus call will be subject to authorization checks.
 * Typically, this requires search (execute) permissions on each directory in
 * the path's prefix, but this is implementation-defined.  Any file system
 * that provides a richer authorization model (such as ACLs) may override the
 * default implementation so that it checks against that model instead.
 * <p>
 * In general, applications should avoid using this method, due to the risk of
 * time-of-check/time-of-use race conditions.  The permissions on a file may
 * change immediately after the access call returns.  Most applications should
 * prefer running specific file system actions as the desired user represented
 * by a {@link UserGroupInformation}.
 *
 * @param path Path to check
 * @param mode type of access to check
 * @throws AccessControlException if access is denied
 * @throws FileNotFoundException if the path does not exist
 * @throws IOException see specific implementation
 */
@InterfaceAudience.LimitedPrivate({"HDFS", "Hive"})
public void access(Path path, FsAction mode) throws AccessControlException,
    FileNotFoundException, IOException {
  checkAccessPermissions(this.getFileStatus(path), mode);
}
 
Example 20
Source File: DFSClient.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get a canonical token service name for this client's tokens.  Null should
 * be returned if the client is not using tokens.
 * @return the token service for the client
 */
@InterfaceAudience.LimitedPrivate( { "HDFS" }) 
public String getCanonicalServiceName() {
  return (dtService != null) ? dtService.toString() : null;
}