public static void isTrue(Boolean object) { isTrue(object, "[Assertion failed] - this argument must be true"); }
private ContentBuilder(Generator generator, ValueWriter writer) { Assert.notNull(generator); this.generator = generator; this.writer = writer; }
public SearchRequestBuilder shard(String shard) { Assert.hasText(shard, "Invalid shard"); this.shard = shard; return this; }
public static Field findField(Class<?> clazz, String name, Class<?> type) { Assert.notNull(clazz, "Class must not be null"); Assert.isTrue(name != null || type != null, "Either name or type of the field must be specified"); Class<?> searchType = clazz; while (!Object.class.equals(searchType) && searchType != null) { Field[] fields = searchType.getDeclaredFields(); for (Field field : fields) { if ((name == null || name.equals(field.getName())) && (type == null || type.equals(field.getType()))) { return field; } } searchType = searchType.getSuperclass(); } return null; }
Assert.hasText(resource, errorMessage + resource); type = res.substring(slash + 1); typed = true; Assert.hasText(type, "No type found; expecting [index]/[type]"); } else { index = res; typed = false; Assert.hasText(index, "No index found; expecting [index]/[type]"); Assert.isTrue(!StringUtils.hasWhitespace(index) && !StringUtils.hasWhitespace(type), "Index/type should not contain whitespaces"); Assert.isTrue(!StringUtils.hasWhitespace(ingestPipeline), "Ingest Pipeline name should not contain whitespaces"); Assert.isTrue(!(ES_OPERATION_UPDATE.equals(settings.getOperation()) || ES_OPERATION_UPSERT.equals(settings.getOperation())), "Cannot specify an ingest pipeline when doing updates or upserts"); bulkEndpoint = bulkEndpoint + "?pipeline=" + ingestPipeline;
public static void hasNoText(CharSequence sequence) { hasNoText(sequence, "[Assertion failed] - this CharSequence argument must be empty"); }
public SearchRequestBuilder fields(String fieldsCSV) { Assert.isFalse(this.excludeSource, "Fields can't be requested because _source section is excluded"); this.fields = fieldsCSV; return this; }
/** * Writes the objects to index. * * @param ba The data as a bytes array */ public void writeProcessedToIndex(BytesArray ba) { Assert.notNull(ba, "no data given"); Assert.isTrue(ba.length() > 0, "no data given"); lazyInitWriting(); trivialBytesRef.reset(); trivialBytesRef.add(ba); doWriteToIndex(trivialBytesRef); }
public SearchRequestBuilder excludeSource(boolean value) { if (value) { Assert.hasNoText(this.fields, String.format("_source section can't be excluded if fields [%s] are requested", this.fields)); } this.excludeSource = value; return this; }
public static void isFalse(Boolean object) { isFalse(object, "[Assertion failed] - this argument must be false"); } }
/** * Creates a new byte array output stream, with a buffer capacity of * the specified size, in bytes. * * @param size the initial size. * @throws EsHadoopIllegalArgumentException if size is negative. */ public FastByteArrayOutputStream(int size) { Assert.isTrue(size >= 0, "Negative initial size: " + size); data = new BytesArray(size); }
public SparkSettings(SparkConf cfg) { Assert.notNull(cfg, "non-null spark configuration expected"); this.cfg = cfg; }
public MessageTemplate(ElasticCommonSchema schema, Map<String, String> labels, Set<String> tags, HostData host, String eventCategory, String eventType) { Assert.hasText(eventCategory, "Missing " + FieldNames.FIELD_EVENT_CATEGORY + " value for ECS template."); Assert.hasText(eventType, "Missing " + FieldNames.FIELD_EVENT_TYPE + " value for ECS template."); this.schema = schema; this.labels = labels; this.tags = tags; this.host = host; this.eventCategory = eventCategory; this.eventType = eventType; }
HeartBeat(final Progressable progressable, Configuration cfg, TimeValue lead, final Log log) { Assert.notNull(progressable, "a valid progressable is required to report status to Hadoop"); TimeValue tv = HadoopCfgUtils.getTaskTimeout(cfg); Assert.isTrue(tv.getSeconds() <= 0 || tv.getSeconds() > lead.getSeconds(), "Hadoop timeout is shorter than the heartbeat"); this.progressable = progressable; long cfgMillis = (tv.getMillis() > 0 ? tv.getMillis() : 0); // the task is simple hence the delay = timeout - lead, that is when to start the notification right before the timeout this.delay = new TimeValue(Math.abs(cfgMillis - lead.getMillis()), TimeUnit.MILLISECONDS); this.log = log; String taskId; TaskID taskID = HadoopCfgUtils.getTaskID(cfg); if (taskID == null) { log.warn("Cannot determine task id..."); taskId = "<unknown>"; if (log.isTraceEnabled()) { log.trace("Current configuration is " + HadoopCfgUtils.asProperties(cfg)); } } else { taskId = "" + taskID; } id = taskId; }
public static void hasNoText(CharSequence sequence) { hasNoText(sequence, "[Assertion failed] - this CharSequence argument must be empty"); }
public SearchRequestBuilder fields(String fieldsCSV) { Assert.isFalse(this.excludeSource, "Fields can't be requested because _source section is excluded"); this.fields = fieldsCSV; return this; }
public SearchRequestBuilder scroll(long keepAliveMillis) { Assert.isTrue(keepAliveMillis > 0, "Invalid scroll"); this.scroll = TimeValue.timeValueMillis(keepAliveMillis); return this; }
public HadoopSettings(Configuration cfg) { Assert.notNull(cfg, "Non-null properties expected"); this.cfg = cfg; }
public static void hasText(CharSequence sequence) { hasText(sequence, "[Assertion failed] - this CharSequence argument must have text; it must not be null, empty, or blank"); }
public static void hasNoText(CharSequence sequence) { hasNoText(sequence, "[Assertion failed] - this CharSequence argument must be empty"); }