diff --git a/symmetric-assemble/build.gradle b/symmetric-assemble/build.gradle index 5aa5f67a85..65511eb6fc 100644 --- a/symmetric-assemble/build.gradle +++ b/symmetric-assemble/build.gradle @@ -8,7 +8,7 @@ buildscript { classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3' classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16' classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7' - classpath 'io.spring.gradle:docbook-reference-plugin:0.3.0' + classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' classpath ("com.smokejumperit.gradle.license:Gradle-License-Report:0.0.2") { // guava 21 requires Java 8, setting up for a clean build with only Java 1.7 tools. exclude group: 'com.google.guava', module: 'guava' diff --git a/symmetric-assemble/common.gradle b/symmetric-assemble/common.gradle index 1f33597a4e..5317bb2038 100644 --- a/symmetric-assemble/common.gradle +++ b/symmetric-assemble/common.gradle @@ -164,14 +164,14 @@ subprojects { subproject -> ext { bshVersion = '2.0b6' - commonsBeanUtilsVersion = '1.9.3' - commonsCliVersion = '1.2' + commonsBeanUtilsVersion = '1.9.4' + commonsCliVersion = '1.4' commonsDbcpVersion = '1.4' - commonsFileuploadVersion = '1.3.3' - commonsIoVersion = '2.4' + commonsFileuploadVersion = '1.4' + commonsIoVersion = '2.6' commonsLangVersion = '2.6' - commonsNetVersion = '3.3' - commonsCodecVersion = '1.3' + commonsNetVersion = '3.6' + commonsCodecVersion = '1.12' commonsCollectionVersion = '3.2.2' hamcrestVersion = '1.3' h2Version = '1.3.176' @@ -186,15 +186,15 @@ subprojects { subproject -> jdomVersion = '2.0.5' junitVersion = '4.11' log4jVersion = '1.2.17' - slf4jVersion = '1.7.6' + slf4jVersion = '1.7.26' mockitoVersion = '1.9.5' powerMockVersion = '1.5.3' mysqlVersion = '5.1.45' servletVersion = '3.1.0' springVersion = '4.3.16.RELEASE' - jtdsVersion = '1.2.8' + jtdsVersion = '1.3.1' voltDbVersion = '6.2' - bouncyCastleVersion = '1.59' + bouncyCastleVersion = '1.64' animalSnifferVersion = '1.10' jnaVersion = '4.1.0' jettyVersion = project.property('jetty.version') diff --git a/symmetric-assemble/gradle.properties b/symmetric-assemble/gradle.properties index 2841379985..43cd484773 100644 --- a/symmetric-assemble/gradle.properties +++ b/symmetric-assemble/gradle.properties @@ -11,5 +11,5 @@ publishPort=? publishServer=symmetricds.org sourceforgeUser=? sourceforgePassword=? -jetty.version=9.4.19.v20190610 +jetty.version=9.4.26.v20200117 vaadinVersion=8.1.6 \ No newline at end of file diff --git a/symmetric-core/build.gradle b/symmetric-core/build.gradle index 9527a9774c..cd8408411d 100644 --- a/symmetric-core/build.gradle +++ b/symmetric-core/build.gradle @@ -7,8 +7,8 @@ apply from: symAssembleDir + '/common.gradle' compile project(":symmetric-util") compile "commons-fileupload:commons-fileupload:$commonsFileuploadVersion" compile "javax.mail:mail:1.4.5" - compile "com.fasterxml.jackson.core:jackson-databind:2.9.5" - compile "com.google.code.gson:gson:2.8.2" + compile "com.fasterxml.jackson.core:jackson-databind:2.10.3" + compile "com.google.code.gson:gson:2.8.5" compile "org.springframework:spring-core:$springVersion" testCompile project(path: ':symmetric-util', configuration: 'testArtifacts') diff --git a/symmetric-io/build.gradle b/symmetric-io/build.gradle index fd626573a1..1af90c97c0 100644 --- a/symmetric-io/build.gradle +++ b/symmetric-io/build.gradle @@ -7,8 +7,9 @@ apply from: symAssembleDir + '/common.gradle' compile project(":symmetric-db") compile "org.apache-extras.beanshell:bsh:$bshVersion" compile "net.sourceforge.jeval:jeval:0.9.4" - provided "com.fasterxml.jackson.core:jackson-core:2.9.5" - provided "com.fasterxml.jackson.core:jackson-databind:2.9.5" + compile "com.google.code.gson:gson:2.8.5" + provided "com.fasterxml.jackson.core:jackson-core:2.10.3" + provided "com.fasterxml.jackson.core:jackson-databind:2.10.3" testCompile project(path: ':symmetric-util', configuration: 'testArtifacts') testCompile project(":symmetric-jdbc") diff --git a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/CassandraDatabaseWriter.java b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/CassandraDatabaseWriter.java index fea16e42ea..6fcbfb96da 100644 --- a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/CassandraDatabaseWriter.java +++ b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/CassandraDatabaseWriter.java @@ -26,236 +26,242 @@ import com.datastax.driver.core.LocalDate; import com.datastax.driver.core.PreparedStatement; import com.datastax.driver.core.Session; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; public class CassandraDatabaseWriter extends DynamicDefaultDatabaseWriter { - protected Session session; + protected Gson gson = new Gson(); - Map> metaData = new HashMap>(); + protected Session session; - PreparedStatement pstmt; + protected Map> metaData = new HashMap>(); - SimpleDateFormat tsFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); - - public CassandraDatabaseWriter(IDatabasePlatform symmetricPlatform, - IDatabasePlatform targetPlatform,String prefix, + protected PreparedStatement pstmt; + + SimpleDateFormat tsFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); + + public CassandraDatabaseWriter(IDatabasePlatform symmetricPlatform, + IDatabasePlatform targetPlatform,String prefix, IDatabaseWriterConflictResolver conflictResolver, DatabaseWriterSettings settings) { - - super(symmetricPlatform, targetPlatform, prefix, conflictResolver, settings); - this.metaData = ((CassandraPlatform) targetPlatform).getMetaData(); - this.session = ((CassandraPlatform) targetPlatform).getSession(); - } + + super(symmetricPlatform, targetPlatform, prefix, conflictResolver, settings); + this.metaData = ((CassandraPlatform) targetPlatform).getMetaData(); + this.session = ((CassandraPlatform) targetPlatform).getSession(); + } - @Override - protected void prepare() { - if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "")) { - super.prepare(); - } else { - pstmt = session.prepare(currentDmlStatement.getSql()); - } - } - - @Override - protected void prepare(String sql, CsvData data) { - if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "") && !isUserSendSql(sql, data)) { - super.prepare(sql, data); - } else { - pstmt = session.prepare(sql); - } - } - - /* - * Checks if a send sql event type was for the sym_node table. If it is the send sql shoudl run against Cassandra tables otherwise it is an internal Symmetric - * send sql. - */ - protected boolean isUserSendSql(String sql, CsvData data) { - return data.getDataEventType().equals(DataEventType.SQL) - && this.targetTable.getNameLowerCase().equals(this.getTablePrefix().toLowerCase() + "_node") - && !sql.toLowerCase().contains("from " + this.getTablePrefix().toLowerCase() + "_node"); - } - - @Override - public int prepareAndExecute(String sql, CsvData data) { - if (isUserSendSql(sql, data)) { - return session.execute(sql).wasApplied() ? 1 : 0; - } - else { - return super.prepareAndExecute(sql, data); - } - } + @Override + protected void prepare() { + if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "")) { + super.prepare(); + } else { + pstmt = session.prepare(currentDmlStatement.getSql()); + } + } + + @Override + protected void prepare(String sql, CsvData data) { + if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "") && !isUserSendSql(sql, data)) { + super.prepare(sql, data); + } else { + pstmt = session.prepare(sql); + } + } + + /* + * Checks if a send sql event type was for the sym_node table. If it is the send sql shoudl run against Cassandra tables otherwise it is an internal Symmetric + * send sql. + */ + protected boolean isUserSendSql(String sql, CsvData data) { + return data.getDataEventType().equals(DataEventType.SQL) + && this.targetTable.getNameLowerCase().equals(this.getTablePrefix().toLowerCase() + "_node") + && !sql.toLowerCase().contains("from " + this.getTablePrefix().toLowerCase() + "_node"); + } + + @Override + public int prepareAndExecute(String sql, CsvData data) { + if (isUserSendSql(sql, data)) { + return session.execute(sql).wasApplied() ? 1 : 0; + } + else { + return super.prepareAndExecute(sql, data); + } + } - @Override - protected int execute(CsvData data, String[] values) { - if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "")) { - return super.execute(data, values); - } - BoundStatement bstmt = pstmt.bind(); - currentDmlValues = getPlatform().getObjectValues(batch.getBinaryEncoding(), values, - currentDmlStatement.getMetaData(), false, writerSettings.isFitToColumn()); - if (log.isDebugEnabled()) { - log.debug("Submitting data [{}] with types [{}]", - dmlValuesToString(currentDmlValues, this.currentDmlStatement.getTypes()), - TypeMap.getJdbcTypeDescriptions(this.currentDmlStatement.getTypes())); - } + @Override + protected int execute(CsvData data, String[] values) { + if (isSymmetricTable(this.targetTable != null ? this.targetTable.getName() : "")) { + return super.execute(data, values); + } + BoundStatement bstmt = pstmt.bind(); + currentDmlValues = getPlatform().getObjectValues(batch.getBinaryEncoding(), values, + currentDmlStatement.getMetaData(), false, writerSettings.isFitToColumn()); + if (log.isDebugEnabled()) { + log.debug("Submitting data [{}] with types [{}]", + dmlValuesToString(currentDmlValues, this.currentDmlStatement.getTypes()), + TypeMap.getJdbcTypeDescriptions(this.currentDmlStatement.getTypes())); + } - bindVariables(bstmt, this.currentDmlStatement.getColumns(), this.currentDmlStatement.getTypes(), values); - return session.execute(bstmt).wasApplied() ? 1 : 0; - } + bindVariables(bstmt, this.currentDmlStatement.getColumns(), this.currentDmlStatement.getTypes(), values); + return session.execute(bstmt).wasApplied() ? 1 : 0; + } - @Override - protected Table lookupTableAtTarget(Table sourceTable) { - if (sourceTable != null && isSymmetricTable(sourceTable.getName())) { - return super.lookupTableAtTarget(sourceTable); - } - String keyspace = sourceTable.getCatalog() == null ? sourceTable.getSchema() : sourceTable.getCatalog(); - Map tables = metaData.get(keyspace); - Table returnTable = tables == null ? sourceTable : tables.get(sourceTable.getName()); - - // ADD target table param is missing do not error - if (returnTable == null) { - throw new RuntimeException("Unable to find Cassandra target table " + sourceTable.getName() + " in keyspace " + keyspace); - } - return returnTable; - } + @Override + protected Table lookupTableAtTarget(Table sourceTable) { + if (sourceTable != null && isSymmetricTable(sourceTable.getName())) { + return super.lookupTableAtTarget(sourceTable); + } + String keyspace = sourceTable.getCatalog() == null ? sourceTable.getSchema() : sourceTable.getCatalog(); + Map tables = metaData.get(keyspace); + Table returnTable = tables == null ? sourceTable : tables.get(sourceTable.getName()); + + // ADD target table param is missing do not error + if (returnTable == null) { + throw new RuntimeException("Unable to find Cassandra target table " + sourceTable.getName() + " in keyspace " + keyspace); + } + return returnTable; + } - @Override - protected boolean create(CsvData data) { - return false; - } + @Override + protected boolean create(CsvData data) { + return false; + } - @Override - protected void logFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails) { - } + @Override + protected void logFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails) { + } - @Override - protected void allowInsertIntoAutoIncrementColumns(boolean value, Table table) { - } - - protected void bindVariables(BoundStatement bstmt, Column[] columns, int[] types, String[] values) { - // TODO data time mappings + @Override + protected void allowInsertIntoAutoIncrementColumns(boolean value, Table table) { + } + + @SuppressWarnings("unchecked") + protected void bindVariables(BoundStatement bstmt, Column[] columns, int[] types, String[] values) { + // TODO data time mappings - int i = 0; - for (int type : types) { - if (Types.INTEGER == type) { - bstmt.setInt(i, Integer.parseInt(values[i])); - } else if (Types.VARCHAR == type) { - bstmt.setString(i, values[i]); - } else if (Types.JAVA_OBJECT == type) { - bstmt.setUUID(i, UUID.fromString(values[i])); - } else if (Types.TIMESTAMP == type) { - try { - bstmt.setTimestamp(i, tsFormat.parse(values[i])); - } catch (ParseException e) { - throw new RuntimeException("Unable to bind timestamp column " + columns[i].getName() + " with value " + values[i]); - } - } else if (Types.DATE == type) { - try { - bstmt.setDate(i, LocalDate.fromMillisSinceEpoch(dateFormat.parse(values[i]).getTime())); - } catch (ParseException e) { - throw new RuntimeException("Unable to bind date column " + columns[i].getName() + " with value " + values[i]); - } - } else if (Types.TIME == type) { - try { - bstmt.setTime(i, LocalTime.parse(values[i], timeFormat).toNanoOfDay()); - } catch (DateTimeParseException e) { - throw new RuntimeException("Unable to bind time column " + columns[i].getName() + " with value " + values[i]); - } - } else if (Types.BOOLEAN == type) { - bstmt.setBool(i, Boolean.parseBoolean(values[i])); - } else if (Types.DECIMAL == type) { - bstmt.setDecimal(i, new BigDecimal(values[i])); - } else if (Types.DOUBLE == type) { - bstmt.setDouble(i, Double.parseDouble(values[i])); - } else if (Types.FLOAT == type) { - bstmt.setFloat(i, Float.parseFloat(values[i])); - } else if (Types.STRUCT == type) { - bstmt.setList(i, parseList(columns[i], values[i])); - } else if (Types.REF == type) { - bstmt.setSet(i, parseSet(columns[i], values[i])); - } else if (Types.OTHER == type) { - bstmt.setMap(i, parseMap(columns[i], values[i])); - } + int i = 0; + for (int type : types) { + if (Types.INTEGER == type) { + bstmt.setInt(i, Integer.parseInt(values[i])); + } else if (Types.VARCHAR == type) { + bstmt.setString(i, values[i]); + } else if (Types.JAVA_OBJECT == type) { + bstmt.setUUID(i, UUID.fromString(values[i])); + } else if (Types.TIMESTAMP == type) { + try { + bstmt.setTimestamp(i, tsFormat.parse(values[i])); + } catch (ParseException e) { + throw new RuntimeException("Unable to bind timestamp column " + columns[i].getName() + " with value " + values[i]); + } + } else if (Types.DATE == type) { + try { + bstmt.setDate(i, LocalDate.fromMillisSinceEpoch(dateFormat.parse(values[i]).getTime())); + } catch (ParseException e) { + throw new RuntimeException("Unable to bind date column " + columns[i].getName() + " with value " + values[i]); + } + } else if (Types.TIME == type) { + try { + bstmt.setTime(i, LocalTime.parse(values[i], timeFormat).toNanoOfDay()); + } catch (DateTimeParseException e) { + throw new RuntimeException("Unable to bind time column " + columns[i].getName() + " with value " + values[i]); + } + } else if (Types.BOOLEAN == type) { + bstmt.setBool(i, Boolean.parseBoolean(values[i])); + } else if (Types.DECIMAL == type) { + bstmt.setDecimal(i, new BigDecimal(values[i])); + } else if (Types.DOUBLE == type) { + bstmt.setDouble(i, Double.parseDouble(values[i])); + } else if (Types.FLOAT == type) { + bstmt.setFloat(i, Float.parseFloat(values[i])); + } else if (Types.STRUCT == type) { + bstmt.setList(i, parseList(columns[i], values[i])); + } else if (Types.REF == type) { + bstmt.setSet(i, parseSet(columns[i], values[i])); + } else if (Types.OTHER == type) { + bstmt.setMap(i, parseMap(columns[i], values[i])); + } - i++; - } - } + i++; + } + } - protected List parseList(Column c, String val) { - try { - if (c.getDescription() != null) { - if (c.getDescription().toLowerCase().equals("text") || c.getDescription().toLowerCase().equals("varchar")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("int")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("bigint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("smallint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("tinyint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("double")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("decimal")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("float")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } - } - return new ObjectMapper().readValue(val, new TypeReference>(){}); - - } catch (Exception e) { - throw new RuntimeException("Unable to convert value to list, value=" + val,e); - } - } + @SuppressWarnings("rawtypes") + protected List parseList(Column c, String val) { + try { + if (c.getDescription() != null) { + if (c.getDescription().toLowerCase().equals("text") || c.getDescription().toLowerCase().equals("varchar")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("int")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("bigint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("smallint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("tinyint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("double")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("decimal")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("float")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } + } + return gson.fromJson(val, new TypeToken>(){}.getType()); + + } catch (Exception e) { + throw new RuntimeException("Unable to convert value to list, value=" + val,e); + } + } - protected Set parseSet(Column c, String val) { - try { - if (c.getDescription() != null) { - if (c.getDescription().toLowerCase().equals("text") || c.getDescription().toLowerCase().equals("varchar")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("int")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("bigint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("smallint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("tinyint")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("double")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("decimal")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if (c.getDescription().toLowerCase().equals("float")) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } - } - return new ObjectMapper().readValue(val, new TypeReference>(){}); - - } catch (Exception e) { - throw new RuntimeException("Unable to convert value to set, value=" + val,e); - } - } + @SuppressWarnings("rawtypes") + protected Set parseSet(Column c, String val) { + try { + if (c.getDescription() != null) { + if (c.getDescription().toLowerCase().equals("text") || c.getDescription().toLowerCase().equals("varchar")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("int")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("bigint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("smallint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("tinyint")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("double")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("decimal")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if (c.getDescription().toLowerCase().equals("float")) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } + } + return gson.fromJson(val, new TypeToken>(){}.getType()); + + } catch (Exception e) { + throw new RuntimeException("Unable to convert value to set, value=" + val,e); + } + } - protected Map parseMap(Column c, String val) { - try { - if (c.getDescription() != null) { - // TODO find dynamic way to create map types based on column types - String[] parts = c.getDescription().split(","); - if (parts[0].equals(DataType.Name.INT.name()) && - (parts[1].equals(DataType.Name.TEXT.name()) || parts[1].equals(DataType.Name.VARCHAR.name()))) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } else if ((parts[0].equals(DataType.Name.TEXT.name()) || parts[0].equals(DataType.Name.VARCHAR.name())) && - (parts[1].equals(DataType.Name.TEXT.name()) || parts[1].equals(DataType.Name.VARCHAR.name()))) { - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } - } - return new ObjectMapper().readValue(val, new TypeReference>(){}); - } catch (Exception e) { - throw new RuntimeException("Unable to convert value to map, expecting JSON, value=" + val,e); - } - } + @SuppressWarnings("rawtypes") + protected Map parseMap(Column c, String val) { + try { + if (c.getDescription() != null) { + // TODO find dynamic way to create map types based on column types + String[] parts = c.getDescription().split(","); + if (parts[0].equals(DataType.Name.INT.name()) && + (parts[1].equals(DataType.Name.TEXT.name()) || parts[1].equals(DataType.Name.VARCHAR.name()))) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } else if ((parts[0].equals(DataType.Name.TEXT.name()) || parts[0].equals(DataType.Name.VARCHAR.name())) && + (parts[1].equals(DataType.Name.TEXT.name()) || parts[1].equals(DataType.Name.VARCHAR.name()))) { + return gson.fromJson(val, new TypeToken>(){}.getType()); + } + } + return gson.fromJson(val, new TypeToken>(){}.getType()); + } catch (Exception e) { + throw new RuntimeException("Unable to convert value to map, expecting JSON, value=" + val,e); + } + } } diff --git a/symmetric-jdbc/build.gradle b/symmetric-jdbc/build.gradle index 6e36a65eca..b777fc66de 100644 --- a/symmetric-jdbc/build.gradle +++ b/symmetric-jdbc/build.gradle @@ -6,5 +6,6 @@ apply from: symAssembleDir + '/common.gradle' compile project(":symmetric-db") compile "commons-dbcp:commons-dbcp:$commonsDbcpVersion" compile "org.springframework:spring-jdbc:$springVersion" + compile "jdbc.sybase:jconnect:7.7" testCompile project(path: ':symmetric-util', configuration: 'testArtifacts') } \ No newline at end of file