activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1058635 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
Date Thu, 13 Jan 2011 16:03:20 GMT
Author: chirino
Date: Thu Jan 13 16:03:19 2011
New Revision: 1058635

URL: http://svn.apache.org/viewvc?rev=1058635&view=rev
Log:
Better config validation and web server now stops properly (was hanging)

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala?rev=1058635&r1=1058634&r2=1058635&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
Thu Jan 13 16:03:19 2011
@@ -43,11 +43,34 @@ object JettyWebServerFactory extends Web
   def create(broker:Broker): WebServer = new JettyWebServer(broker)
 
   def validate(config: WebAdminDTO, reporter: Reporter): ReporterLevel.ReporterLevel = {
-    ReporterLevel.INFO
+    import ReporterLevel._
+    if( JettyWebServer.webapp==null ) {
+      reporter.report(ERROR, "The apollo.home or apollo.webapp system property must be set
so that the webconsole can be started.")
+      return ERROR
+    }
+    return INFO
   }
 }
 
-object JettyWebServer extends Log
+object JettyWebServer extends Log {
+
+  val LOAD_JETTY = classOf[LoginService]
+
+  val webapp = {
+    import FileSupport._
+
+    val x = System.getProperty("apollo.webapp")
+    if( x != null ) {
+      new File(x)
+    } else {
+      (Option(System.getProperty("apollo.home")).flatMap { home=>
+        val lib = new File(home) / "lib"
+        lib.list.find( _.matches("""apollo-web-.+-slim.war""")).map(lib / _)
+      }).getOrElse(null)
+    }
+  }
+
+}
 
 class JettyWebServer(val broker:Broker) extends WebServer with BaseService {
   import JettyWebServer._
@@ -84,17 +107,6 @@ class JettyWebServer(val broker:Broker) 
       connector.setPort(port)
 
 
-      val webapp = {
-        val x = System.getProperty("apollo.webapp")
-        if( x != null ) {
-          new File(x)
-        } else {
-          val home = system_dir("apollo.home")
-          val lib = home / "lib"
-          lib / lib.list.find( _.matches("""apollo-web-.+-slim.war""")).get
-        }
-      }
-
       def admin_app = {
         var app_context = new WebAppContext
         app_context.setContextPath(prefix)
@@ -150,6 +162,7 @@ class JettyWebServer(val broker:Broker) 
     this.synchronized {
       server.stop
       server = null
+      on_completed.run
     }
   }
 



Mime
View raw message