mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Reformat
This commit is contained in:
parent
7be8087b19
commit
131dec75ec
228 changed files with 800 additions and 942 deletions
|
@ -100,6 +100,7 @@ The license model is chosen in such a way that you are
|
|||
able to use and integrate X-Pipe within your application through the MIT-licensed API.
|
||||
In any other case where you plan to contribute to the X-Pipe platform itself, which is GPL licensed,
|
||||
I would still have to figure out how to exactly handle these kinds of contributions.
|
||||
It is also planned to move many components to a more permissive license in the future.
|
||||
|
||||
## Development
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ import java.util.Optional;
|
|||
|
||||
public final class XPipeApiConnection extends BeaconConnection {
|
||||
|
||||
private XPipeApiConnection() {
|
||||
}
|
||||
private XPipeApiConnection() {}
|
||||
|
||||
public static XPipeApiConnection open() {
|
||||
var con = new XPipeApiConnection();
|
||||
|
|
|
@ -10,10 +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
|
||||
) {
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ 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;
|
||||
|
|
|
@ -9,10 +9,7 @@ import io.xpipe.core.source.DataSourceType;
|
|||
public class DataStructureImpl extends DataSourceImpl implements DataStructure {
|
||||
|
||||
DataStructureImpl(
|
||||
DataSourceId sourceId,
|
||||
DataSourceConfig sourceConfig,
|
||||
io.xpipe.core.source.DataSource<?> internalSource
|
||||
) {
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,16 @@ public class DataTableAccumulatorImpl implements DataTableAccumulator {
|
|||
connection = XPipeApiConnection.open();
|
||||
|
||||
store = new InternalStreamStore();
|
||||
var addReq = StoreAddExchange.Request.builder().storeInput(store).name(store.getUuid().toString()).build();
|
||||
var addReq = StoreAddExchange.Request.builder()
|
||||
.storeInput(store)
|
||||
.name(store.getUuid().toString())
|
||||
.build();
|
||||
StoreAddExchange.Response addRes = connection.performSimpleExchange(addReq);
|
||||
QuietDialogHandler.handle(addRes.getConfig(), connection);
|
||||
|
||||
connection.sendRequest(WriteStreamExchange.Request.builder().name(store.getUuid().toString()).build());
|
||||
connection.sendRequest(WriteStreamExchange.Request.builder()
|
||||
.name(store.getUuid().toString())
|
||||
.build());
|
||||
bodyOutput = connection.sendBody();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,7 @@ import java.util.stream.StreamSupport;
|
|||
|
||||
public class DataTableImpl extends DataSourceImpl implements DataTable {
|
||||
|
||||
DataTableImpl(
|
||||
DataSourceId id,
|
||||
DataSourceConfig sourceConfig,
|
||||
io.xpipe.core.source.DataSource<?> internalSource
|
||||
) {
|
||||
DataTableImpl(DataSourceId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(id, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
@ -74,7 +70,6 @@ public class DataTableImpl extends DataSourceImpl implements DataTable {
|
|||
public Iterator<TupleNode> iterator() {
|
||||
return new TableIterator();
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private class TableIterator implements Iterator<TupleNode> {
|
||||
|
|
|
@ -25,10 +25,7 @@ import java.util.stream.StreamSupport;
|
|||
public class DataTextImpl extends DataSourceImpl implements DataText {
|
||||
|
||||
DataTextImpl(
|
||||
DataSourceId sourceId,
|
||||
DataSourceConfig sourceConfig,
|
||||
io.xpipe.core.source.DataSource<?> internalSource
|
||||
) {
|
||||
DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
|
||||
super(sourceId, sourceConfig, internalSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ public class AppLayoutComp extends Comp<CompStructure<BorderPane>> {
|
|||
|
||||
private List<SideMenuBarComp.Entry> createEntryList() {
|
||||
var l = new ArrayList<>(List.of(
|
||||
new SideMenuBarComp.Entry(
|
||||
I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()),
|
||||
new SideMenuBarComp.Entry(I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()),
|
||||
new SideMenuBarComp.Entry(I18n.observable("data"), "mdsal-dvr", new SourceCollectionLayoutComp()),
|
||||
new SideMenuBarComp.Entry(
|
||||
I18n.observable("settings"), "mdsmz-miscellaneous_services", new PrefsComp(this)),
|
||||
|
@ -52,7 +51,8 @@ public class AppLayoutComp extends Comp<CompStructure<BorderPane>> {
|
|||
// new SideMenuBarComp.Entry(I18n.observable("account"), "mdi2a-account", new StorageLayoutComp()),
|
||||
new SideMenuBarComp.Entry(I18n.observable("about"), "mdi2p-package-variant", new AboutTabComp())));
|
||||
if (AppProperties.get().isDeveloperMode()) {
|
||||
// l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new DeveloperTabComp()));
|
||||
// l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new
|
||||
// DeveloperTabComp()));
|
||||
}
|
||||
// l.add(new SideMenuBarComp.Entry(I18n.observable("abc"), "mdi2b-book-open-variant", Comp.of(() -> {
|
||||
// var fi = new FontIcon("mdsal-dvr");
|
||||
|
|
|
@ -2,14 +2,14 @@ package io.xpipe.app.comp.about;
|
|||
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.core.AppLogs;
|
||||
import io.xpipe.app.util.ExternalEditor;
|
||||
import io.xpipe.app.issue.UserReportComp;
|
||||
import io.xpipe.app.util.ExternalEditor;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
import io.xpipe.extension.I18n;
|
||||
import io.xpipe.extension.event.ErrorEvent;
|
||||
import io.xpipe.extension.fxcomps.SimpleComp;
|
||||
import io.xpipe.extension.util.DynamicOptionsBuilder;
|
||||
import io.xpipe.extension.util.DesktopHelper;
|
||||
import io.xpipe.extension.util.DynamicOptionsBuilder;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
public class BrowseDirectoryComp extends SimpleComp {
|
||||
|
@ -30,7 +30,11 @@ public class BrowseDirectoryComp extends SimpleComp {
|
|||
.addComp(
|
||||
"logFile",
|
||||
new ButtonComp(I18n.observable("openCurrentLogFile"), () -> {
|
||||
ExternalEditor.get().openInEditor(AppLogs.get().getSessionLogsDirectory().resolve("xpipe.log").toString());
|
||||
ExternalEditor.get()
|
||||
.openInEditor(AppLogs.get()
|
||||
.getSessionLogsDirectory()
|
||||
.resolve("xpipe.log")
|
||||
.toString());
|
||||
}),
|
||||
null)
|
||||
.addComp(
|
||||
|
|
|
@ -22,8 +22,7 @@ public record ThirdPartyDependency(String name, String version, String licenseNa
|
|||
}
|
||||
|
||||
try (var list = Files.list(path)) {
|
||||
for (var p : list
|
||||
.filter(p -> p.getFileName().toString().endsWith(".properties"))
|
||||
for (var p : list.filter(p -> p.getFileName().toString().endsWith(".properties"))
|
||||
.sorted(Comparator.comparing(path1 -> path1.toString()))
|
||||
.toList()) {
|
||||
var props = new Properties();
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package io.xpipe.app.comp.about;
|
||||
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.update.AppUpdater;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.extension.I18n;
|
||||
import io.xpipe.extension.fxcomps.SimpleComp;
|
||||
import io.xpipe.extension.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableBooleanValue;
|
||||
|
|
|
@ -29,7 +29,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
|
|||
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
var fileDrop = new FileDropOverlayComp<>(Comp.of(() -> {
|
||||
var fileDrop = new FileDropOverlayComp<>(
|
||||
Comp.of(() -> {
|
||||
var textArea = new TextAreaComp(value, lazy).createRegion();
|
||||
var copyButton = createOpenButton(textArea);
|
||||
var pane = new AnchorPane(copyButton);
|
||||
|
@ -40,7 +41,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
|
|||
var c = new StackPane();
|
||||
c.getChildren().addAll(textArea, pane);
|
||||
return c;
|
||||
}), paths -> value.setValue(Files.readString(paths.get(0))));
|
||||
}),
|
||||
paths -> value.setValue(Files.readString(paths.get(0))));
|
||||
return fileDrop.createRegion();
|
||||
}
|
||||
|
||||
|
@ -48,7 +50,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
|
|||
var button = new IconButtonComp("mdal-edit", () -> ExternalEditor.get()
|
||||
.startEditing(identifier, fileType, this, value.getValue(), (s) -> {
|
||||
Platform.runLater(() -> value.setValue(s));
|
||||
})).createRegion();
|
||||
}))
|
||||
.createRegion();
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ public class ListBoxViewComp<T> extends Comp<CompStructure<VBox>> {
|
|||
private final ObservableList<T> all;
|
||||
private final Function<T, Comp<?>> compFunction;
|
||||
|
||||
public ListBoxViewComp(
|
||||
ObservableList<T> shown, ObservableList<T> all, Function<T, Comp<?>> compFunction) {
|
||||
public ListBoxViewComp(ObservableList<T> shown, ObservableList<T> all, Function<T, Comp<?>> compFunction) {
|
||||
this.shown = PlatformThread.sync(shown);
|
||||
this.all = PlatformThread.sync(all);
|
||||
this.compFunction = compFunction;
|
||||
|
|
|
@ -23,28 +23,23 @@ public class DataSourceTargetChoiceComp extends Comp<CompStructure<ComboBox<Node
|
|||
private final Property<DataSourceTarget> selectedApplication;
|
||||
private final List<DataSourceTarget> all;
|
||||
|
||||
private DataSourceTargetChoiceComp(
|
||||
Property<DataSourceTarget> selectedApplication, List<DataSourceTarget> all) {
|
||||
private DataSourceTargetChoiceComp(Property<DataSourceTarget> selectedApplication, List<DataSourceTarget> all) {
|
||||
this.selectedApplication = selectedApplication;
|
||||
this.all = all;
|
||||
}
|
||||
|
||||
public static DataSourceTargetChoiceComp create(
|
||||
Property<DataSourceTarget> selectedApplication,
|
||||
Predicate<DataSourceTarget> filter) {
|
||||
Property<DataSourceTarget> selectedApplication, Predicate<DataSourceTarget> filter) {
|
||||
selectedApplication.addListener((observable, oldValue, val) -> {
|
||||
AppCache.update("application-last-used", val != null ? val.getId() : null);
|
||||
});
|
||||
var all = DataSourceTarget.getAll().stream()
|
||||
.filter((p) -> filter.test(p))
|
||||
.toList();
|
||||
var all =
|
||||
DataSourceTarget.getAll().stream().filter((p) -> filter.test(p)).toList();
|
||||
|
||||
if (selectedApplication.getValue() == null) {
|
||||
String selectedId = AppCache.get("application-last-used", String.class, () -> null);
|
||||
var selectedProvider = selectedId != null
|
||||
? DataSourceTarget.byId(selectedId)
|
||||
.filter(filter)
|
||||
.orElse(null)
|
||||
? DataSourceTarget.byId(selectedId).filter(filter).orElse(null)
|
||||
: null;
|
||||
selectedApplication.setValue(selectedProvider);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import io.xpipe.app.storage.DataSourceEntry;
|
|||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
import io.xpipe.extension.I18n;
|
||||
import io.xpipe.extension.DataSourceTarget;
|
||||
import io.xpipe.extension.I18n;
|
||||
import io.xpipe.extension.fxcomps.Comp;
|
||||
import io.xpipe.extension.fxcomps.CompStructure;
|
||||
import io.xpipe.extension.fxcomps.SimpleComp;
|
||||
|
@ -65,7 +65,9 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
AppWindowHelper.sideWindow(
|
||||
I18n.get("pipeDataSource"),
|
||||
window -> {
|
||||
var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e)).exclude(DataSourceTarget.byId("base.saveSource").orElseThrow());
|
||||
var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e))
|
||||
.exclude(DataSourceTarget.byId("base.saveSource")
|
||||
.orElseThrow());
|
||||
var multi = new MultiStepComp() {
|
||||
@Override
|
||||
protected List<Entry> setup() {
|
||||
|
@ -111,9 +113,7 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
};
|
||||
return multi.apply(s -> {
|
||||
SimpleChangeListener.apply(ms.getSelectedTarget(), (c) -> {
|
||||
if (c != null
|
||||
&& c.getAccessType()
|
||||
== DataSourceTarget.AccessType.PASSIVE) {
|
||||
if (c != null && c.getAccessType() == DataSourceTarget.AccessType.PASSIVE) {
|
||||
((Region) s.get().getChildren().get(2)).setMaxHeight(0);
|
||||
((Region) s.get().getChildren().get(2)).setMinHeight(0);
|
||||
((Region) s.get().getChildren().get(2)).setVisible(false);
|
||||
|
@ -149,8 +149,9 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
|
||||
var chooser = DataSourceTargetChoiceComp.create(
|
||||
selectedTarget,
|
||||
a -> !excludedTargets.contains(a) && a.isApplicable(dataSourceEntry.getValue().getSource()) &&
|
||||
a.createRetrievalInstructions(
|
||||
a -> !excludedTargets.contains(a)
|
||||
&& a.isApplicable(dataSourceEntry.getValue().getSource())
|
||||
&& a.createRetrievalInstructions(
|
||||
dataSourceEntry.getValue().getSource(), id)
|
||||
!= null);
|
||||
|
||||
|
@ -165,11 +166,9 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
return selectedTarget.getValue() != null
|
||||
&& selectedTarget.getValue().getSetupGuideURL() != null;
|
||||
},
|
||||
selectedTarget
|
||||
)));
|
||||
selectedTarget)));
|
||||
var top = new HorizontalComp(List.<Comp<?>>of(
|
||||
chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)),
|
||||
setupGuideButton))
|
||||
chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)), setupGuideButton))
|
||||
.apply(struc -> {
|
||||
struc.get().setAlignment(Pos.CENTER);
|
||||
struc.get().setSpacing(12);
|
||||
|
@ -179,9 +178,7 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
// setupGuideButton.prefHeightProperty().bind(chooserR.heightProperty());
|
||||
|
||||
var content = new VBox(
|
||||
new DynamicOptionsComp(
|
||||
List.of(new DynamicOptionsComp.Entry(null, null, top)), false)
|
||||
.createRegion(),
|
||||
new DynamicOptionsComp(List.of(new DynamicOptionsComp.Entry(null, null, top)), false).createRegion(),
|
||||
new Region());
|
||||
SimpleChangeListener.apply(selectedTarget, c -> {
|
||||
if (selectedTarget.getValue() == null) {
|
||||
|
@ -192,8 +189,7 @@ public class DsDataTransferComp extends SimpleComp {
|
|||
|
||||
var instructions = selectedTarget
|
||||
.getValue()
|
||||
.createRetrievalInstructions(
|
||||
dataSourceEntry.getValue().getSource(), id);
|
||||
.createRetrievalInstructions(dataSourceEntry.getValue().getSource(), id);
|
||||
content.getChildren().set(1, instructions.getRegion());
|
||||
VBox.setVgrow(instructions.getRegion(), Priority.ALWAYS);
|
||||
selectedDisplay.setValue(instructions);
|
||||
|
|
|
@ -40,7 +40,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
|
|||
|
||||
private GuiDsCreatorMultiStep(
|
||||
Stage window,
|
||||
DataSourceEntry editing, DataSourceCollection targetGroup,
|
||||
DataSourceEntry editing,
|
||||
DataSourceCollection targetGroup,
|
||||
DataSourceProvider.Category category,
|
||||
DataSourceProvider<?> provider,
|
||||
DI store,
|
||||
|
@ -72,13 +73,7 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
|
|||
I18n.get("newDataSource"),
|
||||
window -> {
|
||||
var ms = new GuiDsCreatorMultiStep<>(
|
||||
window,
|
||||
null, sourceCollection,
|
||||
category,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
State.CREATE);
|
||||
window, null, sourceCollection, category, null, null, null, State.CREATE);
|
||||
loading.bind(ms.loading);
|
||||
window.setOnCloseRequest(e -> {
|
||||
if (ms.state == State.CREATE && ms.source.getValue() != null) {
|
||||
|
@ -102,7 +97,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
|
|||
window -> {
|
||||
var ms = new GuiDsCreatorMultiStep<>(
|
||||
window,
|
||||
entry, DataStorage.get()
|
||||
entry,
|
||||
DataStorage.get()
|
||||
.getCollectionForSourceEntry(entry)
|
||||
.orElse(null),
|
||||
entry.getProvider().getCategory(),
|
||||
|
@ -130,7 +126,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
|
|||
window -> {
|
||||
var gui = new GuiDsCreatorMultiStep<>(
|
||||
window,
|
||||
null, sourceCollection,
|
||||
null,
|
||||
sourceCollection,
|
||||
category,
|
||||
provider.orElse(null),
|
||||
store,
|
||||
|
@ -266,7 +263,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
|
|||
switch (state) {
|
||||
case EDIT -> {}
|
||||
case CREATE -> {
|
||||
list.add(new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source)));
|
||||
list.add(
|
||||
new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source)));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -45,7 +45,8 @@ public class GuiDsCreatorTransferStep extends MultiStepComp.Step<CompStructure<?
|
|||
return null;
|
||||
}
|
||||
|
||||
var name = DataStorage.get().createUniqueSourceEntryName(DataStorage.get().getInternalCollection(), source.get());
|
||||
var name = DataStorage.get()
|
||||
.createUniqueSourceEntryName(DataStorage.get().getInternalCollection(), source.get());
|
||||
var entry = DataSourceEntry.createNew(UUID.randomUUID(), name, this.source.get());
|
||||
return entry;
|
||||
},
|
||||
|
|
|
@ -66,7 +66,8 @@ public class GuiDsStoreSelectStep extends MultiStepComp.Step<CompStructure<? ext
|
|||
|
||||
private Region createCategoryChooserComp() {
|
||||
if (category == DataSourceProvider.Category.STREAM) {
|
||||
return new DsStreamStoreChoiceComp(input, provider, true, true, DsStreamStoreChoiceComp.Mode.OPEN).createRegion();
|
||||
return new DsStreamStoreChoiceComp(input, provider, true, true, DsStreamStoreChoiceComp.Mode.OPEN)
|
||||
.createRegion();
|
||||
}
|
||||
|
||||
if (category == DataSourceProvider.Category.DATABASE) {
|
||||
|
|
|
@ -56,8 +56,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
|
|||
Property<DataStore> selected,
|
||||
Property<DataSourceProvider<?>> provider,
|
||||
boolean showAnonymous,
|
||||
boolean showSaved, Mode mode
|
||||
) {
|
||||
boolean showSaved,
|
||||
Mode mode) {
|
||||
this.selected = selected;
|
||||
this.provider = provider;
|
||||
this.showAnonymous = showAnonymous;
|
||||
|
@ -69,9 +69,12 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
|
|||
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
var isNamedStore = XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent();
|
||||
var isNamedStore =
|
||||
XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent();
|
||||
var localStore = new SimpleObjectProperty<DataStore>(
|
||||
!isNamedStore && selected.getValue() instanceof FileStore fileStore && fileStore.getFileSystem() instanceof LocalStore
|
||||
!isNamedStore
|
||||
&& selected.getValue() instanceof FileStore fileStore
|
||||
&& fileStore.getFileSystem() instanceof LocalStore
|
||||
? selected.getValue()
|
||||
: null);
|
||||
var browseComp = new DsLocalFileBrowseComp(provider, localStore, mode).apply(GrowAugment.create(true, false));
|
||||
|
@ -99,7 +102,9 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
|
|||
provider != null ? provider : new SimpleObjectProperty<>());
|
||||
|
||||
var remoteStore = new SimpleObjectProperty<DataStore>(
|
||||
isNamedStore && selected.getValue() instanceof FileStore fileStore && !(fileStore.getFileSystem() instanceof LocalStore)
|
||||
isNamedStore
|
||||
&& selected.getValue() instanceof FileStore fileStore
|
||||
&& !(fileStore.getFileSystem() instanceof LocalStore)
|
||||
? selected.getValue()
|
||||
: null);
|
||||
var remote = new TabPaneComp.Entry(
|
||||
|
@ -111,7 +116,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
|
|||
"mdrmz-storage",
|
||||
NamedStoreChoiceComp.create(filter, namedStore, DataStoreProvider.Category.STREAM));
|
||||
|
||||
var otherStore = new SimpleObjectProperty<DataStore>(localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null);
|
||||
var otherStore = new SimpleObjectProperty<DataStore>(
|
||||
localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null);
|
||||
var other = new TabPaneComp.Entry(
|
||||
I18n.observable("other"),
|
||||
"mdrmz-web_asset",
|
||||
|
@ -132,7 +138,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
|
|||
|
||||
selected.addListener((observable, oldValue, newValue) -> {
|
||||
if (provider != null && provider.getValue() == null) {
|
||||
provider.setValue(DataSourceProviders.byPreferredStore(newValue, null).orElse(null));
|
||||
provider.setValue(
|
||||
DataSourceProviders.byPreferredStore(newValue, null).orElse(null));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -158,7 +158,8 @@ public class SourceCollectionViewState {
|
|||
|
||||
private ObservableList<SourceCollectionWrapper> filter(ObservableList<SourceCollectionWrapper> list) {
|
||||
return list.filtered(storeEntryWrapper -> {
|
||||
if (AppPrefs.get().developerMode().getValue() && AppPrefs.get().developerShowHiddenEntries().get()) {
|
||||
if (AppPrefs.get().developerMode().getValue()
|
||||
&& AppPrefs.get().developerShowHiddenEntries().get()) {
|
||||
return true;
|
||||
} else {
|
||||
return !storeEntryWrapper.isInternal();
|
||||
|
|
|
@ -17,12 +17,10 @@ public class StoreEntryListComp extends SimpleComp {
|
|||
var topLevel = StoreEntrySection.createTopLevels();
|
||||
var filtered = BindingsHelper.filteredContentBinding(
|
||||
topLevel,
|
||||
StoreViewState.get().getFilterString().map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s))));
|
||||
var content = new ListViewComp<>(
|
||||
filtered,
|
||||
topLevel,
|
||||
null,
|
||||
(StoreEntrySection e) -> {
|
||||
StoreViewState.get()
|
||||
.getFilterString()
|
||||
.map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s))));
|
||||
var content = new ListViewComp<>(filtered, topLevel, null, (StoreEntrySection e) -> {
|
||||
return e.comp(true);
|
||||
});
|
||||
return content.styleClass("store-list-comp");
|
||||
|
|
|
@ -43,7 +43,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
|
|||
ActionProvider.ALL.stream()
|
||||
.filter(dataStoreActionProvider -> {
|
||||
return !entry.isDisabled()
|
||||
&& dataStoreActionProvider.getDataStoreCallSite() != null && dataStoreActionProvider.getDataStoreCallSite()
|
||||
&& dataStoreActionProvider.getDataStoreCallSite() != null
|
||||
&& dataStoreActionProvider
|
||||
.getDataStoreCallSite()
|
||||
.getApplicableClass()
|
||||
.isAssignableFrom(entry.getStore().getClass());
|
||||
})
|
||||
|
@ -54,8 +56,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
|
|||
return false;
|
||||
}
|
||||
|
||||
return dataStoreActionProvider.getDataStoreCallSite().isApplicable(
|
||||
entry.getStore().asNeeded());
|
||||
return dataStoreActionProvider
|
||||
.getDataStoreCallSite()
|
||||
.isApplicable(entry.getStore().asNeeded());
|
||||
},
|
||||
disabledProperty(),
|
||||
state,
|
||||
|
|
|
@ -30,8 +30,7 @@ public class StoreViewState {
|
|||
private final ObservableList<StoreEntryWrapper> shownEntries =
|
||||
FXCollections.observableList(new CopyOnWriteArrayList<>());
|
||||
|
||||
private final ObservableBooleanValue empty =
|
||||
BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1));
|
||||
private final ObservableBooleanValue empty = BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1));
|
||||
|
||||
private StoreViewState() {
|
||||
try {
|
||||
|
|
|
@ -69,7 +69,8 @@ public class App extends Application {
|
|||
AppActionLinkDetector.detectOnFocus();
|
||||
});
|
||||
});
|
||||
var title = String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion());
|
||||
var title =
|
||||
String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion());
|
||||
var appWindow = new AppMainWindow(stage);
|
||||
appWindow.initialize();
|
||||
appWindow.setContent(title, content);
|
||||
|
|
|
@ -65,8 +65,11 @@ public class AppActionLinkDetector {
|
|||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle(I18n.get("clipboardActionDetectedTitle"));
|
||||
alert.setHeaderText(I18n.get("clipboardActionDetectedHeader"));
|
||||
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent")));
|
||||
}).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false);
|
||||
alert.getDialogPane()
|
||||
.setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent")));
|
||||
})
|
||||
.map(buttonType -> buttonType.getButtonData().isDefaultButton())
|
||||
.orElse(false);
|
||||
return paste;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,9 @@ public class AppChecks {
|
|||
new IOException(
|
||||
"Unable to access directory " + dataDirectory
|
||||
+ ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. "
|
||||
+ "In case you use cloud storage, verify that your cloud storage is working and you are logged in.")).term().handle();
|
||||
+ "In case you use cloud storage, verify that your cloud storage is working and you are logged in."))
|
||||
.term()
|
||||
.handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,7 @@ public class AppFont {
|
|||
|
||||
public static void setSize(Node node, int off) {
|
||||
var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12;
|
||||
node.setStyle(
|
||||
node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;");
|
||||
node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;");
|
||||
}
|
||||
|
||||
public static void loadFonts() {
|
||||
|
|
|
@ -158,7 +158,9 @@ public class AppI18n implements I18n {
|
|||
}
|
||||
|
||||
private boolean matchesLocale(Path f) {
|
||||
var l = AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale();
|
||||
var l = AppPrefs.get() != null
|
||||
? AppPrefs.get().language.getValue().getLocale()
|
||||
: SupportedLocale.ENGLISH.getLocale();
|
||||
var name = FilenameUtils.getBaseName(f.getFileName().toString());
|
||||
var ending = "_" + l.toLanguageTag();
|
||||
return name.endsWith(ending);
|
||||
|
@ -208,6 +210,9 @@ public class AppI18n implements I18n {
|
|||
.handle();
|
||||
});
|
||||
}
|
||||
this.prettyTime = new PrettyTime(AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale());
|
||||
this.prettyTime = new PrettyTime(
|
||||
AppPrefs.get() != null
|
||||
? AppPrefs.get().language.getValue().getLocale()
|
||||
: SupportedLocale.ENGLISH.getLocale());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,10 @@ public class AppLogs {
|
|||
private final PrintStream originalSysErr;
|
||||
private final Path logDir;
|
||||
private final boolean writeToSysout;
|
||||
|
||||
@Getter
|
||||
private final boolean writeToFile;
|
||||
|
||||
private final PrintStream outStream;
|
||||
private final Map<String, PrintStream> categoryWriters;
|
||||
|
||||
|
|
|
@ -44,7 +44,9 @@ public class AppProperties {
|
|||
|
||||
version = Optional.ofNullable(props.getProperty("version")).orElse("dev");
|
||||
build = Optional.ofNullable(props.getProperty("build")).orElse("unknown");
|
||||
buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId")).map(UUID::fromString).orElse(UUID.randomUUID());
|
||||
buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId"))
|
||||
.map(UUID::fromString)
|
||||
.orElse(UUID.randomUUID());
|
||||
sentryUrl = System.getProperty("io.xpipe.app.sentryUrl");
|
||||
|
||||
extensionPaths = parseExtensionPaths();
|
||||
|
|
|
@ -219,7 +219,9 @@ public class AppWindowHelper {
|
|||
} else {
|
||||
var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "img/logo.png");
|
||||
if (url.isPresent()) {
|
||||
((Stage) a.getDialogPane().getScene().getWindow()).getIcons().add(new Image(url.get().toString()));
|
||||
((Stage) a.getDialogPane().getScene().getWindow())
|
||||
.getIcons()
|
||||
.add(new Image(url.get().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@ package io.xpipe.app.core.mode;
|
|||
import io.xpipe.app.comp.storage.collection.SourceCollectionViewState;
|
||||
import io.xpipe.app.comp.storage.store.StoreViewState;
|
||||
import io.xpipe.app.core.*;
|
||||
import io.xpipe.app.util.ExternalEditor;
|
||||
import io.xpipe.app.update.AppUpdater;
|
||||
import io.xpipe.app.issue.BasicErrorHandler;
|
||||
import io.xpipe.app.issue.ErrorHandler;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.update.AppUpdater;
|
||||
import io.xpipe.app.util.ExternalEditor;
|
||||
import io.xpipe.core.util.JacksonMapper;
|
||||
import io.xpipe.extension.event.TrackEvent;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package io.xpipe.app.core.mode;
|
||||
|
||||
import io.xpipe.app.update.UpdateChangelogAlert;
|
||||
import io.xpipe.app.core.App;
|
||||
import io.xpipe.app.core.AppGreetings;
|
||||
import io.xpipe.app.issue.ErrorHandler;
|
||||
import io.xpipe.app.issue.ErrorHandlerComp;
|
||||
import io.xpipe.app.update.UpdateChangelogAlert;
|
||||
import io.xpipe.extension.event.ErrorEvent;
|
||||
import io.xpipe.extension.event.TrackEvent;
|
||||
import javafx.application.Platform;
|
||||
|
|
|
@ -25,7 +25,8 @@ public abstract class PlatformMode extends OperationMode {
|
|||
}
|
||||
|
||||
try {
|
||||
GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
|
||||
GraphicsDevice[] screenDevices =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
|
||||
HAS_GRAPHICS = screenDevices != null && screenDevices.length > 0;
|
||||
} catch (HeadlessException e) {
|
||||
TrackEvent.warn(e.getMessage());
|
||||
|
|
|
@ -20,12 +20,15 @@ public class ModeExchangeImpl extends ModeExchange
|
|||
throw new ClientException("Unsupported mode: " + msg.getMode().getDisplayName() + ". Supported: "
|
||||
+ String.join(
|
||||
", ",
|
||||
OperationMode.getAll().stream().filter(OperationMode::isSupported)
|
||||
OperationMode.getAll().stream()
|
||||
.filter(OperationMode::isSupported)
|
||||
.map(OperationMode::getId)
|
||||
.toList()));
|
||||
}
|
||||
|
||||
OperationMode.switchTo(mode);
|
||||
return ModeExchange.Response.builder().usedMode(OperationMode.map(OperationMode.get())).build();
|
||||
return ModeExchange.Response.builder()
|
||||
.usedMode(OperationMode.map(OperationMode.get()))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,12 @@ public class AttachmentHelper {
|
|||
if (file.isDirectory()) {
|
||||
compressDirectoryToZipfile(rootDir, sourceDir.resolve(file.getName()), out);
|
||||
} else {
|
||||
ZipEntry entry = new ZipEntry(rootDir.relativize(sourceDir).resolve(file.getName()).toString());
|
||||
ZipEntry entry = new ZipEntry(
|
||||
rootDir.relativize(sourceDir).resolve(file.getName()).toString());
|
||||
out.putNextEntry(entry);
|
||||
|
||||
FileInputStream in = new FileInputStream(sourceDir.resolve(file.getName()).toString());
|
||||
FileInputStream in =
|
||||
new FileInputStream(sourceDir.resolve(file.getName()).toString());
|
||||
IOUtils.copy(in, out);
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ import io.sentry.*;
|
|||
import io.sentry.protocol.SentryId;
|
||||
import io.sentry.protocol.User;
|
||||
import io.xpipe.app.core.AppCache;
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.extension.event.ErrorEvent;
|
||||
import io.xpipe.extension.event.TrackEvent;
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
|
|
@ -50,9 +50,11 @@ public class UserReportComp extends SimpleComp {
|
|||
}
|
||||
|
||||
return file.getFileName().toString();
|
||||
}).styleClass("attachment-list");
|
||||
})
|
||||
.styleClass("attachment-list");
|
||||
var tp = new TitledPaneComp(I18n.observable("additionalErrorAttachments"), list, 100)
|
||||
.apply(s -> AppFont.medium(s.get())).styleClass("attachments");
|
||||
.apply(s -> AppFont.medium(s.get()))
|
||||
.styleClass("attachments");
|
||||
return tp;
|
||||
//
|
||||
// var list = FXCollections.observableList(event.getSensitiveDiagnostics());
|
||||
|
|
|
@ -71,7 +71,8 @@ public class LauncherCommand implements Callable<Integer> {
|
|||
if (BeaconServer.isRunning()) {
|
||||
try (var con = new LauncherConnection()) {
|
||||
con.constructSocket();
|
||||
con.performSimpleExchange(FocusExchange.Request.builder().mode(getEffectiveMode()).build());
|
||||
con.performSimpleExchange(
|
||||
FocusExchange.Request.builder().mode(getEffectiveMode()).build());
|
||||
if (inputs.size() > 0) {
|
||||
con.performSimpleExchange(
|
||||
OpenExchange.Request.builder().arguments(inputs).build());
|
||||
|
@ -79,8 +80,9 @@ public class LauncherCommand implements Callable<Integer> {
|
|||
|
||||
if (OsType.getLocal().equals(OsType.MACOS)) {
|
||||
Desktop.getDesktop().setOpenURIHandler(e -> {
|
||||
con.performSimpleExchange(
|
||||
OpenExchange.Request.builder().arguments(List.of(e.getURI().toString())).build());
|
||||
con.performSimpleExchange(OpenExchange.Request.builder()
|
||||
.arguments(List.of(e.getURI().toString()))
|
||||
.build());
|
||||
});
|
||||
ThreadHelper.sleep(1000);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,9 @@ import java.util.List;
|
|||
public abstract class LauncherInput {
|
||||
|
||||
public static void handle(List<String> arguments) {
|
||||
TrackEvent.withDebug("launcher", "Handling arguments").elements(arguments).handle();
|
||||
TrackEvent.withDebug("launcher", "Handling arguments")
|
||||
.elements(arguments)
|
||||
.handle();
|
||||
|
||||
var all = new ArrayList<ActionProvider.Action>();
|
||||
arguments.forEach(s -> {
|
||||
|
|
|
@ -405,8 +405,7 @@ public class AppPrefs {
|
|||
Setting.of(
|
||||
"externalStartupBehaviour",
|
||||
externalStartupBehaviourControl,
|
||||
externalStartupBehaviour
|
||||
),
|
||||
externalStartupBehaviour),
|
||||
Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour),
|
||||
Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate)
|
||||
.applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty(
|
||||
|
@ -416,9 +415,7 @@ public class AppPrefs {
|
|||
XPipeDistributionType.get().supportsUpdate()))),
|
||||
Setting.of("storageDirectory", storageDirectoryControl, internalStorageDirectory),
|
||||
Setting.of("logLevel", logLevelField, internalLogLevel),
|
||||
Setting.of("developerMode", developerModeField, internalDeveloperMode)
|
||||
)
|
||||
),
|
||||
Setting.of("developerMode", developerModeField, internalDeveloperMode))),
|
||||
Category.of(
|
||||
"appearance",
|
||||
Group.of(
|
||||
|
@ -427,10 +424,8 @@ public class AppPrefs {
|
|||
Setting.of("theme", themeControl, themeInternal),
|
||||
Setting.of("useSystemFont", useSystemFontInternal),
|
||||
Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax),
|
||||
Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)
|
||||
),
|
||||
Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))
|
||||
),
|
||||
Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)),
|
||||
Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))),
|
||||
Category.of(
|
||||
"integrations",
|
||||
Group.of(
|
||||
|
@ -443,39 +438,29 @@ public class AppPrefs {
|
|||
"editorReloadTimeout",
|
||||
editorReloadTimeout,
|
||||
editorReloadTimeoutMin,
|
||||
editorReloadTimeoutMax
|
||||
)
|
||||
)
|
||||
),
|
||||
editorReloadTimeoutMax))),
|
||||
Category.of(
|
||||
"developer",
|
||||
Setting.of(
|
||||
"developerDisableUpdateVersionCheck",
|
||||
developerDisableUpdateVersionCheckField,
|
||||
developerDisableUpdateVersionCheck
|
||||
),
|
||||
developerDisableUpdateVersionCheck),
|
||||
Setting.of(
|
||||
"developerDisableGuiRestrictions",
|
||||
developerDisableGuiRestrictionsField,
|
||||
developerDisableGuiRestrictions
|
||||
),
|
||||
developerDisableGuiRestrictions),
|
||||
Setting.of(
|
||||
"developerDisableConnectorInstallationVersionCheck",
|
||||
developerDisableConnectorInstallationVersionCheckField,
|
||||
developerDisableConnectorInstallationVersionCheck
|
||||
),
|
||||
developerDisableConnectorInstallationVersionCheck),
|
||||
Setting.of(
|
||||
"developerShowHiddenEntries",
|
||||
developerShowHiddenEntriesField,
|
||||
developerShowHiddenEntries
|
||||
),
|
||||
developerShowHiddenEntries),
|
||||
Setting.of(
|
||||
"developerShowHiddenProviders",
|
||||
developerShowHiddenProvidersField,
|
||||
developerShowHiddenProviders
|
||||
)
|
||||
)
|
||||
));
|
||||
developerShowHiddenProviders))));
|
||||
|
||||
categories.get(categories.size() - 1).setVisibilityProperty(VisibilityProperty.of(developerMode()));
|
||||
|
||||
|
|
|
@ -6,21 +6,15 @@ import lombok.Getter;
|
|||
|
||||
@Getter
|
||||
public enum CloseBehaviour implements PrefsChoiceValue {
|
||||
QUIT(
|
||||
"app.quit",
|
||||
() -> {
|
||||
QUIT("app.quit", () -> {
|
||||
OperationMode.shutdown(false, false);
|
||||
}),
|
||||
|
||||
CONTINUE_IN_BACKGROUND(
|
||||
"app.continueInBackground",
|
||||
() -> {
|
||||
CONTINUE_IN_BACKGROUND("app.continueInBackground", () -> {
|
||||
OperationMode.switchToAsync(OperationMode.BACKGROUND);
|
||||
}),
|
||||
|
||||
MINIMIZE_TO_TRAY(
|
||||
"app.minimizeToTray",
|
||||
() -> {
|
||||
MINIMIZE_TO_TRAY("app.minimizeToTray", () -> {
|
||||
OperationMode.switchToAsync(OperationMode.TRAY);
|
||||
});
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
|
|||
protected Optional<Path> getApplicationPath() {
|
||||
try (ShellProcessControl pc = ShellStore.local().create().start()) {
|
||||
try (var c = pc.command(String.format(
|
||||
"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister " +
|
||||
"-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq",
|
||||
"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister "
|
||||
+ "-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq",
|
||||
applicationName, applicationName))
|
||||
.start()) {
|
||||
var path = c.readOnlyStdout();
|
||||
|
@ -66,7 +66,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
|
|||
}
|
||||
}
|
||||
|
||||
public static abstract class PathApplication extends ExternalApplicationType {
|
||||
public abstract static class PathApplication extends ExternalApplicationType {
|
||||
|
||||
protected final String executable;
|
||||
|
||||
|
|
|
@ -29,9 +29,8 @@ public class PrefFields {
|
|||
return Path.of(value);
|
||||
}
|
||||
});
|
||||
return StringField.ofStringType(
|
||||
stringProperty).render(
|
||||
() -> new SimpleChooserControl(
|
||||
return StringField.ofStringType(stringProperty)
|
||||
.render(() -> new SimpleChooserControl(
|
||||
I18n.get("browse"), fileProperty.getValue().toFile(), true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,10 +30,13 @@ public class DataSourceEntry extends StorageElement {
|
|||
|
||||
@NonFinal
|
||||
State state;
|
||||
|
||||
@NonFinal
|
||||
String information;
|
||||
|
||||
@NonFinal
|
||||
JsonNode sourceNode;
|
||||
|
||||
@NonFinal
|
||||
DataSource<?> dataSource;
|
||||
|
||||
|
@ -70,10 +73,17 @@ public class DataSourceEntry extends StorageElement {
|
|||
}
|
||||
|
||||
public static DataSourceEntry createNew(
|
||||
@NonNull UUID uuid, @NonNull String name, @NonNull DataSource<?> dataSource
|
||||
) {
|
||||
@NonNull UUID uuid, @NonNull String name, @NonNull DataSource<?> dataSource) {
|
||||
var entry = new DataSourceEntry(
|
||||
null, uuid, name, Instant.now(), Instant.now(), true, DataStorageWriter.sourceToNode(dataSource), null, State.INCOMPLETE);
|
||||
null,
|
||||
uuid,
|
||||
name,
|
||||
Instant.now(),
|
||||
Instant.now(),
|
||||
true,
|
||||
DataStorageWriter.sourceToNode(dataSource),
|
||||
null,
|
||||
State.INCOMPLETE);
|
||||
entry.simpleRefresh();
|
||||
return entry;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ public abstract class DataStorage {
|
|||
}
|
||||
|
||||
public DataSourceCollection getInternalCollection() {
|
||||
var found = sourceCollections.stream().filter(o -> o.getName() != null && o.getName().equals("Internal")).findAny();
|
||||
var found = sourceCollections.stream()
|
||||
.filter(o -> o.getName() != null && o.getName().equals("Internal"))
|
||||
.findAny();
|
||||
if (found.isPresent()) {
|
||||
return found.get();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ public class DataStorageWriter {
|
|||
}
|
||||
return Optional.empty();
|
||||
},
|
||||
"storeId", isRoot);
|
||||
"storeId",
|
||||
isRoot);
|
||||
|
||||
node = replaceReferencesWithIds(
|
||||
node,
|
||||
|
@ -61,7 +62,8 @@ public class DataStorageWriter {
|
|||
}
|
||||
return Optional.empty();
|
||||
},
|
||||
"sourceId", isRoot);
|
||||
"sourceId",
|
||||
isRoot);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,8 @@ public class AppInstaller {
|
|||
if (s.isLocal()) {
|
||||
targetFile = localFile.toString();
|
||||
} else {
|
||||
targetFile = FileNames.join(s.getTemporaryDirectory(), localFile.getFileName().toString());
|
||||
targetFile = FileNames.join(
|
||||
s.getTemporaryDirectory(), localFile.getFileName().toString());
|
||||
try (CommandProcessControl c = s.command(s.getShellType().getStreamFileWriteCommand(targetFile))
|
||||
.start()) {
|
||||
c.discardOut();
|
||||
|
@ -60,7 +61,9 @@ public class AppInstaller {
|
|||
}
|
||||
|
||||
if (OsType.getLocal().equals(OsType.LINUX)) {
|
||||
return Files.exists(Path.of("/etc/debian_version")) ? new InstallerAssetType.Debian() : new InstallerAssetType.Rpm();
|
||||
return Files.exists(Path.of("/etc/debian_version"))
|
||||
? new InstallerAssetType.Debian()
|
||||
: new InstallerAssetType.Rpm();
|
||||
}
|
||||
|
||||
if (OsType.getLocal().equals(OsType.MACOS)) {
|
||||
|
@ -236,7 +239,8 @@ public class AppInstaller {
|
|||
@Override
|
||||
public void installRemote(ShellProcessControl shellProcessControl, String file) throws Exception {
|
||||
try (var pc = shellProcessControl.subShell(ShellTypes.BASH).start()) {
|
||||
try (CommandProcessControl c = pc.command("installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /")
|
||||
try (CommandProcessControl c = pc.command(
|
||||
"installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /")
|
||||
.elevated()
|
||||
.start()) {
|
||||
c.discardOrThrow();
|
||||
|
@ -247,7 +251,8 @@ public class AppInstaller {
|
|||
|
||||
@Override
|
||||
public void installLocal(String file) throws Exception {
|
||||
var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n" + "xpipe daemon start";
|
||||
var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n"
|
||||
+ "xpipe daemon start";
|
||||
TerminalProvider.open("X-Pipe Updater", command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.xpipe.app.update;
|
||||
|
||||
import io.xpipe.app.core.AppCache;
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import io.xpipe.app.core.AppExtensionManager;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.core.mode.OperationMode;
|
||||
|
@ -12,6 +11,7 @@ import io.xpipe.extension.event.ErrorEvent;
|
|||
import io.xpipe.extension.event.TrackEvent;
|
||||
import io.xpipe.extension.util.BusyProperty;
|
||||
import io.xpipe.extension.util.ThreadHelper;
|
||||
import io.xpipe.extension.util.XPipeDistributionType;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
|
|
|
@ -12,13 +12,14 @@ public class UpdateAvailableAlert {
|
|||
return;
|
||||
}
|
||||
|
||||
var update = AppWindowHelper.showBlockingAlert(
|
||||
alert -> {
|
||||
var update = AppWindowHelper.showBlockingAlert(alert -> {
|
||||
alert.setTitle(I18n.get("updateReadyTitle"));
|
||||
alert.setHeaderText(I18n.get("updateReadyHeader"));
|
||||
alert.setContentText(I18n.get("updateReadyContent"));
|
||||
alert.setAlertType(Alert.AlertType.INFORMATION);
|
||||
}).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false);
|
||||
})
|
||||
.map(buttonType -> buttonType.getButtonData().isDefaultButton())
|
||||
.orElse(false);
|
||||
if (update) {
|
||||
AppUpdater.get().executeUpdateAndClose();
|
||||
}
|
||||
|
|
|
@ -122,18 +122,18 @@ public class ExternalEditor {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
public void startEditing(
|
||||
String keyName,
|
||||
String fileType,
|
||||
Object key,
|
||||
String input,
|
||||
Consumer<String> output) {
|
||||
public void startEditing(String keyName, String fileType, Object key, String input, Consumer<String> output) {
|
||||
if (input == null) {
|
||||
input = "";
|
||||
}
|
||||
|
||||
String s = input;
|
||||
startEditing(keyName, fileType, key, () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), () -> new ByteArrayOutputStream(s.length()) {
|
||||
startEditing(
|
||||
keyName,
|
||||
fileType,
|
||||
key,
|
||||
() -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)),
|
||||
() -> new ByteArrayOutputStream(s.length()) {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
|
@ -154,7 +154,8 @@ public class ExternalEditor {
|
|||
return;
|
||||
}
|
||||
|
||||
var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "." + (fileType != null ? fileType : "txt");
|
||||
var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "."
|
||||
+ (fileType != null ? fileType : "txt");
|
||||
Path file = TEMP.resolve(name);
|
||||
try {
|
||||
FileUtils.forceMkdirParent(file.toFile());
|
||||
|
|
|
@ -22,7 +22,8 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider {
|
|||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle(I18n.get("connectorInstallationTitle"));
|
||||
alert.setHeaderText(I18n.get("connectorInstallationHeader"));
|
||||
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent")));
|
||||
alert.getDialogPane()
|
||||
.setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent")));
|
||||
})
|
||||
.filter(buttonType -> buttonType.getButtonData().isDefaultButton())
|
||||
.isPresent();
|
||||
|
|
|
@ -13,7 +13,9 @@ public abstract class TerminalProvider {
|
|||
|
||||
@Override
|
||||
public void init(ModuleLayer layer) {
|
||||
INSTANCE = ServiceLoader.load(layer, TerminalProvider.class).findFirst().orElseThrow();
|
||||
INSTANCE = ServiceLoader.load(layer, TerminalProvider.class)
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,9 +7,9 @@ import io.xpipe.app.comp.source.store.NamedStoreChoiceComp;
|
|||
import io.xpipe.app.core.AppImages;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.core.AppResources;
|
||||
import io.xpipe.app.update.AppDownloads;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.update.AppDownloads;
|
||||
import io.xpipe.core.charsetter.Charsetter;
|
||||
import io.xpipe.core.source.DataSource;
|
||||
import io.xpipe.core.source.DataSourceId;
|
||||
|
@ -71,7 +71,8 @@ public class XPipeDaemonProvider implements XPipeDaemon {
|
|||
Property<DataSourceProvider<?>> provider,
|
||||
boolean showAnonymous,
|
||||
boolean showSaved) {
|
||||
return (T) new DsStreamStoreChoiceComp(storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE);
|
||||
return (T) new DsStreamStoreChoiceComp(
|
||||
storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,7 +101,8 @@ open module io.xpipe.app {
|
|||
uses MessageExchangeImpl;
|
||||
uses io.xpipe.app.util.TerminalProvider;
|
||||
|
||||
provides ModuleLayerLoader with TerminalProvider.Loader;
|
||||
provides ModuleLayerLoader with
|
||||
TerminalProvider.Loader;
|
||||
provides DataStateProvider with
|
||||
DataStateProviderImpl;
|
||||
provides ProxyManagerProvider with
|
||||
|
|
|
@ -35,6 +35,7 @@ public class BeaconClient implements AutoCloseable {
|
|||
|
||||
@Getter
|
||||
private final Closeable base;
|
||||
|
||||
private final InputStream in;
|
||||
private final OutputStream out;
|
||||
|
||||
|
@ -296,10 +297,7 @@ public class BeaconClient implements AutoCloseable {
|
|||
void run() throws E;
|
||||
}
|
||||
|
||||
@JsonTypeInfo(
|
||||
use = JsonTypeInfo.Id.NAME,
|
||||
property = "type"
|
||||
)
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
public abstract static class ClientInformation {
|
||||
|
||||
public final CliClientInformation cli() {
|
||||
|
|
|
@ -78,8 +78,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
|||
}
|
||||
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputExchange(
|
||||
REQ req, BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer
|
||||
) {
|
||||
REQ req, BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
|
||||
checkClosed();
|
||||
|
||||
performInputOutputExchange(req, null, responseConsumer);
|
||||
|
@ -88,8 +87,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
|||
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputOutputExchange(
|
||||
REQ req,
|
||||
BeaconClient.FailableConsumer<OutputStream, IOException> reqWriter,
|
||||
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer
|
||||
) {
|
||||
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
|
@ -151,8 +149,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
|||
}
|
||||
|
||||
public <REQ extends RequestMessage, RES extends ResponseMessage> RES performOutputExchange(
|
||||
REQ req, BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter
|
||||
) {
|
||||
REQ req, BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter) {
|
||||
checkClosed();
|
||||
|
||||
try {
|
||||
|
@ -183,7 +180,10 @@ public abstract class BeaconConnection implements AutoCloseable {
|
|||
|
||||
public InternalStreamStore createInternalStreamStore(String name) {
|
||||
var store = new InternalStreamStore();
|
||||
var addReq = StoreAddExchange.Request.builder().storeInput(store).name(name != null ? name : store.getUuid().toString()).build();
|
||||
var addReq = StoreAddExchange.Request.builder()
|
||||
.storeInput(store)
|
||||
.name(name != null ? name : store.getUuid().toString())
|
||||
.build();
|
||||
StoreAddExchange.Response addRes = performSimpleExchange(addReq);
|
||||
QuietDialogHandler.handle(addRes.getConfig(), this);
|
||||
return store;
|
||||
|
@ -194,8 +194,7 @@ public abstract class BeaconConnection implements AutoCloseable {
|
|||
}
|
||||
|
||||
public void writeStream(String name, InputStream in) {
|
||||
performOutputExchange(
|
||||
WriteStreamExchange.Request.builder().name(name).build(), in::transferTo);
|
||||
performOutputExchange(WriteStreamExchange.Request.builder().name(name).build(), in::transferTo);
|
||||
}
|
||||
|
||||
private BeaconException unwrapException(Exception exception) {
|
||||
|
|
|
@ -39,7 +39,10 @@ public class BeaconDaemonController {
|
|||
return;
|
||||
}
|
||||
|
||||
var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder().version("?").language("Java API Test").build());
|
||||
var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder()
|
||||
.version("?")
|
||||
.language("Java API Test")
|
||||
.build());
|
||||
if (!BeaconServer.tryStop(client)) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
|||
*/
|
||||
public class BeaconException extends RuntimeException {
|
||||
|
||||
public BeaconException() {
|
||||
}
|
||||
public BeaconException() {}
|
||||
|
||||
public BeaconException(String message) {
|
||||
super(message);
|
||||
|
|
|
@ -11,7 +11,6 @@ public class BeaconJacksonModule extends SimpleModule {
|
|||
new NamedType(BeaconClient.ApiClientInformation.class),
|
||||
new NamedType(BeaconClient.CliClientInformation.class),
|
||||
new NamedType(BeaconClient.DaemonInformation.class),
|
||||
new NamedType(BeaconClient.ReachableCheckInformation.class)
|
||||
);
|
||||
new NamedType(BeaconClient.ReachableCheckInformation.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ public class BeaconProxyImpl extends ProxyProvider {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends DataSourceReadConnection> T createRemoteReadConnection(DataSource<?> source, ShellStore proxy) throws Exception {
|
||||
public <T extends DataSourceReadConnection> T createRemoteReadConnection(DataSource<?> source, ShellStore proxy)
|
||||
throws Exception {
|
||||
var downstream = downstreamTransform(source, proxy);
|
||||
|
||||
BeaconClient client = null;
|
||||
|
@ -105,7 +106,8 @@ public class BeaconProxyImpl extends ProxyProvider {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends DataSourceConnection> T createRemoteWriteConnection(DataSource<?> source, WriteMode mode, ShellStore proxy) throws Exception {
|
||||
public <T extends DataSourceConnection> T createRemoteWriteConnection(
|
||||
DataSource<?> source, WriteMode mode, ShellStore proxy) throws Exception {
|
||||
var downstream = downstreamTransform(source, proxy);
|
||||
|
||||
BeaconClient client = null;
|
||||
|
@ -124,7 +126,8 @@ public class BeaconProxyImpl extends ProxyProvider {
|
|||
finalClient.close();
|
||||
}
|
||||
};
|
||||
var outputSource = DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream));
|
||||
var outputSource =
|
||||
DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream));
|
||||
return (T) outputSource.openWriteConnection(mode);
|
||||
} catch (Exception ex) {
|
||||
if (client != null) {
|
||||
|
|
|
@ -43,7 +43,8 @@ public class BeaconServer {
|
|||
public static Process start(String installationBase, XPipeDaemonMode mode) throws Exception {
|
||||
String command;
|
||||
if (!BeaconConfig.launchDaemonInDebugMode()) {
|
||||
command = XPipeInstallation.createExternalAsyncLaunchCommand(installationBase, mode, BeaconConfig.getDaemonArguments());
|
||||
command = XPipeInstallation.createExternalAsyncLaunchCommand(
|
||||
installationBase, mode, BeaconConfig.getDaemonArguments());
|
||||
} else {
|
||||
command = XPipeInstallation.createExternalLaunchCommand(
|
||||
getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode);
|
||||
|
@ -77,8 +78,7 @@ public class BeaconServer {
|
|||
ioe.printStackTrace();
|
||||
}
|
||||
},
|
||||
"daemon sysout"
|
||||
);
|
||||
"daemon sysout");
|
||||
out.setDaemon(true);
|
||||
out.start();
|
||||
|
||||
|
@ -98,8 +98,7 @@ public class BeaconServer {
|
|||
ioe.printStackTrace();
|
||||
}
|
||||
},
|
||||
"daemon syserr"
|
||||
);
|
||||
"daemon syserr");
|
||||
err.setDaemon(true);
|
||||
err.start();
|
||||
}
|
||||
|
@ -117,8 +116,7 @@ public class BeaconServer {
|
|||
throw new IllegalStateException();
|
||||
} else {
|
||||
if (BeaconConfig.attachDebuggerToDaemon()) {
|
||||
return FileNames.join(
|
||||
installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType));
|
||||
return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType));
|
||||
} else {
|
||||
return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugScriptPath(osType));
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
|||
*/
|
||||
public class ClientException extends Exception {
|
||||
|
||||
public ClientException() {
|
||||
}
|
||||
public ClientException() {}
|
||||
|
||||
public ClientException(String message) {
|
||||
super(message);
|
||||
|
|
|
@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
|||
*/
|
||||
public class ConnectorException extends Exception {
|
||||
|
||||
public ConnectorException() {
|
||||
}
|
||||
public ConnectorException() {}
|
||||
|
||||
public ConnectorException(String message) {
|
||||
super(message);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
package io.xpipe.beacon;
|
||||
|
||||
public interface RequestMessage {
|
||||
}
|
||||
public interface RequestMessage {}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
package io.xpipe.beacon;
|
||||
|
||||
public interface ResponseMessage {
|
||||
}
|
||||
public interface ResponseMessage {}
|
||||
|
|
|
@ -31,7 +31,6 @@ public class SecretProviderImpl extends SecretProvider {
|
|||
return nonce;
|
||||
}
|
||||
|
||||
|
||||
private static SecretKey getAESKey(int keysize) throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||
var salt = new byte[16];
|
||||
|
|
|
@ -5,8 +5,7 @@ package io.xpipe.beacon;
|
|||
*/
|
||||
public class ServerException extends Exception {
|
||||
|
||||
public ServerException() {
|
||||
}
|
||||
public ServerException() {}
|
||||
|
||||
public ServerException(String message) {
|
||||
super(message);
|
||||
|
|
|
@ -26,6 +26,5 @@ public class FocusExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,5 @@ public class ForwardExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ public class OpenExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull List<String> arguments;
|
||||
@NonNull
|
||||
List<String> arguments;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -21,14 +21,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -37,14 +31,8 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ public class ProxyReadConnectionExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull DataSource<?> source;
|
||||
@NonNull
|
||||
DataSource<?> source;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,15 @@ public class ProxyWriteConnectionExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull DataSource<?> source;
|
||||
@NonNull WriteMode mode;
|
||||
@NonNull
|
||||
DataSource<?> source;
|
||||
|
||||
@NonNull
|
||||
WriteMode mode;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ public class QueryDataSourceExchange implements MessageExchange {
|
|||
@NonNull
|
||||
String provider;
|
||||
|
||||
@NonNull DataSourceType type;
|
||||
@NonNull
|
||||
DataSourceType type;
|
||||
|
||||
@NonNull
|
||||
LinkedHashMap<String, String> config;
|
||||
|
|
|
@ -21,12 +21,12 @@ public class ReadStreamExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull String name;
|
||||
@NonNull
|
||||
String name;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ public class StopExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -21,12 +21,12 @@ public class WriteStreamExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
@NonNull String name;
|
||||
@NonNull
|
||||
String name;
|
||||
}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,5 @@ public class QueryRawDataExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class QueryTableDataExchange implements MessageExchange {
|
|||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
@NonNull TupleType dataType;
|
||||
@NonNull
|
||||
TupleType dataType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,5 @@ public class QueryTextDataExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ public class InstanceExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -20,8 +20,7 @@ public class ListCollectionsExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -20,8 +20,7 @@ public class ListStoresExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -30,6 +30,5 @@ public class ReadDrainExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ public class RemoveCollectionExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ public class RemoveStoreExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,5 @@ public class RenameCollectionExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,5 @@ public class RenameEntryExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,5 @@ public class RenameStoreExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,5 @@ public class SelectExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Response implements ResponseMessage {
|
||||
}
|
||||
public static class Response implements ResponseMessage {}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ public class SourceProviderListExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -17,8 +17,7 @@ public class StatusExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -22,8 +22,7 @@ public class StoreProviderListExchange implements MessageExchange {
|
|||
@Jacksonized
|
||||
@Builder
|
||||
@Value
|
||||
public static class Request implements RequestMessage {
|
||||
}
|
||||
public static class Request implements RequestMessage {}
|
||||
|
||||
@Jacksonized
|
||||
@Builder
|
||||
|
|
|
@ -17,8 +17,7 @@ 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
|
||||
|
|
|
@ -17,6 +17,7 @@ public class QuietDialogHandler {
|
|||
private final BeaconConnection connection;
|
||||
private final Map<String, String> overrides;
|
||||
private DialogElement element;
|
||||
|
||||
public QuietDialogHandler(DialogReference ref, BeaconConnection connection, Map<String, String> overrides) {
|
||||
this.dialogKey = ref.getDialogId();
|
||||
this.element = ref.getStart();
|
||||
|
|
|
@ -23,7 +23,9 @@ module io.xpipe.beacon {
|
|||
opens io.xpipe.beacon.exchange.api;
|
||||
opens io.xpipe.beacon.exchange.data;
|
||||
opens io.xpipe.beacon.exchange.cli;
|
||||
|
||||
exports io.xpipe.beacon.util;
|
||||
|
||||
opens io.xpipe.beacon.util;
|
||||
|
||||
requires static com.fasterxml.jackson.core;
|
||||
|
@ -34,9 +36,12 @@ module io.xpipe.beacon {
|
|||
uses MessageExchange;
|
||||
uses ProxyFunction;
|
||||
|
||||
provides ProxyProvider with BeaconProxyImpl;
|
||||
provides SecretProvider with SecretProviderImpl;
|
||||
provides Module with BeaconJacksonModule;
|
||||
provides ProxyProvider with
|
||||
BeaconProxyImpl;
|
||||
provides SecretProvider with
|
||||
SecretProviderImpl;
|
||||
provides Module with
|
||||
BeaconJacksonModule;
|
||||
provides io.xpipe.beacon.exchange.MessageExchange with
|
||||
ForwardExchange,
|
||||
InstanceExchange,
|
||||
|
|
|
@ -23,8 +23,7 @@ public abstract class Charsetter {
|
|||
public static Charsetter INSTANCE;
|
||||
private static CharsetterUniverse universe;
|
||||
|
||||
protected Charsetter() {
|
||||
}
|
||||
protected Charsetter() {}
|
||||
|
||||
protected static void checkInit() {
|
||||
if (universe == null) {
|
||||
|
@ -78,8 +77,7 @@ public abstract class Charsetter {
|
|||
}
|
||||
|
||||
public abstract Result read(
|
||||
FailableSupplier<InputStream, Exception> in, FailableConsumer<InputStreamReader, Exception> con
|
||||
)
|
||||
FailableSupplier<InputStream, Exception> in, FailableConsumer<InputStreamReader, Exception> con)
|
||||
throws Exception;
|
||||
|
||||
public Result detect(StreamDataStore store) throws Exception {
|
||||
|
@ -112,7 +110,9 @@ public abstract class Charsetter {
|
|||
|
||||
if (store instanceof FileStore fileStore && fileStore.getFileSystem() instanceof MachineStore m) {
|
||||
if (result.getNewLine() == null) {
|
||||
result = new Result(result.getCharset(), m.getShellType() != null ? m.getShellType().getNewLine() : null);
|
||||
result = new Result(
|
||||
result.getCharset(),
|
||||
m.getShellType() != null ? m.getShellType().getNewLine() : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,8 @@ 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
|
||||
|
@ -36,24 +31,16 @@ 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 = UTF16_LE;
|
||||
|
||||
|
@ -67,8 +54,7 @@ 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,
|
||||
|
@ -76,20 +62,15 @@ 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"))));
|
||||
|
||||
// ======
|
||||
// UTF-32
|
||||
|
@ -98,26 +79,16 @@ public class StreamCharset {
|
|||
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")
|
||||
);
|
||||
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,
|
||||
(byte) 0xFF, (byte) 0xFE, 0x00, 0x00,
|
||||
},
|
||||
Identifiers.get("utf", "32", "be", "bom")
|
||||
);
|
||||
Identifiers.get("utf", "32", "be", "bom"));
|
||||
private static final List<StreamCharset> RARE_NAMED =
|
||||
List.of(UTF16_LE, UTF16_LE_BOM, UTF16_BE, UTF16_BE_BOM, UTF32_LE, UTF32_LE_BOM, UTF32_BE, UTF32_BE_BOM);
|
||||
|
||||
|
@ -136,13 +107,11 @@ public class StreamCharset {
|
|||
.map(charset -> new StreamCharset(
|
||||
charset,
|
||||
null,
|
||||
Identifiers.get(charset.name().split("-"))
|
||||
))
|
||||
)
|
||||
Identifiers.get(charset.name().split("-")))))
|
||||
.toList();
|
||||
|
||||
public static final List<StreamCharset> ALL = Stream.concat(COMMON.stream(), RARE.stream()).toList();
|
||||
|
||||
public static final List<StreamCharset> ALL =
|
||||
Stream.concat(COMMON.stream(), RARE.stream()).toList();
|
||||
|
||||
Charset charset;
|
||||
byte[] byteOrderMark;
|
||||
|
@ -157,7 +126,9 @@ public class StreamCharset {
|
|||
}
|
||||
|
||||
public static StreamCharset get(String s) {
|
||||
var found = ALL.stream().filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))).findFirst();
|
||||
var found = ALL.stream()
|
||||
.filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT)))
|
||||
.findFirst();
|
||||
if (found.isEmpty()) {
|
||||
throw new IllegalArgumentException("Unknown charset name: " + s);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue