[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread m4rkmckenna
Github user m4rkmckenna commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138696197
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
--- End diff --

Agree for the sake of readability please add braces and a line break


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread grkvlt
Github user grkvlt commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138690532
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
+if (s==null) continue;
+if (!firstWord) { msg.append(", "); } else { firstWord = 
false; }
+// s is normally a sensor but forgive other things if caller 
cheated generics
+msg.append(s instanceof Sensor ? ((Sensor)s).getName() : 
s.toString());
+}
+if (firstWord) msg.append("");
+
+firstWord = true;
--- End diff --

Interesting @Graeme-Miller - Not sure that you need the second clause in 
your `if`, as the body handles the `self` output the same as the original code. 
I'd prefer the `Collectors.joining(", ")` collector, to get a `String` out 
directly... Also, I'm not sure you should try and chest the lambda type 
inference like that, just go `s -> { /* stuff */ }` and it'll be fine. Redoing 
the whole method with lambdas gave me this, which is almost exactly the same 
length ;)

```
protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
StringBuilder msg = new StringBuilder("Listening for ");
if (Iterables.isEmpty(sensors)) {
msg.append("");
} else {
String sensorsText = 
StreamSupport.stream(sensors.spliterator(), false)
.filter(s -> s != null)
.map(s -> {
if (s instanceof Sensor) {
return ((Sensor) s).getName();
} else {
return s.toString();
}
})
.collect(Collectors.joining(", "));
msg.append(sensorsText);
}
if (!Iterables.isEmpty(sources)) {
String sourcesText = 
StreamSupport.stream(sources.spliterator(), false)
.filter(s -> s != null)
.map(s -> {
if (s.equals(getEntity())) {
return "self";
   

Jenkins build is back to normal : brooklyn-server-master #728

2017-09-13 Thread Apache Jenkins Server
See 




[GitHub] brooklyn-server issue #822: New periodic and scheduled effector policies

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/822
  
(yaml could be used in a test :nudge:)


---


[GitHub] brooklyn-server issue #822: New periodic and scheduled effector policies

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/822
  
cool @grkvlt - wonder if you could do two things:

* merge #818 here for testing and follow the pattern there to set trigger 
and action highlights
* include a YAML illustrating use of these policies


---


[GitHub] brooklyn-server pull request #812: use external config in examples

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-server pull request #822: New periodic and scheduled effector polic...

2017-09-13 Thread grkvlt
GitHub user grkvlt opened a pull request:

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

New periodic and scheduled effector policies



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

$ git pull https://github.com/grkvlt/brooklyn-server feature/time-policies

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

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


commit 060d7d114cd89050bdcbdecb3129e1425f944f61
Author: Andrew Donald Kennedy 
Date:   2017-09-13T17:03:56Z

New periodic and scedukled effector policies




---


[GitHub] brooklyn-server issue #750: Adds a policy to create locations from an entity

2017-09-13 Thread grkvlt
Github user grkvlt commented on the issue:

https://github.com/apache/brooklyn-server/pull/750
  
Thanks for the review @aledsage, I will update appropriately. The use case 
is for blueprints like Kubernetes, which would be able to add a new 
`KubernetesLocation` or similar.


---


[GitHub] brooklyn-docs issue #209: explain and use the `brooklyn-demo-sample` externa...

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-docs/pull/209
  
@drigodwin @aledsage merged the upstream PRs -- is this good to go?

(and if you could have a quick look at #208 i'd be obliged!)


---


[GitHub] brooklyn-library pull request #124: use external config provider for demo pa...

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-library/pull/124


---


[GitHub] brooklyn-library pull request #126: Highlights and load

2017-09-13 Thread ahgittin
GitHub user ahgittin opened a pull request:

https://github.com/apache/brooklyn-library/pull/126

Highlights and load

uses https://github.com/apache/brooklyn-server/pull/818 to add highlights 
for software-specific entities.  also adds new perf test.

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

$ git pull https://github.com/ahgittin/brooklyn-library highlights-and-load

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

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


commit 71a3fd2ebd2652dce2fd2b9678bffaed613eec27
Author: Alex Heneveld 
Date:   2017-09-13T16:52:08Z

add load test without persistence

so we can see what else is chewing up cpu

commit 4babb503460bbd938352b603c397214e53a1ef08
Author: Alex Heneveld 
Date:   2017-09-13T16:52:43Z

set highlights on software-specific enrichers and policies




---


[GitHub] brooklyn-server pull request #817: Optimizations

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-docs pull request #211: Update _azure-ARM.md

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/211


---


[GitHub] brooklyn-server issue #821: REST API for accessing adjuncts (including highl...

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/821
  
These are the API calls, for reference.  The `Entity Policy` and `Entity 
Policy Config` resources shown at bottom are now redundant (and deprecated).

https://user-images.githubusercontent.com/496540/30388575-07b8995e-98a8-11e7-8539-ec591126a3f9.png";>



---


[GitHub] brooklyn-server pull request #821: REST API for accessing adjuncts (includin...

2017-09-13 Thread ahgittin
GitHub user ahgittin opened a pull request:

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

REST API for accessing adjuncts (including highlights)

NB: builds on #810 and #818, review and merge those first

This is then just one commit (currently) which:

* adds an `AdjunctApi` combining all the functionality of `PolicyApi` and 
`PolicyConfigApi` generalized across adjunct types
* same for `AdjunctConfigSummary`
* deprecates the replaced policy-specific endpoints and related classes, 
and also the `CatalogApi` `/catalog` endpoint (since we are deprecating; also 
there is some overlap at `CatalogPolicyItem` and `PolicyConfigSummary` etc)

This is mostly a drop-in replacement for the 
`/applications/XXX/entities/XXX/policies/*` endpoints, now using 
`/applications/XXX/entities/XXX/adjuncts/*` and returning other items.  Note 
also that:

* `GET /v1/applications/XXX/entities/XXX/adjuncts?adjunctType=policy` 
filters by policy (same for other types)
* `adjunctType` is included in the returned object
* the detail object if you `GET 
/v1/applications/XXX/entities/XXX/adjuncts/XXX` includes more info (config keys 
aka parameters, and values)
* the `links` on the detail object include links to `start` and `stop` if 
and only if the adjunct supports that (ie enrichers don't for instance)


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

$ git pull https://github.com/ahgittin/brooklyn-server 
adjunct-rest-api-and-highlights

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

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


commit 9b337035992f77c7e156bba4d3b3ce35438ca180
Author: Alex Heneveld 
Date:   2017-09-07T15:43:45Z

REST API for bundles, types, and subtypes

also tweaks to other classes to make them more usable, eg VersionedName 
comparables and bundle removal giving an OsgiBundleInstallationResult

test in BundleAndTypeAndSubtypeResourcesTest based on CatalogResourceTest, 
basically giving parity in terms of functionality and test coverage

commit 1a8df4275d61ddd69e6bc05b057c081dd4dcad34
Author: Alex Heneveld 
Date:   2017-09-13T08:07:44Z

use highlights in `ServiceRestarter`

commit 5ae9c41c1dc8d2884598a2375581d2c4dc14ce14
Author: Alex Heneveld 
Date:   2017-09-13T08:24:09Z

expand API for policy java authors, and address PR comments incl javadoc

see ServiceRestarter for example of how the API can be used by authors now

commit 717084697c206e84a19922ec1dc30945b82523db
Author: Alex Heneveld 
Date:   2017-09-13T10:39:30Z

Set highlights on many more things

* selected policies (autoscaler, restarter, replacer, membership trackers)  
- triggers, actions, and confirmations/violations
* triggers for most enrichers (with new conveniences added for sensor 
triggers)
* period trigger for all feeds (from `Poller` using new 
`highlightTriggerPeriod` in `AbstractFeed`)
* publish sensor actions for all enrichers (new 
`highlightActionPublishSensor` convenience for `AbstractEntityAdjuct`, called 
in `AbstractEnricher`, and in feed handlers via new `AbstractFeed.onSensor..` 
methods)

commit 1cd6bf455d4cd0004a98881cc2d9a045bf2ffd1e
Author: Alex Heneveld 
Date:   2017-09-13T11:53:30Z

Merge branch 'master' into bundle-rest-api

BrooklynCatalog api tidy minor conflict

commit 80a4c255d595d4df9a2af7199b9a03e9f2a5641d
Author: Alex Heneveld 
Date:   2017-09-13T15:52:14Z

Merge branch 'bundle-rest-api' into adjunct-rest-api-and-highlights-2

commit 2860af56a7e77de8742fb3b6a0c22903f33e3a6b
Author: Alex Heneveld 
Date:   2017-09-13T15:52:27Z

Merge branch 'highlights-adjuncts' into adjunct-rest-api-and-highlights-2

commit 07247e8f15447e36b8e2f705f025b59be3a2
Author: Alex Heneveld 
Date:   2017-09-13T15:22:56Z

add adjunct REST API, deprecating policy endpoint




---


Build failed in Jenkins: brooklyn-server-master #727

2017-09-13 Thread Apache Jenkins Server
See 


Changes:

[alex.heneveld] use type registry when confirming catalog on startup

[alex.heneveld] only search in legacy catalog items in a couple other places

--
[...truncated 7.57 MB...]
Deploying the main artifact brooklyn-launcher-0.12.0-SNAPSHOT-no-jsgui.jar
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-no-jsgui.jar
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-no-jsgui.jar
 (52 KB at 35.9 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
 (2 KB at 1.4 KB/sec)
Deploying the main artifact brooklyn-launcher-0.12.0-SNAPSHOT-sources.jar
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-sources.jar
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-sources.jar
 (37 KB at 30.0 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
 (2 KB at 1.4 KB/sec)
Deploying the main artifact brooklyn-launcher-0.12.0-SNAPSHOT-test-sources.jar
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-test-sources.jar
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/brooklyn-launcher-0.12.0-20170913.161546-152-test-sources.jar
 (109 KB at 82.2 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher/0.12.0-SNAPSHOT/maven-metadata.xml
 (2 KB at 1.3 KB/sec)
[INFO] Deployment in 
https://repository.apache.org/content/repositories/snapshots 
(id=apache.snapshots.https,uniqueVersion=true)
Deploying the main artifact brooklyn-launcher-common-0.12.0-SNAPSHOT.jar
Downloading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/maven-metadata.xml
Downloaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/maven-metadata.xml
 (2 KB at 2.5 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/brooklyn-launcher-common-0.12.0-20170913.161603-152.jar
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/brooklyn-launcher-common-0.12.0-20170913.161603-152.jar
 (48 KB at 34.8 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/brooklyn-launcher-common-0.12.0-20170913.161603-152.pom
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/brooklyn-launcher-common-0.12.0-20170913.161603-152.pom
 (4 KB at 3.0 KB/sec)
Downloading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/maven-metadata.xml
Downloaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/maven-metadata.xml
 (365 B at 0.6 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/maven-metadata.xml
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/0.12.0-SNAPSHOT/maven-metadata.xml
 (2 KB at 1.3 KB/sec)
Uploading: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/maven-metadata.xml
Uploaded: 
https://repository.apache.org/content/repositories/snapshots/org/apache/brooklyn/brooklyn-launcher-common/maven-metadata.xml
 (365 B at 0.3 KB/sec)
Deploying the main artifact brooklyn-launcher-common-0.12.0-SN

[GitHub] brooklyn-server pull request #820: use type registry when confirming catalog...

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-server issue #820: use type registry when confirming catalog on sta...

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/820
  
brooklyn CLI gives error in some startup configurations with #814 and this 
is minor so committing before review but review welcome


---


[GitHub] brooklyn-server pull request #820: use type registry when confirming catalog...

2017-09-13 Thread ahgittin
GitHub user ahgittin opened a pull request:

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

use type registry when confirming catalog on startup

prevents errors trying to check legacy catalog items

#814 caused legacy CI instances to be created for TR items which could 
cause errors; this limits search to legacy CIs to prevent error, and confirms 
TR items also

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

$ git pull https://github.com/ahgittin/brooklyn-server 
confirm-catalog-using-type-registry

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

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


commit 19410218fa694f5dac270bcbf514034224f80384
Author: Alex Heneveld 
Date:   2017-09-13T15:22:06Z

use type registry when confirming catalog on startup

prevents errors trying to check legacy catalog items




---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138651745
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
+if (s==null) continue;
+if (!firstWord) { msg.append(", "); } else { firstWord = 
false; }
+// s is normally a sensor but forgive other things if caller 
cheated generics
+msg.append(s instanceof Sensor ? ((Sensor)s).getName() : 
s.toString());
+}
+if (firstWord) msg.append("");
+
+firstWord = true;
--- End diff --

lines 620 -> 639 are confusing and it is difficult to extract what the code 
is supposed to do. I had a go at what I think is a simpler solution:
```
if(!myList.isEmpty() && !(myList.size() == 1 && 
myList.iterator().next().equals(getEntity())) {
msg.append(" on ");
List stringList = myList.stream().map((Sensor s) -> {
if (s.equals(getEntity())) {
return "self";
} else if (s instanceof Sensor) {
return ((Sensor) s).getName();
} else {
return s.toString();
}
}).collect(Collectors.toList());
msg.append(String.join(",", stringList));
}
```


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642145
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
--- End diff --

This method would benefit from comments to explain what it is doing, with 
multiple loops and nested ifs it isn't easy to tell at a glance.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642446
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
+StringBuilder msg = new StringBuilder("Listening for ");
+boolean firstWord = true;
+if (sensors!=null) for (Object s: sensors) {
--- End diff --

do we have a style guide for brooklyn? I have never seen someone put a for 
loop on the same line as an if. Seems to break with our coding conventions.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642216
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
--- End diff --

Should be calling setHighlight, rather than putting directly into the map. 
This would allow these methods to remain uncoupled from how we store the 
highlights. Same for the below highlight methods.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138642085
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time. */
+protected void highlightNow(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), null));
+}
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item with the current time and given task. */
+protected void highlight(String name, String description, @Nullable 
Task t) {
+highlights.put(name, new HighlightTuple(description, 
System.currentTimeMillis(), t!=null ? t.getId() : null));
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)} for {@link 
#HIGHLIGHT_NAME_TRIGGERS} (as ongoing). */
+protected void highlightTriggers(String description) {
+highlightOngoing(HIGHLIGHT_NAME_TRIGGERS, description);
+}
+protected  void highlightTriggers(Sensor s, Object source) {
+highlightTriggers(Collections.singleton(s), 
Collections.singleton(source));
+}
+protected  void highlightTriggers(Iterable> s, Object source) {
+highlightTriggers(s, (Iterable) (source instanceof Iterable ? 
(Iterable)source : Collections.singleton(source)));
+}
+protected  void highlightTriggers(Sensor s, Iterable sources) 
{
+highlightTriggers(Collections.singleton(s), sources);
+}
+protected  void highlightTriggers(Iterable> sensors, Iterable sources) {
--- End diff --

This method would benefit from comments to explain what it is doing, with 
multiple loops and nested ifs it isn't easy to tell at a glance.


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread Graeme-Miller
Github user Graeme-Miller commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/818#discussion_r138638872
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java ---
@@ -568,6 +570,98 @@ public void setUniqueTag(String uniqueTag) {
 return highlightsToReturn;
 }
 
+/** Records a named highlight against this object, for persistence and 
API access.
+ * See common highlights including {@link #HIGHLIGHT_NAME_LAST_ACTION} 
and
+ * {@link #HIGHLIGHT_NAME_LAST_CONFIRMATION}.
+ * Also see convenience methods eg  {@link #highlightOngoing(String, 
String)} and {@link #highlight(String, String, Task)}
+ * and {@link HighlightTuple}. 
+ */
+protected void setHighlight(String name, HighlightTuple tuple) {
+highlights.put(name, tuple);
+}
+
+/** As {@link #setHighlight(String, HighlightTuple)}, convenience for 
recording an item which is intended to be ongoing. */
+protected void highlightOngoing(String name, String description) {
+highlights.put(name, new HighlightTuple(description, 0, null));
--- End diff --

Should be calling setHighlight, rather than putting directly into the map. 
This would allow these methods to remain uncoupled from how we store the 
highlights. Same for the below highlight methods.


---


[GitHub] brooklyn-server issue #812: use external config in examples

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/812
  
Good point re examples pointing to master.  Will add password in script.  
But we should probably change links in example to point at specific branches 
too.


---


[GitHub] brooklyn-server issue #817: Optimizations

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/817
  
good comments @aledsage - thx - will apply both and merge


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138632642
  
--- Diff: guide/ops/security-guidelines.md ---
@@ -37,7 +37,7 @@ relevant mount points, disks and directories.
 
 For credential storage, users are strongly encouraged to consider using 
the "externalised 
 configuration" feature. This allows credentials to be retrieved from a 
store managed by you, 
-rather than being stored within YAML blueprints or brooklyn.properties.
+rather than being stored within YAML blueprints or brooklyn.cfg.
--- End diff --

Wrap `brooklyn.cfg` in \`\`


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138628703
  
--- Diff: guide/ops/configuration/brooklyn_cfg.md ---
@@ -214,7 +204,7 @@ or
 
 See [HTTPS Configuration](https.html) for general information on 
configuring HTTPS.
 
-To enable HTTPS in Brooklyn, add the following to your brooklyn.properties:
+To enable HTTPS in Brooklyn, add the following to your brooklyn.cfg:
--- End diff --

Wrap `brooklyn.cfg` in \`\`


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138631625
  
--- Diff: guide/ops/high-availability/high-availability-supplemental.md ---
@@ -12,34 +12,46 @@ and provides an example of how to configure a pair of 
Apache Brooklyn servers to
 - An NFS folder has been mounted on both VMs at 
`/mnt/brooklyn-persistence` and both machines can write to the folder
 
 \* Brooklyn can be configured to use either an object store such as S3, or 
a shared NFS mount. The recommended option is to use an object
-store as described in the [Object Store Persistence]({{ site.path.guide 
}}/ops/persistence/#object-store-persistence) documentation. For simplicity, a 
shared NFS folder
+store as described in the [Object Store Persistence]({{ 
site.path.operations }}/ops/persistence/#object-store-persistence) 
documentation. For simplicity, a shared NFS folder
 is assumed in this example
 
 ### Launching
 To start, download and install the latest Apache Brooklyn release on both 
VMs following the instructions in
-[Running Apache Brooklyn]({{ site.path.guide 
}}/start/running.html#install-apache-brooklyn)
+[Running Apache Brooklyn]({{ site.path.tutorials }}/start/running.html)
 
-On the first VM, which will be the master node, run the following to start 
Brooklyn in high availability mode:
+On the first VM, which will be the master node, set the following 
configuration options:
--- End diff --

Add: `([``org.apache.brooklyn.osgilauncher.cfg``](../paths.html))`


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138628440
  
--- Diff: guide/ops/configuration/brooklyn_cfg.md ---
@@ -33,7 +28,7 @@ 
brooklyn.webconsole.security.user.admin.password=AdminPassw0rd
 brooklyn.webconsole.security.user.bob.password=BobPassw0rd
 {% endhighlight %}
 
-The properties file *must* have permissions 600 
+The config file *must* have permissions 600 
--- End diff --

I don't think that is true anymore. Although, as long as it is readable and 
writable for the file owner, it should be fine


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138631452
  
--- Diff: guide/ops/high-availability/high-availability-supplemental.md ---
@@ -12,34 +12,46 @@ and provides an example of how to configure a pair of 
Apache Brooklyn servers to
 - An NFS folder has been mounted on both VMs at 
`/mnt/brooklyn-persistence` and both machines can write to the folder
 
 \* Brooklyn can be configured to use either an object store such as S3, or 
a shared NFS mount. The recommended option is to use an object
-store as described in the [Object Store Persistence]({{ site.path.guide 
}}/ops/persistence/#object-store-persistence) documentation. For simplicity, a 
shared NFS folder
+store as described in the [Object Store Persistence]({{ 
site.path.operations }}/ops/persistence/#object-store-persistence) 
documentation. For simplicity, a shared NFS folder
 is assumed in this example
 
 ### Launching
 To start, download and install the latest Apache Brooklyn release on both 
VMs following the instructions in
-[Running Apache Brooklyn]({{ site.path.guide 
}}/start/running.html#install-apache-brooklyn)
+[Running Apache Brooklyn]({{ site.path.tutorials }}/start/running.html)
 
-On the first VM, which will be the master node, run the following to start 
Brooklyn in high availability mode:
+On the first VM, which will be the master node, set the following 
configuration options:
+
+- highAvailabilityMode: MASTER
+- persistMode: AUTO
+- persistenceDir: /mnt/brooklyn-persistence
+
+Then launch Brooklyn with:
 
 {% highlight bash %}
-$ bin/brooklyn launch --highAvailability master --https --persist auto 
--persistenceDir /mnt/brooklyn-persistence
+$ bin/start
 {% endhighlight %}
 
-If you are using RPMs/deb to install, please see the [Running Apache 
Brooklyn]({{ site.path.guide }}/start/running.html#install-apache-brooklyn)
+If you are using RPMs/deb to install, please see the [Running Apache 
Brooklyn]({{ site.path.tutorials }}/start/running.html) 
--- End diff --

Same as above


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138633409
  
--- Diff: guide/start/running.md ---
@@ -182,7 +182,7 @@ Apache Brooklyn should now have been installed and be 
running as a system servic
 $ systemctl start|stop|restart|status brooklyn
 {% endhighlight %}
 
-The application should then output its logs to 
`/var/log/brooklyn/apache-brooklyn.debug.log` and 
`/var/log/brooklyn/apache-brooklyn.info.log`.
+The application should then output its logs to 
`/var/log/brooklyn/brooklyn.debug.log` and 
`/var/log/brooklyn/brooklyn.info.log`.
--- End diff --

Would keep only `brooklyn.(debug|info).log` and link to the `paths.html` 
page


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138629659
  
--- Diff: guide/ops/configuration/https.md ---
@@ -21,7 +21,7 @@ The passwords above should be changed to your own values. 
 Omit those arguments
 
 You will then be prompted to enter your name and organization details. 
This will use (or create, if it does not exist)
 a keystore with the password `mypassword` - you should use your own secure 
password, which will be the same password
-used in your brooklyn.properties (below). You will also need to replace 
`` with the full 
+used in your brooklyn.cfg (below). You will also need to replace 
`` with the full 
--- End diff --

Wrap `brooklyn.cfg` into \`\`


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138631937
  
--- Diff: guide/ops/high-availability/high-availability-supplemental.md ---
@@ -12,34 +12,46 @@ and provides an example of how to configure a pair of 
Apache Brooklyn servers to
 - An NFS folder has been mounted on both VMs at 
`/mnt/brooklyn-persistence` and both machines can write to the folder
 
 \* Brooklyn can be configured to use either an object store such as S3, or 
a shared NFS mount. The recommended option is to use an object
-store as described in the [Object Store Persistence]({{ site.path.guide 
}}/ops/persistence/#object-store-persistence) documentation. For simplicity, a 
shared NFS folder
+store as described in the [Object Store Persistence]({{ 
site.path.operations }}/ops/persistence/#object-store-persistence) 
documentation. For simplicity, a shared NFS folder
 is assumed in this example
 
 ### Launching
 To start, download and install the latest Apache Brooklyn release on both 
VMs following the instructions in
-[Running Apache Brooklyn]({{ site.path.guide 
}}/start/running.html#install-apache-brooklyn)
+[Running Apache Brooklyn]({{ site.path.tutorials }}/start/running.html)
 
-On the first VM, which will be the master node, run the following to start 
Brooklyn in high availability mode:
+On the first VM, which will be the master node, set the following 
configuration options:
+
+- highAvailabilityMode: MASTER
+- persistMode: AUTO
+- persistenceDir: /mnt/brooklyn-persistence
+
+Then launch Brooklyn with:
 
 {% highlight bash %}
-$ bin/brooklyn launch --highAvailability master --https --persist auto 
--persistenceDir /mnt/brooklyn-persistence
+$ bin/start
 {% endhighlight %}
 
-If you are using RPMs/deb to install, please see the [Running Apache 
Brooklyn]({{ site.path.guide }}/start/running.html#install-apache-brooklyn)
+If you are using RPMs/deb to install, please see the [Running Apache 
Brooklyn]({{ site.path.tutorials }}/start/running.html) 
 documentation for the appropriate launch commands
 
-Once Brooklyn has launched, on the second VM, run the following command to 
launch Brooklyn in standby mode:
+Once Brooklyn has launched, on the second VM, set the following 
configuration options ([`org.apache.brooklyn.osgilauncher.cfg`](../paths.html)):
+
+- highAvailabilityMode: AUTO
+- persistMode: AUTO
+- persistenceDir: /mnt/brooklyn-persistence
+
+Then launch the standby Brooklyn with:
 
 {% highlight bash %}
-$ bin/brooklyn launch --highAvailability auto --https --persist auto 
--persistenceDir /mnt/brooklyn-persistence
+$ bin/start
 {% endhighlight %}
 
 ### Failover
 When running as a HA standby node, each standby Brooklyn server (in this 
case there is only one standby) will check the shared persisted state
 every one second to determine the state of the HA master. If no heartbeat 
has been recorded for 30 seconds, then an election will be performed
 and one of the standby nodes will be promoted to master. At this point all 
requests should be directed to the new master node.
 If the master is terminated gracefully, the secondary will be immediately 
promoted to mater. Otherwise, the secondary will be promoted after 
-heartbeats are missed for a given length of time. This defaults to 30 
seconds, and is configured in brooklyn.properties using 
+heartbeats are missed for a given length of time. This defaults to 30 
seconds, and is configured in brooklyn.cfg using 
--- End diff --

Wrap `brooklyn.cfg` in \`\`


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138633009
  
--- Diff: guide/start/brooklyn.properties ---
@@ -17,7 +17,7 @@
 # under the License.
 #
 # This is Brooklyn's dot-properties file.
-# It should be located at "~/.brooklyn/brooklyn.properties" for automatic 
loading,
+# It should be located at "brooklyn.cfg" for automatic loading,
--- End diff --

Should this file be renamed `brooklyn.cfg`?


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138633481
  
--- Diff: guide/start/running.md ---
@@ -205,19 +205,19 @@ The application should then output its logs to 
`/var/log/brooklyn/apache-brookly
 Now start Apache Brooklyn with the following command:
 
 {% highlight bash %}
-$ bin/brooklyn launch
+$ bin/start
 {% endhighlight %}
 
-The application should then output its log into the console and also 
`apache-brooklyn.debug.log` and `apache-brooklyn.info.log`
+The application should then output its log to 
`./data/log/brooklyn.debug.log` and `./data/log/brooklyn.info.log`
--- End diff --

Same as above


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138629521
  
--- Diff: guide/ops/configuration/cors.md ---
@@ -0,0 +1,45 @@
+---
+title: CORS Configuration
+layout: website-normal
+---
+
+To enable / configure [cross-origin resource sharing 
(CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing).
+The following file must be added to 
[`/org.apache.brooklyn.rest.filter.cors.cfg`](../paths.html)
--- End diff --

Don't think you need the `` as you already link 
to the `path.html` page


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138633454
  
--- Diff: guide/start/running.md ---
@@ -195,7 +195,7 @@ Apache Brooklyn should now have been installed and be 
running as a system servic
 $ sudo service brooklyn start|stop|restart|status
 {% endhighlight %}
 
-The application should then output its logs to 
`/var/log/brooklyn/apache-brooklyn.debug.log` and 
`/var/log/brooklyn/apache-brooklyn.info.log`.
+The application should then output its logs to 
`/var/log/brooklyn/brooklyn.debug.log` and 
`/var/log/brooklyn/brooklyn.info.log`.
--- End diff --

Same as above


---


[GitHub] brooklyn-docs pull request #210: [WIP] Update to Karaf as default

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/210#discussion_r138631341
  
--- Diff: guide/ops/high-availability/high-availability-supplemental.md ---
@@ -12,34 +12,46 @@ and provides an example of how to configure a pair of 
Apache Brooklyn servers to
 - An NFS folder has been mounted on both VMs at 
`/mnt/brooklyn-persistence` and both machines can write to the folder
 
 \* Brooklyn can be configured to use either an object store such as S3, or 
a shared NFS mount. The recommended option is to use an object
-store as described in the [Object Store Persistence]({{ site.path.guide 
}}/ops/persistence/#object-store-persistence) documentation. For simplicity, a 
shared NFS folder
+store as described in the [Object Store Persistence]({{ 
site.path.operations }}/ops/persistence/#object-store-persistence) 
documentation. For simplicity, a shared NFS folder
 is assumed in this example
 
 ### Launching
 To start, download and install the latest Apache Brooklyn release on both 
VMs following the instructions in
-[Running Apache Brooklyn]({{ site.path.guide 
}}/start/running.html#install-apache-brooklyn)
+[Running Apache Brooklyn]({{ site.path.tutorials }}/start/running.html)
--- End diff --

Does `site.path.tutorial` exists? I didn't see anywhere before


---


[GitHub] brooklyn-library pull request #124: use external config provider for demo pa...

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-library/pull/124#discussion_r138633960
  
--- Diff: 
examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql ---
@@ -19,18 +19,22 @@
 create database visitors;
 use visitors;
 
-# not necessary to create user if we grant (and not supported in some 
dialects)
-# create user 'brooklyn' identified by 'br00k11n';
-
-grant usage on *.* to 'brooklyn'@'%' identified by 'br00k11n';
-
-# ''@localhost is sometimes set up, overriding brooklyn@'%', so do a 
second explicit grant
-grant usage on *.* to 'brooklyn'@'localhost' identified by 'br00k11n';
 
+# the below will create user (and note create user not supported in some 
dialects)
+grant usage on *.* to 'brooklyn'@'%' identified by 
'${config["creation.script.password"]}';
--- End diff --

As I mentioned on the other PR, this is script is used quite a few 
different places 
[here](https://brooklyn.apache.org/v/latest/blueprints/multiple-services.html) 
for example. There should probably be a default so it doesn't break those 
places.


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-dist/pull/104


---


[GitHub] brooklyn-dist issue #105: Update Brooklyn vagrant

2017-09-13 Thread tbouron
Github user tbouron commented on the issue:

https://github.com/apache/brooklyn-dist/pull/105
  
retest this please


---


[GitHub] brooklyn-dist issue #104: Improve RPM/DEB packages

2017-09-13 Thread tbouron
Github user tbouron commented on the issue:

https://github.com/apache/brooklyn-dist/pull/104
  
@drigodwin Comment addressed except for the `Depends` package (see my 
comment above)


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138617661
  
--- Diff: 
karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg ---
@@ -0,0 +1,24 @@

+
+#
+#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.
+#

+
+
+# Web login credentials
+
+# Credentials for user 'admin'
+brooklyn.webconsole.security.users=admin
--- End diff --

Forgot this conversation, will change it back to no authentication


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138617340
  
--- Diff: deb-packaging/deb/control/control ---
@@ -19,6 +19,6 @@ Version: [[version]]
 Section: misc
 Priority: optional
 Architecture: all
-Depends: default-jre-headless (>= 1.7)
--- End diff --

I'm using `java8-runtime` because Karaf requires java 1.8. Using 
`default-jre-headless` could potentially install and use java 1.7 in older 
system which would be problematic when launching the service


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138614635
  
--- Diff: 
shared-packaging/src/main/resources/service/systemd/brooklyn.service ---
@@ -22,12 +22,16 @@ 
Documentation=https://brooklyn.apache.org/documentation/index.html
 [Service]
 Type=simple
 WorkingDirectory=/opt/brooklyn/
-Environment="JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 
-Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"

-Environment="CLASSPATH=/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-ExecStart=/usr/bin/java $JAVA_OPTS -cp "$CLASSPATH" 
org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties 
--localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto

+Environment="EXTRA_JAVA_OPTS=-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx1g"
--- End diff --

I think we set 2G as the Xmx everywhere else - [see 
here](https://github.com/apache/brooklyn-dist/blob/master/karaf/apache-brooklyn/src/main/resources/bin/setenv#L21)


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138614710
  
--- Diff: 
shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf ---
@@ -33,11 +34,13 @@ pre-start script
 end script
 
 script
-BROOKLYN_HOME="/opt/brooklyn/"
-JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 
-Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"
-
CLASSPATH="/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-export BROOKLYN_HOME
-exec java ${JAVA_OPTS} -cp "${CLASSPATH}" org.apache.brooklyn.cli.Main 
launch --noGlobalBrooklynProperties --localBrooklynProperties 
/etc/brooklyn/brooklyn.conf --persist auto
+EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx1g"
--- End diff --

Same as above


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138611933
  
--- Diff: 
karaf/apache-brooklyn/src/main/filtered-resources/etc/brooklyn.cfg ---
@@ -0,0 +1,24 @@

+
+#
+#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.
+#

+
+
+# Web login credentials
+
+# Credentials for user 'admin'
+brooklyn.webconsole.security.users=admin
--- End diff --

Do we want to have default credentials, I note the outcome from [[PROPOSAL] 
Remove unauthenticated localhost 
login](http://markmail.org/search/?q=[PROPOSAL]%20Remove%20unauthenticated%20localhost%20login#query:[PROPOSAL]%20Remove%20unauthenticated%20localhost%20login+page:1+mid:2f3q5vjf6rtxnpzt+state:results)
 was that we do not.


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138608902
  
--- Diff: deb-packaging/deb/control/control ---
@@ -19,6 +19,6 @@ Version: [[version]]
 Section: misc
 Priority: optional
 Architecture: all
-Depends: default-jre-headless (>= 1.7)
--- End diff --

In xenial `default-jre-headless` appears to be `openjdk-8-jre-headless` why 
does this need to change?


---


[GitHub] brooklyn-dist pull request #104: Improve RPM/DEB packages

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-dist/pull/104#discussion_r138614755
  
--- Diff: 
shared-packaging/src/main/resources/service/upstart/rpm/brooklyn.conf ---
@@ -30,13 +31,14 @@ pre-start script
 end script
 
 script
-BROOKLYN_HOME="/opt/brooklyn/"
-JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 
-Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"
-
CLASSPATH="/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-export BROOKLYN_HOME
-# Upstart is too old on CentOS 6, at least v1.4 required to use 
setuid, setgid.
+EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 
-XX:SoftRefLRUPolicyMSPerMB=1 -Xms256m -Xmx1g"
--- End diff --

Same as above


---


[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/750#discussion_r138607380
  
--- Diff: 
policy/src/main/java/org/apache/brooklyn/policy/location/CreateLocationPolicy.java
 ---
@@ -0,0 +1,288 @@
+/*
+ * 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.brooklyn.policy.location;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Policy that is attached to an entity to create a location configured
+ * using its sensor data. The created location is added to the catalog
+ * and will be removed when the entity is no longer running, based on
+ * the entity {@link Startable#SERVICE_UP} sensor status.
+ * 
+ * The policy definition includes configuration for the id, name and
+ * type of the location, as well as the {@link #LOCATION_CONFIG} map
+ * of config keys and the sensors used to define them.
+ * 
+ * The YAML below shows a policy that creates a {@code jclouds:aws-ec2}
+ * location with the region defined by a sensor on the entity it is
+ * attached to:
+ * {@code
+ * name: My App
+ * brooklyn.policies:
+ *   - type: org.apache.brooklyn.policy.location.CreateLocationPolicy
+ * id: create-my-cloud-location
+ * brooklyn.config:
+ *   location.catalogId: my-cloud
+ *   location.displayName: "My Cloud"
+ *   location.type: jclouds:aws-ec2
+ *   location.config:
+ * region: $brooklyn:sensor("aws.region")
+ * }
+ *
+ */
+@Beta
+public class CreateLocationPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateLocationPolicy.class);
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private String id;
+private String name;
+private AttributeSensor status;
+private Map> configuration;
+private String catalogId;
+private String displayName;
+private String type;
+private Set tags;
+
+public Builder id(String val) {
+this.id = val; return this;
+}
+public Builder name(String val) {
+this.name = val; return this;
+}
+public Builder status(AttributeSensor val) {
+this.status = val; return this;
+}
+public Builder configuration(Map> val) {
+this.configuration = val; return this;
+}
+public Builder catalogId(String val) {
+this.catalogId = val; return this;
+}
+public Builder displayName(String val) {
+this.displayName = val; re

[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/750#discussion_r138607947
  
--- Diff: 
policy/src/main/java/org/apache/brooklyn/policy/location/CreateLocationPolicy.java
 ---
@@ -0,0 +1,288 @@
+/*
+ * 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.brooklyn.policy.location;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Policy that is attached to an entity to create a location configured
+ * using its sensor data. The created location is added to the catalog
+ * and will be removed when the entity is no longer running, based on
+ * the entity {@link Startable#SERVICE_UP} sensor status.
+ * 
+ * The policy definition includes configuration for the id, name and
+ * type of the location, as well as the {@link #LOCATION_CONFIG} map
+ * of config keys and the sensors used to define them.
+ * 
+ * The YAML below shows a policy that creates a {@code jclouds:aws-ec2}
+ * location with the region defined by a sensor on the entity it is
+ * attached to:
+ * {@code
+ * name: My App
+ * brooklyn.policies:
+ *   - type: org.apache.brooklyn.policy.location.CreateLocationPolicy
+ * id: create-my-cloud-location
+ * brooklyn.config:
+ *   location.catalogId: my-cloud
+ *   location.displayName: "My Cloud"
+ *   location.type: jclouds:aws-ec2
+ *   location.config:
+ * region: $brooklyn:sensor("aws.region")
+ * }
+ *
+ */
+@Beta
+public class CreateLocationPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateLocationPolicy.class);
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private String id;
+private String name;
+private AttributeSensor status;
+private Map> configuration;
+private String catalogId;
+private String displayName;
+private String type;
+private Set tags;
+
+public Builder id(String val) {
+this.id = val; return this;
+}
+public Builder name(String val) {
+this.name = val; return this;
+}
+public Builder status(AttributeSensor val) {
+this.status = val; return this;
+}
+public Builder configuration(Map> val) {
+this.configuration = val; return this;
+}
+public Builder catalogId(String val) {
+this.catalogId = val; return this;
+}
+public Builder displayName(String val) {
+this.displayName = val; re

[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/750#discussion_r138606936
  
--- Diff: 
policy/src/main/java/org/apache/brooklyn/policy/location/CreateLocationPolicy.java
 ---
@@ -0,0 +1,288 @@
+/*
+ * 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.brooklyn.policy.location;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Policy that is attached to an entity to create a location configured
+ * using its sensor data. The created location is added to the catalog
+ * and will be removed when the entity is no longer running, based on
+ * the entity {@link Startable#SERVICE_UP} sensor status.
+ * 
+ * The policy definition includes configuration for the id, name and
+ * type of the location, as well as the {@link #LOCATION_CONFIG} map
+ * of config keys and the sensors used to define them.
+ * 
+ * The YAML below shows a policy that creates a {@code jclouds:aws-ec2}
+ * location with the region defined by a sensor on the entity it is
+ * attached to:
+ * {@code
+ * name: My App
+ * brooklyn.policies:
+ *   - type: org.apache.brooklyn.policy.location.CreateLocationPolicy
+ * id: create-my-cloud-location
+ * brooklyn.config:
+ *   location.catalogId: my-cloud
+ *   location.displayName: "My Cloud"
+ *   location.type: jclouds:aws-ec2
+ *   location.config:
+ * region: $brooklyn:sensor("aws.region")
+ * }
+ *
+ */
+@Beta
+public class CreateLocationPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateLocationPolicy.class);
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private String id;
+private String name;
+private AttributeSensor status;
+private Map> configuration;
+private String catalogId;
+private String displayName;
+private String type;
+private Set tags;
+
+public Builder id(String val) {
+this.id = val; return this;
+}
+public Builder name(String val) {
+this.name = val; return this;
+}
+public Builder status(AttributeSensor val) {
+this.status = val; return this;
+}
+public Builder configuration(Map> val) {
+this.configuration = val; return this;
+}
+public Builder catalogId(String val) {
+this.catalogId = val; return this;
+}
+public Builder displayName(String val) {
+this.displayName = val; re

[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/750#discussion_r138607171
  
--- Diff: 
policy/src/main/java/org/apache/brooklyn/policy/location/CreateLocationPolicy.java
 ---
@@ -0,0 +1,288 @@
+/*
+ * 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.brooklyn.policy.location;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Policy that is attached to an entity to create a location configured
+ * using its sensor data. The created location is added to the catalog
+ * and will be removed when the entity is no longer running, based on
+ * the entity {@link Startable#SERVICE_UP} sensor status.
+ * 
+ * The policy definition includes configuration for the id, name and
+ * type of the location, as well as the {@link #LOCATION_CONFIG} map
+ * of config keys and the sensors used to define them.
+ * 
+ * The YAML below shows a policy that creates a {@code jclouds:aws-ec2}
+ * location with the region defined by a sensor on the entity it is
+ * attached to:
+ * {@code
+ * name: My App
+ * brooklyn.policies:
+ *   - type: org.apache.brooklyn.policy.location.CreateLocationPolicy
+ * id: create-my-cloud-location
+ * brooklyn.config:
+ *   location.catalogId: my-cloud
+ *   location.displayName: "My Cloud"
+ *   location.type: jclouds:aws-ec2
+ *   location.config:
+ * region: $brooklyn:sensor("aws.region")
+ * }
+ *
+ */
+@Beta
+public class CreateLocationPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateLocationPolicy.class);
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private String id;
+private String name;
+private AttributeSensor status;
+private Map> configuration;
+private String catalogId;
+private String displayName;
+private String type;
+private Set tags;
+
+public Builder id(String val) {
+this.id = val; return this;
+}
+public Builder name(String val) {
+this.name = val; return this;
+}
+public Builder status(AttributeSensor val) {
+this.status = val; return this;
+}
+public Builder configuration(Map> val) {
+this.configuration = val; return this;
+}
+public Builder catalogId(String val) {
+this.catalogId = val; return this;
+}
+public Builder displayName(String val) {
+this.displayName = val; re

[GitHub] brooklyn-server pull request #750: Adds a policy to create locations from an...

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/750#discussion_r138608438
  
--- Diff: 
policy/src/main/java/org/apache/brooklyn/policy/location/CreateLocationPolicy.java
 ---
@@ -0,0 +1,288 @@
+/*
+ * 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.brooklyn.policy.location;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.trait.Startable;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Policy that is attached to an entity to create a location configured
+ * using its sensor data. The created location is added to the catalog
+ * and will be removed when the entity is no longer running, based on
+ * the entity {@link Startable#SERVICE_UP} sensor status.
+ * 
+ * The policy definition includes configuration for the id, name and
+ * type of the location, as well as the {@link #LOCATION_CONFIG} map
+ * of config keys and the sensors used to define them.
+ * 
+ * The YAML below shows a policy that creates a {@code jclouds:aws-ec2}
+ * location with the region defined by a sensor on the entity it is
+ * attached to:
+ * {@code
+ * name: My App
+ * brooklyn.policies:
+ *   - type: org.apache.brooklyn.policy.location.CreateLocationPolicy
+ * id: create-my-cloud-location
+ * brooklyn.config:
+ *   location.catalogId: my-cloud
+ *   location.displayName: "My Cloud"
+ *   location.type: jclouds:aws-ec2
+ *   location.config:
+ * region: $brooklyn:sensor("aws.region")
+ * }
+ *
+ */
+@Beta
+public class CreateLocationPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CreateLocationPolicy.class);
+
+public static Builder builder() {
+return new Builder();
+}
+
+public static class Builder {
+private String id;
+private String name;
+private AttributeSensor status;
+private Map> configuration;
+private String catalogId;
+private String displayName;
+private String type;
+private Set tags;
+
+public Builder id(String val) {
+this.id = val; return this;
+}
+public Builder name(String val) {
+this.name = val; return this;
+}
+public Builder status(AttributeSensor val) {
+this.status = val; return this;
+}
+public Builder configuration(Map> val) {
+this.configuration = val; return this;
+}
+public Builder catalogId(String val) {
+this.catalogId = val; return this;
+}
+public Builder displayName(String val) {
+this.displayName = val; re

[GitHub] brooklyn-server issue #812: use external config in examples

2017-09-13 Thread aledsage
Github user aledsage commented on the issue:

https://github.com/apache/brooklyn-server/pull/812
  
@m4rkmckenna there is a "file-based exteranl config supplier" you can use 
for dev (`PropertiesFileExternalConfigSupplier`), and then switch to Vault or 
whatever when you're ready.

But I think that @ahgittin's change here is a separate good addition as it 
means stock examples can work out-of-the-box without the user having to modify 
`brooklyn.cfg` to configure things like that, or to add the desired password to 
some file.

---
I agree with @drigodwin's suggestion of giving a default in 
`visitors-creation-script.sql` so that we don't break other people's examples 
that might be referencing that file. For Brooklyn 1.0.0 we can remove the 
default, perhaps first warning people on the mailing list.


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138606016
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/enricher/stock/Aggregator.java ---
@@ -65,18 +66,22 @@
 "'list' (the default, putting any collection of items 
into a list), " +
 "or 'first' (the first value, or null if empty)");
 
-public static final ConfigKey, ?>> 
TRANSFORMATION = ConfigKeys.newConfigKey(new TypeToken, ?>>() {},
-"enricher.transformation");
+public static final ConfigKey, ?>> 
TRANSFORMATION = ConfigKeys.newConfigKey(
+new TypeToken, ?>>() {},
+"enricher.transformation",
+"A function to be executed to evaluate the target sensor");
 
 /**
  * @see QuorumChecks
  */
 public static final ConfigKey QUORUM_CHECK_TYPE = 
ConfigKeys.newStringConfigKey(
-"quorum.check.type", "The requirement to be considered quorate 
-- possible values: " +
+"quorum.check.type", 
+"The requirement to be considered quorate (used with 
transformation of type 'isQuorate') -- possible values: " +
 "'all', 'allAndAtLeastOne', 'atLeastOne', 
'atLeastOneUnlessEmpty', 'alwaysHealthy'", "allAndAtLeastOne");
 
 public static final ConfigKey QUORUM_TOTAL_SIZE = 
ConfigKeys.newIntegerConfigKey(
-"quorum.total.size", "The total size to consider when 
determining if quorate", 1);
+"quorum.total.size", 
+"The total size to consider when determining if quorate (used 
iwth transformation of type 'isQuorate')", 1);
--- End diff --

typo iwth -> with


---


[GitHub] brooklyn-library pull request #125: Improve config and entity descriptions

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-library/pull/125


---


[GitHub] brooklyn-library issue #125: Improve config and entity descriptions

2017-09-13 Thread aledsage
Github user aledsage commented on the issue:

https://github.com/apache/brooklyn-library/pull/125
  
Thanks @m4rkmckenna - merging now.


---


[GitHub] brooklyn-server issue #819: Improve config key descriptions

2017-09-13 Thread aledsage
Github user aledsage commented on the issue:

https://github.com/apache/brooklyn-server/pull/819
  
Thanks @tbouron - comments addressed.

@drigodwin I believe you were also looking at this? Ready to merge?


---


[GitHub] brooklyn-server issue #818: More on adjunct highlights

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/818
  
Now has highlights on most things.


---


[GitHub] brooklyn-server pull request #814: Fix back compat of catalog java api

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-server issue #812: use external config in examples

2017-09-13 Thread m4rkmckenna
Github user m4rkmckenna commented on the issue:

https://github.com/apache/brooklyn-server/pull/812
  
Ignore me ... It was never added. 

But i do think the flow i mentioned above would be incredibly useful



---


[GitHub] brooklyn-server pull request #817: Optimizations

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/817#discussion_r138592431
  
--- Diff: 
utils/common/src/main/java/org/apache/brooklyn/util/guava/TypeTokens.java ---
@@ -24,6 +24,14 @@
 
 public class TypeTokens {
 
+// creating TypeToken is surprisingly expensive so cache these common 
ones
+public static TypeToken STRING = TypeToken.of(String.class);
--- End diff --

If leaving as-is, then these should be `final`.

I'd have gone for:
```
public static final Map, TypeToken> COMMON_TYPE_TOKENS = 
ImmutableMap., TypeToken>builder()
.put(String.class, TypeToken.of(String.class))
...
.build();
```

And:
```
TypeToken result = COMMON_TYPE_TOKENS.get(raw);
if (result == null) result = TypeToken.of((Class)raw);
return (TypeToken) result;
```


---


[GitHub] brooklyn-server pull request #817: Optimizations

2017-09-13 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/817#discussion_r138591570
  
--- Diff: 
utils/common/src/main/java/org/apache/brooklyn/util/guava/TypeTokens.java ---
@@ -68,5 +85,19 @@
 public static  Class getRawRawType(TypeToken token) {
 return (Class)token.getRawType();
 }
+
+/** Checks that if both type and token are supplied, either exactly 
one is null, or 
+ * they both refer to the same non-null type */
+public static  void checkCompatibleOneNonNull(Class 
type, TypeToken typeToken) {
+if ((type==null && typeToken!=null) || (type!=null && 
typeToken==null)) {
+return;
+}
+if (type==null && typeToken==null) {
+throw new NullPointerException("Type not set (neither class or 
type token)");
+}
+if (!type.equals(typeToken.getRawType())) {
+throw new NullPointerException("Invalid types, token is 
"+typeToken+" (raw "+typeToken.getRawType()+") but class is "+type);
--- End diff --

This should be `IllegalArgumentException` or `IllegalStateException`, 
rather than NPE.


---


[GitHub] brooklyn-server pull request #805: Modify jcloudsLocation.releaseNode

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-dist pull request #103: Make karaf release the primary one

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-dist/pull/103


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138584725
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/entity/BrooklynConfigKeys.java ---
@@ -180,23 +194,59 @@
  * component is up, but this entity does not care about the dependent 
component's actual config values.
  */
 
-public static final ConfigKey PROVISION_LATCH = 
newBooleanConfigKey("provision.latch", "Latch for blocking location provision 
until ready");
-public static final ConfigKey START_LATCH = 
newBooleanConfigKey("start.latch", "Latch for blocking start until ready");
+public static final ConfigKey PROVISION_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("provision.latch")
+.description("Latch for blocking machine provisioning; if 
non-null will wait for this to resolve (normal use is with 
'$brooklyn:attributeWhenReady')")
+.build();
+public static final ConfigKey START_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("start.latch")
+.description("Latch for blocking start (done post-provisioning 
for software processes); if non-null will wait for this to resolve (normal use 
is with '$brooklyn:attributeWhenReady')")
+.build();
 
 @Beta // on stop DSLs time out after a minute and unblock; may be 
easier to fix after https://github.com/apache/brooklyn-server/pull/390
-public static final ConfigKey STOP_LATCH = 
newBooleanConfigKey("stop.latch", "Latch for blocking stop until a condition is 
met; will block for at most 1 minute and then time out");
+public static final ConfigKey STOP_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("stop.latch")
+.description("Latch for blocking stop; if non-null will wait 
for at most 1 minute for this to resolve (normal use is with 
'$brooklyn:attributeWhenReady')")
+.build();
 
-public static final ConfigKey SETUP_LATCH = 
newBooleanConfigKey("setup.latch", "Latch for blocking setup until ready");
-public static final ConfigKey PRE_INSTALL_RESOURCES_LATCH = 
newBooleanConfigKey("resources.preInstall.latch", "Latch for blocking 
pre-install resources until ready");
-public static final ConfigKey INSTALL_RESOURCES_LATCH = 
newBooleanConfigKey("resources.install.latch", "Latch for blocking install 
resources until ready");
-public static final ConfigKey INSTALL_LATCH = 
newBooleanConfigKey("install.latch", "Latch for blocking install until ready");
-public static final ConfigKey RUNTIME_RESOURCES_LATCH = 
newBooleanConfigKey("resources.runtime.latch", "Latch for blocking runtime 
resources until ready");
-public static final ConfigKey CUSTOMIZE_LATCH = 
newBooleanConfigKey("customize.latch", "Latch for blocking customize until 
ready");
-public static final ConfigKey CUSTOMIZE_RESOURCES_LATCH = 
newBooleanConfigKey("resources.customize.latch", "Latch for blocking customize 
resources until ready");
-public static final ConfigKey LAUNCH_LATCH = 
newBooleanConfigKey("launch.latch", "Latch for blocking launch until ready");
+public static final ConfigKey SETUP_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("setup.latch")
+.description("Latch for blocking setup; if non-null will wait 
for this to resolve (normal use is with '$brooklyn:attributeWhenReady')")
+.build();
+
+public static final ConfigKey PRE_INSTALL_RESOURCES_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("resources.preInstall.latch")
+.description("Latch for blocking files being copied before the 
pre-install; if non-null will wait for this to resolve (normal use is with 
'$brooklyn:attributeWhenReady')")
+.build();
+public static final ConfigKey INSTALL_RESOURCES_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("resources.install.latch")
+.description("Latch for blocking files being copied before the 
install; if non-null will wait for this to resolve (normal use is with 
'$brooklyn:attributeWhenReady')")
+.build();
+public static final ConfigKey INSTALL_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("install.latch")
+.description("Latch for blocking install; if non-null will 
wait for this to resolve (normal use is with '$brooklyn:attributeWhenReady')")
+.build();
+public static final ConfigKey CUSTOMIZE_RESOURCES_LATCH = 
ConfigKeys.builder(Boolean.class)
+.name("resources.customize.latch")
+.description("Latch for blocking files being copied before 
customize; if non-null will wait for this to resolve (normal use is with 
'$brooklyn:attributeWhenReady')")
+.build

[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138585632
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/DynamicFabric.java ---
@@ -50,13 +51,20 @@
 + "for each given location).",
 true);
 
+@CatalogConfig(label = "Member spec")
 @SetFromFlag("memberSpec")
 ConfigKey> MEMBER_SPEC = ConfigKeys.newConfigKey(
-new TypeToken>() {}, 
"dynamiccfabric.memberspec", "entity spec for creating new cluster members", 
null);
+new TypeToken>() {}, 
+"dynamiccfabric.memberspec", 
+"entity spec for creating new members (one per location)", 
--- End diff --

s/entity/Entity/


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138584451
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java ---
@@ -52,11 +52,15 @@
 
 // TODO these should switch to being 
TemplatedStringAttributeSensorAndConfigKey
 BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new 
BasicAttributeSensorAndConfigKey(
-String.class, "download.url", "URL pattern for downloading the 
installer (will substitute things like ${version} automatically)");
+String.class, 
+"download.url", 
+"URL pattern for downloading the installer (will substitute 
things like ${version} automatically)");
--- End diff --

Shouldn't it just say `uses FreeMarker templating format` to be consistent 
with the other description below?


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138584470
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/entity/Attributes.java ---
@@ -52,11 +52,15 @@
 
 // TODO these should switch to being 
TemplatedStringAttributeSensorAndConfigKey
 BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new 
BasicAttributeSensorAndConfigKey(
-String.class, "download.url", "URL pattern for downloading the 
installer (will substitute things like ${version} automatically)");
+String.class, 
+"download.url", 
+"URL pattern for downloading the installer (will substitute 
things like ${version} automatically)");
 
 @SuppressWarnings({ "unchecked", "rawtypes" })
 BasicAttributeSensorAndConfigKey> 
DOWNLOAD_ADDON_URLS = new BasicAttributeSensorAndConfigKey(
-Map.class, "download.addon.urls", "URL patterns for 
downloading named add-ons (will substitute things like ${version} 
automatically)");
+Map.class, 
+"download.addon.urls", 
+"URL patterns for downloading named add-ons (will substitute 
things like ${version} automatically)");
--- End diff --

Shouldn't it just say `uses FreeMarker templating format` to be consistent 
with the other description below?


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread tbouron
Github user tbouron commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/819#discussion_r138585654
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/DynamicFabric.java ---
@@ -50,13 +51,20 @@
 + "for each given location).",
 true);
 
+@CatalogConfig(label = "Member spec")
 @SetFromFlag("memberSpec")
 ConfigKey> MEMBER_SPEC = ConfigKeys.newConfigKey(
-new TypeToken>() {}, 
"dynamiccfabric.memberspec", "entity spec for creating new cluster members", 
null);
+new TypeToken>() {}, 
+"dynamiccfabric.memberspec", 
+"entity spec for creating new members (one per location)", 
+null);
 
 @SetFromFlag("firstMemberSpec")
 ConfigKey> FIRST_MEMBER_SPEC = ConfigKeys.newConfigKey(
-new TypeToken>() {}, 
"dynamiccfabric.firstmemberspec", "entity spec for creating new cluster 
members", null);
+new TypeToken>() {}, 
+"dynamiccfabric.firstmemberspec", 
+"entity spec for the first member", 
--- End diff --

s/entity/Entity/


---


[GitHub] brooklyn-library pull request #125: Improve config and entity descriptions

2017-09-13 Thread aledsage
GitHub user aledsage opened a pull request:

https://github.com/apache/brooklyn-library/pull/125

Improve config and entity descriptions



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

$ git pull https://github.com/aledsage/brooklyn-library 
config-and-entity-descriptions

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

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


commit d1cb5c62ab6c72f2c8634c9b4023e9bd34f6d620
Author: Aled Sage 
Date:   2017-09-12T17:35:12Z

Improve config key descriptions

Also marks most important config keys as ‘CatalogConfig’ on some 
entities/policies/enrichers.

commit 021400ced7b1e94eb78bed074509fa67af0d37a1
Author: Aled Sage 
Date:   2017-09-12T17:35:28Z

catalog.bom: improve names/descriptions

commit 0d59c30c6fe7d84cd9e9ce9fc84851cd4399ec6a
Author: Aled Sage 
Date:   2017-09-12T17:36:33Z

DatastoreMixins.CanExecuteScript.COMMANDS: remove

Because entities extend this interface, they were reporting this as a
config key on the entity rather than just on the effector. Therefore
remove it as a constant.




---


[GitHub] brooklyn-server issue #812: use external config in examples

2017-09-13 Thread m4rkmckenna
Github user m4rkmckenna commented on the issue:

https://github.com/apache/brooklyn-server/pull/812
  
@ahgittin I think @neykov added a file based external config provider for 
this, That enable users to configure for development and then swap to a 
"proper" config provider. You could just configure it by default



---


[GitHub] brooklyn-server pull request #812: use external config in examples

2017-09-13 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/812#discussion_r138582530
  
--- Diff: 
camp/camp-brooklyn/src/test/resources/visitors-creation-script.sql ---
@@ -19,18 +19,22 @@
 create database visitors;
 use visitors;
 
-# not necessary to create user if we grant (and not supported in some 
dialects)
-create user 'brooklyn' identified by 'br00k11n';
-
-grant usage on *.* to 'brooklyn'@'%' identified by 'br00k11n';
-
-# ''@localhost is sometimes set up, overriding brooklyn@'%', so do a 
second explicit grant
-grant usage on *.* to 'brooklyn'@'localhost' identified by 'br00k11n';
 
+# the below will create user (and note create user not supported in some 
dialects)
+grant usage on *.* to 'brooklyn'@'%' identified by 
'${config["creation.script.password"]}';
--- End diff --

Previously @aledsage deleted [this 
version](https://github.com/apache/brooklyn-library/blob/master/examples/simple-web-cluster/src/main/resources/visitors-creation-script.sql)
 of the visitors creation script. We then found out a lot of downstream 
projects were using it. Do you think it would be worth adding a 
[default](http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default)
 here in case that is true for this file?


---


[GitHub] brooklyn-server issue #819: Improve config key descriptions

2017-09-13 Thread aledsage
Github user aledsage commented on the issue:

https://github.com/apache/brooklyn-server/pull/819
  
retest this please


---


[GitHub] brooklyn-server pull request #819: Improve config key descriptions

2017-09-13 Thread aledsage
GitHub user aledsage opened a pull request:

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

Improve config key descriptions

See individual commits for details.

Note the last two commits make significant changes to config:
* remove the default for `launch.command` of `VanillaSoftwareProcess`.
* Rename some config keys (deprecating the old names) for `latch.*` and 
`skip.*`.

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

$ git pull https://github.com/aledsage/brooklyn-server 
config-key-descriptions

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

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






---


[GitHub] brooklyn-server issue #813: Added highlights to policy endpoint

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/813
  
@m4rkmckenna re your general comment, a human client will use this to 
understand what's going on.  currently adjuncts (policies etc) are opaque 
unless you look at logs or tasks (or code).  highlights are an arbitrary set of 
summary info -- although with some conventions -- which let an adjunct 
communicate to a user at a high level what it has been doing.  on the premise 
that a little bit of sensibly distilled info is better than lots of raw info -- 
but sensible distillation does depend on the adjunct author a bit.  (i'd like 
to have activities properly tagged to adjuncts as well, so we can also expose 
lots of "raw" info.)

your point about javadoc is a good one so people know how to use these -- 
added in #818.

i prefer the name `HighlightTuple` as there is nothing adjunct-specific 
about them, just they are only used for adjuncts. 

i also prefer `Objects.equal` and `hashCode` _but_ if your IDE generates 
this for you or it has already been written i don't think it's worth the time 
to change ... doesn't create any value for user!


---


[GitHub] brooklyn-server issue #818: More on adjunct highlights

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/818
  
See 
https://github.com/apache/brooklyn-server/pull/818/commits/5ae9c41c1dc8d2884598a2375581d2c4dc14ce14#diff-0724222c7ef44a5337e1e8f44d9d5faeR114
 for illustration of what I mean by an easier adjunct java author API (just 
some convenience methods to allow DRY).


---


[GitHub] brooklyn-server pull request #818: More on adjunct highlights

2017-09-13 Thread ahgittin
GitHub user ahgittin opened a pull request:

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

More on adjunct highlights

Applies #813 to a policy (`ServiceRestarter`) to see how it works.  As 
reported there it works good, REST and persistence acting as expected.

The API for policy authors was a little awkward, and there were some PR 
review comments in #813.  This addresses both of these.

I will be adding highlight info to more policies and adjuncts.  If this is 
reviewed in time I'll do it in a different branch, else I'll add them here for 
simplicity.

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

$ git pull https://github.com/ahgittin/brooklyn-server highlights-adjuncts

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

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


commit 1a8df4275d61ddd69e6bc05b057c081dd4dcad34
Author: Alex Heneveld 
Date:   2017-09-13T08:07:44Z

use highlights in `ServiceRestarter`

commit 5ae9c41c1dc8d2884598a2375581d2c4dc14ce14
Author: Alex Heneveld 
Date:   2017-09-13T08:24:09Z

expand API for policy java authors, and address PR comments incl javadoc

see ServiceRestarter for example of how the API can be used by authors now




---


[GitHub] brooklyn-server pull request #813: Added highlights to policy endpoint

2017-09-13 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] brooklyn-server issue #813: Added highlights to policy endpoint

2017-09-13 Thread ahgittin
Github user ahgittin commented on the issue:

https://github.com/apache/brooklyn-server/pull/813
  
works a treat, did a sample impl on `ServiceRestarter`, and tested 
persistence too.  merging this.  i'll open a follow-on PR which will address 
the points here and show how it's used in that class.


---