private WriteType getS3WriteType() { return Configuration.getEnum(PropertyKey.PROXY_S3_WRITE_TYPE, WriteType.class); }
/** * Checks if authentication is enabled. * * @return true if authentication is enabled, false otherwise */ public static boolean isAuthenticationEnabled() { return !Configuration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class) .equals(AuthType.NOSASL); }
/** * Note: Packet streaming requires {@link io.netty.channel.epoll.EpollMode} to be set to * LEVEL_TRIGGERED which is not supported in netty versions < 4.0.26.Final. Without shading netty * in Alluxio, we cannot use epoll. * * @param key the property key for looking up the configured channel type * @return the channel type to use */ private static ChannelType getChannelType(PropertyKey key) { ChannelType configured = Configuration.getEnum(key, ChannelType.class); if (configured == ChannelType.EPOLL) { if (!Epoll.isAvailable()) { LOG.info("EPOLL is not available, will use NIO"); return ChannelType.NIO; } try { EpollChannelOption.class.getField("EPOLL_MODE"); } catch (Throwable e) { LOG.warn("EPOLL_MODE is not supported in netty with version < 4.0.26.Final, will use NIO"); return ChannelType.NIO; } LOG.info("EPOLL_MODE is available"); } return configured; } }
private CreateDirectoryOptions() { mRecursive = false; mAllowExists = false; WriteType defaultWriteType = ClientContext.getConf().getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); mUnderStorageType = defaultWriteType.getUnderStorageType(); }
/** * @return a journal system */ public JournalSystem build() { JournalType journalType = Configuration.getEnum(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.class); switch (journalType) { case NOOP: return new NoopJournalSystem(); case UFS: return new UfsJournalSystem(mLocation, mQuietTimeMs); default: throw new IllegalStateException("Unrecognized journal type: " + journalType); } } }
private InStreamOptions() { mReadType = ClientContext.getConf().getEnum(Constants.USER_FILE_READ_TYPE_DEFAULT, ReadType.class); try { mLocationPolicy = CommonUtils.createNewClassInstance(ClientContext.getConf() .<FileWriteLocationPolicy>getClass(Constants.USER_FILE_WRITE_LOCATION_POLICY), new Class[]{}, new Object[]{}); } catch (Exception e) { throw Throwables.propagate(e); } }
/** * Creates a new instance of {@code TransportProvider} based on authentication type. For * {@link AuthType#NOSASL}, return an instance of {@link NoSaslTransportProvider}; for * {@link AuthType#SIMPLE} or {@link AuthType#CUSTOM}, return an instance of * {@link PlainSaslTransportProvider}. * * @return the generated {@link TransportProvider} */ public static TransportProvider create() { AuthType authType = Configuration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class); switch (authType) { case NOSASL: return new NoSaslTransportProvider(); case SIMPLE: // intended to fall through case CUSTOM: return new PlainSaslTransportProvider(); case KERBEROS: throw new UnsupportedOperationException( "getClientTransport: Kerberos is not supported currently."); default: throw new UnsupportedOperationException( "getClientTransport: Unsupported authentication type: " + authType.getAuthName()); } } }
@Override public TTransportFactory getServerTransportFactory(Runnable runnable, String serverName) throws SaslException { AuthType authType = Configuration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class); TSaslServerTransport.Factory saslFactory = new TSaslServerTransport.Factory(); AuthenticationProvider provider = AuthenticationProvider.Factory.create(authType); saslFactory .addServerDefinition(PlainSaslServerProvider.MECHANISM, null, null, new HashMap<String, String>(), new PlainSaslServerCallbackHandler(provider, runnable)); return saslFactory; } }
Configuration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class); checkSecurityEnabled(authType); Subject subject = new Subject();
/** * Creates a new instance with defaults based on the configuration. */ private OpenFileOptions() { mReadType = ClientContext.getConf().getEnum(Constants.USER_FILE_READ_TYPE_DEFAULT, ReadType.class); try { mLocationPolicy = CommonUtils.createNewClassInstance(ClientContext.getConf() .<FileWriteLocationPolicy>getClass(Constants.USER_FILE_WRITE_LOCATION_POLICY), new Class[]{}, new Object[]{}); } catch (Exception e) { throw Throwables.propagate(e); } }
/** * Creates a new instance with defaults from the configuration. */ private CreateFileOptions() { Configuration conf = ClientContext.getConf(); mRecursive = true; mBlockSizeBytes = conf.getBytes(Constants.USER_BLOCK_SIZE_BYTES_DEFAULT); try { mLocationPolicy = CommonUtils.createNewClassInstance( conf.<FileWriteLocationPolicy>getClass(Constants.USER_FILE_WRITE_LOCATION_POLICY), new Class[]{}, new Object[]{}); } catch (Exception e) { throw Throwables.propagate(e); } mWriteType = conf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); mTtl = Constants.NO_TTL; }
private OutStreamOptions() { Configuration conf = ClientContext.getConf(); mBlockSizeBytes = conf.getBytes(Constants.USER_BLOCK_SIZE_BYTES_DEFAULT); mTtl = Constants.NO_TTL; try { mLocationPolicy = CommonUtils.createNewClassInstance(ClientContext.getConf() .<FileWriteLocationPolicy>getClass(Constants.USER_FILE_WRITE_LOCATION_POLICY), new Class[] {}, new Object[] {}); } catch (Exception e) { throw Throwables.propagate(e); } mWriteType = conf.getEnum(Constants.USER_FILE_WRITE_TYPE_DEFAULT, WriteType.class); }
Configuration.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class); auditContext.setUgi(ugi) .setAuthType(authType)