Search in sources :

Example 1 with JobSchedule

use of org.platformlayer.core.model.JobSchedule in project platformlayer by platformlayer.

the class JdbcSchedulerRepository method fromDb.

private SchedulerRecord fromDb(SchedulerRecordEntity in) throws OpsException {
    SchedulerRecord out = new SchedulerRecord();
    out.key = in.key;
    out.schedule = new JobSchedule();
    out.schedule.base = in.scheduleBase;
    out.schedule.interval = in.scheduleInterval;
    ActionTask task = new ActionTask();
    out.task = task;
    task.target = PlatformLayerKey.parse(in.taskTarget);
    task.endpoint = new EndpointRecord();
    task.endpoint.url = in.taskEndpointUrl;
    task.endpoint.project = in.taskEndpointProject;
    task.endpoint.secret = fromDb(in.taskEndpointSecret);
    task.endpoint.token = in.taskEndpointToken;
    task.endpoint.trustKeys = in.taskEndpointTrustKeys;
    if (in.taskAction != null) {
        task.action = deserializeAction(in.taskAction);
    }
    return out;
}
Also used : JobSchedule(org.platformlayer.core.model.JobSchedule) ActionTask(org.platformlayer.ops.schedule.ActionTask) EndpointRecord(org.platformlayer.ops.schedule.EndpointRecord) SchedulerRecord(org.platformlayer.ops.schedule.SchedulerRecord)

Example 2 with JobSchedule

use of org.platformlayer.core.model.JobSchedule in project platformlayer by platformlayer.

the class ScheduleController method handler.

@Handler
public void handler() throws OpsException {
    if (OpsContext.isConfigure()) {
        String key = model.getKey().getUrl();
        PlatformLayerKey target = model.targetItem;
        PlatformLayerEndpointInfo endpoint = platformLayer.getEndpointInfo(target);
        JobSchedule schedule = model.schedule;
        Action action = model.action;
        actionScheduler.putJob(key, endpoint, schedule, target, action);
    }
}
Also used : Action(org.platformlayer.core.model.Action) PlatformLayerEndpointInfo(org.platformlayer.PlatformLayerEndpointInfo) JobSchedule(org.platformlayer.core.model.JobSchedule) PlatformLayerKey(org.platformlayer.core.model.PlatformLayerKey) Handler(org.platformlayer.ops.Handler)

Aggregations

JobSchedule (org.platformlayer.core.model.JobSchedule)2 PlatformLayerEndpointInfo (org.platformlayer.PlatformLayerEndpointInfo)1 Action (org.platformlayer.core.model.Action)1 PlatformLayerKey (org.platformlayer.core.model.PlatformLayerKey)1 Handler (org.platformlayer.ops.Handler)1 ActionTask (org.platformlayer.ops.schedule.ActionTask)1 EndpointRecord (org.platformlayer.ops.schedule.EndpointRecord)1 SchedulerRecord (org.platformlayer.ops.schedule.SchedulerRecord)1