Commit 676e28d8 authored by npedot's avatar npedot
Browse files

removes some print

parent bf5707e4
......@@ -10,8 +10,7 @@ class Starter {
*/
fun main(args:Array<String>) {
val version = "0.1.0-SNAPSHOT"
println("KPrime $version")
}
}
......
package unibz.cs.semint.kprime.adapter.repository
import com.fasterxml.jackson.databind.ObjectMapper
import unibz.cs.semint.kprime.domain.DataSource
import unibz.cs.semint.kprime.domain.dql.Query
import unibz.cs.semint.kprime.usecase.common.SQLizeSelectUseCase
......@@ -13,6 +12,7 @@ import java.util.*
class JdbcAdapter {
private var formatted=false
constructor() {}
constructor(formatted: Boolean) {
......@@ -20,12 +20,12 @@ class JdbcAdapter {
}
fun query(datasource: DataSource, query: Query, printer: (rs :ResultSet)->String) :String {
var sqlquery = SQLizeSelectUseCase().sqlize(query)
val sqlquery = SQLizeSelectUseCase().sqlize(query)
return query(datasource,sqlquery,printer)
}
fun query(datasource: DataSource, sqlquery: String, printer:(rs:ResultSet)->String):String {
var conn: Connection = openConnection(datasource) ?: throw IllegalArgumentException("No connection")
val conn: Connection = openConnection(datasource) ?: throw IllegalArgumentException("No connection")
val sqlnative = conn.nativeSQL(sqlquery)
val prepareStatement = conn.prepareStatement(sqlnative)
val resultSet = prepareStatement.executeQuery()
......@@ -39,19 +39,19 @@ class JdbcAdapter {
val conn = openConnection(datasource) ?: throw IllegalArgumentException("No connection")
val createStatement = conn.createStatement()
val resultSet = createStatement.executeUpdate(sqlcreate)
println(" Create result : $resultSet")
// println(" Create result : $resultSet")
createStatement.close()
closeConnection(datasource,conn)
}
private fun closeConnection(datasource: DataSource, conn: Connection) {
val connectionDescriptor = datasource.connection
println(" Check close connection ${connectionDescriptor?.id}: ${connectionDescriptor?.closed}")
// println(" Check close connection ${connectionDescriptor?.id}: ${connectionDescriptor?.closed}")
if (connectionDescriptor != null) {
if (connectionDescriptor.closed) {
conn.close()
datasource.remResource(connectionDescriptor.id)
println("closed connection ${connectionDescriptor.id}")
// println("closed connection ${connectionDescriptor.id}")
}
} else {
conn.close()
......@@ -69,13 +69,13 @@ class JdbcAdapter {
val pass = source.pass
val path = source.path
println("Looking for... driver [${source.driver}] for connection [$path] with user [$user].")
// println("Looking for... driver [${source.driver}] for connection [$path] with user [$user].")
Class.forName(source.driver).newInstance()
var conn: Connection?
println("Connection preparing...")
// println("Connection preparing...")
if (datasource.connection == null) {
println("Connection NEW")
// println("Connection NEW")
val connectionProps = Properties()
connectionProps.put("user", user)
connectionProps.put("password", pass)
......
......@@ -22,11 +22,11 @@ class MetaSchemaJdbcAdapter : IMetaSchemaRepository {
val connectionProps = Properties()
connectionProps.put("user", user)
connectionProps.put("password", pass)
println("Looking for driver [${source.driver}] for connection [$path] with user [$user].")
// println("Looking for driver [${source.driver}] for connection [$path] with user [$user].")
Class.forName(source.driver).newInstance()
println("--------------------------")
DriverManager.getDrivers().toList().forEach{ println(it.toString()) }
println("--------------------------")
// println("--------------------------")
// DriverManager.getDrivers().toList().forEach{ println(it.toString()) }
// println("--------------------------")
val conn = DriverManager.getConnection(
path, connectionProps)
......
......@@ -108,7 +108,7 @@ class XMLSerializerJacksonAdapter : SerializerServiceI {
}
override fun deserializeTransformer(transformerXml: String): Transformer {
println(transformerXml)
// println(transformerXml)
val mapper = XmlMapper()
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
return mapper.readValue(transformerXml,Transformer::class.java)
......
......@@ -61,7 +61,7 @@ class Schema () {
if (constr.target.table==sourceTableName) {
constr.target.table=targetTableName
}
println("MOVED CONSTRAINT FROM $sourceTableName TO ${constr.name}:"+constr.toString())
// println("MOVED CONSTRAINT FROM $sourceTableName TO ${constr.name}:"+constr.toString())
}
}
......
......@@ -72,7 +72,6 @@ class UnSQLizeSelectUseCase {
)
internal fun splitOnKeyWords(line:String): List<String> {
println("to split: '$line'")
val result = mutableListOf<String>()
var token = line
do {
......@@ -87,7 +86,7 @@ class UnSQLizeSelectUseCase {
}
} while(found)
result.add(token.trim())
result.forEach { println(it) }
// result.forEach { println(it) }
return result
}
......
......@@ -13,28 +13,28 @@ import unibz.cs.semint.kprime.usecase.common.XMLSerializeUseCase
class HSplitUseCase {
fun compute(databaseMetadata: Database) {
printDb(databaseMetadata)
// printDb(databaseMetadata)
val detected = detect(databaseMetadata)
if (detected.ok!=null) {
val applied = apply(databaseMetadata, detected)
if (applied.ok!=null) {
printDb(applied.ok)
printSql(SQLizeCreateUseCase().createViewCommands(applied.ok))
}
// if (applied.ok!=null) {
// printDb(applied.ok)
// printSql(SQLizeCreateUseCase().createViewCommands(applied.ok))
// }
}
}
private fun printSql(sqlines: List<String>) {
println()
println("--------------------------------------------------------------------------")
for (sql in sqlines) println(sql)
}
private fun printDb(db: Database) {
println()
println("--------------------------------------------------------------------------")
println(XMLSerializeUseCase(XMLSerializerJacksonAdapter()).prettyDatabase(db))
}
// private fun printSql(sqlines: List<String>) {
// println()
// println("--------------------------------------------------------------------------")
// for (sql in sqlines) println(sql)
// }
//
// private fun printDb(db: Database) {
// println()
// println("--------------------------------------------------------------------------")
// println(XMLSerializeUseCase(XMLSerializerJacksonAdapter()).prettyDatabase(db))
// }
private fun detect(personMetadata: Database): UseCaseResult<Database> {
val dbDetected = Database()
......
......@@ -26,7 +26,7 @@ class TransformerXCompose (
): Transformation {
val dbFilePath = fileIOAdapter.writeOnWorkingFilePath(
serializer.prettyDatabase(db), workingDir + "db_worked.xml")
println("Updated db file db_worked.xml")
// println("Updated db file db_worked.xml")
var xPaths = File(coXPathsFilePath).readLines()
val tranformerParmeters = mutableMapOf<String,Any>()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment