Skip to content

Commit

Permalink
[ 1852586 ] Add support for automatically sending initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Dec 17, 2007
1 parent 902d89a commit 52557ef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Expand Up @@ -34,9 +34,10 @@
import org.jumpmind.symmetric.model.Trigger;
import org.jumpmind.symmetric.service.IAcknowledgeService;
import org.jumpmind.symmetric.service.IClusterService;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.IConfigurationService;
import org.jumpmind.symmetric.service.IDataExtractorService;
import org.jumpmind.symmetric.service.IDataService;
import org.jumpmind.symmetric.service.INodeService;
import org.jumpmind.symmetric.service.IRegistrationService;
import org.jumpmind.symmetric.transport.IOutgoingTransport;
import org.jumpmind.symmetric.transport.internal.InternalOutgoingTransport;
Expand All @@ -57,6 +58,8 @@ public class RegistrationService extends AbstractService implements

private IClusterService clusterService;

private IDataService dataService;

private String findNodeToRegisterSql;

private String registerNodeSql;
Expand All @@ -70,6 +73,8 @@ public class RegistrationService extends AbstractService implements
private String openRegistrationNodeSecuritySql;

private boolean autoRegistration;

private boolean autoReload;

/**
* Register a node for the given domain name and domain ID if the
Expand All @@ -91,7 +96,11 @@ public boolean registerNode(Node node, OutputStream out) throws IOException {
node.getSyncURL().toString(), node.getSchemaVersion(),
node.getDatabaseType(), node.getDatabaseVersion(),
node.getSymmetricVersion(), node.getNodeId() });
return writeConfiguration(node, out);
boolean success = writeConfiguration(node, out);
if (success && autoReload) {
dataService.reloadNode(node.getNodeId());
}
return success;
}

private String findNodeToRegister(String nodeGroupId, String externald) {
Expand Down Expand Up @@ -238,4 +247,12 @@ public void setAutoRegistration(boolean autoRegistration) {
this.autoRegistration = autoRegistration;
}

public void setAutoReload(boolean autoReload) {
this.autoReload = autoReload;
}

public void setDataService(IDataService dataService) {
this.dataService = dataService;
}

}
3 changes: 3 additions & 0 deletions symmetric/src/main/resources/symmetric-default.properties
Expand Up @@ -48,6 +48,9 @@ symmetric.auto.upgrade=true
# If this is true, registration is opened automatically for nodes requesting it
symmetric.auto.registration=false

# If this is true, a reload is automatically sent to nodes when they register
symmetric.auto.reload=false

# This is the download rate for the HTTP symmetric transport. -1 means full throttle.
symmetric.http.download.rate.kb=-1

Expand Down
2 changes: 2 additions & 0 deletions symmetric/src/main/resources/symmetric-services.xml
Expand Up @@ -454,7 +454,9 @@
<property name="runtimeConfiguration" ref="runtimeConfiguration" />
<property name="dataExtractorService" ref="dataExtractorService" />
<property name="configurationService" ref="configurationService" />
<property name="dataService" ref="dataService" />
<property name="autoRegistration" value ="${symmetric.auto.registration}" />
<property name="autoReload" value ="${symmetric.auto.reload}" />
<property name="findNodeToRegisterSql">
<value>
select min(c.node_id) from ${sync.table.prefix}_node c inner join
Expand Down

0 comments on commit 52557ef

Please sign in to comment.