exhibitor.getLog().add(ActivityLog.Type.INFO, "Process started via: " + builder.command().get(0));
}
private void prepConfigFile(Details details) throws IOException
{
UsState usState = new UsState(exhibitor);
File idFile = new File(details.dataDirectory, "myid");
if ( usState.getUs() != null )
{
Files.createParentDirs(idFile);
String id = String.format("%d\n", usState.getUs().getServerId());
Files.write(id.getBytes(), idFile);
}
else
{
exhibitor.getLog().add(ActivityLog.Type.INFO, "Starting in standalone mode");
if ( idFile.exists() && !idFile.delete() )
{
exhibitor.getLog().add(ActivityLog.Type.ERROR, "Could not delete ID file: " + idFile);
}
}
Properties localProperties = new Properties();
localProperties.putAll(details.properties);
localProperties.setProperty("clientPort", Integer.toString(usState.getConfig().getInt(IntConfigs.CLIENT_PORT)));
String portSpec = String.format(":%d:%d", usState.getConfig().getInt(IntConfigs.CONNECT_PORT), usState.getConfig().getInt(IntConfigs.ELECTION_PORT));
for ( ServerSpec spec : usState.getServerList().getSpecs() )
{
localProperties.setProperty("server." + spec.getServerId(), spec.getHostname() + portSpec + spec.getServerType().getZookeeperConfigValue());
}
if ( usState.getUs().getServerType() == ServerType.OBSERVER )
{
localProperties.setProperty("peerType", "observer");
}
File configFile = new File(details.configDirectory, "zoo.cfg");