This commit is contained in:
Christopher Schnick
2022-12-30 12:54:40 +01:00
parent b9501bad43
commit 661ad8a79c
116 changed files with 715 additions and 491 deletions

View File

@@ -15,10 +15,10 @@ import java.nio.file.Path;
/**
* Represents a reference to a data source that is managed by X-Pipe.
*
* <p>
* 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.
*
* <p>
* 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!
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* 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) {

View File

@@ -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;

View File

@@ -8,7 +8,7 @@ import io.xpipe.core.source.DataSourceId;
/**
* An accumulator for table data.
*
* <p>
* 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.

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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<TupleNode> iterator() {
return new TableIterator();
}
;
private class TableIterator implements Iterator<TupleNode> {

View File

@@ -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);
}