当前位置: 首页>>代码示例>>Java>>正文


Java RiverSettings类代码示例

本文整理汇总了Java中org.elasticsearch.river.RiverSettings的典型用法代码示例。如果您正苦于以下问题:Java RiverSettings类的具体用法?Java RiverSettings怎么用?Java RiverSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RiverSettings类属于org.elasticsearch.river包,在下文中一共展示了RiverSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SnapshotsSettings

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
public SnapshotsSettings(RiverSettings settings) {
	super();
	if (settings.settings().containsKey(RIVERNAME)) {
		@SuppressWarnings({ "unchecked" })
		Map<String, Object> snapshotterSettings = (Map<String, Object>) settings.settings().get(RIVERNAME);
		this.repository = XContentMapValues.nodeStringValue(snapshotterSettings.get("repository"), "my_backup");
		this.indices = XContentMapValues.nodeStringValue(snapshotterSettings.get("indices"), "_all");
		this.includeGlobalState = XContentMapValues.nodeBooleanValue(snapshotterSettings.get("include_global_state"), false);
		this.frequency = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(snapshotterSettings.get("frequency"), "24h"), TimeValue.timeValueMinutes(60));
		if (snapshotterSettings.get("purgeAfter") != null && snapshotterSettings.get("purgeAfter").toString().length() > 0) {
			this.purgeAfter = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(snapshotterSettings.get("purgeAfter"), "240h"), TimeValue.timeValueHours(240));
		} else {
			this.purgeAfter = null;
		}
		this.setPurgeIndicesMustMatch(XContentMapValues.nodeBooleanValue(snapshotterSettings.get("purge_indices_must_match"), true));

	} else {
		this.repository = "my_backup";
		this.indices = "_all";
		this.includeGlobalState = false;
		this.frequency = TimeValue.timeValueHours(24);
		this.purgeAfter = null; // no purging by default
		this.setPurgeIndicesMustMatch(true);
	}
}
 
开发者ID:garmin,项目名称:elasticsearch-river-snapshot,代码行数:26,代码来源:SnapshotsSettings.java

示例2: BigQueryRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
public BigQueryRiver(final RiverName riverName, final RiverSettings settings, final Client esClient) {
	super(riverName, settings);
	this.esClient = esClient;
	logger.info("Creating BigQuery Stream River");
	indexScript = readConfig("index", riverName.name());
	typeScript = readConfig("type", "import");
	project = readConfig("project");
	keyFile = readConfig("keyFile");
	account = readConfig("account");
	query = readConfig("query");
	mappingScript = readConfig("mapping", null);
	create = Boolean.valueOf(readConfig("create", null));
	uniqueIdField = readConfig("uniqueIdField", null);
	interval = Long.parseLong(readConfig("interval", "600000"));
}
 
开发者ID:mallocator,项目名称:Elasticsearch-BigQuery-River,代码行数:17,代码来源:BigQueryRiver.java

示例3: createFeeder

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
private Feeder createFeeder(String riverType, String riverName, RiverSettings riverSettings) {
    JDBCFeeder feeder = null;
    try {
        Map<String, Object> spec = (Map<String, Object>) riverSettings.settings().get("jdbc");
        Map<String, String> loadedSettings = new JsonSettingsLoader().load(jsonBuilder().map(spec).string());
        Settings mySettings = settingsBuilder().put(loadedSettings).build();
        String strategy = XContentMapValues.nodeStringValue(spec.get("strategy"), "simple");
        RiverFlow riverFlow = RiverServiceLoader.findRiverFlow(strategy);
        logger.debug("found river flow class {} for strategy {}", riverFlow.getClass().getName(), strategy);
        feeder = riverFlow.getFeeder();
        logger.debug("spec = {} settings = {}", spec, mySettings.getAsMap());
        feeder.setName(riverName)
                .setType(riverType)
                .setSpec(spec).setSettings(mySettings);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return feeder;
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:20,代码来源:JDBCRiver.java

示例4: testDefaults

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
public void testDefaults()
{
	Map<String, Object> map = new HashMap<>();		
	RiverSettings settings = new RiverSettings(
		ImmutableSettings.settingsBuilder().build(), 
		map);
	KafkaRiverConfig c = new KafkaRiverConfig(settings);
	
	assertEquals("localhost", c.brokerHost);
	assertEquals(9092, c.brokerPort);
	assertEquals("localhost", c.zookeeper);
	assertEquals(10485760, c.bulkSize);
	assertEquals(0, c.partition);
	assertEquals("default_topic", c.topic);
	assertEquals(10000, c.bulkTimeout.millis());
	
	assertEquals("org.elasticsearch.river.kafka.JsonMessageHandlerFactory", c.factoryClass);
	
	assertEquals(-1, c.statsdPort);
	assertNull(c.statsdHost);
	assertNull(c.statsdPrefix);
	
}
 
开发者ID:endgameinc,项目名称:elasticsearch-river-kafka,代码行数:24,代码来源:KafkaRiverConfigTest.java

示例5: GitRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
protected GitRiver(RiverName riverName, RiverSettings settings, @RiverIndexName String riverIndexName, Client client) throws InvocationTargetException, IllegalAccessException {
    super(riverName, settings);
    this.client = client;
    logger.info("Creating Git river");

    if (settings.settings().containsKey("git")) {
        Map<String, Object> gitSettings = (Map<String, Object>) settings.settings().get("git");
        BeanUtilsBean2.getInstance().populate(context, transformKeys(gitSettings, new Function<String, String>() {
            @Override
            public String apply(String input) {
                return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, input);
            }
        }));
    }
    context.setRiverName(riverName.name());
    context.setRiverIndexName(riverIndexName);
    context.setClient(client);
    context.setIssuePattern(compilePattern(context.getIssueRegex()));
}
 
开发者ID:obazoud,项目名称:elasticsearch-river-git,代码行数:21,代码来源:GitRiver.java

示例6: ArangoDbRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
public ArangoDbRiver( //
final RiverName riverName, //
	final RiverSettings settings, //
	final Client client, //
	final ScriptService scriptService, //
	final ArangoDbConfig config, //
	final WalReaderRunnable walReaderRunnable, //
	final IndexWriterRunnable indexWriterRunnable, //
	@Named("arangodb_river_walReaderRunnable_threadfactory") final ThreadFactory walReaderThreadFactory, //
	@Named("arangodb_river_indexWriterRunnable_threadfactory") final ThreadFactory indexWriterThreadFactory //
) throws ArangoDbException {

	super(riverName, settings);

	this.client = client;
	this.config = config;
	this.walReaderRunnable = walReaderRunnable;
	this.indexWriterRunnable = indexWriterRunnable;
	this.walReaderThreadFactory = walReaderThreadFactory;
	this.indexWriterThreadFactory = indexWriterThreadFactory;

	logger.debug("Prefix: [{}] - name: [{}]", logger.getPrefix(), logger.getName());
	logger.debug("River settings: [{}]", settings.settings());
}
 
开发者ID:arangodb,项目名称:elasticsearch-river-arangodb,代码行数:26,代码来源:ArangoDbRiver.java

示例7: WildlfyRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
@Inject
public WildlfyRiver(RiverName riverName, RiverSettings settings, Client client, ThreadPool threadPool) {
    super(riverName, settings);
    this.client = client;
    this.threadPool = threadPool;

    logger.info("Creating wildfly metric stream");

    indexName = riverName.name();
    typeName = "metrics";

    //dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");

    timeFormatter = ISODateTimeFormat.dateTimeNoMillis();

}
 
开发者ID:heiko-braun,项目名称:river-metrics,代码行数:18,代码来源:WildlfyRiver.java

示例8: prepareRiverInstanceForTest

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
/**
 * Prepare {@link RemoteRiver} instance for unit test, with Mockito moceked jiraClient and elasticSearchClient.
 * 
 * @param urlGetDocuments parameter for remote settings
 * @param remoteSettingsAdd additional/optional config properties to be added into <code>remote</code> configuration
 *          node
 * @param toplevelSettingsAdd additional/optional config properties to be added into toplevel node. Do not add
 *          <code>remote</code> here, will be ignored.
 * @param initRemoteClientMock if set to true then Mockito mock instance is created and set into
 *          {@link RemoteRiver#remoteSystemClient}
 * @return instance for tests
 * @throws Exception from constructor
 */
public static RemoteRiver prepareRiverInstanceForTest(String urlGetDocuments, Map<String, Object> remoteSettingsAdd,
		Map<String, Object> toplevelSettingsAdd, boolean initRemoteClientMock) throws Exception {
	Map<String, Object> settings = new HashMap<String, Object>();
	if (toplevelSettingsAdd != null)
		settings.putAll(toplevelSettingsAdd);
	if (urlGetDocuments != null || remoteSettingsAdd != null) {
		Map<String, Object> remoteSettings = new HashMap<String, Object>();
		settings.put("remote", remoteSettings);
		if (remoteSettingsAdd != null)
			remoteSettings.putAll(remoteSettingsAdd);
		remoteSettings.put(GetJSONClient.CFG_URL_GET_DOCUMENTS, urlGetDocuments);
		remoteSettings.put(GetJSONClient.CFG_URL_GET_SPACES, urlGetDocuments);
	}

	Settings gs = mock(Settings.class);
	RiverSettings rs = new RiverSettings(gs, settings);
	Client clientMock = mock(Client.class);
	RemoteRiver tested = new RemoteRiver(new RiverName("remote", RIVER_NAME), rs, clientMock);
	if (initRemoteClientMock) {
		IRemoteSystemClient remoteClientMock = mock(IRemoteSystemClient.class);
		tested.remoteSystemClient = remoteClientMock;
	}
	return tested;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:38,代码来源:RemoteRiverTest.java

示例9: ZookeeperRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
public ZookeeperRiver(final RiverName riverName, final RiverSettings settings,
        final Client client) {
    super(riverName, settings);
    this.client = client;

    logger.info("CREATE ZookeeperRiver");

    // TODO Your code..

}
 
开发者ID:xingxiudong,项目名称:elasticsearch-zkdiscovery,代码行数:12,代码来源:ZookeeperRiver.java

示例10: GitHubRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
@Inject
public GitHubRiver(RiverName riverName, RiverSettings settings, Client client) {
    super(riverName, settings);
    this.client = client;

    if (!settings.settings().containsKey("github")) {
        throw new IllegalArgumentException("Need river settings - owner and repository.");
    }

    // get settings
    Map<String, Object> githubSettings = (Map<String, Object>) settings.settings().get("github");
    owner = XContentMapValues.nodeStringValue(githubSettings.get("owner"), null);
    repository = XContentMapValues.nodeStringValue(githubSettings.get("repository"), null);

    index = String.format("%s&%s", owner, repository);
    userRequestedInterval = XContentMapValues.nodeIntegerValue(githubSettings.get("interval"), 60);

    // auth (optional)
    username = null;
    password = null;
    if (githubSettings.containsKey("authentication")) {
        Map<String, Object> auth = (Map<String, Object>) githubSettings.get("authentication");
        username = XContentMapValues.nodeStringValue(auth.get("username"), null);
        password = XContentMapValues.nodeStringValue(auth.get("password"), null);
    }

    // endpoint (optional - default to github.com)
    endpoint = XContentMapValues.nodeStringValue(githubSettings.get("endpoint"), "https://api.github.com");

    logger.info("Created GitHub river.");
}
 
开发者ID:uberVU,项目名称:elasticsearch-river-github,代码行数:33,代码来源:GitHubRiver.java

示例11: JDBCRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
@SuppressWarnings({"unchecked"})
public JDBCRiver(RiverName riverName, RiverSettings riverSettings, Client client) {
    super(riverName, riverSettings);
    if (!riverSettings.settings().containsKey("jdbc")) {
        throw new IllegalArgumentException("no 'jdbc' settings in river settings?");
    }
    this.client = client;
    this.feeder = createFeeder(riverName.getType(), riverName.getName(), riverSettings);
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:11,代码来源:JDBCRiver.java

示例12: setContextSettings

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
private void setContextSettings(String riverResource) throws IOException {
    RiverSettings riverSettings = riverSettings(riverResource);
    Map<String, Object> settings = (Map<String, Object>) riverSettings.settings().get("jdbc");

    riverSettings.settings().put(ColumnRiverFlow.LAST_RUN_TIME, LAST_RUN_TIME);
    riverSettings.settings().put(ColumnRiverFlow.CURRENT_RUN_STARTED_TIME, new TimeValue(new Date().getTime()));

    context.setRiverSettings(riverSettings.settings());
    context.setStatements(SQLCommand.parse(settings));
    context.columnCreatedAt(XContentMapValues.nodeStringValue(settings.get("column_created_at"), null));
    context.columnUpdatedAt(XContentMapValues.nodeStringValue(settings.get("column_updated_at"), null));
    context.columnDeletedAt(XContentMapValues.nodeStringValue(settings.get("column_deleted_at"), null));
    context.columnEscape(true);
    context.setLastRunTimeStampOverlap(getLastRunTimestampOverlap(riverSettings));
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:16,代码来源:ColumnRiverSourceTests.java

示例13: getLastRunTimestampOverlap

import org.elasticsearch.river.RiverSettings; //导入依赖的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;
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:9,代码来源:ColumnRiverSourceTests.java

示例14: setupContext

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
private void setupContext(RiverSource riverSource, String riverResource) throws IOException {
    RiverSettings riverSettings = riverSettings(riverResource);
    context.setRiverName(new RiverName(index, type).getName());
    context.setRiverMouth(new MockRiverMouth());
    context.setRiverSource(riverSource);
    context.setRiverSettings(riverSettings.settings());
    context.columnEscape(true);
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:9,代码来源:ColumnRiverFlowTests.java

示例15: KafkaRiver

import org.elasticsearch.river.RiverSettings; //导入依赖的package包/类
@Inject
  public KafkaRiver(RiverName riverName, RiverSettings settings, Client client) {
      super(riverName, settings);
      this.client = client;
      
      try {
	logger.info("KafkaRiver created: name={}, type={}", riverName.getName(), riverName.getType());
	this.riverConfig = new KafkaRiverConfig(settings);
} catch (Exception e) {
	logger.error("Unexpected Error occurred", e);
	throw new RuntimeException(e);
}
  }
 
开发者ID:endgameinc,项目名称:elasticsearch-river-kafka,代码行数:14,代码来源:KafkaRiver.java


注:本文中的org.elasticsearch.river.RiverSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。