Permalink
Browse files

main method

  • Loading branch information...
1 parent 9b1b1a5 commit 5e3700d262612260196e374b13138e56a9f3cbef matthew committed Aug 21, 2012
Showing with 47 additions and 0 deletions.
  1. +1 −0 build.sbt
  2. +46 −0 src/main/scala/com/foursquare/oozie/dashboard/JettyStart.scala
View
1 build.sbt
@@ -16,6 +16,7 @@ libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra-specs2" % "2.0.4" % "test",
"ch.qos.logback" % "logback-classic" % "1.0.0" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "7.6.0.v20120127" % "container",
+ "org.eclipse.jetty" % "jetty-webapp" % "7.6.0.v20120127",
"javax.servlet" % "servlet-api" % "2.5" % "provided",
"org.scalaj" %% "scalaj-collection" % "1.2",
"com.yahoo.oozie" % "oozie-client" % "2.3.2-cdh3u3",
View
46 src/main/scala/com/foursquare/oozie/dashboard/JettyStart.scala
@@ -0,0 +1,46 @@
+package com.foursquare.oozie.dashboard
+
+import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.servlet.{ServletContextHandler, ServletHolder}
+import org.scalatra.ScalatraServlet
+import org.scalatra.scalate.ScalateSupport
+import scalaj.collection.Imports._
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.server.handler.HandlerList;
+import org.eclipse.jetty.server.handler.ResourceHandler;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.webapp.WebAppContext;
+import java.text.SimpleDateFormat
+import java.util.Date
+
+object JettyLauncher {
+ def main(args: Array[String]) {
+ if (args.size < 1) {
+ println("usage: ./oozieDash <port>")
+ return
+ }
+ val port = args(0).toInt
+ val server = new Server(port)
+
+ val static = new ResourceHandler()
+ static.setResourceBase("src/main/webapp/static")
+ static.setDirectoriesListed(false)
+
+ val staticContext = new ContextHandler()
+ staticContext.setContextPath("/static");
+ staticContext.setHandler(static);
+
+ val root = new ServletContextHandler(ServletContextHandler.SESSIONS)
+ root.setContextPath("/")
+ root.addServlet(new ServletHolder(new OozieDashboard()), "/*")
+ root.setResourceBase("src/main/webapp")
+
+
+ val handlers = new HandlerList()
+ handlers.setHandlers(Array(staticContext, root))
+ server.setHandler(handlers)
+
+ server.start()
+ server.join()
+ }
+}

0 comments on commit 5e3700d

Please sign in to comment.