From d96a38d7b2dce55f46b29fb46ae8892e85f379be Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 4 Oct 2023 14:34:03 +0000 Subject: [PATCH] Merge branch 1.7 into master --- api/src/main/java/io/xpipe/api/DataRaw.java | 12 - .../main/java/io/xpipe/api/DataSource.java | 229 ---------- .../java/io/xpipe/api/DataSourceConfig.java | 32 -- .../main/java/io/xpipe/api/DataStructure.java | 7 - api/src/main/java/io/xpipe/api/DataTable.java | 26 -- .../io/xpipe/api/DataTableAccumulator.java | 52 --- api/src/main/java/io/xpipe/api/DataText.java | 17 - .../java/io/xpipe/api/impl/DataRawImpl.java | 41 -- .../io/xpipe/api/impl/DataSourceImpl.java | 161 ------- .../io/xpipe/api/impl/DataStructureImpl.java | 30 -- .../api/impl/DataTableAccumulatorImpl.java | 115 ----- .../java/io/xpipe/api/impl/DataTableImpl.java | 61 --- .../java/io/xpipe/api/impl/DataTextImpl.java | 66 --- .../java/io/xpipe/api/test/DataTableTest.java | 2 +- app/build.gradle | 2 +- .../app/browser/BrowserBookmarkList.java | 16 +- .../app/browser/BrowserBreadcrumbBar.java | 2 +- .../io/xpipe/app/browser/BrowserComp.java | 3 +- .../io/xpipe/app/browser/BrowserEntry.java | 2 +- .../app/browser/BrowserFileListComp.java | 2 +- .../app/browser/BrowserFileListModel.java | 2 +- .../io/xpipe/app/browser/BrowserModel.java | 26 +- .../app/browser/BrowserSelectionListComp.java | 2 +- .../app/browser/BrowserTransferComp.java | 2 +- .../app/browser/BrowserTransferModel.java | 2 +- .../xpipe/app/browser/BrowserWelcomeComp.java | 6 +- .../xpipe/app/browser/FileSystemHelper.java | 4 +- .../app/browser/OpenFileSystemModel.java | 33 +- .../app/browser/OpenFileSystemSavedState.java | 12 +- .../app/browser/StandaloneFileBrowser.java | 9 +- .../browser/action/MultiExecuteAction.java | 2 +- .../xpipe/app/browser/icon/DirectoryType.java | 2 +- .../io/xpipe/app/comp/base/DropdownComp.java | 69 ++- .../app/comp/base/InstallExtensionComp.java | 4 +- .../app/comp/base/IntegratedTextAreaComp.java | 3 + .../xpipe/app/comp/base/ListBoxViewComp.java | 4 +- .../xpipe/app/comp/base/NamedToggleComp.java | 4 +- .../io/xpipe/app/comp/base/OsLogoComp.java | 35 +- .../xpipe/app/comp/base/StoreToggleComp.java | 13 +- .../xpipe/app/comp/base/SystemStateComp.java | 29 +- .../app/comp/storage/DataSourceTypeComp.java | 98 ----- .../storage/store/DenseStoreEntryComp.java | 10 +- .../storage/store/StandardStoreEntryComp.java | 2 +- .../comp/storage/store/StoreCreationMenu.java | 21 +- .../comp/storage/store/StoreEntryComp.java | 48 +- .../comp/storage/store/StoreEntryWrapper.java | 116 ++--- .../comp/storage/store/StoreIntroComp.java | 3 +- .../app/comp/storage/store/StoreSection.java | 10 +- .../app/comp/storage/store/StoreSortMode.java | 4 +- .../comp/storage/store/StoreViewState.java | 9 + .../comp/store/DsStoreProviderChoiceComp.java | 2 +- .../app/comp/store/GuiDsStoreCreator.java | 8 +- app/src/main/java/io/xpipe/app/core/App.java | 2 + .../main/java/io/xpipe/app/core/AppCache.java | 4 +- .../xpipe/app/core/AppExtensionManager.java | 12 +- .../main/java/io/xpipe/app/core/AppI18n.java | 4 +- .../io/xpipe/app/core/AppSocketServer.java | 20 +- .../main/java/io/xpipe/app/core/AppTheme.java | 7 - .../java/io/xpipe/app/core/mode/BaseMode.java | 2 +- .../io/xpipe/app/core/mode/OperationMode.java | 2 +- .../app/exchange/MessageExchangeImpl.java | 44 +- .../exchange/ProxyFunctionExchangeImpl.java | 16 - .../ProxyReadConnectionExchangeImpl.java | 27 -- .../ProxyWriteConnectionExchangeImpl.java | 25 -- .../app/exchange/QueryStoreExchangeImpl.java | 4 +- .../xpipe/app/exchange/ReadExchangeImpl.java | 49 --- .../exchange/cli/InstanceExchangeImpl.java | 2 +- .../exchange/cli/ListStoresExchangeImpl.java | 1 - .../exchange/cli/RenameStoreExchangeImpl.java | 2 +- .../exchange/cli/StoreAddExchangeImpl.java | 10 +- .../cli/StoreProviderListExchangeImpl.java | 8 +- .../java/io/xpipe/app/ext/ActionProvider.java | 28 -- .../io/xpipe/app/ext/DataSourceProvider.java | 139 ------ .../io/xpipe/app/ext/DataSourceProviders.java | 175 -------- .../io/xpipe/app/ext/DataSourceTarget.java | 100 ----- .../io/xpipe/app/ext/DataStoreProvider.java | 62 +-- .../xpipe/app/ext/XPipeServiceProviders.java | 8 - .../fxcomps/augment/ContextMenuAugment.java | 5 + .../app/fxcomps/impl/DataStoreChoiceComp.java | 102 +++-- .../fxcomps/impl/DataStoreListChoiceComp.java | 59 +++ .../app/fxcomps/impl/DynamicOptionsComp.java | 136 ------ .../app/fxcomps/impl/FileStoreChoiceComp.java | 7 +- .../app/fxcomps/impl/HorizontalComp.java | 4 + .../app/fxcomps/impl/PrettyImageComp.java | 2 +- .../app/fxcomps/impl/PrettyImageHelper.java | 4 +- .../xpipe/app/fxcomps/impl/PrettySvgComp.java | 2 +- .../app/fxcomps/impl/WriteModeChoiceComp.java | 71 --- .../app/fxcomps/util/BindingsHelper.java | 8 +- .../app/fxcomps/util/PlatformThread.java | 3 + .../io/xpipe/app/issue/ErrorHandlerComp.java | 22 + .../io/xpipe/app/launcher/LauncherInput.java | 4 +- .../java/io/xpipe/app/prefs/AppPrefs.java | 19 +- .../app/prefs/ExternalApplicationType.java | 2 +- .../xpipe/app/prefs/ExternalTerminalType.java | 8 +- .../xpipe/app/prefs/JsonStorageHandler.java | 4 +- .../io/xpipe/app/prefs/PasswordCategory.java | 2 +- .../io/xpipe/app/prefs/TroubleshootComp.java | 6 +- .../app/storage/DataStateProviderImpl.java | 51 ++- .../io/xpipe/app/storage/DataStorage.java | 409 ++++++++++-------- .../xpipe/app/storage/DataStorageParser.java | 94 +--- .../xpipe/app/storage/DataStorageWriter.java | 67 +-- .../io/xpipe/app/storage/DataStoreEntry.java | 310 +++++++------ .../xpipe/app/storage/DataStoreEntryRef.java | 24 + .../io/xpipe/app/storage/StandardStorage.java | 40 +- .../app/storage/StorageJacksonModule.java | 68 +++ .../xpipe/app/test/DaemonExtensionTest.java | 14 - .../java/io/xpipe/app/test/ExtensionTest.java | 16 +- .../io/xpipe/app/update/AppDownloads.java | 7 +- .../io/xpipe/app/update/AppInstaller.java | 12 +- .../io/xpipe/app/update/ChocoUpdater.java | 4 +- .../app/update/XPipeDistributionType.java | 2 +- .../io/xpipe/app/util/ApplicationHelper.java | 18 +- .../io/xpipe/app/util/DataStoreFormatter.java | 43 +- .../java/io/xpipe/app/util/DesktopHelper.java | 2 +- .../io/xpipe/app/util/DesktopShortcuts.java | 2 +- .../java/io/xpipe/app/util/DialogHelper.java | 2 +- .../xpipe/app/util/DiscreteProgressScope.java | 19 + .../xpipe/app/util/DynamicOptionsBuilder.java | 270 ------------ .../java/io/xpipe/app/util/FileOpener.java | 4 +- .../xpipe/app/util/FixedHierarchyStore.java | 12 + .../io/xpipe/app/util/LicenseException.java | 27 ++ .../io/xpipe/app/util/MacOsPermissions.java | 2 +- .../xpipe/app/util/ObservableDataStore.java | 12 +- .../io/xpipe/app/util/OptionsBuilder.java | 22 +- .../java/io/xpipe/app/util/ProgressScope.java | 64 +++ .../app/util/ProxyManagerProviderImpl.java | 2 +- .../java/io/xpipe/app/util/ScanAlert.java | 23 +- .../java/io/xpipe/app/util/ScriptHelper.java | 10 +- .../app/util/SecretRetrievalStrategy.java | 6 +- .../io/xpipe/app/util/StatefulDataStore.java | 13 - .../app/util/UniformDataSourceProvider.java | 13 - .../java/io/xpipe/app/util/Validator.java | 10 + .../java/io/xpipe/app/util/Validators.java | 31 +- app/src/main/java/module-info.java | 10 +- .../resources/lang/dscreation_en.properties | 1 + .../resources/lang/preferences_en.properties | 6 +- .../style/data-store-list-choice-comp.css | 17 + .../app/resources/style/dropdown-comp.css | 19 + .../app/resources/style/store-creator.css | 2 +- .../app/resources/style/store-entry-comp.css | 6 +- .../io/xpipe/app/resources/style/style.css | 13 + .../java/io/xpipe/beacon/BeaconClient.java | 8 +- .../io/xpipe/beacon/BeaconConnection.java | 2 +- .../java/io/xpipe/beacon/BeaconProxyImpl.java | 149 ------- .../java/io/xpipe/beacon/BeaconServer.java | 2 +- .../io/xpipe/beacon/SecretProviderImpl.java | 71 --- .../beacon/exchange/AddSourceExchange.java | 36 -- .../xpipe/beacon/exchange/DrainExchange.java | 2 +- .../xpipe/beacon/exchange/EditExchange.java | 40 -- .../beacon/exchange/ForwardExchange.java | 35 -- .../xpipe/beacon/exchange/LaunchExchange.java | 2 +- .../exchange/ProxyFunctionExchange.java | 38 -- .../exchange/ProxyReadConnectionExchange.java | 30 -- .../ProxyWriteConnectionExchange.java | 34 -- .../exchange/QueryDataSourceExchange.java | 54 --- .../xpipe/beacon/exchange/ReadExchange.java | 44 -- .../xpipe/beacon/exchange/SinkExchange.java | 2 +- .../beacon/exchange/cli/ConvertExchange.java | 42 -- .../exchange/cli/RemoveEntryExchange.java | 35 -- .../exchange/cli/RenameEntryExchange.java | 35 -- .../beacon/exchange/cli/SelectExchange.java | 31 -- .../cli/SourceProviderListExchange.java | 35 -- .../exchange/cli/WriteExecuteExchange.java | 43 -- .../cli/WritePreparationExchange.java | 45 -- .../beacon/exchange/data/StoreListEntry.java | 2 +- beacon/src/main/java/module-info.java | 11 - .../io/xpipe/core/charsetter/Charsetter.java | 2 +- .../data/generic/GenericAbstractReader.java | 10 - .../core/data/generic/GenericArrayReader.java | 161 ------- .../generic/GenericDataStreamCallback.java | 18 - .../data/generic/GenericDataStreamParser.java | 89 ---- .../data/generic/GenericDataStreamWriter.java | 59 --- .../GenericDataStructureNodeReader.java | 91 ---- .../core/data/generic/GenericTupleReader.java | 173 -------- .../io/xpipe/core/data/node/ArrayNode.java | 71 --- .../core/data/node/DataStructureNode.java | 246 ----------- .../data/node/DataStructureNodeAcceptor.java | 6 - .../core/data/node/DataStructureNodeIO.java | 94 ---- .../data/node/DataStructureNodePointer.java | 235 ---------- .../xpipe/core/data/node/LinkedTupleNode.java | 181 -------- .../xpipe/core/data/node/SimpleArrayNode.java | 80 ---- .../xpipe/core/data/node/SimpleTupleNode.java | 111 ----- .../xpipe/core/data/node/SimpleValueNode.java | 37 -- .../io/xpipe/core/data/node/TupleNode.java | 125 ------ .../io/xpipe/core/data/node/ValueNode.java | 177 -------- .../io/xpipe/core/data/type/ArrayType.java | 100 ----- .../io/xpipe/core/data/type/DataType.java | 115 ----- .../xpipe/core/data/type/DataTypeVisitor.java | 12 - .../core/data/type/DataTypeVisitors.java | 105 ----- .../io/xpipe/core/data/type/TupleType.java | 144 ------ .../io/xpipe/core/data/type/ValueType.java | 61 --- .../io/xpipe/core/data/type/WildcardType.java | 53 --- .../core/data/typed/TypedAbstractReader.java | 10 - .../data/typed/TypedDataStreamCallback.java | 25 -- .../data/typed/TypedDataStreamParser.java | 140 ------ .../data/typed/TypedDataStreamWriter.java | 60 --- .../typed/TypedDataStructureNodeReader.java | 169 -------- .../core/impl/BatchTableWriteConnection.java | 55 --- .../java/io/xpipe/core/impl/BinarySource.java | 74 ---- .../impl/BufferedTableReadConnection.java | 66 --- .../core/impl/LimitTableReadConnection.java | 57 --- .../core/impl/LocalDirectoryDataStore.java | 24 - .../java/io/xpipe/core/impl/NamedStore.java | 36 -- .../impl/PeekTableStreamReadConnection.java | 57 --- .../impl/PreservingTableWriteConnection.java | 25 -- .../impl/PreservingTextWriteConnection.java | 18 - .../core/impl/PreservingWriteConnection.java | 51 --- .../core/impl/SimpleDataSourceConnection.java | 15 - .../core/impl/SimpleTableWriteConnection.java | 26 -- .../xpipe/core/impl/StreamReadConnection.java | 48 -- .../core/impl/StreamWriteConnection.java | 49 --- .../xpipe/core/impl/TextReadConnection.java | 29 -- .../java/io/xpipe/core/impl/TextSource.java | 41 -- .../xpipe/core/impl/TextWriteConnection.java | 17 - .../xpipe/core/impl/XpbsReadConnection.java | 17 - .../java/io/xpipe/core/impl/XpbsSource.java | 26 -- .../xpipe/core/impl/XpbsWriteConnection.java | 17 - .../xpipe/core/impl/XpbtReadConnection.java | 97 ----- .../java/io/xpipe/core/impl/XpbtSource.java | 26 -- .../xpipe/core/impl/XpbtWriteConnection.java | 57 --- .../java/io/xpipe/core/process/OsType.java | 2 +- .../io/xpipe/core/process/ShellControl.java | 42 +- .../io/xpipe/core/process/ShellDialect.java | 4 + .../xpipe/core/process/ShellStoreState.java | 30 ++ .../core/source/CollectionDataSource.java | 34 -- .../core/source/CollectionReadConnection.java | 22 - .../source/CollectionWriteConnection.java | 8 - .../java/io/xpipe/core/source/DataSource.java | 139 ------ .../core/source/DataSourceConnection.java | 15 - .../core/source/DataSourceReadConnection.java | 8 - .../core/source/DataSourceReference.java | 238 ---------- .../io/xpipe/core/source/DataSourceType.java | 24 - .../io/xpipe/core/source/RawDataSource.java | 38 -- .../xpipe/core/source/RawReadConnection.java | 27 -- .../xpipe/core/source/RawWriteConnection.java | 6 - .../core/source/StructureDataSource.java | 47 -- .../core/source/StructureReadConnection.java | 17 - .../core/source/StructureWriteConnection.java | 11 - .../io/xpipe/core/source/TableDataSource.java | 102 ----- .../io/xpipe/core/source/TableMapping.java | 112 ----- .../core/source/TableReadConnection.java | 131 ------ .../core/source/TableWriteConnection.java | 33 -- .../io/xpipe/core/source/TextDataSource.java | 49 --- .../xpipe/core/source/TextReadConnection.java | 22 - .../core/source/TextWriteConnection.java | 6 - .../java/io/xpipe/core/source/WriteMode.java | 44 -- .../java/io/xpipe/core/store/DataStore.java | 58 --- .../core/{source => store}/DataStoreId.java | 2 +- .../io/xpipe/core/store/DataStoreState.java | 42 ++ .../xpipe/core/{impl => store}/FileNames.java | 2 +- .../xpipe/core/{impl => store}/FileStore.java | 5 +- .../java/io/xpipe/core/store/FileSystem.java | 1 - .../xpipe/core/store/FixedHierarchyStore.java | 8 - .../java/io/xpipe/core/store/GroupStore.java | 16 - .../core/{impl => store}/InMemoryStore.java | 3 +- .../{impl => store}/InputStreamStore.java | 2 +- .../core/store/InternalCacheDataStore.java | 12 +- .../{impl => store}/InternalStreamStore.java | 4 +- .../core/{impl => store}/LocalStore.java | 24 +- .../{impl => store}/OutputStreamStore.java | 5 +- .../java/io/xpipe/core/store/ShellStore.java | 25 +- .../xpipe/core/store/StatefulDataStore.java | 44 ++ .../core/{impl => store}/StdinDataStore.java | 2 +- .../core/{impl => store}/StdoutDataStore.java | 2 +- .../io/xpipe/core/store/StreamDataStore.java | 23 + .../io/xpipe/core/store/ValidatableStore.java | 22 + .../io/xpipe/core/util/CoreJacksonModule.java | 65 +-- .../io/xpipe/core/util/DataStateProvider.java | 9 +- .../io/xpipe/core/util/ProxyFunction.java | 15 +- .../io/xpipe/core/util/ProxyProvider.java | 38 -- .../io/xpipe/core/util/SecretProvider.java | 22 - .../core/util/XPipeExecTempDirectory.java | 2 +- .../io/xpipe/core/util/XPipeInstallation.java | 2 +- .../io/xpipe/core/util/XPipeSystemId.java | 2 +- core/src/main/java/module-info.java | 14 - .../core/test/DataSourceReferenceTest.java | 2 +- .../io/xpipe/core/test/DataStoreIdTest.java | 2 +- dist/changelogs/1.7.0.md | 27 ++ .../xpipe/ext/base/BinarySourceProvider.java | 43 -- .../io/xpipe/ext/base/FileStoreProvider.java | 77 ---- .../java/io/xpipe/ext/base/GroupStore.java | 17 + .../java/io/xpipe/ext/base/HttpStore.java | 137 ------ .../io/xpipe/ext/base/HttpStoreProvider.java | 125 ------ .../xpipe/ext/base/InMemoryStoreProvider.java | 50 +-- .../ext/base/InternalStreamProvider.java | 14 +- .../ext/base/ReadOnlyCollectionSource.java | 16 - .../ext/base/SimpleCollectionSource.java | 28 -- .../base/SimpleFileDataSourceProvider.java | 89 ---- .../io/xpipe/ext/base/TextSourceProvider.java | 83 ---- .../java/io/xpipe/ext/base/XpbsProvider.java | 42 -- .../java/io/xpipe/ext/base/XpbtProvider.java | 42 -- .../ext/base/action/BrowseStoreAction.java | 2 +- .../action/DeleteStoreChildrenAction.java | 4 +- .../ext/base/action/EditStoreAction.java | 4 +- .../ext/base/action/FileBrowseAction.java | 4 +- .../xpipe/ext/base/action/FileEditAction.java | 4 +- .../ext/base/action/GroupToggleAction.java | 42 -- .../xpipe/ext/base/action/LaunchAction.java | 12 +- .../ext/base/action/RefreshStoreAction.java | 20 +- .../xpipe/ext/base/action/SampleAction.java | 2 +- .../ext/base/action/StreamExportAction.java | 2 +- .../xpipe/ext/base/action/XPipeUrlAction.java | 4 +- .../ext/base/browser/CopyPathAction.java | 2 +- .../ext/base/browser/FollowLinkAction.java | 2 +- .../browser/OpenDirectoryInNewTabAction.java | 3 +- .../browser/OpenNativeFileDetailsAction.java | 4 +- .../xpipe/ext/base/browser/UnzipAction.java | 2 +- .../ext/base/script/MultiScriptStore.java | 50 +++ .../base/script/MultiScriptStoreProvider.java | 117 +++++ .../base/script/PredefinedScriptGroup.java | 22 + .../base/script/PredefinedScriptStore.java | 102 +++++ .../ext/base/script/ScriptGroupStore.java | 24 + .../base/script/ScriptGroupStoreProvider.java | 59 +++ .../io/xpipe/ext/base/script/ScriptStore.java | 91 ++++ .../script/ScriptStoreTypeChoiceComp.java | 32 ++ .../ext/base/script/SimpleScriptStore.java | 85 ++++ .../script/SimpleScriptStoreProvider.java | 262 +++++++++++ ext/base/src/main/java/module-info.java | 18 +- .../ext/base/resources/lang/elevation_en.md | 15 + .../base/resources/lang/executionType_en.md | 12 + .../resources/lang/translations_en.properties | 24 +- .../base/resources/scripts/starship_bash.sh | 8 + .../base/resources/scripts/starship_cmd.bat | 19 + ext/base/src/test/java/test/TextFileTest.java | 2 +- gradle/gradle_scripts/java.gradle | 1 + version | 2 +- 326 files changed, 2633 insertions(+), 10111 deletions(-) delete mode 100644 api/src/main/java/io/xpipe/api/DataRaw.java delete mode 100644 api/src/main/java/io/xpipe/api/DataSource.java delete mode 100644 api/src/main/java/io/xpipe/api/DataSourceConfig.java delete mode 100644 api/src/main/java/io/xpipe/api/DataStructure.java delete mode 100644 api/src/main/java/io/xpipe/api/DataTable.java delete mode 100644 api/src/main/java/io/xpipe/api/DataTableAccumulator.java delete mode 100644 api/src/main/java/io/xpipe/api/DataText.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataRawImpl.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataTableImpl.java delete mode 100644 api/src/main/java/io/xpipe/api/impl/DataTextImpl.java delete mode 100644 app/src/main/java/io/xpipe/app/comp/storage/DataSourceTypeComp.java delete mode 100644 app/src/main/java/io/xpipe/app/exchange/ProxyFunctionExchangeImpl.java delete mode 100644 app/src/main/java/io/xpipe/app/exchange/ProxyReadConnectionExchangeImpl.java delete mode 100644 app/src/main/java/io/xpipe/app/exchange/ProxyWriteConnectionExchangeImpl.java delete mode 100644 app/src/main/java/io/xpipe/app/exchange/ReadExchangeImpl.java delete mode 100644 app/src/main/java/io/xpipe/app/ext/DataSourceProvider.java delete mode 100644 app/src/main/java/io/xpipe/app/ext/DataSourceProviders.java delete mode 100644 app/src/main/java/io/xpipe/app/ext/DataSourceTarget.java create mode 100644 app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java delete mode 100644 app/src/main/java/io/xpipe/app/fxcomps/impl/DynamicOptionsComp.java delete mode 100644 app/src/main/java/io/xpipe/app/fxcomps/impl/WriteModeChoiceComp.java create mode 100644 app/src/main/java/io/xpipe/app/storage/DataStoreEntryRef.java create mode 100644 app/src/main/java/io/xpipe/app/storage/StorageJacksonModule.java create mode 100644 app/src/main/java/io/xpipe/app/util/DiscreteProgressScope.java delete mode 100644 app/src/main/java/io/xpipe/app/util/DynamicOptionsBuilder.java create mode 100644 app/src/main/java/io/xpipe/app/util/FixedHierarchyStore.java create mode 100644 app/src/main/java/io/xpipe/app/util/LicenseException.java create mode 100644 app/src/main/java/io/xpipe/app/util/ProgressScope.java delete mode 100644 app/src/main/java/io/xpipe/app/util/StatefulDataStore.java delete mode 100644 app/src/main/java/io/xpipe/app/util/UniformDataSourceProvider.java create mode 100644 app/src/main/resources/io/xpipe/app/resources/style/data-store-list-choice-comp.css create mode 100644 app/src/main/resources/io/xpipe/app/resources/style/dropdown-comp.css delete mode 100644 beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/SecretProviderImpl.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/AddSourceExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/EditExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/ProxyReadConnectionExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/ProxyWriteConnectionExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/QueryDataSourceExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/ReadExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/ConvertExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveEntryExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameEntryExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/WriteExecuteExchange.java delete mode 100644 beacon/src/main/java/io/xpipe/beacon/exchange/cli/WritePreparationExchange.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericAbstractReader.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamParser.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamWriter.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericDataStructureNodeReader.java delete mode 100644 core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/ArrayNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/DataStructureNodeAcceptor.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/DataStructureNodeIO.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/SimpleArrayNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/SimpleTupleNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/SimpleValueNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/TupleNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/node/ValueNode.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/ArrayType.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/DataType.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/TupleType.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/ValueType.java delete mode 100644 core/src/main/java/io/xpipe/core/data/type/WildcardType.java delete mode 100644 core/src/main/java/io/xpipe/core/data/typed/TypedAbstractReader.java delete mode 100644 core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java delete mode 100644 core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamParser.java delete mode 100644 core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamWriter.java delete mode 100644 core/src/main/java/io/xpipe/core/data/typed/TypedDataStructureNodeReader.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/BatchTableWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/BinarySource.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/BufferedTableReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/LimitTableReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/LocalDirectoryDataStore.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/NamedStore.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/PeekTableStreamReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/PreservingTableWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/PreservingTextWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/SimpleDataSourceConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/StreamReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/StreamWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/TextReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/TextSource.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/TextWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbsReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbsSource.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbsWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbtSource.java delete mode 100644 core/src/main/java/io/xpipe/core/impl/XpbtWriteConnection.java create mode 100644 core/src/main/java/io/xpipe/core/process/ShellStoreState.java delete mode 100644 core/src/main/java/io/xpipe/core/source/CollectionDataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/CollectionReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/CollectionWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/DataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/DataSourceConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/DataSourceReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/DataSourceReference.java delete mode 100644 core/src/main/java/io/xpipe/core/source/DataSourceType.java delete mode 100644 core/src/main/java/io/xpipe/core/source/RawDataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/RawReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/RawWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/StructureDataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/StructureReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/StructureWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TableDataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TableMapping.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TableReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TableWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TextDataSource.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TextReadConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/TextWriteConnection.java delete mode 100644 core/src/main/java/io/xpipe/core/source/WriteMode.java rename core/src/main/java/io/xpipe/core/{source => store}/DataStoreId.java (98%) create mode 100644 core/src/main/java/io/xpipe/core/store/DataStoreState.java rename core/src/main/java/io/xpipe/core/{impl => store}/FileNames.java (99%) rename core/src/main/java/io/xpipe/core/{impl => store}/FileStore.java (94%) delete mode 100644 core/src/main/java/io/xpipe/core/store/FixedHierarchyStore.java delete mode 100644 core/src/main/java/io/xpipe/core/store/GroupStore.java rename core/src/main/java/io/xpipe/core/{impl => store}/InMemoryStore.java (94%) rename core/src/main/java/io/xpipe/core/{impl => store}/InputStreamStore.java (95%) rename core/src/main/java/io/xpipe/core/{impl => store}/InternalStreamStore.java (90%) rename core/src/main/java/io/xpipe/core/{impl => store}/LocalStore.java (69%) rename core/src/main/java/io/xpipe/core/{impl => store}/OutputStreamStore.java (86%) create mode 100644 core/src/main/java/io/xpipe/core/store/StatefulDataStore.java rename core/src/main/java/io/xpipe/core/{impl => store}/StdinDataStore.java (96%) rename core/src/main/java/io/xpipe/core/{impl => store}/StdoutDataStore.java (96%) create mode 100644 core/src/main/java/io/xpipe/core/store/ValidatableStore.java delete mode 100644 core/src/main/java/io/xpipe/core/util/ProxyProvider.java delete mode 100644 core/src/main/java/io/xpipe/core/util/SecretProvider.java create mode 100644 dist/changelogs/1.7.0.md delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/BinarySourceProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/FileStoreProvider.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/GroupStore.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/HttpStore.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/HttpStoreProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/ReadOnlyCollectionSource.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/SimpleCollectionSource.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/SimpleFileDataSourceProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/TextSourceProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/XpbsProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/XpbtProvider.java delete mode 100644 ext/base/src/main/java/io/xpipe/ext/base/action/GroupToggleAction.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/MultiScriptStore.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/MultiScriptStoreProvider.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/PredefinedScriptGroup.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/PredefinedScriptStore.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStore.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStoreProvider.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStoreTypeChoiceComp.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java create mode 100644 ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStoreProvider.java create mode 100644 ext/base/src/main/resources/io/xpipe/ext/base/resources/lang/elevation_en.md create mode 100644 ext/base/src/main/resources/io/xpipe/ext/base/resources/lang/executionType_en.md create mode 100644 ext/base/src/main/resources/io/xpipe/ext/base/resources/scripts/starship_bash.sh create mode 100644 ext/base/src/main/resources/io/xpipe/ext/base/resources/scripts/starship_cmd.bat diff --git a/api/src/main/java/io/xpipe/api/DataRaw.java b/api/src/main/java/io/xpipe/api/DataRaw.java deleted file mode 100644 index a8eaf11e0..000000000 --- a/api/src/main/java/io/xpipe/api/DataRaw.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.xpipe.api; - -import java.io.InputStream; - -public interface DataRaw extends DataSource { - - InputStream open(); - - byte[] readAll(); - - byte[] read(int maxBytes); -} diff --git a/api/src/main/java/io/xpipe/api/DataSource.java b/api/src/main/java/io/xpipe/api/DataSource.java deleted file mode 100644 index 62cc8d65c..000000000 --- a/api/src/main/java/io/xpipe/api/DataSource.java +++ /dev/null @@ -1,229 +0,0 @@ -package io.xpipe.api; - -import io.xpipe.api.impl.DataSourceImpl; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceReference; -import io.xpipe.core.source.DataSourceType; -import io.xpipe.core.store.DataStore; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; - -/** - * Represents a reference to a data source that is managed by XPipe. - *

- * The actual data is only queried when required and is not cached. - * Therefore, the queried data is always up-to-date at the point of calling a method that queries the data. - *

- * As soon a data source reference is created, the data source is locked - * within XPipe to prevent concurrent modification and the problems that can arise from it. - * By default, the lock is held until the calling program terminates and prevents - * other applications from modifying the data source in any way. - * To unlock the data source earlier, you can make use the {@link #unlock()} method. - */ -public interface DataSource { - - /** - * NOT YET IMPLEMENTED! - *

- * Creates a new supplier data source that will be interpreted as the generated data source. - * In case this program should be a data source generator, this method has to be called at - * least once to register that it actually generates a data source. - *

- * All content that is written to this data source until the generator program terminates is - * will be available later on when the data source is used as a supplier later on. - *

- * In case this method is called multiple times, the same data source is returned. - * - * @return the generator data source - */ - static DataSource drain() { - return null; - } - - /** - * NOT YET IMPLEMENTED! - *

- * Creates a data source sink that will block with any read operations - * until an external data producer routes the output into this sink. - */ - static DataSource sink() { - return null; - } - - /** - * Wrapper for {@link #get(DataSourceReference)}. - * - * @throws IllegalArgumentException if {@code id} is not a valid data source id - */ - static DataSource getById(String id) { - return get(DataSourceReference.id(id)); - } - - /** - * Wrapper for {@link #get(DataSourceReference)} using the latest reference. - */ - static DataSource getLatest() { - return get(DataSourceReference.latest()); - } - - /** - * Wrapper for {@link #get(DataSourceReference)} using a name reference. - */ - static DataSource getByName(String name) { - return get(DataSourceReference.name(name)); - } - - /** - * Retrieves the data source for a given reference. - * - * @param ref the data source reference - */ - static DataSource get(DataSourceReference ref) { - return DataSourceImpl.get(ref); - } - - /** - * Releases the lock held by this program for this data source such - * that other applications can modify the data source again. - */ - static void unlock() { - throw new UnsupportedOperationException(); - } - - /** - * Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source. - */ - static DataSource createAnonymous(String type, Path path) { - return create(null, type, path); - } - - /** - * Wrapper for {@link #create(DataStoreId, String, InputStream)}. - */ - static DataSource create(DataStoreId id, String type, Path path) { - try (var in = Files.newInputStream(path)) { - return create(id, type, in); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - /** - * Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source. - */ - static DataSource createAnonymous(String type, URL url) { - return create(null, type, url); - } - - /** - * Wrapper for {@link #create(DataStoreId, String, InputStream)}. - */ - static DataSource create(DataStoreId id, String type, URL url) { - try (var in = url.openStream()) { - return create(id, type, in); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - /** - * Wrapper for {@link #create(DataStoreId, String, InputStream)} that creates an anonymous data source. - */ - static DataSource createAnonymous(String type, InputStream in) { - return create(null, type, in); - } - - /** - * Creates a new data source from an input stream. - * - * @param id the data source id - * @param type the data source type - * @param in the input stream to read - * @return a {@link DataSource} instances that can be used to access the underlying data - */ - static DataSource create(DataStoreId id, String type, InputStream in) { - return DataSourceImpl.create(id, type, in); - } - - /** - * Creates a new data source from an input stream. - * - * @param id the data source id - * @return a {@link DataSource} instances that can be used to access the underlying data - */ - static DataSource create(DataStoreId id, io.xpipe.core.source.DataSource source) { - return DataSourceImpl.create(id, source); - } - - /** - * Creates a new data source from an input stream. - * 1 - * - * @param id the data source id - * @param type the data source type - * @param in the data store to add - * @return a {@link DataSource} instances that can be used to access the underlying data - */ - static DataSource create(DataStoreId id, String type, DataStore in) { - return DataSourceImpl.create(id, type, in); - } - - void forwardTo(DataSource target); - - void appendTo(DataSource target); - - io.xpipe.core.source.DataSource getInternalSource(); - - /** - * Returns the id of this data source. - */ - DataStoreId getId(); - - /** - * Returns the type of this data source. - */ - DataSourceType getType(); - - DataSourceConfig getConfig(); - - /** - * Attempts to cast this object to a {@link DataTable}. - * - * @throws UnsupportedOperationException if the data source is not a table - */ - default DataTable asTable() { - throw new UnsupportedOperationException("Data source is not a table"); - } - - /** - * Attempts to cast this object to a {@link DataStructure}. - * - * @throws UnsupportedOperationException if the data source is not a structure - */ - default DataStructure asStructure() { - throw new UnsupportedOperationException("Data source is not a structure"); - } - - /** - * Attempts to cast this object to a {@link DataText}. - * - * @throws UnsupportedOperationException if the data source is not a text - */ - default DataText asText() { - throw new UnsupportedOperationException("Data source is not a text"); - } - - /** - * Attempts to cast this object to a {@link DataRaw}. - * - * @throws UnsupportedOperationException if the data source is not raw - */ - default DataRaw asRaw() { - throw new UnsupportedOperationException("Data source is not raw"); - } -} diff --git a/api/src/main/java/io/xpipe/api/DataSourceConfig.java b/api/src/main/java/io/xpipe/api/DataSourceConfig.java deleted file mode 100644 index 921488039..000000000 --- a/api/src/main/java/io/xpipe/api/DataSourceConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.xpipe.api; - -import java.util.Map; - -/** - * Represents the current configuration of a data source. - */ -public final class DataSourceConfig { - - /** - * The data source provider id. - */ - private final String provider; - - /** - * The set configuration parameters. - */ - private final Map configInstance; - - public DataSourceConfig(String provider, Map configInstance) { - this.provider = provider; - this.configInstance = configInstance; - } - - public String getProvider() { - return provider; - } - - public Map getConfig() { - return configInstance; - } -} diff --git a/api/src/main/java/io/xpipe/api/DataStructure.java b/api/src/main/java/io/xpipe/api/DataStructure.java deleted file mode 100644 index 6f43874d3..000000000 --- a/api/src/main/java/io/xpipe/api/DataStructure.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.xpipe.api; - -import io.xpipe.core.data.node.DataStructureNode; - -public interface DataStructure extends DataSource { - DataStructureNode read(); -} diff --git a/api/src/main/java/io/xpipe/api/DataTable.java b/api/src/main/java/io/xpipe/api/DataTable.java deleted file mode 100644 index 1fa4a761e..000000000 --- a/api/src/main/java/io/xpipe/api/DataTable.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.xpipe.api; - -import io.xpipe.core.data.node.ArrayNode; -import io.xpipe.core.data.node.TupleNode; - -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Stream; - -public interface DataTable extends Iterable, DataSource { - - Stream stream(); - - ArrayNode readAll(); - - ArrayNode read(int maxRows); - - default int countAndDiscard() { - AtomicInteger count = new AtomicInteger(); - try (var stream = stream()) { - stream.forEach(dataStructureNodes -> { - count.getAndIncrement(); - }); - } - return count.get(); - } -} diff --git a/api/src/main/java/io/xpipe/api/DataTableAccumulator.java b/api/src/main/java/io/xpipe/api/DataTableAccumulator.java deleted file mode 100644 index 768037193..000000000 --- a/api/src/main/java/io/xpipe/api/DataTableAccumulator.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.xpipe.api; - -import io.xpipe.api.impl.DataTableAccumulatorImpl; -import io.xpipe.core.data.node.DataStructureNode; -import io.xpipe.core.data.node.DataStructureNodeAcceptor; -import io.xpipe.core.data.type.TupleType; -import io.xpipe.core.source.DataStoreId; - -/** - * An accumulator for table data. - *

- * This class can be used to construct new table data sources by - * accumulating the rows using {@link #add(DataStructureNode)} or {@link #acceptor()} and then calling - * {@link #finish(DataStoreId)} to complete the construction process and create a new data source. - */ -public interface DataTableAccumulator { - - static DataTableAccumulator create(TupleType type) { - return new DataTableAccumulatorImpl(type); - } - - /** - * Wrapper for {@link #finish(DataStoreId)}. - */ - default DataTable finish(String id) { - return finish(DataStoreId.fromString(id)); - } - - /** - * Finishes the construction process and returns the data source reference. - * - * @param id the data source id to assign - */ - DataTable finish(DataStoreId id); - - /** - * Adds a row to the table. - * - * @param row the row to add - */ - void add(DataStructureNode row); - - /** - * Creates a tuple acceptor that adds all accepted tuples to the table. - */ - DataStructureNodeAcceptor acceptor(); - - /** - * Returns the current amount of rows added to the table. - */ - int getCurrentRows(); -} diff --git a/api/src/main/java/io/xpipe/api/DataText.java b/api/src/main/java/io/xpipe/api/DataText.java deleted file mode 100644 index 864a34d97..000000000 --- a/api/src/main/java/io/xpipe/api/DataText.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.xpipe.api; - -import java.util.List; -import java.util.stream.Stream; - -public interface DataText extends DataSource { - - List readAllLines(); - - List readLines(int maxLines); - - Stream lines(); - - String readAll(); - - String read(int maxCharacters); -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java b/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java deleted file mode 100644 index 4f63432f1..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataRaw; -import io.xpipe.api.DataSourceConfig; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceType; - -import java.io.InputStream; - -public class DataRawImpl extends DataSourceImpl implements DataRaw { - - public DataRawImpl( - DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { - super(sourceId, sourceConfig, internalSource); - } - - @Override - public InputStream open() { - return null; - } - - @Override - public byte[] readAll() { - return new byte[0]; - } - - @Override - public byte[] read(int maxBytes) { - return new byte[0]; - } - - @Override - public DataSourceType getType() { - return DataSourceType.RAW; - } - - @Override - public DataRaw asRaw() { - return this; - } -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java deleted file mode 100644 index 82e4251a5..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java +++ /dev/null @@ -1,161 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataSource; -import io.xpipe.api.DataSourceConfig; -import io.xpipe.api.connector.XPipeApiConnection; -import io.xpipe.beacon.exchange.*; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceReference; -import io.xpipe.core.store.DataStore; -import io.xpipe.core.store.StreamDataStore; - -import java.io.InputStream; - -public abstract class DataSourceImpl implements DataSource { - - private final DataStoreId sourceId; - private final DataSourceConfig config; - private final io.xpipe.core.source.DataSource internalSource; - - public DataSourceImpl( - DataStoreId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource internalSource) { - this.sourceId = sourceId; - this.config = config; - this.internalSource = internalSource; - } - - public static DataSource get(DataSourceReference ds) { - return XPipeApiConnection.execute(con -> { - var req = QueryDataSourceExchange.Request.builder().ref(ds).build(); - QueryDataSourceExchange.Response res = con.performSimpleExchange(req); - var config = new DataSourceConfig(res.getProvider(), res.getConfig()); - return switch (res.getType()) { - case TABLE -> { - yield new DataTableImpl(res.getId(), config, res.getInternalSource()); - } - case STRUCTURE -> { - yield new DataStructureImpl(res.getId(), config, res.getInternalSource()); - } - case TEXT -> { - yield new DataTextImpl(res.getId(), config, res.getInternalSource()); - } - case RAW -> { - yield new DataRawImpl(res.getId(), config, res.getInternalSource()); - } - case COLLECTION -> throw new UnsupportedOperationException("Unimplemented case: " + res.getType()); - default -> throw new IllegalArgumentException("Unexpected value: " + res.getType()); - }; - }); - } - - public static DataSource create(DataStoreId id, io.xpipe.core.source.DataSource source) { - var startReq = - AddSourceExchange.Request.builder().source(source).target(id).build(); - var returnedId = XPipeApiConnection.execute(con -> { - AddSourceExchange.Response r = con.performSimpleExchange(startReq); - return r.getId(); - }); - - var ref = DataSourceReference.id(returnedId); - return get(ref); - } - - public static DataSource create(DataStoreId id, String type, DataStore store) { - if (store instanceof StreamDataStore s && s.isContentExclusivelyAccessible()) { - store = XPipeApiConnection.execute(con -> { - var internal = con.createInternalStreamStore(); - var req = WriteStreamExchange.Request.builder() - .name(internal.getUuid().toString()) - .build(); - con.performOutputExchange(req, out -> { - try (InputStream inputStream = s.openInput()) { - inputStream.transferTo(out); - } - }); - return internal; - }); - } - - var startReq = ReadExchange.Request.builder() - .provider(type) - .store(store) - .target(id) - .configureAll(false) - .build(); - var startRes = XPipeApiConnection.execute(con -> { - return con.performSimpleExchange(startReq); - }); - - var configInstance = startRes.getConfig(); - XPipeApiConnection.finishDialog(configInstance); - - var ref = id != null ? DataSourceReference.id(id) : DataSourceReference.latest(); - return get(ref); - } - - public static DataSource create(DataStoreId id, String type, InputStream in) { - var store = XPipeApiConnection.execute(con -> { - var internal = con.createInternalStreamStore(); - var req = WriteStreamExchange.Request.builder() - .name(internal.getUuid().toString()) - .build(); - con.performOutputExchange(req, out -> { - in.transferTo(out); - }); - return internal; - }); - - var startReq = ReadExchange.Request.builder() - .provider(type) - .store(store) - .target(id) - .configureAll(false) - .build(); - var startRes = XPipeApiConnection.execute(con -> { - return con.performSimpleExchange(startReq); - }); - - var configInstance = startRes.getConfig(); - XPipeApiConnection.finishDialog(configInstance); - - var ref = id != null ? DataSourceReference.id(id) : DataSourceReference.latest(); - return get(ref); - } - - @Override - public void forwardTo(DataSource target) { - XPipeApiConnection.execute(con -> { - var req = ForwardExchange.Request.builder() - .source(DataSourceReference.id(sourceId)) - .target(DataSourceReference.id(target.getId())) - .build(); - ForwardExchange.Response res = con.performSimpleExchange(req); - }); - } - - @Override - public void appendTo(DataSource target) { - XPipeApiConnection.execute(con -> { - var req = ForwardExchange.Request.builder() - .source(DataSourceReference.id(sourceId)) - .target(DataSourceReference.id(target.getId())) - .append(true) - .build(); - ForwardExchange.Response res = con.performSimpleExchange(req); - }); - } - - public io.xpipe.core.source.DataSource getInternalSource() { - return internalSource; - } - - @Override - public DataStoreId getId() { - return sourceId; - } - - @Override - public DataSourceConfig getConfig() { - return config; - } -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java b/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java deleted file mode 100644 index f1e2f8ca1..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataSourceConfig; -import io.xpipe.api.DataStructure; -import io.xpipe.core.data.node.DataStructureNode; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceType; - -public class DataStructureImpl extends DataSourceImpl implements DataStructure { - - DataStructureImpl( - DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { - super(sourceId, sourceConfig, internalSource); - } - - @Override - public DataSourceType getType() { - return DataSourceType.STRUCTURE; - } - - @Override - public DataStructure asStructure() { - return this; - } - - @Override - public DataStructureNode read() { - return null; - } -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java deleted file mode 100644 index cf89065d9..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataSource; -import io.xpipe.api.DataTable; -import io.xpipe.api.DataTableAccumulator; -import io.xpipe.api.connector.XPipeApiConnection; -import io.xpipe.api.util.TypeDescriptor; -import io.xpipe.beacon.BeaconException; -import io.xpipe.beacon.exchange.ReadExchange; -import io.xpipe.beacon.exchange.WriteStreamExchange; -import io.xpipe.beacon.exchange.cli.StoreAddExchange; -import io.xpipe.beacon.util.QuietDialogHandler; -import io.xpipe.core.data.node.DataStructureNode; -import io.xpipe.core.data.node.DataStructureNodeAcceptor; -import io.xpipe.core.data.node.TupleNode; -import io.xpipe.core.data.type.TupleType; -import io.xpipe.core.data.typed.TypedDataStreamWriter; -import io.xpipe.core.impl.InternalStreamStore; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceReference; - -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; - -public class DataTableAccumulatorImpl implements DataTableAccumulator { - - private final XPipeApiConnection connection; - private final TupleType type; - private int rows; - private final InternalStreamStore store; - private TupleType writtenDescriptor; - private final OutputStream bodyOutput; - - public DataTableAccumulatorImpl(TupleType type) { - this.type = type; - connection = XPipeApiConnection.open(); - - store = new InternalStreamStore(); - 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()); - bodyOutput = connection.sendBody(); - } - - @Override - public synchronized DataTable finish(DataStoreId id) { - try { - bodyOutput.close(); - } catch (IOException e) { - throw new BeaconException(e); - } - - WriteStreamExchange.Response res = connection.receiveResponse(); - connection.close(); - - var req = ReadExchange.Request.builder() - .target(id) - .store(store) - .provider("xpbt") - .configureAll(false) - .build(); - ReadExchange.Response response = XPipeApiConnection.execute(con -> { - return con.performSimpleExchange(req); - }); - - var configInstance = response.getConfig(); - XPipeApiConnection.finishDialog(configInstance); - - return DataSource.get(DataSourceReference.id(id)).asTable(); - } - - private void writeDescriptor() { - if (writtenDescriptor != null) { - return; - } - writtenDescriptor = TupleType.tableType(type.getNames()); - - connection.withOutputStream(out -> { - out.write((TypeDescriptor.create(type.getNames())).getBytes(StandardCharsets.UTF_8)); - }); - } - - @Override - public synchronized void add(DataStructureNode row) { - TupleNode toUse = type.matches(row) - ? row.asTuple() - : type.convert(row).orElseThrow().asTuple(); - connection.withOutputStream(out -> { - writeDescriptor(); - TypedDataStreamWriter.writeStructure(out, toUse, writtenDescriptor); - rows++; - }); - } - - @Override - public synchronized DataStructureNodeAcceptor acceptor() { - return node -> { - add(node); - return true; - }; - } - - @Override - public synchronized int getCurrentRows() { - return rows; - } -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java deleted file mode 100644 index 7b06e22f6..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataSourceConfig; -import io.xpipe.api.DataTable; -import io.xpipe.core.data.node.ArrayNode; -import io.xpipe.core.data.node.DataStructureNode; -import io.xpipe.core.data.node.TupleNode; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceType; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Stream; - -public class DataTableImpl extends DataSourceImpl implements DataTable { - - DataTableImpl(DataStoreId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { - super(id, sourceConfig, internalSource); - } - - @Override - public DataTable asTable() { - return this; - } - - public Stream stream() { - return Stream.of(); - } - - @Override - public DataSourceType getType() { - return DataSourceType.TABLE; - } - - @Override - public ArrayNode readAll() { - return read(Integer.MAX_VALUE); - } - - @Override - public ArrayNode read(int maxRows) { - List nodes = new ArrayList<>(); - return ArrayNode.of(nodes); - } - - @Override - public Iterator iterator() { - return new Iterator<>() { - @Override - public boolean hasNext() { - return false; - } - - @Override - public TupleNode next() { - return null; - } - }; - } -} diff --git a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java deleted file mode 100644 index 19658e9ce..000000000 --- a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package io.xpipe.api.impl; - -import io.xpipe.api.DataSourceConfig; -import io.xpipe.api.DataText; -import io.xpipe.core.source.DataStoreId; -import io.xpipe.core.source.DataSourceType; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class DataTextImpl extends DataSourceImpl implements DataText { - - DataTextImpl( - DataStoreId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { - super(sourceId, sourceConfig, internalSource); - } - - @Override - public DataSourceType getType() { - return DataSourceType.TEXT; - } - - @Override - public DataText asText() { - return this; - } - - @Override - public List readAllLines() { - return readLines(Integer.MAX_VALUE); - } - - @Override - public List readLines(int maxLines) { - try (Stream lines = lines()) { - return lines.limit(maxLines).toList(); - } - } - - @Override - public Stream lines() { - return Stream.of(); - } - - @Override - public String readAll() { - try (Stream lines = lines()) { - return lines.collect(Collectors.joining("\n")); - } - } - - @Override - public String read(int maxCharacters) { - StringBuilder builder = new StringBuilder(); - lines().takeWhile(s -> { - if (builder.length() > maxCharacters) { - return false; - } - - builder.append(s); - return true; - }); - return builder.toString(); - } -} diff --git a/api/src/test/java/io/xpipe/api/test/DataTableTest.java b/api/src/test/java/io/xpipe/api/test/DataTableTest.java index 95ef63d3b..272c7b252 100644 --- a/api/src/test/java/io/xpipe/api/test/DataTableTest.java +++ b/api/src/test/java/io/xpipe/api/test/DataTableTest.java @@ -1,7 +1,7 @@ package io.xpipe.api.test; import io.xpipe.api.DataSource; -import io.xpipe.core.source.DataStoreId; +import io.xpipe.core.store.DataStoreId; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/app/build.gradle b/app/build.gradle index 9abeddd96..a979e3337 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -138,7 +138,7 @@ application { run { systemProperty 'io.xpipe.app.useVirtualThreads', 'false' systemProperty 'io.xpipe.app.mode', 'gui' - systemProperty 'io.xpipe.app.dataDir', "$projectDir/local_git2/" + systemProperty 'io.xpipe.app.dataDir', "$projectDir/local_git3/" systemProperty 'io.xpipe.app.writeLogs', "true" systemProperty 'io.xpipe.app.writeSysOut', "true" systemProperty 'io.xpipe.app.developerMode', "true" diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java b/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java index 2f3a20d6d..788fa2e81 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java @@ -12,11 +12,10 @@ import io.xpipe.app.fxcomps.impl.HorizontalComp; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.util.BooleanScope; import io.xpipe.app.util.DataStoreCategoryChoiceComp; +import io.xpipe.app.util.FixedHierarchyStore; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.store.DataStore; -import io.xpipe.core.store.FixedHierarchyStore; import io.xpipe.core.store.ShellStore; -import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -53,7 +52,7 @@ final class BrowserBookmarkList extends SimpleComp { Predicate applicable = storeEntryWrapper -> { return (storeEntryWrapper.getEntry().getStore() instanceof ShellStore || storeEntryWrapper.getEntry().getStore() instanceof FixedHierarchyStore) - && storeEntryWrapper.getEntry().getState().isUsable(); + && storeEntryWrapper.getEntry().getValidity().isUsable(); }; var section = StoreSectionMiniComp.createList( StoreSection.createTopLevel( @@ -68,7 +67,7 @@ final class BrowserBookmarkList extends SimpleComp { .pseudoClassStateChanged( SELECTED, newValue != null - && newValue.getStore() + && newValue.getEntry() .equals(s.getWrapper() .getEntry() .getStore())); @@ -77,13 +76,10 @@ final class BrowserBookmarkList extends SimpleComp { ThreadHelper.runFailableAsync(() -> { var entry = s.getWrapper().getEntry(); if (entry.getStore() instanceof ShellStore fileSystem) { - BooleanScope.execute(busy, () -> { - s.getWrapper().refreshIfNeeded(); - }); - model.openFileSystemAsync(null, fileSystem, null, busy); + model.openFileSystemAsync(entry.ref(), null, busy); } else if (entry.getStore() instanceof FixedHierarchyStore) { BooleanScope.execute(busy, () -> { - s.getWrapper().refreshWithChildren(); + s.getWrapper().refreshChildren(); }); } }); @@ -125,7 +121,7 @@ final class BrowserBookmarkList extends SimpleComp { return; } - Platform.runLater(() -> model.openExistingFileSystemIfPresent(null, store.asNeeded())); + // Platform.runLater(() -> model.openExistingFileSystemIfPresent(store.asNeeded())); } }; DROP_TIMER.schedule(activeTask, 500); diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserBreadcrumbBar.java b/app/src/main/java/io/xpipe/app/browser/BrowserBreadcrumbBar.java index 8afc08ecc..5acbcc856 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserBreadcrumbBar.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserBreadcrumbBar.java @@ -4,7 +4,7 @@ import atlantafx.base.controls.Breadcrumbs; import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.SimpleChangeListener; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.ButtonBase; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserComp.java index d940b836e..0cb75c85a 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserComp.java @@ -7,7 +7,6 @@ import io.xpipe.app.browser.icon.DirectoryType; import io.xpipe.app.browser.icon.FileIconManager; import io.xpipe.app.browser.icon.FileType; import io.xpipe.app.comp.base.MultiContentComp; -import io.xpipe.app.ext.DataStoreProviders; import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.impl.FancyTooltipAugment; @@ -252,7 +251,7 @@ public class BrowserComp extends SimpleComp { .bind(Bindings.createDoubleBinding( () -> model.getBusy().get() ? -1d : 0, PlatformThread.sync(model.getBusy()))); - var image = DataStoreProviders.byStore(model.getStore()).getDisplayIconFileName(model.getStore()); + var image = model.getEntry().get().getProvider().getDisplayIconFileName(model.getEntry().getStore()); var logo = PrettyImageHelper.ofFixedSquare(image, 16).createRegion(); tab.graphicProperty() diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserEntry.java b/app/src/main/java/io/xpipe/app/browser/BrowserEntry.java index 1d718a726..381eff69d 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserEntry.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserEntry.java @@ -2,7 +2,7 @@ package io.xpipe.app.browser; import io.xpipe.app.browser.icon.DirectoryType; import io.xpipe.app.browser.icon.FileType; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileSystem; import lombok.Getter; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserFileListComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserFileListComp.java index 6f995e40e..d058ce311 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserFileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserFileListComp.java @@ -12,7 +12,7 @@ import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.util.BooleanScope; import io.xpipe.app.util.HumanReadableFormat; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.process.OsType; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileSystem; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserFileListModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserFileListModel.java index bce6612e1..f82d27414 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserFileListModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserFileListModel.java @@ -2,7 +2,7 @@ package io.xpipe.app.browser; import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.issue.ErrorEvent; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileSystem; import javafx.beans.property.Property; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserModel.java index e876e07e1..b0fc483ab 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserModel.java @@ -2,10 +2,11 @@ package io.xpipe.app.browser; import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.storage.DataStorage; +import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.BooleanScope; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.impl.FileStore; -import io.xpipe.core.store.ShellStore; +import io.xpipe.core.store.FileStore; +import io.xpipe.core.store.FileSystemStore; import javafx.beans.property.BooleanProperty; import javafx.beans.property.Property; import javafx.beans.property.SimpleBooleanProperty; @@ -76,18 +77,19 @@ public class BrowserModel { } public void restoreState(BrowserSavedState.Entry e, BooleanProperty busy) { - var storageEntry = DataStorage.get().getStoreEntry(e.getUuid()); + var storageEntry = DataStorage.get().getStoreEntryIfPresent(e.getUuid()); storageEntry.ifPresent(entry -> { - openFileSystemAsync(null, entry.getStore().asNeeded(), e.getPath(), busy); + openFileSystemAsync(entry.ref(), e.getPath(), busy); }); } public void reset() { var list = new ArrayList(); openFileSystems.forEach(model -> { - var storageEntry = DataStorage.get().getStoreEntryIfPresent(model.getStore()); - storageEntry.ifPresent(entry -> list.add(new BrowserSavedState.Entry( - entry.getUuid(), model.getCurrentPath().get()))); + if (DataStorage.get().getStoreEntries().contains(model.getEntry().get())) { + list.add(new BrowserSavedState.Entry( + model.getEntry().get().getUuid(), model.getCurrentPath().get())); + } }); // Don't override state if it is empty @@ -138,18 +140,18 @@ public class BrowserModel { }); } - public void openExistingFileSystemIfPresent(String name, ShellStore store) { + public void openExistingFileSystemIfPresent(DataStoreEntryRef store) { var found = openFileSystems.stream() - .filter(model -> Objects.equals(model.getStore(), store)) + .filter(model -> Objects.equals(model.getEntry(), store)) .findFirst(); if (found.isPresent()) { selected.setValue(found.get()); } else { - openFileSystemAsync(name, store, null, null); + openFileSystemAsync(store, null, null); } } - public void openFileSystemAsync(String name, ShellStore store, String path, BooleanProperty externalBusy) { + public void openFileSystemAsync(DataStoreEntryRef store, String path, BooleanProperty externalBusy) { // // Prevent multiple tabs in non browser modes // if (!mode.equals(Mode.BROWSER)) { // ThreadHelper.runFailableAsync(() -> { @@ -177,7 +179,7 @@ public class BrowserModel { // Prevent multiple calls from interfering with each other synchronized (BrowserModel.this) { try (var b = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) { - model = new OpenFileSystemModel(name, this, store); + model = new OpenFileSystemModel(this, store); model.initFileSystem(); model.initSavedState(); } diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java index ab5f45cec..55f242b94 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java @@ -8,7 +8,7 @@ import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.impl.PrettyImageHelper; import io.xpipe.app.fxcomps.util.PlatformThread; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileSystem; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserTransferComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserTransferComp.java index 11a2f0f50..cf12eaae7 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserTransferComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserTransferComp.java @@ -9,7 +9,7 @@ import io.xpipe.app.fxcomps.impl.*; import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.storage.DataStorage; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import javafx.beans.binding.Bindings; import javafx.collections.FXCollections; import javafx.geometry.Insets; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java index df32461ae..0204c9fef 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java @@ -2,7 +2,7 @@ package io.xpipe.app.browser; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.BooleanScope; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileSystem; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java index 1167800ff..48c6ef9e2 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserWelcomeComp.java @@ -54,12 +54,12 @@ public class BrowserWelcomeComp extends SimpleComp { var storeList = new VBox(); storeList.setSpacing(8); state.getLastSystems().forEach(e -> { - var entry = DataStorage.get().getStoreEntry(e.getUuid()); + var entry = DataStorage.get().getStoreEntryIfPresent(e.getUuid()); if (entry.isEmpty()) { return; } - if (!entry.get().getState().isUsable()) { + if (!entry.get().getValidity().isUsable()) { return; } @@ -68,7 +68,7 @@ public class BrowserWelcomeComp extends SimpleComp { var view = PrettyImageHelper.ofFixedSquare(graphic, 45); view.padding(new Insets(2, 8, 2, 8)); var tile = new Tile( - DataStorage.get().getStoreBrowserDisplayName(entry.get().getStore()), + DataStorage.get().getStoreBrowserDisplayName(entry.get()), e.getPath(), view.createRegion()); tile.setActionHandler(() -> { diff --git a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java index 2432bef7c..ac39454c3 100644 --- a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java +++ b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java @@ -1,8 +1,8 @@ package io.xpipe.app.browser; import io.xpipe.app.issue.ErrorEvent; -import io.xpipe.core.impl.FileNames; -import io.xpipe.core.impl.LocalStore; +import io.xpipe.core.store.FileNames; +import io.xpipe.core.store.LocalStore; import io.xpipe.core.process.OsType; import io.xpipe.core.store.ConnectionFileSystem; import io.xpipe.core.store.FileKind; diff --git a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java index e87a779fa..e3e1779cb 100644 --- a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java @@ -3,10 +3,11 @@ package io.xpipe.app.browser; import io.xpipe.app.comp.base.ModalOverlayComp; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.storage.DataStorage; +import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.BooleanScope; import io.xpipe.app.util.TerminalHelper; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; import io.xpipe.core.store.*; @@ -26,7 +27,7 @@ import java.util.stream.Stream; @Getter public final class OpenFileSystemModel { - private final FileSystemStore store; + private final DataStoreEntryRef entry; private FileSystem fileSystem; private final Property filter = new SimpleStringProperty(); private final BrowserFileListModel fileList; @@ -42,12 +43,11 @@ public final class OpenFileSystemModel { private final String tooltip; private boolean local; - public OpenFileSystemModel(String name, BrowserModel browserModel, FileSystemStore store) { + public OpenFileSystemModel(BrowserModel browserModel, DataStoreEntryRef entry) { this.browserModel = browserModel; - this.store = store; - var e = DataStorage.get().getStoreEntryIfPresent(store); - this.name = name != null ? name : e.isPresent() ? DataStorage.get().getStoreBrowserDisplayName(store) : "?"; - this.tooltip = e.isPresent() ? DataStorage.get().getId(e.get()).toString() : name; + this.entry = entry; + this.name = entry.get().getName(); + this.tooltip = DataStorage.get().getId(entry.getEntry()).toString(); this.inOverview.bind(Bindings.createBooleanBinding( () -> { return currentPath.get() == null; @@ -63,7 +63,7 @@ public final class OpenFileSystemModel { } BooleanScope.execute(busy, () -> { - if (store instanceof ShellStore s) { + if (entry.getStore() instanceof ShellStore s) { c.accept(fileSystem.getShell().orElseThrow()); if (refresh) { refreshSync(); @@ -150,8 +150,7 @@ public final class OpenFileSystemModel { if (allowCommands && evaluatedPath != null && !FileNames.isAbsolute(evaluatedPath) && fileSystem.getShell().isPresent()) { var directory = currentPath.get(); - var name = adjustedPath + " - " - + DataStorage.get().getStoreDisplayName(store).orElse("?"); + var name = adjustedPath + " - " + entry.get().getName(); ThreadHelper.runFailableAsync(() -> { if (ShellDialects.ALL.stream() .anyMatch(dialect -> adjustedPath.startsWith(dialect.getOpenCommand()))) { @@ -205,7 +204,7 @@ public final class OpenFileSystemModel { private void cdSyncWithoutCheck(String path) throws Exception { if (fileSystem == null) { - var fs = store.createFileSystem(); + var fs = entry.getStore().createFileSystem(); fs.open(); this.fileSystem = fs; } @@ -364,7 +363,7 @@ public final class OpenFileSystemModel { public void initFileSystem() throws Exception { BooleanScope.execute(busy, () -> { - var fs = store.createFileSystem(); + var fs = entry.getStore().createFileSystem(); fs.open(); this.fileSystem = fs; this.local = @@ -393,23 +392,17 @@ public final class OpenFileSystemModel { } BooleanScope.execute(busy, () -> { - if (store instanceof ShellStore s) { + if (entry.getStore() instanceof ShellStore s) { var connection = ((ConnectionFileSystem) fileSystem).getShellControl(); var command = s.control() .initWith(connection.getShellDialect().getCdCommand(directory)) - .prepareTerminalOpen(directory + " - " - + DataStorage.get().getStoreDisplayName(store) - .orElse("?")); + .prepareTerminalOpen(directory + " - " + entry.get().getName()); TerminalHelper.open(directory, command); } }); }); } - public OpenFileSystemHistory getHistory() { - return history; - } - public void backSync() throws Exception { cdSyncWithoutCheck(history.back()); } diff --git a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemSavedState.java b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemSavedState.java index b495552c8..1cae5619c 100644 --- a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemSavedState.java +++ b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemSavedState.java @@ -12,8 +12,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import io.xpipe.app.core.AppCache; -import io.xpipe.app.storage.DataStorage; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.util.JacksonMapper; import javafx.application.Platform; import javafx.collections.FXCollections; @@ -81,11 +80,7 @@ public class OpenFileSystemSavedState { } static OpenFileSystemSavedState loadForStore(OpenFileSystemModel model) { - var storageEntry = DataStorage.get() - .getStoreEntryIfPresent(model.getStore()) - .map(entry -> entry.getUuid()) - .orElse(UUID.randomUUID()); - var state = AppCache.get("fs-state-" + storageEntry, OpenFileSystemSavedState.class, () -> { + var state = AppCache.get("fs-state-" + model.getEntry().get().getUuid(), OpenFileSystemSavedState.class, () -> { return new OpenFileSystemSavedState(); }); state.setModel(model); @@ -127,8 +122,7 @@ public class OpenFileSystemSavedState { return; } - var storageEntry = DataStorage.get().getStoreEntryIfPresent(model.getStore()); - storageEntry.ifPresent(entry -> AppCache.update("fs-state-" + entry.getUuid(), this)); + AppCache.update("fs-state-" + model.getEntry().get().getUuid(), this); } public void cd(String dir) { diff --git a/app/src/main/java/io/xpipe/app/browser/StandaloneFileBrowser.java b/app/src/main/java/io/xpipe/app/browser/StandaloneFileBrowser.java index 844508d82..0e040144e 100644 --- a/app/src/main/java/io/xpipe/app/browser/StandaloneFileBrowser.java +++ b/app/src/main/java/io/xpipe/app/browser/StandaloneFileBrowser.java @@ -4,8 +4,9 @@ import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppWindowHelper; import io.xpipe.app.fxcomps.util.PlatformThread; -import io.xpipe.core.impl.FileStore; -import io.xpipe.core.store.ShellStore; +import io.xpipe.app.storage.DataStoreEntryRef; +import io.xpipe.core.store.FileStore; +import io.xpipe.core.store.FileSystemStore; import javafx.beans.property.Property; import javafx.stage.FileChooser; import javafx.stage.Window; @@ -38,7 +39,7 @@ public class StandaloneFileBrowser { }); } - public static void openSingleFile(Supplier store, Consumer file) { + public static void openSingleFile(Supplier> store, Consumer file) { PlatformThread.runLaterIfNeeded(() -> { var model = new BrowserModel(BrowserModel.Mode.SINGLE_FILE_CHOOSER); var comp = new BrowserComp(model) @@ -50,7 +51,7 @@ public class StandaloneFileBrowser { window.close(); }); window.show(); - model.openFileSystemAsync(null, store.get(), null, null); + model.openFileSystemAsync(store.get(), null, null); }); } diff --git a/app/src/main/java/io/xpipe/app/browser/action/MultiExecuteAction.java b/app/src/main/java/io/xpipe/app/browser/action/MultiExecuteAction.java index 81b522daa..049eaf310 100644 --- a/app/src/main/java/io/xpipe/app/browser/action/MultiExecuteAction.java +++ b/app/src/main/java/io/xpipe/app/browser/action/MultiExecuteAction.java @@ -5,7 +5,7 @@ import io.xpipe.app.browser.OpenFileSystemModel; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.ScriptHelper; import io.xpipe.app.util.TerminalHelper; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.process.ShellControl; import org.apache.commons.io.FilenameUtils; diff --git a/app/src/main/java/io/xpipe/app/browser/icon/DirectoryType.java b/app/src/main/java/io/xpipe/app/browser/icon/DirectoryType.java index 0b91da25d..cfc1d9036 100644 --- a/app/src/main/java/io/xpipe/app/browser/icon/DirectoryType.java +++ b/app/src/main/java/io/xpipe/app/browser/icon/DirectoryType.java @@ -1,7 +1,7 @@ package io.xpipe.app.browser.icon; import io.xpipe.app.core.AppResources; -import io.xpipe.core.impl.FileNames; +import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileSystem; import lombok.Getter; diff --git a/app/src/main/java/io/xpipe/app/comp/base/DropdownComp.java b/app/src/main/java/io/xpipe/app/comp/base/DropdownComp.java index 5431a87e1..6dd2cd2b2 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/DropdownComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/DropdownComp.java @@ -3,66 +3,53 @@ package io.xpipe.app.comp.base; import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.CompStructure; import io.xpipe.app.fxcomps.SimpleCompStructure; +import io.xpipe.app.fxcomps.augment.ContextMenuAugment; +import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.fxcomps.util.SimpleChangeListener; -import javafx.beans.property.ObjectProperty; -import javafx.beans.property.SimpleObjectProperty; -import javafx.beans.value.ObservableValue; import javafx.css.Size; import javafx.css.SizeUnits; -import javafx.scene.Node; -import javafx.scene.control.MenuButton; +import javafx.scene.control.Button; +import javafx.scene.control.ContextMenu; import javafx.scene.control.MenuItem; import org.kordamp.ikonli.javafx.FontIcon; import java.util.List; -public class DropdownComp extends Comp >{ +public class DropdownComp extends Comp> { - private final ObservableValue name; - private final ObjectProperty graphic; private final List> items; - public DropdownComp(ObservableValue name, List> items) { - this.name = name; - this.graphic = new SimpleObjectProperty<>(null); + public DropdownComp(List> items) { this.items = items; } - public DropdownComp(ObservableValue name, Node graphic, List> items) { - this.name = name; - this.graphic = new SimpleObjectProperty<>(graphic); - this.items = items; - } - - public Node getGraphic() { - return graphic.get(); - } - - public ObjectProperty graphicProperty() { - return graphic; - } - @Override - public CompStructure createBase() { - var button = new MenuButton(null); - if (name != null) { - button.textProperty().bind(name); - } - var graphic = getGraphic(); - if (graphic instanceof FontIcon f) { - SimpleChangeListener.apply(button.fontProperty(), c -> { - f.setIconSize((int) new Size(c.getSize(), SizeUnits.PT).pixels()); - }); - } + public CompStructure