mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-23 08:00:56 -04:00
Small fixes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.xpipe.api;
|
||||
|
||||
import io.xpipe.beacon.*;
|
||||
import io.xpipe.core.util.JacksonHelper;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -10,14 +11,8 @@ public abstract class XPipeApiConnector extends BeaconConnector {
|
||||
try {
|
||||
var socket = constructSocket();
|
||||
handle(socket);
|
||||
} catch (ConnectorException ce) {
|
||||
throw new XPipeConnectException(ce.getMessage());
|
||||
} catch (ClientException ce) {
|
||||
throw new XPipeClientException(ce.getMessage());
|
||||
} catch (ServerException se) {
|
||||
throw new XPipeServerException(se.getMessage());
|
||||
} catch (Throwable t) {
|
||||
throw new XPipeConnectException(t);
|
||||
} catch (Throwable ce) {
|
||||
throw new XPipeException(ce);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +20,10 @@ public abstract class XPipeApiConnector extends BeaconConnector {
|
||||
|
||||
@Override
|
||||
protected BeaconClient constructSocket() throws ConnectorException {
|
||||
if (!JacksonHelper.isInit()) {
|
||||
JacksonHelper.init(ModuleLayer.boot());
|
||||
}
|
||||
|
||||
if (!BeaconServer.isRunning()) {
|
||||
try {
|
||||
start();
|
||||
|
||||
23
api/src/main/java/io/xpipe/api/XPipeException.java
Normal file
23
api/src/main/java/io/xpipe/api/XPipeException.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package io.xpipe.api;
|
||||
|
||||
public class XPipeException extends RuntimeException {
|
||||
|
||||
public XPipeException() {
|
||||
}
|
||||
|
||||
public XPipeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public XPipeException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public XPipeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public XPipeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,13 @@ public abstract class DataSourceImpl implements DataSource {
|
||||
@Override
|
||||
protected void handle(BeaconClient sc) throws ClientException, ServerException, ConnectorException {
|
||||
var req = StoreResourceExchange.Request.builder()
|
||||
.url(url).type(type).build();
|
||||
StoreResourceExchange.Response res = performSimpleExchange(sc, req);
|
||||
.url(url).providerId(type).build();
|
||||
StoreResourceExchange.Response res = performOutputExchange(sc, req, out -> {
|
||||
try (var s = url.openStream()) {
|
||||
writeLength(sc, s.available());
|
||||
s.transferTo(out);
|
||||
}
|
||||
});
|
||||
switch (res.getSourceType()) {
|
||||
case TABLE -> {
|
||||
var data = res.getTableData();
|
||||
|
||||
Reference in New Issue
Block a user