Skip to content
This repository has been archived by the owner on Jul 22, 2018. It is now read-only.

Commit

Permalink
Ref #873, #817 More deprecation fixes, import organize and package cl…
Browse files Browse the repository at this point in the history
…eanups
  • Loading branch information
indrajitr committed Feb 28, 2011
1 parent 675bac9 commit 7d8e9f8
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 204 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2010 WorldWide Conferencing, LLC
* Copyright 2007-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.
Expand All @@ -18,14 +18,14 @@ package net.liftweb {
package ext_api {
package facebook {

import _root_.java.net.{HttpURLConnection, URL, URLEncoder}
import _root_.java.io.DataOutputStream
import _root_.java.io.InputStream
import _root_.java.util.Date
import java.net.{HttpURLConnection, URL, URLEncoder}
import java.io.DataOutputStream
import java.io.InputStream
import java.util.Date

import _root_.scala.xml.{Node, XML, NodeSeq}
import xml.{Node, XML, NodeSeq}

import _root_.net.liftweb.util.Helpers._
import util.Helpers._

object FacebookRestApi {
def apiKey = System.getProperty("com.facebook.api_key")
Expand Down Expand Up @@ -61,7 +61,7 @@ object FacebookClient {

def genSignature(allParams: List[(String, Any)], secret: String): String = {
val md = _root_.java.security.MessageDigest.getInstance("MD5")
val theStr = convert(allParams).sort(_ < _).mkString("") + secret
val theStr = convert(allParams).sortWith(_ < _).mkString("") + secret

md.digest((theStr).getBytes).map(byteToHex(_)).mkString("")
}
Expand Down Expand Up @@ -201,7 +201,7 @@ class FacebookClient[T](val apiKey: String, val secret: String, val session: Fac
FacebookClient.buildParams(meth.name, allParams: _*)
}

def getInfo(users: Collection[Long], fields: FacebookField*): T = {
def getInfo(users: Iterable[Long], fields: FacebookField*): T = {
callMethod(GetInfo(users, fields: _*))
}
}
Expand Down Expand Up @@ -249,8 +249,8 @@ case class GetEvents(filters: GetEventsParam*) extends FacebookMethod("facebook.
case class GetEventsMembers(eventId: Long) extends FacebookMethod("facebook.events.getMembers", EventId(eventId))
case object GetAppUsers extends FacebookMethod("facebook.friends.getAppUsers")
//case object GetRequests extends FacebookMethod("facebook.friends.getRequests") /*This method is not listed in the current facebook api. deprecated?*/
case class AreFriends(friends1: Collection[Long], friends2: Collection[Long]) extends FacebookMethod("facebook.friends.areFriends", FacebookParam("uids1", friends1.mkString(",")), FacebookParam("uids2", friends2.mkString(",")))
case class GetInfo(users: Collection[Long], fields: FacebookField*) extends FacebookMethod("facebook.users.getInfo", UserIds(users.toList: _*), FacebookFields(fields: _*))
case class AreFriends(friends1: Iterable[Long], friends2: Iterable[Long]) extends FacebookMethod("facebook.friends.areFriends", FacebookParam("uids1", friends1.mkString(",")), FacebookParam("uids2", friends2.mkString(",")))
case class GetInfo(users: Iterable[Long], fields: FacebookField*) extends FacebookMethod("facebook.users.getInfo", UserIds(users.toList: _*), FacebookFields(fields: _*))
case object GetUser extends FacebookMethod("facebook.users.getLoggedInUser")
case class GetPhotos(primaryFilter: GetPhotosParam, otherFilters: GetPhotosParam*) extends FacebookMethod("facebook.photos.get", (primaryFilter :: otherFilters.toList): _*)
case class GetAlbums(primaryFilter: GetAlbumsParam, otherFilters: GetAlbumsParam*) extends FacebookMethod("facebook.photos.getAlbums", (primaryFilter :: otherFilters.toList): _*)
Expand Down
34 changes: 12 additions & 22 deletions imaging/src/main/scala/net/liftweb/imaging/ImageResizer.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.
Expand All @@ -14,31 +14,23 @@
* limitations under the License.
*/

package net.liftweb {
package imaging {
package net.liftweb
package imaging


import java.awt.{Graphics2D, Graphics, Transparency, AlphaComposite, RenderingHints}
import java.awt.geom.AffineTransform
import java.awt.image.{AffineTransformOp, BufferedImage, ColorModel, IndexColorModel}
import java.io.{InputStream,ByteArrayOutputStream,ByteArrayInputStream}
import java.awt.{Graphics2D, Transparency, RenderingHints}
import java.awt.image.BufferedImage
import javax.imageio.{IIOImage, ImageIO, ImageWriteParam}

import org.apache.sanselan.ImageReadException
import org.apache.sanselan.Sanselan
import org.apache.sanselan.ImageFormat
import org.apache.sanselan.common.IImageMetadata
import org.apache.sanselan.common.RationalNumber
import org.apache.sanselan.formats.jpeg.JpegImageMetadata
import org.apache.sanselan.formats.tiff.TiffField
import org.apache.sanselan.formats.tiff.TiffImageMetadata
import org.apache.sanselan.formats.tiff.constants.TagInfo
import org.apache.sanselan.formats.tiff.constants.TiffConstants
import org.apache.sanselan.formats.tiff.constants.TiffTagConstants

import java.io.{InputStream,ByteArrayOutputStream,ByteArrayInputStream}
import common.{Box, Full, Empty}
import util.Helpers

import net.liftweb.common.{Box, Full, Empty}
import net.liftweb.util.Helpers

object ImageOutFormat extends Enumeration("png", "jpg", "gif", "bmp"){
val png,jpeg,gif,bmp = Value
Expand Down Expand Up @@ -227,17 +219,17 @@ class ImageResizer(renderingHintsMap:Map[java.awt.RenderingHints.Key,Any], multi
val (tW, tH, rotFunc) = orientation match {
case Full(ImageOrientation.rotate180) =>
(targetWidth, targetHeight, (g2:Graphics2D) => {
g2.rotate(Math.Pi)
g2.rotate(math.Pi)
g2.translate(-targetWidth, -targetHeight)
})
case Full(ImageOrientation.rotate270) =>
(targetHeight, targetWidth, (g2:Graphics2D) => {
g2.rotate(Math.Pi/2)
g2.rotate(math.Pi/2)
g2.translate(0, -targetHeight)
})
case Full(ImageOrientation.rotate90) =>
(targetHeight, targetWidth, (g2:Graphics2D) => {
g2.rotate(-Math.Pi/2)
g2.rotate(-math.Pi/2)
g2.translate(-targetWidth, 0)
})
case _ => (targetWidth, targetHeight, (g2:Graphics2D) => {})
Expand All @@ -253,6 +245,4 @@ class ImageResizer(renderingHintsMap:Map[java.awt.RenderingHints.Key,Any], multi
ret
}

} //ImageResizer
} //imaging
} //net.liftweb
}
27 changes: 13 additions & 14 deletions machine/src/main/scala/net/liftweb/machine/ProtoStateMachine.scala
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010 WorldWide Conferencing, LLC
* Copyright 2006-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.
Expand All @@ -14,15 +14,17 @@
* limitations under the License.
*/

package net.liftweb {
package machine {
package net.liftweb
package machine

import collection.mutable.{Queue, HashMap}

import common._
import actor._
import util._
import Helpers._
import mapper._

import _root_.net.liftweb.mapper._
import _root_.net.liftweb.util.Helpers._
import _root_.scala.collection.mutable.{Queue, HashMap}
import _root_.net.liftweb.util._
import _root_.net.liftweb.common._
import _root_.net.liftweb.actor._

/**
* This trait manages state/workflow transition
Expand Down Expand Up @@ -319,7 +321,7 @@ trait MetaProtoStateMachine [MyType <: ProtoStateMachine[MyType, StateType],
def timedEventPeriodicWait = 10000L

private class TimedEventManager(val metaOwner: Meta) extends LiftActor with Loggable {
ActorPing.schedule(this, Ping, TimeSpan(timedEventInitialWait)) // give the system 2 minutes to "warm up" then start pinging
Schedule.schedule(this, Ping, TimeSpan(timedEventInitialWait)) // give the system 2 minutes to "warm up" then start pinging

protected def messageHandler =
{
Expand All @@ -339,7 +341,7 @@ trait MetaProtoStateMachine [MyType <: ProtoStateMachine[MyType, StateType],
} catch {
case e => logger.error("State machine loop", e)
}
ActorPing.schedule(this, Ping, TimeSpan(timedEventPeriodicWait))
Schedule.schedule(this, Ping, TimeSpan(timedEventPeriodicWait))
}

case object Ping
Expand Down Expand Up @@ -369,6 +371,3 @@ trait MetaProtoStateMachine [MyType <: ProtoStateMachine[MyType, StateType],
ret
}
}

}
}
18 changes: 8 additions & 10 deletions oauth/src/main/scala/net/liftweb/oauth/OAuthSignatureMethod.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.
Expand All @@ -14,16 +14,17 @@
* limitations under the License.
*/

package net.liftweb {
package oauth {
package net.liftweb
package oauth

import java.net.URI
import javax.crypto.Mac
import javax.crypto.SecretKey
import javax.crypto.spec.SecretKeySpec

import common._
import util.Helpers
import net.liftweb.http._
import net.liftweb.common._
import net.liftweb.util.Helpers


abstract class OAuthSignatureMethod(accessor: OAuthAccessor) {
def validate(message: OAuthMessage): Box[OAuthMessage] =
Expand Down Expand Up @@ -66,7 +67,7 @@ abstract class OAuthSignatureMethod(accessor: OAuthAccessor) {

private def normalizeParameters(parameters: List[OAuthUtil.Parameter]) = {
val filteredParameters = parameters.filter(_.name != OAuthUtil.OAUTH_SIGNATURE)
val sortedParameters = filteredParameters.sort((p1, p2) => {
val sortedParameters = filteredParameters.sortWith((p1, p2) => {
val k1 = OAuthUtil.percentEncode(p1.name) + ' ' + OAuthUtil.percentEncode(p1.value)
val k2 = OAuthUtil.percentEncode(p2.name) + ' ' + OAuthUtil.percentEncode(p2.value)
k1.compareTo(k2) <= 0
Expand Down Expand Up @@ -151,6 +152,3 @@ class PLAINTEXT(accessor: OAuthAccessor) extends OAuthSignatureMethod(accessor)
object PLAINTEXT extends OAuthSignatureMethodBuilder {
def apply(accessor: OAuthAccessor): OAuthSignatureMethod = new PLAINTEXT(accessor)
}

}
}
34 changes: 16 additions & 18 deletions paypal/src/main/scala/net/liftweb/paypal/Paypal.scala
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2010 WorldWide Conferencing, LLC
* Copyright 2007-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.
Expand All @@ -14,21 +14,22 @@
* limitations under the License.
*/

package net.liftweb {
package paypal {
package net.liftweb
package paypal

import _root_.net.liftweb.util.Helpers
import java.io._

import collection.mutable.ListBuffer

import org.apache.commons.httpclient.{HttpClient, NameValuePair}
import org.apache.commons.httpclient.methods._

import common._
import actor._
import util._
import Helpers._
import _root_.net.liftweb.util._
import _root_.net.liftweb.common._
import _root_.net.liftweb.actor._
import _root_.net.liftweb.http._
import _root_.org.apache.commons.httpclient._
import _root_.org.apache.commons.httpclient.methods._
import _root_.java.io._
import _root_.scala.collection.mutable.ListBuffer
import http._

import _root_.scala.xml.{NodeSeq}

/**
* sealed abstract type PaypalMode so we can cast to the super
Expand Down Expand Up @@ -91,7 +92,7 @@ object PaypalTransactionStatus extends Enumeration {

def find(name: String): Box[Value] = {
val n = name.trim.toLowerCase
this.iterator.filter(v => v.toString.toLowerCase == n).toList.firstOption
this.values.filter(_.toString.toLowerCase == n).headOption
}
}

Expand Down Expand Up @@ -538,7 +539,7 @@ trait PaypalIPN extends BasePaypalTrait {
protected object requestQueue extends LiftActor {
protected def messageHandler =
{
case PingMe => ActorPing.schedule(this, PingMe, 10 seconds)
case PingMe => Schedule.schedule(this, PingMe, 10 seconds)

case IPNRequest(r, cnt, _) if cnt > MaxRetry => // discard the transaction

Expand All @@ -562,6 +563,3 @@ trait PaypalIPN extends BasePaypalTrait {
}
requestQueue ! PingMe
}

}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2010 WorldWide Conferencing, LLC
* Copyright 2007-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.
Expand All @@ -14,22 +14,25 @@
* limitations under the License.
*/

package net.liftweb {
package widgets {
package calendars {

import _root_.scala.xml._
import _root_.java.util.{Calendar, Locale}
import _root_.java.util.Calendar._
import _root_.java.text.SimpleDateFormat
import _root_.net.liftweb.util.Helpers._
import _root_.net.liftweb.common.{Box, Full, Empty}
import _root_.net.liftweb.http.{LiftRules}
import _root_.net.liftweb.http.js._
import _root_.net.liftweb.http.SHtml._
package net.liftweb
package widgets
package calendars

import java.util.{Calendar, Locale}
import java.util.Calendar._

import xml._

import common.Box
import util.Helpers._

import http.LiftRules
import http.js._
import http.SHtml._
import JsCmds._
import JE._


object CalendarDayView {

/**
Expand Down Expand Up @@ -94,7 +97,7 @@ class CalendarDayView(val when: Calendar, val meta: DayViewMeta) {
<div class="dayHead">
<table cellspacing="0" cellpading="0" style="width: 100%;">
<tr>
<td class="dayHour"><div></div></td>
<td class="dayHour"><div></div></td>
<td class="dayHeadCell">{
val time = cal.getTime
meta.weekDaysFormatter.format(time) + " " + dateFormatter.format(time)
Expand All @@ -108,7 +111,7 @@ class CalendarDayView(val when: Calendar, val meta: DayViewMeta) {
val cal = Calendar getInstance;
cal set(HOUR_OF_DAY, 0)
cal set(MINUTE, 0)
for (val i <- 0 to 23) yield
for (i <- 0 to 23) yield
try{
<tr>
<td class="dayHour"><div>{(meta.timeFormatter format(cal getTime)).toString}</div></td>
Expand All @@ -130,7 +133,3 @@ class CalendarDayView(val when: Calendar, val meta: DayViewMeta) {
</div>
}
}

}
}
}

0 comments on commit 7d8e9f8

Please sign in to comment.