本文整理汇总了Java中org.elasticsearch.common.xcontent.support.XContentMapValues.nodeTimeValue方法的典型用法代码示例。如果您正苦于以下问题:Java XContentMapValues.nodeTimeValue方法的具体用法?Java XContentMapValues.nodeTimeValue怎么用?Java XContentMapValues.nodeTimeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.xcontent.support.XContentMapValues
的用法示例。
在下文中一共展示了XContentMapValues.nodeTimeValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRiverContext
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Override
protected void createRiverContext(String riverType, String riverName, Map<String, Object> mySettings) throws IOException {
super.createRiverContext(riverType, riverName, mySettings);
// defaults for column strategy
String columnCreatedAt = XContentMapValues.nodeStringValue(mySettings.get("created_at"), "created_at");
String columnUpdatedAt = XContentMapValues.nodeStringValue(mySettings.get("updated_at"), "updated_at");
String columnDeletedAt = XContentMapValues.nodeStringValue(mySettings.get("deleted_at"), null);
boolean columnEscape = XContentMapValues.nodeBooleanValue(mySettings.get("column_escape"), true);
TimeValue lastRunTimeStampOverlap = XContentMapValues.nodeTimeValue(mySettings.get("last_run_timestamp_overlap"),
TimeValue.timeValueSeconds(0));
riverContext
.columnCreatedAt(columnCreatedAt)
.columnUpdatedAt(columnUpdatedAt)
.columnDeletedAt(columnDeletedAt)
.columnEscape(columnEscape)
.setLastRunTimeStampOverlap(lastRunTimeStampOverlap);
}
示例2: getLastRunTimestampOverlap
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
private TimeValue getLastRunTimestampOverlap(RiverSettings riverSettings) {
TimeValue overlap = TimeValue.timeValueMillis(0);
Map<String, Object> jdbcSettingsMap = ((Map<String, Object>) (riverSettings.settings().get("jdbc")));
if (jdbcSettingsMap != null && jdbcSettingsMap.containsKey("last_run_timestamp_overlap")) {
overlap = XContentMapValues.nodeTimeValue(jdbcSettingsMap.get("last_run_timestamp_overlap"));
}
return overlap;
}
示例3: JolokiaRiver
import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Inject
public JolokiaRiver(RiverName riverName, RiverSettings riverSettings,
@RiverIndexName String riverIndexName,
Client client) {
super(riverName, riverSettings);
// riverIndexName = _river
Map<String, Object> sourceSettings =
riverSettings.settings().containsKey(TYPE)
? (Map<String, Object>) riverSettings.settings().get(TYPE)
: new HashMap<String, Object>();
strategy = XContentMapValues.nodeStringValue(sourceSettings.get("strategy"), "simple");
riverSetting = new JolokiaRiverSetting();
riverSetting.setHosts(nodeToStringList(sourceSettings.get("hosts"), new ArrayList<String>()));
riverSetting.setUrl(XContentMapValues.nodeStringValue(sourceSettings.get("url"), null));
riverSetting.setObjectName(XContentMapValues.nodeStringValue(sourceSettings.get("objectName"), null));
riverSetting.setAttributes(nodeToAttributeList(sourceSettings.get("attributes"), new ArrayList<Attribute>()));
riverSetting.setPrefix(XContentMapValues.nodeStringValue(sourceSettings.get("prefix"), ""));
riverSetting.setConstants(nodeToMap(sourceSettings.get("constants"), new HashMap<String, Map<String, Object>>()));
riverSetting.setLogType(XContentMapValues.nodeStringValue(sourceSettings.get("logType"), null));
riverSetting.setOnlyUpdates(XContentMapValues.nodeBooleanValue(sourceSettings.get("onlyUpdates"),false));
poll = XContentMapValues.nodeTimeValue(sourceSettings.get("poll"), TimeValue.timeValueMinutes(1));
maxretries = XContentMapValues.nodeIntegerValue(sourceSettings.get("max_retries"), 3);
maxretrywait = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(sourceSettings.get("max_retries_wait"), "10s"), TimeValue.timeValueMillis(30000));
digesting = XContentMapValues.nodeBooleanValue(sourceSettings.get("digesting"), Boolean.TRUE);
Map<String, Object> targetSettings =
riverSettings.settings().containsKey("index")
? (Map<String, Object>) riverSettings.settings().get("index")
: new HashMap<String, Object>();
indexName = XContentMapValues.nodeStringValue(targetSettings.get("index"), TYPE);
typeName = XContentMapValues.nodeStringValue(targetSettings.get("type"), TYPE);
bulkSize = XContentMapValues.nodeIntegerValue(targetSettings.get("bulk_size"), 100);
maxBulkRequests = XContentMapValues.nodeIntegerValue(targetSettings.get("max_bulk_requests"), 30);
indexSettings = XContentMapValues.nodeStringValue(targetSettings.get("index_settings"), null);
typeMapping = XContentMapValues.nodeStringValue(targetSettings.get("type_mapping"), null);
versioning = XContentMapValues.nodeBooleanValue(sourceSettings.get("versioning"), Boolean.FALSE);
acknowledgeBulk = XContentMapValues.nodeBooleanValue(sourceSettings.get("acknowledge"), Boolean.FALSE);
riverSource = RiverServiceLoader.findRiverSource(strategy);
logger.debug("found river source {} for strategy {}", riverSource.getClass().getName(), strategy);
riverSource.setting(riverSetting);
riverMouth = RiverServiceLoader.findRiverMouth(strategy);
logger.debug("found river mouth {} for strategy {}", riverMouth.getClass().getName(), strategy);
riverMouth.indexTemplate(indexName)
.type(typeName)
.maxBulkActions(bulkSize)
.maxConcurrentBulkRequests(maxBulkRequests)
.acknowledge(acknowledgeBulk)
.versioning(versioning)
.client(client);
riverContext = new RiverContext()
.riverName(riverName.getName())
.riverIndexName(riverIndexName)
.riverSettings(riverSettings.settings())
.riverSource(riverSource)
.riverMouth(riverMouth)
.pollInterval(poll)
.retries(maxretries)
.maxRetryWait(maxretrywait)
.digesting(digesting)
.contextualize();
riverFlow = RiverServiceLoader.findRiverFlow(strategy);
// prepare task for run
riverFlow.riverContext(riverContext);
logger.debug("found river flow {} for strategy {}", riverFlow.getClass().getName(), strategy);
}