This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.makotan; | |
import org.vertx.java.core.Handler; | |
import org.vertx.java.core.SimpleHandler; | |
import org.vertx.java.core.impl.DefaultVertx; | |
import org.vertx.java.core.impl.VertxInternal; | |
import org.vertx.java.core.json.DecodeException; | |
import org.vertx.java.core.json.JsonObject; | |
import org.vertx.java.core.logging.Logger; | |
import org.vertx.java.core.logging.impl.LoggerFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class RetryException(throwables: List[Throwable]) extends Exception(throwables.toString()) | |
object RetryUtil { | |
import scala.util.control.Exception.allCatch | |
def retry[T](retryLimit: Int)(f: => T): T = | |
retry(retryLimit, 0, classOf[Throwable])(f) | |
def retry[T](retryLimit: Int, retryInterval: Int)(f: => T): T = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import org.vertx.java.core.Handler; | |
import org.vertx.java.core.http.HttpServer; | |
import org.vertx.java.core.http.HttpServerRequest; | |
import org.vertx.java.core.http.RouteMatcher; | |
import org.vertx.java.deploy.Verticle; | |
public class HttpRestVerticle1 extends Verticle { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version = '0.1-SNAPSHOT' | |
group = 'foo.bar' | |
task init << { | |
def ignores = ["/.*","/build","/lib","/bin","/repo" | |
,"/gradle*","!gradle","!gradle.bat" | |
,"target","/out","/logs","/log","/bin" | |
,"*.iml","*.ipr","*.iws",".idea" | |
,".DS_Store" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sample02 { | |
import sburi.b1._ | |
import scala.reflect.BeanInfo | |
@BeanInfo | |
class Sample02Entity( | |
var id:Long = 0 , | |
var name : String = "" , | |
var status : String = "") | |
class Sample02EntityPersistentPlugin extends PersistentPlugin[Sample02Entity,Long] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sburi | |
import scala.collection.mutable.MapBuilder | |
trait PersistentPlugin[Entity,IdType] { | |
def setStatus(e :Entity , state : String) | |
def save(e :Entity) | |
def getStatus(e :Entity) :Option[String] | |
def get(id:IdType) : Option[Entity] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(classOf[JUnitRunner]) | |
class Sample01 extends FunSuite { | |
import sburi._ | |
import scala.reflect.BeanInfo | |
@BeanInfo | |
class Sample01Entity( | |
var id:Long = 0 , | |
var name : String = "" , | |
var status : String = "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicReference | |
class LowUpdateHighReadList[T] { | |
val aList = new AtomicReference[List[T]] | |
aList.set(List()) | |
def list() : List[T] = aList.get() | |
def add(t : T) : List[T] = { | |
listUpdate(t::_) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def eith[R](arg: Either[Throwable, Any] ) : R = { | |
arg match { | |
case Left(e) => throw e | |
case Right(o:Either[Throwable, Any]) => eith(o) | |
case Right(o:R) => o | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testcase.vfs | |
import org.scalatest.FunSuite | |
import org.junit.runner.RunWith | |
import org.scalatest.junit.JUnitRunner | |
import org.apache.commons.vfs2.VFS | |
import java.io.BufferedOutputStream | |
import java.io.OutputStreamWriter | |
import java.io.BufferedWriter | |
import org.apache.commons.vfs2.FileObject | |
import org.apache.commons.vfs2.FileContent |
NewerOlder