tags:

views:

47

answers:

2

Greetings

I'm using the scala version 2.8.0 and version 2.1 of lift to compile my project with maven I mark the following error:

error: type mismatch;

[INFO]  required: **scala.actors.Actor**
[INFO]     Auctioneer !? AddListener(**this**, this.itemId) match {
[INFO]                               ^

error: type mismatch;

[INFO]  required: **scala.actors.Actor**
[INFO]     Auctioneer ! RemoveListener(**this**, this.itemId)
[INFO]                                 ^

the file is:

package org.developerworks.comet

import net.liftweb.http._
import net.liftweb.common.Full
import net.liftweb.http.S._
import net.liftweb.http.SHtml._
import net.liftweb.http.js.JsCmd
import net.liftweb.http.js.JsCmds._
import net.liftweb.http.js.JE._
import net.liftweb.util.Helpers._
import net.liftweb.util._
import scala.xml.NodeSeq
import org.developerworks.model._
import org.developerworks.actor._
import java.lang.Long


class AuctionActor extends CometActor {


  var highBid : TheCurrentHighBid = null

  override def defaultPrefix = Full("auction")

  val itemId = S.param("itemId").map(Long.parseLong(_)).openOr(0L)


  def render = {

    def itemView: NodeSeq = {

      val item = if (itemId > 0) 
        ItemMetaData.findByKey(itemId).openOr(ItemMetaData.create)
      else ItemMetaData.create
      val currBid = item.highBid
      val bidAmt = if (currBid.user.isEmpty) 0L else currBid.amount.is
      highBid = TheCurrentHighBid(bidAmt, currBid.user.obj.openOr(User.currentUser.open_!))
      val minNewBid = highBid.amount + 1L
      val button = <button type="button">{S.?("Bid Now!")}</button> %
      ("onclick" -> ajaxCall(JsRaw("$('#newBid').attr('value')"), bid _))
      (<div>
          <strong>{item.name}</strong>
          <br/>
          <div>
            Current Bid: ${highBid.amount} by {highBid.user.niceName}
          </div>
          <div>
            New Bid (min: ${minNewBid}) :
            <input type="text" id="newBid"/>
            {button}
          </div>
          {item.description}<br/>
       </div>)
    }

    bind("foo" -> <div>{itemView}</div>)

  }


  def bid(s:String): JsCmd = {

    val user = User.currentUser.open_!
    Auctioneer ! BidOnItem(itemId, Long.parseLong(s), user)
    Noop

  }


  override def localSetup {

    Auctioneer !? AddListener(this, this.itemId) match {

      case Success(true) => println("Listener added")
      case _ => println("Other ls")

    }

  }


  override def localShutdown {

    Auctioneer ! RemoveListener(this, this.itemId)

  }


  override def lowPriority : PartialFunction[Any, Unit] = {

    case TheCurrentHighBid(a,u) => {
        highBid = TheCurrentHighBid(a,u)
        reRender(false)
      }
    case _ => println("Other lp")

  }


}

anyone can tell me I'm missing or am I doing wrong

I had compiled this project in version 2.7.3 and had no problems

help please!!!

+2  A: 

Lift's Actors are no longer Scala Actors. There may be a way for them to interoperate, but I'd suggest first trying to change all your actors so that they're Lift Actors.

Alex Cruise
A: 

You can use Scala Actors and Lift Actors in the same project, but you cannot substitute them for one another. They use completely different implementations of the Actor system, so they cannot as far as I know send messages to each other.

In Lift projects I will typically use LiftActors for my singleton, named actors that will receive messages sent to it explicitly. For ease of readability, I'll use Scala actors for backgrounding tasks like logging writes to the database:

actor { mapper.save }
Collin