Skip to content
This repository
Browse code

Issue 994 - Remove Mapper dependency from Record

  • Loading branch information...
commit 964667665b17baf8c47f1051eb5ae31bbffa8e26 1 parent be68944
Tim Nelson authored April 29, 2011
3  ...pper/src/main/scala/net/liftweb/mapper/Safe.scala → core/util/src/main/scala/net/liftweb/util/Safe.scala
@@ -15,11 +15,10 @@
15 15
  */
16 16
 
17 17
 package net.liftweb
18  
-package mapper
  18
+package util
19 19
 
20 20
 import java.security.{SecureRandom, MessageDigest}
21 21
 import org.apache.commons.codec.binary.Base64
22  
-import net.liftweb.util.{StringHelpers, Helpers, ThreadGlobal}
23 22
 
24 23
 /**
25 24
  * Manage the current "safety" state of the stack
1  persistence/mapper/src/main/scala/net/liftweb/mapper/MappedPassword.scala
@@ -17,7 +17,6 @@
17 17
 package net.liftweb
18 18
 package mapper
19 19
 
20  
-import net.liftweb.mapper._
21 20
 import net.liftweb.util.Helpers._
22 21
 import net.liftweb.util.FatLazy
23 22
 import java.sql.{ResultSet, Types}
5  persistence/mapper/src/main/scala/net/liftweb/mapper/package.scala
@@ -14,7 +14,7 @@
14 14
  * limitations under the License.
15 15
  */
16 16
 
17  
-package net.liftweb 
  17
+package net.liftweb
18 18
 package object mapper {
19 19
   type SuperConnection = db.SuperConnection
20 20
   type ConnectionIdentifier = db.ConnectionIdentifier
@@ -26,4 +26,7 @@ package object mapper {
26 26
   def DBLogEntry = db.DBLogEntry
27 27
   def DefaultConnectionIdentifier = db.DefaultConnectionIdentifier
28 28
   def DriverType = db.DriverType
  29
+
  30
+  @deprecated("Use util.Safe instead.")
  31
+  def Safe = util.Safe
29 32
 }
3  persistence/mongodb-record/src/main/scala/net/liftweb/mongodb/record/field/MongoPasswordField.scala
@@ -24,8 +24,7 @@ import scala.xml.{Node, NodeSeq, Text}
24 24
 import net.liftweb.common.{Box, Empty, Failure, Full}
25 25
 import net.liftweb.http.S
26 26
 import net.liftweb.http.js.JE._
27  
-import net.liftweb.mapper.Safe
28  
-import net.liftweb.util.{FatLazy, FieldError, Helpers}
  27
+import net.liftweb.util.{FatLazy, FieldError, Helpers, Safe}
29 28
 
30 29
 import Helpers._
31 30
 
16  persistence/mongodb-record/src/test/scala/net/liftweb/mongodb/record/MongoRecordSpec.scala
@@ -432,22 +432,6 @@ object MongoRecordSpec extends Specification("MongoRecord Specification") with M
432 432
       srtrAsJValue \\ "legacyOptionalBsonRecordListField" mustEqual srtrJson \\ "legacyOptionalBsonRecordListField"
433 433
     }
434 434
 
435  
-    "convert Mongo type fields to JsExp" in {
436  
-      checkMongoIsRunning
437  
-
438  
-      mfttr.asJsExp mustEqual new JsExp {
439  
-        def toJsCmd = compact(render(mfttrJson))
440  
-      }
441  
-
442  
-      ltr.asJsExp mustEqual new JsExp {
443  
-        def toJsCmd = compact(render(ltrJson))
444  
-      }
445  
-
446  
-      mtr.asJsExp mustEqual new JsExp {
447  
-        def toJsCmd = compact(render(mtrJson))
448  
-      }
449  
-    }
450  
-
451 435
     "get set from json string using lift-json parser" in {
452 436
       checkMongoIsRunning
453 437
 
4  persistence/record/src/main/scala/net/liftweb/record/DBMetaRecord.scala
@@ -17,13 +17,13 @@
17 17
 package net.liftweb
18 18
 package record
19 19
 
20  
-import net.liftweb._
21 20
 import util._
22 21
 import common._
  22
+import db.{ConnectionIdentifier, DefaultConnectionIdentifier}
23 23
 import scala.xml._
24  
-import net.liftweb.mapper.{ConnectionIdentifier, Safe, DefaultConnectionIdentifier, DB, KeyObfuscator, SuperConnection, QueryParam}
25 24
 import java.sql.{ResultSet, Types, PreparedStatement, Statement}
26 25
 
  26
+@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
27 27
 trait DBMetaRecord[BaseRecord <: DBRecord[BaseRecord]] extends MetaRecord[BaseRecord] {
28 28
   self: BaseRecord =>
29 29
 
5  persistence/record/src/main/scala/net/liftweb/record/DBRecord.scala
@@ -17,13 +17,12 @@
17 17
 package net.liftweb 
18 18
 package record 
19 19
 
20  
-import net.liftweb._
21 20
 import common._
  21
+import db.{ConnectionIdentifier, DB}
22 22
 import util._
23 23
 import scala.xml._
24  
-import net.liftweb.mapper.{ConnectionIdentifier, Safe, DefaultConnectionIdentifier, DB, KeyObfuscator}
25  
-
26 24
 
  25
+@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
27 26
 trait DBRecord[MyType <: DBRecord[MyType]] extends Record[MyType] {
28 27
   self: MyType =>
29 28
 
5  persistence/record/src/main/scala/net/liftweb/record/Field.scala
@@ -422,14 +422,15 @@ trait DisplayWithLabel[OwnerType <: Record[OwnerType]] extends OwnedField[OwnerT
422 422
 
423 423
 
424 424
 import java.sql.{ResultSet, Types}
425  
-import net.liftweb.mapper.{DriverType}
  425
+import net.liftweb.db.{DriverType}
426 426
 
427 427
 /**
428 428
  * Desribes common aspects related with JDBC
429 429
  */
  430
+@deprecated("This was never fully implemented. If you're looking for a SQL implementation of Record, please see Squeryl-Record. If you have any questions, please bring them up on the mailing list.")
430 431
 trait JDBCFieldFlavor[MyType] {
431 432
 
432  
-  def jdbcFriendly(field : String) : MyType
  433
+  def jdbcFriendly(field : String) : AnyRef
433 434
 
434 435
   def targetSQLType : Int
435 436
 
1  persistence/record/src/main/scala/net/liftweb/record/Record.scala
@@ -21,7 +21,6 @@ import common._
21 21
 import http.js.{JsExp, JsObj}
22 22
 import http.{Req, SHtml}
23 23
 import json.JsonAST._
24  
-import mapper.Safe
25 24
 import util._
26 25
 import field._
27 26
 
2  persistence/record/src/main/scala/net/liftweb/record/field/PasswordField.scala
@@ -28,8 +28,6 @@ import http.S
28 28
 import http.js._
29 29
 import S._
30 30
 import JE._
31  
-import mapper.Safe
32  
-
33 31
 
34 32
 object PasswordField {
35 33
   @volatile var blankPw = "*******"
1  persistence/record/src/main/scala/net/liftweb/record/field/PostalCodeField.scala
@@ -21,7 +21,6 @@ package field
21 21
 import scala.xml._
22 22
 import net.liftweb.util._
23 23
 import net.liftweb.common._
24  
-import net.liftweb.mapper.{Safe}
25 24
 import net.liftweb.http.{S}
26 25
 import java.util.regex._
27 26
 import java.util.regex.{Pattern => RegexPattern}
8  persistence/squeryl-record/src/main/scala/net/liftweb/squerylrecord/SquerylRecord.scala
@@ -15,7 +15,7 @@ package net.liftweb
15 15
 package squerylrecord
16 16
 
17 17
 import common.{Box, Full, Loggable}
18  
-import mapper.DB // FIXME should be moved out of mapper
  18
+import db.DB
19 19
 import util.DynoVar
20 20
 
21 21
 import org.squeryl.{Session, SessionFactory}
@@ -25,14 +25,14 @@ import org.squeryl.internals.{DatabaseAdapter, FieldMetaData}
25 25
 object SquerylRecord extends Loggable {
26 26
   /** Keep track of the current Squeryl Session we've created using DB */
27 27
   private object currentSession extends DynoVar[Session]
28  
-  
  28
+
29 29
   /**
30 30
    * We have to remember the default Squeryl metadata factory before
31 31
    * we override it with our own implementation, so that we can use
32 32
    * the original factory for non-record classes.
33 33
    */
34 34
   private[squerylrecord] var posoMetaDataFactory = FieldMetaData.factory
35  
-  
  35
+
36 36
   /**
37 37
    * Initialize the Squeryl/Record integration. This must be called somewhere during your Boot, and before you use any
38 38
    * Records with Squeryl. Use this function instead of init if you want to use the squeryl session factory
@@ -42,7 +42,7 @@ object SquerylRecord extends Loggable {
42 42
     FieldMetaData.factory = new RecordMetaDataFactory
43 43
     SessionFactory.concreteFactory = Some(() => sessionFactory)
44 44
   }
45  
-  
  45
+
46 46
   /**
47 47
    * Initialize the Squeryl/Record integration. This must be called somewhere during your Boot, and before you use any
48 48
    * Records with Squeryl. Use this function if you want to use mapper.DB as the transaction manager
4  project/build/LiftFrameworkProject.scala
@@ -50,10 +50,10 @@ class LiftFrameworkProject(info: ProjectInfo) extends ParentProject(info) with L
50 50
   lazy val proto          = persistenceProject("proto")(webkit)
51 51
   lazy val jpa            = persistenceProject("jpa", scalajpa, persistence_api)(webkit)
52 52
   lazy val mapper         = persistenceProject("mapper", RuntimeScope.h2database, RuntimeScope.derby)(db, proto)
53  
-  lazy val record         = persistenceProject("record")(mapper)
  53
+  lazy val record         = persistenceProject("record")(proto, db) // db to be removed in v 2.5 (ticket 997)
54 54
   lazy val ldap           = persistenceProject("ldap", TestScope.apacheds)(mapper)
55 55
   lazy val couchdb        = persistenceProject("couchdb", dispatch_http)(record)
56  
-  lazy val squeryl_record = persistenceProject("squeryl-record", RuntimeScope.h2database, squeryl)(record)
  56
+  lazy val squeryl_record = persistenceProject("squeryl-record", RuntimeScope.h2database, squeryl)(record, db)
57 57
   lazy val mongodb        = persistenceProject("mongodb", mongo_driver)(json_ext)
58 58
   lazy val mongodb_record = persistenceProject("mongodb-record")(record, mongodb)
59 59
 

0 notes on commit 9646676

Please sign in to comment.
Something went wrong with that request. Please try again.