- Add classes: "Assignment", "AssignmentRequest", "UrlReport", "WorkerReport" and "WorkerResponse".
- Add interface "WorkerConstants".
This commit is contained in:
parent
b2dfd524e1
commit
137744a8ce
|
@ -0,0 +1,66 @@
|
|||
package eu.openaire.urls_worker.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"tasks",
|
||||
"workerId",
|
||||
"date"
|
||||
})
|
||||
public class Assignment {
|
||||
|
||||
@JsonProperty("tasks")
|
||||
private List<Task> tasks;
|
||||
|
||||
@JsonProperty("workerId")
|
||||
private String workerId;
|
||||
|
||||
@JsonProperty("date")
|
||||
private Date date;
|
||||
|
||||
public Assignment(List<Task> tasks, String workerId, Date date) {
|
||||
this.tasks = tasks;
|
||||
this.workerId = workerId;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public List<Task> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(List<Task> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
public String getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(String workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Assignment{" +
|
||||
"tasks=" + tasks +
|
||||
", workerId='" + workerId + '\'' +
|
||||
", date=" + date +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package eu.openaire.urls_worker.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"task",
|
||||
"status",
|
||||
"payload"
|
||||
})
|
||||
public class UrlReport {
|
||||
|
||||
@JsonProperty("task")
|
||||
private Task task;
|
||||
|
||||
@JsonProperty("status")
|
||||
private String Status;
|
||||
|
||||
@JsonProperty("payload")
|
||||
private Payload payload;
|
||||
|
||||
|
||||
public UrlReport(Task task, String status, Payload payload) {
|
||||
this.task = task;
|
||||
Status = status;
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
public Task getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
public void setTask(Task task) {
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return Status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
Status = status;
|
||||
}
|
||||
|
||||
public Payload getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public void setPayload(Payload payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package eu.openaire.urls_worker.payloads.requests;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import eu.openaire.urls_worker.models.Assignment;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class AssignmentRequest {
|
||||
|
||||
@JsonProperty("assignment")
|
||||
private Assignment assignment;
|
||||
|
||||
public AssignmentRequest(Assignment assignment) {
|
||||
this.assignment = assignment;
|
||||
}
|
||||
|
||||
public Assignment getAssignment() {
|
||||
return assignment;
|
||||
}
|
||||
|
||||
public void setAssignment(Assignment assignment) {
|
||||
this.assignment = assignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AssignmentRequest{" +
|
||||
"assignment=" + assignment +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package eu.openaire.urls_worker.payloads.responces;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import eu.openaire.urls_worker.models.UrlReport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"workerId",
|
||||
"url"
|
||||
})
|
||||
public class WorkerReport {
|
||||
|
||||
@JsonProperty("workerId")
|
||||
private String workerId;
|
||||
|
||||
@JsonProperty("urlReports")
|
||||
private List<UrlReport> urlReports;
|
||||
|
||||
public WorkerReport(String workerId, List<UrlReport> urlReports) {
|
||||
this.workerId = workerId;
|
||||
this.urlReports = urlReports;
|
||||
}
|
||||
|
||||
public String getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(String workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public List<UrlReport> getUrlReports() {
|
||||
return urlReports;
|
||||
}
|
||||
|
||||
public void setUrlReports(List<UrlReport> urlReports) {
|
||||
this.urlReports = urlReports;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package eu.openaire.urls_worker.payloads.responces;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"workerId",
|
||||
"tasksLimit"
|
||||
})
|
||||
public class WorkerResponse {
|
||||
|
||||
@JsonProperty("workerId")
|
||||
private String workerId;
|
||||
|
||||
@JsonProperty("tasksLimit")
|
||||
private int tasksLimit;
|
||||
|
||||
public WorkerResponse(String workerId, int tasksLimit) {
|
||||
this.workerId = workerId;
|
||||
this.tasksLimit = tasksLimit;
|
||||
}
|
||||
|
||||
public String getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(String workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public int getTasksLimit() {
|
||||
return tasksLimit;
|
||||
}
|
||||
|
||||
public void setTasksLimit(int tasksLimit) {
|
||||
this.tasksLimit = tasksLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WorkerRequest{" +
|
||||
"id='" + workerId + '\'' +
|
||||
", tasksLimit=" + tasksLimit +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package eu.openaire.urls_worker.util;
|
||||
|
||||
public interface WorkerConstants {
|
||||
|
||||
String WORKER_ID = "worker_1"; // This should be different for every deployment of a Worker.
|
||||
int TASKS_LIMIT = 10000;
|
||||
}
|
Loading…
Reference in New Issue