本文整理汇总了Java中org.apache.flume.Context.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getString方法的具体用法?Java Context.getString怎么用?Java Context.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flume.Context
的用法示例。
在下文中一共展示了Context.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildBulkProcessor
import org.apache.flume.Context; //导入方法依赖的package包/类
public BulkProcessor buildBulkProcessor(Context context, TransportClient client) {
bulkActions = context.getInteger(ES_BULK_ACTIONS,
DEFAULT_ES_BULK_ACTIONS);
bulkProcessorName = context.getString(ES_BULK_PROCESSOR_NAME,
DEFAULT_ES_BULK_PROCESSOR_NAME);
bulkSize = Util.getByteSizeValue(context.getInteger(ES_BULK_SIZE),
context.getString(ES_BULK_SIZE_UNIT));
concurrentRequest = context.getInteger(ES_CONCURRENT_REQUEST,
DEFAULT_ES_CONCURRENT_REQUEST);
flushIntervalTime = Util.getTimeValue(context.getString(ES_FLUSH_INTERVAL_TIME),
DEFAULT_ES_FLUSH_INTERVAL_TIME);
backoffPolicyTimeInterval = context.getString(ES_BACKOFF_POLICY_TIME_INTERVAL,
DEFAULT_ES_BACKOFF_POLICY_START_DELAY);
backoffPolicyRetries = context.getInteger(ES_BACKOFF_POLICY_RETRIES,
DEFAULT_ES_BACKOFF_POLICY_RETRIES);
return build(client);
}
示例2: getConfigurationString
import org.apache.flume.Context; //导入方法依赖的package包/类
/**
* Helper method to transition the configuration from the old long form
* style configuration to the new short form. If the value is specified for
* both the old and the new forms, the one associated with the new form
* takes precedence.
*
* @param context
* @param key the expected configuration key
* @param oldKey the deprecated configuration key
* @param defaultValue default value, null if no default
* @return the value associated with the key
*/
private String getConfigurationString(Context context, String key,
String oldKey, String defaultValue) {
String oldValue = context.getString(oldKey);
if (oldValue != null && oldValue.length() > 0) {
LOGGER.warn("Long form configuration key \"" + oldKey
+ "\" is deprecated. Please use the short form key \""
+ key + "\" instead.");
}
String value = context.getString(key);
if (value == null) {
if (oldValue != null) {
value = oldValue;
} else {
value = defaultValue;
}
}
return value;
}
示例3: 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
示例4: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public void configure(Context context) {
String hostKey = NetcatSourceConfigurationConstants.CONFIG_HOSTNAME;
String portKey = NetcatSourceConfigurationConstants.CONFIG_PORT;
String ackEventKey = NetcatSourceConfigurationConstants.CONFIG_ACKEVENT;
Configurables.ensureRequiredNonNull(context, hostKey, portKey);
hostName = context.getString(hostKey);
port = context.getInteger(portKey);
ackEveryEvent = context.getBoolean(ackEventKey, true);
maxLineLength = context.getInteger(
NetcatSourceConfigurationConstants.CONFIG_MAX_LINE_LENGTH,
NetcatSourceConfigurationConstants.DEFAULT_MAX_LINE_LENGTH);
sourceEncoding = context.getString(
NetcatSourceConfigurationConstants.CONFIG_SOURCE_ENCODING,
NetcatSourceConfigurationConstants.DEFAULT_ENCODING
);
}
示例5: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public void configure(Context context) {
String hostname = Utils.getHostNameForLinux();
this.pollFrequency = context.getInteger(this.CONF_POLL_FREQUENCY, 60);
this.hostname = context.getString(this.CONF_HOSTNAME, hostname);
this.tags = context.getString(this.CONF_TAGS, this.DEFAULT_TAGS);
// context.getSubProperties();
logger.debug("#########@@@@@@@@@@@@@@@@#############$$$$$$$$$$$$$$$$$$4" + context.getParameters().toString());
String urls = context.getString(this.CONF_URLS, "http://127.0.0.1:1988/v1/push");
if (urls == null || urls.isEmpty()) {
throw new ConfigurationException("OpenFalcon agent's v1/push interface list cannot be empty.");
}
this.postUrls = getPostUrlsFromString(urls);
}
示例6: 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);
}
示例7: getContextValue
import org.apache.flume.Context; //导入方法依赖的package包/类
/**
* Returns the context value for the contextId
*/
public static String getContextValue(Context context, String contextId) {
String contextValue = null;
if (StringUtils.isNotBlank(context.getString(contextId))) {
contextValue = context.getString(contextId);
}
return contextValue;
}
示例8: 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);
inputPattern = Pattern.compile(regex, Pattern.DOTALL
+ (regexIgnoreCase ? Pattern.CASE_INSENSITIVE : 0));
charset = Charset.forName(context.getString(CHARSET_CONFIG,
CHARSET_DEFAULT));
String colNameStr = context.getString(FIELD_NAMES, FIELD_NAME_DEFAULT);
inputColNames = colNameStr.split(",");
}
示例9: 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);
}
示例10: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public void configure(Context context) {
delimiter = parseDelimiterSpec(context.getString(DELIMITER, DEFAULT_DELIMITER));
charset = context.getString(CHARSET, DEFAULT_CHARSET);
String fieldNames = Preconditions.checkNotNull(context.getString(FIELD_NAMES), "Field names cannot be empty, " +
"please specify in configuration file");
inputColNames = fieldNames.split(",", -1);
}
示例11: 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]);
}
}
}
示例12: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public void configure(Context context) {
String strMaxBytes = context.getString(MAX_BYTES_DUMP_KEY);
if (!Strings.isNullOrEmpty(strMaxBytes)) {
try {
maxBytesToLog = Integer.parseInt(strMaxBytes);
} catch (NumberFormatException e) {
logger.warn(String.format(
"Unable to convert %s to integer, using default value(%d) for maxByteToDump",
strMaxBytes, DEFAULT_MAX_BYTE_DUMP));
maxBytesToLog = DEFAULT_MAX_BYTE_DUMP;
}
}
}
示例13: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@SuppressWarnings( "deprecation" )
@Override
public void configure(Context context) {
// DBCP 초기화
ConnectionManager.instance.initialize( context );
this.batchsize = context.getInteger(CONF_BATCH_SIZE, DEFAULT_BATCH_SIZE);
this.sqlDialect = SQLDialect.valueOf(context.getString(CONF_SQL_DIALECT).toUpperCase(Locale.ENGLISH));
final String sql = context.getString(CONF_SQL);
if (sql == null) {
Connection connection = null;
try {
// Table 정보 매핑
connection = ConnectionManager.instance.getConnection();
final DSLContext create = DSL.using(connection, sqlDialect);
this.queryGenerator = new MappingQueryGenerator(create, context.getString(CONF_TABLE));
} catch (SQLException ex) {
throw new JDBCSinkException(ex);
} finally {
JDBCUtils.safeClose( connection );
}
} else {
this.queryGenerator = new TemplateQueryGenerator(sqlDialect, sql);
}
this.sinkCounter = new SinkCounter(this.getName());
}
示例14: build
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public KeyProvider build(Context context) {
String keyStoreFileName = context.getString(
EncryptionConfiguration.JCE_FILE_KEY_STORE_FILE);
String keyStorePasswordFileName = context.getString(
EncryptionConfiguration.JCE_FILE_KEY_STORE_PASSWORD_FILE);
Preconditions.checkState(!Strings.isNullOrEmpty(keyStoreFileName),
"KeyStore file not specified");
Preconditions.checkState(!Strings.isNullOrEmpty(keyStorePasswordFileName),
"KeyStore password file not specified");
Map<String, File> aliasPasswordFileMap = Maps.newHashMap();
String passwordProtectedKeys = context.getString(
EncryptionConfiguration.JCE_FILE_KEYS);
Preconditions.checkState(!Strings.isNullOrEmpty(passwordProtectedKeys),
"Keys available to KeyStore was not specified or empty");
for (String passwordName : passwordProtectedKeys.trim().split("\\s+")) {
String propertyName = Joiner.on(".").join(EncryptionConfiguration.JCE_FILE_KEYS,
passwordName, EncryptionConfiguration.JCE_FILE_KEY_PASSWORD_FILE);
String passwordFileName = context.getString(propertyName,
keyStorePasswordFileName);
File passwordFile = new File(passwordFileName.trim());
if (passwordFile.isFile()) {
aliasPasswordFileMap.put(passwordName, passwordFile);
} else {
logger.warn("Password file for alias " + passwordName +
" does not exist");
}
}
File keyStoreFile = new File(keyStoreFileName.trim());
File keyStorePasswordFile = new File(keyStorePasswordFileName.trim());
return new JCEFileKeyProvider(keyStoreFile, keyStorePasswordFile,
aliasPasswordFileMap);
}
示例15: configure
import org.apache.flume.Context; //导入方法依赖的package包/类
@Override
public void configure(Context context) {
syncIntervalBytes =
context.getInteger(SYNC_INTERVAL_BYTES, DEFAULT_SYNC_INTERVAL_BYTES);
compressionCodec =
context.getString(COMPRESSION_CODEC, DEFAULT_COMPRESSION_CODEC);
staticSchemaURL = context.getString(STATIC_SCHEMA_URL, DEFAULT_STATIC_SCHEMA_URL);
}