You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/02/09 19:08:14 UTC

[1/2] incubator-brooklyn git commit: code review fixes for CLI extensions

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 0f74d4477 -> 86da1643d


code review fixes for CLI extensions

closing streams, deprecating old BrooklynDevelopmentModes, and release notes


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

Branch: refs/heads/master
Commit: 35708f1ea4daffe23b6c2f904affd3ca1b025dcd
Parents: 0f74d44
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Feb 9 17:59:07 2015 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Feb 9 18:01:25 2015 +0000

----------------------------------------------------------------------
 core/src/main/java/brooklyn/BrooklynVersion.java    | 16 ++++++++++++++--
 docs/guide/misc/release-notes.md                    |  2 ++
 .../java/brooklyn/launcher/BrooklynWebServer.java   |  3 ---
 .../launcher/config/BrooklynDevelopmentModes.java   |  2 ++
 .../launcher/config/BrooklynGlobalConfig.java       |  5 +++--
 .../launcher/config/CustomResourceLocator.java      |  4 ++--
 6 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/core/src/main/java/brooklyn/BrooklynVersion.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/BrooklynVersion.java b/core/src/main/java/brooklyn/BrooklynVersion.java
index 3496d9e..fb77cdc 100644
--- a/core/src/main/java/brooklyn/BrooklynVersion.java
+++ b/core/src/main/java/brooklyn/BrooklynVersion.java
@@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
 import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.osgi.Osgis;
 import brooklyn.util.osgi.Osgis.ManifestHelper;
+import brooklyn.util.stream.Streams;
 import brooklyn.util.text.Strings;
 
 /**
@@ -126,8 +127,9 @@ public class BrooklynVersion {
   }
     
   private void readPropertiesFromMavenResource(ClassLoader resourceLoader) {
+    InputStream versionStream = null;
     try {
-      InputStream versionStream = resourceLoader.getResourceAsStream(MVN_VERSION_RESOURCE_FILE);
+      versionStream = resourceLoader.getResourceAsStream(MVN_VERSION_RESOURCE_FILE);
       if (versionStream==null) {
           if (isDevelopmentEnvironment()) {
               // allowed for dev env
@@ -140,6 +142,8 @@ public class BrooklynVersion {
       versionProperties.load(checkNotNull(versionStream));
     } catch (IOException e) {
       log.warn("Error reading maven resource file "+MVN_VERSION_RESOURCE_FILE+": "+e, e);
+    } finally {
+        Streams.closeQuietly(versionStream);
     }
   }
 
@@ -154,8 +158,10 @@ public class BrooklynVersion {
       }
       while (paths.hasMoreElements()) {
           URL u = paths.nextElement();
+          InputStream us = null;
           try {
-              ManifestHelper mh = Osgis.ManifestHelper.forManifest(u.openStream());
+              us = u.openStream();
+              ManifestHelper mh = Osgis.ManifestHelper.forManifest(us);
               if (BROOKLYN_CORE_SYMBOLIC_NAME.equals(mh.getSymbolicName())) {
                   Attributes attrs = mh.getManifest().getMainAttributes();
                   for (Object key: attrs.keySet()) {
@@ -167,6 +173,8 @@ public class BrooklynVersion {
           } catch (Exception e) {
               Exceptions.propagateIfFatal(e);
               log.warn("Error reading OSGi manifest from "+u+" when determining version properties: "+e, e);
+          } finally {
+              Streams.closeQuietly(us);
           }
       }
       if (isDevelopmentEnvironment()) {
@@ -183,6 +191,10 @@ public class BrooklynVersion {
    * <p>
    * In a packaged or library build of Brooklyn (normal usage) this should return false,
    * and all OSGi components should be available.
+   * <p>
+   * There is no longer any way to force this,
+   * such as the old BrooklynDevelopmentMode class; 
+   * but that could easily be added if required (eg as a system property).
    */
   public static boolean isDevelopmentEnvironment() {
       Boolean isDevEnv = IS_DEV_ENV.get();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/docs/guide/misc/release-notes.md
----------------------------------------------------------------------
diff --git a/docs/guide/misc/release-notes.md b/docs/guide/misc/release-notes.md
index 8683eb8..2b6dadf 100644
--- a/docs/guide/misc/release-notes.md
+++ b/docs/guide/misc/release-notes.md
@@ -44,6 +44,8 @@ For more information, please visit [brooklyn.io](http://brooklyn.io).
   but some items have had to change. For most users this should not be an issue as persistence in the previous version
   was not working well in any case. 
 
+* If `brooklyn.webconsole.security.https.required=true` is specified with no explicit port, 
+  it now defaults to 8443; previously it would default to 8081 even in the case of `https`.
 
 ### Community Activity
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
index 97e93b4..8c9c9e3 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
@@ -212,9 +212,6 @@ public class BrooklynWebServer {
     }
 
     public BrooklynWebServer setPort(Object port) {
-        if (port==null) {
-            this.requestedPort = null;
-        }
         if (getActualPort()>0)
             throw new IllegalStateException("Can't set port after port has been assigned to server (using "+getActualPort()+")");
         this.requestedPort = TypeCoercions.coerce(port, PortRange.class);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynDevelopmentModes.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynDevelopmentModes.java b/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynDevelopmentModes.java
index a2aad98..ea08466 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynDevelopmentModes.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynDevelopmentModes.java
@@ -28,6 +28,8 @@ import brooklyn.config.ConfigKey;
 import brooklyn.event.basic.BasicConfigKey;
 import brooklyn.util.os.Os;
 
+@Deprecated /** @deprecated since 0.7.0; see BrooklynVersion;
+* and anyway this was not really used, and if it were, it would be needed in core; autodetection is pretty good */
 public class BrooklynDevelopmentModes {
 
     private static final Logger log = LoggerFactory.getLogger(BrooklynDevelopmentModes.class);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynGlobalConfig.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynGlobalConfig.java b/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynGlobalConfig.java
index 08a8c57..5f79cf0 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynGlobalConfig.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/config/BrooklynGlobalConfig.java
@@ -21,7 +21,6 @@ package brooklyn.launcher.config;
 import brooklyn.config.BrooklynServiceAttributes;
 import brooklyn.config.ConfigKey;
 import brooklyn.entity.basic.BrooklynConfigKeys;
-import brooklyn.launcher.config.BrooklynDevelopmentModes.BrooklynDevelopmentMode;
 import brooklyn.location.cloud.CloudLocationConfig;
 import brooklyn.management.internal.BrooklynGarbageCollector;
 import brooklyn.rest.BrooklynWebConfig;
@@ -44,7 +43,9 @@ import brooklyn.util.time.Duration;
  */
 public class BrooklynGlobalConfig {
 
-    public static final ConfigKey<BrooklynDevelopmentMode> BROOKLYN_DEV_MODE = BrooklynDevelopmentModes.BROOKLYN_DEV_MODE;
+    @Deprecated /** @deprecated since 0.7.0; see BrooklynVersion;
+    * and anyway this was not really used, and if it were, it would be needed in core; autodetection is pretty good */
+    public static final ConfigKey<brooklyn.launcher.config.BrooklynDevelopmentModes.BrooklynDevelopmentMode> BROOKLYN_DEV_MODE = brooklyn.launcher.config.BrooklynDevelopmentModes.BROOKLYN_DEV_MODE;
 
     public static final ConfigKey<Boolean> REQUIRE_HTTPS = BrooklynWebConfig.HTTPS_REQUIRED;
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35708f1e/usage/launcher/src/main/java/brooklyn/launcher/config/CustomResourceLocator.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/config/CustomResourceLocator.java b/usage/launcher/src/main/java/brooklyn/launcher/config/CustomResourceLocator.java
index 4cd155a..dfdd643 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/config/CustomResourceLocator.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/config/CustomResourceLocator.java
@@ -26,6 +26,7 @@ import java.util.List;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import brooklyn.BrooklynVersion;
 import brooklyn.config.ConfigMap;
 import brooklyn.util.ResourceUtils;
 import brooklyn.util.exceptions.Exceptions;
@@ -104,8 +105,7 @@ public class CustomResourceLocator {
         
         @Override
         public boolean isApplicable(String url, ConfigMap config) {
-            return config.getConfig(BrooklynDevelopmentModes.BROOKLYN_DEV_MODE).isEnabled()
-                    && urlToSearchFor.equals(url);
+            return BrooklynVersion.isDevelopmentEnvironment() && urlToSearchFor.equals(url);
         }
 
         @Override


[2/2] incubator-brooklyn git commit: This closes #510

Posted by he...@apache.org.
This closes #510


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

Branch: refs/heads/master
Commit: 86da1643dd9a827ef0e5dbf4b3cf74a382f283af
Parents: 0f74d44 35708f1
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Feb 9 18:05:49 2015 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Feb 9 18:05:49 2015 +0000

----------------------------------------------------------------------
 core/src/main/java/brooklyn/BrooklynVersion.java    | 16 ++++++++++++++--
 docs/guide/misc/release-notes.md                    |  2 ++
 .../java/brooklyn/launcher/BrooklynWebServer.java   |  3 ---
 .../launcher/config/BrooklynDevelopmentModes.java   |  2 ++
 .../launcher/config/BrooklynGlobalConfig.java       |  5 +++--
 .../launcher/config/CustomResourceLocator.java      |  4 ++--
 6 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------