Implement library build

This commit is contained in:
Christopher Schnick
2022-01-02 00:51:06 +01:00
parent d63882c5ff
commit 08bd127695
11 changed files with 162 additions and 11 deletions

View File

@@ -10,6 +10,9 @@ import io.xpipe.beacon.ServerException;
import io.xpipe.beacon.exchange.ReadInfoExchange;
import io.xpipe.core.source.DataSourceId;
import java.net.URL;
import java.util.Map;
public abstract class DataSourceImpl implements DataSource {
public static DataSource get(DataSourceId ds) {
@@ -34,6 +37,28 @@ public abstract class DataSourceImpl implements DataSource {
return source[0];
}
public static DataSource wrap(URL url, String type, Map<String,String> config) {
final DataSource[] source = new DataSource[1];
new XPipeApiConnector() {
@Override
protected void handle(BeaconClient sc) throws ClientException, ServerException, ConnectorException {
var req = ReadInfoExchange.Request.builder().sourceId(ds).build();
ReadInfoExchange.Response res = performSimpleExchange(sc, req);
switch (res.getType()) {
case TABLE -> {
var data = res.getTableData();
source[0] = new DataTableImpl(res.getSourceId(), data.getRowCount(), data.getDataType());
}
case STRUCTURE -> {
}
case RAW -> {
}
}
}
}.execute();
return source[0];
}
private final DataSourceId sourceId;
public DataSourceImpl(DataSourceId sourceId) {