This commit is contained in:
crschnick 2023-02-09 21:30:07 +00:00
parent 7be8087b19
commit 131dec75ec
228 changed files with 800 additions and 942 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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);
@ -80,12 +81,12 @@ public class App extends Application {
appWindow.show();
// For demo purposes
// if (true) {
// stage.setX(310);
// stage.setY(178);
// stage.setWidth(1300);
// stage.setHeight(730);
// }
// if (true) {
// stage.setX(310);
// stage.setY(178);
// stage.setWidth(1300);
// stage.setHeight(730);
// }
}
public void focus() {

View file

@ -18,7 +18,7 @@ public class AppActionLinkDetector {
content = Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT);
}
return content != null?content.toString():null;
return content != null ? content.toString() : null;
}
private static void handle(String content, boolean showAlert) {
@ -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;
}
}

View file

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

View file

@ -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() {

View file

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

View file

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

View file

@ -34,7 +34,7 @@ public class AppProperties {
Properties props = new Properties();
AppResources.with(AppResources.XPIPE_MODULE, "app.properties", p -> {
if (Files.exists(p)) {
try (var in = Files.newInputStream(p)){
try (var in = Files.newInputStream(p)) {
props.load(in);
} catch (IOException e) {
ErrorEvent.fromThrowable(e).omitted(true).build().handle();
@ -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();

View file

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

View file

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

View file

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

View file

@ -77,9 +77,9 @@ public abstract class OperationMode {
OperationMode.shutdown(true, false);
}));
// if (true) {
// throw new OutOfMemoryError();
// }
// if (true) {
// throw new OutOfMemoryError();
// }
TrackEvent.info("mode", "Initial setup");
AppProperties.init();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ import java.util.Locale;
@Getter
public enum SupportedLocale implements PrefsChoiceValue {
ENGLISH(Locale.ENGLISH, "english");
//GERMAN(Locale.GERMAN, "german");
// GERMAN(Locale.GERMAN, "german");
private final Locale locale;
private final String id;

View file

@ -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;
}
@ -137,12 +147,12 @@ public class DataSourceEntry extends StorageElement {
var oldSource = dataSource;
DataSource<?> newSource = DataStorageParser.sourceFromNode(sourceNode);
// TrackEvent.storage()
// .trace()
// .message("Refreshing data source entry")
// .tag("old", oldSource)
// .tag("new", newSource)
// .handle();
// TrackEvent.storage()
// .trace()
// .message("Refreshing data source entry")
// .tag("old", oldSource)
// .tag("new", newSource)
// .handle();
if (newSource == null) {
dataSource = null;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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() {

View file

@ -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) {

View file

@ -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();
}
@ -49,9 +52,9 @@ public class BeaconDaemonController {
private static void waitForStartup(Process process, boolean custom) throws IOException {
for (int i = 0; i < 160; i++) {
// Breaks when using nohup & disown
// if (process != null && !custom && !process.isAlive()) {
// throw new IOException("Daemon start failed");
// }
// if (process != null && !custom && !process.isAlive()) {
// throw new IOException("Daemon start failed");
// }
if (process != null && custom && !process.isAlive() && process.exitValue() != 0) {
throw new IOException("Custom launch command failed");

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/
public class BeaconException extends RuntimeException {
public BeaconException() {
}
public BeaconException() {}
public BeaconException(String message) {
super(message);

View file

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

View file

@ -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) {

View file

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

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/
public class ClientException extends Exception {
public ClientException() {
}
public ClientException() {}
public ClientException(String message) {
super(message);

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/
public class ConnectorException extends Exception {
public ConnectorException() {
}
public ConnectorException() {}
public ConnectorException(String message) {
super(message);

View file

@ -1,4 +1,3 @@
package io.xpipe.beacon;
public interface RequestMessage {
}
public interface RequestMessage {}

View file

@ -1,4 +1,3 @@
package io.xpipe.beacon;
public interface ResponseMessage {
}
public interface ResponseMessage {}

View file

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

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/
public class ServerException extends Exception {
public ServerException() {
}
public ServerException() {}
public ServerException(String message) {
super(message);

View file

@ -26,6 +26,5 @@ public class FocusExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -31,6 +31,5 @@ public class ForwardExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -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 {}
}

View file

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

View file

@ -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 {}
}

View file

@ -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 {}
}

View file

@ -43,7 +43,8 @@ public class QueryDataSourceExchange implements MessageExchange {
@NonNull
String provider;
@NonNull DataSourceType type;
@NonNull
DataSourceType type;
@NonNull
LinkedHashMap<String, String> config;

View file

@ -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 {}
}

View file

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

View file

@ -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 {}
}

View file

@ -29,6 +29,5 @@ public class QueryRawDataExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -34,6 +34,7 @@ public class QueryTableDataExchange implements MessageExchange {
@Builder
@Value
public static class Response implements ResponseMessage {
@NonNull TupleType dataType;
@NonNull
TupleType dataType;
}
}

View file

@ -30,6 +30,5 @@ public class QueryTextDataExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

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

View file

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

View file

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

View file

@ -30,6 +30,5 @@ public class ReadDrainExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -26,6 +26,5 @@ public class RemoveCollectionExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -26,6 +26,5 @@ public class RemoveStoreExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -29,6 +29,5 @@ public class RenameCollectionExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -31,6 +31,5 @@ public class RenameEntryExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -29,6 +29,5 @@ public class RenameStoreExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

@ -27,6 +27,5 @@ public class SelectExchange implements MessageExchange {
@Jacksonized
@Builder
@Value
public static class Response implements ResponseMessage {
}
public static class Response implements ResponseMessage {}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

Some files were not shown because too many files have changed in this diff Show more