update more names from bisq* to haveno*

This commit is contained in:
woodser 2021-12-19 11:32:55 -05:00
parent fae477fc51
commit e8cc3d20f5
12 changed files with 66 additions and 66 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<Boolean> p2pNetworkAndWalletInitialized;
private final List<BisqSetupListener> bisqSetupListeners = new ArrayList<>();
private final List<HavenoSetupListener> 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);

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
<?import bisq.desktop.components.AutoTooltipCheckBox?>
<?import bisq.desktop.components.AutoTooltipLabel?>
<?import bisq.desktop.components.AutoTooltipRadioButton?>
<?import bisq.desktop.components.BisqTextField?>
<?import bisq.desktop.components.HavenoTextField?>
<?import bisq.desktop.components.InputTextField?>
<?import bisq.desktop.components.TitledGroupBg?>
<?import javafx.scene.control.cell.PropertyValueFactory?>
@ -103,12 +103,12 @@
</GridPane.margin>
</TitledGroupBg>
<BisqTextField fx:id="onionAddress" GridPane.rowIndex="5"
<HavenoTextField fx:id="onionAddress" GridPane.rowIndex="5"
editable="false" focusTraversable="false" labelFloat="true">
<GridPane.margin>
<Insets top="60.0"/>
</GridPane.margin>
</BisqTextField>
</HavenoTextField>
<VBox GridPane.rowIndex="6" GridPane.hgrow="ALWAYS" GridPane.vgrow="SOMETIMES">
<AutoTooltipLabel fx:id="p2PPeersLabel" styleClass="small-text"/>
@ -153,13 +153,13 @@
</TableView>
</VBox>
<BisqTextField fx:id="sentDataTextField" GridPane.rowIndex="7" editable="false"
<HavenoTextField fx:id="sentDataTextField" GridPane.rowIndex="7" editable="false"
focusTraversable="false" labelFloat="true"/>
<BisqTextField fx:id="receivedDataTextField" GridPane.rowIndex="8" editable="false"
<HavenoTextField fx:id="receivedDataTextField" GridPane.rowIndex="8" editable="false"
focusTraversable="false" labelFloat="true"/>
<BisqTextField fx:id="chainHeightTextField" GridPane.rowIndex="9" editable="false"
<HavenoTextField fx:id="chainHeightTextField" GridPane.rowIndex="9" editable="false"
focusTraversable="false" labelFloat="true"/>
<AutoTooltipButton fx:id="openTorSettingsButton" GridPane.rowIndex="10" GridPane.columnIndex="0"/>

View File

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