/** * Select a delegation token from all tokens in credentials, based on url. */ @InterfaceAudience.Private public org.apache.hadoop.security.token.Token<? extends TokenIdentifier> selectDelegationToken(URL url, Credentials creds) { final InetSocketAddress serviceAddr = new InetSocketAddress(url.getHost(), url.getPort()); final Text service = SecurityUtil.buildTokenService(serviceAddr); org.apache.hadoop.security.token.Token<? extends TokenIdentifier> dToken = creds.getToken(service); LOG.debug("Using delegation token {} from service:{}", dToken, service); return dToken; }
/** * This class contains constants for configuration keys used * in the local file system, raw local fs and checksum fs. * */ @InterfaceAudience.Private @InterfaceStability.Unstable public class LocalFileSystemConfigKeys extends CommonConfigurationKeys { public static final String LOCAL_FS_BLOCK_SIZE_KEY = "file.blocksize"; public static final long LOCAL_FS_BLOCK_SIZE_DEFAULT = 64*1024*1024; public static final String LOCAL_FS_REPLICATION_KEY = "file.replication"; public static final short LOCAL_FS_REPLICATION_DEFAULT = 1; public static final String LOCAL_FS_STREAM_BUFFER_SIZE_KEY = "file.stream-buffer-size"; public static final int LOCAL_FS_STREAM_BUFFER_SIZE_DEFAULT = 4096; public static final String LOCAL_FS_BYTES_PER_CHECKSUM_KEY = "file.bytes-per-checksum"; public static final int LOCAL_FS_BYTES_PER_CHECKSUM_DEFAULT = 512; public static final String LOCAL_FS_CLIENT_WRITE_PACKET_SIZE_KEY = "file.client-write-packet-size"; public static final int LOCAL_FS_CLIENT_WRITE_PACKET_SIZE_DEFAULT = 64*1024; }
/** * Protocol which is used to refresh arbitrary things at runtime. */ @KerberosInfo( serverPrincipal=CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY) @InterfaceAudience.Private @InterfaceStability.Evolving public interface GenericRefreshProtocol { /** * Version 1: Initial version. */ public static final long versionID = 1L; /** * Refresh the resource based on identity passed in. * @throws IOException */ @Idempotent Collection<RefreshResponse> refresh(String identifier, String[] args) throws IOException; }
/** * URLStream handler relying on FileSystem and on a given Configuration to * handle URL protocols. */ @InterfaceAudience.Private @InterfaceStability.Unstable class FsUrlStreamHandler extends URLStreamHandler { private Configuration conf; FsUrlStreamHandler(Configuration conf) { this.conf = conf; } FsUrlStreamHandler() { this.conf = new Configuration(); } @Override protected FsUrlConnection openConnection(URL url) throws IOException { return new FsUrlConnection(conf, url); } }
/** * Metrics annotation helpers. */ @InterfaceAudience.Private @InterfaceStability.Evolving public class MetricsAnnotations { /** * Make an metrics source from an annotated object. * @param source the annotated object. * @return a metrics source */ public static MetricsSource makeSource(Object source) { return new MetricsSourceBuilder(source, DefaultMetricsFactory.getAnnotatedMetricsFactory()).build(); } public static MetricsSourceBuilder newSourceBuilder(Object source) { return new MetricsSourceBuilder(source, DefaultMetricsFactory.getAnnotatedMetricsFactory()); } }
/** * A interface for disk validators. * * The {@link #checkStatus(File)} operation checks status of a file/dir. * */ @InterfaceAudience.Private @InterfaceStability.Unstable public interface DiskValidator { /** * Check the status of a file/dir. * @param dir a file/dir * @throws DiskErrorException if any disk error */ void checkStatus(File dir) throws DiskErrorException; }
@InterfaceAudience.Private @InterfaceStability.Unstable class RawParser extends PermissionParser { private static Pattern rawOctalPattern = Pattern.compile("^\\s*([01]?)([0-7]{3})\\s*$"); private static Pattern rawNormalPattern = Pattern.compile("\\G\\s*([ugoa]*)([+=-]+)([rwxt]*)([,\\s]*)\\s*"); private short permission; public RawParser(String modeStr) throws IllegalArgumentException { super(modeStr, rawNormalPattern, rawOctalPattern); permission = (short)combineModes(0, false); } public short getPermission() { return permission; } }
/** * Get a new delegation token for this FileSystem. * This is an internal method that should have been declared protected * but wasn't historically. * Callers should use {@link #addDelegationTokens(String, Credentials)} * * @param renewer the account name that is allowed to renew the token. * @return a new delegation token or null if the FS does not support tokens. * @throws IOException on any problem obtaining a token */ @InterfaceAudience.Private() @Override public Token<?> getDelegationToken(String renewer) throws IOException { return null; }
@InterfaceAudience.Private public static String sourceName(String name, boolean dupOK) { return INSTANCE.newSourceName(name, dupOK); }
/** * Create new groups used to map user-to-groups with loaded configuration. * @param conf * @return the groups being used to map user-to-groups. */ @Private public static synchronized Groups getUserToGroupsMappingServiceWithLoadedConfiguration( Configuration conf) { GROUPS = new Groups(conf); return GROUPS; } }
/** * Erasure codec options. */ @InterfaceAudience.Private public class ErasureCodecOptions { private ECSchema schema; public ErasureCodecOptions(ECSchema schema) { this.schema = schema; } public ECSchema getSchema() { return schema; } }
@InterfaceAudience.Private public static ObjectName newMBeanName(String name) { return INSTANCE.newObjectName(name); }
@InterfaceAudience.Private public static long getFatal() { return counts.get(FATAL); }
@InterfaceAudience.Private public JavaSerializationComparator() throws IOException { super(new JavaSerialization.JavaSerializationDeserializer<T>()); }
@InterfaceAudience.Private public static void removeSourceName(String name) { INSTANCE.removeSource(name); }
@InterfaceAudience.Private public static long getError() { return counts.get(ERROR); }
@InterfaceAudience.Private public static void removeMBeanName(ObjectName name) { INSTANCE.removeObjectName(name.toString()); }
@InterfaceAudience.Private public static MetricsSystem setInstance(MetricsSystem ms) { return INSTANCE.setImpl(ms); }
@InterfaceAudience.Private public static long getInfo() { return counts.get(INFO); }
@InterfaceAudience.Private private boolean isHideNonPrintable() { return hideNonPrintable; }