incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r881012 - in /incubator/esme/trunk/server/src/main/scala/org/apache/esme: actor/UserActor.scala lib/MsgParser.scala model/Action.scala
Date Mon, 16 Nov 2009 22:26:29 GMT
Author: vdichev
Date: Mon Nov 16 22:26:28 2009
New Revision: 881012

URL: http://svn.apache.org/viewvc?rev=881012&view=rev
Log:
ESME-115 Add tags on feed action.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/actor/UserActor.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

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=881012&r1=881011&r2=881012&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 Mon Nov
16 22:26:28 2009
@@ -111,9 +111,10 @@
         f()
         
       case CreateMessage(text, tags, when, metaData, source, replyTo, pool) =>
-        val tagLst = if (pool == None) 
-                       tags.removeDuplicates.map(Tag.findOrCreate)
-                     else Nil
+        val tagLst = pool match {
+          case Empty => tags.removeDuplicates.map(Tag.findOrCreate)
+          case _ => Nil
+        }
 
         Message.create.author(userId).when(when).
         source(source).
@@ -270,12 +271,12 @@
               Distributor !
               Distributor.AddMessageToMailbox(id, msg, ResendReason(userId))
 
-            case FetchFeed(url) => MessagePullActor ! MessagePullActor.Fetch(td.performId)
+            case FetchFeed(_, _) => MessagePullActor ! MessagePullActor.Fetch(td.performId)
 
-            /*
-            case ScalaInterpret => if (msg.source.is != "scala")
+            case ScalaInterpret => logger.info("Scala interpreter is disabled!")
+            /*if (msg.source.is != "scala")
               ScalaInterpreter ! ScalaInterpreter.ScalaExcerpt(userId, msg.id.is, msg.pool.is,
msg.getText)
-	      */
+            */
 
             case PerformFilter => Stats incr "messagesFiltered" // IGNORE
           }

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=881012&r1=881011&r2=881012&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 Mon Nov
16 22:26:28 2009
@@ -231,10 +231,19 @@
       case protocol ~ userPass ~ urlpart ~ hdrs ~ data =>
         HttpTo(protocol + urlpart, userPass._1, userPass._2, hdrs, data)
     }) |
-  (acceptCI("atom:") ~> httpUrl <~ EOF ^^ {url => FetchAtom(UrlStore.make(url))})
|
-  (acceptCI("rss:") ~> httpUrl <~ EOF ^^ {url => FetchRss(UrlStore.make(url))})
|
+  (acceptCI("atom:") ~> httpUrl ~ tags <~ EOF ^^ {
+    case url ~ tags => FetchAtom(UrlStore.make(url), tags)
+  }) |
+  (acceptCI("rss:") ~> httpUrl ~ tags <~ EOF ^^ {
+    case url ~ tags => FetchRss(UrlStore.make(url), tags)
+  }) |
   (acceptCI("scala") ~ lineSpace ~ EOF ^^^ ScalaInterpret)
 
+  lazy val tags: Parser[List[String]] = opt(EOL ~ accept("tags:") ~ whiteSpace ~> repsep(rep1(tagChar),
accept(",")) ) ^^ {
+    case None => Nil
+    case Some(l) => l.map(_.mkString)
+  }
+  
   lazy val httpHeader: Parser[(String, String)] = EOL ~ accept("header:") ~
   lineSpace ~> rep1(uchar) ~ '=' ~ rep1(uchar) ^^ {
     case name ~ _ ~ value => (name.mkString, value.mkString)

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=881012&r1=881011&r2=881012&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 Mon Nov
16 22:26:28 2009
@@ -171,7 +171,7 @@
     }
     val urlSourcePrefix = "url:"
     theAction.actionFunc match {
-      case a @ (FetchFeed(url)) => {
+      case a @ (FetchFeed(url, tags)) => {
         User.find(user) match {
           case Full(u) =>
             val msgList = Message.findAll(By(Message.source, urlSourcePrefix + url.uniqueId),
@@ -184,8 +184,8 @@
               }
 
             val feed = a match {
-              case FetchAtom(_) => new AtomFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, Nil)
-              case FetchRss(_) => new RssFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, Nil)
+              case FetchAtom(_, _) => new AtomFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, tags)
+              case FetchRss(_, _) => new RssFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, tags)
             }
             MessagePullActor ! MessagePullActor.StartPullActor(id, lastMsg, feed)
           
@@ -490,9 +490,9 @@
 sealed trait Performances
 case class MailTo(who: String, text: Option[String]) extends Performances
 case class HttpTo(url: String, user: String, password: String, headers: List[(String, String)],
data: Option[String]) extends Performances
-case class FetchFeed(url: UrlStore) extends Performances
-case class FetchAtom(override val url: UrlStore) extends FetchFeed(url)
-case class FetchRss(override val url: UrlStore) extends FetchFeed(url)
+case class FetchFeed(url: UrlStore, tags: List[String]) extends Performances
+case class FetchAtom(override val url: UrlStore, override val tags: List[String]) extends
FetchFeed(url, tags)
+case class FetchRss(override val url: UrlStore, override val tags: List[String]) extends
FetchFeed(url, tags)
 case object PerformResend extends Performances
 case object PerformFilter extends Performances
 case object ScalaInterpret extends Performances



Mime
View raw message