Rework exchange classes

This commit is contained in:
Christopher Schnick 2021-12-10 17:13:35 +01:00
parent 88741f74b8
commit 5356d0d027
9 changed files with 42 additions and 10 deletions

View file

@ -3,9 +3,10 @@ package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage; import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
import java.time.Instant;
import java.util.List; import java.util.List;
public class ListCollectionsExchange implements MessageExchange<ListCollectionsExchange.Request, ListCollectionsExchange.Response> { public abstract class ListCollectionsExchange implements MessageExchange<ListCollectionsExchange.Request, ListCollectionsExchange.Response> {
@Override @Override
public String getId() { public String getId() {
@ -26,7 +27,7 @@ public class ListCollectionsExchange implements MessageExchange<ListCollectionsE
} }
public static record Entry(String name, int count) { public static record Entry(String name, int count, Instant lastUsed) {
} }

View file

@ -3,6 +3,7 @@ package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage; import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
import java.time.Instant;
import java.util.List; import java.util.List;
public abstract class ListEntriesExchange implements MessageExchange<ListEntriesExchange.Request, ListEntriesExchange.Response> { public abstract class ListEntriesExchange implements MessageExchange<ListEntriesExchange.Request, ListEntriesExchange.Response> {
@ -26,7 +27,7 @@ public abstract class ListEntriesExchange implements MessageExchange<ListEntries
} }
public static record Entry(String name, String type, String description, String date, String size) { public static record Entry(String name, String type, String description, Instant lastUsed, int size) {
} }

View file

@ -3,7 +3,7 @@ package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage; import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
public class ModeExchange implements MessageExchange<ModeExchange.Request, ModeExchange.Response> { public abstract class ModeExchange implements MessageExchange<ModeExchange.Request, ModeExchange.Response> {
@Override @Override
public String getId() { public String getId() {

View file

@ -4,7 +4,7 @@ import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
import io.xpipe.core.source.DataSourceId; import io.xpipe.core.source.DataSourceId;
public class ReadStructureExchange implements MessageExchange<ReadStructureExchange.Request, ReadStructureExchange.Response> { public abstract class ReadStructureExchange implements MessageExchange<ReadStructureExchange.Request, ReadStructureExchange.Response> {
@Override @Override
public String getId() { public String getId() {

View file

@ -4,7 +4,7 @@ import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
import io.xpipe.core.source.DataSourceId; import io.xpipe.core.source.DataSourceId;
public class ReadTableDataExchange implements MessageExchange<ReadTableDataExchange.Request, ReadTableDataExchange.Response> { public abstract class ReadTableDataExchange implements MessageExchange<ReadTableDataExchange.Request, ReadTableDataExchange.Response> {
@Override @Override
public String getId() { public String getId() {
@ -21,7 +21,7 @@ public class ReadTableDataExchange implements MessageExchange<ReadTableDataExcha
return ReadTableDataExchange.Response.class; return ReadTableDataExchange.Response.class;
} }
public static record Request(DataSourceId sourceId, int maxLines) implements RequestMessage { public static record Request(DataSourceId sourceId, int startow, int maxRows) implements RequestMessage {
} }

View file

@ -5,7 +5,7 @@ import io.xpipe.beacon.message.ResponseMessage;
import io.xpipe.core.data.type.DataType; import io.xpipe.core.data.type.DataType;
import io.xpipe.core.source.DataSourceId; import io.xpipe.core.source.DataSourceId;
public class ReadTableInfoExchange implements MessageExchange<ReadTableInfoExchange.Request, ReadTableInfoExchange.Response> { public abstract class ReadTableInfoExchange implements MessageExchange<ReadTableInfoExchange.Request, ReadTableInfoExchange.Response> {
@Override @Override
public String getId() { public String getId() {

View file

@ -3,7 +3,7 @@ package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage; import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
public class StatusExchange implements MessageExchange<StatusExchange.Request, StatusExchange.Response> { public abstract class StatusExchange implements MessageExchange<StatusExchange.Request, StatusExchange.Response> {
@Override @Override
public String getId() { public String getId() {

View file

@ -0,0 +1,30 @@
package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage;
public abstract class StopExchange implements MessageExchange<StopExchange.Request, StopExchange.Response> {
@Override
public String getId() {
return "stop";
}
@Override
public Class<StopExchange.Request> getRequestClass() {
return StopExchange.Request.class;
}
@Override
public Class<StopExchange.Response> getResponseClass() {
return StopExchange.Response.class;
}
public static record Request(int timeout, boolean force) implements RequestMessage {
}
public static record Response() implements ResponseMessage {
}
}

View file

@ -3,7 +3,7 @@ package io.xpipe.beacon.exchange;
import io.xpipe.beacon.message.RequestMessage; import io.xpipe.beacon.message.RequestMessage;
import io.xpipe.beacon.message.ResponseMessage; import io.xpipe.beacon.message.ResponseMessage;
public class VersionExchange implements MessageExchange<VersionExchange.Request, VersionExchange.Response> { public abstract class VersionExchange implements MessageExchange<VersionExchange.Request, VersionExchange.Response> {
@Override @Override
public String getId() { public String getId() {