activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1159613 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/ apollo-cli/src/main/resources/org/apache/activemq/apollo/cl...
Date Fri, 19 Aug 2011 12:35:32 GMT
Author: chirino
Date: Fri Aug 19 12:35:32 2011
New Revision: 1159613

URL: http://svn.apache.org/viewvc?rev=1159613&view=rev
Log:
Report an error if a store is not configured.  Better default log4j config setup.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/StoreFactory.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/log4j.properties
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/NullStoreDTO.java
    activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
Fri Aug 19 12:35:32 2011
@@ -21,9 +21,9 @@ import security.EncryptionSupport
 import org.apache.activemq.apollo.util._
 import FileSupport._
 import java.util.Properties
-import org.apache.activemq.apollo.dto.{XmlCodec, BrokerDTO}
 import java.io.{InputStream, FileInputStream, File}
 import javax.xml.bind.{ValidationEvent, ValidationEventHandler}
+import org.apache.activemq.apollo.dto.{NullStoreDTO, XmlCodec, BrokerDTO}
 
 /**
  * <p>
@@ -42,7 +42,7 @@ object ConfigStore {
   }
 
   def load(is: => InputStream, prop:Properties, func: (String)=>Unit):BrokerDTO = {
-    XmlCodec.decode(classOf[BrokerDTO], is, prop, new ValidationEventHandler(){
+    val rc = XmlCodec.decode(classOf[BrokerDTO], is, prop, new ValidationEventHandler(){
         def handleEvent(event: ValidationEvent): Boolean = {
           val level = event.getSeverity match {
             case 0=> "warning"
@@ -53,6 +53,13 @@ object ConfigStore {
           true
         }
     })
+    import collection.JavaConversions._
+    for( host <- rc.virtual_hosts ) {
+      if( host.store == null ) {
+        func("error: virtual host '%s' does not have valid store configured".format(host.id))
+      }
+    }
+    rc
   }
 
   def config_properties(file:File): Properties = {

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/StoreFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/StoreFactory.scala?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/StoreFactory.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/StoreFactory.scala
Fri Aug 19 12:35:32 2011
@@ -16,8 +16,8 @@ package org.apache.activemq.apollo.broke
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import org.apache.activemq.apollo.dto.StoreDTO
 import org.apache.activemq.apollo.util._
+import org.apache.activemq.apollo.dto.{NullStoreDTO, StoreDTO}
 
 /**
  * <p>
@@ -33,17 +33,17 @@ object StoreFactory {
 
   val providers = new ClassFinder[Provider]("META-INF/services/org.apache.activemq.apollo/store-factory.index",
classOf[Provider])
 
-  def create(config:StoreDTO):Store = {
-    if( config == null ) {
-      return null
-    }
-    providers.singletons.foreach { provider=>
-      val rc = provider.create(config)
-      if( rc!=null ) {
-        return rc
+  def create(config:StoreDTO):Store = config match {
+    case null => null
+    case config:NullStoreDTO => null
+    case _ =>
+      providers.singletons.foreach { provider=>
+        val rc = provider.create(config)
+        if( rc!=null ) {
+          return rc
+        }
       }
-    }
-    throw new IllegalArgumentException("Uknonwn store type: "+config.getClass)
+      throw new IllegalArgumentException("Uknonwn store type: "+config.getClass)
   }
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/log4j.properties?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/log4j.properties
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/log4j.properties
Fri Aug 19 12:35:32 2011
@@ -18,13 +18,16 @@
 #
 # Setup the default logging levels
 #
-log4j.rootLogger=ERROR
-log4j.logger=WARN, console, apollo
-log4j.logger.org.apache.activemq.apollo=INFO, apollo
+log4j.rootLogger=WARN, console, apollo
 
 log4j.logger.console=INFO, console, apollo
+log4j.additivity.console=false
 log4j.logger.security=INFO, security
+log4j.additivity.security=false
 log4j.logger.connection=INFO, connection
+log4j.additivity.connection=false
+
+log4j.logger.org.apache.activemq.apollo=INFO
 
 #
 # Uncomment one of the following to enable debug logging

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
Fri Aug 19 12:35:32 2011
@@ -87,18 +87,18 @@ class Run extends Action {
         broker.config = ConfigStore.load(conf, validation_messages += _)
       } finally {
         if( !validation_messages.isEmpty && broker.config.validation != "hide") {
-          println("")
-          println("Broker configuration file failed the following validations:")
+          Broker.warn("")
+          Broker.warn("Broker configuration file failed the following validations:")
           validation_messages.foreach{ v =>
-            println("")
-            println("  "+v)
+            Broker.warn("")
+            Broker.warn("  "+v)
           }
-          println("")
+          Broker.warn("")
         }
       }
 
       if( broker.config.validation == "strict" && !validation_messages.isEmpty) {
-        session.getConsole.println("Strict validation was configured, shutting down")
+        Broker.error("Strict validation was configured, shutting down")
         return null
       }
 

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/NullStoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/NullStoreDTO.java?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/NullStoreDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/NullStoreDTO.java
Fri Aug 19 12:35:32 2011
@@ -21,9 +21,8 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
- * Placeholder implementation fo a StoreDTO since JAXB
- * seems to fail with:
- * "Type <...> or any of its subclasses are not known to this context."
+ * The null store is used when you do NOT want to persistently
+ * store any of the messages.
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */

Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1159613&r1=1159612&r2=1159613&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original)
+++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Fri Aug
19 12:35:32 2011
@@ -95,6 +95,7 @@ single connector.
 
   <virtual_host id="default">
     <host_name>localhost</host_name>
+    <null_store/>
   </virtual_host>
 
   <connector id="tcp" bind="tcp://0.0.0.0:61613"/>
@@ -105,8 +106,7 @@ single connector.
 The broker, virtual host, and connector are assigned an id which which
 is used to by the REST based administration console to identify 
 the corresponding runtime resource.  The virtual host will not persist
-any messages sent to it since it does not have a configured messages 
-store.
+any messages sent to it since it is using the `null_store`.
 
 Brokers can be configured with multiple virtual hosts and connectors.
 



Mime
View raw message