incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esjew...@apache.org
Subject svn commit: r932939 [1/3] - in /incubator/esme/trunk/server/src: main/scala/bootstrap/liftweb/ main/scala/org/apache/esme/external/ main/scala/org/apache/esme/model/ main/webapp/action_view/ main/webapp/auth_view/ main/webapp/info_view/ main/webapp/poo...
Date Sun, 11 Apr 2010 17:12:30 GMT
Author: esjewett
Date: Sun Apr 11 17:12:29 2010
New Revision: 932939

URL: http://svn.apache.org/viewvc?rev=932939&view=rev
Log:
Switching over to Redmond theme for JQuery UI components

Added:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/PubSubHubbubReceiver.scala
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_flat_0_aaaaaa_40x100.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_flat_55_fbec88_40x100.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_glass_75_d0e5f5_1x400.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_glass_85_dfeffc_1x400.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_glass_95_fef1ec_1x400.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_217bc0_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_2e83ff_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_469bdd_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_6da8d5_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_cd0a0a_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_d8e7f3_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/images/ui-icons_f9bd01_256x240.png
  (with props)
    incubator/esme/trunk/server/src/main/webapp/style/jqueryui-theme/jquery-ui-1.7.2.custom.css
  (with props)
    incubator/esme/trunk/server/src/test/scala/org/apache/esme/external/
    incubator/esme/trunk/server/src/test/scala/org/apache/esme/external/PubSubHubbubTest.scala
Removed:
    incubator/esme/trunk/server/src/main/webapp/style/jquery-ui.css
    incubator/esme/trunk/server/src/main/webapp/style/smoothness/
Modified:
    incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Action.scala
    incubator/esme/trunk/server/src/main/webapp/action_view/index.html
    incubator/esme/trunk/server/src/main/webapp/auth_view/index.html
    incubator/esme/trunk/server/src/main/webapp/info_view/streams.html
    incubator/esme/trunk/server/src/main/webapp/info_view/user.html
    incubator/esme/trunk/server/src/main/webapp/pools_view/index.html
    incubator/esme/trunk/server/src/main/webapp/scripts/jquery-ui-1.7.2.custom.min.js
    incubator/esme/trunk/server/src/main/webapp/track_view/index.html

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=932939&r1=932938&r2=932939&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 Sun Apr 11 17:12:29
2010
@@ -33,7 +33,8 @@ import net.liftweb.mapper.{DB, Connectio
 import java.sql.{Connection, DriverManager}
 import org.apache.esme._
 import model._
-import org.apache.esme.actor._
+import org.apache.esme.actor._          
+import org.apache.esme.external.PubSubHubbubReceiver
 import lib._
 import snippet._
 import api._
@@ -81,7 +82,7 @@ class Boot {
       case r@Req("api" :: "send_msg" :: Nil, "", PostRequest)
         if r.param("token").isDefined =>
         () => RestAPI.sendMsgWithToken(r)
-    }
+    }  
     
     //Added exceptions to the log
     LiftRules.exceptionHandler.prepend {
@@ -91,6 +92,9 @@ class Boot {
       }
     } 
 
+    // PubSubHubbub support
+    LiftRules.statelessDispatchTable.append(PubSubHubbubReceiver.dispatch)
+
     LiftRules.dispatch.append(ESMEOpenIDVendor.dispatchPF)
 
     //Resources for Internationalization
@@ -150,7 +154,7 @@ class Boot {
 
     LiftRules.setSiteMap(SiteMap(entries: _*))
 
-    S.addAround(ExtSession.requestLoans)          
+    S.addAround(ExtSession.requestLoans)       
 
     // API security rules
     LiftRules.dispatch.append(API2.authorizationRules)

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala Sun
Apr 11 17:12:29 2010
@@ -65,5 +65,22 @@ class AtomFeed(user: User, atomURL: Stri
       else published
     parseInternetDate(date text).getTime
   }
+
+  override def detPubSubHubbub:Boolean = {
+    val r:Boolean = try {
+      val feedXml = XML.loadString(responseString)
+      val feedLinks = ( feedXml \\ "link" ) 
+      val pushLinks = for { 
+        tag <- feedLinks                
+        val link = ( tag \ "@href" ).text if ( tag \ "@rel" ).text == "hub"
+      } yield link
+
+      pushLinks.isEmpty == false
+    } catch {
+      case _ => false
+    }   
+
+    r   
+  }
 }
 

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala Sun Apr
11 17:12:29 2010
@@ -56,6 +56,10 @@ abstract class Feed(val user: User, val 
         )
     ).toList
   }
+
+  lazy val isPubSubHubbub: Boolean = detPubSubHubbub
+
+  protected def detPubSubHubbub:Boolean
   
   protected def getEntries(xml: Elem): NodeSeq
   
@@ -63,8 +67,8 @@ abstract class Feed(val user: User, val 
   
   protected def getLink(xml: Node): String
   
-  protected def getDate(xml: Node): Long
-  
+  protected def getDate(xml: Node): Long         
+
   protected def responseString() = {
     // url.openConnection
     val httpClient = HttpSender.httpClient

Added: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/PubSubHubbubReceiver.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/PubSubHubbubReceiver.scala?rev=932939&view=auto
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/PubSubHubbubReceiver.scala
(added)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/PubSubHubbubReceiver.scala
Sun Apr 11 17:12:29 2010
@@ -0,0 +1,67 @@
+/**
+ * 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.external    
+                            
+import net.liftweb.common.{Full,Box,Empty}
+import net.liftweb.http.{Req,PostRequest,LiftRules,OkResponse,LiftResponse}   
+
+import org.apache.esme.model.Action    
+
+import org.apache.esme.actor.Distributor    
+
+import scala.collection.mutable.HashMap
+
+object PubSubHubbubReceiver {  
+
+  private val receivingActions = new HashMap[String,Box[Action]]
+
+  def dispatch: LiftRules.DispatchPF = {
+    case Req("push" :: cbCode :: Nil, _, PostRequest) => () => handleCallBack(cbCode)
+  }           
+
+  def addReceivingAction(who:Action) {
+// Replace with real code to register callback URL based on action
+    receivingActions += Tuple2("blahblahblahblah",Full(who))    
+    receivingActions += Tuple2("testcallbackurl1",Full(who))
+  }                                                                 
+
+  protected def handleCallBack(cbCode:String): Box[LiftResponse] = { 
+                      
+    // See if the callback code is registered
+    val action = receivingActions.get(cbCode)
+
+    for(a1 <- action; a <- a1) yield {          
+      val user = a.user
+      Distributor ! Distributor.UserCreatedMessage(
+        user,
+        "Some Text",
+        List("tags"),
+        1,
+        Empty,
+        "PubSubHubbub baby",
+        Empty,
+        None)
+    }
+    
+// According to the spec, 200-response indicates only successful receipt, not processing
+    Full(OkResponse())  
+  }
+
+}
\ No newline at end of file

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala Sun
Apr 11 17:12:29 2010
@@ -81,6 +81,23 @@ class RssFeed(user: User, rssURL: String
         }
       case None => msgs
     }
-  }.reverse
+  }.reverse  
+             
+  override def detPubSubHubbub:Boolean = {  
+    val r:Boolean = try {
+      val feedXml = XML.loadString(responseString)
+      val feedLinks = ( feedXml \\ "link" ) 
+      val pushLinks = for { 
+        tag <- feedLinks                
+        val link = ( tag \ "@href" ).text if ( tag \ "@rel" ).text == "hub"
+      } yield link
+
+      pushLinks.isEmpty == false
+    } catch {
+      case _ => false
+    }        
+
+    r
+  }
 }
 

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=932939&r1=932938&r2=932939&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 Sun Apr
11 17:12:29 2010
@@ -207,8 +207,20 @@ class Action extends LongKeyedMapper[Act
             val feed = a match {
               case FetchAtom(_, _) => new AtomFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, tags)
               case FetchRss(_, _) => new RssFeed(u, url.url, urlSourcePrefix + url.uniqueId,
0, tags)
+            }      
+
+// Pubsubhubbub - check if feed is PuSH-enabled. If it is, shut down the regular actor
+// then start up the PuSH subscription                                     
+
+            if(feed.isPubSubHubbub) {
+              SchedulerActor ! SchedulerActor.StopRegular(this.id.is)
+
+            } else {
+
+// If not PuSH-enabled, go ahead as before and start the message pull actor
+
+              MessagePullActor ! MessagePullActor.StartPullActor(id, lastMsg, feed)
             }
-            MessagePullActor ! MessagePullActor.StartPullActor(id, lastMsg, feed)
           
           case _ =>
         }

Modified: 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=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/action_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/action_view/index.html Sun Apr 11 17:12:29
2010
@@ -21,8 +21,7 @@
 	<lift:TableSorterSnip/>
 <head>
 	<!-- STYLESHEETS  -->  
-	<link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
-	<link type="text/css" href="../style/jquery-ui.css" rel="stylesheet" />
+	<link type="text/css" href="../style/jqueryui-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>     
 	<link type="text/css" href="../style/parseTheme.css" rel="stylesheet" />
 	<link type="text/css" href="../style/dialog.css" rel="stylesheet" />
 	<script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js">   
</script>

Modified: incubator/esme/trunk/server/src/main/webapp/auth_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/auth_view/index.html?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/auth_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/auth_view/index.html Sun Apr 11 17:12:29 2010
@@ -19,8 +19,7 @@
 <lift:surround with="base" at="left">
 	<head>
 		<!-- STYLESHEETS  -->
-		<link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
-		<link type="text/css" href="../style/jquery-ui.css" rel="stylesheet" />
+		<link type="text/css" href="../style/jqueryui-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/> 
 		<link type="text/css" href="../style/parseTheme.css" rel="stylesheet" />
 		<link type="text/css" href="../style/dialog.css" rel="stylesheet" />
 		<script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js">  
 </script>

Modified: incubator/esme/trunk/server/src/main/webapp/info_view/streams.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/info_view/streams.html?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/info_view/streams.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/info_view/streams.html Sun Apr 11 17:12:29
2010
@@ -25,7 +25,7 @@
 	<link rel="stylesheet" type="text/css" href="../style/text.css" media="screen" />
 	<link rel="stylesheet" type="text/css" href="../style/grid.css" media="screen" />
 	<link rel="stylesheet" type="text/css" href="../style/layout.css" media="screen" />
-	<link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
+	<link type="text/css" href="../style/jqueryui-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
 	<!--[if IE 6]>
 	<link rel="stylesheet" type="text/css" href="../style/ie6.css" media="screen" />
 	<![endif]-->

Modified: incubator/esme/trunk/server/src/main/webapp/info_view/user.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/info_view/user.html?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/info_view/user.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/info_view/user.html Sun Apr 11 17:12:29 2010
@@ -23,7 +23,7 @@
     <link rel="stylesheet" type="text/css" href="../style/text.css" media="screen" />
     <link rel="stylesheet" type="text/css" href="../style/grid.css" media="screen" />
     <link rel="stylesheet" type="text/css" href="../style/layout.css" media="screen" />
-    <link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
+    <link type="text/css" href="../style/jqueryui-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
     <!--[if IE 6]><link rel="stylesheet" type="text/css" href="../style/ie6.css"
media="screen" /><![endif]--><!--[if gte IE 7]><link rel="stylesheet" type="text/css"
href="../style/ie.css" media="screen" /><![endif]--><!-- JAVASCRIPT -->
     <script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js">
     </script>

Modified: incubator/esme/trunk/server/src/main/webapp/pools_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/pools_view/index.html?rev=932939&r1=932938&r2=932939&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/pools_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/pools_view/index.html Sun Apr 11 17:12:29
2010
@@ -19,8 +19,7 @@
 <lift:surround with="base" at="left">
 <head>
 	<!-- STYLESHEETS  -->  
-	<link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>
-	<link type="text/css" href="../style/jquery-ui.css" rel="stylesheet" />
+	<link type="text/css" href="../style/jqueryui-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet"
/>     
 	<link type="text/css" href="../style/parseTheme.css" rel="stylesheet" />
 	<link type="text/css" href="../style/dialog.css" rel="stylesheet" />
 	<script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js">   
</script>



Mime
View raw message