diff --git a/apitest/src/main/java/bisq/apitest/Scaffold.java b/apitest/src/main/java/bisq/apitest/Scaffold.java index e186488e99..8455a585b2 100644 --- a/apitest/src/main/java/bisq/apitest/Scaffold.java +++ b/apitest/src/main/java/bisq/apitest/Scaffold.java @@ -289,13 +289,13 @@ public class Scaffold { startBisqApp(bobdesktop, executor, countdownLatch); } - private void startBisqApp(HavenoAppConfig bisqAppConfig, + private void startBisqApp(HavenoAppConfig havenoAppConfig, ExecutorService executor, CountDownLatch countdownLatch) throws IOException, InterruptedException { - HavenoProcess bisqProcess = createBisqProcess(bisqAppConfig); - switch (bisqAppConfig) { + HavenoProcess bisqProcess = createBisqProcess(havenoAppConfig); + switch (havenoAppConfig) { case seednode: seedNodeTask = new SetupTask(bisqProcess, countdownLatch); seedNodeTaskFuture = executor.submit(seedNodeTask); @@ -316,9 +316,9 @@ public class Scaffold { bobNodeTaskFuture = executor.submit(bobNodeTask); break; default: - throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name()); + throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name()); } - log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, bisqAppConfig.appName); + log.info("Giving {} ms for {} to initialize ...", config.bisqAppInitTime, havenoAppConfig.appName); MILLISECONDS.sleep(config.bisqAppInitTime); if (bisqProcess.hasStartupExceptions()) { bisqProcess.logExceptions(bisqProcess.getStartupExceptions(), log); @@ -326,9 +326,9 @@ public class Scaffold { } } - private HavenoProcess createBisqProcess(HavenoAppConfig bisqAppConfig) + private HavenoProcess createBisqProcess(HavenoAppConfig havenoAppConfig) throws IOException, InterruptedException { - HavenoProcess bisqProcess = new HavenoProcess(bisqAppConfig, config); + HavenoProcess bisqProcess = new HavenoProcess(havenoAppConfig, config); bisqProcess.verifyAppNotRunning(); bisqProcess.verifyAppDataDirInstalled(); return bisqProcess; diff --git a/apitest/src/main/java/bisq/apitest/config/HavenoAppConfig.java b/apitest/src/main/java/bisq/apitest/config/HavenoAppConfig.java index a66e0e013f..3411aff707 100644 --- a/apitest/src/main/java/bisq/apitest/config/HavenoAppConfig.java +++ b/apitest/src/main/java/bisq/apitest/config/HavenoAppConfig.java @@ -118,7 +118,7 @@ public enum HavenoAppConfig { @Override public String toString() { - return "BisqAppConfig{" + "\n" + + return "HavenoAppConfig{" + "\n" + " appName='" + appName + '\'' + "\n" + ", startupScript='" + startupScript + '\'' + "\n" + ", javaOpts='" + javaOpts + '\'' + "\n" + diff --git a/apitest/src/main/java/bisq/apitest/linux/HavenoProcess.java b/apitest/src/main/java/bisq/apitest/linux/HavenoProcess.java index 8eafaefa02..a08c66f5b8 100644 --- a/apitest/src/main/java/bisq/apitest/linux/HavenoProcess.java +++ b/apitest/src/main/java/bisq/apitest/linux/HavenoProcess.java @@ -43,7 +43,7 @@ import bisq.daemon.app.HavenoDaemonMain; @Slf4j public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess { - private final HavenoAppConfig bisqAppConfig; + private final HavenoAppConfig havenoAppConfig; private final String baseCurrencyNetwork; private final String genesisTxId; private final int genesisBlockHeight; @@ -53,9 +53,9 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess private final String findBisqPidScript; private final String debugOpts; - public HavenoProcess(HavenoAppConfig bisqAppConfig, ApiTestConfig config) { - super(bisqAppConfig.appName, config); - this.bisqAppConfig = bisqAppConfig; + public HavenoProcess(HavenoAppConfig havenoAppConfig, ApiTestConfig config) { + super(havenoAppConfig.appName, config); + this.havenoAppConfig = havenoAppConfig; this.baseCurrencyNetwork = "XMR_STAGENET"; this.genesisTxId = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf"; this.genesisBlockHeight = 111; @@ -65,7 +65,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess this.findBisqPidScript = (config.isRunningTest ? "." : "./apitest") + "/scripts/get-bisq-pid.sh"; this.debugOpts = config.enableBisqDebugging - ? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + bisqAppConfig.remoteDebugPort + ? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:" + havenoAppConfig.remoteDebugPort : ""; } @@ -89,33 +89,33 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess @Override public void shutdown() { try { - log.info("Shutting down {} ...", bisqAppConfig.appName); + log.info("Shutting down {} ...", havenoAppConfig.appName); if (!isAlive(pid)) { - this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", bisqAppConfig.appName))); + this.shutdownExceptions.add(new IllegalStateException(format("%s already shut down", havenoAppConfig.appName))); return; } String killCmd = "kill -15 " + pid; if (new BashCommand(killCmd).run().getExitStatus() != 0) { - this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", bisqAppConfig.appName))); + this.shutdownExceptions.add(new IllegalStateException(format("Could not shut down %s", havenoAppConfig.appName))); return; } // Be lenient about the time it takes for a java app to shut down. for (int i = 0; i < 5; i++) { if (!isAlive(pid)) { - log.info("{} stopped", bisqAppConfig.appName); + log.info("{} stopped", havenoAppConfig.appName); break; } MILLISECONDS.sleep(2500); } if (isAlive(pid)) { - this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", bisqAppConfig.appName))); + this.shutdownExceptions.add(new IllegalStateException(format("%s shutdown did not work", havenoAppConfig.appName))); } } catch (Exception e) { - this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", bisqAppConfig.appName), e)); + this.shutdownExceptions.add(new IllegalStateException(format("Error shutting down %s", havenoAppConfig.appName), e)); } } @@ -123,21 +123,21 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess long pid = findBisqAppPid(); if (pid >= 0) throw new IllegalStateException(format("%s %s already running with pid %d", - bisqAppConfig.mainClassName, bisqAppConfig.appName, pid)); + havenoAppConfig.mainClassName, havenoAppConfig.appName, pid)); } public void verifyAppDataDirInstalled() { // If we're running an Alice or Bob daemon, make sure the dao-setup directory // are installed. - switch (bisqAppConfig) { + switch (havenoAppConfig) { case alicedaemon: case alicedesktop: case bobdaemon: case bobdesktop: - File bisqDataDir = new File(config.rootAppDataDir, bisqAppConfig.appName); + File bisqDataDir = new File(config.rootAppDataDir, havenoAppConfig.appName); if (!bisqDataDir.exists()) throw new IllegalStateException(format("Application dataDir %s/%s not found", - config.rootAppDataDir, bisqAppConfig.appName)); + config.rootAppDataDir, havenoAppConfig.appName)); break; default: break; @@ -152,7 +152,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess String classpath = System.getProperty("java.class.path"); String bisqCmd = getJavaOptsSpec() + " " + java + " -cp " + classpath - + " " + bisqAppConfig.mainClassName + + " " + havenoAppConfig.mainClassName + " " + String.join(" ", getOptsList()) + " &"; // run in background without nohup runBashCommand(bisqCmd); @@ -163,7 +163,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess // are loaded from the root project's lib directory. private void runStartupScript() throws IOException, InterruptedException { String startupScriptPath = config.rootProjectDir - + "/" + bisqAppConfig.startupScript; + + "/" + havenoAppConfig.startupScript; String bisqCmd = getJavaOptsSpec() + " " + startupScriptPath + " " + String.join(" ", getOptsList()) @@ -173,15 +173,15 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess private void runBashCommand(String bisqCmd) throws IOException, InterruptedException { String cmdDescription = config.runSubprojectJars - ? "java -> " + bisqAppConfig.mainClassName + " -> " + bisqAppConfig.appName - : bisqAppConfig.startupScript + " -> " + bisqAppConfig.appName; + ? "java -> " + havenoAppConfig.mainClassName + " -> " + havenoAppConfig.appName + : havenoAppConfig.startupScript + " -> " + havenoAppConfig.appName; BashCommand bashCommand = new BashCommand(bisqCmd); log.info("Starting {} ...\n$ {}", cmdDescription, bashCommand.getCommand()); bashCommand.runInBackground(); if (bashCommand.getExitStatus() != 0) throw new IllegalStateException(format("Error starting BisqApp%n%s%nError: %s", - bisqAppConfig.appName, + havenoAppConfig.appName, bashCommand.getError())); // Sometimes it takes a little extra time to find the linux process id. @@ -197,26 +197,26 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess throw new IllegalStateException(format("Error finding pid for %s", this.name)); log.info("{} running with pid {}", cmdDescription, pid); - log.info("Log {}", config.rootAppDataDir + "/" + bisqAppConfig.appName + "/bisq.log"); + log.info("Log {}", config.rootAppDataDir + "/" + havenoAppConfig.appName + "/bisq.log"); } private long findBisqAppPid() throws IOException, InterruptedException { // Find the pid of the java process by grepping for the mainClassName and appName. - String findPidCmd = findBisqPidScript + " " + bisqAppConfig.mainClassName + " " + bisqAppConfig.appName; + String findPidCmd = findBisqPidScript + " " + havenoAppConfig.mainClassName + " " + havenoAppConfig.appName; String psCmdOutput = new BashCommand(findPidCmd).run().getOutput(); return (psCmdOutput == null || psCmdOutput.isEmpty()) ? -1 : Long.parseLong(psCmdOutput); } private String getJavaOptsSpec() { - return "export JAVA_OPTS=\"" + bisqAppConfig.javaOpts + debugOpts + "\"; "; + return "export JAVA_OPTS=\"" + havenoAppConfig.javaOpts + debugOpts + "\"; "; } private List getOptsList() { return new ArrayList<>() {{ - add("--appName=" + bisqAppConfig.appName); - add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + bisqAppConfig.appName); - add("--nodePort=" + bisqAppConfig.nodePort); - add("--rpcBlockNotificationPort=" + bisqAppConfig.rpcBlockNotificationPort); + add("--appName=" + havenoAppConfig.appName); + add("--appDataDir=" + config.rootAppDataDir.getAbsolutePath() + "/" + havenoAppConfig.appName); + add("--nodePort=" + havenoAppConfig.nodePort); + add("--rpcBlockNotificationPort=" + havenoAppConfig.rpcBlockNotificationPort); add("--rpcUser=" + config.bitcoinRpcUser); add("--rpcPassword=" + config.bitcoinRpcPassword); add("--rpcPort=" + config.bitcoinRpcPort); @@ -224,7 +224,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess add("--baseCurrencyNetwork=" + baseCurrencyNetwork); add("--useDevPrivilegeKeys=" + useDevPrivilegeKeys); add("--useLocalhostForP2P=" + useLocalhostForP2P); - switch (bisqAppConfig) { + switch (havenoAppConfig) { case seednode: break; // no extra opts needed for seed node case arbdaemon: @@ -235,13 +235,13 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess case bobdesktop: add("--genesisBlockHeight=" + genesisBlockHeight); add("--genesisTxId=" + genesisTxId); - if (bisqAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) { + if (havenoAppConfig.mainClassName.equals(HavenoDaemonMain.class.getName())) { add("--apiPassword=" + config.apiPassword); - add("--apiPort=" + bisqAppConfig.apiPort); + add("--apiPort=" + havenoAppConfig.apiPort); } break; default: - throw new IllegalStateException("Unknown BisqAppConfig " + bisqAppConfig.name()); + throw new IllegalStateException("Unknown HavenoAppConfig " + havenoAppConfig.name()); } }}; } @@ -249,7 +249,7 @@ public class HavenoProcess extends AbstractLinuxProcess implements LinuxProcess private File getJavaExecutable() { File javaHome = Paths.get(System.getProperty("java.home")).toFile(); if (!javaHome.exists()) - throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", bisqAppConfig.mainClassName)); + throw new IllegalStateException(format("$JAVA_HOME not found, cannot run %s", havenoAppConfig.mainClassName)); File javaExecutable = Paths.get(javaHome.getAbsolutePath(), "bin", "java").toFile(); if (javaExecutable.exists() || javaExecutable.canExecute()) diff --git a/core/src/main/java/bisq/core/app/DomainInitialisation.java b/core/src/main/java/bisq/core/app/DomainInitialisation.java index 05a9a76776..af5ef95992 100644 --- a/core/src/main/java/bisq/core/app/DomainInitialisation.java +++ b/core/src/main/java/bisq/core/app/DomainInitialisation.java @@ -67,7 +67,7 @@ import java.util.stream.Collectors; /** * Handles the initialisation of domain classes. We should refactor to the model that the domain classes listen on the * relevant start up state from AppStartupState instead to get called. Only for initialisation which has a required - * order we will still need this class. For now it helps to keep BisqSetup more focussed on the process and not getting + * order we will still need this class. For now it helps to keep HavenoSetup more focussed on the process and not getting * overloaded with domain initialisation code. */ public class DomainInitialisation { diff --git a/core/src/main/java/bisq/core/app/HavenoExecutable.java b/core/src/main/java/bisq/core/app/HavenoExecutable.java index b73e0a3c47..c4449eece0 100644 --- a/core/src/main/java/bisq/core/app/HavenoExecutable.java +++ b/core/src/main/java/bisq/core/app/HavenoExecutable.java @@ -54,7 +54,7 @@ import lombok.extern.slf4j.Slf4j; import javax.annotation.Nullable; @Slf4j -public abstract class HavenoExecutable implements GracefulShutDownHandler, HavenoSetup.BisqSetupListener, UncaughtExceptionHandler { +public abstract class HavenoExecutable implements GracefulShutDownHandler, HavenoSetup.HavenoSetupListener, UncaughtExceptionHandler { public static final int EXIT_SUCCESS = 0; public static final int EXIT_FAILURE = 1; @@ -139,7 +139,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven hasDowngraded = HavenoSetup.hasDowngraded(); if (hasDowngraded) { // If user tried to downgrade we do not read the persisted data to avoid data corruption - // We call startApplication to enable UI to show popup. We prevent in BisqSetup to go further + // We call startApplication to enable UI to show popup. We prevent in HavenoSetup to go further // in the process and require a shut down. startApplication(); } else { @@ -194,12 +194,12 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven // Once the application is ready we get that callback and we start the setup protected void onApplicationStarted() { - runBisqSetup(); + runHavenoSetup(); } - protected void runBisqSetup() { + protected void runHavenoSetup() { HavenoSetup bisqSetup = injector.getInstance(HavenoSetup.class); - bisqSetup.addBisqSetupListener(this); + bisqSetup.addHavenoSetupListener(this); bisqSetup.start(); } diff --git a/core/src/main/java/bisq/core/app/HavenoHeadlessApp.java b/core/src/main/java/bisq/core/app/HavenoHeadlessApp.java index d511adb8cc..7ee974c567 100644 --- a/core/src/main/java/bisq/core/app/HavenoHeadlessApp.java +++ b/core/src/main/java/bisq/core/app/HavenoHeadlessApp.java @@ -53,7 +53,7 @@ public class HavenoHeadlessApp implements HeadlessApp { public void startApplication() { try { bisqSetup = injector.getInstance(HavenoSetup.class); - bisqSetup.addBisqSetupListener(this); + bisqSetup.addHavenoSetupListener(this); corruptedStorageFileHandler = injector.getInstance(CorruptedStorageFileHandler.class); tradeManager = injector.getInstance(TradeManager.class); diff --git a/core/src/main/java/bisq/core/app/HavenoSetup.java b/core/src/main/java/bisq/core/app/HavenoSetup.java index 5eee60d2e1..d3584a2231 100644 --- a/core/src/main/java/bisq/core/app/HavenoSetup.java +++ b/core/src/main/java/bisq/core/app/HavenoSetup.java @@ -104,7 +104,7 @@ public class HavenoSetup { private static final String VERSION_FILE_NAME = "version"; private static final String RESYNC_SPV_FILE_NAME = "resyncSpv"; - public interface BisqSetupListener { + public interface HavenoSetupListener { default void onInitP2pNetwork() { } @@ -195,7 +195,7 @@ public class HavenoSetup { private boolean allBasicServicesInitialized; @SuppressWarnings("FieldCanBeLocal") private MonadicBinding p2pNetworkAndWalletInitialized; - private final List bisqSetupListeners = new ArrayList<>(); + private final List bisqSetupListeners = new ArrayList<>(); @Inject public HavenoSetup(DomainInitialisation domainInitialisation, @@ -273,7 +273,7 @@ public class HavenoSetup { // Main startup tasks /////////////////////////////////////////////////////////////////////////////////////////// - public void addBisqSetupListener(BisqSetupListener listener) { + public void addHavenoSetupListener(HavenoSetupListener listener) { bisqSetupListeners.add(listener); } @@ -303,7 +303,7 @@ public class HavenoSetup { private void step4() { initDomainServices(); - bisqSetupListeners.forEach(BisqSetupListener::onSetupComplete); + bisqSetupListeners.forEach(HavenoSetupListener::onSetupComplete); // We set that after calling the setupCompleteHandler to not trigger a popup from the dev dummy accounts // in MainViewModel @@ -373,7 +373,7 @@ public class HavenoSetup { }, STARTUP_TIMEOUT_MINUTES, TimeUnit.MINUTES); log.info("Init P2P network"); - bisqSetupListeners.forEach(BisqSetupListener::onInitP2pNetwork); + bisqSetupListeners.forEach(HavenoSetupListener::onInitP2pNetwork); p2pNetworkReady = p2PNetworkSetup.init(this::initWallet, displayTorNetworkSettingsHandler); // We only init wallet service here if not using Tor for bitcoinj. @@ -402,10 +402,10 @@ public class HavenoSetup { private void initWallet() { log.info("Init wallet"); - bisqSetupListeners.forEach(BisqSetupListener::onInitWallet); + bisqSetupListeners.forEach(HavenoSetupListener::onInitWallet); Runnable walletPasswordHandler = () -> { log.info("Wallet password required"); - bisqSetupListeners.forEach(BisqSetupListener::onRequestWalletPassword); + bisqSetupListeners.forEach(HavenoSetupListener::onRequestWalletPassword); if (p2pNetworkReady.get()) p2PNetworkSetup.setSplashP2PNetworkAnimationVisible(true); diff --git a/core/src/main/java/bisq/core/app/HeadlessApp.java b/core/src/main/java/bisq/core/app/HeadlessApp.java index 76e2ad6ed7..e95d32d99d 100644 --- a/core/src/main/java/bisq/core/app/HeadlessApp.java +++ b/core/src/main/java/bisq/core/app/HeadlessApp.java @@ -22,7 +22,7 @@ import bisq.common.setup.UncaughtExceptionHandler; import com.google.inject.Injector; -public interface HeadlessApp extends UncaughtExceptionHandler, HavenoSetup.BisqSetupListener { +public interface HeadlessApp extends UncaughtExceptionHandler, HavenoSetup.HavenoSetupListener { void setGracefulShutDownHandler(GracefulShutDownHandler gracefulShutDownHandler); void setInjector(Injector injector); diff --git a/daemon/src/main/java/bisq/daemon/app/HavenoDaemonMain.java b/daemon/src/main/java/bisq/daemon/app/HavenoDaemonMain.java index 68db7a23e8..c9c34714ea 100644 --- a/daemon/src/main/java/bisq/daemon/app/HavenoDaemonMain.java +++ b/daemon/src/main/java/bisq/daemon/app/HavenoDaemonMain.java @@ -37,7 +37,7 @@ import lombok.extern.slf4j.Slf4j; import bisq.daemon.grpc.GrpcServer; @Slf4j -public class HavenoDaemonMain extends HavenoHeadlessAppMain implements HavenoSetup.BisqSetupListener { +public class HavenoDaemonMain extends HavenoHeadlessAppMain implements HavenoSetup.HavenoSetupListener { private GrpcServer grpcServer; diff --git a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java index 7c2d12822e..fa7dfaaa7e 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java @@ -107,7 +107,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; @Slf4j -public class MainViewModel implements ViewModel, HavenoSetup.BisqSetupListener { +public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener { private final HavenoSetup bisqSetup; private final WalletsSetup walletsSetup; private final User user; @@ -209,12 +209,12 @@ public class MainViewModel implements ViewModel, HavenoSetup.BisqSetupListener { GUIUtil.setPreferences(preferences); setupHandlers(); - bisqSetup.addBisqSetupListener(this); + bisqSetup.addHavenoSetupListener(this); } /////////////////////////////////////////////////////////////////////////////////////////// - // BisqSetupListener + // HavenoSetupListener /////////////////////////////////////////////////////////////////////////////////////////// @Override diff --git a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.fxml b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.fxml index 44b2b9d9b3..5fff0359ef 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.fxml @@ -21,7 +21,7 @@ - + @@ -103,12 +103,12 @@ - - + @@ -153,13 +153,13 @@ - - - diff --git a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java index a090bfc8ea..3d6548b147 100644 --- a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java +++ b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java @@ -99,7 +99,7 @@ public class GuiceSetupTest { assertSingleton(DisplayedTransactionsFactory.class); // core module -// assertSingleton(BisqSetup.class); // this is a can of worms +// assertSingleton(HavenoSetup.class); // this is a can of worms // assertSingleton(DisputeMsgEvents.class); assertSingleton(TorSetup.class); assertSingleton(P2PNetworkSetup.class);