private void initializeDataDirectory()
			throws IOException, InterruptedException, SAXException, GeneralSecurityException {
		File configFile = new File(dataDirectory, POSTGRES_CONFIGFILE);
		File hbaFile = new File(dataDirectory, POSTGRES_CONNECTFILE);
		if (configFile.exists()) {
			recoverConfigurationParameters(configFile, hbaFile);
			return;
		}
		File serverConfigFile = Application.getModuleDataFile("serverconfig.xml").getFile(false);
		if (hostAuthentication == AUTHENTICATION_PKI) {
			checkCertAuthorityFile();
			System.out.println("Remote client authentication with PKI certificates");
		}
		else if (hostAuthentication == AUTHENTICATION_PASSWORD) {
			System.out.println("Remote client authentication via password");
		}
		else {
			System.out.println("No client authentication");
		}
		System.out.println("Initializing data directory");
		List<String> command = new ArrayList<String>();
		command.add(postgresControl.getAbsolutePath());
		command.add("init");
		command.add("-o");
		command.add("'--username=" + connectingUserName + '\'');
		if (hostAuthentication == AUTHENTICATION_PASSWORD) {
			establishAdminPassword();
			command.add("-o");
			command.add("'--pwfile=" + passwordFile.getAbsolutePath() + '\'');
		}
		else if (hostAuthentication == AUTHENTICATION_PKI) {
			if (commonName == null) {
				throw new GeneralSecurityException(
					"Distinguished name option (--dn) required for " + connectingUserName);
			}
			checkCertAuthorityFile();
		}
		command.add("-D");
		command.add(dataDirectory.getAbsolutePath());
		int res = runCommand(null, command, loadLibraryVar, loadLibraryValue);
		if (res != 0) {
			throw new IOException("Error initializing postgres database");
		}
		File configCopy = new File(dataDirectory, POSTGRES_CONFIGFILE + ".orig");

		if (hostAuthentication == AUTHENTICATION_PKI || localAuthentication == AUTHENTICATION_PKI) {
			File rootCA = new File(dataDirectory, POSTGRES_ROOTCA);
			FileUtilities.copyFile(certAuthorityFile, rootCA, false, null);
			addCertificateName(connectingUserName);
		}

		// Move the original configuration file
		if (!configFile.renameTo(configCopy)) {
			throw new IOException("Error copying original configuration file");
		}

		File hbaCopy = new File(dataDirectory, POSTGRES_CONNECTFILE + ".orig");

		// Move the original connection file
		if (!hbaFile.renameTo(hbaCopy)) {
			throw new IOException("Error copying original connection file");
		}
		// Patch the configuration
		tuneConfig(configCopy, configFile, hbaCopy, hbaFile, serverConfigFile);
		System.out.println("Generating servers SSL certificate");
		generateSelfSignedCertificate(new File(dataDirectory, "server.crt"),
			new File(dataDirectory, "server.key"));
	}
Locate the PostgreSQL configuration and authentication files (postgresql.conf and pg_hba.conf)
and recover the settings pertinent to BSimControl.  If the data directory has not been initialized yet,
run PostgreSQL's init command to perform the initialization and then tailor the configuration
based on BSimControl's command-line options and the Ghidra specific configuration options
@throws IOException if the module data file cannot be retrieved
@throws InterruptedException if the postgres command is interrupted
@throws SAXException if tuneConfig fails
@throws GeneralSecurityException if the cert file cannot be processed
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java