Skip to content

Commit

Permalink
add initial_load_select to config channel trigger entries ... this he…
Browse files Browse the repository at this point in the history
…lps create a hierarchy by limiting nodes to subset of configuration they need
  • Loading branch information
erilong committed Jan 3, 2008
1 parent cd1354f commit f779041
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
Expand Up @@ -88,6 +88,8 @@ public class ConfigurationService extends AbstractService implements
private List<String> rootConfigChannelTableNames;

private List<String> nodeConfigChannelTableNames;

private Map<String, String> rootConfigChannelInitialLoadSelect;

private IDbDialect dbDialect;

Expand Down Expand Up @@ -145,8 +147,9 @@ private void initTriggerRowsForConfigChannel(String sourceGroupId, String target
Trigger trigger = getTriggerForTarget(tableName, sourceGroupId, targetGroupId,
Constants.CHANNEL_CONFIG);
if (trigger == null) {
String initialLoadSelect = rootConfigChannelInitialLoadSelect.get(tableName);
jdbcTemplate.update(insertTriggerSql, new Object[] { tableName, sourceGroupId, targetGroupId,
Constants.CHANNEL_CONFIG, initialLoadOrder++ });
Constants.CHANNEL_CONFIG, initialLoadOrder++, initialLoadSelect });
}
}
}
Expand Down Expand Up @@ -518,6 +521,10 @@ public void setSelectTriggerByIdSql(String selectTriggerByIdSql) {
public void setActiveTriggersForReloadSql(String activeTriggersForReloadSql) {
this.activeTriggersForReloadSql = activeTriggersForReloadSql;
}

public void setRootConfigChannelInitialLoadSelect(Map<String, String> rootConfigChannelInitialLoadSelect) {
this.rootConfigChannelInitialLoadSelect = rootConfigChannelInitialLoadSelect;
}



Expand Down
54 changes: 52 additions & 2 deletions symmetric/src/main/resources/symmetric-services.xml
Expand Up @@ -56,6 +56,56 @@
<value>${sync.table.prefix}_trigger</value>
</list>
</property>
<property name="rootConfigChannelInitialLoadSelect">
<map>
<entry key="${sync.table.prefix}_node_group">
<value>
node_group_id = '$(groupId)' or
node_group_id in (select source_node_group_id from ${sync.table.prefix}_node_group_link where target_node_group_id = '$(groupId)') or
node_group_id in (select target_node_group_id from ${sync.table.prefix}_node_group_link where source_node_group_id = '$(groupId)')
</value>
</entry>
<entry key="${sync.table.prefix}_node_group_link">
<value>
source_node_group_id = '$(groupId)' or target_node_group_id = '$(groupId)'
</value>
</entry>
<entry key="${sync.table.prefix}_node">
<value>
node_id = '$(nodeId)' or
node_group_id in (select source_node_group_id from ${sync.table.prefix}_node_group_link where target_node_group_id = '$(groupId)') or
node_group_id in (select target_node_group_id from ${sync.table.prefix}_node_group_link where source_node_group_id = '$(groupId)')
</value>
</entry>
<entry key="${sync.table.prefix}_node_security">
<value>
node_id = '$(nodeId)' or
node_id in (select s.node_id from ${sync.table.prefix}_node s inner join ${sync.table.prefix}_node_group_link l on s.node_group_id = l.source_node_group_id where l.target_node_group_id = '$(groupId)') or
node_id in (select s.node_id from ${sync.table.prefix}_node s inner join ${sync.table.prefix}_node_group_link l on s.node_group_id = l.target_node_group_id where l.source_node_group_id = '$(groupId)')
</value>
</entry>
<entry key="${sync.table.prefix}_global_parameter">
<value>
node_group_id = '$(groupId)'
</value>
</entry>
<entry key="${sync.table.prefix}_channel">
<value>
channel_id in (select channel_id from ${sync.table.prefix}_trigger where source_node_group_id = '$(groupId)')
</value>
</entry>
<entry key="${sync.table.prefix}_node_channel_ctl">
<value>
node_id = '$(nodeId)'
</value>
</entry>
<entry key="${sync.table.prefix}_trigger">
<value>
source_node_group_id = '$(groupId)'
</value>
</entry>
</map>
</property>
<property name="nodeConfigChannelTableNames">
<list>
<value>${sync.table.prefix}_node</value>
Expand Down Expand Up @@ -113,8 +163,8 @@
<value>
insert into ${sync.table.prefix}_trigger (source_table_name, source_node_group_id,
target_node_group_id, channel_id, source_schema_name, sync_on_update,
sync_on_insert, sync_on_delete, initial_load_order, last_updated_by,
last_updated_time, create_time) values (?, ?, ?, ?, null, 0, 0, 0, ?, 'system',
sync_on_insert, sync_on_delete, initial_load_order, initial_load_select, last_updated_by,
last_updated_time, create_time) values (?, ?, ?, ?, null, 0, 0, 0, ?, ?, 'system',
current_timestamp, current_timestamp)
</value>
</property>
Expand Down

0 comments on commit f779041

Please sign in to comment.