Skip to content

Commit

Permalink
add reload-node option
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Nov 1, 2007
1 parent 29785db commit 2e8bcf6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Expand Up @@ -43,6 +43,7 @@
import org.jumpmind.symmetric.db.SqlScript;
import org.jumpmind.symmetric.service.IBootstrapService;
import org.jumpmind.symmetric.service.IDataExtractorService;
import org.jumpmind.symmetric.service.IDataService;
import org.jumpmind.symmetric.service.IRegistrationService;
import org.jumpmind.symmetric.transport.IOutgoingTransport;
import org.jumpmind.symmetric.transport.internal.InternalOutgoingTransport;
Expand All @@ -56,6 +57,8 @@ public class SymmetricLauncher {
private static final String OPTION_DUMP_BATCH = "dump-batch";

private static final String OPTION_OPEN_REGISTRATION = "open-registration";

private static final String OPTION_RELOAD_NODE = "reload-node";

private static final String OPTION_AUTO_CREATE = "auto-create";

Expand Down Expand Up @@ -112,6 +115,13 @@ public static void main(String[] args) throws Exception {
return;
}

if (line.hasOption(OPTION_RELOAD_NODE)) {
String arg = line.getOptionValue(OPTION_RELOAD_NODE);
String message = reloadNode(new SymmetricEngine(), arg);
System.out.println(message);
return;
}

if (line.hasOption(OPTION_DUMP_BATCH)) {
String arg = line.getOptionValue(OPTION_DUMP_BATCH);
dumpBatch(new SymmetricEngine(), arg);
Expand Down Expand Up @@ -183,6 +193,9 @@ private static Options buildOptions() {
options
.addOption("R", OPTION_OPEN_REGISTRATION, true,
"Open registration for the passed in node group and external id. Takes an argument of {groupId},{externalId}.");
options
.addOption("l", OPTION_RELOAD_NODE, true,
"Send an initial load of data to reload the passed in node id.");
options.addOption("d", OPTION_DUMP_BATCH, true,
"Print the contents of a batch out to the console. Takes the batch id as an argument.");

Expand Down Expand Up @@ -211,6 +224,12 @@ private static void openRegistration(SymmetricEngine engine, String argument) {
registrationService.openRegistration(nodeGroupId, externalId);
}

private static String reloadNode(SymmetricEngine engine, String argument) {
IDataService dataService = (IDataService) engine.getApplicationContext().getBean(
Constants.DATA_SERVICE);
return dataService.reloadNode(argument);
}

private static void generateDDL(SymmetricEngine engine, String fileName) throws IOException {
File file = new File(fileName);
file.getParentFile().mkdirs();
Expand Down
Expand Up @@ -59,6 +59,8 @@ public class Constants {

public static final String REGISTRATION_SERVICE = "registrationService";

public static final String DATA_SERVICE = "dataService";

public static final String PUSH_SERVICE = "pushService";

public static final String PULL_SERVICE = "pullService";
Expand Down

0 comments on commit 2e8bcf6

Please sign in to comment.