Browse files

Ref #872, #873, #817: More deprecation fixes and scala 2.8 alignment

  • Loading branch information...
1 parent 94555af commit cda5a9e5eedeee398fea7a87b9f2e8bff71e3f95 @indrajitr indrajitr committed Feb 27, 2011
Showing with 225 additions and 266 deletions.
  1. +4 −7 core/actor/src/main/scala/net/liftweb/actor/LAPinger.scala
  2. +1 −1 core/util/src/main/scala/net/liftweb/util/BaseField.scala
  3. +1 −1 core/util/src/main/scala/net/liftweb/util/Maker.scala
  4. +11 −12 core/util/src/main/scala/net/liftweb/util/SoftReferenceCache.scala
  5. +14 −14 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedPostalCode.scala
  6. +5 −7 persistence/mapper/src/main/scala/net/liftweb/mapper/OneToMany.scala
  7. +11 −12 persistence/mapper/src/main/scala/net/liftweb/mapper/Schemifier.scala
  8. +13 −19 persistence/mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala
  9. +1 −2 persistence/mongodb-record/src/test/scala/net/liftweb/mongodb/record/MongoRecordSpec.scala
  10. +16 −19 persistence/record/src/main/scala/net/liftweb/record/field/EnumField.scala
  11. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/EnumNameField.scala
  12. +13 −15 persistence/record/src/main/scala/net/liftweb/record/field/LocaleField.scala
  13. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/PasswordField.scala
  14. +15 −18 persistence/record/src/main/scala/net/liftweb/record/field/StringField.scala
  15. +13 −15 persistence/record/src/main/scala/net/liftweb/record/field/TimeZoneField.scala
  16. +2 −3 web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
  17. +14 −14 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
  18. +9 −16 web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala
  19. +23 −22 web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
  20. +6 −6 web/webkit/src/main/scala/net/liftweb/http/Paginator.scala
  21. +11 −12 web/webkit/src/main/scala/net/liftweb/http/S.scala
  22. +1 −1 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
  23. +3 −3 web/webkit/src/main/scala/net/liftweb/http/TemplateFinder.scala
  24. +1 −1 web/webkit/src/main/scala/net/liftweb/http/auth/HttpAuthentication.scala
  25. +7 −10 web/webkit/src/main/scala/net/liftweb/sitemap/XmlMenu.scala
View
11 core/actor/src/main/scala/net/liftweb/actor/LAPinger.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package net.liftweb {
-package actor {
+package net.liftweb
+package actor
-import _root_.java.util.concurrent._
+import java.util.concurrent._
/**
* The ActorPing object schedules an actor to be ping-ed with a given message at specific intervals.
@@ -72,6 +72,3 @@ private object TF extends ThreadFactory {
d
}
}
-
-}
-}
View
2 core/util/src/main/scala/net/liftweb/util/BaseField.scala
@@ -66,7 +66,7 @@ trait ReadableField extends FieldIdentifier with ValueHolder with Bindable {
/**
* Default read-only rendering of field
*/
- def asHtml: NodeSeq = Text(is.toString)
+ def asHtml: NodeSeq = Text(get.toString)
/**
* Given the current context, should this field be displayed
View
2 core/util/src/main/scala/net/liftweb/util/Maker.scala
@@ -147,7 +147,7 @@ trait StackableMaker[T] extends Maker[T] {
protected final def find(in: List[PValueHolder[Maker[T]]]): Box[T] = in match {
case Nil => Empty
case x :: rest =>
- x.is.make match {
+ x.get.make match {
case Full(v) => Full(v)
case _ => find(rest)
}
View
23 core/util/src/main/scala/net/liftweb/util/SoftReferenceCache.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.java.lang.ref.{ReferenceQueue,SoftReference};
-import _root_.java.util._
-import _root_.java.util.concurrent.locks._
-import _root_.net.liftweb.util._
+import java.lang.ref.{ReferenceQueue,SoftReference};
+import java.util._
import Map._
-import Helpers._
-import ActorPing._
+import concurrent.locks._
+
import common._
+import util._
+import Helpers._
+import Schedule._
+
/**
* Companion module that has the role of monitoring garbage collected references and remove the orphaned
@@ -163,6 +165,3 @@ class SoftValue[K, V](k: K,
def key: K = k
def cache: SoftReferenceCache[K, V] = lruCache
}
-
-}
-}
View
28 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedPostalCode.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,15 +14,18 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
-import _root_.scala.xml.{Text, Elem}
-import _root_.net.liftweb.http.{S, SHtml}
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.util._
+import java.util.{Locale, TimeZone}
+
+import xml.{Text, Elem}
+
+import common._
+import util._
import Helpers._
-import _root_.java.util.{Locale, TimeZone}
+import http.{S, SHtml}
+
object Countries extends Enumeration(1) {
@@ -81,7 +84,7 @@ abstract class MappedLocale[T <: Mapper[T]](owner: T) extends MappedString[T](ow
override def _toForm: Box[Elem] =
Full(SHtml.select(Locale.getAvailableLocales.
- toList.sort(_.getDisplayName < _.getDisplayName).
+ toList.sortWith(_.getDisplayName < _.getDisplayName).
map(lo => (lo.toString, lo.getDisplayName)),
Full(this.is), set) % ("id" -> fieldId))
}
@@ -104,15 +107,15 @@ object MappedTimeZone {
TimeZone.getAvailableIDs.toList.
filter(!_.startsWith("SystemV/")).
filter(!_.startsWith("Etc/")).filter(_.length > 3).
- sort(_ < _).map(tz => (tz, tz))
+ sortWith(_ < _).map(tz => (tz, tz))
}
abstract class MappedCountry[T <: Mapper[T]](owner: T) extends MappedEnum[T, Countries.type](owner, Countries) {
override def buildDisplayList: List[(Int, String)] = {
val collator = java.text.Collator.getInstance(S.locale)
- super.buildDisplayList.sort((s1, s2) =>
+ super.buildDisplayList.sortWith((s1, s2) =>
collator.compare(s1._2, s2._2) < 0)
}
@@ -153,6 +156,3 @@ abstract class MappedPostalCode[T <: Mapper[T]](owner: T, country: MappedCountry
case _ => genericCheck _ :: super.validations
}
}
-
-}
-}
View
12 persistence/mapper/src/main/scala/net/liftweb/mapper/OneToMany.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
+
/**
* Add this trait to a Mapper for managed one-to-many support
@@ -174,7 +175,7 @@ trait OneToMany[K,T<:KeyedMapper[K, T]] extends KeyedMapper[K,T] { this: T =>
def remove(n: Int) = {
val e = unown(delegate(n))
- delegate = delegate.remove(e eq)
+ delegate = delegate.filterNot(e eq)
e
}
@@ -314,6 +315,3 @@ trait LongMappedForeignMapper[T<:Mapper[T],O<:KeyedMapper[Long,O]]
if (obj eq Empty) List(FieldError(this, scala.xml.Text("Required field: " + name)))
else Nil
}
-
-}
-}
View
23 persistence/mapper/src/main/scala/net/liftweb/mapper/Schemifier.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
+package net.liftweb
+package mapper
-import _root_.java.sql.{Connection, ResultSet, DatabaseMetaData}
-import _root_.scala.collection.mutable.{HashMap, ListBuffer}
-import _root_.net.liftweb.common.{Full, Box, Loggable}
-import _root_.net.liftweb.util.Helpers
+import java.sql.{Connection, ResultSet, DatabaseMetaData}
+
+import collection.mutable.{HashMap, ListBuffer}
+
+import common.{Full, Box, Loggable}
+import util.Helpers
import Helpers._
/**
@@ -266,7 +268,7 @@ object Schemifier extends Loggable {
// val q = quad(rs)
// q.foreach{case (name, col, pos) => byColumn.get(col) match {case Some(li) => byColumn(col) = (name, col, pos) :: li case _ => byColumn(col) = List((name, col, pos))}}
q.foreach{case (name, col, pos) => byName.get(name) match {case Some(li) => byName(name) = col :: li case _ => byName(name) = List(col)}}
- val indexedFields: List[List[String]] = byName.map{case (name, value) => value.sort(_ < _)}.toList
+ val indexedFields: List[List[String]] = byName.map{case (name, value) => value.sortWith(_ < _)}.toList
//rs.close
val single = table.mappedFields.filter{f => f.dbIndexed_?}.toList.flatMap {
@@ -293,7 +295,7 @@ object Schemifier extends Loggable {
case _ => logger.error("Invalid index: " + index); ""
}
- val fn = columns.map(_.field._dbColumnNameLC.toLowerCase).sort(_ < _)
+ val fn = columns.map(_.field._dbColumnNameLC.toLowerCase).sortWith(_ < _)
if (!indexedFields.contains(fn)) {
cmds += maybeWrite(performWrite, logFunc, connection) {
() => createStatement
@@ -337,6 +339,3 @@ object Schemifier extends Loggable {
Collector(ret, cmds.toList)
}
}
-
-}
-}
View
32 persistence/mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,25 +14,23 @@
* limitations under the License.
*/
-package net.liftweb {
-package mapper {
-package view {
+package net.liftweb
+package mapper
+package view
-import net.liftweb.http.{SHtml, S, DispatchSnippet}
-import S.?
-import net.liftweb.util.BindPlus._
-import net.liftweb.util.{Helpers, BindHelpers}
-import net.liftweb.common.{Box, Full, Empty}
+import xml.{NodeSeq, Text}
+
+import common.{Box, Full, Empty}
+import util.BindPlus._
+import util.{Helpers, BindHelpers}
import Helpers._
+import http.{SHtml, S, DispatchSnippet}
+import S.?
-import net.liftweb.mapper.{Mapper,
- MetaMapper,
- LongKeyedMetaMapper,
- MappedField}
+import mapper.{Mapper, MetaMapper, LongKeyedMetaMapper, MappedField}
import Util._
-import scala.xml.{NodeSeq, Text}
/**
* Keeps track of pending adds to and removes from a list of mappers.
@@ -87,7 +85,7 @@ trait ItemsList[T <: Mapper[T]] {
case None =>
unsorted
case Some(field) =>
- unsorted.sort {
+ unsorted.sortWith {
(a, b) => ((field.actualField(a).is: Any, field.actualField(b).is: Any) match {
case (aval: String, bval: String) => aval.toLowerCase < bval.toLowerCase
case (aval: Ordered[Any], bval: Ordered[Any]) => aval < bval
@@ -311,7 +309,3 @@ trait ItemsListEditor[T<:Mapper[T]] {
}
}
-
-}
-}
-}
View
3 persistence/mongodb-record/src/test/scala/net/liftweb/mongodb/record/MongoRecordSpec.scala
@@ -26,7 +26,6 @@ import org.specs.Specification
import common._
import json._
-import http.js.JE._
import net.liftweb.record.field.Countries
@@ -48,7 +47,7 @@ object MongoRecordSpec extends Specification("MongoRecord Specification") with M
} yield flavor + typeName + "Field").toList
"introspect only the expected fields" in {
- rec.fields().map(_.name).sortWith(_ < _) must_== allExpectedFieldNames.sort(_ < _)
+ rec.fields().map(_.name).sortWith(_ < _) must_== allExpectedFieldNames.sortWith(_ < _)
}
"correctly look up fields by name" in {
View
35 persistence/record/src/main/scala/net/liftweb/record/field/EnumField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,20 +14,21 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
-
-import scala.reflect.Manifest
-import scala.xml._
-import net.liftweb.common._
-import net.liftweb.http.js._
-import net.liftweb.http.{S, SHtml}
-import net.liftweb.json.JsonAST.{JInt, JNothing, JNull, JString, JValue}
-import net.liftweb.util._
+package net.liftweb
+package record
+package field
+
+import reflect.Manifest
+import xml._
+
+import common._
import Box.option2Box
-import S._
+import json._
+import util._
import Helpers._
+import http.js._
+import http.{S, SHtml}
+import S._
import JE._
@@ -61,7 +62,7 @@ trait EnumTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Value]
* is the value of the field and the second string is the Text name of the Value.
*/
def buildDisplayList: List[(Box[EnumType#Value], String)] = {
- val options = enum.map(a => (Full(a), a.toString)).toList
+ val options = enum.values.map(a => (Full(a), a.toString)).toList
if (optional_?) (Empty, emptyOptionLabel)::options else options
}
@@ -74,7 +75,7 @@ trait EnumTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Value]
case _ => Full(elem)
}
- def defaultValue: EnumType#Value = enum.iterator.next
+ def defaultValue: EnumType#Value = enum.values.iterator.next
def asJs = valueBox.map(_ => Str(toString)) openOr JsNull
@@ -119,7 +120,3 @@ class OptionalEnumField[OwnerType <: Record[OwnerType], EnumType <: Enumeration]
def owner = rec
protected val valueManifest = m
}
-
-}
-}
-}
View
33 persistence/record/src/main/scala/net/liftweb/record/field/EnumNameField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,18 +14,19 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
-
-import scala.reflect.Manifest
-import scala.xml._
-import net.liftweb.common._
-import net.liftweb.http.js._
-import net.liftweb.http.{S, SHtml}
-import net.liftweb.json.JsonAST.{JInt, JNothing, JNull, JString, JValue}
-import net.liftweb.util._
+package net.liftweb
+package record
+package field
+
+import reflect.Manifest
+import xml._
+
+import common._
import Box.option2Box
+import json._
+import util._
+import http.js._
+import http.{S, SHtml}
import S._
import Helpers._
import JE._
@@ -50,7 +51,7 @@ trait EnumNameTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Va
* is the value of the field and the second string is the Text name of the Value.
*/
def buildDisplayList: List[(Box[EnumType#Value], String)] = {
- val options = enum.map(a => (Full(a), a.toString)).toList
+ val options = enum.values.map(a => (Full(a), a.toString)).toList
if (optional_?) (Empty, emptyOptionLabel)::options else options
}
@@ -62,7 +63,7 @@ trait EnumNameTypedField[EnumType <: Enumeration] extends TypedField[EnumType#Va
case _ => Full(elem)
}
- def defaultValue: EnumType#Value = enum.iterator.next
+ def defaultValue: EnumType#Value = enum.values.iterator.next
def asJs = valueBox.map(_ => Str(toString)) openOr JsNull
@@ -100,7 +101,3 @@ class OptionalEnumNameField[OwnerType <: Record[OwnerType], EnumType <: Enumerat
def owner = rec
protected val valueManifest = m
}
-
-}
-}
-}
View
28 persistence/record/src/main/scala/net/liftweb/record/field/LocaleField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,22 +14,24 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
+package net.liftweb
+package record
+package field
-import _root_.scala.xml._
-import _root_.net.liftweb.util._
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.http.{S, SHtml}
-import _root_.java.util.{Locale}
-import S._
+import java.util.{Locale}
+import xml._
+
+import common._
+import util._
import Helpers._
+import http.{S, SHtml}
+import S._
+
object LocaleField {
lazy val localeList = Locale
.getAvailableLocales.toList
- .sort(_.getDisplayName < _.getDisplayName)
+ .sortWith(_.getDisplayName < _.getDisplayName)
.map(lo => (lo.toString, lo.getDisplayName))
}
@@ -69,7 +71,3 @@ class OptionalLocaleField[OwnerType <: Record[OwnerType]](rec: OwnerType)
def buildDisplayList: List[(String, String)] = ("", emptyOptionLabel)::LocaleField.localeList
}
-
-}
-}
-}
View
33 persistence/record/src/main/scala/net/liftweb/record/field/PasswordField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
-
-import _root_.scala.xml._
-import _root_.net.liftweb.common._
-import _root_.net.liftweb.http.{S}
-import _root_.net.liftweb.http.js._
-import _root_.net.liftweb.json.JsonAST.{JNothing, JNull, JString, JValue}
-import _root_.net.liftweb.mapper.{Safe}
-import _root_.net.liftweb.util._
-import _root_.java.util.regex._
+package net.liftweb
+package record
+package field
+
+import xml._
+
+import common._
+import json._
+import util._
import Helpers._
+import http.S
+import http.js._
import S._
import JE._
+import mapper.Safe
+
object PasswordField {
@volatile var blankPw = "*******"
@@ -44,7 +45,7 @@ trait PasswordTypedField extends TypedField[String] {
private var validatedValue: Box[String] = valueBox
def match_?(toTest: String): Boolean =
- is == hash("{"+toTest+"} salt={"+salt_i.get+"}")
+ get == hash("{"+toTest+"} salt={"+salt_i.get+"}")
override def set_!(in: Box[String]): Box[String] = {
validatedValue = in
@@ -123,7 +124,3 @@ class OptionalPasswordField[OwnerType <: Record[OwnerType]](rec: OwnerType)
def owner = rec
}
-
-}
-}
-}
View
33 persistence/record/src/main/scala/net/liftweb/record/field/StringField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,28 +14,29 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
-
-import scala.xml._
-import net.liftweb.common._
-import net.liftweb.http.js._
-import net.liftweb.http.{S}
-import net.liftweb.json.JsonAST.{JNothing, JNull, JString, JValue}
-import net.liftweb.util._
-import _root_.java.util.regex._
-import S._
+package net.liftweb
+package record
+package field
+
+import xml._
+
+import common._
+import json._
+import util._
import Helpers._
+import http.js._
+import http.S
+import S._
import JE._
+
trait StringTypedField extends TypedField[String] with StringValidators {
val maxLength: Int
def maxLen = maxLength
def setFromAny(in: Any): Box[String] = in match {
- case seq: Seq[_] if !seq.isEmpty => setFromAny(seq.first)
+ case seq: Seq[_] if !seq.isEmpty => setFromAny(seq.head)
case _ => genericSetFromAny(in)
}
@@ -115,7 +116,3 @@ class OptionalStringField[OwnerType <: Record[OwnerType]](rec: OwnerType, val ma
protected def valueTypeToBoxString(in: ValueType): Box[String] = toBoxMyType(in)
protected def boxStrToValType(in: Box[String]): ValueType = toValueType(in)
}
-
-}
-}
-}
View
28 persistence/record/src/main/scala/net/liftweb/record/field/TimeZoneField.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,23 +14,25 @@
* limitations under the License.
*/
-package net.liftweb {
-package record {
-package field {
+package net.liftweb
+package record
+package field
-import scala.xml._
-import net.liftweb.util._
-import net.liftweb.common._
-import net.liftweb.http.{S, SHtml}
-import _root_.java.util.TimeZone
-import S._
+import java.util.TimeZone
+import xml._
+
+import common._
+import util._
import Helpers._
+import http.{S, SHtml}
+import S._
+
object TimeZoneField {
lazy val timeZoneList: List[(String, String)] = TimeZone.getAvailableIDs.toList.
filter(!_.startsWith("SystemV/")).
filter(!_.startsWith("Etc/")).filter(_.length > 3).
- sort(_ < _).map(tz => (tz, tz))
+ sortWith(_ < _).map(tz => (tz, tz))
}
trait TimeZoneTypedField extends StringTypedField {
@@ -63,7 +65,3 @@ class TimeZoneField[OwnerType <: Record[OwnerType]](rec: OwnerType)
class OptionalTimeZoneField[OwnerType <: Record[OwnerType]](rec: OwnerType)
extends OptionalStringField(rec, 32) with TimeZoneTypedField
-
-}
-}
-}
View
5 web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
@@ -30,7 +30,6 @@ import JsCmds._
import auth._
import scala.xml._
-import scala.collection.mutable.{ListBuffer}
import java.util.{Locale, TimeZone, ResourceBundle, Date}
import java.io.{InputStream, ByteArrayOutputStream, BufferedReader, StringReader}
import java.util.concurrent.{ConcurrentHashMap => CHash}
@@ -1586,7 +1585,7 @@ trait LiftRules extends Factory with FormVendor with LazyLoggable {
sealed trait NotFound
-final case object DefaultNotFound extends NotFound
+case object DefaultNotFound extends NotFound
final case class NotFoundAsResponse(response: LiftResponse) extends NotFound
@@ -1692,7 +1691,7 @@ class RulesSeq[T] {
private[http] def remove(f: T => Boolean) {
safe_? {
- rules = rules.remove(f)
+ rules = rules.filterNot(f)
}
}
View
28 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
@@ -17,15 +17,15 @@
package net.liftweb
package http
-import js._
-import JsCmds._
+import xml._
+import reflect.Manifest
-import net.liftweb.common._
-import net.liftweb.util._
+import common._
+import util._
import Helpers._
+import js._
+import JsCmds._
-import scala.xml._
-import scala.reflect.Manifest
/**
* The trait that forms the basis for LiftScreen and the
@@ -126,7 +126,7 @@ trait AbstractScreen extends Factory {
}
protected sealed trait OtherValueInitializer[T]
- protected final case object NothingOtherValueInitializer extends OtherValueInitializer[Nothing]
+ protected case object NothingOtherValueInitializer extends OtherValueInitializer[Nothing]
protected final case class OtherValueInitializerImpl[T](f: () => T) extends OtherValueInitializer[T]
/**
@@ -140,7 +140,7 @@ trait AbstractScreen extends Factory {
trait Field extends ConfirmField {
type OtherValueType // >: Nothing
- AbstractScreen.this._register(() => this)
+ AbstractScreen.this.addFields(() => this)
private val _currentValue: NonCleanAnyVar[ValueType] =
vendAVar[ValueType](setFilter.foldLeft(default)((nv, f) => f(nv)))
@@ -324,21 +324,21 @@ trait AbstractScreen extends Factory {
* Override the screen default for fields appearing on the confirm
* screen and force this field to appear on the confirm screen
*/
- protected final case object OnConfirmScreen extends FilterOrValidate[Nothing]
+ protected case object OnConfirmScreen extends FilterOrValidate[Nothing]
/**
* Override the screen default for fields appearing on the confirm
* screen and force this field not to appear on the confirm screen
*/
- protected final case object NotOnConfirmScreen extends FilterOrValidate[Nothing]
+ protected case object NotOnConfirmScreen extends FilterOrValidate[Nothing]
protected final case class FormParam(fp: SHtml.ElemAttr) extends FilterOrValidate[Nothing]
protected final case class FormFieldId(id: String) extends FilterOrValidate[Nothing]
- protected final case class AFilter[T](val f: T => T) extends FilterOrValidate[T]
- protected final case class AVal[T](val v: T => List[FieldError]) extends FilterOrValidate[T]
+ protected final case class AFilter[T](f: T => T) extends FilterOrValidate[T]
+ protected final case class AVal[T](v: T => List[FieldError]) extends FilterOrValidate[T]
protected def field[T](underlying: => BaseField{type ValueType=T},
stuff: FilterOrValidate[T]*)(implicit man: Manifest[T]): Field{type ValueType=T} = {
@@ -409,7 +409,7 @@ trait AbstractScreen extends Factory {
* A little hack because => BaseField and => Box[BaseField]
* have the same method signature
*/
- protected final implicit object BoxMarkerObj extends BoxMarker
+ protected implicit object BoxMarkerObj extends BoxMarker
protected def field[T](underlying: => Box[BaseField{type ValueType=T}],
stuff: FilterOrValidate[T]*)(implicit man: Manifest[T], marker: BoxMarker): Field{type ValueType=T} = {
@@ -836,7 +836,7 @@ trait ScreenWizardRendered {
myNotices match {
case Nil => bind("wizard", in, AttrBindParam("for", curId, "for"), "bind" -%> f.text)
case _ =>
- val maxN = myNotices.map(_._1).sort{_.id > _.id}.head // get the maximum type of notice (Error > Warning > Notice)
+ val maxN = myNotices.map(_._1).sortWith{_.id > _.id}.head // get the maximum type of notice (Error > Warning > Notice)
val metaData: MetaData = noticeTypeToAttr(theScreen).map(_(maxN)) openOr Null
bind("wizard", in, AttrBindParam("for", curId, "for"), "bind" -%> f.text).map {
case e: Elem => e % metaData
View
25 web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala
@@ -17,23 +17,16 @@
package net.liftweb
package http
-import java.net.URLDecoder
-import scala.xml.{Node, NodeSeq, Group, Elem, MetaData, Null, XML, Comment, Text}
-import scala.collection.immutable.HashMap
-import scala.xml.transform._
-import net.liftweb.common._
-import net.liftweb.util.Helpers._
-import net.liftweb.util._
-import net.liftweb.util.Helpers
-import net.liftweb.util.ActorPing
-import java.util.{Locale, ResourceBundle}
-import java.net.URL
+import xml.{Node, NodeSeq, Group}
+
+import common._
+import actor._
+import util._
+import util.Helpers._
import js._
import auth._
import provider._
-import net.liftweb.actor._
-
class LiftServlet extends Loggable {
private var servletContext: HTTPContext = null
@@ -58,7 +51,7 @@ class LiftServlet extends Loggable {
Thread.sleep(20)
}
- tryo{ActorPing.shutdown}
+ tryo{Schedule.shutdown}
tryo{LAScheduler.shutdown()}
LiftRules.runUnloadHooks()
@@ -87,7 +80,7 @@ class LiftServlet extends Loggable {
val req = if (null eq reqOrg) reqOrg else reqOrg.snapshot
def runFunction(doAnswer: LiftResponse => Unit) {
- ActorPing.schedule(() => {
+ Schedule.schedule(() => {
val answerFunc: (=> LiftResponse) => Unit = response =>
doAnswer(wrapState(req, session)(response))
@@ -99,7 +92,7 @@ class LiftServlet extends Loggable {
if (reqOrg.request.suspendResumeSupport_?) {
runFunction(liftResponse => {
// do the actual write on a separate thread
- ActorPing.schedule(() => {
+ Schedule.schedule(() => {
reqOrg.request.resume(reqOrg, liftResponse)
}, 0 seconds)
})
View
45 web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
@@ -17,23 +17,24 @@
package net.liftweb
package http
-import scala.collection.mutable.{HashMap, ArrayBuffer, ListBuffer}
-import scala.xml._
+import java.io.InputStream
+import java.lang.reflect.{Method, Modifier, InvocationTargetException}
+import java.util.concurrent.TimeUnit
+import java.util.Locale
+
+import collection.mutable.{HashMap, ArrayBuffer, ListBuffer}
+import reflect.Manifest
+import xml._
+
import common._
-import util._
+import Box._
import actor._
+import util._
+import Helpers._
import http.js.{JsCmd, AjaxInfo}
-import util.Helpers._
import builtin.snippet._
-import java.lang.reflect.{Method, Modifier, InvocationTargetException}
-import scala.xml._
-import java.io.InputStream
-import java.util.concurrent.TimeUnit
-import java.util.Locale
import js._
-import scala.reflect.Manifest
import provider._
-import Box._
object LiftSession {
@@ -218,7 +219,7 @@ object SessionMaster extends LiftActor with Loggable {
((ses: Map[String, SessionInfo], destroyer: SessionInfo => Unit) => {
val now = millis
- for ((id, info @ SessionInfo(session, _, _, _, _)) <- ses.elements) {
+ for ((id, info @ SessionInfo(session, _, _, _, _)) <- ses.iterator) {
if (now - session.lastServiceTime > session.inactivityLength || session.markedForTermination) {
logger.info(" Session " + id + " expired")
destroyer(info)
@@ -329,7 +330,7 @@ object SessionMaster extends LiftActor with Loggable {
ses.get(sessionId).foreach {
case SessionInfo(s, _, _, _, _) =>
s.markedForShutDown_? = true
- ActorPing.schedule(() => {
+ Schedule.schedule(() => {
try {
s.doShutDown
try {
@@ -359,7 +360,7 @@ object SessionMaster extends LiftActor with Loggable {
}
})
} else {
- ActorPing.schedule(() => f(ses,
+ Schedule.schedule(() => f(ses,
shutDown => {
if (!shutDown.session.markedForShutDown_?) {
shutDown.session.
@@ -394,7 +395,7 @@ object SessionMaster extends LiftActor with Loggable {
private def doPing() {
if (!Props.inGAE) {
try {
- ActorPing schedule (this, CheckAndPurge, 10 seconds)
+ Schedule.schedule (this, CheckAndPurge, 10 seconds)
} catch {
case e: Exception => logger.error("Couldn't start SessionMaster ping", e)
}
@@ -612,7 +613,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
}
private[http] def cometForHost(hostAndPath: String): List[(AnyActor, Req)] =
- synchronized {cometList}.filter{
+ synchronized {cometList}.filter {
case (_, r) => r.hostAndPath == hostAndPath
}
@@ -621,7 +622,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
}
private[http] def exitComet(what: AnyActor): Unit = synchronized {
- cometList = cometList.remove(_._1 eq what)
+ cometList = cometList.filterNot(_._1 eq what)
}
private case class RunnerHolder(name: String, func: S.AFuncHolder, owner: Box[String])
@@ -645,7 +646,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
// get all the commands, sorted by owner,
(state.uploadedFiles.map(_.name) ::: state.paramNames).distinct.
flatMap {n => synchronized {messageCallback.get(n)}.map(mcb => RunnerHolder(n, mcb, mcb.owner))}.
- sort {
+ sortWith {
case (RunnerHolder(_, _, Full(a)), RunnerHolder(_, _, Full(b))) if a < b => true
case (RunnerHolder(_, _, Full(a)), RunnerHolder(_, _, Full(b))) if a > b => false
case (RunnerHolder(an, _, Full(a)), RunnerHolder(bn, _, Full(b))) if a == b => an < bn
@@ -1461,7 +1462,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
first(LiftRules.snippetNamesToSearch.vend(tagName)) { nameToTry =>
val ret = findSnippetInstance(nameToTry)
// Update the snippetMap so that we reuse the same instance in this request
- ret.foreach(s => snippetMap.set(snippetMap.is.update(tagName, s)))
+ ret.foreach(s => snippetMap.set(snippetMap.is.updated(tagName, s)))
ret
}
}
@@ -1564,8 +1565,8 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
case it =>
val intersection = if (Props.devMode) {
val methodNames = inst.getClass.getMethods().map(_.getName).toList.distinct
- val methodAlts = List(method, Helpers.camelCase(method),
- Helpers.camelCaseMethod(method))
+ val methodAlts = List(method, Helpers.camelify(method),
+ Helpers.camelifyMethod(method))
methodNames intersect methodAlts
} else Nil
@@ -1612,7 +1613,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
def checkAttr(attr_name: String, in: MetaData, base: MetaData): MetaData =
in.filter(_.key == attr_name).toList match {
case Nil => base
- case x => new UnprefixedAttribute(attr_name, Text(x.first.value.text),
+ case x => new UnprefixedAttribute(attr_name, Text(x.head.value.text),
base)
}
View
12 web/webkit/src/main/scala/net/liftweb/http/Paginator.scala
@@ -15,11 +15,12 @@
*/
package net.liftweb
package http
-
-import scala.xml.{NodeSeq,Text,Elem}
-import net.liftweb.common.Loggable
-import net.liftweb.util.Helpers._
-import S.{?,??}
+
+import xml.{NodeSeq, Text}
+
+import common.Loggable
+import util.Helpers._
+import S.{?, ??}
/**
@@ -309,4 +310,3 @@ trait StatefulSortedPaginatorSnippet[T, C] extends SortedPaginatorSnippet[T, C]
appendParams(super.sortedPageUrl(offset,sort), List(name -> "_"))
}
}
-
View
23 web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -17,20 +17,19 @@
package net.liftweb
package http
-import scala.collection.mutable.{HashMap, ListBuffer}
-import scala.xml._
-import scala.collection.immutable.{ListMap, TreeMap}
+import java.util.{Locale, TimeZone, ResourceBundle}
+
+import collection.mutable.{HashMap, ListBuffer}
+import xml._
+
import common._
import actor.LAFuture
import util._
import Helpers._
import js._
-import java.util.{Locale, TimeZone, ResourceBundle}
-import java.util.concurrent.atomic.AtomicLong
+
import builtin.snippet._
import provider._
-import scala.reflect.Manifest
-import java.util.concurrent.{ConcurrentHashMap => CHash}
import http.rest.RestContinuation
class SJBridge {
@@ -1246,7 +1245,7 @@ for {
case si: StatefulSnippet => si.addName(cls) // addresses
case _ =>
}
- _statefulSnip.set(_statefulSnip.is.update(cls, inst))
+ _statefulSnip.set(_statefulSnip.is.updated(cls, inst))
}
}
@@ -1259,7 +1258,7 @@ for {
case si: StatefulSnippet => si.addName(cls) // addresses
case _ =>
}
- _statefulSnip.set(_statefulSnip.is.update(cls, inst))
+ _statefulSnip.set(_statefulSnip.is.updated(cls, inst))
}
private[http] def unsetSnippetForClass(cls: String): Unit =
@@ -1393,7 +1392,7 @@ for {
def getHeaders(in: List[(String, String)]): List[(String, String)] = {
Box.legacyNullTest(_responseHeaders.value).map(
rh =>
- rh.headers.elements.toList :::
+ rh.headers.iterator.toList :::
in.filter {case (n, v) => !rh.headers.contains(n)}
).openOr(Nil)
}
@@ -2134,7 +2133,7 @@ for {
*/
def functionMap: Map[String, AFuncHolder] = {
Box.legacyNullTest(_functionMap.value).
- map(s => Map(s.elements.toList: _*)).openOr(Map.empty)
+ map(s => Map(s.iterator.toList: _*)).openOr(Map.empty)
}
private def testFunctionMap[T](f: T): T =
@@ -2227,7 +2226,7 @@ for {
* @param name The name of the snippet that you want to map (the part after "&lt;lift:").
* @param func The snippet function to map to.
*/
- def mapSnippet(name: String, func: NodeSeq => NodeSeq) {_snippetMap.set(_snippetMap.is.update(name, func))}
+ def mapSnippet(name: String, func: NodeSeq => NodeSeq) {_snippetMap.set(_snippetMap.is.updated(name, func))}
/**
* The are times when it's helpful to define snippets for a certain
View
2 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
@@ -1870,7 +1870,7 @@ trait SHtml {
/** Holds a series of choices: HTML for input controls alongside some user defined value */
final case class ChoiceHolder[T](items: Seq[ChoiceItem[T]]) {
/** Retrieve the ChoiceItem that has the given key, throwing NoSuchElementException if there is no matching ChoiceItem */
- def apply(in: T): NodeSeq = items.filter(_.key == in).first.xhtml
+ def apply(in: T): NodeSeq = items.filter(_.key == in).head.xhtml
/** Retrieve the nth ChoiceItem, 0-based */
def apply(in: Int): NodeSeq = items(in).xhtml
View
6 web/webkit/src/main/scala/net/liftweb/http/TemplateFinder.scala
@@ -107,15 +107,15 @@ object TemplateFinder {
case _ =>
val pls = places.mkString("/", "/", "")
- val se = suffixes.elements
+ val se = suffixes.iterator
val sl = List("_" + locale.toString, "_" + locale.getLanguage, "")
var found = false
var ret: NodeSeq = null
while (!found && se.hasNext) {
val s = se.next
- val le = sl.elements
+ val le = sl.iterator
while (!found && le.hasNext) {
val p = le.next
val name = pls + p + (if (s.length > 0) "." + s else "")
@@ -168,7 +168,7 @@ object TemplateFinder {
case ctl :: _ => (ctl, "index")
case Nil => ("default_template", "index")
}
- val trans = List[String => String](n => n, n => camelCase(n))
+ val trans = List[String => String](n => n, n => camelify(n))
val toTry = trans.flatMap(f => (LiftRules.buildPackage("view") ::: ("lift.app.view" :: Nil)).map(_ + "." + f(controller)))
first(toTry) {
View
2 web/webkit/src/main/scala/net/liftweb/http/auth/HttpAuthentication.scala
@@ -110,7 +110,7 @@ case class HttpDigestAuthentication(realmName: String)(func: PartialFunction[(St
private[auth] def doPing() {
try {
- ActorPing schedule (this, CheckAndPurge, 5 seconds)
+ Schedule.schedule (this, CheckAndPurge, 5 seconds)
} catch {
case e => logger.error("Couldn't start NonceWatcher ping", e)
}
View
17 web/webkit/src/main/scala/net/liftweb/sitemap/XmlMenu.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package net.liftweb {
-package sitemap {
+package net.liftweb
+package sitemap
import scala.xml.NodeSeq
-import Loc._
+
/**
* The beginning of an experiment to provide a capability to define
@@ -32,14 +32,11 @@ import Loc._
* @author nafg
*/
object XmlMenu {
- def apply(xml: scala.xml.NodeSeq): Seq[Menu] = for(node<-xml) yield node match {
+ def apply(xml: NodeSeq): Seq[Menu] = for(node<-xml) yield node match {
case m @ <menu>{ children @ _* }</menu> =>
val name = m \ "@name" text
- val text = scala.xml.NodeSeq.fromSeq((m \ "text" elements) flatMap {_.child.elements} toSeq)
- val link = net.liftweb.util.JSONParser.parse(m \ "link" text).get.asInstanceOf[List[Any]].map(_.asInstanceOf[String])
+ val text = NodeSeq.fromSeq((m \ "text" iterator) flatMap {_.child.iterator} toSeq)
+ val link = util.JSONParser.parse(m \ "link" text).get.asInstanceOf[List[Any]].map(_.asInstanceOf[String])
Menu(Loc(name, link, text), apply(m \ "menu") : _*)
}
}
-
-}
-}

0 comments on commit cda5a9e

Please sign in to comment.