mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-23 08:00:56 -04:00
Refactor
This commit is contained in:
@@ -23,32 +23,6 @@ import static io.xpipe.beacon.BeaconConfig.BODY_SEPARATOR;
|
||||
|
||||
public class BeaconClient implements AutoCloseable {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableBiConsumer<T, U, E extends Throwable> {
|
||||
|
||||
void accept(T var1, U var2) throws E;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableConsumer<T, E extends Throwable> {
|
||||
|
||||
void accept(T var1) throws E;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableRunnable<E extends Throwable> {
|
||||
|
||||
void run() throws E;
|
||||
}
|
||||
|
||||
public static Optional<BeaconClient> tryConnect() {
|
||||
try {
|
||||
return Optional.of(new BeaconClient());
|
||||
} catch (IOException ex) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
private final Closeable closeable;
|
||||
private final InputStream in;
|
||||
private final OutputStream out;
|
||||
@@ -66,6 +40,14 @@ public class BeaconClient implements AutoCloseable {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public static Optional<BeaconClient> tryConnect() {
|
||||
try {
|
||||
return Optional.of(new BeaconClient());
|
||||
} catch (IOException ex) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() throws ConnectorException {
|
||||
try {
|
||||
closeable.close();
|
||||
@@ -104,12 +86,13 @@ public class BeaconClient implements AutoCloseable {
|
||||
|
||||
json.set("messageType", new TextNode(prov.get().getId()));
|
||||
json.set("messagePhase", new TextNode("request"));
|
||||
//json.set("id", new TextNode(UUID.randomUUID().toString()));
|
||||
// json.set("id", new TextNode(UUID.randomUUID().toString()));
|
||||
var msg = JsonNodeFactory.instance.objectNode();
|
||||
msg.set("xPipeMessage", json);
|
||||
|
||||
if (BeaconConfig.printMessages()) {
|
||||
System.out.println("Sending request to server of type " + req.getClass().getName());
|
||||
System.out.println(
|
||||
"Sending request to server of type " + req.getClass().getName());
|
||||
}
|
||||
|
||||
var writer = new StringWriter();
|
||||
@@ -198,13 +181,13 @@ public class BeaconClient implements AutoCloseable {
|
||||
|
||||
var type = content.required("messageType").textValue();
|
||||
var phase = content.required("messagePhase").textValue();
|
||||
//var requestId = UUID.fromString(content.required("id").textValue());
|
||||
// var requestId = UUID.fromString(content.required("id").textValue());
|
||||
if (!phase.equals("response")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
content.remove("messageType");
|
||||
content.remove("messagePhase");
|
||||
//content.remove("id");
|
||||
// content.remove("id");
|
||||
|
||||
var prov = MessageExchanges.byId(type);
|
||||
if (prov.isEmpty()) {
|
||||
@@ -226,4 +209,22 @@ public class BeaconClient implements AutoCloseable {
|
||||
public OutputStream getRawOutputStream() {
|
||||
return out;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableBiConsumer<T, U, E extends Throwable> {
|
||||
|
||||
void accept(T var1, U var2) throws E;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableConsumer<T, E extends Throwable> {
|
||||
|
||||
void accept(T var1) throws E;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FailableRunnable<E extends Throwable> {
|
||||
|
||||
void run() throws E;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,14 @@ import java.nio.charset.StandardCharsets;
|
||||
public class BeaconConfig {
|
||||
|
||||
public static final byte[] BODY_SEPARATOR = "\n\n".getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
public static final String BEACON_PORT_PROP = "io.xpipe.beacon.port";
|
||||
public static final int DEFAULT_PORT = System.getProperty("os.name").startsWith("Windows") ? 21721 : 21722;
|
||||
private static final String PRINT_MESSAGES_PROPERTY = "io.xpipe.beacon.printMessages";
|
||||
private static final String LAUNCH_DAEMON_IN_DEBUG_PROP = "io.xpipe.beacon.launchDebugDaemon";
|
||||
private static final String ATTACH_DEBUGGER_PROP = "io.xpipe.beacon.attachDebuggerToDaemon";
|
||||
private static final String EXEC_DEBUG_PROP = "io.xpipe.beacon.printDaemonOutput";
|
||||
private static final String EXEC_PROCESS_PROP = "io.xpipe.beacon.customDaemonCommand";
|
||||
private static final String DAEMON_ARGUMENTS_PROP = "io.xpipe.beacon.daemonArgs";
|
||||
|
||||
public static boolean printMessages() {
|
||||
if (System.getProperty(PRINT_MESSAGES_PROPERTY) != null) {
|
||||
@@ -18,8 +24,6 @@ public class BeaconConfig {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final String LAUNCH_DAEMON_IN_DEBUG_PROP = "io.xpipe.beacon.launchDebugDaemon";
|
||||
|
||||
public static boolean launchDaemonInDebugMode() {
|
||||
if (System.getProperty(LAUNCH_DAEMON_IN_DEBUG_PROP) != null) {
|
||||
return Boolean.parseBoolean(System.getProperty(LAUNCH_DAEMON_IN_DEBUG_PROP));
|
||||
@@ -27,8 +31,6 @@ public class BeaconConfig {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final String ATTACH_DEBUGGER_PROP = "io.xpipe.beacon.attachDebuggerToDaemon";
|
||||
|
||||
public static boolean attachDebuggerToDaemon() {
|
||||
if (System.getProperty(ATTACH_DEBUGGER_PROP) != null) {
|
||||
return Boolean.parseBoolean(System.getProperty(ATTACH_DEBUGGER_PROP));
|
||||
@@ -36,10 +38,6 @@ public class BeaconConfig {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static final String EXEC_DEBUG_PROP = "io.xpipe.beacon.printDaemonOutput";
|
||||
|
||||
public static boolean printDaemonOutput() {
|
||||
if (System.getProperty(EXEC_DEBUG_PROP) != null) {
|
||||
return Boolean.parseBoolean(System.getProperty(EXEC_DEBUG_PROP));
|
||||
@@ -47,11 +45,6 @@ public class BeaconConfig {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final String BEACON_PORT_PROP = "io.xpipe.beacon.port";
|
||||
public static final int DEFAULT_PORT = System.getProperty("os.name").startsWith("Windows") ? 21721 : 21722;
|
||||
|
||||
public static int getUsedPort() {
|
||||
if (System.getProperty(BEACON_PORT_PROP) != null) {
|
||||
return Integer.parseInt(System.getProperty(BEACON_PORT_PROP));
|
||||
@@ -60,10 +53,6 @@ public class BeaconConfig {
|
||||
return DEFAULT_PORT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static final String EXEC_PROCESS_PROP = "io.xpipe.beacon.customDaemonCommand";
|
||||
|
||||
public static String getCustomDaemonCommand() {
|
||||
if (System.getProperty(EXEC_PROCESS_PROP) != null) {
|
||||
return System.getProperty(EXEC_PROCESS_PROP);
|
||||
@@ -72,8 +61,6 @@ public class BeaconConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String DAEMON_ARGUMENTS_PROP = "io.xpipe.beacon.daemonArgs";
|
||||
|
||||
public static String getDaemonArguments() {
|
||||
if (System.getProperty(DAEMON_ARGUMENTS_PROP) != null) {
|
||||
return System.getProperty(DAEMON_ARGUMENTS_PROP);
|
||||
@@ -82,5 +69,3 @@ public class BeaconConfig {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.io.OutputStream;
|
||||
|
||||
public abstract class BeaconConnection implements AutoCloseable {
|
||||
|
||||
|
||||
protected BeaconClient beaconClient;
|
||||
|
||||
private InputStream bodyInput;
|
||||
@@ -74,9 +73,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
}
|
||||
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputExchange(
|
||||
REQ req,
|
||||
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer
|
||||
) {
|
||||
REQ req, BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
|
||||
checkClosed();
|
||||
|
||||
performInputOutputExchange(req, null, responseConsumer);
|
||||
@@ -85,8 +82,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputOutputExchange(
|
||||
REQ req,
|
||||
BeaconClient.FailableConsumer<OutputStream, IOException> reqWriter,
|
||||
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer
|
||||
) {
|
||||
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
@@ -105,9 +101,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
public <REQ extends RequestMessage> void sendRequest(
|
||||
REQ req
|
||||
) {
|
||||
public <REQ extends RequestMessage> void sendRequest(REQ req) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
@@ -150,9 +144,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
}
|
||||
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> RES performOutputExchange(
|
||||
REQ req,
|
||||
BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter
|
||||
) {
|
||||
REQ req, BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
@@ -166,9 +158,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> RES performSimpleExchange(
|
||||
REQ req
|
||||
) {
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> RES performSimpleExchange(REQ req) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
@@ -192,7 +182,6 @@ public abstract class BeaconConnection implements AutoCloseable {
|
||||
return new BeaconException("A beacon connection error occurred", s.getCause());
|
||||
}
|
||||
|
||||
|
||||
return new BeaconException("An unexpected error occurred", exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
||||
*/
|
||||
public class BeaconException extends RuntimeException {
|
||||
|
||||
public BeaconException() {
|
||||
}
|
||||
public BeaconException() {}
|
||||
|
||||
public BeaconException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -34,9 +34,8 @@ public class BeaconServer {
|
||||
public static Process tryStartCustom() throws Exception {
|
||||
var custom = BeaconConfig.getCustomDaemonCommand();
|
||||
if (custom != null) {
|
||||
var command = custom + " " + (BeaconConfig.getDaemonArguments() != null ?
|
||||
BeaconConfig.getDaemonArguments() :
|
||||
"");
|
||||
var command =
|
||||
custom + " " + (BeaconConfig.getDaemonArguments() != null ? BeaconConfig.getDaemonArguments() : "");
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
printDaemonOutput(process, command);
|
||||
return process;
|
||||
@@ -47,9 +46,8 @@ public class BeaconServer {
|
||||
public static Process tryStart() throws Exception {
|
||||
var daemonExecutable = getDaemonExecutable();
|
||||
if (daemonExecutable.isPresent()) {
|
||||
var command = "\"" + daemonExecutable.get() + "\" --external " + (BeaconConfig.getDaemonArguments() != null ?
|
||||
BeaconConfig.getDaemonArguments() :
|
||||
"");
|
||||
var command = "\"" + daemonExecutable.get() + "\" --external "
|
||||
+ (BeaconConfig.getDaemonArguments() != null ? BeaconConfig.getDaemonArguments() : "");
|
||||
// Tell daemon that we launched from an external tool
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
printDaemonOutput(process, command);
|
||||
@@ -65,35 +63,43 @@ public class BeaconServer {
|
||||
System.out.println("Starting daemon: " + command);
|
||||
}
|
||||
|
||||
new Thread(null, () -> {
|
||||
try {
|
||||
InputStreamReader isr = new InputStreamReader(proc.getInputStream());
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (print) {
|
||||
System.out.println("[xpiped] " + line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}, "daemon sysout").start();
|
||||
new Thread(
|
||||
null,
|
||||
() -> {
|
||||
try {
|
||||
InputStreamReader isr = new InputStreamReader(proc.getInputStream());
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (print) {
|
||||
System.out.println("[xpiped] " + line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
},
|
||||
"daemon sysout")
|
||||
.start();
|
||||
|
||||
new Thread(null, () -> {
|
||||
try {
|
||||
InputStreamReader isr = new InputStreamReader(proc.getErrorStream());
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (print) {
|
||||
System.err.println("[xpiped] " + line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}, "daemon syserr").start();
|
||||
new Thread(
|
||||
null,
|
||||
() -> {
|
||||
try {
|
||||
InputStreamReader isr = new InputStreamReader(proc.getErrorStream());
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (print) {
|
||||
System.err.println("[xpiped] " + line);
|
||||
}
|
||||
}
|
||||
} catch (Exception ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
},
|
||||
"daemon syserr")
|
||||
.start();
|
||||
}
|
||||
|
||||
public static boolean tryStop(BeaconClient client) throws Exception {
|
||||
@@ -111,7 +117,6 @@ public class BeaconServer {
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
|
||||
if (base == null) {
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
base = Path.of(System.getenv("LOCALAPPDATA"), "X-Pipe");
|
||||
|
||||
@@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
||||
*/
|
||||
public class ClientException extends Exception {
|
||||
|
||||
public ClientException() {
|
||||
}
|
||||
public ClientException() {}
|
||||
|
||||
public ClientException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
||||
*/
|
||||
public class ConnectorException extends Exception {
|
||||
|
||||
public ConnectorException() {
|
||||
}
|
||||
public ConnectorException() {}
|
||||
|
||||
public ConnectorException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package io.xpipe.beacon;
|
||||
|
||||
public interface RequestMessage {
|
||||
|
||||
}
|
||||
public interface RequestMessage {}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package io.xpipe.beacon;
|
||||
|
||||
public interface ResponseMessage {
|
||||
|
||||
}
|
||||
public interface ResponseMessage {}
|
||||
|
||||
@@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
||||
*/
|
||||
public class ServerException extends Exception {
|
||||
|
||||
public ServerException() {
|
||||
}
|
||||
public ServerException() {}
|
||||
|
||||
public ServerException(String message) {
|
||||
super(message);
|
||||
|
||||
@@ -21,7 +21,9 @@ public class AddSourceExchange implements MessageExchange {
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
DataSourceId target;
|
||||
@NonNull DataSource<?> source;
|
||||
|
||||
@NonNull
|
||||
DataSource<?> source;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
|
||||
@@ -31,6 +31,5 @@ public class ForwardExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ public class MessageExchanges {
|
||||
private static void loadAll() {
|
||||
if (ALL == null) {
|
||||
ALL = ServiceLoader.load(MessageExchange.class).stream()
|
||||
.map(ServiceLoader.Provider::get).collect(Collectors.toSet());
|
||||
.map(ServiceLoader.Provider::get)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +27,16 @@ public class MessageExchanges {
|
||||
|
||||
public static <RQ extends RequestMessage> Optional<MessageExchange> byRequest(RQ req) {
|
||||
loadAll();
|
||||
return ALL.stream().filter(d -> d.getRequestClass().equals(req.getClass())).findAny();
|
||||
return ALL.stream()
|
||||
.filter(d -> d.getRequestClass().equals(req.getClass()))
|
||||
.findAny();
|
||||
}
|
||||
|
||||
public static <RP extends ResponseMessage> Optional<MessageExchange> byResponse(RP rep) {
|
||||
loadAll();
|
||||
return ALL.stream().filter(d -> d.getResponseClass().equals(rep.getClass())).findAny();
|
||||
return ALL.stream()
|
||||
.filter(d -> d.getResponseClass().equals(rep.getClass()))
|
||||
.findAny();
|
||||
}
|
||||
|
||||
public static Set<MessageExchange> getAll() {
|
||||
|
||||
@@ -37,14 +37,18 @@ public class QueryDataSourceExchange implements MessageExchange {
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull
|
||||
DataSourceId id;
|
||||
|
||||
boolean disabled;
|
||||
boolean hidden;
|
||||
|
||||
@NonNull
|
||||
DataSourceInfo info;
|
||||
|
||||
@NonNull
|
||||
String storeDisplay;
|
||||
|
||||
String provider;
|
||||
|
||||
@NonNull
|
||||
Map<String, String> config;
|
||||
|
||||
|
||||
@@ -32,6 +32,5 @@ public class ReadExecuteExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ public class StopExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -20,8 +20,7 @@ public class StoreStreamExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.api;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -29,6 +29,5 @@ public class QueryRawDataExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.api;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -32,6 +32,5 @@ public class QueryTableDataExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.api;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -30,6 +30,5 @@ public class QueryTextDataExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.dialog.DialogReference;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.dialog.DialogElement;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -34,6 +34,7 @@ public class DialogExchange implements MessageExchange {
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull
|
||||
UUID dialogKey;
|
||||
|
||||
String value;
|
||||
boolean cancel;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class EditStoreExchange implements MessageExchange {
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull DialogReference dialog;
|
||||
@NonNull
|
||||
DialogReference dialog;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ public class InstanceExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.CollectionListEntry;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.CollectionListEntry;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
@@ -20,9 +20,7 @@ public class ListCollectionsExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.EntryListEntry;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.EntryListEntry;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.StoreListEntry;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.StoreListEntry;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
@@ -20,9 +20,7 @@ public class ListStoresExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
@@ -26,7 +26,5 @@ public class ModeExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
@@ -26,6 +26,5 @@ public class RemoveCollectionExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
@@ -28,6 +28,5 @@ public class RemoveStoreExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
@@ -21,6 +21,7 @@ public class RenameCollectionExchange implements MessageExchange {
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull
|
||||
String collectionName;
|
||||
|
||||
@NonNull
|
||||
String newName;
|
||||
}
|
||||
@@ -28,6 +29,5 @@ public class RenameCollectionExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
@@ -32,6 +32,7 @@ public class RenameEntryExchange implements MessageExchange {
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull DataSourceId newId;
|
||||
@NonNull
|
||||
DataSourceId newId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
@@ -21,6 +21,7 @@ public class RenameStoreExchange implements MessageExchange {
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull
|
||||
String storeName;
|
||||
|
||||
@NonNull
|
||||
String newName;
|
||||
}
|
||||
@@ -28,6 +29,5 @@ public class RenameStoreExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -27,6 +27,5 @@ public class SelectExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.ProviderEntry;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.exchange.data.ProviderEntry;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -23,13 +23,13 @@ public class SourceProviderListExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull Map<DataSourceType, List<ProviderEntry>> entries;
|
||||
@NonNull
|
||||
Map<DataSourceType, List<ProviderEntry>> entries;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
@@ -17,8 +17,7 @@ public class StatusExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.dialog.DialogReference;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import lombok.Builder;
|
||||
|
||||
@@ -21,13 +21,13 @@ public class StoreProviderListExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull List<ProviderEntry> entries;
|
||||
@NonNull
|
||||
List<ProviderEntry> entries;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
@@ -17,9 +17,7 @@ public class VersionExchange implements MessageExchange {
|
||||
@lombok.extern.jackson.Jacksonized
|
||||
@lombok.Builder
|
||||
@lombok.Value
|
||||
public static class Request implements RequestMessage {
|
||||
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.exchange.cli;
|
||||
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.beacon.RequestMessage;
|
||||
import io.xpipe.beacon.ResponseMessage;
|
||||
import io.xpipe.beacon.exchange.MessageExchange;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
@@ -35,6 +35,5 @@ public class WriteExecuteExchange implements MessageExchange {
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,10 @@ public class WritePreparationExchange implements MessageExchange {
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
String type;
|
||||
|
||||
@NonNull
|
||||
DataStore output;
|
||||
|
||||
@NonNull
|
||||
DataSourceReference source;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import io.xpipe.beacon.exchange.*;
|
||||
import io.xpipe.beacon.exchange.api.*;
|
||||
import io.xpipe.beacon.exchange.api.QueryRawDataExchange;
|
||||
import io.xpipe.beacon.exchange.api.QueryTableDataExchange;
|
||||
import io.xpipe.beacon.exchange.api.QueryTextDataExchange;
|
||||
import io.xpipe.beacon.exchange.cli.*;
|
||||
|
||||
module io.xpipe.beacon {
|
||||
@@ -21,6 +23,7 @@ module io.xpipe.beacon {
|
||||
requires static lombok;
|
||||
|
||||
uses MessageExchange;
|
||||
|
||||
provides io.xpipe.beacon.exchange.MessageExchange with
|
||||
ForwardExchange,
|
||||
InstanceExchange,
|
||||
@@ -55,4 +58,4 @@ module io.xpipe.beacon {
|
||||
QueryRawDataExchange,
|
||||
QueryTableDataExchange,
|
||||
VersionExchange;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user