diff --git a/api/src/main/java/io/xpipe/api/DataSource.java b/api/src/main/java/io/xpipe/api/DataSource.java
index 4ba59595..2277d325 100644
--- a/api/src/main/java/io/xpipe/api/DataSource.java
+++ b/api/src/main/java/io/xpipe/api/DataSource.java
@@ -15,10 +15,10 @@ import java.nio.file.Path;
/**
* Represents a reference to a data source that is managed by X-Pipe.
- *
+ *
* The actual data is only queried when required and is not cached.
* Therefore, the queried data is always up-to-date at the point of calling a method that queries the data.
- *
+ *
* As soon a data source reference is created, the data source is locked
* within X-Pipe to prevent concurrent modification and the problems that can arise from it.
* By default, the lock is held until the calling program terminates and prevents
@@ -29,14 +29,14 @@ public interface DataSource {
/**
* NOT YET IMPLEMENTED!
- *
+ *
* Creates a new supplier data source that will be interpreted as the generated data source.
* In case this program should be a data source generator, this method has to be called at
* least once to register that it actually generates a data source.
- *
+ *
* All content that is written to this data source until the generator program terminates is
* will be available later on when the data source is used as a supplier later on.
- *
+ *
* In case this method is called multiple times, the same data source is returned.
*
* @return the generator data source
@@ -132,9 +132,9 @@ public interface DataSource {
/**
* Creates a new data source from an input stream.
*
- * @param id the data source id
+ * @param id the data source id
* @param type the data source type
- * @param in the input stream to read
+ * @param in the input stream to read
* @return a {@link DataSource} instances that can be used to access the underlying data
*/
public static DataSource create(DataSourceId id, String type, InputStream in) {
@@ -153,10 +153,11 @@ public interface DataSource {
/**
* Creates a new data source from an input stream.
- *1
- * @param id the data source id
+ * 1
+ *
+ * @param id the data source id
* @param type the data source type
- * @param in the data store to add
+ * @param in the data store to add
* @return a {@link DataSource} instances that can be used to access the underlying data
*/
public static DataSource create(DataSourceId id, String type, DataStore in) {
diff --git a/api/src/main/java/io/xpipe/api/DataStores.java b/api/src/main/java/io/xpipe/api/DataStores.java
index 68feb5a5..17564584 100644
--- a/api/src/main/java/io/xpipe/api/DataStores.java
+++ b/api/src/main/java/io/xpipe/api/DataStores.java
@@ -1,8 +1,8 @@
package io.xpipe.api;
import io.xpipe.api.connector.XPipeApiConnection;
-import io.xpipe.beacon.util.QuietDialogHandler;
import io.xpipe.beacon.exchange.cli.StoreAddExchange;
+import io.xpipe.beacon.util.QuietDialogHandler;
import io.xpipe.core.store.DataStore;
import java.util.Map;
diff --git a/api/src/main/java/io/xpipe/api/DataTableAccumulator.java b/api/src/main/java/io/xpipe/api/DataTableAccumulator.java
index 6c02a2af..e8808117 100644
--- a/api/src/main/java/io/xpipe/api/DataTableAccumulator.java
+++ b/api/src/main/java/io/xpipe/api/DataTableAccumulator.java
@@ -8,7 +8,7 @@ import io.xpipe.core.source.DataSourceId;
/**
* An accumulator for table data.
- *
+ *
* This class can be used to construct new table data sources by
* accumulating the rows using {@link #add(DataStructureNode)} or {@link #acceptor()} and then calling
* {@link #finish(DataSourceId)} to complete the construction process and create a new data source.
diff --git a/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java b/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java
index 88c7e065..de6d332d 100644
--- a/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java
+++ b/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java
@@ -12,7 +12,8 @@ import java.util.Optional;
public final class XPipeApiConnection extends BeaconConnection {
- private XPipeApiConnection() {}
+ private XPipeApiConnection() {
+ }
public static XPipeApiConnection open() {
var con = new XPipeApiConnection();
@@ -30,8 +31,8 @@ public final class XPipeApiConnection extends BeaconConnection {
}
DialogExchange.Response response = con.performSimpleExchange(DialogExchange.Request.builder()
- .dialogKey(reference.getDialogId())
- .build());
+ .dialogKey(reference.getDialogId())
+ .build());
element = response.getElement();
if (response.getElement() == null) {
break;
@@ -78,9 +79,9 @@ public final class XPipeApiConnection extends BeaconConnection {
}
var s = BeaconClient.tryConnect(BeaconClient.ApiClientInformation.builder()
- .version("?")
- .language("Java")
- .build());
+ .version("?")
+ .language("Java")
+ .build());
if (s.isPresent()) {
return s;
}
@@ -122,9 +123,9 @@ public final class XPipeApiConnection extends BeaconConnection {
try {
beaconClient = BeaconClient.connect(BeaconClient.ApiClientInformation.builder()
- .version("?")
- .language("Java")
- .build());
+ .version("?")
+ .language("Java")
+ .build());
} catch (Exception ex) {
throw new BeaconException("Unable to connect to running xpipe daemon", ex);
}
diff --git a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java b/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java
index c5883901..6d731829 100644
--- a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java
+++ b/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java
@@ -12,7 +12,8 @@ public class DataRawImpl extends DataSourceImpl implements DataRaw {
public DataRawImpl(
DataSourceId sourceId,
DataSourceConfig sourceConfig,
- io.xpipe.core.source.DataSource> internalSource) {
+ io.xpipe.core.source.DataSource> internalSource
+ ) {
super(sourceId, sourceConfig, internalSource);
}
diff --git a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java
index 4d3b904b..aac6eb32 100644
--- a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java
+++ b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java
@@ -18,7 +18,8 @@ public abstract class DataSourceImpl implements DataSource {
private final io.xpipe.core.source.DataSource> internalSource;
public DataSourceImpl(
- DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource> internalSource) {
+ DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource> internalSource
+ ) {
this.sourceId = sourceId;
this.config = config;
this.internalSource = internalSource;
diff --git a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java b/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java
index 1ffc8902..2f692179 100644
--- a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java
+++ b/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java
@@ -11,7 +11,8 @@ public class DataStructureImpl extends DataSourceImpl implements DataStructure {
DataStructureImpl(
DataSourceId sourceId,
DataSourceConfig sourceConfig,
- io.xpipe.core.source.DataSource> internalSource) {
+ io.xpipe.core.source.DataSource> internalSource
+ ) {
super(sourceId, sourceConfig, internalSource);
}
diff --git a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java
index 4b68c2df..536b7b35 100644
--- a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java
+++ b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java
@@ -27,7 +27,8 @@ public class DataTableImpl extends DataSourceImpl implements DataTable {
DataTableImpl(
DataSourceId id,
DataSourceConfig sourceConfig,
- io.xpipe.core.source.DataSource> internalSource) {
+ io.xpipe.core.source.DataSource> internalSource
+ ) {
super(id, sourceConfig, internalSource);
}
@@ -73,6 +74,7 @@ public class DataTableImpl extends DataSourceImpl implements DataTable {
public Iterator iterator() {
return new TableIterator();
}
+
;
private class TableIterator implements Iterator {
diff --git a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java
index f4a2fbff..17a8b22c 100644
--- a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java
+++ b/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java
@@ -24,10 +24,11 @@ import java.util.stream.StreamSupport;
public class DataTextImpl extends DataSourceImpl implements DataText {
- DataTextImpl(
+ DataTextImpl(
DataSourceId sourceId,
DataSourceConfig sourceConfig,
- io.xpipe.core.source.DataSource> internalSource) {
+ io.xpipe.core.source.DataSource> internalSource
+ ) {
super(sourceId, sourceConfig, internalSource);
}
diff --git a/api/src/test/java/io/xpipe/api/test/DataTableAccumulatorTest.java b/api/src/test/java/io/xpipe/api/test/DataTableAccumulatorTest.java
index 67a863e0..98553916 100644
--- a/api/src/test/java/io/xpipe/api/test/DataTableAccumulatorTest.java
+++ b/api/src/test/java/io/xpipe/api/test/DataTableAccumulatorTest.java
@@ -5,11 +5,9 @@ import io.xpipe.core.data.node.TupleNode;
import io.xpipe.core.data.node.ValueNode;
import io.xpipe.core.data.type.TupleType;
import io.xpipe.core.data.type.ValueType;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.List;
-import java.util.OptionalInt;
public class DataTableAccumulatorTest extends ApiTest {
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java
index ecd5df76..0216e45d 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java
@@ -33,78 +33,8 @@ import static io.xpipe.beacon.BeaconConfig.BODY_SEPARATOR;
public class BeaconClient implements AutoCloseable {
- @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
- public abstract static class ClientInformation {
-
- public final CliClientInformation cli() {
- return (CliClientInformation) this;
- }
-
- public abstract String toDisplayString();
- }
-
- @JsonTypeName("cli")
- @Value
- @Builder
- @Jacksonized
- @EqualsAndHashCode(callSuper = false)
- public static class CliClientInformation extends ClientInformation {
-
- int consoleWidth;
-
- @Override
- public String toDisplayString() {
- return "X-Pipe CLI";
- }
- }
-
- @JsonTypeName("reachableCheck")
- @Value
- @Builder
- @Jacksonized
- @EqualsAndHashCode(callSuper = false)
- public static class ReachableCheckInformation extends ClientInformation {
-
- @Override
- public String toDisplayString() {
- return "Reachable check";
- }
- }
-
- @JsonTypeName("gateway")
- @Value
- @Builder
- @Jacksonized
- @EqualsAndHashCode(callSuper = false)
- public static class GatewayClientInformation extends ClientInformation {
-
- String version;
-
- @Override
- public String toDisplayString() {
- return "X-Pipe Gateway " + version;
- }
- }
-
- @JsonTypeName("api")
- @Value
- @Builder
- @Jacksonized
- @EqualsAndHashCode(callSuper = false)
- public static class ApiClientInformation extends ClientInformation {
-
- String version;
- String language;
-
- @Override
- public String toDisplayString() {
- return String.format("X-Pipe %s API v%s", language, version);
- }
- }
-
@Getter
private final Closeable base;
-
private final InputStream in;
private final OutputStream out;
@@ -130,15 +60,15 @@ public class BeaconClient implements AutoCloseable {
command.discardErr();
return new BeaconClient(command, command.getStdout(), command.getStdin()) {
-// {
-// new Thread(() -> {
-// while (true) {
-// if (!control.isRunning()) {
-// close();
-// }
-// }
-// })
-// }
+ // {
+ // new Thread(() -> {
+ // while (true) {
+ // if (!control.isRunning()) {
+ // close();
+ // }
+ // }
+ // })
+ // }
@Override
public T receiveResponse()
@@ -365,4 +295,76 @@ public class BeaconClient implements AutoCloseable {
void run() throws E;
}
+
+ @JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+ )
+ public abstract static class ClientInformation {
+
+ public final CliClientInformation cli() {
+ return (CliClientInformation) this;
+ }
+
+ public abstract String toDisplayString();
+ }
+
+ @JsonTypeName("cli")
+ @Value
+ @Builder
+ @Jacksonized
+ @EqualsAndHashCode(callSuper = false)
+ public static class CliClientInformation extends ClientInformation {
+
+ int consoleWidth;
+
+ @Override
+ public String toDisplayString() {
+ return "X-Pipe CLI";
+ }
+ }
+
+ @JsonTypeName("reachableCheck")
+ @Value
+ @Builder
+ @Jacksonized
+ @EqualsAndHashCode(callSuper = false)
+ public static class ReachableCheckInformation extends ClientInformation {
+
+ @Override
+ public String toDisplayString() {
+ return "Reachable check";
+ }
+ }
+
+ @JsonTypeName("gateway")
+ @Value
+ @Builder
+ @Jacksonized
+ @EqualsAndHashCode(callSuper = false)
+ public static class GatewayClientInformation extends ClientInformation {
+
+ String version;
+
+ @Override
+ public String toDisplayString() {
+ return "X-Pipe Gateway " + version;
+ }
+ }
+
+ @JsonTypeName("api")
+ @Value
+ @Builder
+ @Jacksonized
+ @EqualsAndHashCode(callSuper = false)
+ public static class ApiClientInformation extends ClientInformation {
+
+ String version;
+ String language;
+
+ @Override
+ public String toDisplayString() {
+ return String.format("X-Pipe %s API v%s", language, version);
+ }
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java
index c1672908..aa13b546 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java
@@ -78,7 +78,8 @@ public abstract class BeaconConnection implements AutoCloseable {
}
public void performInputExchange(
- REQ req, BeaconClient.FailableBiConsumer responseConsumer) {
+ REQ req, BeaconClient.FailableBiConsumer responseConsumer
+ ) {
checkClosed();
performInputOutputExchange(req, null, responseConsumer);
@@ -87,7 +88,8 @@ public abstract class BeaconConnection implements AutoCloseable {
public void performInputOutputExchange(
REQ req,
BeaconClient.FailableConsumer reqWriter,
- BeaconClient.FailableBiConsumer responseConsumer) {
+ BeaconClient.FailableBiConsumer responseConsumer
+ ) {
checkClosed();
try {
@@ -149,7 +151,8 @@ public abstract class BeaconConnection implements AutoCloseable {
}
public RES performOutputExchange(
- REQ req, BeaconClient.FailableConsumer reqWriter) {
+ REQ req, BeaconClient.FailableConsumer reqWriter
+ ) {
checkClosed();
try {
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java b/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java
index 1dae5afb..248769ca 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java
@@ -72,7 +72,7 @@ public class BeaconDaemonController {
throw new IOException("Wait for daemon start up timed out");
}
- private static void waitForShutdown() {
+ private static void waitForShutdown() {
for (int i = 0; i < 40; i++) {
try {
Thread.sleep(500);
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconException.java b/beacon/src/main/java/io/xpipe/beacon/BeaconException.java
index 5c4bd3b6..66d0980b 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconException.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconException.java
@@ -5,7 +5,8 @@ package io.xpipe.beacon;
*/
public class BeaconException extends RuntimeException {
- public BeaconException() {}
+ public BeaconException() {
+ }
public BeaconException(String message) {
super(message);
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java b/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java
index ff2150c0..313a5aa9 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java
@@ -10,6 +10,7 @@ public class BeaconJacksonModule extends SimpleModule {
context.registerSubtypes(
new NamedType(BeaconClient.ApiClientInformation.class),
new NamedType(BeaconClient.CliClientInformation.class),
- new NamedType(BeaconClient.ReachableCheckInformation.class));
+ new NamedType(BeaconClient.ReachableCheckInformation.class)
+ );
}
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java b/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java
index 7f88aca4..c7c5a75a 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java
@@ -81,8 +81,8 @@ public class BeaconProxyImpl extends ProxyProvider {
try {
client = BeaconClient.connectProxy(proxy);
client.sendRequest(ProxyReadConnectionExchange.Request.builder()
- .source(downstream)
- .build());
+ .source(downstream)
+ .build());
client.receiveResponse();
BeaconClient finalClient = client;
var inputStream = new FilterInputStream(finalClient.receiveBody()) {
@@ -96,22 +96,24 @@ public class BeaconProxyImpl extends ProxyProvider {
var inputSource = DataSource.createInternalDataSource(source.getType(), new InputStreamStore(inputStream));
return (T) inputSource.openReadConnection();
} catch (Exception ex) {
- if (client != null) client.close();
+ if (client != null) {
+ client.close();
+ }
throw ex;
}
}
@Override
@SuppressWarnings("unchecked")
- public T createRemoteWriteConnection(DataSource> source, WriteMode mode, ShellStore proxy) throws Exception {
+ public T createRemoteWriteConnection(DataSource> source, WriteMode mode, ShellStore proxy) throws Exception {
var downstream = downstreamTransform(source, proxy);
BeaconClient client = null;
try {
client = BeaconClient.connectProxy(proxy);
client.sendRequest(ProxyWriteConnectionExchange.Request.builder()
- .source(downstream)
- .build());
+ .source(downstream)
+ .build());
BeaconClient finalClient = client;
var outputStream = new FilterOutputStream(client.sendBody()) {
@Override
@@ -125,7 +127,9 @@ public class BeaconProxyImpl extends ProxyProvider {
var outputSource = DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream));
return (T) outputSource.openWriteConnection(mode);
} catch (Exception ex) {
- if (client != null) client.close();
+ if (client != null) {
+ client.close();
+ }
throw ex;
}
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java
index 24df5320..b7625712 100644
--- a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java
+++ b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java
@@ -30,9 +30,9 @@ public class BeaconServer {
if (custom != null) {
var command = ShellTypes.getPlatformDefault()
.executeCommandListWithShell(custom
- + (BeaconConfig.getDaemonArguments() != null
- ? " " + BeaconConfig.getDaemonArguments()
- : ""));
+ + (BeaconConfig.getDaemonArguments() != null
+ ? " " + BeaconConfig.getDaemonArguments()
+ : ""));
Process process = Runtime.getRuntime().exec(command.toArray(String[]::new));
printDaemonOutput(process, command);
return process;
@@ -77,7 +77,8 @@ public class BeaconServer {
ioe.printStackTrace();
}
},
- "daemon sysout");
+ "daemon sysout"
+ );
out.setDaemon(true);
out.start();
@@ -97,7 +98,8 @@ public class BeaconServer {
ioe.printStackTrace();
}
},
- "daemon syserr");
+ "daemon syserr"
+ );
err.setDaemon(true);
err.start();
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/ClientException.java b/beacon/src/main/java/io/xpipe/beacon/ClientException.java
index 784d9b64..74f4364a 100644
--- a/beacon/src/main/java/io/xpipe/beacon/ClientException.java
+++ b/beacon/src/main/java/io/xpipe/beacon/ClientException.java
@@ -5,7 +5,8 @@ package io.xpipe.beacon;
*/
public class ClientException extends Exception {
- public ClientException() {}
+ public ClientException() {
+ }
public ClientException(String message) {
super(message);
diff --git a/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java b/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java
index 83a14dbc..8f5841f5 100644
--- a/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java
+++ b/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java
@@ -5,7 +5,8 @@ package io.xpipe.beacon;
*/
public class ConnectorException extends Exception {
- public ConnectorException() {}
+ public ConnectorException() {
+ }
public ConnectorException(String message) {
super(message);
diff --git a/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java b/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java
index 9f9a5c2d..d8b65c3b 100644
--- a/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java
+++ b/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java
@@ -1,3 +1,4 @@
package io.xpipe.beacon;
-public interface RequestMessage {}
+public interface RequestMessage {
+}
diff --git a/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java b/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java
index ec167994..859fe14d 100644
--- a/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java
+++ b/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java
@@ -1,3 +1,4 @@
package io.xpipe.beacon;
-public interface ResponseMessage {}
+public interface ResponseMessage {
+}
diff --git a/beacon/src/main/java/io/xpipe/beacon/ServerException.java b/beacon/src/main/java/io/xpipe/beacon/ServerException.java
index d25c2272..470f4120 100644
--- a/beacon/src/main/java/io/xpipe/beacon/ServerException.java
+++ b/beacon/src/main/java/io/xpipe/beacon/ServerException.java
@@ -5,7 +5,8 @@ package io.xpipe.beacon;
*/
public class ServerException extends Exception {
- public ServerException() {}
+ public ServerException() {
+ }
public ServerException(String message) {
super(message);
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java
index a8c7eba7..971d92ac 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java
@@ -31,5 +31,6 @@ public class ForwardExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java
index 3d708e56..32d6e65a 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java
@@ -2,9 +2,9 @@ package io.xpipe.beacon.exchange;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import io.xpipe.core.util.ProxyFunction;
import io.xpipe.beacon.RequestMessage;
import io.xpipe.beacon.ResponseMessage;
+import io.xpipe.core.util.ProxyFunction;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
@@ -21,8 +21,14 @@ public class ProxyFunctionExchange implements MessageExchange {
@Value
public static class Request implements RequestMessage {
- @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class)
- @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class)
+ @JsonSerialize(
+ using = ProxyFunction.Serializer.class,
+ as = ProxyFunction.class
+ )
+ @JsonDeserialize(
+ using = ProxyFunction.Deserializer.class,
+ as = ProxyFunction.class
+ )
ProxyFunction function;
}
@@ -31,8 +37,14 @@ public class ProxyFunctionExchange implements MessageExchange {
@Value
public static class Response implements ResponseMessage {
- @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class)
- @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class)
+ @JsonSerialize(
+ using = ProxyFunction.Serializer.class,
+ as = ProxyFunction.class
+ )
+ @JsonDeserialize(
+ using = ProxyFunction.Deserializer.class,
+ as = ProxyFunction.class
+ )
ProxyFunction function;
}
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java
index bb749814..116b27be 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java
@@ -19,7 +19,8 @@ public class StopExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java
index 73cfa543..92bd9dd8 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java
@@ -29,5 +29,6 @@ public class QueryRawDataExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java
index 0eb5acee..fe5616c0 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java
@@ -30,5 +30,6 @@ public class QueryTextDataExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java
index 9f080bb8..f00299aa 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java
@@ -19,7 +19,8 @@ public class InstanceExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java
index b010c53b..e0a85698 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java
@@ -20,7 +20,8 @@ public class ListCollectionsExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java
index da6a507e..62846f1b 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java
@@ -20,7 +20,8 @@ public class ListStoresExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ModeExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ModeExchange.java
index a2806a80..ca884278 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ModeExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ModeExchange.java
@@ -26,5 +26,6 @@ public class ModeExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java
index 939baf2a..89f7179c 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java
@@ -30,5 +30,6 @@ public class ReadDrainExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java
index 357c2457..ba0dc7fc 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java
@@ -26,5 +26,6 @@ public class RemoveCollectionExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java
index 95dd9732..caccde8b 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java
@@ -26,5 +26,6 @@ public class RemoveStoreExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java
index 192fcc34..82ae32bb 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java
@@ -29,5 +29,6 @@ public class RenameCollectionExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java
index 0a271212..cf8eddb2 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java
@@ -29,5 +29,6 @@ public class RenameStoreExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java
index 7c0017df..eaf1f3ab 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java
@@ -27,5 +27,6 @@ public class SelectExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Response implements ResponseMessage {}
+ public static class Response implements ResponseMessage {
+ }
}
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java
index f0b272f6..3a3e5f04 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java
@@ -23,7 +23,8 @@ public class SourceProviderListExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java
index 255a2570..2de24b6e 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java
@@ -17,7 +17,8 @@ public class StatusExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java
index ee5511dd..88850ac4 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java
@@ -22,7 +22,8 @@ public class StoreProviderListExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
- public static class Request implements RequestMessage {}
+ public static class Request implements RequestMessage {
+ }
@Jacksonized
@Builder
diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java
index 41a9c050..58ce8189 100644
--- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java
+++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java
@@ -17,7 +17,8 @@ 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
diff --git a/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java b/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java
index 33838c75..2fce1525 100644
--- a/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java
+++ b/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java
@@ -13,15 +13,10 @@ import java.util.UUID;
public class QuietDialogHandler {
- public static void handle(DialogReference ref, BeaconConnection connection) {
- new QuietDialogHandler(ref, connection, Map.of()).handle();
- }
-
private final UUID dialogKey;
private final BeaconConnection connection;
private final Map overrides;
private DialogElement element;
-
public QuietDialogHandler(DialogReference ref, BeaconConnection connection, Map overrides) {
this.dialogKey = ref.getDialogId();
this.element = ref.getStart();
@@ -29,6 +24,10 @@ public class QuietDialogHandler {
this.overrides = overrides;
}
+ public static void handle(DialogReference ref, BeaconConnection connection) {
+ new QuietDialogHandler(ref, connection, Map.of()).handle();
+ }
+
public void handle() {
String response = null;
@@ -41,9 +40,9 @@ public class QuietDialogHandler {
}
DialogExchange.Response res = connection.performSimpleExchange(DialogExchange.Request.builder()
- .dialogKey(dialogKey)
- .value(response)
- .build());
+ .dialogKey(dialogKey)
+ .value(response)
+ .build());
if (res.getElement() != null && element.equals(res.getElement())) {
throw new BeaconException(
"Invalid value for key " + res.getElement().toDisplayString());
diff --git a/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java b/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java
index bd2d40f4..87ad202a 100644
--- a/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java
+++ b/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java
@@ -23,7 +23,8 @@ public abstract class Charsetter {
public static Charsetter INSTANCE;
private static CharsetterUniverse universe;
- protected Charsetter() {}
+ protected Charsetter() {
+ }
protected static void checkInit() {
if (universe == null) {
@@ -77,7 +78,8 @@ public abstract class Charsetter {
}
public abstract Result read(
- FailableSupplier in, FailableConsumer con)
+ FailableSupplier in, FailableConsumer con
+ )
throws Exception;
public Result detect(StreamDataStore store) throws Exception {
diff --git a/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java b/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java
index f31a250a..e0182e42 100644
--- a/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java
+++ b/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java
@@ -20,8 +20,13 @@ public class StreamCharset {
public static final StreamCharset UTF8_BOM = new StreamCharset(
StandardCharsets.UTF_8,
- new byte[] {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF},
- Identifiers.get("utf", "8", "bom"));
+ new byte[]{
+ (byte) 0xEF,
+ (byte) 0xBB,
+ (byte) 0xBF
+ },
+ Identifiers.get("utf", "8", "bom")
+ );
// ======
// UTF-16
@@ -32,16 +37,24 @@ public class StreamCharset {
public static final StreamCharset UTF16_BE_BOM = new StreamCharset(
StandardCharsets.UTF_16BE,
- new byte[] {(byte) 0xFE, (byte) 0xFF},
- Identifiers.get("utf", "16", "be", "bom"));
+ new byte[]{
+ (byte) 0xFE,
+ (byte) 0xFF
+ },
+ Identifiers.get("utf", "16", "be", "bom")
+ );
public static final StreamCharset UTF16_LE =
new StreamCharset(StandardCharsets.UTF_16LE, null, Identifiers.get("utf", "16", "le"));
public static final StreamCharset UTF16_LE_BOM = new StreamCharset(
StandardCharsets.UTF_16LE,
- new byte[] {(byte) 0xFF, (byte) 0xFE},
- Identifiers.get("utf", "16", "le", "bom"));
+ new byte[]{
+ (byte) 0xFF,
+ (byte) 0xFE
+ },
+ Identifiers.get("utf", "16", "le", "bom")
+ );
public static final StreamCharset UTF16 =
new StreamCharset(StandardCharsets.UTF_16, null, Identifiers.get("utf", "16"));
@@ -51,30 +64,12 @@ public class StreamCharset {
ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)
? UTF16_BE_BOM.getByteOrderMark()
: UTF16_LE_BOM.getByteOrderMark(),
- Identifiers.get("utf", "16", "bom"));
+ Identifiers.get("utf", "16", "bom")
+ );
// ======
// UTF-32
// ======
-
- public static final StreamCharset UTF32_LE =
- new StreamCharset(Charset.forName("utf-32le"), null, Identifiers.get("utf", "32", "le"));
-
- public static final StreamCharset UTF32_LE_BOM = new StreamCharset(
- Charset.forName("utf-32le"),
- new byte[] {0x00, 0x00, (byte) 0xFE, (byte) 0xFF},
- Identifiers.get("utf", "32", "le", "bom"));
-
- public static final StreamCharset UTF32_BE =
- new StreamCharset(Charset.forName("utf-32be"), null, Identifiers.get("utf", "32", "be"));
-
- public static final StreamCharset UTF32_BE_BOM = new StreamCharset(
- Charset.forName("utf-32be"),
- new byte[] {
- (byte) 0xFF, (byte) 0xFE, 0x00, 0x00,
- },
- Identifiers.get("utf", "32", "be", "bom"));
-
public static final List COMMON = List.of(
UTF8,
UTF8_BOM,
@@ -83,7 +78,8 @@ public class StreamCharset {
new StreamCharset(
StandardCharsets.US_ASCII,
null,
- Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii"))),
+ Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii"))
+ ),
new StreamCharset(
StandardCharsets.ISO_8859_1,
null,
@@ -91,16 +87,44 @@ public class StreamCharset {
Identifiers.get("iso", "8859"),
Identifiers.get("iso", "8859", "1"),
Identifiers.get("8859"),
- Identifiers.get("8859", "1"))),
+ Identifiers.get("8859", "1")
+ )
+ ),
new StreamCharset(
Charset.forName("Windows-1251"),
null,
- Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251"))),
+ Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251"))
+ ),
new StreamCharset(
Charset.forName("Windows-1252"),
null,
- Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252"))));
-
+ Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252"))
+ )
+ );
+ public static final StreamCharset UTF32_LE =
+ new StreamCharset(Charset.forName("utf-32le"), null, Identifiers.get("utf", "32", "le"));
+ public static final StreamCharset UTF32_LE_BOM = new StreamCharset(
+ Charset.forName("utf-32le"),
+ new byte[]{
+ 0x00,
+ 0x00,
+ (byte) 0xFE,
+ (byte) 0xFF
+ },
+ Identifiers.get("utf", "32", "le", "bom")
+ );
+ public static final StreamCharset UTF32_BE =
+ new StreamCharset(Charset.forName("utf-32be"), null, Identifiers.get("utf", "32", "be"));
+ public static final StreamCharset UTF32_BE_BOM = new StreamCharset(
+ Charset.forName("utf-32be"),
+ new byte[]{
+ (byte) 0xFF,
+ (byte) 0xFE,
+ 0x00,
+ 0x00,
+ },
+ Identifiers.get("utf", "32", "be", "bom")
+ );
private static final List RARE_NAMED =
List.of(UTF16_LE, UTF16_LE_BOM, UTF16_BE, UTF16_BE_BOM, UTF32_LE, UTF32_LE_BOM, UTF32_BE, UTF32_BE_BOM);
@@ -113,23 +137,41 @@ public class StreamCharset {
&& !charset.displayName().startsWith("X-")
&& !charset.displayName().endsWith("-BOM")
&& COMMON.stream()
- .noneMatch(c -> c.getCharset().equals(charset))
+ .noneMatch(c -> c.getCharset().equals(charset))
&& RARE_NAMED.stream()
- .noneMatch(c -> c.getCharset().equals(charset)))
+ .noneMatch(c -> c.getCharset().equals(charset)))
.map(charset -> new StreamCharset(
charset,
null,
- Identifiers.get(charset.name().split("-")))))
+ Identifiers.get(charset.name().split("-"))
+ ))
+ )
.toList();
public static final List ALL = Stream.concat(COMMON.stream(), RARE.stream()).toList();
-
Charset charset;
byte[] byteOrderMark;
List names;
+ public static StreamCharset get(Charset charset, boolean byteOrderMark) {
+ return ALL.stream()
+ .filter(streamCharset ->
+ streamCharset.getCharset().equals(charset) && streamCharset.hasByteOrderMark() == byteOrderMark)
+ .findFirst()
+ .orElseThrow();
+ }
+
+ public static StreamCharset get(String s) {
+ var found = ALL.stream().filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))).findFirst();
+ if (found.isEmpty()) {
+ throw new IllegalArgumentException("Unknown charset name: " + s);
+ }
+
+ return found.get();
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -148,23 +190,6 @@ public class StreamCharset {
return result;
}
- public static StreamCharset get(Charset charset, boolean byteOrderMark) {
- return ALL.stream()
- .filter(streamCharset ->
- streamCharset.getCharset().equals(charset) && streamCharset.hasByteOrderMark() == byteOrderMark)
- .findFirst()
- .orElseThrow();
- }
-
- public static StreamCharset get(String s) {
- var found = ALL.stream().filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))).findFirst();
- if (found.isEmpty()) {
- throw new IllegalArgumentException("Unknown charset name: " + s);
- }
-
- return found.get();
- }
-
public String toString() {
return getNames().get(0);
}
diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java b/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java
index 739c8bb6..3059960c 100644
--- a/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java
+++ b/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java
@@ -17,7 +17,8 @@ public class GenericArrayReader implements GenericAbstractReader {
private GenericAbstractReader currentReader;
private DataStructureNode created;
- public GenericArrayReader() {}
+ public GenericArrayReader() {
+ }
public static GenericArrayReader newReader(int length) {
var ar = new GenericArrayReader();
diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java b/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java
index be1e0ba5..4ca04cd6 100644
--- a/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java
+++ b/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java
@@ -4,15 +4,21 @@ import java.util.Map;
public interface GenericDataStreamCallback {
- default void onName(String name) {}
+ default void onName(String name) {
+ }
- default void onArrayStart(int length) {}
+ default void onArrayStart(int length) {
+ }
- default void onArrayEnd(Map metaAttributes) {}
+ default void onArrayEnd(Map metaAttributes) {
+ }
- default void onTupleStart(int length) {}
+ default void onTupleStart(int length) {
+ }
- default void onTupleEnd(Map metaAttributes) {}
+ default void onTupleEnd(Map metaAttributes) {
+ }
- default void onValue(byte[] value, Map metaAttributes) {}
+ default void onValue(byte[] value, Map metaAttributes) {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java b/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java
index af7712d9..796d3da6 100644
--- a/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java
+++ b/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java
@@ -19,7 +19,8 @@ public class GenericTupleReader implements GenericAbstractReader {
private GenericAbstractReader currentReader;
private DataStructureNode created;
- public GenericTupleReader() {}
+ public GenericTupleReader() {
+ }
public static GenericTupleReader newReader(int length) {
var tr = new GenericTupleReader();
diff --git a/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java b/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java
index 3bcef8ae..70b579fb 100644
--- a/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java
@@ -8,7 +8,8 @@ import java.util.stream.Collectors;
public abstract class ArrayNode extends DataStructureNode {
- protected ArrayNode() {}
+ protected ArrayNode() {
+ }
public static ArrayNode empty() {
return of(List.of());
diff --git a/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java b/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java
index b9b5ca65..05a053a1 100644
--- a/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java
@@ -129,13 +129,13 @@ public abstract class DataStructureNode implements Iterable {
public String metaToString() {
return "("
+ (metaAttributes != null
- ? metaAttributes.entrySet().stream()
- .sorted(Comparator.comparingInt(entry -> entry.getKey()))
- .map(e -> e.getValue() != null
- ? e.getKey() + ":" + e.getValue()
- : e.getKey().toString())
- .collect(Collectors.joining("|"))
- : "")
+ ? metaAttributes.entrySet().stream()
+ .sorted(Comparator.comparingInt(entry -> entry.getKey()))
+ .map(e -> e.getValue() != null
+ ? e.getKey() + ":" + e.getValue()
+ : e.getKey().toString())
+ .collect(Collectors.joining("|"))
+ : "")
+ ")";
}
@@ -242,5 +242,6 @@ public abstract class DataStructureNode implements Iterable {
throw unsupported("iterator creation");
}
- public record KeyValue(String key, DataStructureNode value) {}
+ public record KeyValue(String key, DataStructureNode value) {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java b/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java
index 7425b9f2..c52114c3 100644
--- a/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java
+++ b/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java
@@ -217,7 +217,8 @@ public class DataStructureNodePointer {
}
public Builder pointerEvaluation(
- DataStructureNodePointer pointer, Function converter) {
+ DataStructureNodePointer pointer, Function converter
+ ) {
path.add(new FunctionElement((current) -> {
var res = pointer.get(current);
if (res != null) {
diff --git a/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java b/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java
index 29fee248..7385b24c 100644
--- a/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java
@@ -86,7 +86,8 @@ public class LinkedTupleNode extends TupleNode {
public DataType determineDataType() {
return TupleType.of(
getKeyNames(),
- getNodes().stream().map(DataStructureNode::determineDataType).toList());
+ getNodes().stream().map(DataStructureNode::determineDataType).toList()
+ );
}
@Override
diff --git a/core/src/main/java/io/xpipe/core/data/node/SimpleTupleNode.java b/core/src/main/java/io/xpipe/core/data/node/SimpleTupleNode.java
index 758739c7..b40dc584 100644
--- a/core/src/main/java/io/xpipe/core/data/node/SimpleTupleNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/SimpleTupleNode.java
@@ -67,7 +67,9 @@ public class SimpleTupleNode extends TupleNode {
@Override
public DataStructureNode clear() {
nodes.clear();
- if (names != null) names.clear();
+ if (names != null) {
+ names.clear();
+ }
return this;
}
diff --git a/core/src/main/java/io/xpipe/core/data/node/TupleNode.java b/core/src/main/java/io/xpipe/core/data/node/TupleNode.java
index c04b10eb..2424da24 100644
--- a/core/src/main/java/io/xpipe/core/data/node/TupleNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/TupleNode.java
@@ -102,8 +102,9 @@ public abstract class TupleNode extends DataStructureNode {
boolean hasKeys = entries.stream().anyMatch(kv -> kv.key() != null);
return hasKeys
? TupleNode.of(
- entries.stream().map(KeyValue::key).toList(),
- entries.stream().map(KeyValue::value).toList())
+ entries.stream().map(KeyValue::key).toList(),
+ entries.stream().map(KeyValue::value).toList()
+ )
: TupleNode.of(entries.stream().map(KeyValue::value).toList());
}
}
diff --git a/core/src/main/java/io/xpipe/core/data/node/ValueNode.java b/core/src/main/java/io/xpipe/core/data/node/ValueNode.java
index 3957303d..255a2bad 100644
--- a/core/src/main/java/io/xpipe/core/data/node/ValueNode.java
+++ b/core/src/main/java/io/xpipe/core/data/node/ValueNode.java
@@ -13,7 +13,8 @@ import java.util.Objects;
public abstract class ValueNode extends DataStructureNode {
- protected ValueNode() {}
+ protected ValueNode() {
+ }
public static ValueNode nullValue() {
return new SimpleValueNode(new byte[0]).tag(IS_NULL).asValue();
diff --git a/core/src/main/java/io/xpipe/core/data/type/DataType.java b/core/src/main/java/io/xpipe/core/data/type/DataType.java
index e51be181..737c545a 100644
--- a/core/src/main/java/io/xpipe/core/data/type/DataType.java
+++ b/core/src/main/java/io/xpipe/core/data/type/DataType.java
@@ -10,7 +10,10 @@ import java.util.Optional;
* To check whether a {@link DataStructureNode} instance conforms to the specified type,
* the method {@link #matches(DataStructureNode)} can be used.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
public abstract class DataType {
/**
diff --git a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java
index 5b08de48..aa513938 100644
--- a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java
+++ b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java
@@ -2,11 +2,15 @@ package io.xpipe.core.data.type;
public interface DataTypeVisitor {
- default void onValue(ValueType type) {}
+ default void onValue(ValueType type) {
+ }
- default void onTuple(TupleType type) {}
+ default void onTuple(TupleType type) {
+ }
- default void onArray(ArrayType type) {}
+ default void onArray(ArrayType type) {
+ }
- default void onWildcard(WildcardType type) {}
+ default void onWildcard(WildcardType type) {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java
index addda547..e4174e9a 100644
--- a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java
+++ b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java
@@ -41,7 +41,8 @@ public class DataTypeVisitors {
* Creates a visitor that allows for visiting possible recursive columns of table.
*/
public static DataTypeVisitor table(
- Consumer newTuple, Runnable endTuple, BiConsumer newValue) {
+ Consumer newTuple, Runnable endTuple, BiConsumer newValue
+ ) {
return new DataTypeVisitor() {
private final Stack tuples = new Stack<>();
private final Stack keyIndices = new Stack<>();
diff --git a/core/src/main/java/io/xpipe/core/data/type/WildcardType.java b/core/src/main/java/io/xpipe/core/data/type/WildcardType.java
index 17967c08..28d1d6fb 100644
--- a/core/src/main/java/io/xpipe/core/data/type/WildcardType.java
+++ b/core/src/main/java/io/xpipe/core/data/type/WildcardType.java
@@ -17,7 +17,8 @@ import java.util.Optional;
@Value
public class WildcardType extends DataType {
- private WildcardType() {}
+ private WildcardType() {
+ }
/**
* Creates a new instance.
diff --git a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java
index c662614d..9edea441 100644
--- a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java
+++ b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java
@@ -7,19 +7,27 @@ import java.util.Map;
public interface TypedDataStreamCallback {
- default void onValue(byte[] data, Map metaAttributes) {}
+ default void onValue(byte[] data, Map metaAttributes) {
+ }
- default void onGenericNode(DataStructureNode node) {}
+ default void onGenericNode(DataStructureNode node) {
+ }
- default void onTupleBegin(TupleType type) {}
+ default void onTupleBegin(TupleType type) {
+ }
- default void onTupleEnd(Map metaAttributes) {}
+ default void onTupleEnd(Map metaAttributes) {
+ }
- default void onArrayBegin(int size) {}
+ default void onArrayBegin(int size) {
+ }
- default void onArrayEnd(Map metaAttributes) {}
+ default void onArrayEnd(Map metaAttributes) {
+ }
- default void onNodeBegin() {}
+ default void onNodeBegin() {
+ }
- default void onNodeEnd() {}
+ default void onNodeEnd() {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStructureNodeReader.java b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStructureNodeReader.java
index f927a390..7a2dbd73 100644
--- a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStructureNodeReader.java
+++ b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStructureNodeReader.java
@@ -19,6 +19,7 @@ public class TypedDataStructureNodeReader implements TypedAbstractReader {
private int arrayDepth;
private DataType expectedType;
private int currentExpectedTypeIndex;
+
private TypedDataStructureNodeReader(DataType type) {
flattened = new ArrayList<>();
type.visit(DataTypeVisitors.flatten(flattened::add));
diff --git a/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java b/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java
index a3aba841..a8cc0da1 100644
--- a/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java
+++ b/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java
@@ -21,7 +21,8 @@ public class BaseQueryElement extends DialogElement {
@JsonCreator
public BaseQueryElement(
- String description, boolean newLine, boolean required, boolean secret, boolean quiet, String value) {
+ String description, boolean newLine, boolean required, boolean secret, boolean quiet, String value
+ ) {
this.description = description;
this.newLine = newLine;
this.required = required;
diff --git a/core/src/main/java/io/xpipe/core/dialog/Dialog.java b/core/src/main/java/io/xpipe/core/dialog/Dialog.java
index f0908c70..f15721a6 100644
--- a/core/src/main/java/io/xpipe/core/dialog/Dialog.java
+++ b/core/src/main/java/io/xpipe/core/dialog/Dialog.java
@@ -30,13 +30,6 @@ public abstract class Dialog {
protected Object eval;
private Supplier> evaluation;
- /**
- * Removes all completion listeners. Intended for internal use only.
- */
- public void clearCompletion() {
- completion.clear();
- }
-
/**
* Creates an empty dialogue. This dialogue completes immediately and does not handle any questions or answers.
*/
@@ -65,7 +58,8 @@ public abstract class Dialog {
* @param selected the selected element index
*/
public static Dialog.Choice choice(
- String description, List elements, boolean required, boolean quiet, int selected) {
+ String description, List elements, boolean required, boolean quiet, int selected
+ ) {
Dialog.Choice c = new Dialog.Choice(description, elements, required, quiet, selected);
c.evaluateTo(c::getSelected);
return c;
@@ -83,7 +77,8 @@ public abstract class Dialog {
*/
@SafeVarargs
public static Dialog.Choice choice(
- String description, Function toString, boolean required, boolean quiet, T def, T... vals) {
+ String description, Function toString, boolean required, boolean quiet, T def, T... vals
+ ) {
var elements = Arrays.stream(vals)
.map(v -> new io.xpipe.core.dialog.Choice(null, toString.apply(v)))
.toList();
@@ -120,7 +115,8 @@ public abstract class Dialog {
boolean required,
boolean quiet,
T value,
- QueryConverter converter) {
+ QueryConverter converter
+ ) {
var q = new Dialog.Query(description, newLine, required, quiet, value, converter, false);
q.evaluateTo(q::getConvertedValue);
return q;
@@ -166,7 +162,8 @@ public abstract class Dialog {
DialogElement currentElement = ds[current].receive(answer);
if (currentElement == null) {
DialogElement next = null;
- while (current < ds.length - 1 && (next = ds[++current].start()) == null) {}
+ while (current < ds.length - 1 && (next = ds[++current].start()) == null) {
+ }
;
return next;
}
@@ -357,7 +354,8 @@ public abstract class Dialog {
List elements,
boolean required,
int selected,
- Function c) {
+ Function c
+ ) {
var choice = new ChoiceElement(description, elements, required, false, selected);
return new Dialog() {
@@ -391,6 +389,13 @@ public abstract class Dialog {
};
}
+ /**
+ * Removes all completion listeners. Intended for internal use only.
+ */
+ public void clearCompletion() {
+ completion.clear();
+ }
+
/* TODO: Implement automatic completion mechanism for start as well
* In case start returns null, the completion is not automatically done.
* */
@@ -497,7 +502,8 @@ public abstract class Dialog {
boolean quiet,
T value,
QueryConverter converter,
- boolean hidden) {
+ boolean hidden
+ ) {
this.element = new QueryElement(description, newLine, required, quiet, value, converter, hidden);
}
diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java b/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java
index e27b672f..2b070cee 100644
--- a/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java
+++ b/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java
@@ -5,7 +5,8 @@ package io.xpipe.core.dialog;
*/
public class DialogCancelException extends Exception {
- public DialogCancelException() {}
+ public DialogCancelException() {
+ }
public DialogCancelException(String message) {
super(message);
@@ -20,7 +21,8 @@ public class DialogCancelException extends Exception {
}
public DialogCancelException(
- String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace
+ ) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogElement.java b/core/src/main/java/io/xpipe/core/dialog/DialogElement.java
index 736025d1..dfb13aec 100644
--- a/core/src/main/java/io/xpipe/core/dialog/DialogElement.java
+++ b/core/src/main/java/io/xpipe/core/dialog/DialogElement.java
@@ -8,7 +8,10 @@ import java.util.UUID;
@EqualsAndHashCode
@ToString
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
public abstract class DialogElement {
protected String id;
diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java b/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java
index 0a52d16b..cbb509fc 100644
--- a/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java
+++ b/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java
@@ -22,7 +22,7 @@ public class DialogMapper {
return map;
}
- private void handle(DialogElement element) throws Exception {
+ private void handle(DialogElement element) throws Exception {
String response = null;
if (element instanceof ChoiceElement c) {
response = handleChoice(c);
@@ -45,8 +45,8 @@ public class DialogMapper {
}
private String handleQuery(BaseQueryElement q) {
- map.put(q.getDescription(), q.getValue());
- return q.getValue();
+ map.put(q.getDescription(), q.getValue());
+ return q.getValue();
}
private String handleChoice(ChoiceElement c) {
diff --git a/core/src/main/java/io/xpipe/core/dialog/QueryElement.java b/core/src/main/java/io/xpipe/core/dialog/QueryElement.java
index e2c374cf..2550d910 100644
--- a/core/src/main/java/io/xpipe/core/dialog/QueryElement.java
+++ b/core/src/main/java/io/xpipe/core/dialog/QueryElement.java
@@ -14,7 +14,8 @@ public class QueryElement extends BaseQueryElement {
boolean quiet,
T value,
QueryConverter converter,
- boolean hidden) {
+ boolean hidden
+ ) {
super(description, newLine, required, hidden, quiet, value != null ? converter.toString(value) : null);
this.converter = converter;
}
diff --git a/core/src/main/java/io/xpipe/core/impl/BinarySource.java b/core/src/main/java/io/xpipe/core/impl/BinarySource.java
index 970e7bde..33abe1f4 100644
--- a/core/src/main/java/io/xpipe/core/impl/BinarySource.java
+++ b/core/src/main/java/io/xpipe/core/impl/BinarySource.java
@@ -44,13 +44,13 @@ public class BinarySource extends RawDataSource {
protected RawReadConnection newReadConnection() {
return new RawReadConnection() {
+ private InputStream inputStream;
+
@Override
public boolean canRead() throws Exception {
return getStore().canOpen();
}
- private InputStream inputStream;
-
@Override
public void init() throws Exception {
if (inputStream != null) {
diff --git a/core/src/main/java/io/xpipe/core/impl/FileNames.java b/core/src/main/java/io/xpipe/core/impl/FileNames.java
index 923ef368..2322c2b9 100644
--- a/core/src/main/java/io/xpipe/core/impl/FileNames.java
+++ b/core/src/main/java/io/xpipe/core/impl/FileNames.java
@@ -43,7 +43,7 @@ public class FileNames {
return backslash ? toWindows(file) : toUnix(file);
}
- private static List split(String file) {
+ private static List split(String file) {
var split = file.split("[\\\\/]");
return Arrays.stream(split).filter(s -> !s.isEmpty()).toList();
}
diff --git a/core/src/main/java/io/xpipe/core/impl/FileStore.java b/core/src/main/java/io/xpipe/core/impl/FileStore.java
index 808bfa9e..bb710632 100644
--- a/core/src/main/java/io/xpipe/core/impl/FileStore.java
+++ b/core/src/main/java/io/xpipe/core/impl/FileStore.java
@@ -32,7 +32,18 @@ public class FileStore extends JacksonizedValue implements FilenameStore, Stream
this.file = file;
}
- public String getParent() {
+ public static FileStore local(Path p) {
+ return new FileStore(new LocalStore(), p.toString());
+ }
+
+ /**
+ * Creates a file store for a file that is local to the callers machine.
+ */
+ public static FileStore local(String p) {
+ return new FileStore(new LocalStore(), p);
+ }
+
+ public String getParent() {
var matcher = Pattern.compile("^(.+?)[^\\\\/]+$").matcher(file);
if (!matcher.matches()) {
throw new IllegalArgumentException("Unable to determine parent of " + file);
@@ -45,17 +56,6 @@ public class FileStore extends JacksonizedValue implements FilenameStore, Stream
return fileSystem instanceof LocalStore;
}
- public static FileStore local(Path p) {
- return new FileStore(new LocalStore(), p.toString());
- }
-
- /**
- * Creates a file store for a file that is local to the callers machine.
- */
- public static FileStore local(String p) {
- return new FileStore(new LocalStore(), p);
- }
-
@Override
public void checkComplete() throws Exception {
if (fileSystem == null) {
diff --git a/core/src/main/java/io/xpipe/core/impl/LocalProcessControlProvider.java b/core/src/main/java/io/xpipe/core/impl/LocalProcessControlProvider.java
index 75bc5e40..c764a7a6 100644
--- a/core/src/main/java/io/xpipe/core/impl/LocalProcessControlProvider.java
+++ b/core/src/main/java/io/xpipe/core/impl/LocalProcessControlProvider.java
@@ -6,20 +6,20 @@ import java.util.ServiceLoader;
public abstract class LocalProcessControlProvider {
+ private static LocalProcessControlProvider INSTANCE;
+
public static LocalProcessControlProvider get() {
return INSTANCE;
}
- private static LocalProcessControlProvider INSTANCE;
-
public static void init(ModuleLayer layer) {
INSTANCE = layer != null
? ServiceLoader.load(layer, LocalProcessControlProvider.class)
- .findFirst()
- .orElse(null)
+ .findFirst()
+ .orElse(null)
: ServiceLoader.load(LocalProcessControlProvider.class)
- .findFirst()
- .orElse(null);
+ .findFirst()
+ .orElse(null);
}
public static ShellProcessControl create() {
diff --git a/core/src/main/java/io/xpipe/core/impl/LocalStore.java b/core/src/main/java/io/xpipe/core/impl/LocalStore.java
index b1a5d461..a5f33f21 100644
--- a/core/src/main/java/io/xpipe/core/impl/LocalStore.java
+++ b/core/src/main/java/io/xpipe/core/impl/LocalStore.java
@@ -45,6 +45,7 @@ public class LocalStore extends JacksonizedValue implements FileSystemStore, Mac
var p = Path.of(file);
return Files.newOutputStream(p);
}
+
@Override
public ShellProcessControl create() {
return LocalProcessControlProvider.create();
diff --git a/core/src/main/java/io/xpipe/core/impl/PreservingTableWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/PreservingTableWriteConnection.java
index a4835777..8b21460a 100644
--- a/core/src/main/java/io/xpipe/core/impl/PreservingTableWriteConnection.java
+++ b/core/src/main/java/io/xpipe/core/impl/PreservingTableWriteConnection.java
@@ -12,6 +12,7 @@ public class PreservingTableWriteConnection extends PreservingWriteConnection im
public PreservingTableWriteConnection(DataSource> source, DataSourceConnection connection, boolean append) {
super(DataSourceType.TABLE, source, append, connection);
}
+
@Override
public Optional createMapping(TupleType inputType) throws Exception {
return ((TableWriteConnection) connection).createMapping(inputType);
diff --git a/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java
index 34769d2f..f98a4211 100644
--- a/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java
+++ b/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java
@@ -15,7 +15,8 @@ public class PreservingWriteConnection implements DataSourceConnection {
private final boolean append;
public PreservingWriteConnection(
- DataSourceType type, DataSource> source, boolean append, DataSourceConnection connection) {
+ DataSourceType type, DataSource> source, boolean append, DataSourceConnection connection
+ ) {
this.type = type;
this.source = source;
this.append = append;
@@ -28,7 +29,7 @@ public class PreservingWriteConnection implements DataSourceConnection {
var nativeSource = DataSource.createInternalDataSource(type, nativeStore);
if (source.getStore().canOpen()) {
try (var in = source.openReadConnection();
- var out = nativeSource.openWriteConnection(WriteMode.REPLACE)) {
+ var out = nativeSource.openWriteConnection(WriteMode.REPLACE)) {
in.init();
out.init();
in.forward(out);
diff --git a/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java
index ff56d6b0..5733d606 100644
--- a/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java
+++ b/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java
@@ -7,7 +7,7 @@ import io.xpipe.core.source.TableWriteConnection;
import java.util.Optional;
-public interface SimpleTableWriteConnection> extends TableWriteConnection {
+public interface SimpleTableWriteConnection> extends TableWriteConnection {
public T getSource();
@@ -18,7 +18,7 @@ public interface SimpleTableWriteConnection> exten
public default Optional createMapping(TupleType inputType) throws Exception {
var outputType = getType();
- if (outputType.isEmpty() || outputType.get().getSize() == 0){
+ if (outputType.isEmpty() || outputType.get().getSize() == 0) {
return Optional.of(TableMapping.createIdentity(inputType));
}
diff --git a/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java b/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java
index 04e1dc67..4c4fdbea 100644
--- a/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java
+++ b/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java
@@ -21,14 +21,6 @@ import java.nio.channels.Pipe;
@Getter
public class SinkDrainStore extends JacksonizedValue implements KnownFormatStreamDataStore, StatefulDataStore {
- public static enum State {
- NONE_CONNECTED,
- PRODUCER_CONNECTED,
- CONSUMER_CONNECTED,
- OPEN,
- CLOSED
- }
-
private final StreamCharset charset;
private final NewLine newLine;
@@ -163,4 +155,12 @@ public class SinkDrainStore extends JacksonizedValue implements KnownFormatStrea
throw new IllegalStateException("Consumer is already connected");
}
}
+
+ public static enum State {
+ NONE_CONNECTED,
+ PRODUCER_CONNECTED,
+ CONSUMER_CONNECTED,
+ OPEN,
+ CLOSED
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java b/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java
index 4f3d3f2f..2766c8e9 100644
--- a/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java
+++ b/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java
@@ -26,7 +26,8 @@ public class StdinDataStore extends JacksonizedValue implements StreamDataStore
// Prevent closing the standard in when the returned input stream is closed
return new FilterInputStream(in) {
@Override
- public void close() throws IOException {}
+ public void close() throws IOException {
+ }
};
}
}
diff --git a/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java b/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java
index 799c98f7..25a47df5 100644
--- a/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java
+++ b/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java
@@ -30,7 +30,8 @@ public class StdoutDataStore extends JacksonizedValue implements StreamDataStore
// Create an output stream that will write to standard out but will not close it
return new FilterOutputStream(System.out) {
@Override
- public void close() throws IOException {}
+ public void close() throws IOException {
+ }
};
}
}
diff --git a/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java b/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java
index dbebe1cb..6d373eb2 100644
--- a/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java
+++ b/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java
@@ -24,6 +24,7 @@ public class XpbtReadConnection extends StreamReadConnection implements TableRea
private TupleType dataType;
private TypedDataStreamParser parser;
private boolean empty;
+
protected XpbtReadConnection(XpbtSource source) {
super(source.getStore(), null);
this.store = source.getStore();
@@ -46,13 +47,14 @@ public class XpbtReadConnection extends StreamReadConnection implements TableRea
this.inputStream.skip(headerLength + 1);
List names = JacksonMapper.newMapper()
.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE)
- .readerFor(new TypeReference>() {})
+ .readerFor(new TypeReference>() {
+ })
.readValue(header);
TupleType dataType = TupleType.tableType(names);
this.dataType = dataType;
this.parser = new TypedDataStreamParser(dataType);
}
-
+
@Override
public TupleType getDataType() {
return dataType;
diff --git a/core/src/main/java/io/xpipe/core/process/OsType.java b/core/src/main/java/io/xpipe/core/process/OsType.java
index 68ab2a9d..e99b6334 100644
--- a/core/src/main/java/io/xpipe/core/process/OsType.java
+++ b/core/src/main/java/io/xpipe/core/process/OsType.java
@@ -9,16 +9,6 @@ public interface OsType {
Linux LINUX = new Linux();
Mac MAC = new Mac();
- String getName();
-
- String getTempDirectory(ShellProcessControl pc) throws Exception;
-
- String normalizeFileName(String file);
-
- Map getProperties(ShellProcessControl pc) throws Exception;
-
- String determineOperatingSystemName(ShellProcessControl pc) throws Exception;
-
public static OsType getLocal() {
String osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
if ((osName.contains("mac")) || (osName.contains("darwin"))) {
@@ -32,6 +22,16 @@ public interface OsType {
}
}
+ String getName();
+
+ String getTempDirectory(ShellProcessControl pc) throws Exception;
+
+ String normalizeFileName(String file);
+
+ Map getProperties(ShellProcessControl pc) throws Exception;
+
+ String determineOperatingSystemName(ShellProcessControl pc) throws Exception;
+
static class Windows implements OsType {
@Override
@@ -52,7 +52,7 @@ public interface OsType {
@Override
public Map getProperties(ShellProcessControl pc) throws Exception {
try (CommandProcessControl c =
- pc.subShell(ShellTypes.CMD).command("systeminfo").start()) {
+ pc.subShell(ShellTypes.CMD).command("systeminfo").start()) {
var text = c.readOrThrow();
return PropertiesFormatsParser.parse(text, ":");
}
@@ -144,7 +144,7 @@ public interface OsType {
@Override
public Map getProperties(ShellProcessControl pc) throws Exception {
try (CommandProcessControl c =
- pc.subShell(ShellTypes.BASH).command("sw_vers").start()) {
+ pc.subShell(ShellTypes.BASH).command("sw_vers").start()) {
var text = c.readOrThrow();
return PropertiesFormatsParser.parse(text, ":");
}
diff --git a/core/src/main/java/io/xpipe/core/process/ProcessControl.java b/core/src/main/java/io/xpipe/core/process/ProcessControl.java
index 6a401e1b..29092ea2 100644
--- a/core/src/main/java/io/xpipe/core/process/ProcessControl.java
+++ b/core/src/main/java/io/xpipe/core/process/ProcessControl.java
@@ -8,7 +8,7 @@ import java.nio.charset.Charset;
public interface ProcessControl extends Closeable, AutoCloseable {
- String prepareTerminalOpen() throws Exception;
+ String prepareTerminalOpen() throws Exception;
void closeStdin() throws IOException;
@@ -24,6 +24,7 @@ public interface ProcessControl extends Closeable, AutoCloseable {
@Override
void close() throws IOException;
+
void kill() throws Exception;
ProcessControl start() throws Exception;
diff --git a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java
index 6cee4c40..a70cfbea 100644
--- a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java
+++ b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java
@@ -18,7 +18,8 @@ public class ProcessOutputException extends Exception {
}
protected ProcessOutputException(
- String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace
+ ) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
diff --git a/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java b/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java
index 8c0d6e02..791477e8 100644
--- a/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java
+++ b/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java
@@ -55,8 +55,8 @@ public interface ShellProcessControl extends ProcessControl {
default ShellProcessControl subShell(@NonNull ShellType type) {
return subShell(p -> type.getNormalOpenCommand(), (shellProcessControl, s) -> {
- return s == null ? type.getNormalOpenCommand() : type.executeCommandWithShell(s);
- })
+ return s == null ? type.getNormalOpenCommand() : type.executeCommandWithShell(s);
+ })
.elevation(getElevationPassword());
}
@@ -71,7 +71,8 @@ public interface ShellProcessControl extends ProcessControl {
ShellProcessControl subShell(
@NonNull Function command,
- BiFunction terminalCommand);
+ BiFunction terminalCommand
+ );
void executeCommand(String command) throws Exception;
@@ -81,7 +82,8 @@ public interface ShellProcessControl extends ProcessControl {
CommandProcessControl command(Function command);
CommandProcessControl command(
- Function command, Function terminalCommand);
+ Function command, Function terminalCommand
+ );
default CommandProcessControl command(String command) {
return command(shellProcessControl -> command);
diff --git a/core/src/main/java/io/xpipe/core/process/ShellType.java b/core/src/main/java/io/xpipe/core/process/ShellType.java
index f345ce41..2b0bf00e 100644
--- a/core/src/main/java/io/xpipe/core/process/ShellType.java
+++ b/core/src/main/java/io/xpipe/core/process/ShellType.java
@@ -7,7 +7,10 @@ import java.nio.charset.Charset;
import java.util.List;
import java.util.stream.Collectors;
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
public interface ShellType {
String getScriptFileEnding();
@@ -25,8 +28,8 @@ public interface ShellType {
default String flatten(List command) {
return command.stream()
.map(s -> s.contains(" ")
- && !(s.startsWith("\"") && s.endsWith("\""))
- && !(s.startsWith("'") && s.endsWith("'"))
+ && !(s.startsWith("\"") && s.endsWith("\""))
+ && !(s.startsWith("'") && s.endsWith("'"))
? "\"" + s + "\""
: s)
.collect(Collectors.joining(" "));
diff --git a/core/src/main/java/io/xpipe/core/source/DataSource.java b/core/src/main/java/io/xpipe/core/source/DataSource.java
index 9f42444e..40861cd5 100644
--- a/core/src/main/java/io/xpipe/core/source/DataSource.java
+++ b/core/src/main/java/io/xpipe/core/source/DataSource.java
@@ -23,7 +23,10 @@ import java.util.Optional;
* This instance is only valid in combination with its associated data store instance.
*/
@SuperBuilder
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
public abstract class DataSource extends JacksonizedValue {
protected DS store;
@@ -39,7 +42,7 @@ public abstract class DataSource extends JacksonizedValue
.charset(StreamCharset.UTF8)
.build();
case RAW -> null;
- // TODO
+ // TODO
case COLLECTION -> null;
};
} catch (Exception ex) {
@@ -47,7 +50,7 @@ public abstract class DataSource extends JacksonizedValue
}
}
- public boolean isComplete() {
+ public boolean isComplete() {
try {
checkComplete();
return true;
diff --git a/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java b/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java
index c44e3dec..38c8a928 100644
--- a/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java
+++ b/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java
@@ -9,7 +9,9 @@ public interface DataSourceConnection extends AutoCloseable {
* Initializes this connection. Required to be called
* exactly once prior to attempting to use this connection.
*/
- default void init() throws Exception {}
+ default void init() throws Exception {
+ }
- default void close() throws Exception {}
+ default void close() throws Exception {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/source/DataSourceId.java b/core/src/main/java/io/xpipe/core/source/DataSourceId.java
index c43d45b8..0d0b96b9 100644
--- a/core/src/main/java/io/xpipe/core/source/DataSourceId.java
+++ b/core/src/main/java/io/xpipe/core/source/DataSourceId.java
@@ -11,7 +11,7 @@ import lombok.Getter;
* To allow for a simple usage of data source ids, the collection and entry names are trimmed and
* converted to lower case names when creating them.
* The two names are separated by a colon and are therefore not allowed to contain colons themselves.
- *
+ *
* A missing collection name indicates that the data source exists only temporarily.
*
* @see #create(String, String)
diff --git a/core/src/main/java/io/xpipe/core/source/DataSourceReference.java b/core/src/main/java/io/xpipe/core/source/DataSourceReference.java
index 07444442..6b390eed 100644
--- a/core/src/main/java/io/xpipe/core/source/DataSourceReference.java
+++ b/core/src/main/java/io/xpipe/core/source/DataSourceReference.java
@@ -10,7 +10,7 @@ import java.util.Objects;
* Represents a reference to an X-Pipe data source.
* Using {@link DataSourceReference} instances instead of {@link DataSourceId}
* instances is mainly done for user convenience purposes.
- *
+ *
* While a {@link DataSourceId} represents a unique and canonical identifier for an X-Pipe data source,
* there also exist easier and shorter ways to address a data source.
* This convenience comes at the price of ambiguity and instability for other types of references.
@@ -105,8 +105,12 @@ public interface DataSourceReference {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Id id = (Id) o;
return value.equals(id.value);
}
@@ -155,8 +159,12 @@ public interface DataSourceReference {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Name n = (Name) o;
return value.equals(n.value);
}
@@ -201,7 +209,9 @@ public interface DataSourceReference {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
+ if (this == o) {
+ return true;
+ }
return o != null && getClass() == o.getClass();
}
diff --git a/core/src/main/java/io/xpipe/core/source/TableDataSource.java b/core/src/main/java/io/xpipe/core/source/TableDataSource.java
index 619efc4a..3653a4dd 100644
--- a/core/src/main/java/io/xpipe/core/source/TableDataSource.java
+++ b/core/src/main/java/io/xpipe/core/source/TableDataSource.java
@@ -45,28 +45,6 @@ public abstract class TableDataSource extends DataSource {
-
- private TableDataSource> source;
- private TupleType type;
-
- public CreateMappingFunction(TableDataSource> source, TupleType type) {
- this.source = source;
- this.type = type;
- }
-
- private TableMapping mapping;
-
- @SneakyThrows
- public void callLocal() {
- try (TableWriteConnection w = source.openWriteConnection(WriteMode.REPLACE)) {
- w.init();
- mapping = w.createMapping(type).orElse(null);
- }
- }
- }
-
public final Optional createMapping(TupleType inputType) throws Exception {
return Optional.ofNullable(new CreateMappingFunction(this, inputType).callAndGet());
}
@@ -100,4 +78,25 @@ public abstract class TableDataSource extends DataSource {
+
+ private TableDataSource> source;
+ private TupleType type;
+ private TableMapping mapping;
+
+ public CreateMappingFunction(TableDataSource> source, TupleType type) {
+ this.source = source;
+ this.type = type;
+ }
+
+ @SneakyThrows
+ public void callLocal() {
+ try (TableWriteConnection w = source.openWriteConnection(WriteMode.REPLACE)) {
+ w.init();
+ mapping = w.createMapping(type).orElse(null);
+ }
+ }
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/source/TableMapping.java b/core/src/main/java/io/xpipe/core/source/TableMapping.java
index 89288ad5..076f6113 100644
--- a/core/src/main/java/io/xpipe/core/source/TableMapping.java
+++ b/core/src/main/java/io/xpipe/core/source/TableMapping.java
@@ -13,6 +13,17 @@ import java.util.stream.IntStream;
@Getter
public class TableMapping {
+ protected final Integer[] columMap;
+ private final TupleType inputType;
+ private final TupleType outputType;
+
+ @JsonCreator
+ public TableMapping(TupleType inputType, TupleType outputType, Integer[] columMap) {
+ this.inputType = inputType;
+ this.outputType = outputType;
+ this.columMap = columMap;
+ }
+
private static Integer[] range(int size) {
var array = new Integer[size];
for (int i = 0; i < size; i++) {
@@ -58,19 +69,6 @@ public class TableMapping {
return OptionalInt.empty();
}
- private final TupleType inputType;
-
- private final TupleType outputType;
-
- protected final Integer[] columMap;
-
- @JsonCreator
- public TableMapping(TupleType inputType, TupleType outputType, Integer[] columMap) {
- this.inputType = inputType;
- this.outputType = outputType;
- this.columMap = columMap;
- }
-
public boolean isIdentity() {
return inputType.equals(outputType)
&& Arrays.equals(columMap, range(getInputType().getSize()));
diff --git a/core/src/main/java/io/xpipe/core/source/WriteMode.java b/core/src/main/java/io/xpipe/core/source/WriteMode.java
index 24dbfc1c..0fa9c4c6 100644
--- a/core/src/main/java/io/xpipe/core/source/WriteMode.java
+++ b/core/src/main/java/io/xpipe/core/source/WriteMode.java
@@ -9,37 +9,39 @@ import java.util.ServiceLoader;
public class WriteMode extends JacksonizedValue {
+ public static final Replace REPLACE = new Replace();
+ public static final Append APPEND = new Append();
+ public static final Prepend PREPEND = new Prepend();
private static final List ALL = new ArrayList<>();
public static void init(ModuleLayer layer) {
if (ALL.size() == 0) {
ALL.addAll(ServiceLoader.load(layer, WriteMode.class).stream()
- .map(p -> p.get())
- .toList());
+ .map(p -> p.get())
+ .toList());
}
}
- @JsonTypeName("replace")
- public static final class Replace extends WriteMode {}
-
- @JsonTypeName("append")
- public static final class Append extends WriteMode {}
-
- @JsonTypeName("prepend")
- public static final class Prepend extends WriteMode {}
-
- public static final Replace REPLACE = new Replace();
- public static final Append APPEND = new Append();
- public static final Prepend PREPEND = new Prepend();
-
- public final String getId() {
- return getClass().getAnnotation(JsonTypeName.class).value();
- }
-
public static WriteMode byId(String id) {
return ALL.stream()
.filter(writeMode -> writeMode.getId().equalsIgnoreCase(id))
.findFirst()
.orElseThrow();
}
+
+ public final String getId() {
+ return getClass().getAnnotation(JsonTypeName.class).value();
+ }
+
+ @JsonTypeName("replace")
+ public static final class Replace extends WriteMode {
+ }
+
+ @JsonTypeName("append")
+ public static final class Append extends WriteMode {
+ }
+
+ @JsonTypeName("prepend")
+ public static final class Prepend extends WriteMode {
+ }
}
diff --git a/core/src/main/java/io/xpipe/core/store/DataStore.java b/core/src/main/java/io/xpipe/core/store/DataStore.java
index ec75ece6..cb6e2690 100644
--- a/core/src/main/java/io/xpipe/core/store/DataStore.java
+++ b/core/src/main/java/io/xpipe/core/store/DataStore.java
@@ -16,7 +16,10 @@ import java.util.Optional;
*
* @see DataSource
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonTypeInfo(
+ use = JsonTypeInfo.Id.NAME,
+ property = "type"
+)
public interface DataStore {
default boolean shouldPersist() {
@@ -61,23 +64,25 @@ public interface DataStore {
/**
* Performs a validation of this data store.
- *
+ *
* This validation can include one of multiple things:
* - Sanity checks of individual properties
* - Existence checks
* - Connection checks
- *
+ *
* All in all, a successful execution of this method should almost guarantee
* that the data store can be successfully accessed in the near future.
- *
+ *
* Note that some checks may take a long time, for example if a connection has to be validated.
* The caller should therefore expect a runtime of multiple seconds when calling this method.
*
* @throws Exception if any part of the validation went wrong
*/
- default void validate() throws Exception {}
+ default void validate() throws Exception {
+ }
- default void checkComplete() throws Exception {}
+ default void checkComplete() throws Exception {
+ }
default boolean delete() throws Exception {
return false;
diff --git a/core/src/main/java/io/xpipe/core/store/MachineStore.java b/core/src/main/java/io/xpipe/core/store/MachineStore.java
index a387682c..0b2c726f 100644
--- a/core/src/main/java/io/xpipe/core/store/MachineStore.java
+++ b/core/src/main/java/io/xpipe/core/store/MachineStore.java
@@ -36,7 +36,7 @@ public interface MachineStore extends FileSystemStore, ShellStore {
public default boolean mkdirs(String file) throws Exception {
try (var pc = create().command(proc -> proc.getShellType()
.flatten(proc.getShellType()
- .createMkdirsCommand(proc.getOsType().normalizeFileName(file))))
+ .createMkdirsCommand(proc.getOsType().normalizeFileName(file))))
.start()) {
return pc.discardAndCheckExit();
}
diff --git a/core/src/main/java/io/xpipe/core/store/ShellStore.java b/core/src/main/java/io/xpipe/core/store/ShellStore.java
index b6022ba8..3cebb016 100644
--- a/core/src/main/java/io/xpipe/core/store/ShellStore.java
+++ b/core/src/main/java/io/xpipe/core/store/ShellStore.java
@@ -28,9 +28,11 @@ public interface ShellStore extends DataStore {
return pc.getShellType();
}
}
+
@Override
default void validate() throws Exception {
- try (ShellProcessControl pc = create().start()) {}
+ try (ShellProcessControl pc = create().start()) {
+ }
}
public default String queryMachineName() throws Exception {
diff --git a/core/src/main/java/io/xpipe/core/store/StatefulDataStore.java b/core/src/main/java/io/xpipe/core/store/StatefulDataStore.java
index 70ab1793..10f5d520 100644
--- a/core/src/main/java/io/xpipe/core/store/StatefulDataStore.java
+++ b/core/src/main/java/io/xpipe/core/store/StatefulDataStore.java
@@ -4,11 +4,12 @@ import io.xpipe.core.util.DataStateProvider;
import java.util.function.Supplier;
-public interface StatefulDataStore extends DataStore {
+public interface StatefulDataStore extends DataStore {
- default T getState(String key, Class c, T def) {
+ default T getState(String key, Class c, T def) {
return DataStateProvider.get().getState(this, key, c, () -> def);
}
+
default T getOrComputeState(String key, Class c, Supplier def) {
return DataStateProvider.get().getState(this, key, c, def);
}
diff --git a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java
index e9fa6c42..ced43f70 100644
--- a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java
+++ b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java
@@ -52,7 +52,8 @@ public class CoreJacksonModule extends SimpleModule {
new NamedType(BaseQueryElement.class),
new NamedType(ChoiceElement.class),
new NamedType(BusyElement.class),
- new NamedType(HeaderElement.class));
+ new NamedType(HeaderElement.class)
+ );
addSerializer(Charset.class, new CharsetSerializer());
addDeserializer(Charset.class, new CharsetDeserializer());
@@ -197,12 +198,16 @@ public class CoreJacksonModule extends SimpleModule {
@JsonSerialize(as = Throwable.class)
public abstract static class ThrowableTypeMixIn {
- @JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class, property = "$id")
+ @JsonIdentityInfo(
+ generator = ObjectIdGenerators.StringIdGenerator.class,
+ property = "$id"
+ )
private Throwable cause;
}
@JsonSerialize(as = DataSourceReference.class)
- public abstract static class DataSourceReferenceTypeMixIn {}
+ public abstract static class DataSourceReferenceTypeMixIn {
+ }
public class NullSerializer extends JsonSerializer