Skip to content

Commit

Permalink
ci: update version after release
Browse files Browse the repository at this point in the history
  • Loading branch information
MongoCamp CI committed Oct 22, 2024
1 parent dde85f7 commit f8b85fe
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 161 deletions.
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "mongodb-driver",
"organization": "dev.mongocamp",
"version": "2.8.0",
"author": "info@mongocamp.dev",
"license": "Apache-2.0",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/MongoCamp/mongodb-driver.git"
"name" : "mongodb-driver",
"organization" : "dev.mongocamp",
"version" : "2.8.1.snapshot",
"author" : "info@mongocamp.dev",
"license" : "Apache-2.0",
"type" : "module",
"repository" : {
"type" : "git",
"url" : "git+https://github.com/MongoCamp/mongodb-driver.git"
},
"bugs": {
"url": "https://github.com/MongoCamp/mongodb-driver/issues"
"bugs" : {
"url" : "https://github.com/MongoCamp/mongodb-driver/issues"
},
"homepage": "https://mongodb-driver.mongocamp.dev/",
"scripts": {
"docs:serve": "vitepress serve docs --port 5555",
"docs:build": "pnpm docs:external; vitepress build docs",
"docs:external": "sh docs/external/fileloader.sh",
"docs:dev": "pnpm docs:external; vitepress dev docs"
"homepage" : "https://mongodb-driver.mongocamp.dev/",
"scripts" : {
"docs:serve" : "vitepress serve docs --port 5555",
"docs:build" : "pnpm docs:external; vitepress build docs",
"docs:external" : "sh docs/external/fileloader.sh",
"docs:dev" : "pnpm docs:external; vitepress dev docs"
},
"devDependencies": {
"@iconify-json/fluent-emoji": "^1.2.1",
"@unocss/preset-icons": "^0.63.4",
"unocss": "^0.63.4",
"vitepress": "1.4.1"
"devDependencies" : {
"@iconify-json/fluent-emoji" : "^1.2.1",
"@unocss/preset-icons" : "^0.63.4",
"unocss" : "^0.63.4",
"vitepress" : "1.4.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ trait CirceProductSchema {
internalProduct.productElementNames
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,45 @@ package dev.mongocamp.driver.mongodb.database
import java.util.concurrent.TimeUnit
import com.mongodb.MongoCompressor
import com.mongodb.MongoCredential.createCredential
import com.mongodb.event.{CommandListener, ConnectionPoolListener}
import com.typesafe.config.{Config, ConfigFactory}
import dev.mongocamp.driver.mongodb.database.MongoConfig.{CompressionSnappy, CompressionZlib, CompressionZstd, DefaultApplicationName, DefaultAuthenticationDatabaseName, DefaultHost, DefaultPort}
import com.mongodb.event.{ CommandListener, ConnectionPoolListener }
import com.typesafe.config.{ Config, ConfigFactory }
import dev.mongocamp.driver.mongodb.database.MongoConfig.{
CompressionSnappy,
CompressionZlib,
CompressionZstd,
DefaultApplicationName,
DefaultAuthenticationDatabaseName,
DefaultHost,
DefaultPort
}
import org.mongodb.scala.connection._
import org.mongodb.scala.{MongoClientSettings, MongoCredential, ServerAddress}
import org.mongodb.scala.{ MongoClientSettings, MongoCredential, ServerAddress }

import scala.jdk.CollectionConverters._
import scala.collection.mutable.ArrayBuffer

case class MongoConfig(
database: String,
host: String = DefaultHost,
port: Int = DefaultPort,
var applicationName: String = DefaultApplicationName,
userName: Option[String] = None,
password: Option[String] = None,
authDatabase: String = DefaultAuthenticationDatabaseName,
poolOptions: MongoPoolOptions = MongoPoolOptions(),
compressors: List[String] = List.empty,
connectionPoolListener: List[ConnectionPoolListener] = List.empty,
commandListener: List[CommandListener] = List.empty,
customClientSettings: Option[MongoClientSettings] = None,
serverAddressList: List[ServerAddress] = List.empty
) {
database: String,
host: String = DefaultHost,
port: Int = DefaultPort,
var applicationName: String = DefaultApplicationName,
userName: Option[String] = None,
password: Option[String] = None,
authDatabase: String = DefaultAuthenticationDatabaseName,
poolOptions: MongoPoolOptions = MongoPoolOptions(),
compressors: List[String] = List.empty,
connectionPoolListener: List[ConnectionPoolListener] = List.empty,
commandListener: List[CommandListener] = List.empty,
customClientSettings: Option[MongoClientSettings] = None,
serverAddressList: List[ServerAddress] = List.empty
) {

val clientSettings: MongoClientSettings = {
if (customClientSettings.isDefined) {
customClientSettings.get
}
else {
val internalServerAddressList = if (serverAddressList.nonEmpty) serverAddressList else List(new ServerAddress(host, port))
val internalServerAddressList = if (serverAddressList.nonEmpty) serverAddressList else List(new ServerAddress(host, port))
val clusterSettings: ClusterSettings = ClusterSettings.builder().hosts(internalServerAddressList.asJava).build()

val connectionPoolSettingsBuilder = ConnectionPoolSettings
Expand Down Expand Up @@ -137,5 +145,4 @@ object MongoConfig extends ConfigHelper {
MongoConfig(database, host, port, applicationName, userName, password, authDatabase, poolOptions, compressors)
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.mongocamp.driver.mongodb.jdbc

import java.sql.{SQLException, SQLFeatureNotSupportedException}
import java.sql.{ SQLException, SQLFeatureNotSupportedException }

trait MongoJdbcCloseable extends AutoCloseable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@ import dev.mongocamp.driver.mongodb.bson.BsonConverter
import dev.mongocamp.driver.mongodb.database.DatabaseProvider
import dev.mongocamp.driver.mongodb.jdbc.statement.MongoPreparedStatement

import java.{sql, util}
import java.sql.{Blob, CallableStatement, Clob, Connection, DatabaseMetaData, NClob, PreparedStatement, SQLException, SQLWarning, SQLXML, Savepoint, Statement, Struct}
import java.{ sql, util }
import java.sql.{
Blob,
CallableStatement,
Clob,
Connection,
DatabaseMetaData,
NClob,
PreparedStatement,
SQLException,
SQLWarning,
SQLXML,
Savepoint,
Statement,
Struct
}
import java.util.Properties
import java.util.concurrent.Executor
import scala.jdk.CollectionConverters._
Expand Down Expand Up @@ -110,51 +124,51 @@ class MongoJdbcConnection(databaseProvider: DatabaseProvider) extends Connection
createMongoStatement(Some(sql))
}

override def getTypeMap: util.Map[String, Class[_]] = {
override def getTypeMap: util.Map[String, Class[_]] = {
checkClosed()
null
}

override def setTypeMap(map: util.Map[String, Class[_]]): Unit = {
override def setTypeMap(map: util.Map[String, Class[_]]): Unit = {
checkClosed()
}

override def setHoldability(holdability: Int): Unit = {
override def setHoldability(holdability: Int): Unit = {
checkClosed()
}

override def getHoldability: Int = {
override def getHoldability: Int = {
checkClosed()
0
}

override def setSavepoint(): Savepoint = {
override def setSavepoint(): Savepoint = {
checkClosed()
null
}

override def setSavepoint(name: String): Savepoint = {
override def setSavepoint(name: String): Savepoint = {
checkClosed()
null
}

override def rollback(savepoint: Savepoint): Unit = {
override def rollback(savepoint: Savepoint): Unit = {
checkClosed()
}

override def releaseSavepoint(savepoint: Savepoint): Unit = {
override def releaseSavepoint(savepoint: Savepoint): Unit = {
checkClosed()
}

override def createStatement(resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): Statement = {
override def createStatement(resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): Statement = {
createMongoStatement()
}

override def prepareStatement(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): PreparedStatement = {
createMongoStatement(Option(sql))
}

override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): CallableStatement = {
override def prepareCall(sql: String, resultSetType: Int, resultSetConcurrency: Int, resultSetHoldability: Int): CallableStatement = {
checkClosed()
createMongoStatement(Some(sql))
}
Expand All @@ -171,27 +185,27 @@ class MongoJdbcConnection(databaseProvider: DatabaseProvider) extends Connection
createMongoStatement(Option(sql))
}

override def createClob(): Clob = {
override def createClob(): Clob = {
checkClosed()
null
}

override def createBlob(): Blob = {
override def createBlob(): Blob = {
checkClosed()
null
}

override def createNClob(): NClob = {
override def createNClob(): NClob = {
checkClosed()
null
}

override def createSQLXML(): SQLXML = {
override def createSQLXML(): SQLXML = {
checkClosed()
null
}

override def isValid(timeout: Int): Boolean = {
override def isValid(timeout: Int): Boolean = {
checkClosed()
true
}
Expand All @@ -214,8 +228,9 @@ class MongoJdbcConnection(databaseProvider: DatabaseProvider) extends Connection
checkClosed()
if ("ApplicationName".equalsIgnoreCase(name) || "appName".equalsIgnoreCase(name) || "name".equalsIgnoreCase(name)) {
databaseProvider.config.applicationName
} else {
null
}
else {
null
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package dev.mongocamp.driver.mongodb.jdbc

import com.vdurmont.semver4j.Semver
import dev.mongocamp.driver.mongodb.BuildInfo
import dev.mongocamp.driver.mongodb.database.{DatabaseProvider, MongoConfig}
import org.mongodb.scala.{ConnectionString, ServerAddress}
import dev.mongocamp.driver.mongodb.database.{ DatabaseProvider, MongoConfig }
import org.mongodb.scala.{ ConnectionString, ServerAddress }

import java.sql.{Connection, DriverPropertyInfo}
import java.sql.{ Connection, DriverPropertyInfo }
import java.util.Properties
import java.util.logging.Logger
import scala.jdk.CollectionConverters._
Expand All @@ -15,8 +15,7 @@ class MongoJdbcDriver extends java.sql.Driver {

private lazy val semVer = new Semver(BuildInfo.version)

/**
* Connect to the database using a URL like : jdbc:mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] The
/** Connect to the database using a URL like : jdbc:mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] The
* URL excepting the jdbc: prefix is passed as it is to the MongoDb native Java driver.
*/
override def connect(url: String, info: Properties): Connection = {
Expand All @@ -28,9 +27,9 @@ class MongoJdbcDriver extends java.sql.Driver {
val username = Option(info.getProperty(MongodbJdbcDriverPropertyInfoHelper.AuthUser)).filter(_.trim.nonEmpty)
val password = Option(info.getProperty(MongodbJdbcDriverPropertyInfoHelper.AuthPassword)).filter(_.trim.nonEmpty)

val string = new ConnectionString(connectionUrl)
val string = new ConnectionString(connectionUrl)
val database = Option(string.getDatabase).getOrElse(Option(info.getProperty(MongodbJdbcDriverPropertyInfoHelper.Database)).getOrElse("admin"))
val authDb = Option(info.getProperty(MongodbJdbcDriverPropertyInfoHelper.AuthDatabase)).getOrElse(Option(string.getDatabase).getOrElse("admin"))
val authDb = Option(info.getProperty(MongodbJdbcDriverPropertyInfoHelper.AuthDatabase)).getOrElse(Option(string.getDatabase).getOrElse("admin"))
val provider = DatabaseProvider(
MongoConfig(
database,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import MongodbJdbcDriverPropertyInfoHelper._

object MongodbJdbcDriverPropertyInfoHelper {
val ApplicationName = "appName"
val Database = "database"
val Database = "database"

val AuthUser = "user"
val AuthPassword = "password"
val AuthUser = "user"
val AuthPassword = "password"
val AuthDatabase = "auth_database"
val DefaultAuthDB = "admin"
val DefaultAppName = "mongodb-driver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package dev.mongocamp.driver.mongodb.jdbc.resultSet

import dev.mongocamp.driver.mongodb.MongoDAO
import org.mongodb.scala.Document
import org.mongodb.scala.bson.{BsonBoolean, BsonInt32, BsonInt64, BsonNumber, BsonString}
import org.mongodb.scala.bson.{ BsonBoolean, BsonInt32, BsonInt64, BsonNumber, BsonString }
import dev.mongocamp.driver.mongodb._

import java.sql.{ResultSetMetaData, SQLException}
import java.sql.{ ResultSetMetaData, SQLException }

class MongoDbResultSetMetaData extends ResultSetMetaData {
private var document: Document = _
Expand All @@ -32,9 +32,9 @@ class MongoDbResultSetMetaData extends ResultSetMetaData {
}

private def extractDocumentFromDataList(data: List[Document]) = {
var row = data.headOption.getOrElse(throw new SQLException("No data in ResultSet")).copy()
var row = data.headOption.getOrElse(throw new SQLException("No data in ResultSet")).copy()
val distinctKeys = data.flatMap(_.keys).distinct
val missingKeys = distinctKeys.diff(row.keys.toSeq)
val missingKeys = distinctKeys.diff(row.keys.toSeq)
missingKeys.foreach(key => {
data
.find(_.get(key).nonEmpty)
Expand Down
Loading

0 comments on commit f8b85fe

Please sign in to comment.