Skip to content

Commit

Permalink
move code over to the symmetric-client project
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jan 11, 2012
1 parent c1bfc81 commit 2e8ec92
Show file tree
Hide file tree
Showing 43 changed files with 31 additions and 7 deletions.
Expand Up @@ -20,6 +20,8 @@
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.common.SecurityConstants;
import org.jumpmind.symmetric.config.PropertiesFactoryBean;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.db.JdbcSymmetricDialectFactory;
import org.jumpmind.symmetric.ext.ExtensionPointManager;
import org.jumpmind.symmetric.ext.IExtensionPointManager;
import org.jumpmind.symmetric.job.IJobManager;
Expand Down Expand Up @@ -92,6 +94,12 @@ public static BasicDataSource createBasicDataSource(Log log, TypedProperties pro
return dataSource;

}

@Override
protected ISymmetricDialect createSymmetricDialect() {
return new JdbcSymmetricDialectFactory(parameterService, platform, log)
.create();
}

@Override
protected IDatabasePlatform createDatabasePlatform(TypedProperties properties) {
Expand Down
Expand Up @@ -142,4 +142,9 @@ public MsSqlTriggerText() {
"select $(columns) from $(schemaName)$(tableName) t where $(whereClause) " );
}


@Override
protected boolean requiresEmptyLobTemplateForDeletes() {
return true;
}
}
Expand Up @@ -146,5 +146,10 @@ public PostgreSqlTriggerText() {
sqlTemplates.put("initialLoadSqlTemplate" ,
"select $(columns) from $(schemaName)$(tableName) t where $(whereClause) " );
}

@Override
protected boolean requiresWrappedBlobTemplateForBlobType() {
return true;
}

}
Expand Up @@ -17,7 +17,6 @@
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.common.TableConstants;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.db.JdbcSymmetricDialectFactory;
import org.jumpmind.symmetric.ext.IExtensionPointManager;
import org.jumpmind.symmetric.io.DefaultOfflineClientListener;
import org.jumpmind.symmetric.io.IOfflineClientListener;
Expand Down Expand Up @@ -193,8 +192,7 @@ protected void init() {
.getLong(ParameterConstants.CACHE_TIMEOUT_TABLES_IN_MS));

this.bandwidthService = new BandwidthService(parameterService, log);
this.symmetricDialect = new JdbcSymmetricDialectFactory(parameterService, platform, log)
.create();
this.symmetricDialect = createSymmetricDialect();
this.nodeService = new NodeService(parameterService, symmetricDialect);
this.configurationService = new ConfigurationService(parameterService, symmetricDialect,
nodeService);
Expand Down Expand Up @@ -258,6 +256,8 @@ protected static ISecurityService createSecurityService() {
// TODO check system property. integrate eric's changes
return new SecurityService();
}

abstract protected ISymmetricDialect createSymmetricDialect();

abstract protected IJobManager createJobManager();

Expand Down
Expand Up @@ -32,8 +32,6 @@
import org.jumpmind.db.model.Table;
import org.jumpmind.symmetric.Version;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.db.mssql.MsSqlSymmetricDialect;
import org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect;
import org.jumpmind.symmetric.io.data.DataEventType;
import org.jumpmind.symmetric.model.Channel;
import org.jumpmind.symmetric.model.Node;
Expand Down Expand Up @@ -527,6 +525,14 @@ protected String getPrimaryKeyWhereString(String alias, Column[] columns) {
b.append("'");
return b.toString();
}

protected boolean requiresWrappedBlobTemplateForBlobType() {
return false;
}

protected boolean requiresEmptyLobTemplateForDeletes() {
return false;
}

protected ColumnString buildColumnString(String origTableAlias, String tableAlias,
String columnPrefix, Column[] columns, ISymmetricDialect symmetricDialect, DataEventType dml,
Expand Down Expand Up @@ -577,7 +583,7 @@ protected ColumnString buildColumnString(String origTableAlias, String tableAlia
isLob = true;
break;
case Types.BLOB:
if (symmetricDialect instanceof PostgreSqlSymmetricDialect) {
if (requiresWrappedBlobTemplateForBlobType()) {
templateToUse = wrappedBlobColumnTemplate;
isLob = true;
break;
Expand Down Expand Up @@ -634,7 +640,7 @@ protected ColumnString buildColumnString(String origTableAlias, String tableAlia
+ column.getType() + " with JDBC type of " + column.getJdbcTypeName());
}

if (dml == DataEventType.DELETE && isLob && symmetricDialect instanceof MsSqlSymmetricDialect) {
if (dml == DataEventType.DELETE && isLob && requiresEmptyLobTemplateForDeletes()) {
templateToUse = emptyColumnTemplate;
} else if (isLob && trigger.isUseStreamLobs()) {
templateToUse = emptyColumnTemplate;
Expand Down

0 comments on commit 2e8ec92

Please sign in to comment.