changeset 57:bcb0d5dd2b54

~ allow user to choose his port
author Denis Ah-Kang <denis@w3.org>
date Fri, 30 Sep 2011 13:53:11 +0200
parents b95d26ca1363
children 6568ebb8f3e1
files src/main/scala/Main.scala
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/scala/Main.scala	Fri Sep 30 13:52:44 2011 +0200
+++ b/src/main/scala/Main.scala	Fri Sep 30 13:53:11 2011 +0200
@@ -22,7 +22,6 @@
  * 
  */
 
-
 case class XSLTStreamer(proc:Processor, exp:XsltExecutable) {
 
   def apply(url:URL, params:Map[String, String] = Map()):ResponseStreamer = new ResponseStreamer {
@@ -37,7 +36,6 @@
       trans.transform()
     }
   }
-
 }
 
 object XSLTStreamer {
@@ -50,8 +48,6 @@
     val exp:XsltExecutable = comp.compile(xsltStreamSource)
     XSLTStreamer(proc, exp)
   }
-
-
 }
 
 
@@ -65,9 +61,20 @@
 
   def main(args: Array[String]) {
 
-    args.toList match {
-      case dir :: _ => ResponseCache.setDefault(URLResolver(dir))
-      case _        => Console.err.println("You must provide a path for the URLResolver"); System.exit(1)
+    val argsList = args.toList
+    
+    val (port, dir) = argsList match {
+      case port :: dir :: _ => (port.toInt, ResponseCache.setDefault(URLResolver(dir)))
+      case _        => {
+        println(
+"""
+You must provide a port and a path for the URLResolver
+usage: 
+java -jar target/pubrules-checker.jar 8080 src/main/resources
+""")
+        System.exit(1)
+        null
+      }
     }
 
     val echo = unfiltered.filter.Planify {
@@ -127,7 +134,7 @@
       }
     }
 
-    unfiltered.jetty.Http(2719).filter(pubrules).filter(trdoc2rdf).filter(echo).run()
+    unfiltered.jetty.Http(port).filter(pubrules).filter(trdoc2rdf).filter(echo).run()
 
   }
 
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.