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

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

Introduction

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

Prototype

public String[] getStrings(String name) 

Source Link

Document

Get the comma delimited values of the name property as an array of Strings.

Usage

From source file:org.bgi.flexlab.gaea.tools.mapreduce.annotator.AnnotatorOptions.java

License:Open Source License

@Override
public void getOptionsFromHadoopConf(Configuration conf) {
    String[] args = conf.getStrings("args");
    this.parse(args);
}

From source file:org.bgi.flexlab.gaea.tools.mapreduce.bamqualitycontrol.BamQualityControlOptions.java

License:Open Source License

@Override
public void getOptionsFromHadoopConf(Configuration conf) {
    // TODO Auto-generated method stub
    String[] args = conf.getStrings("args");
    this.parse(args);
}

From source file:org.commonvox.hbase_column_manager.Repository.java

License:Apache License

private void buildIncludedAndExcludedTablesSets(Configuration conf) {
    String[] includedTablesArray = conf.getStrings(HBASE_CONFIG_PARM_KEY_COLMANAGER_INCLUDED_TABLES);
    String[] excludedTablesArray = conf.getStrings(HBASE_CONFIG_PARM_KEY_COLMANAGER_EXCLUDED_TABLES);
    if (includedTablesArray != null && excludedTablesArray != null) {
        logger.warn(PRODUCT_NAME + " " + HBASE_CONFIG_PARM_KEY_COLMANAGER_EXCLUDED_TABLES
                + " parameter will be ignored; overridden by "
                + HBASE_CONFIG_PARM_KEY_COLMANAGER_INCLUDED_TABLES + " parameter.");
    }/*w ww .  j  a va  2 s .  c  o m*/
    if (includedTablesArray == null) {
        includedTables = null;
        includedNamespaces = null;
        includedEntireNamespaces = null;
        if (excludedTablesArray == null) {
            excludedTables = null;
            excludedNamespaces = null;
            excludedEntireNamespaces = null;
            logger.info(PRODUCT_NAME + " Repository activated for ALL user tables.");
        } else {
            excludedTables = new TreeSet<>();
            excludedNamespaces = new TreeSet<>();
            excludedEntireNamespaces = new TreeSet<>();
            for (String excludedTableString : new TreeSet<>(Arrays.asList(excludedTablesArray))) {
                try {
                    TableName excludedTableName = TableName.valueOf(excludedTableString);
                    excludedTables.add(excludedTableName);
                } catch (IllegalArgumentException e) {
                    if (excludedTableString.endsWith(ALL_TABLES_WILDCARD_INDICATOR)) {
                        String excludedNamespaceString = excludedTableString.substring(0,
                                excludedTableString.length() - 2);
                        // #isLegalNamespaceName throws IllegalArgumentException if not legal Namespace
                        TableName.isLegalNamespaceName(Bytes.toBytes(excludedNamespaceString));
                        excludedNamespaces.add(excludedNamespaceString);
                        excludedEntireNamespaces.add(excludedNamespaceString);
                    } else {
                        throw e;
                    }
                }
            }
            logger.info(PRODUCT_NAME + " Repository activated for all EXCEPT the following user tables: "
                    + conf.get(HBASE_CONFIG_PARM_KEY_COLMANAGER_EXCLUDED_TABLES));
        }
    } else {
        excludedTables = null;
        excludedNamespaces = null;
        excludedEntireNamespaces = null;
        includedTables = new TreeSet<>();
        includedNamespaces = new TreeSet<>();
        includedEntireNamespaces = new TreeSet<>();
        for (String includedTableString : new TreeSet<>(Arrays.asList(includedTablesArray))) {
            try {
                TableName includedTableName = TableName.valueOf(includedTableString);
                includedTables.add(includedTableName);
                includedNamespaces.add(includedTableName.getNamespaceAsString());
            } catch (IllegalArgumentException e) {
                if (includedTableString.endsWith(ALL_TABLES_WILDCARD_INDICATOR)) {
                    String includedNamespaceString = includedTableString.substring(0,
                            includedTableString.length() - 2);
                    // #isLegalNamespaceName throws IllegalArgumentException if not legal Namespace
                    TableName.isLegalNamespaceName(Bytes.toBytes(includedNamespaceString));
                    includedNamespaces.add(includedNamespaceString);
                    includedEntireNamespaces.add(includedNamespaceString);
                } else {
                    throw e;
                }
            }
        }
        logger.info(PRODUCT_NAME + " Repository activated for ONLY the following user tables: "
                + conf.get(HBASE_CONFIG_PARM_KEY_COLMANAGER_INCLUDED_TABLES));
    }
}

From source file:org.htuple.ShuffleUtils.java

License:Apache License

public static int[] indexesFromConfig(Configuration conf, String confName) {
    String[] parts = conf.getStrings(confName);

    if (parts == null || parts.length == 0) {
        throw new IllegalStateException(String.format("Empty or no configuration set for '%s'", confName));
    }//from  ww w .  j av a 2  s .  co m

    int[] indices = new int[parts.length];
    for (int i = 0; i < parts.length; i++) {
        indices[i] = Integer.valueOf(parts[i]);
    }
    return indices;
}

From source file:org.huahinframework.core.lib.input.creator.JoinCreator.java

License:Apache License

/**
 * @param labels label of input data/*from w ww  .  j a va2s  .  c o  m*/
 * @param formatIgnored
 * If true, {@link DataFormatException} will be throw if there is a format error.
 * If false is ignored (default).
 * @param separator separator
 * @param regex If true, value is regex.
 * @param conf Hadoop Job Configuration
 */
public JoinCreator(String[] labels, boolean formatIgnored, String separator, boolean regex,
        Configuration conf) {
    super(labels, formatIgnored, separator, regex);
    this.conf = conf;
    this.masterPath = conf.get(SimpleJob.MASTER_PATH);
    this.masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    this.masterSeparator = conf.get(SimpleJob.MASTER_SEPARATOR);
    init();
}

From source file:org.huahinframework.core.util.LocalPathUtils.java

License:Apache License

/**
 * {@inheritDoc}/*from   w w w  . j av a2  s .  co  m*/
 */
@Override
public Map<String, String[]> getSimpleMaster(Configuration conf) throws IOException, URISyntaxException {
    String path = conf.get(SimpleJob.MASTER_PATH);
    String[] masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    String separator = conf.get(SimpleJob.MASTER_SEPARATOR);
    String masterColumn = conf.get(SimpleJob.JOIN_MASTER_COLUMN);
    int joinColumnNo = StringUtil.getMatchNo(masterLabels, masterColumn);
    return getSimpleMaster(masterLabels, joinColumnNo, path, separator);
}

From source file:org.huahinframework.core.util.LocalPathUtils.java

License:Apache License

/**
 * {@inheritDoc}//from www  .  j  a  va2s.c  o  m
 */
@Override
public Map<List<String>, String[]> getSimpleColumnsMaster(Configuration conf)
        throws IOException, URISyntaxException {
    String path = conf.get(SimpleJob.MASTER_PATH);
    String[] masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    String separator = conf.get(SimpleJob.MASTER_SEPARATOR);
    String[] masterColumn = conf.getStrings(SimpleJob.JOIN_MASTER_COLUMN);
    int[] joinColumnNo = StringUtil.getMatchNos(masterLabels, masterColumn);
    return getSimpleColumnsMaster(masterLabels, joinColumnNo, path, separator);
}

From source file:org.huahinframework.unit.FilterDriver.java

License:Apache License

/**
 * @param conf/*from   ww  w. ja  va 2 s.  co m*/
 * @return Map
 * @throws IOException
 * @throws URISyntaxException
 */
private Map<String, String[]> getSimpleMaster(Configuration conf) throws IOException, URISyntaxException {
    String path = conf.get(SimpleJob.MASTER_PATH);
    String[] masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    String separator = conf.get(SimpleJob.MASTER_SEPARATOR);
    String masterColumn = conf.get(SimpleJob.JOIN_MASTER_COLUMN);
    int joinColumnNo = StringUtil.getMatchNo(masterLabels, masterColumn);
    return getSimpleMaster(masterLabels, joinColumnNo, path, separator);
}

From source file:org.huahinframework.unit.FilterDriver.java

License:Apache License

/**
 * @param conf//from  w  w  w  . jav  a  2s . co  m
 * @return Map
 * @throws IOException
 * @throws URISyntaxException
 */
private Map<List<String>, String[]> getSimpleColumnsMaster(Configuration conf)
        throws IOException, URISyntaxException {
    String path = conf.get(SimpleJob.MASTER_PATH);
    String[] masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    String separator = conf.get(SimpleJob.MASTER_SEPARATOR);
    String[] masterColumn = conf.getStrings(SimpleJob.JOIN_MASTER_COLUMN);
    int[] joinColumnNo = StringUtil.getMatchNos(masterLabels, masterColumn);
    return getSimpleColumnsMaster(masterLabels, joinColumnNo, path, separator);
}

From source file:org.huahinframework.unit.JobDriver.java

License:Apache License

/**
 * @param conf//from  w w w  .j  av  a 2s.  c  om
 * @return Map
 * @throws IOException
 * @throws URISyntaxException
 */
public Map<List<String>, String[]> getSimpleColumnsMaster(Configuration conf)
        throws IOException, URISyntaxException {
    String path = conf.get(SimpleJob.MASTER_PATH);
    String[] masterLabels = conf.getStrings(SimpleJob.MASTER_LABELS);
    String separator = conf.get(SimpleJob.MASTER_SEPARATOR);
    String[] masterColumn = conf.getStrings(SimpleJob.JOIN_MASTER_COLUMN);
    int[] joinColumnNo = StringUtil.getMatchNos(masterLabels, masterColumn);
    return getSimpleColumnsMaster(masterLabels, joinColumnNo, path, separator);
}