mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-02 13:17:51 +00:00
[stage] [noannounce]
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package io.xpipe.api;
|
||||
|
||||
import io.xpipe.api.impl.DataSourceImpl;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
@@ -96,16 +96,16 @@ public interface DataSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #create(DataSourceId, String, InputStream)} that creates an anonymous data source.
|
||||
* Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source.
|
||||
*/
|
||||
static DataSource createAnonymous(String type, Path path) {
|
||||
return create(null, type, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #create(DataSourceId, String, InputStream)}.
|
||||
* Wrapper for {@link #create(DataStoreId, String, InputStream)}.
|
||||
*/
|
||||
static DataSource create(DataSourceId id, String type, Path path) {
|
||||
static DataSource create(DataStoreId id, String type, Path path) {
|
||||
try (var in = Files.newInputStream(path)) {
|
||||
return create(id, type, in);
|
||||
} catch (IOException e) {
|
||||
@@ -114,16 +114,16 @@ public interface DataSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #create(DataSourceId, String, InputStream)} that creates an anonymous data source.
|
||||
* Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source.
|
||||
*/
|
||||
static DataSource createAnonymous(String type, URL url) {
|
||||
return create(null, type, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #create(DataSourceId, String, InputStream)}.
|
||||
* Wrapper for {@link #create(DataStoreId, String, InputStream)}.
|
||||
*/
|
||||
static DataSource create(DataSourceId id, String type, URL url) {
|
||||
static DataSource create(DataStoreId id, String type, URL url) {
|
||||
try (var in = url.openStream()) {
|
||||
return create(id, type, in);
|
||||
} catch (IOException e) {
|
||||
@@ -132,7 +132,7 @@ public interface DataSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #create(DataSourceId, String, InputStream)} that creates an anonymous data source.
|
||||
* Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source.
|
||||
*/
|
||||
static DataSource createAnonymous(String type, InputStream in) {
|
||||
return create(null, type, in);
|
||||
@@ -146,7 +146,7 @@ public interface DataSource {
|
||||
* @param in the input stream to read
|
||||
* @return a {@link DataSource} instances that can be used to access the underlying data
|
||||
*/
|
||||
static DataSource create(DataSourceId id, String type, InputStream in) {
|
||||
static DataSource create(DataStoreId id, String type, InputStream in) {
|
||||
return DataSourceImpl.create(id, type, in);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public interface DataSource {
|
||||
* @param id the data source id
|
||||
* @return a {@link DataSource} instances that can be used to access the underlying data
|
||||
*/
|
||||
static DataSource create(DataSourceId id, io.xpipe.core.source.DataSource<?> source) {
|
||||
static DataSource create(DataStoreId id, io.xpipe.core.source.DataSource<?> source) {
|
||||
return DataSourceImpl.create(id, source);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public interface DataSource {
|
||||
* @param in the data store to add
|
||||
* @return a {@link DataSource} instances that can be used to access the underlying data
|
||||
*/
|
||||
static DataSource create(DataSourceId id, String type, DataStore in) {
|
||||
static DataSource create(DataStoreId id, String type, DataStore in) {
|
||||
return DataSourceImpl.create(id, type, in);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public interface DataSource {
|
||||
/**
|
||||
* Returns the id of this data source.
|
||||
*/
|
||||
DataSourceId getId();
|
||||
DataStoreId getId();
|
||||
|
||||
/**
|
||||
* Returns the type of this data source.
|
||||
|
||||
@@ -4,14 +4,14 @@ import io.xpipe.api.impl.DataTableAccumulatorImpl;
|
||||
import io.xpipe.core.data.node.DataStructureNode;
|
||||
import io.xpipe.core.data.node.DataStructureNodeAcceptor;
|
||||
import io.xpipe.core.data.type.TupleType;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* {@link #finish(DataStoreId)} to complete the construction process and create a new data source.
|
||||
*/
|
||||
public interface DataTableAccumulator {
|
||||
|
||||
@@ -20,10 +20,10 @@ public interface DataTableAccumulator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for {@link #finish(DataSourceId)}.
|
||||
* Wrapper for {@link #finish(DataStoreId)}.
|
||||
*/
|
||||
default DataTable finish(String id) {
|
||||
return finish(DataSourceId.fromString(id));
|
||||
return finish(DataStoreId.fromString(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ public interface DataTableAccumulator {
|
||||
*
|
||||
* @param id the data source id to assign
|
||||
*/
|
||||
DataTable finish(DataSourceId id);
|
||||
DataTable finish(DataStoreId id);
|
||||
|
||||
/**
|
||||
* Adds a row to the table.
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.xpipe.api.impl;
|
||||
|
||||
import io.xpipe.api.DataRaw;
|
||||
import io.xpipe.api.DataSourceConfig;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -10,7 +10,7 @@ import java.io.InputStream;
|
||||
public class DataRawImpl extends DataSourceImpl implements DataRaw {
|
||||
|
||||
public DataRawImpl(
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.xpipe.api.DataSource;
|
||||
import io.xpipe.api.DataSourceConfig;
|
||||
import io.xpipe.api.connector.XPipeApiConnection;
|
||||
import io.xpipe.beacon.exchange.*;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.core.store.StreamDataStore;
|
||||
@@ -13,12 +13,12 @@ import java.io.InputStream;
|
||||
|
||||
public abstract class DataSourceImpl implements DataSource {
|
||||
|
||||
private final DataSourceId sourceId;
|
||||
private final DataStoreId sourceId;
|
||||
private final DataSourceConfig config;
|
||||
private final io.xpipe.core.source.DataSource<?> internalSource;
|
||||
|
||||
public DataSourceImpl(
|
||||
DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
DataStoreId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
this.sourceId = sourceId;
|
||||
this.config = config;
|
||||
this.internalSource = internalSource;
|
||||
@@ -48,7 +48,7 @@ public abstract class DataSourceImpl implements DataSource {
|
||||
});
|
||||
}
|
||||
|
||||
public static DataSource create(DataSourceId id, io.xpipe.core.source.DataSource<?> source) {
|
||||
public static DataSource create(DataStoreId id, io.xpipe.core.source.DataSource<?> source) {
|
||||
var startReq =
|
||||
AddSourceExchange.Request.builder().source(source).target(id).build();
|
||||
var returnedId = XPipeApiConnection.execute(con -> {
|
||||
@@ -60,7 +60,7 @@ public abstract class DataSourceImpl implements DataSource {
|
||||
return get(ref);
|
||||
}
|
||||
|
||||
public static DataSource create(DataSourceId id, String type, DataStore store) {
|
||||
public static DataSource create(DataStoreId id, String type, DataStore store) {
|
||||
if (store instanceof StreamDataStore s && s.isContentExclusivelyAccessible()) {
|
||||
store = XPipeApiConnection.execute(con -> {
|
||||
var internal = con.createInternalStreamStore();
|
||||
@@ -94,7 +94,7 @@ public abstract class DataSourceImpl implements DataSource {
|
||||
return get(ref);
|
||||
}
|
||||
|
||||
public static DataSource create(DataSourceId id, String type, InputStream in) {
|
||||
public static DataSource create(DataStoreId id, String type, InputStream in) {
|
||||
var store = XPipeApiConnection.execute(con -> {
|
||||
var internal = con.createInternalStreamStore();
|
||||
var req = WriteStreamExchange.Request.builder()
|
||||
@@ -152,7 +152,7 @@ public abstract class DataSourceImpl implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceId getId() {
|
||||
public DataStoreId getId() {
|
||||
return sourceId;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package io.xpipe.api.impl;
|
||||
import io.xpipe.api.DataSourceConfig;
|
||||
import io.xpipe.api.DataStructure;
|
||||
import io.xpipe.core.data.node.DataStructureNode;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
|
||||
public class DataStructureImpl extends DataSourceImpl implements DataStructure {
|
||||
|
||||
DataStructureImpl(
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import io.xpipe.core.data.node.TupleNode;
|
||||
import io.xpipe.core.data.type.TupleType;
|
||||
import io.xpipe.core.data.typed.TypedDataStreamWriter;
|
||||
import io.xpipe.core.impl.InternalStreamStore;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceReference;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -51,7 +51,7 @@ public class DataTableAccumulatorImpl implements DataTableAccumulator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized DataTable finish(DataSourceId id) {
|
||||
public synchronized DataTable finish(DataStoreId id) {
|
||||
try {
|
||||
bodyOutput.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.xpipe.api.DataTable;
|
||||
import io.xpipe.core.data.node.ArrayNode;
|
||||
import io.xpipe.core.data.node.DataStructureNode;
|
||||
import io.xpipe.core.data.node.TupleNode;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -15,7 +15,7 @@ import java.util.stream.Stream;
|
||||
|
||||
public class DataTableImpl extends DataSourceImpl implements DataTable {
|
||||
|
||||
DataTableImpl(DataSourceId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
DataTableImpl(DataStoreId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(id, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.xpipe.api.impl;
|
||||
|
||||
import io.xpipe.api.DataSourceConfig;
|
||||
import io.xpipe.api.DataText;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.core.source.DataStoreId;
|
||||
import io.xpipe.core.source.DataSourceType;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,7 +12,7 @@ import java.util.stream.Stream;
|
||||
public class DataTextImpl extends DataSourceImpl implements DataText {
|
||||
|
||||
DataTextImpl(
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user