Author: dpp
Date: Fri May 22 04:34:34 2009
New Revision: 777364
URL: http://svn.apache.org/viewvc?rev=777364&view=rev
Log:
Migrated Action view to view-based code
Added:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
incubator/esme/trunk/server/src/main/webapp/action_view/
incubator/esme/trunk/server/src/main/webapp/action_view/index.html
Modified:
incubator/esme/trunk/server/pom.xml
incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/Distributor.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/MsgParser.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/User.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/snippet/UserSnip.scala
incubator/esme/trunk/server/src/main/scala/org/apache/esme/view/ActionView.scala
incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
incubator/esme/trunk/server/src/main/webapp/templates-hidden/login.html
incubator/esme/trunk/server/src/test/scala/RunWebApp.scala
incubator/esme/trunk/server/src/test/scala/org/apache/esme/lib/MsgParseTest.scala
Modified: incubator/esme/trunk/server/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/pom.xml?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/pom.xml (original)
+++ incubator/esme/trunk/server/pom.xml Fri May 22 04:34:34 2009
@@ -3,13 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.esme</groupId>
<artifactId>esme-server</artifactId>
- <version>0.2.3-SNAPSHOT</version>
+ <version>0.3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>ESME</name>
<inceptionYear>2008</inceptionYear>
<properties>
- <lift.version>1.0</lift.version>
- <scala.version>2.7.3</scala.version>
+ <lift.version>1.1-SNAPSHOT</lift.version>
+ <scala.version>2.7.4</scala.version>
<compass.version>2.1.1</compass.version>
<lucene.version>2.4.0</lucene.version>
<netbeans.hint.deploy.server>gfv3</netbeans.hint.deploy.server>
@@ -187,9 +187,9 @@
<version>${lucene.version}</version>
</dependency>
<dependency>
- <groupId>org.specs</groupId>
+ <groupId>org.scala-tools.testing</groupId>
<artifactId>specs</artifactId>
- <version>1.3.1</version>
+ <version>1.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
Modified:
incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
(original)
+++ incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala Fri
May 22 04:34:34 2009
@@ -2,7 +2,7 @@
/**
* Copyright 2008-2009 WorldWide Conferencing, LLC
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -47,43 +47,46 @@
*/
class Boot {
def boot {
+ // do this before any messages are sent or there's hell to pay
+ ActorSchedulerFixer.doActorSchedulerFix()
+
DefaultConnectionIdentifier.jndiName = Props.get("jndi.name") openOr "esme"
-
+
if (!DB.jndiJdbcConnAvailable_?)
DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
// where to search snippet
LiftRules.addToPackages("org.apache.esme")
-
+
if (Props.mode == Props.RunModes.Test) {
Schemifier.destroyTables_!!(Log.infoF _, User, ExtSession,
Message, Mailbox, Tag,
- Group, Relationship, MessageTag,
+ Group, Relationship, MessageTag,
AuthToken, UrlStore, Tracking,
Action, DidPerform)
}
-
+
Schemifier.schemify(true, Log.infoF _, User, ExtSession, Message,
Mailbox, Tag,
- Group, Relationship, MessageTag, AuthToken,
+ Group, Relationship, MessageTag, AuthToken,
UrlStore, Tracking, Action, DidPerform)
-
+
LiftRules.statelessDispatchTable.append {
- case r @ Req("api" :: "send_msg" :: Nil, "", PostRequest)
- if r.param("token").isDefined =>
+ case r @ Req("api" :: "send_msg" :: Nil, "", PostRequest)
+ if r.param("token").isDefined =>
() => RestAPI.sendMsgWithToken(r)
}
-
+
LiftRules.dispatch.append(ESMEOpenIDVendor.dispatchPF)
-
+
LiftRules.siteMapFailRedirectLocation = List("static", "about")
-
+
LiftRules.rewrite.prepend {
case RewriteRequest(ParsePath("user" :: user :: Nil,"", _,_), _, _) =>
RewriteResponse( List("user_view", "index"), Map("uid" -> user))
case RewriteRequest(ParsePath("tag" :: tag :: Nil,"", _,_), _, _) =>
RewriteResponse( List("user_view", "tag"), Map("tag" -> tag))
-
+
case RewriteRequest(ParsePath("conversation" :: cid :: Nil, "", _, _),
- _, _) =>
+ _, _) =>
RewriteResponse(List("user_view", "conversation"), Map("cid" -> cid))
case RewriteRequest(ParsePath("search" :: term :: Nil,"", _,_), _, _) =>
@@ -106,10 +109,10 @@
User.sitemap :::
Track.menuItems :::
Auth.menuItems :::
- ActionView.menuItems
+ ActionMgr.menuItems
LiftRules.setSiteMap(SiteMap(entries:_*))
-
+
S.addAround(ExtSession.requestLoans)
LiftRules.viewDispatch.append {
@@ -119,14 +122,14 @@
LiftRules.dispatch.prepend(RestAPI.dispatch)
LiftRules.httpAuthProtectedResource.prepend {
- case (ParsePath(TwitterAPI.ApiPath :: _, _, _, _)) =>
Full(AuthRole("user"))
+ case (ParsePath(TwitterAPI.ApiPath :: _, _, _, _)) =>
Full(AuthRole("user"))
}
-
+
LiftRules.authentication = TwitterAPI.twitterAuth
LiftRules.dispatch.append(TwitterXmlAPI.dispatch)
LiftRules.dispatch.append(TwitterJsonAPI.dispatch)
-
+
LiftRules.early.append(makeUtf8)
Distributor.touch
@@ -145,21 +148,18 @@
object Compass {
// Set up Compass for search
- val conf = new CompassConfiguration()
- .configure(Props.get("compass_config_file") openOr
"/props/compass.cfg.xml")
- .addClass((new Message).clazz)
-
- val compass = conf.buildCompass()
- if (!compass.getSearchEngineIndexManager.indexExists)
- {
- // Create Index if one does not exist
- compass.getSearchEngineIndexManager().createIndex()
- }
+ val conf = tryo(new CompassConfiguration()
+ .configure(Props.get("compass_config_file") openOr "/props/compass.cfg.xml")
+ .addClass((new Message).clazz))
+
+ val compass = conf.map(_.buildCompass())
+
+ for (c <- compass if !c.getSearchEngineIndexManager.indexExists)
+ tryo(c.getSearchEngineIndexManager().createIndex())
}
object RequestAnalyzer {
-
def analyze(req: Box[Req], time: Long, queries: List[(String, Long)]): Unit
= {
val longQueries = (queries.filter(_._2 > 30))
if (time > 50 || longQueries.?) {
@@ -173,7 +173,7 @@
private var pool: List[Connection] = Nil
private var poolSize = 0
private val maxPoolSize = 4
-
+
private def createOne: Box[Connection] = try {
if (Props.getBool("use_prod_psql", false)) {
Class.forName("org.postgresql.Driver")
@@ -195,14 +195,14 @@
case Props.RunModes.Test => "jdbc:derby:esme_test_db;create=true"
case _ => "jdbc:derby:esme_db;create=true"
}
-
+
val dm = DriverManager.getConnection(driverName)
Full(dm)
}
} catch {
case e : Exception => e.printStackTrace; Empty
}
-
+
def newConnection(name: ConnectionIdentifier): Box[Connection] =
synchronized {
pool match {
case Nil if poolSize < maxPoolSize => val ret = createOne
@@ -226,7 +226,7 @@
}
}
}
-
+
def releaseConnection(conn: Connection): Unit = synchronized {
pool = conn :: pool
notify
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/Distributor.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/Distributor.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/Distributor.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/Distributor.scala
Fri May 22 04:34:34 2009
@@ -43,6 +43,9 @@
object Distributor extends Actor {
def act = loop {
react {
+ case RelinkToActorWatcher =>
+ link(ActorWatcher)
+
case StartMeUp =>
link(ActorWatcher)
User.findAll.map(_.id.is).foreach(findOrCreateUser)
@@ -52,9 +55,10 @@
metaData,
source,
inReplyTo) =>
- findOrCreateUser(user) !
- UserActor.CreateMessage(text, tags,
- when, metaData, source, inReplyTo)
+ val toact = findOrCreateUser(user)
+ toact ! UserActor.CreateMessage(text, tags,
+ when, metaData, source, inReplyTo)
+ toact ! text
case AddMessageToMailbox(user, message, reason) =>
findOrCreateUser(user) ! UserActor.AddToMailbox(message, reason)
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.scala
Fri May 22 04:34:34 2009
@@ -21,7 +21,7 @@
package org.apache.esme.actor
-import scala.actors.Actor
+import scala.actors.{Actor, Exit}
import Actor._
import net.liftweb._
@@ -55,6 +55,7 @@
val logger: Logger = Logger.getLogger("org.apache.esme.actor")
}
+
class UserActor extends Actor {
import UserActor._
@@ -76,6 +77,9 @@
def act = loop {
react {
+ case RelinkToActorWatcher =>
+ link(ActorWatcher)
+
case m @ Distributor.UserUpdated(_) =>
User.find(userId).
foreach(u => userTimezone = TimeZone.getTimeZone(u.timezone))
@@ -93,7 +97,8 @@
this ! UpdateTracking(Distributor.TrackTrackingType)
this ! UpdateTracking(Distributor.PerformTrackingType)
- case RunFunc(f) => f()
+ case RunFunc(f) =>
+ f()
case CreateMessage(text, tags, when, metaData, source, replyTo) =>
val tagLst = tags.removeDuplicates.map(Tag.findOrCreate)
@@ -129,7 +134,7 @@
Distributor ! Distributor.NewMessage(msg)
}
- case AddToMailbox(msg, reason) =>
+ case AddToMailbox(msg, reason) =>
addToMailbox(msg, reason)
@@ -157,7 +162,8 @@
case Unlisten(who) => listeners = listeners.filter(_ ne who)
- case LatestMessages(cnt) => reply(_mailbox.take(cnt).toList)
+ case LatestMessages(cnt) =>
+ reply(_mailbox.take(cnt).toList)
}
}
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
Fri May 22 04:34:34 2009
@@ -43,7 +43,7 @@
super.localSetup()
for (user <- User.currentUser) {
Distributor ! Distributor.Listen(user.id, this)
- Distributor !? (200, Distributor.LatestMessages(user.id, 40)) match {
+ Distributor !? (2000, Distributor.LatestMessages(user.id, 40)) match {
case Some(msg: List[Long]) => messages = msg
case x =>
}
Added:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala?rev=777364&view=auto
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
(added)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/ActionMgr.scala
Fri May 22 04:34:34 2009
@@ -0,0 +1,131 @@
+/**
+ * Copyright 2008-2009 WorldWide Conferencing, LLC
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.esme.lib
+
+import net.liftweb._
+import http._
+import SHtml._
+import js._
+import JsCmds._
+import JE._
+
+import sitemap._
+import Loc._
+
+import mapper._
+
+import util._
+import Helpers._
+
+import model._
+
+import scala.xml._
+
+/**
+ * Manage the sitemap and related snippets for Actions
+ */
+object ActionMgr {
+ def loggedIn_? = User.loggedIn_?
+
+ val ifIsLoggedIn = If(loggedIn_? _, strFuncToFailMsg(() => S.?("You must be
logged in")))
+
+ val menuItems =
+ Menu(Loc("actionMgt", List("action_view", "index"), "Action Management",
ifIsLoggedIn,
+ Loc.Snippet("dispayActions", dispayActions),
+ Loc.Snippet("main", mainActions))) ::
+ Nil
+
+ object updateActions extends RequestVar[() => JsCmd](() => Noop)
+
+ def dispayActions(in: NodeSeq): NodeSeq = {
+ // get the span name to update
+ val spanName = S.attr("the_id") openOr "TokenSpan"
+ // get the current user
+ val user = User.currentUser
+
+ // bind the dynamic content to the incoming nodeseq
+ def doRender(): NodeSeq =
+ Action.findAll(By(Action.user, user), By(Action.removed, false),
+ OrderBy(Action.id, Ascending)) match {
+ case Nil => NodeSeq.Empty
+ case xs => bind("disp", in,
+ "item" ->
+ (lst => xs.flatMap(i => bind("item", lst,
+ "name" -> i.name.is,
+ "enabled" ->
ajaxCheckbox(!i.disabled,
+ e
=> {i.disabled(!e).save; Noop} ),
+ "test" -> i.testText,
+ "action" -> i.actionText,
+ "remove" ->
+ ((bt: NodeSeq) =>
+ ajaxButton(bt, () => {i.removed(true).save ; updateSpan()}))
+ ))))
+ }
+
+ def updateSpan(): JsCmd = SetHtml(spanName, doRender())
+
+ updateActions.set(updateSpan)
+ doRender()
+ }
+
+ def mainActions(in: NodeSeq): NodeSeq = {
+ val redisplay = updateActions.is
+ var name = ""
+ var test = ""
+ val mainName = "name_input"
+ val mainTest = "test_input"
+ val mainAction = "action_input"
+ val user = User.currentUser
+
+ def doSave(actionText: String): JsCmd = {
+ val toSave = Action.create.name(name).user(user)
+ DB.use(toSave.connectionIdentifier) {
+ ignore =>
+ val act: Box[List[FieldError]] =
+ for (a1 <- toSave.setAction(actionText);
+ a2 <- a1.setTest(test))
+ yield a2.validate
+
+ act match {
+ case Full(Nil) =>
+ toSave.save
+ S.notice("Action added")
+ redisplay() &
+ SetValById(mainName, "") &
+ SetValById(mainAction, "") &
+ SetValById(mainTest, "")
+
+ case Full(xs) => S.error(xs); Noop
+ case Failure(msg, _, _) => S.error(msg) ; Noop
+ case _ => Noop
+ }
+ }
+ }
+
+
+ bind("main", in,
+ "name" -> text(name, name = _, "id" -> mainName),
+ "test" -> textarea(test, test = _, "id" -> mainTest),
+ "action" -> textarea("", doSave, "id" -> mainAction)
+ )
+ }
+}
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/MsgParser.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/MsgParser.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/MsgParser.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/MsgParser.scala
Fri May 22 04:34:34 2009
@@ -266,13 +266,13 @@
case x ~ xs => x :: xs
}
- lazy val testLogin: Parser[TestAction] = acceptCI("login") ^^^ LoginAction()
+ lazy val testLogin: Parser[TestAction] = acceptCI("login") ^^^ LoginAction
- lazy val testFollowed: Parser[TestAction] = acceptCI("followed") ^^^
FollowedAction()
+ lazy val testFollowed: Parser[TestAction] = acceptCI("followed") ^^^
FollowedAction
- lazy val testUnfollowed: Parser[TestAction] = acceptCI("unfollowed") ^^^
UnfollowedAction()
+ lazy val testUnfollowed: Parser[TestAction] = acceptCI("unfollowed") ^^^
UnfollowedAction
- lazy val testProfile: Parser[TestAction] = acceptCI("profile") ^^^
ProfileAction()
+ lazy val testProfile: Parser[TestAction] = acceptCI("profile") ^^^
ProfileAction
lazy val testRegular: Parser[TestAction] = acceptCI("every") ~ whiteSpace ~>
number <~ whiteSpace ~ acceptCI("mins") ^^ {
case mins => RegularAction(mins)
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala
Fri May 22 04:34:34 2009
@@ -75,19 +75,19 @@
val f2 = toFunc(right)
(m, u, c, r) => f1(m, u, c, r) && f2(m, u, c, r)
- case LoginAction() =>
+ case LoginAction =>
(m, u, c, r) => r.isInstanceOf[LoginReason]
- case FollowedAction() =>
+ case FollowedAction =>
(m, u, c, r) => r.isInstanceOf[FollowedReason]
- case UnfollowedAction() =>
+ case UnfollowedAction =>
(m, u, c, r) => r.isInstanceOf[UnfollowedReason]
case RegularAction(mins) =>
(m, u, c, r) => r.isInstanceOf[RegularReason]
- case ProfileAction() =>
+ case ProfileAction =>
(m, u, c, r) => r.isInstanceOf[ProfileReason]
case AtUserAction(userId) =>
@@ -349,19 +349,19 @@
})
}
-case class LoginAction extends TestAction {
+case object LoginAction extends TestAction {
def toStr = "login"
}
-case class FollowedAction extends TestAction {
+case object FollowedAction extends TestAction {
def toStr = "followed"
}
-case class UnfollowedAction extends TestAction {
+case object UnfollowedAction extends TestAction {
def toStr = "unfollowed"
}
-case class ProfileAction extends TestAction {
+case object ProfileAction extends TestAction {
def toStr = "profile"
}
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
Fri May 22 04:34:34 2009
@@ -2,7 +2,7 @@
/**
* Copyright 2008-2009 WorldWide Conferencing, LLC
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -64,12 +64,12 @@
val il = in.toList
val (r1, left) = il.foldLeft[(Map[Long, Message], List[Long])](
(Map.empty, Nil)) {
- case ((map, left), id) =>
+ case ((map, left), id) =>
if (idCache.contains(id)) {
(map + (id -> idCache(id)), left)
} else (map, id :: left)
}
-
+
val r2 = left match {
case Nil => r1
@@ -90,7 +90,7 @@
idCache.remove(msg.id)
}
-
+
override def afterCommit = super.afterCommit
private def saveTags(msg: Message) {
@@ -121,7 +121,7 @@
logger.info("Inside Message.search() with user list "+(users.mkString(",
")))
- val session = compass.openSession()
+ (for(session <- compass.map(_.openSession()); user <- User.currentUser)
yield {
var tx:CompassTransaction = null
var returnValue:List[Message] = Nil
@@ -129,7 +129,7 @@
tx = session.beginTransaction()
val queryBuilder: CompassQueryBuilder = session.queryBuilder()
- val followingQuery =
queryBuilder.bool().addShould(queryBuilder.term("author",
User.currentUser.open_!.id))
+ val followingQuery =
queryBuilder.bool().addShould(queryBuilder.term("author", user.id))
for (user <- following)
followingQuery.addShould(queryBuilder.term("author", user.id))
val query: CompassQuery = queryBuilder.bool()
@@ -147,7 +147,7 @@
val resourceList =
hitlist.getResources.toList.asInstanceOf[List[Resource]]
- returnValue = resourceList.map(x => Message.find(x.getId).open_!)
+ returnValue = resourceList.flatMap(x => Message.find(x.getId))
tx.commit();
} catch {
case ce: CompassException =>
@@ -157,6 +157,7 @@
}
returnValue
+ }) openOr Nil
}
}
@@ -366,7 +367,8 @@
// Get the term (i.e. word) frequencies for the word cloud from the message
text
lazy val wordFrequencies: List[(String, Int)] = {
- val session = compass.openSession()
+ try {
+ (for {session <- compass.map(_.openSession())} yield {
var tx:CompassTransaction = null
var returnValue:List[(String, Int)] = Nil
@@ -380,7 +382,7 @@
case x => x
}
-
+
val textTermFreqs:TermFreqVector =
LuceneHelper.getTermFreqVector(session, msgResource, "textWords")
Message.logger.info("textTermFreqs: "+textTermFreqs)
@@ -400,6 +402,11 @@
}
compoundStem(returnValue)
+ }) openOr Nil
+ } catch {
+ case e => e.printStackTrace; Nil
+ }
+
}
// Get the tag frequencies for the tag cloud from the message's tags
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/User.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/User.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/User.scala
(original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/User.scala
Fri May 22 04:34:34 2009
@@ -203,7 +203,7 @@
def createAConsumer = new ESMEOpenIDConsumer
}
-class ESMEOpenIDConsumer extends OpenIDConsumer[User]
+class ESMEOpenIDConsumer extends OpenIdConsumer[User]
{
override val manager = {
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/snippet/UserSnip.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/snippet/UserSnip.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/snippet/UserSnip.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/snippet/UserSnip.scala
Fri May 22 04:34:34 2009
@@ -47,7 +47,7 @@
case Some(x) if x > 0L => Full(x)
case _ => Empty
}
-
+
Distributor !
Distributor.UserCreatedMessage(user.id, msg,
Tag.split(tags),
@@ -55,7 +55,6 @@
Empty,
"web",
replyTo)
-
}
Noop
Modified:
incubator/esme/trunk/server/src/main/scala/org/apache/esme/view/ActionView.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/view/ActionView.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/main/scala/org/apache/esme/view/ActionView.scala
(original)
+++
incubator/esme/trunk/server/src/main/scala/org/apache/esme/view/ActionView.scala
Fri May 22 04:34:34 2009
@@ -21,6 +21,7 @@
* under the License.
*/
+/*
import net.liftweb._
import http._
import js._
@@ -172,3 +173,4 @@
</lift:surround>
}
}
+*/
Added: incubator/esme/trunk/server/src/main/webapp/action_view/index.html
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/action_view/index.html?rev=777364&view=auto
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/action_view/index.html (added)
+++ incubator/esme/trunk/server/src/main/webapp/action_view/index.html Fri May
22 04:34:34 2009
@@ -0,0 +1,75 @@
+<lift:surround with="default" at="content">
+ Manage your Actions items: <br/>
+ <span id="TokenSpan">
+ <lift:ignore>
+ <!--
+ The displayActions snippet *MUST* appear on the page before
+ the main snippet
+ -->
+ </lift:ignore>
+ <lift:dispayActions the_id="TokenSpan">
+ <table>
+ <tr>
+ <td>Name</td>
+ <td>Enabled</td>
+ <td>Test</td>
+ <td>Action</td>
+ <td>Remove</td>
+ </tr>
+ <disp:item>
+ <tr>
+ <td><item:name/></td>
+ <td>Enabled: <item:enabled/></td>
+ <td><pre><item:test/></pre></td>
+ <td><pre><item:action/></pre></td>
+ <td>
+ <item:remove>Remove</item:remove>
+ </td>
+ </tr>
+ </disp:item>
+ </table>
+ </lift:dispayActions>
+ </span>
+
+ <lift:form>
+ <lift:main>
+ <table>
+ <tr><td colspan="3">New Action</td></tr>
+ <tr>
+ <td>Name</td>
+ <td><main:name/></td>
+ </tr>
+ <tr>
+ <td>Test</td>
+ <td><main:test/></td>
+ <td>
+ @foo -- sender is @foo<br />
+ day = (0,1) -- sent on Sunday or Monday<br/>
+ #moo -- contains the #moo tag<br/>
+ 50% -- success 50% of the time<br/>
+ @foo & 50% -- half the time, something sent by @foo<br/>
+ login -- user has logged in<br/>
+ followed -- user is being followed<br/>
+ unfollowed -- user is being unfollowed<br/>
+ profile -- user changed profile<br/>
+ every N mins -- repeat action, N is an integer
+ </td>
+ </tr>
+
+ <tr>
+ <td>Action</td>
+ <td><main:action/></td>
+ <td>
+ filter -- not put in your timeline<br />
+ resend -- sends the message to all your followers<br />
+ mailto:[email protected] -- sends the message to [email protected]<br/>
+ http://foo.com/message/in -- HTTP post, %s expands to message<br/>
+ atom:http://blog.com/feed.atom -- posts new messages from Atom
feed<br/>
+ rss:http://blog.com/feed.rss -- posts new messages from RSS feed
+ </td>
+ </tr>
+ <input type="submit" value="Add" />
+ </table>
+ </lift:main>
+ </lift:form>
+</lift:surround>
Modified:
incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
(original)
+++ incubator/esme/trunk/server/src/main/webapp/templates-hidden/default.html
Fri May 22 04:34:34 2009
@@ -32,7 +32,7 @@
<tr>
<td width="75%">
<div>
- <lift:bind name="content" />
+ <lift-tag:bind name="content" />
</div>
</td>
<td>
Modified:
incubator/esme/trunk/server/src/main/webapp/templates-hidden/login.html
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/templates-hidden/login.html?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/templates-hidden/login.html
(original)
+++ incubator/esme/trunk/server/src/main/webapp/templates-hidden/login.html Fri
May 22 04:34:34 2009
@@ -39,7 +39,7 @@
<td class="l-page-r">
<div class="l-top">
<div class="b-open">
- <lift:bind name="content"/>
+ <lift-tag:bind name="content"/>
<div class="open-id">
<h3>Need an OpenID?</h3>
Modified: incubator/esme/trunk/server/src/test/scala/RunWebApp.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/scala/RunWebApp.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/test/scala/RunWebApp.scala (original)
+++ incubator/esme/trunk/server/src/test/scala/RunWebApp.scala Fri May 22
04:34:34 2009
@@ -1,7 +1,8 @@
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
-import org.mortbay.jetty.webapp.WebAppContext;
+// import org.mortbay.jetty.webapp.WebAppContext;
+/*
object RunWebApp extends Application {
val server = new Server(8080);
val context = new WebAppContext()
@@ -26,3 +27,4 @@
}
}
}
+*/
\ No newline at end of file
Modified:
incubator/esme/trunk/server/src/test/scala/org/apache/esme/lib/MsgParseTest.scala
URL:
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/scala/org/apache/esme/lib/MsgParseTest.scala?rev=777364&r1=777363&r2=777364&view=diff
==============================================================================
---
incubator/esme/trunk/server/src/test/scala/org/apache/esme/lib/MsgParseTest.scala
(original)
+++
incubator/esme/trunk/server/src/test/scala/org/apache/esme/lib/MsgParseTest.scala
Fri May 22 04:34:34 2009
@@ -32,7 +32,7 @@
import org.mortbay.jetty.Server
//import org.mortbay.jetty.servlet.Context
import org.mortbay.jetty.servlet.ServletHolder
-import org.mortbay.jetty.webapp.WebAppContext
+// import org.mortbay.jetty.webapp.WebAppContext
import org.apache.esme._
import model._
@@ -303,13 +303,15 @@
private val server_ : Server = {
val server = new Server(serverPort_)
+ /*
val context = new WebAppContext()
context.setServer(server)
context.setContextPath("/")
context.setWar("src/main/webapp")
+ */
//val context = new Context(_server, "/", Context.SESSIONS)
//context.addFilter(new FilterHolder(new LiftFilter()), "/");
- server.addHandler(context)
+ // server.addHandler(context)
server
}