Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mark vals 'lazy' in traits to disambiguate initialization order, more…

… cleanups
  • Loading branch information...
commit 11fe8b87bb24fc5cd915860d37c8c69f02c48f78 1 parent 7d8e9f8
@indrajitr indrajitr authored
View
37 jta/src/main/scala/net/liftweb/transaction/EntityManagerSynchronization.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,38 +14,14 @@
* limitations under the License.
*/
-package net.liftweb {
-package transaction {
+package net.liftweb
+package transaction
import net.liftweb.common.Loggable
-import _root_.javax.naming.{NamingException, Context, InitialContext}
-import _root_.javax.transaction.{
- Transaction,
- UserTransaction,
- TransactionManager,
- Status,
- Synchronization,
- RollbackException,
- SystemException,
- TransactionRequiredException
-}
-import _root_.javax.persistence.{
- EntityManager,
- EntityManagerFactory,
- NonUniqueResultException,
- NoResultException
-}
+import javax.transaction.{ TransactionManager, Status, Synchronization, SystemException}
+import javax.persistence.EntityManager
-import com.atomikos.icatch.jta.{
- J2eeTransactionManager,
- J2eeUserTransaction
-}
-import com.atomikos.icatch.config.{
- TSInitInfo,
- UserTransactionService,
- UserTransactionServiceImp
-}
/**
* EntityManager JTA synchronization class.
@@ -86,6 +62,3 @@ class EntityManagerSynchronization(
}
}
}
-
-}
-}
View
21 jta/src/main/scala/net/liftweb/transaction/TransactionContext.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,13 +14,17 @@
* limitations under the License.
*/
-package net.liftweb {
-package transaction {
+package net.liftweb
+package transaction
+
+import javax.persistence.EntityManager
+import javax.transaction.{Transaction, Status, TransactionManager}
+
+import org.scala_libs.jpa.{ScalaEntityManager, ScalaEMFactory}
+
+import common.Loggable
+
-import _root_.javax.persistence.{EntityManager, EntityManagerFactory}
-import _root_.javax.transaction.{Transaction, Status, TransactionManager}
-import _root_.net.liftweb.common.Loggable
-import _root_.org.scala_libs.jpa.{ScalaEntityManager, ScalaEMFactory}
/**
* Base monad for the transaction monad implementations.
*
@@ -228,6 +232,3 @@ class TransactionContext(private implicit val transactionService: TransactionSer
def openEM: javax.persistence.EntityManager = em
def closeEM(e: javax.persistence.EntityManager) = closeEntityManager
}
-
-}
-}
View
35 jta/src/main/scala/net/liftweb/transaction/TransactionService.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,30 +14,14 @@
* limitations under the License.
*/
-package net.liftweb {
-package transaction {
+package net.liftweb
+package transaction
-import _root_.javax.naming.{NamingException, Context, InitialContext}
-import _root_.javax.transaction.{
- Transaction,
- UserTransaction,
- TransactionManager,
- Status,
- Synchronization,
- RollbackException,
- SystemException,
- TransactionRequiredException
-}
-import _root_.javax.persistence.{
- Persistence,
- EntityManager,
- EntityManagerFactory,
- NonUniqueResultException,
- NoResultException
-}
+import javax.transaction.{Transaction, TransactionManager, Status, SystemException, TransactionRequiredException}
+import javax.persistence.{Persistence, EntityManagerFactory, NonUniqueResultException, NoResultException}
+
+import common.Logger
-import net.liftweb.common.{Loggable, Logger}
-import org.scala_libs.jpa.{ScalaEMFactory, ScalaEntityManager}
/**
* JTA Transaction service.
@@ -56,7 +40,7 @@ trait TransactionService {
*/
trait EntityManagerService {
// TODO: make configurable?
- val JPA_PERSISTENT_UNIT = "LiftPersistenceUnit"
+ lazy val JPA_PERSISTENT_UNIT = "LiftPersistenceUnit"
lazy val entityManagerFactory = Persistence.createEntityManagerFactory(JPA_PERSISTENT_UNIT)
}
@@ -253,6 +237,3 @@ trait TransactionProtocol {
else None
}
}
-
-}
-}
View
8 machine/src/main/scala/net/liftweb/machine/ProtoStateMachine.scala
@@ -29,9 +29,9 @@ import mapper._
/**
* This trait manages state/workflow transition
*/
-trait ProtoStateMachine[MyType <: ProtoStateMachine[MyType, StateType],
- StateType <: Enumeration] extends KeyedMapper[Long, MyType]
-{
+trait ProtoStateMachine[MyType <: ProtoStateMachine[MyType, StateType], StateType <: Enumeration]
+ extends KeyedMapper[Long, MyType] {
+
self: MyType =>
/**
@@ -346,7 +346,7 @@ trait MetaProtoStateMachine [MyType <: ProtoStateMachine[MyType, StateType],
case object Ping
}
-
+
private class TimedEventHandler(val metaOwner: Meta) extends LiftActor with Loggable {
protected def messageHandler =
{
View
21 oauth/src/main/scala/net/liftweb/oauth/OAuthValidator.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 WorldWide Conferencing, LLC
+ * Copyright 2010-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,18 @@
* limitations under the License.
*/
-package net.liftweb {
-package oauth {
+package net.liftweb
+package oauth
-import net.liftweb.common.Full
-import net.liftweb.util._
-import net.liftweb.common._
+import common._
+import util._
import Helpers._
+
trait OAuthValidator {
- val MIN_VERSION = 1.0
- val MAX_VERSION = 1.0
- val MAX_TIMESTAMP_AGE_MSEC = 5 * 60 * 1000
+ lazy val MIN_VERSION = 1.0
+ lazy val MAX_VERSION = 1.0
+ lazy val MAX_TIMESTAMP_AGE_MSEC = 5 * 60 * 1000
val SINGLE_PARAMETERS = Set(OAuthUtil.OAUTH_CONSUMER_KEY, OAuthUtil.OAUTH_TOKEN, OAuthUtil.OAUTH_TOKEN_SECRET,
OAuthUtil.OAUTH_CALLBACK, OAuthUtil.OAUTH_SIGNATURE_METHOD, OAuthUtil.OAUTH_SIGNATURE,
@@ -119,6 +119,3 @@ trait OAuthValidator {
} yield msg
}
-
-}
-}
View
6 paypal/src/main/scala/net/liftweb/paypal/Paypal.scala
@@ -422,7 +422,7 @@ private[paypal] class PaypalIPNPostbackReponse(val response: List[String]) exten
}
object SimplePaypal extends PaypalIPN with PaypalPDT with Loggable {
- val paypalAuthToken = "123"
+ lazy val paypalAuthToken = "123"
def actions = {
case (status, info, resp) =>
logger.info("Got a verified PayPal IPN: "+status)
@@ -534,7 +534,7 @@ trait PaypalIPN extends BasePaypalTrait {
/**
* How many times do we try to verify the request
*/
- val MaxRetry = 6
+ lazy val MaxRetry = 6
protected object requestQueue extends LiftActor {
protected def messageHandler =
@@ -556,7 +556,7 @@ trait PaypalIPN extends BasePaypalTrait {
}
} match {
case Full(Full(true)) => // it succeeded
- case _ => // retry
+ case _ => // retry
this ! IPNRequest(r, cnt + 1, millis + (1000 * 8 << (cnt + 2)))
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.