activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1417987 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/
Date Thu, 06 Dec 2012 16:32:27 GMT
Author: chirino
Date: Thu Dec  6 16:32:27 2012
New Revision: 1417987

URL: http://svn.apache.org/viewvc?rev=1417987&view=rev
Log:
Fixes APLO-274: Support accessing environment variables via ${env.*} references in the the
config file.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1417987&r1=1417986&r2=1417987&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Thu Dec  6 16:32:27 2012
@@ -42,6 +42,7 @@ import org.xml.sax.InputSource
 import java.util
 import javax.management.openmbean.CompositeData
 import javax.net.ssl.SSLContext
+import util.Properties
 
 /**
  * <p>
@@ -65,7 +66,15 @@ object BrokerFactory {
 
   val finder = new ClassFinder[BrokerFactoryTrait]("META-INF/services/org.apache.activemq.apollo/broker-factory.index",classOf[BrokerFactoryTrait])
 
-  def createBroker(brokerURI:String):Broker = createBroker(brokerURI, System.getProperties)
+  def createBroker(brokerURI:String):Broker = {
+    val props = new Properties
+    for( entry <- System.getenv().entrySet() ) {
+      props.put("env."+entry.getKey, entry.getValue)
+    }
+    props.putAll(System.getProperties)
+    createBroker(brokerURI, props)
+  }
+
   def createBroker(uri:String, props:util.Properties):Broker = {
     if( uri == null ) {
       return null

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=1417987&r1=1417986&r2=1417987&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
Thu Dec  6 16:32:27 2012
@@ -63,7 +63,11 @@ object ConfigStore {
   }
 
   def config_properties(file:File): Properties = {
+    import collection.JavaConversions._
     val props = new Properties()
+    for( entry <- System.getenv().entrySet() ) {
+      props.put("env."+entry.getKey, entry.getValue)
+    }
     props.putAll(System.getProperties)
     if( file!=null ) {
       val prop_file = file.getParentFile / (file.getName + ".properties")

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala?rev=1417987&r1=1417986&r2=1417987&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala
Thu Dec  6 16:32:27 2012
@@ -119,6 +119,9 @@ object BrokerService extends Log {
         info("Loading configuration file '%s'.", apollo_xml)
 
         val props = new Properties()
+        for( entry <- System.getenv().entrySet() ) {
+          props.put("env."+entry.getKey, entry.getValue)
+        }
         props.putAll(System.getProperties)
         if( cmProps!=null ) {
           cmProps.keySet.foreach { key =>



Mime
View raw message