Example usage for org.apache.hadoop.conf Configuration getBoolean

List of usage examples for org.apache.hadoop.conf Configuration getBoolean

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration getBoolean.

Prototype

public boolean getBoolean(String name, boolean defaultValue) 

Source Link

Document

Get the value of the name property as a boolean.

Usage

From source file:org.apache.atlas.web.service.SecureEmbeddedServer.java

License:Apache License

protected Connector getConnector(int port) throws IOException {
    org.apache.commons.configuration.Configuration config = getConfiguration();

    SslContextFactory sslContextFactory = new SslContextFactory();
    sslContextFactory.setKeyStorePath(config.getString(KEYSTORE_FILE_KEY,
            System.getProperty(KEYSTORE_FILE_KEY, DEFAULT_KEYSTORE_FILE_LOCATION)));
    sslContextFactory.setKeyStorePassword(getPassword(config, KEYSTORE_PASSWORD_KEY));
    sslContextFactory.setKeyManagerPassword(getPassword(config, SERVER_CERT_PASSWORD_KEY));
    sslContextFactory.setTrustStorePath(config.getString(TRUSTSTORE_FILE_KEY,
            System.getProperty(TRUSTSTORE_FILE_KEY, DEFATULT_TRUSTORE_FILE_LOCATION)));
    sslContextFactory.setTrustStorePassword(getPassword(config, TRUSTSTORE_PASSWORD_KEY));
    sslContextFactory/* ww  w  .  ja v a2s  . co  m*/
            .setWantClientAuth(config.getBoolean(CLIENT_AUTH_KEY, Boolean.getBoolean(CLIENT_AUTH_KEY)));

    List<Object> cipherList = config.getList(ATLAS_SSL_EXCLUDE_CIPHER_SUITES, DEFAULT_CIPHER_SUITES);
    sslContextFactory.setExcludeCipherSuites(cipherList.toArray(new String[cipherList.size()]));
    sslContextFactory.setRenegotiationAllowed(false);

    // SSL HTTP Configuration
    // HTTP Configuration
    HttpConfiguration http_config = new HttpConfiguration();
    http_config.setSecureScheme("https");
    final int bufferSize = getBufferSize();
    http_config.setSecurePort(port);
    http_config.setRequestHeaderSize(bufferSize);
    http_config.setResponseHeaderSize(bufferSize);
    http_config.setSendServerVersion(true);
    http_config.setSendDateHeader(false);

    HttpConfiguration https_config = new HttpConfiguration(http_config);
    https_config.addCustomizer(new SecureRequestCustomizer());

    // SSL Connector
    ServerConnector sslConnector = new ServerConnector(server,
            new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
            new HttpConnectionFactory(https_config));
    sslConnector.setPort(port);
    server.addConnector(sslConnector);

    return sslConnector;
}

From source file:org.apache.avro.mapred.AvroJob.java

License:Apache License

public static GenericData createInputDataModel(Configuration conf) {
    String className = conf.get(CONF_DATA_MODEL, null);
    Class<? extends GenericData> modelClass;
    if (className != null) {
        modelClass = getDataModelClass(conf);
    } else if (conf.getBoolean(INPUT_IS_REFLECT, false)) {
        modelClass = ReflectData.class;
    } else {/*from w  ww.j  a  v  a2  s  .  co  m*/
        modelClass = SpecificData.class;
    }
    return newDataModelInstance(modelClass, conf);
}

From source file:org.apache.avro.mapred.AvroJob.java

License:Apache License

public static GenericData createMapOutputDataModel(Configuration conf) {
    String className = conf.get(CONF_DATA_MODEL, null);
    Class<? extends GenericData> modelClass;
    if (className != null) {
        modelClass = getDataModelClass(conf);
    } else if (conf.getBoolean(MAP_OUTPUT_IS_REFLECT, false)) {
        modelClass = ReflectData.class;
    } else {//from w ww .j av  a  2 s  .  c  om
        modelClass = SpecificData.class;
    }
    return newDataModelInstance(modelClass, conf);
}

From source file:org.apache.blur.hive.BlurHiveOutputCommitter.java

License:Apache License

private void finishBulkJob(JobContext context, boolean apply) throws IOException {
    Configuration configuration = context.getConfiguration();
    String connectionStr = configuration.get(BLUR_CONTROLLER_CONNECTION_STR);
    boolean blocking = configuration.getBoolean(BLUR_BLOCKING_APPLY, false);
    Iface client = BlurClient.getClient(connectionStr);
    String bulkId = BlurHiveOutputFormat.getBulkId(configuration);
    try {//from  w w w  .  ja  v a  2s  .  c  o m
        client.bulkMutateFinish(bulkId, apply, blocking);
    } catch (BlurException e) {
        throw new IOException(e);
    } catch (TException e) {
        throw new IOException(e);
    }
}

From source file:org.apache.blur.hive.BlurHiveOutputFormat.java

License:Apache License

public static boolean isBlurUserAsProxy(Configuration configuration) {
    return configuration.getBoolean(BLUR_USER_PROXY, false);
}

From source file:org.apache.blur.hive.BlurSerDe.java

License:Apache License

@Override
public void initialize(Configuration conf, Properties tbl) throws SerDeException {
    String table = tbl.getProperty(TABLE);
    nullCheck(TABLE, table);/*from w  w  w  . j av  a  2 s  .  c o m*/
    _family = tbl.getProperty(FAMILY);
    nullCheck(FAMILY, _family);
    BlurConfiguration configuration;
    String zkConnectionStr;
    try {
        configuration = new BlurConfiguration();
        zkConnectionStr = tbl.getProperty(ZK);
        nullCheck(ZK, zkConnectionStr);
        configuration.set(ZK, zkConnectionStr);
    } catch (IOException e) {
        throw new SerDeException(e);
    }

    Iface client = BlurClient.getClient(configuration);
    Schema schema;
    try {
        List<String> tableList = client.tableList();
        if (!tableList.contains(table)) {
            LOG.warn("Table [{0}] from zk [{1}] does not exist.", table, zkConnectionStr);
            _objectInspector = new NullStructSerDe.NullStructSerDeObjectInspector();
            return;
        }
        if (conf != null) {
            TableDescriptor tableDescriptor = client.describe(table);
            Map<String, String> tableProperties = tableDescriptor.getTableProperties();
            if (tableProperties != null) {
                String workingPath = tableProperties.get(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH);
                if (conf != null && workingPath != null) {
                    if (!conf.getBoolean(BLUR_MR_UPDATE_DISABLED, false)) {
                        conf.set(BlurConstants.BLUR_BULK_UPDATE_WORKING_PATH, workingPath);
                    }
                }
            }

            BlurOutputFormat.setTableDescriptor(conf, tableDescriptor);
            conf.set(BLUR_CONTROLLER_CONNECTION_STR, getControllerConnectionStr(client));
        }
        schema = client.schema(table);
    } catch (BlurException e) {
        throw new SerDeException(e);
    } catch (TException e) {
        throw new SerDeException(e);
    } catch (IOException e) {
        throw new SerDeException(e);
    }

    Map<String, ColumnDefinition> columns = schema.getFamilies().get(_family);
    if (columns == null) {
        throw new SerDeException("Family [" + _family + "] does not exist in table [" + table + "]");
    }

    _schema = new HashMap<String, ColumnDefinition>();
    for (ColumnDefinition columnDefinition : columns.values()) {
        String subColumnName = columnDefinition.getSubColumnName();
        if (subColumnName == null) {
            _schema.put(columnDefinition.getColumnName(), columnDefinition);
        }
    }

    _columnNameResolver = new BlurColumnNameResolver(_schema.values());

    BlurObjectInspectorGenerator blurObjectInspectorGenerator = new BlurObjectInspectorGenerator(
            _schema.values(), _columnNameResolver);
    _objectInspector = blurObjectInspectorGenerator.getObjectInspector();
    _columnNames = blurObjectInspectorGenerator.getColumnNames();
    _columnTypes = blurObjectInspectorGenerator.getColumnTypes();

    _serializer = new BlurSerializer(_schema, _columnNameResolver);
}

From source file:org.apache.blur.mapreduce.lib.BlurOutputFormat.java

License:Apache License

public static boolean isIndexLocally(Configuration configuration) {
    return configuration.getBoolean(BLUR_OUTPUT_INDEXLOCALLY, true);
}

From source file:org.apache.blur.mapreduce.lib.BlurOutputFormat.java

License:Apache License

public static boolean isOptimizeInFlight(Configuration configuration) {
    return configuration.getBoolean(BLUR_OUTPUT_OPTIMIZEINFLIGHT, true);
}

From source file:org.apache.blur.mapreduce.lib.CsvBlurMapper.java

License:Apache License

/**
 * Gets whether or not to generate a recordid for the record based on the
 * data.//  www .j a va2s.  c o m
 * 
 * @param configuration
 *          the configuration.
 * @return boolean.
 */
public static boolean isAutoGenerateRecordIdAsHashOfData(Configuration configuration) {
    return configuration.getBoolean(BLUR_CSV_AUTO_GENERATE_RECORD_ID_AS_HASH_OF_DATA, false);
}

From source file:org.apache.blur.mapreduce.lib.CsvBlurMapper.java

License:Apache License

/**
 * Gets whether or not to generate a recordid for the record based on the
 * data./*from  w w  w.ja  v a  2  s  . co m*/
 * 
 * @param configuration
 *          the configuration.
 * @return boolean.
 */
public static boolean isAutoGenerateRowIdAsHashOfData(Configuration configuration) {
    return configuration.getBoolean(BLUR_CSV_AUTO_GENERATE_ROW_ID_AS_HASH_OF_DATA, false);
}