當前位置: 首頁>>代碼示例>>Java>>正文


Java Context.getBoolean方法代碼示例

本文整理匯總了Java中org.apache.flume.Context.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.getBoolean方法的具體用法?Java Context.getBoolean怎麽用?Java Context.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.flume.Context的用法示例。


在下文中一共展示了Context.getBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
    searchAndReplace = context.getBoolean(SEARCH_AND_REPLACE_KEY);
    String searchPattern = context.getString(SEARCH_PATTERN_KEY);
    replaceString = context.getString(REPLACE_STRING_KEY);
    searchRegex = Pattern.compile(searchPattern);
    if (context.containsKey(CHARSET_KEY)) {
        // May throw IllegalArgumentException for unsupported charsets.
        charset = Charset.forName(context.getString(CHARSET_KEY));
    }
    filterByRow = context.getBoolean(FILTER_BY_ROW_KEY);
    String regexString = context.getString(REGEX_KEY);
    regex = Pattern.compile(regexString);
    filterByCol = context.getBoolean(FILTER_BY_COL_KEY);
    colSeparator = context.getString(COL_SEPARATOR_KEY);
    index = context.getString(INDEX_KEY);
}
 
開發者ID:Transwarp-DE,項目名稱:Transwarp-Sample-Code,代碼行數:18,代碼來源:SearchAndReplaceAndFilterInterceptor.java

示例2: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  super.configure(context);

  // use binary writable serialize by default
  writeFormat = context.getString("hdfs.writeFormat",
    SequenceFileSerializerType.Writable.name());
  useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem",
      false);
  serializerContext = new Context(
          context.getSubProperties(SequenceFileSerializerFactory.CTX_PREFIX));
  serializer = SequenceFileSerializerFactory
          .getSerializer(writeFormat, serializerContext);
  logger.info("writeFormat = " + writeFormat + ", UseRawLocalFileSystem = "
      + useRawLocalFileSystem);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:17,代碼來源:HDFSSequenceFile.java

示例3: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
public void configure(Context context) {
  hostname = context.getString("hostname");
  String portStr = context.getString("port");
  nick = context.getString("nick");
  password = context.getString("password");
  user = context.getString("user");
  name = context.getString("name");
  chan = context.getString("chan");
  splitLines = context.getBoolean("splitlines", false);
  splitChars = context.getString("splitchars");

  if (portStr != null) {
    port = Integer.parseInt(portStr);
  } else {
    port = DEFAULT_PORT;
  }

  if (splitChars == null) {
    splitChars = DEFAULT_SPLIT_CHARS;
  }
  
  Preconditions.checkState(hostname != null, "No hostname specified");
  Preconditions.checkState(nick != null, "No nick specified");
  Preconditions.checkState(chan != null, "No chan specified");
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:26,代碼來源:IRCSink.java

示例4: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  super.configure(context);

  serializerType = context.getString("serializer", "TEXT");
  useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem",
      false);
  serializerContext =
      new Context(context.getSubProperties(EventSerializer.CTX_PREFIX));
  logger.info("Serializer = " + serializerType + ", UseRawLocalFileSystem = "
      + useRawLocalFileSystem);
}
 
開發者ID:Transwarp-DE,項目名稱:Transwarp-Sample-Code,代碼行數:13,代碼來源:HDFSDataStream.java

示例5: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  super.configure(context);

  serializerType = context.getString("serializer", "TEXT");
  useRawLocalFileSystem = context.getBoolean("hdfs.useRawLocalFileSystem",
      false);
  serializerContext = new Context(
      context.getSubProperties(EventSerializer.CTX_PREFIX));
  logger.info("Serializer = " + serializerType + ", UseRawLocalFileSystem = "
      + useRawLocalFileSystem);
}
 
開發者ID:Transwarp-DE,項目名稱:Transwarp-Sample-Code,代碼行數:13,代碼來源:HDFSCompressedDataStream.java

示例6: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  Preconditions.checkState(getSinks().size() > 1,
      "The LoadBalancingSinkProcessor cannot be used for a single sink. "
      + "Please configure more than one sinks and try again.");

  String selectorTypeName = context.getString(CONFIG_SELECTOR,
      SELECTOR_NAME_ROUND_ROBIN);

  Boolean shouldBackOff = context.getBoolean(CONFIG_BACKOFF, false);

  selector = null;

  if (selectorTypeName.equalsIgnoreCase(SELECTOR_NAME_ROUND_ROBIN)) {
    selector = new RoundRobinSinkSelector(shouldBackOff);
  } else if (selectorTypeName.equalsIgnoreCase(SELECTOR_NAME_RANDOM)) {
    selector = new RandomOrderSinkSelector(shouldBackOff);
  } else {
    try {
      @SuppressWarnings("unchecked")
      Class<? extends SinkSelector> klass = (Class<? extends SinkSelector>)
          Class.forName(selectorTypeName);

      selector = klass.newInstance();
    } catch (Exception ex) {
      throw new FlumeException("Unable to instantiate sink selector: "
          + selectorTypeName, ex);
    }
  }

  selector.setSinks(getSinks());
  selector.configure(
      new Context(context.getSubProperties(CONFIG_SELECTOR_PREFIX)));

  LOGGER.debug("Sink selector: " + selector + " initialized");
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:37,代碼來源:LoadBalancingSinkProcessor.java

示例7: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  this.pollFrequency = context.getInteger(this.CONF_POLL_FREQUENCY, 60);
  String localHosts = context.getString(this.CONF_HOSTS);
  if (localHosts == null || localHosts.isEmpty()) {
    throw new ConfigurationException("Hosts list cannot be empty.");
  }
  this.hosts = this.getHostsFromString(localHosts);
  this.isGanglia3 = context.getBoolean(this.CONF_ISGANGLIA3, false);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:11,代碼來源:GangliaServer.java

示例8: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  String morphlineFile = context.getString(MORPHLINE_FILE_PARAM);
  String morphlineId = context.getString(MORPHLINE_ID_PARAM);
  if (morphlineFile == null || morphlineFile.trim().length() == 0) {
    throw new MorphlineCompilationException("Missing parameter: " + MORPHLINE_FILE_PARAM, null);
  }
  morphlineFileAndId = morphlineFile + "@" + morphlineId;
  
  if (morphlineContext == null) {
    FaultTolerance faultTolerance = new FaultTolerance(
        context.getBoolean(FaultTolerance.IS_PRODUCTION_MODE, false), 
        context.getBoolean(FaultTolerance.IS_IGNORING_RECOVERABLE_EXCEPTIONS, false),
        context.getString(FaultTolerance.RECOVERABLE_EXCEPTION_CLASSES));
    
    morphlineContext = new MorphlineContext.Builder()
      .setExceptionHandler(faultTolerance)
      .setMetricRegistry(SharedMetricRegistries.getOrCreate(morphlineFileAndId))
      .build();
  }
  
  Config override = ConfigFactory.parseMap(
      context.getSubProperties(MORPHLINE_VARIABLE_PARAM + "."));
  morphline = new Compiler().compile(
      new File(morphlineFile), morphlineId, morphlineContext, finalChild, override);
  
  this.mappingTimer = morphlineContext.getMetricRegistry().timer(
      MetricRegistry.name("morphline.app", Metrics.ELAPSED_TIME));
  this.numRecords = morphlineContext.getMetricRegistry().meter(
      MetricRegistry.name("morphline.app", Metrics.NUM_RECORDS));
  this.numFailedRecords = morphlineContext.getMetricRegistry().meter(
      MetricRegistry.name("morphline.app", "numFailedRecords"));
  this.numExceptionRecords = morphlineContext.getMetricRegistry().meter(
      MetricRegistry.name("morphline.app", "numExceptionRecords"));
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:36,代碼來源:MorphlineHandlerImpl.java

示例9: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  String regex = context.getString(REGEX_CONFIG, REGEX_DEFAULT);
  regexIgnoreCase = context.getBoolean(IGNORE_CASE_CONFIG,
      INGORE_CASE_DEFAULT);
  depositHeaders = context.getBoolean(DEPOSIT_HEADERS_CONFIG,
      DEPOSIT_HEADERS_DEFAULT);
  inputPattern = Pattern.compile(regex, Pattern.DOTALL
      + (regexIgnoreCase ? Pattern.CASE_INSENSITIVE : 0));
  charset = Charset.forName(context.getString(CHARSET_CONFIG,
      CHARSET_DEFAULT));

  String colNameStr = context.getString(COL_NAME_CONFIG, COLUMN_NAME_DEFAULT);
  String[] columnNames = colNameStr.split(",");
  for (String s : columnNames) {
    colNames.add(s.getBytes(charset));
  }

  //Rowkey is optional, default is -1
  rowKeyIndex = context.getInteger(ROW_KEY_INDEX_CONFIG, -1);
  //if row key is being used, make sure it is specified correct
  if (rowKeyIndex >= 0) {
    if (rowKeyIndex >= columnNames.length) {
      throw new IllegalArgumentException(ROW_KEY_INDEX_CONFIG + " must be " +
          "less than num columns " + columnNames.length);
    }
    if (!ROW_KEY_NAME.equalsIgnoreCase(columnNames[rowKeyIndex])) {
      throw new IllegalArgumentException("Column at " + rowKeyIndex + " must be "
          + ROW_KEY_NAME + " and is " + columnNames[rowKeyIndex]);
    }
  }
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:33,代碼來源:RegexHbaseEventSerializer.java

示例10: HeaderAndBodyTextEventSerializer

import org.apache.flume.Context; //導入方法依賴的package包/類
private HeaderAndBodyTextEventSerializer(OutputStream out, Context ctx) {
  this.appendNewline = ctx.getBoolean(APPEND_NEWLINE, APPEND_NEWLINE_DFLT);
  this.out = out;
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:5,代碼來源:HeaderAndBodyTextEventSerializer.java

示例11: BodyTextEventSerializer

import org.apache.flume.Context; //導入方法依賴的package包/類
private BodyTextEventSerializer(OutputStream out, Context ctx) {
  this.appendNewline = ctx.getBoolean(APPEND_NEWLINE, APPEND_NEWLINE_DFLT);
  this.out = out;
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:5,代碼來源:BodyTextEventSerializer.java

示例12: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  preserveExisting = context.getBoolean(PRESERVE, PRESERVE_DFLT);
  useIP = context.getBoolean(USE_IP, USE_IP_DFLT);
  header = context.getString(HOST_HEADER, HOST);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:7,代碼來源:HostInterceptor.java

示例13: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  preserveExisting = context.getBoolean(PRESERVE, PRESERVE_DFLT);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:5,代碼來源:TimestampInterceptor.java

示例14: UUIDInterceptor

import org.apache.flume.Context; //導入方法依賴的package包/類
protected UUIDInterceptor(Context context) {
  headerName = context.getString(HEADER_NAME, "id");
  preserveExisting = context.getBoolean(PRESERVE_EXISTING_NAME, true);
  prefix = context.getString(PREFIX_NAME, "");
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:6,代碼來源:UUIDInterceptor.java

示例15: configure

import org.apache.flume.Context; //導入方法依賴的package包/類
@Override
public void configure(Context context) {
  this.context = context;

  String principal = context.getString(AUTH_PRINCIPAL);
  String keytab = context.getString(AUTH_KEYTAB);
  String effectiveUser = context.getString(AUTH_PROXY_USER);

  this.privilegedExecutor = FlumeAuthenticationUtil.getAuthenticator(
          principal, keytab).proxyAs(effectiveUser);

  // Get the dataset URI and name from the context
  String datasetURI = context.getString(CONFIG_KITE_DATASET_URI);
  if (datasetURI != null) {
    this.datasetUri = URI.create(datasetURI);
    this.datasetName = uriToName(datasetUri);
  } else {
    String repositoryURI = context.getString(CONFIG_KITE_REPO_URI);
    Preconditions.checkNotNull(repositoryURI, "No dataset configured. Setting "
        + CONFIG_KITE_DATASET_URI + " is required.");

    this.datasetName = context.getString(CONFIG_KITE_DATASET_NAME);
    Preconditions.checkNotNull(datasetName, "No dataset configured. Setting "
        + CONFIG_KITE_DATASET_URI + " is required.");

    String namespace = context.getString(CONFIG_KITE_DATASET_NAMESPACE,
        DEFAULT_NAMESPACE);

    this.datasetUri = new URIBuilder(repositoryURI, namespace, datasetName)
        .build();
  }
  this.setName(datasetUri.toString());

  if (context.getBoolean(CONFIG_SYNCABLE_SYNC_ON_BATCH,
      DEFAULT_SYNCABLE_SYNC_ON_BATCH)) {
    Preconditions.checkArgument(
        context.getBoolean(CONFIG_FLUSHABLE_COMMIT_ON_BATCH,
            DEFAULT_FLUSHABLE_COMMIT_ON_BATCH), "Configuration error: "
                + CONFIG_FLUSHABLE_COMMIT_ON_BATCH + " must be set to true when "
                + CONFIG_SYNCABLE_SYNC_ON_BATCH + " is set to true.");
  }

  // Create the configured failure failurePolicy
  this.failurePolicy = FAILURE_POLICY_FACTORY.newPolicy(context);

  // other configuration
  this.batchSize = context.getLong(CONFIG_KITE_BATCH_SIZE,
      DEFAULT_BATCH_SIZE);
  this.rollIntervalSeconds = context.getInteger(CONFIG_KITE_ROLL_INTERVAL,
      DEFAULT_ROLL_INTERVAL);

  this.counter = new SinkCounter(datasetName);
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:54,代碼來源:DatasetSink.java


注:本文中的org.apache.flume.Context.getBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。