當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。