You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2013/03/25 19:32:05 UTC
svn commit: r1460822 - in /geronimo/server/branches/3.0:
framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/
plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/
plugins/activemq/geroni...
Author: gawor
Date: Mon Mar 25 18:32:05 2013
New Revision: 1460822
URL: http://svn.apache.org/r1460822
Log:
make sure activemq uses the right config substitution values (e.g. if sustitution value is set via a system property)
Added:
geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java (with props)
Modified:
geronimo/server/branches/3.0/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
geronimo/server/branches/3.0/plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/activemq.xml
Modified: geronimo/server/branches/3.0/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=1460822&r1=1460821&r2=1460822&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Mon Mar 25 18:32:05 2013
@@ -150,6 +150,10 @@ public class LocalAttributeManager imple
return prefix;
}
+ public Map<String, Object> getConfigSubstitutionsVariables() {
+ return expressionParser.getVariables();
+ }
+
public synchronized Collection<GBeanData> applyOverrides(Artifact configName, Collection<GBeanData> untypedGbeanDatas, Bundle bundle) throws InvalidConfigException {
// clone the datas since we will be modifying this collection
Collection<GBeanData> gbeanDatas = new ArrayList<GBeanData>(untypedGbeanDatas);
Modified: geronimo/server/branches/3.0/plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/activemq.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/activemq.xml?rev=1460822&r1=1460821&r2=1460822&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/activemq.xml (original)
+++ geronimo/server/branches/3.0/plugins/activemq/activemq-broker-blueprint/src/main/resources/OSGI-INF/blueprint/activemq.xml Mon Mar 25 18:32:05 2013
@@ -27,17 +27,22 @@
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />
+ <b:bean id="config-substitutions"
+ class="org.apache.geronimo.activemq.ConfigSubstitutionsHelper"
+ factory-method="getSubstitutions">
+ <b:argument ref="blueprintBundleContext"/>
+ <b:argument>
+ <b:map>
+ <b:entry key="activemq.brokerName" value="DefaultActiveMQBroker"/>
+ <b:entry key="activemq.data" value="var/activemq"/>
+ <b:entry key="ActiveMQHostname" value="0.0.0.0"/>
+ <b:entry key="ActiveMQPort" value="61616"/>
+ <b:entry key="PortOffset" value="0"/>
+ </b:map>
+ </b:argument>
+ </b:bean>
- <ext:property-placeholder id="property-placeholder" placeholder-prefix="${" placeholder-suffix="}" ignore-missing-locations="true">
- <ext:default-properties>
- <ext:property name="activemq.brokerName" value="DefaultActiveMQBroker"/>
- <ext:property name="activemq.data" value="var/activemq"/>
- <ext:property name="ActiveMQHostname" value="0.0.0.0"/>
- <ext:property name="ActiveMQPort" value="61616"/>
- <ext:property name="PortOffset" value="0"/>
- </ext:default-properties>
- <ext:location>file:$[karaf.base]/var/config/config-substitutions.properties</ext:location>
+ <ext:property-placeholder id="property-placeholder" placeholder-prefix="${" placeholder-suffix="}" ignore-missing-locations="true" defaults-ref="config-substitutions">
</ext:property-placeholder>
<amq:brokerService brokerName="${activemq.brokerName}" tmpDataDirectory="${activemq.data}/tmp_storage" schedulerSupport="false">
Added: geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java?rev=1460822&view=auto
==============================================================================
--- geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java (added)
+++ geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java Mon Mar 25 18:32:05 2013
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.activemq;
+
+import java.util.Map;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.system.configuration.LocalAttributeManager;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConfigSubstitutionsHelper {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigSubstitutionsHelper.class);
+
+ public static Map<String, Object> getSubstitutions(BundleContext bundleContext,
+ Map<String, Object> defaultSubstitutions) {
+ Kernel kernel = KernelRegistry.getSingleKernel();
+ if (kernel != null) {
+ try {
+ LocalAttributeManager attributeManager = kernel.getGBean(LocalAttributeManager.class);
+ if (attributeManager != null) {
+ return attributeManager.getConfigSubstitutionsVariables();
+ }
+ } catch (Exception e) {
+ // ignore - fall through
+ LOG.debug("Error getting config substitutions", e);
+ }
+ }
+ return defaultSubstitutions;
+ }
+
+}
Propchange: geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/branches/3.0/plugins/activemq/geronimo-activemq-blueprint/src/main/java/org/apache/geronimo/activemq/ConfigSubstitutionsHelper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain