This closes #107

Conflicts:
* karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java
  (catalog init done in init in master, whereas here we synch it; easily merged)
* karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
  (spacing change in master)


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/aa2d2e61
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/aa2d2e61
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/aa2d2e61

Branch: refs/heads/master
Commit: aa2d2e618a06bf2e14d166acf000a082f93e4d34
Parents: e4a79d9 0ac07fe
Author: Alex Heneveld <[email protected]>
Authored: Fri May 13 09:38:30 2016 +0100
Committer: Alex Heneveld <[email protected]>
Committed: Fri May 13 09:38:30 2016 +0100

----------------------------------------------------------------------
 .../core/internal/BrooklynProperties.java       | 30 ++++--
 .../mgmt/internal/LocalManagementContext.java   |  2 +-
 .../config/BrooklynPropertiesBuilderTest.java   |  4 +-
 .../internal/LocalManagementContextTest.java    |  4 +-
 karaf/init/pom.xml                              |  5 +
 .../brooklyn/launcher/osgi/ConfigSupplier.java  | 59 ++++++++++++
 .../brooklyn/launcher/osgi/OsgiLauncher.java    | 95 ++++++++++++++++---
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 22 ++---
 .../launcher/osgi/OsgiLauncherTest.java         | 97 ++++++++++++++++++++
 .../common/BrooklynPropertiesFactoryHelper.java | 27 +++++-
 pom.xml                                         |  1 +
 11 files changed, 305 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/aa2d2e61/karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java
----------------------------------------------------------------------
diff --cc 
karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java
index cf810ce,913920f..f5f0385
--- 
a/karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java
+++ 
b/karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java
@@@ -39,7 -46,9 +47,10 @@@ import org.slf4j.LoggerFactory
  public class OsgiLauncher extends BasicLauncher<OsgiLauncher> {
  
      private static final Logger LOG = 
LoggerFactory.getLogger(OsgiLauncher.class);
 +    private static final String DEFAULT_CATALOG_BOM = 
"file:etc/default.catalog.bom";
+     public static final String BROOKLYN_CONFIG_PID = "brooklyn";
+     
+     private Object reloadLock = new Object();
  
      private BrooklynVersionService brooklynVersion;
  
@@@ -54,8 -94,10 +96,11 @@@
      // Called by blueprint container
      // init-method can't find the start method for some reason, provide an 
alternative
      public void init() {
-         catalogInitialization(new CatalogInitialization(DEFAULT_CATALOG_BOM, 
false, null, false));
-         start();
+         synchronized (reloadLock) {
+             LOG.debug("OsgiLauncher init");
++            catalogInitialization(new 
CatalogInitialization(DEFAULT_CATALOG_BOM, false, null, false));
+             start();
+         }
      }
  
      // Called by blueprint container

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/aa2d2e61/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --cc karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index ccaea29,0ed314c..22cf66c
--- a/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/karaf/init/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@@ -30,17 -30,20 +30,20 @@@ limitations under the License
      <reference id="systemService"
                 interface="org.apache.karaf.system.SystemService" />
  
+     <reference id="configAdmin"
+                interface="org.osgi.service.cm.ConfigurationAdmin" />
+ 
      <cm:property-placeholder persistent-id="org.apache.brooklyn.osgilauncher" 
update-strategy="reload">
          <cm:default-properties>
 -            <cm:property name="ignoreCatalogErrors" value="true"/>
 -            <cm:property name="ignorePersistenceErrors" value="true"/>
 -            <cm:property name="highAvailabilityMode" value="DISABLED"/>
 -            <cm:property name="persistMode" value="DISABLED"/>
 -            <cm:property name="persistenceDir" value=""/>
 -            <cm:property name="persistenceLocation" value=""/>
 -            <cm:property name="persistPeriod" value="1s"/>
 -            <cm:property name="globalBrooklynPropertiesFile" 
value="~/.brooklyn/brooklyn.properties"/>
 -            <cm:property name="localBrooklynPropertiesFile" value=""/> <!-- 
used to be settable through cli params -->
 +            <cm:property name="ignoreCatalogErrors" value="true" />
 +            <cm:property name="ignorePersistenceErrors" value="true" />
 +            <cm:property name="highAvailabilityMode" value="DISABLED" />
 +            <cm:property name="persistMode" value="DISABLED" />
 +            <cm:property name="persistenceDir" value="" />
 +            <cm:property name="persistenceLocation" value="" />
 +            <cm:property name="persistPeriod" value="1s" />
 +            <cm:property name="globalBrooklynPropertiesFile" 
value="~/.brooklyn/brooklyn.properties" />
 +            <cm:property name="localBrooklynPropertiesFile" value="" /> <!-- 
used to be settable through cli params -->
          </cm:default-properties>
      </cm:property-placeholder>
  
@@@ -60,16 -52,22 +52,22 @@@
            init-method="init"
            destroy-method="destroy">
  
 -        <property name="brooklynVersion" ref="brooklynVersion"/>
 +        <property name="brooklynVersion" ref="brooklynVersion" />
-         <property name="brooklynPropertiesBuilder" ref="propertiesBuilder" />
  
 -        <property name="ignoreCatalogErrors" value="${ignoreCatalogErrors}"/>
 -        <property name="ignorePersistenceErrors" 
value="${ignorePersistenceErrors}"/>
 -        <property name="highAvailabilityMode" 
value="${highAvailabilityMode}"/>
 -        <property name="persistMode" value="${persistMode}"/>
 -        <property name="persistenceDir" value="${persistenceDir}"/>
 -        <property name="persistenceLocation" value="${persistenceLocation}"/>
 -        <property name="persistPeriod" value="${persistPeriod}"/>
 -        <property name="globalBrooklynProperties" 
value="${globalBrooklynPropertiesFile}"/>
 -        <property name="localBrooklynProperties" 
value="${localBrooklynPropertiesFile}"/>
 -        <property name="configAdmin" ref="configAdmin"/>
 +        <property name="ignoreCatalogErrors" value="${ignoreCatalogErrors}" />
 +        <property name="ignorePersistenceErrors" 
value="${ignorePersistenceErrors}" />
 +        <property name="highAvailabilityMode" value="${highAvailabilityMode}" 
/>
 +        <property name="persistMode" value="${persistMode}" />
 +        <property name="persistenceDir" value="${persistenceDir}" />
 +        <property name="persistenceLocation" value="${persistenceLocation}" />
 +        <property name="persistPeriod" value="${persistPeriod}" />
++        <property name="globalBrooklynProperties" 
value="${globalBrooklynPropertiesFile}" />
++        <property name="localBrooklynProperties" 
value="${localBrooklynPropertiesFile}" />
++        <property name="configAdmin" ref="configAdmin" />
+ 
+         <cm:managed-properties persistent-id="brooklyn"
+                                update-method="updateProperties"
+                                update-strategy="component-managed" />
      </bean>
  
      <bean id="localManagementContextService"

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/aa2d2e61/pom.xml
----------------------------------------------------------------------

Reply via email to