use of com.ms.silverking.cloud.dht.NamespaceCreationOptions in project SilverKing by Morgan-Stanley.
the class StaticDHTCreator method main.
public static void main(String[] args) {
try {
StaticDHTCreator sdc;
StaticDHTCreatorOptions options;
CmdLineParser parser;
Set<String> servers;
String dhtName;
String gcName;
int port;
NamespaceCreationOptions nsCreationOptions;
UUIDBase uuid;
options = new StaticDHTCreatorOptions();
parser = new CmdLineParser(options);
try {
parser.parseArgument(args);
} catch (CmdLineException cle) {
System.err.println(cle.getMessage());
parser.printUsage(System.err);
System.exit(-1);
}
if ((options.serverFile == null && options.servers == null) || (options.serverFile != null && options.servers != null)) {
System.err.println("Exactly one of serverFile and servers should be provided");
parser.printUsage(System.err);
System.exit(-1);
}
if (options.serverFile != null) {
servers = ImmutableSet.copyOf(StreamParser.parseFileLines(options.serverFile));
} else {
servers = CollectionUtil.parseSet(options.servers, serverDelimiter);
}
uuid = new UUIDBase(true);
if (options.gridConfig != null) {
gcName = options.gridConfig;
} else {
gcName = gcNameBase + uuid.toString();
}
if (options.dhtName != null) {
dhtName = options.dhtName;
} else {
dhtName = dhtNameBase + uuid.toString();
}
if (options.port == StaticDHTCreatorOptions.defaultPort) {
port = Util.getFreePort();
} else {
port = options.port;
}
if (options.nsCreationOptions != null) {
nsCreationOptions = NamespaceCreationOptions.parse(options.nsCreationOptions);
} else {
nsCreationOptions = NamespaceCreationOptions.defaultOptions;
}
sdc = new StaticDHTCreator(new ZooKeeperConfig(options.zkEnsemble), servers, options.replication, dhtName, gcName, port, nsCreationOptions, options.gridConfigDir);
sdc.createStaticDHT(uuid, options.initialHeapSize, options.maxHeapSize, options.skInstanceLogBaseVar, options.dataBaseVar, options.skfsConfigurationFile);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
Aggregations