You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by neykov <gi...@git.apache.org> on 2016/04/07 16:24:07 UTC

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

GitHub user neykov opened a pull request:

    https://github.com/apache/brooklyn-server/pull/107

    [OSGi] Load properties from config admin

    Load properties from:
      * global brooklyn.properties
      * local properties
      * config admin's brooklyn PID
    
    It's a one-way integration where changes in config admin will cause reloading the properties in brooklyn. Setting properties programmatically in brooklyn will not update config admin.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/brooklyn-server osgi/config-admin

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/107.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #107
    
----
commit 66e9f56be3584d12a2c0a201b2a9556d11172f60
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2016-04-05T14:46:39Z

    Remove deprecated method.

commit 099f35a7efa651bd59a4a4c378ea33bab6ae168b
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2016-04-07T13:02:02Z

    [OSGi] Populate brooklyn.properties from config admin
    
    Also reload properties when config admin is updated.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the pull request:

    https://github.com/apache/brooklyn-server/pull/107#issuecomment-214714527
  
    Can this not be merged now? Is there anything outstanding?  I don't think the discussions above required us to change things?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the pull request:

    https://github.com/apache/brooklyn-server/pull/107#issuecomment-208900076
  
    👍  I've read through the code and don't have any particular comments to make, I also pulled and built the branch and confirmed that brooklyn.cfg is read and properties from it are used to configure Brooklyn and are dynamically updatable via the config:properties-set command in Karaf console.  
    
    In its present form this will read properties, separately, from the global and local files, and from etc/brooklyn.cfg, and you can only see the values from brooklyn.cfg in the karaf console.  It might be interesting to discuss whether all values could be brought into Configuration Admin and managed from there?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by m4rkmckenna <gi...@git.apache.org>.
Github user m4rkmckenna commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/107#discussion_r59376066
  
    --- Diff: karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java ---
    @@ -23,36 +26,78 @@
     import org.apache.brooklyn.core.internal.BrooklynProperties;
     import org.apache.brooklyn.core.mgmt.persist.PersistMode;
     import org.apache.brooklyn.launcher.common.BasicLauncher;
    +import org.apache.brooklyn.launcher.common.BrooklynPropertiesFactoryHelper;
     import org.apache.brooklyn.rest.BrooklynWebConfig;
     import org.apache.brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider;
    +import org.apache.brooklyn.util.exceptions.Exceptions;
     import org.apache.brooklyn.util.javalang.Threads;
    +import org.apache.brooklyn.util.text.Strings;
     import org.apache.brooklyn.util.time.Duration;
    +import org.osgi.framework.Constants;
    +import org.osgi.framework.InvalidSyntaxException;
    +import org.osgi.service.cm.Configuration;
    +import org.osgi.service.cm.ConfigurationAdmin;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Initializer for brooklyn-core when running in an OSGi environment.
    - *
    - * Temporarily here; should be totally contained in blueprint beans' init-methods.
      */
     public class OsgiLauncher extends BasicLauncher<OsgiLauncher> {
     
         private static final Logger LOG = LoggerFactory.getLogger(OsgiLauncher.class);
    +    public static final String BROOKLYN_CONFIG_PID = "brooklyn";
    --- End diff --
    
    IMO the PID should be `org.apacha.brooklyn`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/107#discussion_r59499842
  
    --- Diff: karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java ---
    @@ -23,36 +26,78 @@
     import org.apache.brooklyn.core.internal.BrooklynProperties;
     import org.apache.brooklyn.core.mgmt.persist.PersistMode;
     import org.apache.brooklyn.launcher.common.BasicLauncher;
    +import org.apache.brooklyn.launcher.common.BrooklynPropertiesFactoryHelper;
     import org.apache.brooklyn.rest.BrooklynWebConfig;
     import org.apache.brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider;
    +import org.apache.brooklyn.util.exceptions.Exceptions;
     import org.apache.brooklyn.util.javalang.Threads;
    +import org.apache.brooklyn.util.text.Strings;
     import org.apache.brooklyn.util.time.Duration;
    +import org.osgi.framework.Constants;
    +import org.osgi.framework.InvalidSyntaxException;
    +import org.osgi.service.cm.Configuration;
    +import org.osgi.service.cm.ConfigurationAdmin;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Initializer for brooklyn-core when running in an OSGi environment.
    - *
    - * Temporarily here; should be totally contained in blueprint beans' init-methods.
      */
     public class OsgiLauncher extends BasicLauncher<OsgiLauncher> {
     
         private static final Logger LOG = LoggerFactory.getLogger(OsgiLauncher.class);
    +    public static final String BROOKLYN_CONFIG_PID = "brooklyn";
    --- End diff --
    
    I was wondering about the same. I'd like the file on disk to be called `brooklyn.cfg` making it a much more friendlier to autocomplete and shorter to type. Can we redirect the pid to a custom file name?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on the pull request:

    https://github.com/apache/brooklyn-server/pull/107#issuecomment-208902670
  
    Something worth thinking about I agree, but as far as this PR goes I think it's fine as is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/brooklyn-server/pull/107


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/107#discussion_r59513542
  
    --- Diff: karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java ---
    @@ -23,36 +26,78 @@
     import org.apache.brooklyn.core.internal.BrooklynProperties;
     import org.apache.brooklyn.core.mgmt.persist.PersistMode;
     import org.apache.brooklyn.launcher.common.BasicLauncher;
    +import org.apache.brooklyn.launcher.common.BrooklynPropertiesFactoryHelper;
     import org.apache.brooklyn.rest.BrooklynWebConfig;
     import org.apache.brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider;
    +import org.apache.brooklyn.util.exceptions.Exceptions;
     import org.apache.brooklyn.util.javalang.Threads;
    +import org.apache.brooklyn.util.text.Strings;
     import org.apache.brooklyn.util.time.Duration;
    +import org.osgi.framework.Constants;
    +import org.osgi.framework.InvalidSyntaxException;
    +import org.osgi.service.cm.Configuration;
    +import org.osgi.service.cm.ConfigurationAdmin;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Initializer for brooklyn-core when running in an OSGi environment.
    - *
    - * Temporarily here; should be totally contained in blueprint beans' init-methods.
      */
     public class OsgiLauncher extends BasicLauncher<OsgiLauncher> {
     
         private static final Logger LOG = LoggerFactory.getLogger(OsgiLauncher.class);
    +    public static final String BROOKLYN_CONFIG_PID = "brooklyn";
    --- End diff --
    
    I also think it doesn't really matter too much either way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/brooklyn-server/pull/107#issuecomment-208901238
  
    Thanks @geomacy. My thinking was that we should point `etc/brooklyn.cfg` to point to `~/.brooklyn/brooklyn.properties` instead (or maybe in addition to) - not done in these changes, just a matter of configuration.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request: [OSGi] Load properties from config a...

Posted by geomacy <gi...@git.apache.org>.
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/107#discussion_r59513491
  
    --- Diff: karaf/init/src/main/java/org/apache/brooklyn/launcher/osgi/OsgiLauncher.java ---
    @@ -23,36 +26,78 @@
     import org.apache.brooklyn.core.internal.BrooklynProperties;
     import org.apache.brooklyn.core.mgmt.persist.PersistMode;
     import org.apache.brooklyn.launcher.common.BasicLauncher;
    +import org.apache.brooklyn.launcher.common.BrooklynPropertiesFactoryHelper;
     import org.apache.brooklyn.rest.BrooklynWebConfig;
     import org.apache.brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider;
    +import org.apache.brooklyn.util.exceptions.Exceptions;
     import org.apache.brooklyn.util.javalang.Threads;
    +import org.apache.brooklyn.util.text.Strings;
     import org.apache.brooklyn.util.time.Duration;
    +import org.osgi.framework.Constants;
    +import org.osgi.framework.InvalidSyntaxException;
    +import org.osgi.service.cm.Configuration;
    +import org.osgi.service.cm.ConfigurationAdmin;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     /**
      * Initializer for brooklyn-core when running in an OSGi environment.
    - *
    - * Temporarily here; should be totally contained in blueprint beans' init-methods.
      */
     public class OsgiLauncher extends BasicLauncher<OsgiLauncher> {
     
         private static final Logger LOG = LoggerFactory.getLogger(OsgiLauncher.class);
    +    public static final String BROOKLYN_CONFIG_PID = "brooklyn";
    --- End diff --
    
    I don't think we need to feel strictly constrained to using package style naming, 'org.apache.brooklyn'.  It's certainly appropriate if the configuration is for a module, where the package style is needed to distinguish itself from others that might have the same basename, e.g. x.y.z.core.security.cfg versus x.y.z.software.base.security.cfg. In this case however we're configuring the whole product, rather than a module. I think we can be a bit flexible here for the convenience of the simpler file name.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---