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


Java RiverName类代码示例

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


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

示例1: BigQueryRiver

import org.elasticsearch.river.RiverName; //导入依赖的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

示例2: masterOperation

import org.elasticsearch.river.RiverName; //导入依赖的package包/类
@Override
protected void masterOperation(GetRiverStateRequest request, ClusterState state, ActionListener<GetRiverStateResponse> listener) throws ElasticsearchException {
    MetaData metaData = state.metaData();
    RiverStatesMetaData riverStates = metaData.custom(RiverStatesMetaData.TYPE);
    if (request.getRiverName() == null || request.getRiverType() == null) {
        listener.onResponse(new GetRiverStateResponse(request, riverStates.rivers()));
    } else {
        String riverName = request.getRiverName();
        String riverType = request.getRiverType();
        ImmutableList.Builder<RiverState> builder = ImmutableList.builder();
        for (Map.Entry<RiverName, River> entry : RiverHelper.rivers(injector).entrySet()) {
            RiverName name = entry.getKey();
            if (("*".equals(riverName) || name.getName().equals(riverName)) && ("*".equals(riverType) || name.getType().equals(riverType)) && entry.getValue() instanceof StatefulRiver) {
                StatefulRiver river = (StatefulRiver) entry.getValue();
                if (river.getRiverState() != null) {
                    builder.add(river.getRiverState());
                }
            }
        }
        listener.onResponse(new GetRiverStateResponse(request, builder.build()));
    }
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:23,代码来源:TransportGetRiverStateAction.java

示例3: nodeOperation

import org.elasticsearch.river.RiverName; //导入依赖的package包/类
@Override
protected NodeRiverExecuteResponse nodeOperation(NodeRiverExecuteRequest request) throws ElasticsearchException {
    NodeInfo nodeInfo = nodeService.info(false, true, false, true, false, false, true, false, true);
    String riverType = request.getRiverType();
    String riverName = request.getRiverName();
    for (Map.Entry<RiverName, River> entry : RiverHelper.rivers(injector).entrySet()) {
        RiverName name = entry.getKey();
        if ((riverName == null || name.getName().equals(riverName))
                && (riverType == null || name.getType().equals(riverType))
                && entry.getValue() instanceof RunnableRiver) {
            RunnableRiver river = (RunnableRiver) entry.getValue();
            river.run();
            return new NodeRiverExecuteResponse(nodeInfo.getNode()).setExecuted(true);
        }
    }
    return new NodeRiverExecuteResponse(nodeInfo.getNode()).setExecuted(false);
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:18,代码来源:TransportRiverExecuteAction.java

示例4: delete

import org.elasticsearch.river.RiverName; //导入依赖的package包/类
public static void delete(final Client client, final RiverName riverName) {
    DeleteMappingResponse deleteMappingResponse;
    try {
        deleteMappingResponse = client.admin().indices()
                .prepareDeleteMapping("_river").setType(riverName.name())
                .execute().actionGet();
    } catch (final ElasticsearchException e) {
        throw new EsUtilSystemException("Failed to delete "
                + riverName.name(), e);
    }
    if (!deleteMappingResponse.isAcknowledged()) {
        throw new EsUtilSystemException("Failed to delete "
                + riverName.name() + ". "
                + deleteMappingResponse.toString());
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-util,代码行数:17,代码来源:RiverUtils.java

示例5: GitRiver

import org.elasticsearch.river.RiverName; //导入依赖的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.RiverName; //导入依赖的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.RiverName; //导入依赖的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.RiverName; //导入依赖的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.RiverName; //导入依赖的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.RiverName; //导入依赖的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.RiverName; //导入依赖的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: rivers

import org.elasticsearch.river.RiverName; //导入依赖的package包/类
/**
 * Retrieve the registered rivers using reflection. This hack can be removed when RiversService gets a public API.
 *
 * @param injector injector
 * @return map of rivers or null if not possible
 */
@SuppressWarnings({"unchecked"})
public static ImmutableMap<RiverName, River> rivers(Injector injector) {
    RiversService riversService = injector.getInstance(RiversService.class);
    try {
        Field field = RiversService.class.getDeclaredField("rivers");
        if (field != null) {
            field.setAccessible(true);
            return (ImmutableMap<RiverName, River>) field.get(riversService);
        }
    } catch (Throwable e) {
        //
    }
    return ImmutableMap.of();
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:21,代码来源:RiverHelper.java

示例13: setupContext

import org.elasticsearch.river.RiverName; //导入依赖的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

示例14: KafkaRiver

import org.elasticsearch.river.RiverName; //导入依赖的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

示例15: HBaseRiver

import org.elasticsearch.river.RiverName; //导入依赖的package包/类
/**
 * Loads and verifies all the configuration needed to run this river.
 * 
 * @param riverName
 * @param settings
 * @param esClient
 */
@Inject
public HBaseRiver(final RiverName riverName, final RiverSettings settings, final Client esClient) {
	super(riverName, settings);
	this.esClient = esClient;
	this.logger.info("Creating HBase Stream River");

	this.normalizeFields = Boolean.parseBoolean(readConfig("normalizeFields", "true"));
	this.hosts = readConfig("hosts");
	this.table = readConfig("table");
	this.columnSeparator = readConfig("columnSeparator", null);
	this.idField = normalizeField(readConfig("idField", null));
	this.index = normalizeField(readConfig("index", riverName.name()));
	this.type = normalizeField(readConfig("type", this.table));
	this.interval = Long.parseLong(readConfig("interval", "600000"));
	this.batchSize = Integer.parseInt(readConfig("batchSize", "100"));
	this.charset = Charset.forName(readConfig("charset", "UTF-8"));
	this.deleteOld = Boolean.parseBoolean(readConfig("deleteOld", "false"));

	final String family = readConfig("family", null);
	this.family = family != null ? family.getBytes(this.charset) : null;
	this.qualifiers = readConfig("qualifiers", null);
	this.customMapping = readConfig("customMapping", null);

	if (this.interval <= 0) {
		throw new IllegalArgumentException("The interval between runs must be at least 1 ms. The current config is set to "
				+ this.interval);
	}
	if (this.batchSize <= 0) {
		throw new IllegalArgumentException("The batch size must be set to at least 1. The current config is set to " + this.batchSize);
	}
}
 
开发者ID:mallocator,项目名称:Elasticsearch-HBase-River,代码行数:39,代码来源:HBaseRiver.java


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