[GitHub] brooklyn-server pull request: Resolve AddSensor and AddEffector co...

2016-05-26 Thread sjcorbett
Github user sjcorbett commented on the pull request:

https://github.com/apache/brooklyn-server/pull/152#issuecomment-221933548
  
@grkvlt @neykov Thanks for your comments. This whole approach is flawed 
because it doesn't survive rebind. Entity initialisers have been written to 
fire once, which is unfortunate because it's counterintuitive when used 
alongside everything else in a blueprint. I will explore the suggestion of 
using `EntityAdjuncts`.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request: Resolve AddSensor and AddEffector co...

2016-05-26 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/152#discussion_r64778305
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/sensor/password/CreatePasswordSensor.java
 ---
@@ -33,23 +34,21 @@
 
 public static final ConfigKey ACCEPTABLE_CHARS = 
ConfigKeys.newStringConfigKey("password.chars", "The characters allowed in 
password");
 
-private Integer passwordLength;
-private String acceptableChars;
-
 public CreatePasswordSensor(Map params) {
 this(ConfigBag.newInstance(params));
 }
 
 public CreatePasswordSensor(ConfigBag params) {
 super(params);
-passwordLength = params.get(PASSWORD_LENGTH);
-acceptableChars = params.get(ACCEPTABLE_CHARS);
 }
 
 @Override
 public void apply(EntityLocal entity) {
 super.apply(entity);
 
+Integer passwordLength = EntityInitializers.resolve(params, 
PASSWORD_LENGTH);
+String acceptableChars = EntityInitializers.resolve(params, 
ACCEPTABLE_CHARS);
--- End diff --

You're right, this was lazy of me.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request: Resolve AddSensor and AddEffector co...

2016-05-23 Thread neykov
Github user neykov commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/152#discussion_r64229699
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/sensor/password/CreatePasswordSensor.java
 ---
@@ -33,23 +34,21 @@
 
 public static final ConfigKey ACCEPTABLE_CHARS = 
ConfigKeys.newStringConfigKey("password.chars", "The characters allowed in 
password");
 
-private Integer passwordLength;
-private String acceptableChars;
-
 public CreatePasswordSensor(Map params) {
 this(ConfigBag.newInstance(params));
 }
 
 public CreatePasswordSensor(ConfigBag params) {
 super(params);
-passwordLength = params.get(PASSWORD_LENGTH);
-acceptableChars = params.get(ACCEPTABLE_CHARS);
 }
 
 @Override
 public void apply(EntityLocal entity) {
 super.apply(entity);
 
+Integer passwordLength = EntityInitializers.resolve(params, 
PASSWORD_LENGTH);
+String acceptableChars = EntityInitializers.resolve(params, 
ACCEPTABLE_CHARS);
--- End diff --

`apply` is called before managing any of the entities in the spec hierarchy 
(i.e. a camp plan) so this can't be resolved at this point. It would just block 
app creation. Could you add some tests to prove me wrong :). 
`StaticSensor` does the right thing by pushing all of it in tasks.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request: Resolve AddSensor and AddEffector co...

2016-05-23 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

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

Resolve AddSensor and AddEffector config

Resolves useful parameters of implementations of the `AddEffector` and 
`AddSensor` entity initializers, meaning that their values can be sourced from 
DslComponents.

Affects:
* SshCommandEffector's command and executionDir
* SshCommandSensor's command and executionDir
* CreatePasswordSensor's passwordLength and acceptableChars
* JmxAttributeSensor's objectName, attribute and defaultValue

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

$ git pull https://github.com/sjcorbett/brooklyn-server 
resolve-initializer-config

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

https://github.com/apache/brooklyn-server/pull/152.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 #152


commit 21b41cb497cd1f22cadf8e0b13565cce21e433c1
Author: Sam Corbett 
Date:   2016-05-23T11:27:47Z

Resolve AddSensor and AddEffector config

Means blueprints can use DslComponents in their definition.




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---