@Override public void execute() throws Exception { if (showHelp) { System.out.println("Usage: $OPENNMS_HOME/bin/newts init"); CmdLineParser parser = new CmdLineParser(new Init()); parser.printUsage(System.out); return; } String keyspace = System.getProperty("org.opennms.newts.config.keyspace", "newts"); String hostname = System.getProperty("org.opennms.newts.config.hostname", "localhost"); int port = Integer.getInteger("org.opennms.newts.config.port", 9042); String username = System.getProperty("org.opennms.newts.config.username"); String password = System.getProperty("org.opennms.newts.config.password"); boolean ssl = Boolean.getBoolean("org.opennms.newts.config.ssl"); System.out.println(String.format("Initializing the '%s' keyspaces on %s:%d", keyspace, hostname, port)); try (SchemaManager m = new SchemaManager(keyspace, hostname, port, username, password, ssl)) { m.setReplicationFactor(replicationFactor); for (Schema s : s_schemas) { m.create(s, true, printOnly); } } if (!printOnly) { System.out.println("The keyspace was succesfully created."); } } }
@Override public void execute() throws Exception { if (showHelp) { System.out.println("Usage: $OPENNMS_HOME/bin/newts init"); CmdLineParser parser = new CmdLineParser(new Init()); parser.printUsage(System.out); return; } String keyspace = System.getProperty("org.opennms.newts.config.keyspace", "newts"); String hostname = System.getProperty("org.opennms.newts.config.hostname", "localhost"); int port = SystemProperties.getInteger("org.opennms.newts.config.port", 9042); String username = System.getProperty("org.opennms.newts.config.username"); String password = System.getProperty("org.opennms.newts.config.password"); boolean ssl = Boolean.getBoolean("org.opennms.newts.config.ssl"); System.out.println(String.format("Initializing the '%s' keyspaces on %s:%d", keyspace, hostname, port)); try (SchemaManager m = new SchemaManager(keyspace, hostname, port, username, password, ssl)) { m.setReplicationFactor(replicationFactor); for (Schema s : s_schemas) { m.create(s, true, printOnly); } } if (!printOnly) { System.out.println("The keyspace was succesfully created."); } } }
@Override protected void run(Bootstrap<NewtsConfig> bootstrap, Namespace namespace, NewtsConfig config) throws Exception { try (SchemaManager m = new SchemaManager(config.getCassandraKeyspace(), config.getCassandraHost(), config.getCassandraPort(), config.getCassandraUsername(), config.getCassandraPassword(), config.getCassandraSsl())) { for (Schema s : s_schemas) { m.create(s, true); } } }
@Override protected void run(Bootstrap<NewtsConfig> bootstrap, Namespace namespace, NewtsConfig config) throws Exception { try (SchemaManager m = new SchemaManager(config.getCassandraKeyspace(), config.getCassandraHost(), config.getCassandraPort(), config.getCassandraUsername(), config.getCassandraPassword(), config.getCassandraSsl())) { for (Schema s : s_schemas) { m.create(s, true); } } }