[GitHub] brooklyn-docs issue #158: Minor fix to Azure ARM docs
Github user andreaturli commented on the issue: https://github.com/apache/brooklyn-docs/pull/158 lgtm --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #614: Fix Transformer’s DSL resolving for fun...
GitHub user aledsage opened a pull request: https://github.com/apache/brooklyn-server/pull/614 Fix Transformerâs DSL resolving for function vals You can merge this pull request into a Git repository by running: $ git pull https://github.com/aledsage/brooklyn-server transformer-dsl-resolving Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-server/pull/614.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 #614 commit 135274a25bd212a1d06d8bba05de09e9df8f0090 Author: Aled SageDate: 2017-03-29T13:54:32Z Fix Transformerâs DSL resolving for function vals --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-docs pull request #158: Minor fix to Azure ARM docs
GitHub user nakomis opened a pull request: https://github.com/apache/brooklyn-docs/pull/158 Minor fix to Azure ARM docs You can merge this pull request into a Git repository by running: $ git pull https://github.com/nakomis/brooklyn-docs fix/azure-arm-docs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-docs/pull/158.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 #158 commit 3b0e58c93d289f815fc1d101a8eabfca7c3c5401 Author: Martin HarrisDate: 2017-03-29T13:53:17Z Minor fix to Azure ARM docs --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
Making blueprint upgrades easier - feature proposal
Hi All- I've been working with a few others on how we can simplify the process writing new versions of blueprints and applying them to existing deployments. * Imagine being able to do *cat blueprint.bom | * **br catalog add --upgrade --restart* to have deployments pick up a new version of a blueprint you're working *on (and an editor in the UI)** * Move towards a pure infrastructure as code ideal where all changes are done by redeploying blueprints (as opposed to changing config programmatically) Let us know what you think -- whether general, you like the idea, or a super-specific question on some subtle implication of a network config change. The doc is attached as PDF and at [1]. Best Alex [1] https://docs.google.com/document/d/1Lm47Kx-cXPLe8BO34-qrL3ZMPosuUHJILYVQUswEH6Y
[GitHub] brooklyn-server issue #589: yaml-test assertions: fix use of “matches”
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/589 @aledsage Can you expand on your thoughts re multiline support by default. Why is it surprising to have it on by default and why would one need to disable it? Especially if combined with `contains` behaviour. I suppose this is up to personal preference so I'm fine with any decision. The dev mailing list could be useful to probe what more ppl think. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #589: yaml-test assertions: fix use of “matches”
Github user tbouron commented on the issue: https://github.com/apache/brooklyn-server/pull/589 @aledsage My assumption was that those flags **were not** language specific, my bad. I think I will side with @geomacy and [his radical idea](https://github.com/apache/brooklyn-server/pull/589#issuecomment-285778134) => not touching the code but adding documentation on how to support multiline via the `(?s)` flag. I know it is java specific but the Brooklyn codebase is java, I don't see any reason against using it. Personally, I do prefer be in charge of what to match rather than letting Brooklyn trying to be smart and possibly fail. That being said, I'm happy to go with what the majority think it's best --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #589: yaml-test assertions: fix use of “matches”
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/589 @tbouron (cc @geomacy @neykov) agree, but I'm not sure from that what you think we should support. There are a few nuances to your second point (about regex): * Use of regex is not just for advanced authors - a lot of people use simple regexes such as `foo.*bar`. * The multiline support etc is language specific (e.g. see [1]). The use of `(?m)` and `(?s)` are java-specific I believe [2,3], so not nice for YAML users to expect them to know those. We'll need to document that, as Geoff says. * It feels (from my experience of using it) like there are two common use-cases for regex matching: one is matching everything (i.e. normal regex); the second is the "containsMatch" (e.g. using `TestSshCommand` to execute `ps aux` gives multiple line stdout, but a user is only interested in checking if it contains a string (on a single-line) that matches my regex; for that particular example some folk currently write `ps aux | grep -E ".*foo.*bar.*"` and check the exit code, but if the command fails, you don't get shown the actual output of `ps aux`, so some people end up executing `ps aux; ps aux | grep -E ".*foo.*bar.*"` to get around that!). Based on that, do you agree with these changes? What do you think we should support? [1] http://stackoverflow.com/a/159139/1393883 [2] http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#MULTILINE [3] http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946892#comment-15946892 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/612 +1 for supporting arbitrary objects, but making strings very easy to add. What about DSL in tags? This is a prerequisite for supporting objects, but on the other hand tags need to be evaluated at the time the entity is constructed which restricts DSL quite a bit. Need to be careful not to set the DSL object itself as a tag. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server issue #612: BROOKLYN-460: Brooklyn Camp syntax for adding ta...
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/612 +1 for supporting arbitrary objects, but making strings very easy to add. What about DSL in tags? This is a prerequisite for supporting objects, but on the other hand tags need to be evaluated at the time the entity is constructed which restricts DSL quite a bit. Need to be careful not to set the DSL object itself as a tag. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946886#comment-15946886 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108640523 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); +} else { +checkArgument(Iterables.all((List) brooklynTags, new Predicate() { +@Override +public boolean apply(@Nullable Object input) { +return input instanceof String; --- End diff -- I introduced only String tags in the PR. I suggest documenting that numbers should be in quotes at this stage. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108640523 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); +} else { +checkArgument(Iterables.all((List) brooklynTags, new Predicate() { +@Override +public boolean apply(@Nullable Object input) { +return input instanceof String; --- End diff -- I introduced only String tags in the PR. I suggest documenting that numbers should be in quotes at this stage. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108640433 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- @tbouron is onto something here. For example for effectors we go through an initializer and try not to expand the keywords too much. I think that anything that is a "first class concept" on an `EntitySpec` should have the corresponding way to express in yaml. There are tags on specs, so `brooklyn.tags` in CAMP makes sense. Similarly for `brooklyn.parameters`, `brooklyn.config`. There are no effectors on the `EntitySpec` so there are no `brooklyn.effectors` in CAMP. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946885#comment-15946885 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108640433 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- @tbouron is onto something here. For example for effectors we go through an initializer and try not to expand the keywords too much. I think that anything that is a "first class concept" on an `EntitySpec` should have the corresponding way to express in yaml. There are tags on specs, so `brooklyn.tags` in CAMP makes sense. Similarly for `brooklyn.parameters`, `brooklyn.config`. There are no effectors on the `EntitySpec` so there are no `brooklyn.effectors` in CAMP. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946883#comment-15946883 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/612 @bostko it's worth adding this test (which passes), for use of a DSL expression in the tags: ``` @Test public void testTagWithDslValue() throws Exception { Entity app = createAndStartApplication( "services:", "- type: " + BasicApplication.class.getName(), " brooklyn.tags:", " - $brooklyn:literal(\"myval\")"); assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("myval"))); } ``` > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server issue #612: BROOKLYN-460: Brooklyn Camp syntax for adding ta...
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/612 @bostko it's worth adding this test (which passes), for use of a DSL expression in the tags: ``` @Test public void testTagWithDslValue() throws Exception { Entity app = createAndStartApplication( "services:", "- type: " + BasicApplication.class.getName(), " brooklyn.tags:", " - $brooklyn:literal(\"myval\")"); assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("myval"))); } ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946879#comment-15946879 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/612 @bostko (cc @tbouron) Thinking about this more, I'm not sure what types we should support for tags. Maybe accepting any object is a bad idea, as it might make subsequent features harder to support (e.g. support for looking up / processing tags). On the other hand, locking down the types to be just strings without a good reason seems too extreme. Looking at the REST api (`org.apache.brooklyn.rest.resources.EntityResource.listTags()`), it turns the tags into json via the standard mechanism. It can therefore handle non-string types. if you use something that does not have a good json representation, then it becomes a lot less useful. But arguably that's the user's problem (presumably they had a reason for putting the object in the tags in the first place). > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server issue #612: BROOKLYN-460: Brooklyn Camp syntax for adding ta...
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/612 @bostko (cc @tbouron) Thinking about this more, I'm not sure what types we should support for tags. Maybe accepting any object is a bad idea, as it might make subsequent features harder to support (e.g. support for looking up / processing tags). On the other hand, locking down the types to be just strings without a good reason seems too extreme. Looking at the REST api (`org.apache.brooklyn.rest.resources.EntityResource.listTags()`), it turns the tags into json via the standard mechanism. It can therefore handle non-string types. if you use something that does not have a good json representation, then it becomes a lot less useful. But arguably that's the user's problem (presumably they had a reason for putting the object in the tags in the first place). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946876#comment-15946876 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108639142 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"- hi"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("hi"))); +} + +@Test +public void testDslMultipleTags() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - tAg2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tag1"))); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tAg2"))); +} + +@Test +public void testDslTagsFailNonList() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"tag1: true", +"tag2: 2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("test tag 1"))); +fail("Should throw IllegalArgumentException exception."); +} catch (CompoundRuntimeException e) { + Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags must be a list, is: "); +} +} + +@Test +public void testDslFailObjectTags() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - $brooklyn:object:", --- End diff -- I introduced only String tags since normally only types defined in `org.apache.brooklyn.core.mgmt.BrooklynTags` are used for tags. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108639142 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"- hi"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("hi"))); +} + +@Test +public void testDslMultipleTags() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - tAg2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tag1"))); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tAg2"))); +} + +@Test +public void testDslTagsFailNonList() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"tag1: true", +"tag2: 2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("test tag 1"))); +fail("Should throw IllegalArgumentException exception."); +} catch (CompoundRuntimeException e) { + Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags must be a list, is: "); +} +} + +@Test +public void testDslFailObjectTags() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - $brooklyn:object:", --- End diff -- I introduced only String tags since normally only types defined in `org.apache.brooklyn.core.mgmt.BrooklynTags` are used for tags. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946861#comment-15946861 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108635959 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- @aledsage By first-class citizen, I mean: do we want to create this specific `brooklyn.tags` key, like we did for `brooklyn.initializers` or `brooklyn.enrichers`? Is this the right thing to do? I don't have the answer to that hence why I'm asking the question > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108635959 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- @aledsage By first-class citizen, I mean: do we want to create this specific `brooklyn.tags` key, like we did for `brooklyn.initializers` or `brooklyn.enrichers`? Is this the right thing to do? I don't have the answer to that hence why I'm asking the question --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946860#comment-15946860 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108635893 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) --- End diff -- Thanks @aledsage ! I was looking for thing like `Objects.equal` but didn't find at the time. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108635893 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) --- End diff -- Thanks @aledsage ! I was looking for thing like `Objects.equal` but didn't find at the time. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #611: Deprecate groovy
Github user asfgit closed the pull request at: https://github.com/apache/brooklyn-server/pull/611 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946847#comment-15946847 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108634898 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"- hi"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("hi"))); +} + +@Test +public void testDslMultipleTags() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - tAg2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tag1"))); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tAg2"))); +} + +@Test +public void testDslTagsFailNonList() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"tag1: true", +"tag2: 2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("test tag 1"))); +fail("Should throw IllegalArgumentException exception."); +} catch (CompoundRuntimeException e) { + Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags must be a list, is: "); +} +} + +@Test +public void testDslFailObjectTags() throws Exception { +try { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - $brooklyn:object:", --- End diff -- Does this fail because it can't parse the DSL, or because it has evaluated it as a `TagsTestObject` instance, which is not a string? If the latter, why forbid it? Tags can be any object in the java API. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946854#comment-15946854 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108632848 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); +} else { +checkArgument(Iterables.all((List) brooklynTags, new Predicate() { +@Override +public boolean apply(@Nullable Object input) { +return input instanceof String; --- End diff -- Is this too strict? What about primitives? I tried the yaml below, and it failed at this assertion (because it has the int `2`): ``` services: - type: org.apache.brooklyn.entity.stock.BasicApplication brooklyn.tags: - tag1 - 2 ``` > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946853#comment-15946853 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108630028 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) --- End diff -- This will return not equals if both have `kind == null` and/or `contents == null`. Better to do: ``` if (!(other instanceof NamedStringTag)) { return false; } NamedStringTag o = (NamedStringTag) other; return Objects.equal(kind, o.kind) && Objects.equal(contents, o.contents); ``` > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946851#comment-15946851 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108629620 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) +&& contents != null && contents.equals(((NamedStringTag)other).contents); +} + +@Override +public int hashCode() { +return (kind == null ? 0 : kind.hashCode()) + (contents == null ? 0 : contents.hashCode()); --- End diff -- Personal preference is to use guava's utilities: `Objects.hashCode(kind, contents)` > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946846#comment-15946846 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108634462 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { --- End diff -- Why are these tests in the `DslYamlTest` class? This class is for testing `$brooklyn:...`. I'd probably create a new test class for this: `org.apache.brooklyn.camp.brooklyn.TagsYamlTest`. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946848#comment-15946848 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108630701 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -230,4 +237,51 @@ protected void addDecorationFromJsonMap(Map decorationJson, List> { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { --- End diff -- Minor personal preference: I'd store this as a variable rather than evaluating it twice. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946852#comment-15946852 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108633804 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- @tbouron what do you mean by a "first-class citizen" here? Do you mean are we right to be promoting it as a first-class citizen, or should we be promoting it more? It should be a first-class concept - it's not a part of config or anything like that. It needs to end up being added to the `EntitySpec` via `spec.tagsAdd(...)`. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946845#comment-15946845 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108631894 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { --- End diff -- You can declare the return type as `Iterable`, and therefore avoid the cast in `decorate()`. As an aside, the `entitySpec.tagsAdd() should really take an `Iterable` rather than an `Iterable`, but don't worry about that for this PR. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946850#comment-15946850 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108629390 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { --- End diff -- Very minor: don't need the `other == null`: `other instanceof NamedStringTag` is false when other is null. > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946843#comment-15946843 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108633186 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); --- End diff -- Perhaps instead log `brooklynTags` rather than `attrs`, and also include in the log message `" of type " + brooklynTags.getClass().getName()`. Don't need to repeat the null check for `brooklynTags != null` > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108633186 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); --- End diff -- Perhaps instead log `brooklynTags` rather than `attrs`, and also include in the log message `" of type " + brooklynTags.getClass().getName()`. Don't need to repeat the null check for `brooklynTags != null` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108634462 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { --- End diff -- Why are these tests in the `DslYamlTest` class? This class is for testing `$brooklyn:...`. I'd probably create a new test class for this: `org.apache.brooklyn.camp.brooklyn.TagsYamlTest`. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108634015 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test +public void testDslSingleTag() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +"- hi"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("hi"))); +} + +@Test +public void testDslMultipleTags() throws Exception { +final Entity app = createAndStartApplication( +"services:", +"- type: " + BasicApplication.class.getName(), +" brooklyn.tags:", +" - tag1", +" - tAg2"); --- End diff -- Include a test for a tag of a primitive type, e.g. `- 3`? (see earlier comment). --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108630028 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) --- End diff -- This will return not equals if both have `kind == null` and/or `contents == null`. Better to do: ``` if (!(other instanceof NamedStringTag)) { return false; } NamedStringTag o = (NamedStringTag) other; return Objects.equal(kind, o.kind) && Objects.equal(contents, o.contents); ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108629620 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) +&& contents != null && contents.equals(((NamedStringTag)other).contents); +} + +@Override +public int hashCode() { +return (kind == null ? 0 : kind.hashCode()) + (contents == null ? 0 : contents.hashCode()); --- End diff -- Personal preference is to use guava's utilities: `Objects.hashCode(kind, contents)` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #611: Deprecate groovy
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/611 Thanks @tbouron - merging now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108631894 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { --- End diff -- You can declare the return type as `Iterable`, and therefore avoid the cast in `decorate()`. As an aside, the `entitySpec.tagsAdd() should really take an `Iterable` rather than an `Iterable`, but don't worry about that for this PR. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108630131 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java --- @@ -59,6 +59,21 @@ public String getKind() { public String getContents() { return contents; } + +@Override +public boolean equals(Object other) { +if (other == null || !(other instanceof NamedStringTag)) { +return false; +} + +return kind != null && kind.equals(((NamedStringTag)other).kind) --- End diff -- Just realised this is in test code, so I really don't care that much! But comments are still worth taking on board for next time! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108632848 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -227,7 +234,54 @@ protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { @Override protected void addDecorationFromJsonMap(Map decorationJson, Listdecorations) { -throw new IllegalStateException("Not called"); +throw new UnsupportedOperationException("SpecParameterResolver.addDecorationFromJsonMap should never be called."); +} +} + +public static class TagsResolver extends BrooklynEntityDecorationResolver { +protected TagsResolver(BrooklynYamlTypeInstantiator.Factory instantiator) { +super(instantiator); +} + +@Override +public void decorate(EntitySpec entitySpec, ConfigBag attrs, Set encounteredRegisteredTypeIds) { +if (getDecorationAttributeJsonValue(attrs) != null) { + entitySpec.tagsAdd((Iterable)getDecorationAttributeJsonValue(attrs)); +} +} + +@Override +protected String getDecorationKind() { +return "Brooklyn Tags"; +} + +@Override +protected Object getDecorationAttributeJsonValue(ConfigBag attrs) { +Object brooklynTags = attrs.getStringKey(BrooklynCampReservedKeys.BROOKLYN_TAGS); +if (brooklynTags == null) { +return null; +} else if (brooklynTags != null && !(brooklynTags instanceof List)) { +throw new IllegalArgumentException(BrooklynCampReservedKeys.BROOKLYN_TAGS + " should be a List of String elements. You supplied " + attrs); +} else { +checkArgument(Iterables.all((List) brooklynTags, new Predicate() { +@Override +public boolean apply(@Nullable Object input) { +return input instanceof String; --- End diff -- Is this too strict? What about primitives? I tried the yaml below, and it failed at this assertion (because it has the int `2`): ``` services: - type: org.apache.brooklyn.entity.stock.BasicApplication brooklyn.tags: - tag1 - 2 ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #611: Deprecate groovy
Github user tbouron commented on the issue: https://github.com/apache/brooklyn-server/pull/611 @aledsage Yes, I think that covers everything so LGTM ð --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #611: Deprecate groovy
Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/611#discussion_r108634563 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java --- @@ -46,12 +58,20 @@ public T call(Entity entity, Map parameters) { /** convenience to create an effector supplying a closure; annotations are preferred, * and subclass here would be failback, but this is offered as - * workaround for bug GROOVY-5122, as discussed in test class CanSayHi + * workaround for bug GROOVY-5122, as discussed in test class CanSayHi. + * + * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ +@Deprecated public static ExplicitEffector create(String name, Class type, Listparameters, String description, Closure body) { +LOG.warn("Use of groovy.lang.Closure is deprecated, in ExplicitEffector.create()"); --- End diff -- Fair enough --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
[ https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15946833#comment-15946833 ] ASF GitHub Bot commented on BROOKLYN-460: - Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108633990 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- Thanks @m4rkmckenna . I opened BROOKLYN-460 as described in https://brooklyn.apache.org/developers/how-to-contribute.html > Brooklyn Camp syntax for adding tags to an entity spec > -- > > Key: BROOKLYN-460 > URL: https://issues.apache.org/jira/browse/BROOKLYN-460 > Project: Brooklyn > Issue Type: New Feature >Reporter: Valentin Aitken >Priority: Minor > > Current requirement is to be able to supply String tags in an entity spec in > YAML so it can be then retrieved via REST API with {{GET > /v1/applications//entities//tags}}. > Example usage in a YAML blueprint: > {noformat} > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > brooklyn.tags: > - tag1 > - tag2 > {noformat} > Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad...
Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108633990 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java --- @@ -257,6 +257,7 @@ public boolean canResolve() { new BrooklynEntityDecorationResolver.EnricherSpecResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.InitializerResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); new BrooklynEntityDecorationResolver.SpecParameterResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); +new BrooklynEntityDecorationResolver.TagsResolver(yamlLoader).decorate(spec, attrs, encounteredRegisteredTypeIds); --- End diff -- Thanks @m4rkmckenna . I opened BROOKLYN-460 as described in https://brooklyn.apache.org/developers/how-to-contribute.html --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Created] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec
Valentin Aitken created BROOKLYN-460: Summary: Brooklyn Camp syntax for adding tags to an entity spec Key: BROOKLYN-460 URL: https://issues.apache.org/jira/browse/BROOKLYN-460 Project: Brooklyn Issue Type: New Feature Reporter: Valentin Aitken Priority: Minor Current requirement is to be able to supply String tags in an entity spec in YAML so it can be then retrieved via REST API with {{GET /v1/applications//entities//tags}}. Example usage in a YAML blueprint: {noformat} services: - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess brooklyn.tags: - tag1 - tag2 {noformat} Please shout if you have further requirements for {{brooklyn.tags}}. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] brooklyn-server pull request #605: Add series of meta effectors for composit...
Github user robertgmoss commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/605#discussion_r108628950 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/composite/AbstractCompositeEffector.java --- @@ -0,0 +1,184 @@ +/* + * 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.core.effector.composite; + +import java.util.Map; +import java.util.Set; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntityLocal; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.util.collections.CollectionFunctionals; +import org.apache.brooklyn.util.core.config.ConfigBag; +import org.apache.brooklyn.util.guava.Maybe; +import org.apache.brooklyn.util.text.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.Beta; +import com.google.common.collect.Iterables; + +@Beta +public abstract class AbstractCompositeEffector extends AddEffector { + +private static final Logger LOG = LoggerFactory.getLogger(AbstractCompositeEffector.class); + +public AbstractCompositeEffector(Effector effector) { +super(effector); +} + +@Override +public void apply(EntityLocal entity) { +MaybeeffectorMaybe = entity.getEntityType().getEffectorByName(effector.getName()); +if (!effectorMaybe.isAbsentOrNull()) { +//Effector original = Effectors.effector(effectorMaybe.get()).name(ORIGINAL_PREFIX + effector.getName()).build(); +//((EntityInternal) entity).getMutableEntityType().addEffector(original); +} +super.apply(entity); +} + +protected static abstract class Body extends EffectorBody { +protected final Effector effector; +protected final ConfigBag params; + +public Body(Effector eff, ConfigBag params) { +this.effector = eff; +this.params = params; +} + +@Override +public abstract T call(final ConfigBag params); + +protected String getEffectorName(Object effectorDetails) { +String effectorName = null; +if (effectorDetails instanceof String) { +effectorName = (String) effectorDetails; +} else if (effectorDetails instanceof Map) { +Map effectorMap = (Map) effectorDetails; +Set keys = effectorMap.keySet(); +if (keys.size() != 1) { +throw new IllegalArgumentException("Effector parameter cannot be parsed: " + effectorDetails); +} +effectorName = Iterables.getOnlyElement(keys); +} else { --- End diff -- Indeed, it would clearly be a mistake - prefer to fail fast, so perhaps throwing an exception rather than allowing it to pass by calling `toString()` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #612: Brooklyn Camp syntax for adding tags to a...
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108628511 --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityDecorationResolver.java --- @@ -230,4 +237,51 @@ protected void addDecorationFromJsonMap(Map decorationJson, List
[GitHub] brooklyn-server pull request #600: Adds perf test for xml serialiser (and me...
Github user asfgit closed the pull request at: https://github.com/apache/brooklyn-server/pull/600 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #600: Adds perf test for xml serialiser (and memento-g...
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/600 Thanks @tbouron - merging now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server issue #611: Deprecate groovy
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/611 @tbouron I've responded to your comments - do you agree with those, or do you think I should make further changes before merging the PR? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #611: Deprecate groovy
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/611#discussion_r108627523 --- Diff: software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessImpl.java --- @@ -476,6 +476,11 @@ public void waitForServiceUp() { public void waitForServiceUp(Duration duration) { Entities.waitForServiceUp(this, duration); } + +/** + * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. + */ +@Deprecated --- End diff -- Yes, the parameter is of type `groovy.time.TimeDuration`. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #611: Deprecate groovy
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/611#discussion_r108627254 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/MethodEffector.java --- @@ -133,6 +133,10 @@ public MethodEffector(Method method) { this(new AnnotationsOnMethod(method.getDeclaringClass(), method), null); } +/** + * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. + */ +@Deprecated --- End diff -- My rule-of-thumb... if one might get at the code via a yaml blueprint (so never seeing a deprecation warning in your IDE/compiler), then we should include a log.warn. But if we can assume that the user will get compiler warnings, then that is sufficient. I believe that this will only get called directly in code, so one should see a compiler warning. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] brooklyn-server pull request #611: Deprecate groovy
Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/611#discussion_r108627021 --- Diff: core/src/main/java/org/apache/brooklyn/core/effector/ExplicitEffector.java --- @@ -46,12 +58,20 @@ public T call(Entity entity, Map parameters) { /** convenience to create an effector supplying a closure; annotations are preferred, * and subclass here would be failback, but this is offered as - * workaround for bug GROOVY-5122, as discussed in test class CanSayHi + * workaround for bug GROOVY-5122, as discussed in test class CanSayHi. + * + * @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. */ +@Deprecated public static ExplicitEffector create(String name, Class type, Listparameters, String description, Closure body) { +LOG.warn("Use of groovy.lang.Closure is deprecated, in ExplicitEffector.create()"); --- End diff -- I've added this to javadoc on the class - I think that's good enough, as there's not a direct replacement (i.e. one would extend `AbstractEffector` yourself instead, as we don't need to workaround for GROOVY-5122 if you're not using groovy - I'm not sure why anyone would want to do that). I agree in general that if deprecating a method/class, one should point at the alternative - but if deprecating a class, I don't think we need it on every method. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---