Revert "move trigger package to top-level x-pack"

This reverts commit elastic/x-pack@bb0add9416.

Original commit: elastic/x-pack-elasticsearch@fc20c8c307
This commit is contained in:
Areek Zillur 2016-06-01 21:30:08 -04:00
parent 51144b3330
commit e996b78b04
173 changed files with 524 additions and 519 deletions

View File

@ -25,8 +25,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.Matchers.is;

View File

@ -20,8 +20,8 @@ import org.elasticsearch.xpack.watcher.transport.actions.delete.DeleteWatchRespo
import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchRequest;
import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchRequest;
import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse;
import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit;
import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingAction;
import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

View File

@ -21,8 +21,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;

View File

@ -14,11 +14,11 @@ import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.xpack.watcher.history.HistoryStore;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse;
import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@ -33,8 +33,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu
import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
@ -75,10 +75,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase {
assertThat(searchResponse.getHits().totalHits(), is(1L));
SearchHit hit = searchResponse.getHits().getAt(0);
if (timeWarped()) {
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now)));
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now)));
} else {
assertThat(hit.getSource(), hasKey("@timestamp"));
DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true));
}
assertThat(hit.getSource(), hasEntry("foo", (Object) "bar"));
@ -111,10 +111,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase {
assertThat(searchResponse.getHits().totalHits(), is(1L));
SearchHit hit = searchResponse.getHits().getAt(0);
if (timeWarped()) {
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now)));
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now)));
} else {
assertThat(hit.getSource(), hasKey("@timestamp"));
DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true));
}
assertThat(hit.getSource(), hasEntry("foo", (Object) "bar"));
@ -202,10 +202,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase {
int i = 0;
for (SearchHit hit : searchResponse.getHits()) {
if (timeWarped()) {
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now)));
assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now)));
} else {
assertThat(hit.getSource(), hasKey("@timestamp"));
DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp"));
assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true));
}
assertThat(hit.getSource(), hasEntry("key", (Object) key.getMillis()));

View File

@ -36,7 +36,7 @@ import java.io.IOException;
import static java.util.Collections.singletonMap;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.messy.tests.MessyTestUtils.getScriptServiceProxy;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

View File

@ -36,8 +36,8 @@ import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.chainTransform;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

View File

@ -30,8 +30,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.hipchatActi
import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder;
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;

View File

@ -51,9 +51,9 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.always
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;

View File

@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.pagerDutyAc
import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder;
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;

View File

@ -37,9 +37,9 @@ import org.elasticsearch.xpack.watcher.input.search.SearchInputFactory;
import org.elasticsearch.xpack.watcher.input.simple.ExecutableSimpleInput;
import org.elasticsearch.xpack.watcher.input.simple.SimpleInput;
import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy;
import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Payload;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.watch.WatchStatus;

View File

@ -43,9 +43,9 @@ import org.elasticsearch.xpack.watcher.transform.TransformBuilders;
import org.elasticsearch.xpack.watcher.transform.search.ExecutableSearchTransform;
import org.elasticsearch.xpack.watcher.transform.search.SearchTransform;
import org.elasticsearch.xpack.watcher.transform.search.SearchTransformFactory;
import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Payload;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.watch.WatchStatus;
@ -74,7 +74,7 @@ import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
import static org.elasticsearch.xpack.support.DateTimeUtils.parseDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.parseDate;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.EMPTY_PAYLOAD;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getRandomSupportedSearchType;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext;

View File

@ -30,8 +30,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.slackAction
import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder;
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;

View File

@ -46,8 +46,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compar
import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput;
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.matchAllRequest;
import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

View File

@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
import java.util.Locale;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*/

View File

@ -19,7 +19,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.rest.support.RestUtils;
import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherUtils;
import org.elasticsearch.xpack.common.http.auth.HttpAuth;
@ -272,14 +272,14 @@ public class HttpRequest implements ToXContent {
builder.auth(httpAuthRegistry.parse(parser));
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.CONNECTION_TIMEOUT)) {
try {
builder.connectionTimeout(DateTimeUtils.parseTimeValue(parser, Field.CONNECTION_TIMEOUT.toString()));
builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser, Field.CONNECTION_TIMEOUT.toString()));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse http request. invalid time value for [{}] field", pe,
currentFieldName);
}
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.READ_TIMEOUT)) {
try {
builder.readTimeout(DateTimeUtils.parseTimeValue(parser, Field.READ_TIMEOUT.toString()));
builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, Field.READ_TIMEOUT.toString()));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse http request. invalid time value for [{}] field", pe,
currentFieldName);

View File

@ -18,7 +18,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.rest.support.RestUtils;
import org.elasticsearch.xpack.common.http.auth.HttpAuth;
import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.common.text.TextTemplate;
import org.elasticsearch.xpack.common.text.TextTemplateEngine;
import org.jboss.netty.handler.codec.http.HttpHeaders;
@ -283,7 +283,7 @@ public class HttpRequestTemplate implements ToXContent {
builder.fromUrl(parser.text());
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, HttpRequest.Field.CONNECTION_TIMEOUT)) {
try {
builder.connectionTimeout(DateTimeUtils.parseTimeValue(parser,
builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser,
HttpRequest.Field.CONNECTION_TIMEOUT.toString()));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field",
@ -291,7 +291,7 @@ public class HttpRequestTemplate implements ToXContent {
}
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, HttpRequest.Field.READ_TIMEOUT)) {
try {
builder.readTimeout(DateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString()));
builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString()));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field",
pe, currentFieldName);

View File

@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -18,7 +18,7 @@ import java.io.IOException;
import java.util.Locale;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -27,7 +27,7 @@ import java.util.Map;
import static java.util.Collections.singletonMap;
import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

View File

@ -15,8 +15,8 @@ import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse;
import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.WatchStore;
import org.elasticsearch.xpack.notification.email.support.EmailServer;
import org.joda.time.DateTime;
@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.emailAction
import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder;
import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition;
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron;
import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule;
import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

View File

@ -63,8 +63,8 @@ import org.elasticsearch.xpack.watcher.transport.actions.service.TransportWatche
import org.elasticsearch.xpack.watcher.transport.actions.service.WatcherServiceAction;
import org.elasticsearch.xpack.watcher.transport.actions.stats.TransportWatcherStatsAction;
import org.elasticsearch.xpack.watcher.transport.actions.stats.WatcherStatsAction;
import org.elasticsearch.xpack.trigger.TriggerModule;
import org.elasticsearch.xpack.trigger.schedule.ScheduleModule;
import org.elasticsearch.xpack.watcher.trigger.TriggerModule;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleModule;
import org.elasticsearch.xpack.watcher.watch.WatchModule;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

View File

@ -18,7 +18,7 @@ import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.xpack.watcher.execution.ExecutionService;
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.watch.WatchLockService;
import org.elasticsearch.xpack.watcher.watch.WatchStatus;
@ -30,9 +30,9 @@ import org.joda.time.PeriodType;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicReference;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.support.Exceptions.ioException;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException;
public class WatcherService extends AbstractComponent {

View File

@ -21,8 +21,8 @@ import java.io.IOException;
import java.util.Locale;
import java.util.Objects;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.support.DateTimeUtils.dateTimeFormatter;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.dateTimeFormatter;
/**
*

View File

@ -18,7 +18,7 @@ import org.elasticsearch.xpack.watcher.actions.throttler.ActionThrottler;
import org.elasticsearch.xpack.watcher.actions.throttler.Throttler;
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
import org.elasticsearch.xpack.watcher.WatcherLicensee;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.watcher.transform.ExecutableTransform;
import org.elasticsearch.xpack.watcher.transform.Transform;
@ -158,7 +158,7 @@ public class ActionWrapper implements ToXContent {
transform = transformRegistry.parse(watchId, parser);
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Throttler.Field.THROTTLE_PERIOD)) {
try {
throttlePeriod = DateTimeUtils.parseTimeValue(parser, Throttler.Field.THROTTLE_PERIOD.toString());
throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, Throttler.Field.THROTTLE_PERIOD.toString());
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse action [{}/{}]. failed to parse field [{}] as time value",
pe, watchId, actionId, currentFieldName);

View File

@ -20,7 +20,7 @@ import org.elasticsearch.xpack.watcher.actions.Action;
import org.elasticsearch.xpack.watcher.actions.ExecutableAction;
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
import org.elasticsearch.xpack.watcher.support.ArrayObjectIterator;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy;
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
import org.elasticsearch.xpack.watcher.watch.Payload;
@ -30,7 +30,7 @@ import java.util.HashMap;
import java.util.Map;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
public class ExecutableIndexAction extends ExecutableAction<IndexAction> {
@ -71,9 +71,9 @@ public class ExecutableIndexAction extends ExecutableAction<IndexAction> {
if (!(data instanceof HashMap)) {
data = new HashMap<>(data); // ensuring mutability
}
data.put(action.executionTimeField, DateTimeUtils.formatDate(ctx.executionTime()));
data.put(action.executionTimeField, WatcherDateTimeUtils.formatDate(ctx.executionTime()));
} else {
indexRequest.timestamp(DateTimeUtils.formatDate(ctx.executionTime()));
indexRequest.timestamp(WatcherDateTimeUtils.formatDate(ctx.executionTime()));
}
indexRequest.source(jsonBuilder().prettyPrint().map(data));
@ -104,9 +104,9 @@ public class ExecutableIndexAction extends ExecutableAction<IndexAction> {
if (!(doc instanceof HashMap)) {
doc = new HashMap<>(doc); // ensuring mutability
}
doc.put(action.executionTimeField, DateTimeUtils.formatDate(ctx.executionTime()));
doc.put(action.executionTimeField, WatcherDateTimeUtils.formatDate(ctx.executionTime()));
} else {
indexRequest.timestamp(DateTimeUtils.formatDate(ctx.executionTime()));
indexRequest.timestamp(WatcherDateTimeUtils.formatDate(ctx.executionTime()));
}
indexRequest.source(jsonBuilder().prettyPrint().map(doc));
bulkRequest.add(indexRequest);

View File

@ -13,7 +13,7 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.watcher.actions.Action;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
import org.joda.time.DateTimeZone;
@ -129,7 +129,7 @@ public class IndexAction implements Action {
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.EXECUTION_TIME_FIELD)) {
executionTimeField = parser.text();
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) {
timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) {
if (token == XContentParser.Token.VALUE_STRING) {
dynamicNameTimeZone = DateTimeZone.forID(parser.text());

View File

@ -9,7 +9,7 @@ import org.elasticsearch.xpack.watcher.actions.ActionStatus;
import org.elasticsearch.xpack.watcher.actions.ActionStatus.AckStatus;
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate;
/**
*

View File

@ -19,10 +19,10 @@ import org.elasticsearch.xpack.watcher.condition.Condition;
import org.elasticsearch.xpack.watcher.condition.always.AlwaysCondition;
import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.watcher.input.none.NoneInput;
import org.elasticsearch.xpack.support.Exceptions;
import org.elasticsearch.xpack.watcher.support.Exceptions;
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
import org.elasticsearch.xpack.watcher.transform.Transform;
import org.elasticsearch.xpack.trigger.Trigger;
import org.elasticsearch.xpack.watcher.trigger.Trigger;
import org.elasticsearch.xpack.watcher.watch.Watch;
import java.io.IOException;

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.watcher.condition.Condition;
import org.elasticsearch.xpack.watcher.condition.ExecutableCondition;
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
import org.elasticsearch.xpack.watcher.support.Variables;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
import org.joda.time.DateTime;
@ -55,8 +55,8 @@ public abstract class AbstractExecutableCompareCondition<C extends Condition, R
Matcher matcher = DATE_MATH_PATTERN.matcher((String) configuredValue);
if (matcher.matches()) {
String dateMath = matcher.group(1);
configuredValue = DateTimeUtils.parseDateMath(dateMath, DateTimeZone.UTC, clock);
resolvedValues.put(dateMath, DateTimeUtils.formatDate((DateTime) configuredValue));
configuredValue = WatcherDateTimeUtils.parseDateMath(dateMath, DateTimeZone.UTC, clock);
resolvedValues.put(dateMath, WatcherDateTimeUtils.formatDate((DateTime) configuredValue));
} else {
// checking if the given value is a path expression
matcher = PATH_PATTERN.matcher((String) configuredValue);

View File

@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.watcher.condition.compare;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@ -55,7 +55,7 @@ public class LenientCompare {
}
if (v1 instanceof String) {
try {
v1 = DateTimeUtils.parseDate((String) v1);
v1 = WatcherDateTimeUtils.parseDate((String) v1);
} catch (Exception e) {
return null;
}

View File

@ -15,7 +15,7 @@ import org.elasticsearch.xpack.common.ScriptServiceProxy;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.invalidScript;
import static org.elasticsearch.xpack.watcher.support.Exceptions.invalidScript;
/**
* This class executes a script against the ctx payload and returns a boolean

View File

@ -7,7 +7,7 @@ package org.elasticsearch.xpack.watcher.execution;
import java.util.Locale;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -9,9 +9,9 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.util.stream.StreamSupport;

View File

@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
public class CurrentExecutions implements Iterable<ExecutionService.WatchExecution> {

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.execution;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
/**
*/

View File

@ -21,7 +21,7 @@ import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation;
import org.elasticsearch.xpack.watcher.transform.Transform;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.watch.WatchLockService;
import org.elasticsearch.xpack.watcher.watch.WatchStore;

View File

@ -10,7 +10,7 @@ import org.elasticsearch.xpack.watcher.actions.Action;
import org.elasticsearch.xpack.watcher.actions.ActionWrapper;
import org.elasticsearch.xpack.watcher.condition.Condition;
import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

View File

@ -9,9 +9,9 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.util.stream.StreamSupport;

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.execution;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.joda.time.DateTime;

View File

@ -16,8 +16,8 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.io.IOException;

View File

@ -38,8 +38,8 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.support.Exceptions.ioException;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException;
public class TriggeredWatchStore extends AbstractComponent {

View File

@ -13,7 +13,7 @@ import org.elasticsearch.xpack.watcher.condition.Condition;
import org.elasticsearch.xpack.watcher.history.WatchRecord;
import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.watcher.transform.Transform;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Payload;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.joda.time.DateTime;

View File

@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.watcher.actions.ExecutableActions;
import org.elasticsearch.xpack.watcher.condition.Condition;
import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.transform.Transform;
import org.joda.time.DateTime;
@ -73,7 +73,7 @@ public class WatchExecutionResult implements ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
DateTimeUtils.writeDate(Field.EXECUTION_TIME.getPreferredName(), builder, executionTime);
WatcherDateTimeUtils.writeDate(Field.EXECUTION_TIME.getPreferredName(), builder, executionTime);
builder.field(Field.EXECUTION_DURATION.getPreferredName(), executionDurationMs);
if (inputResult != null) {

View File

@ -9,7 +9,7 @@ import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -12,6 +12,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.xpack.watcher.WatcherModule;
import org.elasticsearch.xpack.watcher.execution.ExecutionState;
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy;
@ -25,7 +26,7 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import static org.elasticsearch.xpack.support.Exceptions.ioException;
import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException;
/**
*/

View File

@ -17,7 +17,7 @@ import org.elasticsearch.xpack.watcher.execution.WatchExecutionResult;
import org.elasticsearch.xpack.watcher.execution.Wid;
import org.elasticsearch.xpack.watcher.input.ExecutableInput;
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Watch;
import java.io.IOException;

View File

@ -18,7 +18,7 @@ import org.elasticsearch.search.aggregations.AggregatorParsers;
import org.elasticsearch.search.suggest.Suggesters;
import org.elasticsearch.xpack.watcher.input.Input;
import org.elasticsearch.xpack.watcher.support.SearchRequestEquivalence;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherUtils;
import org.elasticsearch.xpack.watcher.watch.Payload;
import org.joda.time.DateTimeZone;
@ -149,7 +149,7 @@ public class SearchInput implements Input {
watchId, currentFieldName);
}
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) {
timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) {
if (token == XContentParser.Token.VALUE_STRING) {
dynamicNameTimeZone = DateTimeZone.forID(parser.text());

View File

@ -28,7 +28,7 @@ import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequest;
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequestBuilder;
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.io.IOException;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.support;
package org.elasticsearch.xpack.watcher.support;
import org.elasticsearch.common.settings.SettingsException;
import org.elasticsearch.script.GeneralScriptException;

View File

@ -11,7 +11,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput;
import java.util.Arrays;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
/**

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.support;
package org.elasticsearch.xpack.watcher.support;
import java.util.Objects;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.support;
package org.elasticsearch.xpack.watcher.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.io.stream.StreamInput;
@ -23,12 +23,12 @@ import java.util.concurrent.Callable;
/**
*
*/
public class DateTimeUtils {
public class WatcherDateTimeUtils {
public static final FormatDateTimeFormatter dateTimeFormatter = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER;
public static final DateMathParser dateMathParser = new DateMathParser(dateTimeFormatter);
private DateTimeUtils() {
private WatcherDateTimeUtils() {
}
public static DateTime convertToDate(Object value, Clock clock) {

View File

@ -6,7 +6,7 @@
package org.elasticsearch.xpack.watcher.support;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate;
import java.io.IOException;
import java.lang.reflect.Array;

View File

@ -10,7 +10,7 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.LoggerMessageFormat;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.support.Exceptions;
import org.elasticsearch.xpack.watcher.support.Exceptions;
import java.util.ArrayList;
import java.util.List;

View File

@ -18,7 +18,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.invalidScript;
import static org.elasticsearch.xpack.watcher.support.Exceptions.invalidScript;
import static org.elasticsearch.xpack.watcher.support.Variables.createCtxModel;
/**

View File

@ -17,7 +17,7 @@ import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.search.aggregations.AggregatorParsers;
import org.elasticsearch.search.suggest.Suggesters;
import org.elasticsearch.xpack.watcher.support.SearchRequestEquivalence;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherUtils;
import org.elasticsearch.xpack.watcher.transform.Transform;
import org.elasticsearch.xpack.watcher.watch.Payload;
@ -115,7 +115,7 @@ public class SearchTransform implements Transform {
TYPE, watchId, currentFieldName);
}
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) {
timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString());
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) {
if (token == XContentParser.Token.VALUE_STRING) {
dynamicNameTimeZone = DateTimeZone.forID(parser.text());

View File

@ -16,7 +16,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder;
import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode;
import org.elasticsearch.xpack.watcher.support.validation.Validation;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import java.io.IOException;
import java.util.HashMap;

View File

@ -10,7 +10,7 @@ import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder;
import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import java.io.IOException;
import java.util.Map;

View File

@ -30,9 +30,9 @@ import org.elasticsearch.xpack.watcher.WatcherLicensee;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
import org.elasticsearch.xpack.watcher.transport.actions.WatcherTransportAction;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent;
import org.elasticsearch.xpack.watcher.watch.Payload;
import org.elasticsearch.xpack.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.watch.WatchStore;
@ -41,7 +41,7 @@ import org.joda.time.DateTimeZone;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
* Performs the watch execution operation.

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.settings.Settings;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentParser;

View File

@ -3,10 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.trigger.schedule.Schedule;
import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.xcontent.XContentParser;
@ -43,7 +43,7 @@ public interface TriggerEngine<T extends Trigger, E extends TriggerEvent> {
T parseTrigger(String context, XContentParser parser) throws IOException;
E parseTriggerEvent(TriggerService service, String id, String context, XContentParser parser) throws IOException;
E parseTriggerEvent(TriggerService service, String watchId, String context, XContentParser parser) throws IOException;
interface Listener {

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.joda.time.DateTime;
import java.io.IOException;
@ -58,7 +58,7 @@ public abstract class TriggerEvent implements ToXContent {
public void recordXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(Field.TYPE.getPreferredName(), type());
DateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime);
WatcherDateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime);
recordDataXContent(builder, params);
builder.endObject();
}

View File

@ -3,13 +3,13 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.multibindings.Multibinder;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.trigger.manual.ManualTriggerEngine;
import org.elasticsearch.xpack.trigger.schedule.ScheduleModule;
import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleModule;
import java.util.HashSet;
import java.util.Set;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger;
package org.elasticsearch.xpack.watcher.trigger;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.component.AbstractComponent;
@ -20,7 +20,7 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.manual;
package org.elasticsearch.xpack.watcher.trigger.manual;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.Trigger;
import org.elasticsearch.xpack.watcher.trigger.Trigger;
import java.io.IOException;

View File

@ -3,19 +3,19 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.manual;
package org.elasticsearch.xpack.watcher.trigger.manual;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*/
@ -79,8 +79,8 @@ public class ManualTriggerEngine implements TriggerEngine<ManualTrigger, ManualT
}
@Override
public ManualTriggerEvent parseTriggerEvent(TriggerService service, String id, String context, XContentParser parser) throws
public ManualTriggerEvent parseTriggerEvent(TriggerService service, String watchId, String context, XContentParser parser) throws
IOException {
return ManualTriggerEvent.parse(service, id, context, parser);
return ManualTriggerEvent.parse(service, watchId, context, parser);
}
}

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.manual;
package org.elasticsearch.xpack.watcher.trigger.manual;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import java.io.IOException;
@ -43,9 +43,9 @@ public class ManualTriggerEvent extends TriggerEvent {
builder.endObject();
}
public static ManualTriggerEvent parse(TriggerService triggerService, String id, String context, XContentParser parser) throws
public static ManualTriggerEvent parse(TriggerService triggerService, String watchId, String context, XContentParser parser) throws
IOException {
TriggerEvent parsedTriggerEvent = triggerService.parseTriggerEvent(id, context, parser);
TriggerEvent parsedTriggerEvent = triggerService.parseTriggerEvent(watchId, context, parser);
return new ManualTriggerEvent(context, parsedTriggerEvent);
}

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.joda.time.DateTimeZone;
@ -21,7 +21,7 @@ import java.util.StringTokenizer;
import java.util.TimeZone;
import java.util.TreeSet;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import java.util.Arrays;
import java.util.Comparator;

View File

@ -3,14 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.schedule.support.DayTimes;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField;
@ -11,7 +11,7 @@ import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.schedule.support.DayTimes;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes;
import java.io.IOException;
import java.util.ArrayList;
@ -19,7 +19,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.ToXContent;
@ -14,7 +14,7 @@ import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.schedule.support.MonthTimes;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.MonthTimes;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentParser;

View File

@ -3,15 +3,15 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.multibindings.MapBinder;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.trigger.schedule.engine.TickerScheduleTriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.trigger.schedule.engine.SchedulerScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.schedule.engine.SchedulerScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleTriggerEngine;
import java.util.HashMap;
import java.util.Locale;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.inject.Inject;

View File

@ -3,10 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.xpack.trigger.Trigger;
import org.elasticsearch.xpack.watcher.trigger.Trigger;
import java.io.IOException;

View File

@ -3,21 +3,21 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.AbstractTriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.watcher.trigger.AbstractTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import org.joda.time.DateTime;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
/**
*
@ -48,13 +48,13 @@ public abstract class ScheduleTriggerEngine extends AbstractTriggerEngine<Schedu
}
Object value = data.get(ScheduleTriggerEvent.Field.TRIGGERED_TIME.getPreferredName());
DateTime triggeredTime = value != null ? DateTimeUtils.convertToDate(value, clock) : now;
DateTime triggeredTime = value != null ? WatcherDateTimeUtils.convertToDate(value, clock) : now;
if (triggeredTime == null) {
throw illegalArgument("could not simulate schedule event. could not convert provided triggered time [{}] to date/time", value);
}
value = data.get(ScheduleTriggerEvent.Field.SCHEDULED_TIME.getPreferredName());
DateTime scheduledTime = value != null ? DateTimeUtils.convertToDate(value, clock) : triggeredTime;
DateTime scheduledTime = value != null ? WatcherDateTimeUtils.convertToDate(value, clock) : triggeredTime;
if (scheduledTime == null) {
throw illegalArgument("could not simulate schedule event. could not convert provided scheduled time [{}] to date/time", value);
}
@ -69,8 +69,8 @@ public abstract class ScheduleTriggerEngine extends AbstractTriggerEngine<Schedu
}
@Override
public ScheduleTriggerEvent parseTriggerEvent(TriggerService service, String id, String context, XContentParser parser) throws
public ScheduleTriggerEvent parseTriggerEvent(TriggerService service, String watchId, String context, XContentParser parser) throws
IOException {
return ScheduleTriggerEvent.parse(parser, id, context, clock);
return ScheduleTriggerEvent.parse(parser, watchId, context, clock);
}
}

View File

@ -3,16 +3,16 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@ -47,15 +47,15 @@ public class ScheduleTriggerEvent extends TriggerEvent {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
DateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime);
DateTimeUtils.writeDate(Field.SCHEDULED_TIME.getPreferredName(), builder, scheduledTime);
WatcherDateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime);
WatcherDateTimeUtils.writeDate(Field.SCHEDULED_TIME.getPreferredName(), builder, scheduledTime);
return builder.endObject();
}
@Override
public void recordDataXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(ScheduleTrigger.TYPE);
DateTimeUtils.writeDate(Field.SCHEDULED_TIME.getPreferredName(), builder, scheduledTime);
WatcherDateTimeUtils.writeDate(Field.SCHEDULED_TIME.getPreferredName(), builder, scheduledTime);
builder.endObject();
}
@ -70,7 +70,7 @@ public class ScheduleTriggerEvent extends TriggerEvent {
currentFieldName = parser.currentName();
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TRIGGERED_TIME)) {
try {
triggeredTime = DateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
triggeredTime = WatcherDateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
} catch (ElasticsearchParseException pe) {
//Failed to parse as a date try datemath parsing
throw new ElasticsearchParseException("could not parse [{}] trigger event for [{}] for watch [{}]. failed to parse " +
@ -78,7 +78,7 @@ public class ScheduleTriggerEvent extends TriggerEvent {
}
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.SCHEDULED_TIME)) {
try {
scheduledTime = DateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
scheduledTime = WatcherDateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse [{}] trigger event for [{}] for watch [{}]. failed to parse " +
"date field [{}]", pe, ScheduleTriggerEngine.TYPE, context, watchId, currentFieldName);

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
/**
* A static factory for all available schedules.

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -3,12 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule;
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.trigger.schedule.support.YearTimes;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.YearTimes;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -3,17 +3,17 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.engine;
package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.scheduler.SchedulerEngine;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

View File

@ -3,18 +3,18 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.engine;
package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent;
import org.elasticsearch.xpack.trigger.TriggerEvent;
import org.elasticsearch.xpack.trigger.schedule.Schedule;
import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.ToXContent;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseFieldMatcher;
@ -16,8 +16,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.support.Strings.join;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Strings.join;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.ToXContent;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseFieldMatcher;
@ -19,8 +19,8 @@ import java.util.Locale;
import java.util.Set;
import static org.elasticsearch.common.util.set.Sets.newHashSet;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.support.Strings.join;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Strings.join;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ToXContent;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseFieldMatcher;
@ -18,7 +18,7 @@ import java.util.HashSet;
import java.util.Set;
import static org.elasticsearch.common.util.set.Sets.newHashSet;
import static org.elasticsearch.xpack.support.Strings.join;
import static org.elasticsearch.xpack.watcher.support.Strings.join;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.support;
package org.elasticsearch.xpack.watcher.trigger.schedule.support;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseFieldMatcher;
@ -21,8 +21,8 @@ import java.util.Locale;
import java.util.Set;
import static org.elasticsearch.common.util.set.Sets.newHashSet;
import static org.elasticsearch.xpack.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.support.Strings.join;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
import static org.elasticsearch.xpack.watcher.support.Strings.join;
/**
*

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.trigger.schedule.tool;
package org.elasticsearch.xpack.watcher.trigger.schedule.tool;
import java.util.Arrays;
import java.util.List;
@ -14,7 +14,7 @@ import org.elasticsearch.cli.Command;
import org.elasticsearch.cli.ExitCodes;
import org.elasticsearch.cli.UserError;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.xpack.trigger.schedule.Cron;
import org.elasticsearch.xpack.watcher.trigger.schedule.Cron;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;

View File

@ -30,7 +30,7 @@ import org.elasticsearch.xpack.watcher.condition.always.ExecutableAlwaysConditio
import org.elasticsearch.xpack.watcher.input.ExecutableInput;
import org.elasticsearch.xpack.watcher.input.InputRegistry;
import org.elasticsearch.xpack.watcher.input.none.ExecutableNoneInput;
import org.elasticsearch.xpack.support.DateTimeUtils;
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
import org.elasticsearch.xpack.support.clock.Clock;
import org.elasticsearch.xpack.support.clock.HaltedClock;
import org.elasticsearch.xpack.common.secret.SecretService;
@ -38,9 +38,9 @@ import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser;
import org.elasticsearch.xpack.watcher.transform.ExecutableTransform;
import org.elasticsearch.xpack.watcher.transform.TransformRegistry;
import org.elasticsearch.xpack.trigger.Trigger;
import org.elasticsearch.xpack.trigger.TriggerEngine;
import org.elasticsearch.xpack.trigger.TriggerService;
import org.elasticsearch.xpack.watcher.trigger.Trigger;
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
import org.joda.time.DateTime;
import org.joda.time.PeriodType;
@ -53,7 +53,7 @@ import java.util.concurrent.atomic.AtomicLong;
import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.common.xcontent.XContentHelper.createParser;
import static org.elasticsearch.xpack.support.Exceptions.ioException;
import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException;
public class Watch implements TriggerEngine.Job, ToXContent {
@ -310,7 +310,7 @@ public class Watch implements TriggerEngine.Job, ToXContent {
transform = transformRegistry.parse(id, parser);
} else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.THROTTLE_PERIOD)) {
try {
throttlePeriod = DateTimeUtils.parseTimeValue(parser, Field.THROTTLE_PERIOD.toString());
throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, Field.THROTTLE_PERIOD.toString());
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse watch [{}]. failed to parse time value for field [{}]",
pe, id, currentFieldName);

View File

@ -16,7 +16,7 @@ import org.joda.time.PeriodType;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
/**
*

View File

@ -30,11 +30,11 @@ import java.util.Map;
import static java.util.Collections.emptyMap;
import static java.util.Collections.unmodifiableMap;
import static org.elasticsearch.xpack.support.DateTimeUtils.parseDate;
import static org.elasticsearch.xpack.support.DateTimeUtils.readDate;
import static org.elasticsearch.xpack.support.DateTimeUtils.readOptionalDate;
import static org.elasticsearch.xpack.support.DateTimeUtils.writeDate;
import static org.elasticsearch.xpack.support.DateTimeUtils.writeOptionalDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.parseDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.readDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.readOptionalDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.writeDate;
import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.writeOptionalDate;
/**
*

View File

@ -40,7 +40,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.elasticsearch.xpack.support.Exceptions.illegalState;
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState;
/**
*/

View File

@ -16,8 +16,8 @@ import org.elasticsearch.xpack.watcher.client.WatchSourceBuilders;
import org.elasticsearch.xpack.watcher.input.InputBuilders;
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse;
import org.elasticsearch.xpack.trigger.TriggerBuilders;
import org.elasticsearch.xpack.trigger.schedule.Schedules;
import org.elasticsearch.xpack.watcher.trigger.TriggerBuilders;
import org.elasticsearch.xpack.watcher.trigger.schedule.Schedules;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;

Some files were not shown because too many files have changed in this diff Show More