本文整理汇总了Java中org.elasticsearch.river.RiverName.name方法的典型用法代码示例。如果您正苦于以下问题:Java RiverName.name方法的具体用法?Java RiverName.name怎么用?Java RiverName.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.river.RiverName
的用法示例。
在下文中一共展示了RiverName.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
示例2: 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();
}
示例3: S3River
import org.elasticsearch.river.RiverName; //导入方法依赖的package包/类
@Inject
@SuppressWarnings({ "unchecked" })
protected S3River(RiverName riverName, RiverSettings settings, Client client, ThreadPool threadPool) throws Exception{
super(riverName, settings);
this.client = client;
this.threadPool = threadPool;
this.riverStatus = RiverStatus.UNKNOWN;
// Deal with connector settings.
if (settings.settings().containsKey("amazon-s3")){
Map<String, Object> feed = (Map<String, Object>)settings.settings().get("amazon-s3");
// Retrieve feed settings.
String feedname = XContentMapValues.nodeStringValue(feed.get("name"), null);
String bucket = XContentMapValues.nodeStringValue(feed.get("bucket"), null);
String pathPrefix = XContentMapValues.nodeStringValue(feed.get("pathPrefix"), null);
String downloadHost = XContentMapValues.nodeStringValue(feed.get("download_host"), null);
int updateRate = XContentMapValues.nodeIntegerValue(feed.get("update_rate"), 15 * 60 * 1000);
boolean jsonSupport = XContentMapValues.nodeBooleanValue(feed.get("json_support"), false);
double indexedCharsRatio = XContentMapValues.nodeDoubleValue(feed.get("indexed_chars_ratio"), 0.0);
String[] includes = S3RiverUtil.buildArrayFromSettings(settings.settings(), "amazon-s3.includes");
String[] excludes = S3RiverUtil.buildArrayFromSettings(settings.settings(), "amazon-s3.excludes");
// Retrieve connection settings.
String accessKey = XContentMapValues.nodeStringValue(feed.get("accessKey"), null);
String secretKey = XContentMapValues.nodeStringValue(feed.get("secretKey"), null);
boolean useIAMRoleForEC2 = XContentMapValues.nodeBooleanValue(feed.get("use_EC2_IAM"), false);
feedDefinition = new S3RiverFeedDefinition(feedname, bucket, pathPrefix, downloadHost,
updateRate, Arrays.asList(includes), Arrays.asList(excludes), accessKey, secretKey, useIAMRoleForEC2,
jsonSupport, indexedCharsRatio);
} else {
logger.error("You didn't define the amazon-s3 settings. Exiting... See https://github.com/lbroudoux/es-amazon-s3-river");
indexName = null;
typeName = null;
bulkSize = 100;
feedDefinition = null;
s3 = null;
return;
}
// Deal with index settings if provided.
if (settings.settings().containsKey("index")) {
Map<String, Object> indexSettings = (Map<String, Object>)settings.settings().get("index");
indexName = XContentMapValues.nodeStringValue(indexSettings.get("index"), riverName.name());
typeName = XContentMapValues.nodeStringValue(indexSettings.get("type"), S3RiverUtil.INDEX_TYPE_DOC);
bulkSize = XContentMapValues.nodeIntegerValue(indexSettings.get("bulk_size"), 100);
} else {
indexName = riverName.name();
typeName = S3RiverUtil.INDEX_TYPE_DOC;
bulkSize = 100;
}
// We need to connect to Amazon S3 after ensure mandatory settings are here.
if (feedDefinition.getBucket() == null){
logger.error("Amazon S3 bucket should not be null. Please fix this.");
throw new IllegalArgumentException("Amazon S3 bucket should not be null.");
}
// Connect using the appropriate authentication process.
if (feedDefinition.getAccessKey() == null && feedDefinition.getSecretKey() == null) {
s3 = new S3Connector(feedDefinition.isUseIAMRoleForEC2());
} else {
s3 = new S3Connector(feedDefinition.getAccessKey(), feedDefinition.getSecretKey());
}
try {
s3.connectUserBucket(feedDefinition.getBucket(), feedDefinition.getPathPrefix());
} catch (AmazonS3Exception ase){
logger.error("Exception while connecting Amazon S3 user bucket. "
+ "Either access key, secret key, IAM Role or bucket name are incorrect");
throw ase;
}
this.riverStatus = RiverStatus.INITIALIZED;
}
示例4: DriveRiver
import org.elasticsearch.river.RiverName; //导入方法依赖的package包/类
@Inject
@SuppressWarnings({ "unchecked" })
protected DriveRiver(RiverName riverName, RiverSettings settings, Client client) throws Exception{
super(riverName, settings);
this.client = client;
// Deal with connector settings.
if (settings.settings().containsKey("google-drive")){
Map<String, Object> feed = (Map<String, Object>)settings.settings().get("google-drive");
// Retrieve feed settings.
String feedname = XContentMapValues.nodeStringValue(feed.get("name"), null);
String folder = XContentMapValues.nodeStringValue(feed.get("folder"), null);
int updateRate = XContentMapValues.nodeIntegerValue(feed.get("update_rate"), 15 * 60 * 1000);
boolean jsonSupport = XContentMapValues.nodeBooleanValue(feed.get("json_support"), false);
String[] includes = DriveRiverUtil.buildArrayFromSettings(settings.settings(), "google-drive.includes");
String[] excludes = DriveRiverUtil.buildArrayFromSettings(settings.settings(), "google-drive.excludes");
// Retrieve connection settings.
String clientId = XContentMapValues.nodeStringValue(feed.get("clientId"), null);
String clientSecret = XContentMapValues.nodeStringValue(feed.get("clientSecret"), null);
String refreshToken = XContentMapValues.nodeStringValue(feed.get("refreshToken"), null);
feedDefinition = new DriveRiverFeedDefinition(feedname, folder, updateRate,
Arrays.asList(includes), Arrays.asList(excludes), clientId, clientSecret, refreshToken, jsonSupport);
} else {
logger.error("You didn't define the google-drive settings. Exiting... See https://github.com/lbroudoux/es-google-drive-river");
indexName = null;
typeName = null;
bulkSize = 100;
feedDefinition = null;
drive = null;
return;
}
// Deal with index settings if provided.
if (settings.settings().containsKey("index")) {
Map<String, Object> indexSettings = (Map<String, Object>)settings.settings().get("index");
indexName = XContentMapValues.nodeStringValue(indexSettings.get("index"), riverName.name());
typeName = XContentMapValues.nodeStringValue(indexSettings.get("type"), DriveRiverUtil.INDEX_TYPE_DOC);
bulkSize = XContentMapValues.nodeIntegerValue(indexSettings.get("bulk_size"), 100);
} else {
indexName = riverName.name();
typeName = DriveRiverUtil.INDEX_TYPE_DOC;
bulkSize = 100;
}
// We need to connect to Google Drive.
drive = new DriveConnector(feedDefinition.getClientId(), feedDefinition.getClientSecret(), feedDefinition.getRefreshToken());
drive.connectUserDrive(feedDefinition.getFolder());
}