repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
lhfei/spark-in-action
spark-2.x/src/main/scala/org/apache/spark/examples/SparkALS.scala
<reponame>lhfei/spark-in-action /* * 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, Vers...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/ml/KMeanApp.scala
package cn.lhfei.spark.ml import org.apache.spark.ml.clustering.KMeans import org.apache.spark.sql.SparkSession object KMeanApp { def main(args: Array[String]) { val spark = SparkSession.builder() .appName("KMeans Sample") .master("local[1]") .getOrCreate(); val dataset = spark.read.form...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/df/DataframePlay.scala
<gh_stars>1-10 package cn.lhfei.spark.df import org.apache.spark.sql.{Encoder, Row, SparkSession} import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder import org.apache.spark.sql.types.{StringType, StructField, StructType} object DataframePlay { case class Person(name: String, age: Long) def main(args...
lhfei/spark-in-action
spark-2.x/src/main/scala/org/apache/spark/examples/mllib/DecisionTreeClassificationExample.scala
/* * 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...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/databricks/streaming/PlaylogApp.scala
<reponame>lhfei/spark-in-action<filename>spark-2.x/src/main/scala/cn/lhfei/spark/databricks/streaming/PlaylogApp.scala package cn.lhfei.spark.databricks.streaming import java.text.SimpleDateFormat object PlaylogApp { val SF: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); val NORMAL_DATE: String =...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/streaming/VLogApp.scala
<gh_stars>1-10 package cn.lhfei.spark.streaming import java.text.SimpleDateFormat import cn.lhfei.spark.df.streaming.vlog.VType import cn.lhfei.spark.df.streaming.vo.VLogger import org.apache.commons.net.ntp.TimeStamp import org.apache.spark.rdd.RDD import org.apache.spark.sql.SparkSession import org.apache.spark.sql...
lhfei/spark-in-action
spark-2.x/src/main/scala/org/apache/spark/examples/mllib/KMeansExample.scala
<reponame>lhfei/spark-in-action<gh_stars>1-10 /* * 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...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/df/ml/recommendation/recommendation.scala
<reponame>lhfei/spark-in-action package cn.lhfei.spark.df.ml.recommendation object recommendation extends App { }
lhfei/spark-in-action
spark-2.x/src/main/scala/org/apache/spark/examples/mllib/PCAExample.scala
/* * 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...
lhfei/spark-in-action
spark-2.x/src/main/scala/org/apache/spark/examples/ml/FeatureHasherExample.scala
/* * 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...
lhfei/spark-in-action
spark-2.x/src/main/scala/cn/lhfei/spark/streaming/HdfsWordcount.scala
<gh_stars>1-10 package cn.lhfei.spark.streaming import org.apache.spark.SparkConf import org.apache.spark.streaming.{Seconds, StreamingContext} /** * Created by <NAME> on 2/28/2017. */ object HdfsWordcount { def main(args: Array[String]): Unit = { if(args.length < 1){ System.err.println("...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/ArticleService.scala
<gh_stars>10-100 package com.hhandoko.realworld.service import java.time.ZonedDateTime import cats.Applicative import com.hhandoko.realworld.core.{Article, Author, Username} import com.hhandoko.realworld.service.query.Pagination trait ArticleService[F[_]] { import ArticleService.ArticleCount def getAll(pg: Pagi...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/UserRoutesSpec.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.route import scala.concurrent.ExecutionContext import cats.effect.{ContextShift, IO} import org.http4s._ import org.http4s.implicits._ import org.specs2.Specification import org.specs2.matcher.MatchResult import com.hhandoko.realwor...
hhandoko/scala-http4s-realworld-example-app
project/plugins.sbt
<reponame>hhandoko/scala-http4s-realworld-example-app<gh_stars>10-100 // Load environment variables for local development // See: https://github.com/mefellows/sbt-dotenv addSbtPlugin("au.com.onegeek" %% "sbt-dotenv" % "2.1.204") // Check Maven and Ivy repositories for dependency updates // See: https://github.com/rtim...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/repository/ArticleRepoSpec.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.repository import cats.effect.IO import doobie.implicits._ import doobie.specs2.IOChecker import org.specs2.mutable.Specification import com.hhandoko.realworld.RepoSpecSupport import com.hhandoko.realworld.core.Article class Article...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/ArticleRoutesSpec.scala
<filename>src/test/scala/com/hhandoko/realworld/route/ArticleRoutesSpec.scala<gh_stars>10-100 package com.hhandoko.realworld.route import java.time.ZonedDateTime import scala.concurrent.ExecutionContext import cats.effect.{ContextShift, IO} import org.http4s._ import org.http4s.implicits._ import org.specs2.Specifica...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/config/Config.scala
package com.hhandoko.realworld.config final case class Config(server: ServerConfig, db: DbConfig, log: LogConfig)
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/auth/RequestAuthenticator.scala
<gh_stars>10-100 package com.hhandoko.realworld.auth import cats.Monad import cats.data.{Kleisli, OptionT} import org.http4s.server.AuthMiddleware import org.http4s.util.CaseInsensitiveString import org.http4s.{AuthedRoutes, Header, HttpRoutes, Request} import com.hhandoko.realworld.core.{JwtToken, Username} class R...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/TagRoutesSpec.scala
<reponame>hhandoko/scala-http4s-realworld-example-app<gh_stars>10-100 package com.hhandoko.realworld.route import scala.concurrent.ExecutionContext import cats.effect.{ContextShift, IO} import org.http4s._ import org.http4s.implicits._ import org.specs2.Specification import org.specs2.matcher.MatchResult import com....
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/util/LazyInitRollingFileAppender.scala
package com.hhandoko.realworld.util import java.util.concurrent.atomic.AtomicBoolean import ch.qos.logback.core.rolling.RollingFileAppender import org.graalvm.nativeimage.ImageInfo /** * RollingFileAppender with lazy initialization on GraalVM native image. * * Logback's rolling file appended does not work with Gr...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/config/ServerConfig.scala
package com.hhandoko.realworld.config final case class ServerConfig(host: String, port: Int)
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/common/UserResponse.scala
package com.hhandoko.realworld.route.common import io.circe.{Encoder, Json} import org.http4s.circe.jsonEncoderOf import org.http4s.EntityEncoder final case class UserResponse( email: String, token: String, username: String, bio: Option[String], image: Option[String] ) object UserResponse { implicit val ...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/core/Username.scala
<reponame>hhandoko/scala-http4s-realworld-example-app<filename>src/main/scala/com/hhandoko/realworld/core/Username.scala package com.hhandoko.realworld.core final case class Username(value: String) extends AnyVal
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/TagRoutes.scala
<gh_stars>10-100 package com.hhandoko.realworld.route import cats.effect.Sync import cats.implicits._ import io.circe.{Encoder, Json} import org.http4s.circe.jsonEncoderOf import org.http4s.dsl.Http4sDsl import org.http4s.{EntityEncoder, HttpRoutes} import com.hhandoko.realworld.core.Tag import com.hhandoko.realworld...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/UserRoutes.scala
package com.hhandoko.realworld.route import cats.effect.Sync import cats.implicits._ import org.http4s.dsl.Http4sDsl import org.http4s.{AuthedRoutes, HttpRoutes} import com.hhandoko.realworld.auth.RequestAuthenticator import com.hhandoko.realworld.core.Username import com.hhandoko.realworld.route.common.UserResponse ...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/auth/JwtSupport.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.auth import scala.util.Try import com.auth0.jwt.JWT import com.auth0.jwt.algorithms.Algorithm import com.hhandoko.realworld.core.{JwtToken, Username} trait JwtSupport { final val CLAIM_USERNAME = "username" // TODO: Move to c...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/ProfileService.scala
package com.hhandoko.realworld.service import cats.Applicative import com.hhandoko.realworld.core.{Profile, Username} trait ProfileService[F[_]] { def get(username: Username): F[Option[Profile]] } object ProfileService { def apply[F[_]: Applicative]: ProfileService[F] = new ProfileService[F] { import...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/ProfileRoutesSpec.scala
package com.hhandoko.realworld.route import scala.concurrent.ExecutionContext import cats.effect.{ContextShift, IO} import org.http4s._ import org.http4s.implicits._ import org.specs2.Specification import org.specs2.matcher.MatchResult import com.hhandoko.realworld.core.{Profile, Username} import com.hhandoko.realwo...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/RepoSpecSupport.scala
package com.hhandoko.realworld import java.util.UUID import javax.sql.DataSource import cats.effect.{ContextShift, IO, Resource} import doobie.implicits._ import doobie.util.ExecutionContexts import doobie.util.fragment.Fragment import doobie.util.transactor.Transactor import org.flywaydb.core.Flyway import org.h2.jd...
hhandoko/scala-http4s-realworld-example-app
build.sbt
<filename>build.sbt enablePlugins(FlywayPlugin) enablePlugins(JavaAppPackaging) lazy val realworld = (project in file(".")) .settings(Common.settings: _*)
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/config/DbConfig.scala
<filename>src/main/scala/com/hhandoko/realworld/config/DbConfig.scala package com.hhandoko.realworld.config final case class DbConfig( driver: String, url: String, user: String, password: String, pool: Int )
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/query/PaginationSpec.scala
package com.hhandoko.realworld.route.query import org.specs2.Specification import org.specs2.matcher.MatchResult import com.hhandoko.realworld.service.query.Pagination class PaginationSpec extends Specification { def is = s2""" Pagination query params object when limit and offset is not defined should u...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/AuthRoutes.scala
<filename>src/main/scala/com/hhandoko/realworld/route/AuthRoutes.scala package com.hhandoko.realworld.route import cats.effect.Sync import cats.implicits._ import io.circe.generic.auto._ import org.http4s.circe.{jsonEncoderOf, jsonOf} import org.http4s.dsl.Http4sDsl import org.http4s.{EntityEncoder, HttpRoutes} impor...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/UserService.scala
package com.hhandoko.realworld.service import cats.Applicative import com.hhandoko.realworld.auth.JwtSupport import com.hhandoko.realworld.core.{User, Username} trait UserService[F[_]] { def get(username: Username): F[Option[User]] } object UserService extends JwtSupport { def apply[F[_]: Applicative]: UserSer...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/repository/UserRepoSpec.scala
package com.hhandoko.realworld.repository import cats.effect.IO import doobie.implicits._ import doobie.specs2.IOChecker import org.specs2.mutable.Specification import com.hhandoko.realworld.RepoSpecSupport import com.hhandoko.realworld.core.{Profile, Username} class UserRepoSpec extends Specification with RepoSpe...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/query/Pagination.scala
package com.hhandoko.realworld.service.query import com.hhandoko.realworld.service.query.Pagination.{DEFAULT_LIMIT, DEFAULT_OFFSET} /** See: https://github.com/gothinkster/realworld/tree/master/api#list-articles */ final case class Pagination(limit: Int = DEFAULT_LIMIT, offset: Int = DEFAULT_OFFSET) object Paginatio...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/core/Tag.scala
package com.hhandoko.realworld.core final case class Tag(value: String) extends AnyVal
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/auth/JwtSupportSpec.scala
<reponame>hhandoko/scala-http4s-realworld-example-app<gh_stars>10-100 package com.hhandoko.realworld.auth import scala.util.Random import org.specs2.Specification import org.specs2.matcher.MatchResult import com.hhandoko.realworld.core.{JwtToken, Username} class JwtSupportSpec extends Specification { def is = s2"""...
hhandoko/scala-http4s-realworld-example-app
src/test/scala/com/hhandoko/realworld/route/AuthRoutesSpec.scala
<gh_stars>10-100 package com.hhandoko.realworld.route import scala.concurrent.ExecutionContext import cats.effect.{ContextShift, IO} import cats.implicits._ import org.http4s.implicits._ import org.http4s.{Method, Request, Response, Status} import org.specs2.Specification import org.specs2.matcher.MatchResult import...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/ProfileRoutes.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.route import cats.effect.Sync import cats.implicits._ import io.circe.{Encoder, Json} import org.http4s.circe.jsonEncoderOf import org.http4s.dsl.Http4sDsl import org.http4s.{EntityEncoder, HttpRoutes} import com.hhandoko.realworld.c...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/TagService.scala
package com.hhandoko.realworld.service import cats.Applicative import com.hhandoko.realworld.core.Tag trait TagService[F[_]] { def getAll: F[Vector[Tag]] } object TagService { def apply[F[_]: Applicative]: TagService[F] = new TagService[F] { import cats.implicits._ def getAll: F[Vector[Tag]] =...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/service/AuthService.scala
package com.hhandoko.realworld.service import cats.Applicative import com.hhandoko.realworld.auth.JwtSupport import com.hhandoko.realworld.core.{User, Username} trait AuthService[F[_]] { type Email = String type Password = String def verify(email: Email, password: Password): F[Either[String, User]] } object A...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/core/Profile.scala
package com.hhandoko.realworld.core sealed trait ProfileAttributes { def username: Username def bio: Option[String] def image: Option[String] } final case class Profile( username: Username, bio: Option[String], image: Option[String] ) extends ProfileAttributes final case class User( username: Username,...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/Server.scala
<reponame>hhandoko/scala-http4s-realworld-example-app<filename>src/main/scala/com/hhandoko/realworld/Server.scala package com.hhandoko.realworld import scala.concurrent.ExecutionContext import cats.effect.{Async, Blocker, ConcurrentEffect, ContextShift, Resource, Sync, Timer} import cats.implicits._ import doobie.hik...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/Application.scala
<filename>src/main/scala/com/hhandoko/realworld/Application.scala package com.hhandoko.realworld import cats.effect.{ExitCode, IO, IOApp} object Application extends IOApp { override def run(args: List[String]): IO[ExitCode] = Server.run[IO] .use(_ => IO.never) .as(ExitCode.Success) }
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/route/ArticleRoutes.scala
package com.hhandoko.realworld.route import java.time.format.DateTimeFormatter import cats.effect.Sync import cats.implicits._ import io.circe.{Encoder, Json} import org.http4s.circe.jsonEncoderOf import org.http4s.dsl.Http4sDsl import org.http4s.dsl.impl.OptionalQueryParamDecoderMatcher import org.http4s.{EntityEnco...
hhandoko/scala-http4s-realworld-example-app
project/Common.scala
<reponame>hhandoko/scala-http4s-realworld-example-app import java.io.Closeable import scala.io.Source import io.github.davidmweber.FlywayPlugin.autoImport._ import sbt.Keys._ import sbt._ object Common { // Scala version private val scalaLibVersion = "2.13.5" // Dependency versions private val doobieVersion...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/repository/UserRepo.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.repository import cats.effect.Sync import doobie.implicits._ import doobie.util.fragment.Fragment import doobie.util.transactor.Transactor import com.hhandoko.realworld.core.{Profile, Username} trait UserRepo[F[_]] { def find(user...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/core/JwtToken.scala
package com.hhandoko.realworld.core final case class JwtToken(value: String) extends AnyVal
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/auth/UnauthorizedResponseSupport.scala
package com.hhandoko.realworld.auth import org.http4s.Challenge import org.http4s.headers.`WWW-Authenticate` trait UnauthorizedResponseSupport { private final val SCHEME = "Token" private final val REALM = "realworld" // TODO: Split to invalid_request and invalid_token // Refer to: // - https://tools.ie...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/config/LogConfig.scala
<reponame>hhandoko/scala-http4s-realworld-example-app<filename>src/main/scala/com/hhandoko/realworld/config/LogConfig.scala package com.hhandoko.realworld.config final case class LogConfig(httpHeader: Boolean, httpBody: Boolean)
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/core/Article.scala
<reponame>hhandoko/scala-http4s-realworld-example-app package com.hhandoko.realworld.core import java.time.ZonedDateTime final case class Article( slug: String, title: String, description: String, body: String, tagList: Set[String], createdAt: ZonedDateTime, updatedAt: ZonedDateTime, favorited: Boolea...
hhandoko/scala-http4s-realworld-example-app
src/main/scala/com/hhandoko/realworld/repository/ArticleRepo.scala
package com.hhandoko.realworld.repository import java.time.ZonedDateTime import cats.syntax.functor._ import doobie.Read import com.hhandoko.realworld.core.{Author, Username} import cats.effect.Effect import doobie.Fragment import doobie.implicits._ import doobie.util.transactor.Transactor import com.hhandoko.realw...
ivoson/delta
project/MimaExcludes.scala
<gh_stars>1-10 /* * Copyright 2019 Databricks, Inc. * * Licensed 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 l...
ivoson/delta
src/main/scala/org/apache/spark/sql/delta/Snapshot.scala
/* * Copyright 2019 Databricks, Inc. * * Licensed 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...
nokia-wroclaw/innovativeproject-notifications
notifications/build.sbt
name := """notifications""" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.7" libraryDependencies ++= Seq( javaJdbc, cache, javaWs, filters ) libraryDependencies += "com.rabbitmq" % "amqp-client" % "3.6.5" libraryDependencies += "mysql" % "mys...
Ahmed-elsayed-mahmoud/incubator-openwhisk
common/scala/src/main/scala/whisk/core/connector/MessageConsumer.scala
/* * 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 ...
KyleErwin/cilib
work/src/main/scala/cilib/work/Main.scala
package cilib package work import scalaz.effect.IO._ import scalaz.effect.{IO, SafeApp} object Main extends SafeApp { override val runc: IO[Unit] = putStrLn("Hello world") }
KyleErwin/cilib
build.sbt
import sbt._ import sbt.Keys._ import sbtrelease.ReleaseStateTransformations._ val scalazVersion = "7.2.25" val scalazStreamVersion = "0.8.6a" val spireVersion = "0.13.0" val monocleVersion = "1.5.0" val scalacheckVersion = "1.14.0" val avro4sVersion = "1.8.3" val previousArtifactVersion = SettingKey[Stri...
az82/micronaut-opa-demo
src/gatling/simulations/de/az/demo/mn/opa/DemoSimulation.scala
<reponame>az82/micronaut-opa-demo package de.az.demo.mn.opa import io.gatling.core.Predef._ import io.gatling.http.Predef._ import scala.concurrent.duration._ /** * Gatling simulation for the Micronaut / OPA demo application */ class DemoSimulation extends Simulation { val appHost: String = getenv("app.host"...
nelsonblaha/playframework
framework/src/play-java-ws/src/main/java/play/libs/ws/util/CollectionUtil.scala
<filename>framework/src/play-java-ws/src/main/java/play/libs/ws/util/CollectionUtil.scala package play.libs.ws.util import java.{util =>ju} import scala.collection.convert.WrapAsJava._ /** Utility class for converting a Scala `Map` with a nested collection type into its idiomatic Java counterpart. * The reason why...
nelsonblaha/playframework
framework/src/iteratees/src/main/scala/play/api/libs/iteratee/RunQueue.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.iteratee import scala.annotation.tailrec import scala.concurrent.{ ExecutionContext, Future } import java.util.concurrent.atomic.AtomicReference /** * Runs asynchronous operations in order. Operations are queued until * ...
nelsonblaha/playframework
framework/src/run-support/src/main/scala/play/runsupport/FileWatchService.scala
<filename>framework/src/run-support/src/main/scala/play/runsupport/FileWatchService.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.runsupport import java.net.URLClassLoader import java.util.List import java.util.Locale import sbt._ import sbt.Path._ import scala.collecti...
nelsonblaha/playframework
framework/src/play-jdbc/src/main/scala/play/api/db/DB.scala
<filename>framework/src/play-jdbc/src/main/scala/play/api/db/DB.scala<gh_stars>0 /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.db import java.sql.Connection import javax.sql.DataSource import play.api.Application /** * Provides a high-level API for getting JDBC connectio...
nelsonblaha/playframework
framework/src/play-ws/src/test/scala/play/api/libs/ws/WSRequestHolderSpec.scala
package play.api.libs.ws import org.specs2.mutable.Specification import play.api.test.WithApplication class WSRequestHolderSpec extends Specification { "WSRequestHolder" should { "give the full URL with the query string" in new WithApplication() { val ws = app.injector.instanceOf[WSClient] ws.ur...
nelsonblaha/playframework
framework/src/play-streams/src/main/scala/play/api/libs/streams/Probes.scala
<filename>framework/src/play-streams/src/main/scala/play/api/libs/streams/Probes.scala package play.api.libs.streams import org.reactivestreams.{ Subscription, Subscriber, Publisher } /** * Probes, for debugging reactive streams. */ object Probes { private trait Probe { def startTime: Long def time = Sy...
nelsonblaha/playframework
framework/src/play-ws/src/main/scala/play/api/libs/ws/ssl/package.scala
<reponame>nelsonblaha/playframework<filename>framework/src/play-ws/src/main/scala/play/api/libs/ws/ssl/package.scala<gh_stars>1-10 /* * * * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> * */ package play.api.libs.ws import java.security.cert.{ PKIXCertPathValidatorResult, CertPathValidatorResult...
nelsonblaha/playframework
framework/src/sbt-plugin/src/sbt-test/play-sbt-plugin/multiproject/transitive/app/Transitive.scala
<reponame>nelsonblaha/playframework /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ object Transitive
nelsonblaha/playframework
documentation/manual/working/scalaGuide/main/http/code/ScalaContentNegotiation.scala
<filename>documentation/manual/working/scalaGuide/main/http/code/ScalaContentNegotiation.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package scalaguide.http.scalacontentnegotiation { import play.api.mvc._ import play.api.test._ import play.api.test.Helpers._ import org.specs...
nelsonblaha/playframework
documentation/manual/working/scalaGuide/main/tests/code/specs2/ExampleEssentialActionSpec.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package scalaguide.tests.specs2 import play.api.mvc._ import play.api.test._ import play.api.mvc.Results._ import play.api.libs.json.Json // #scalatest-exampleessentialactionspec object ExampleEssentialActionSpec extends PlaySpecification { ...
nelsonblaha/playframework
framework/src/play/src/test/scala/play/api/libs/iteratee/TestChannel.scala
<filename>framework/src/play/src/test/scala/play/api/libs/iteratee/TestChannel.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.iteratee import java.lang.{ Boolean => JBoolean } import java.util.concurrent.LinkedBlockingQueue import java.util.function.{ BiFunction, ...
nelsonblaha/playframework
framework/src/play-streams/src/main/scala/play/api/libs/streams/impl/EnumeratorPublisher.scala
package play.api.libs.streams.impl import org.reactivestreams._ import play.api.libs.concurrent.StateMachine import play.api.libs.iteratee._ import scala.concurrent.Promise import scala.util.{ Failure, Success, Try } import scala.language.higherKinds /** * Creates Subscriptions that link Subscribers to an Enumerato...
nelsonblaha/playframework
framework/src/play-ws/src/main/scala/play/api/libs/ws/ssl/debug/FixCertpathDebugLogging.scala
<gh_stars>1-10 /* * * * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> * */ package play.api.libs.ws.ssl.debug import java.security.AccessController import scala.util.control.NonFatal import sun.security.util.Debug /** * This singleton object turns on "certpath" debug logging (originally based ...
nelsonblaha/playframework
framework/src/play-server/src/main/scala/play/core/server/ServerStartException.scala
<gh_stars>1-10 /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.core.server /** * Indicates an issue with starting a server, e.g. a problem reading its * configuration. */ final case class ServerStartException(message: String, cause: Option[Throwable] = None) extends Exception(...
nelsonblaha/playframework
documentation/manual/detailedTopics/configuration/filters/code/CorsFilter.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package detailedtopics.configuration.cors.sapi //#filters import javax.inject.Inject import play.api.http.HttpFilters import play.filters.cors.CORSFilter class Filters @Inject() (corsFilter: CORSFilter) extends HttpFilters { def filters = Se...
nelsonblaha/playframework
framework/src/sbt-plugin/src/main/scala/play/sbt/PlayRunHook.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.sbt import java.net.InetSocketAddress /** * The represents an object which "hooks into" play run, and is used to * apply startup/cleanup actions around a play application. */ trait PlayRunHook extends play.runsupport.RunHook ob...
nelsonblaha/playframework
framework/src/play/src/main/scala/play/core/parsers/Multipart.scala
<filename>framework/src/play/src/main/scala/play/core/parsers/Multipart.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.core.parsers import akka.stream.Materializer import akka.stream.scaladsl._ import akka.stream.stage.{ TerminationDirective, SyncDirective, Context, PushPu...
nelsonblaha/playframework
framework/src/play-filters-helpers/src/main/scala/play/filters/csrf/csrf.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.filters.csrf import java.util.Optional import akka.stream.Materializer import com.typesafe.config.ConfigMemorySize import play.filters.csrf.CSRF.{ CSRFHttpErrorHandler, ErrorHandler } import play.mvc.Http import play.utils.Reflect ...
nelsonblaha/playframework
framework/src/play-integration-test/src/test/scala/play/it/http/parsing/XmlBodyParserSpec.scala
<reponame>nelsonblaha/playframework /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.it.http.parsing import akka.stream.Materializer import akka.stream.scaladsl.Source import akka.util.ByteString import play.api.test._ import play.api.mvc.{ BodyParser, BodyParsers } import scala.x...
nelsonblaha/playframework
framework/src/run-support/src/test/scala/play/runsupport/GlobalStaticVarSpec.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.runsupport import org.specs2.mutable.Specification class GlobalStaticVarSpec extends Specification { "global static var" should { "support setting and getting" in { try { GlobalStaticVar.set("message", "hello w...
nelsonblaha/playframework
framework/src/play/src/main/scala/play/api/inject/guice/GuiceApplicationBuilder.scala
<gh_stars>0 /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.inject.guice import javax.inject.{ Provider, Inject } import com.google.inject.{ Module => GuiceModule } import play.api.routing.Router import play.api._ import play.api.inject.{ Injector => PlayInjector, RoutesProv...
nelsonblaha/playframework
framework/src/play-filters-helpers/src/test/scala/play/filters/csrf/JavaCSRFActionSpec.scala
<gh_stars>0 /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.filters.csrf import java.util.concurrent.CompletableFuture import play.api.libs.Crypto import play.api.mvc.Session import play.core.routing.HandlerInvokerFactory import play.mvc.Http.{ RequestHeader, Context } import s...
nelsonblaha/playframework
framework/src/play-streams/src/main/scala/play/api/libs/streams/AkkaStreams.scala
package play.api.libs.streams import akka.stream.scaladsl.FlexiMerge.{ MergeLogic, ReadAny } import akka.stream.scaladsl._ import akka.stream.{ Attributes, UniformFanInShape } import play.api.libs.iteratee._ import scala.util.{ Failure, Success } /** * Utilities for */ object AkkaStreams { /** * Bypass the g...
nelsonblaha/playframework
framework/src/play-json/src/main/scala/play/api/libs/json/package.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs /** * Json API * For example: * {{{ * import play.api.libs.json._ * import play.api.libs.functional.syntax._ * * case class User(id: Long, name: String, friends: Seq[User] = Seq.empty) * object User { * * // In ...
nelsonblaha/playframework
framework/src/play-json/src/main/scala/play/api/libs/json/Json.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.json import java.io.InputStream import play.api.libs.iteratee.Execution.Implicits.defaultExecutionContext import play.api.libs.json.jackson.JacksonJson /** * Helper functions to handle JsValues. */ object Json { /** ...
nelsonblaha/playframework
documentation/manual/working/scalaGuide/main/sql/code/ScalaInjectNamed.scala
<reponame>nelsonblaha/playframework package scalaguide.sql import javax.inject.Inject import play.api.db.{ Database, NamedDatabase } import play.api.mvc.Controller // inject "orders" database instead of "default" class ScalaInjectNamed @Inject()( @NamedDatabase("orders") db: Database) extends Controller { // do w...
nelsonblaha/playframework
framework/src/play-akka-http-server/src/main/scala/play/core/server/akkahttp/AkkaHttpServer.scala
<filename>framework/src/play-akka-http-server/src/main/scala/play/core/server/akkahttp/AkkaHttpServer.scala package play.core.server.akkahttp import akka.actor.ActorSystem import akka.http.play.WebSocketHandler import akka.http.scaladsl.Http import akka.http.scaladsl.model._ import akka.http.scaladsl.model.headers.Exp...
nelsonblaha/playframework
framework/src/play-integration-test/src/test/scala/play/it/http/websocket/WebSocketClient.scala
<filename>framework/src/play-integration-test/src/test/scala/play/it/http/websocket/WebSocketClient.scala /** * Some elements of this were copied from: * * https://gist.github.com/casualjim/1819496 */ package play.it.http.websocket import java.io.IOException import org.jboss.netty.bootstrap.ClientBootstrap import...
nelsonblaha/playframework
framework/src/sbt-fork-run-plugin/src/sbt-test/fork-run/dev-mode/build.sbt
<filename>framework/src/sbt-fork-run-plugin/src/sbt-test/fork-run/dev-mode/build.sbt lazy val root = (project in file(".")).enablePlugins(PlayScala) DevModeBuild.settings fork in run := true // This actually doesn't do anything, since the build runs in a forked sbt server which doesn't have the same // system proper...
nelsonblaha/playframework
framework/src/play/src/main/scala/play/api/libs/EventSource.scala
<filename>framework/src/play/src/main/scala/play/api/libs/EventSource.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs import play.api.http.{ ContentTypeOf, ContentTypes, Writeable } import play.api.mvc._ import play.api.libs.iteratee._ import play.core.Execution.I...
nelsonblaha/playframework
documentation/manual/working/scalaGuide/advanced/routing/code/scalaguide/binder/controllers/BinderApplication.scala
package scalaguide.binder.controllers import play.api._ import play.api.mvc._ import scalaguide.binder.models._ class BinderApplication extends Controller{ //#path def user(user: User) = Action { Ok(user.name) } //#path //#query def age(age: AgeRange) = Action { Ok(age.from.toString) } //#...
nelsonblaha/playframework
framework/src/play/src/main/scala/play/core/system/RequestIdProvider.scala
<gh_stars>1-10 /* * Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com> */ package play.core.system import java.util.concurrent.atomic.AtomicLong; private[play] object RequestIdProvider { val requestIDs: AtomicLong = new AtomicLong(0) }
nelsonblaha/playframework
framework/src/run-support/src/main/scala/play/runsupport/NamedURLClassLoader.scala
<reponame>nelsonblaha/playframework package play.runsupport import java.net.{ URL, URLClassLoader } /** * A ClassLoader with a toString() that prints name/urls. */ class NamedURLClassLoader(name: String, urls: Array[URL], parent: ClassLoader) extends URLClassLoader(urls, parent) { override def toString = name + "...
nelsonblaha/playframework
framework/src/play-server/src/test/scala/play/core/server/common/ForwardedHeaderHandlerSpec.scala
<reponame>nelsonblaha/playframework<filename>framework/src/play-server/src/test/scala/play/core/server/common/ForwardedHeaderHandlerSpec.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.core.server.common import java.net.InetAddress import org.specs2.mutable.Specification im...
nelsonblaha/playframework
framework/src/play-java-ws/src/test/scala/play/libs/ws/WSSpec.scala
<filename>framework/src/play-java-ws/src/test/scala/play/libs/ws/WSSpec.scala package play.libs.ws import play.api.mvc.{ Result, Action } import play.api.mvc.Results._ import play.api.test._ object WSSpec extends PlaySpecification { sequential val uploadApp = FakeApplication(withRoutes = { case ("POST", "/"...
nelsonblaha/playframework
framework/src/play/src/main/scala/views/defaultpages/package.scala
<filename>framework/src/play/src/main/scala/views/defaultpages/package.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package views.html /** * Contains default error, 404, forbidden, etc. pages. */ package object defaultpages
nelsonblaha/playframework
framework/src/play-streams/src/test/scala/play/api/libs/streams/impl/PublisherEvents.scala
/* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.streams.impl import org.reactivestreams._ import scala.concurrent._ object PublisherEvents { case class RequestMore(elementCount: Long) case object Cancel } trait PublisherEvents[T] { self: EventRecorder => impor...
nelsonblaha/playframework
framework/src/play-ws/src/main/scala/play/api/libs/oauth/package.scala
<reponame>nelsonblaha/playframework /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs /** * OAuth integration helpers. */ package object oauth
nelsonblaha/playframework
framework/src/iteratees/src/main/scala/play/api/libs/iteratee/package.scala
<filename>framework/src/iteratees/src/main/scala/play/api/libs/iteratee/package.scala /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs { /** * The Iteratee monad provides strict, safe, and functional I/O. */ package object iteratee { type K[E, A] = Input[E]...
nelsonblaha/playframework
framework/src/play-functional/src/main/scala/play/api/libs/functional/syntax/package.scala
<reponame>nelsonblaha/playframework /* * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package play.api.libs.functional.syntax import scala.language.higherKinds import scala.language.implicitConversions import play.api.libs.functional._ /** * Don't forget to {{{import play.api.libs.functional...