brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorbett <>
Subject [GitHub] incubator-brooklyn pull request: Config constraints
Date Fri, 11 Sep 2015 19:44:50 GMT
GitHub user sjcorbett opened a pull request:

    Config constraints

    Allows constraints to be specified on config keys. 
    Constraints are eagerly enforced when entities are first managed and when policies and
enrichers are created. At other times they are not enforced. Constraints can only be checked
on ConfigKeys that are declared on the object's type hierarchy.
    A constraint is a `Predicate<T>`, where `T` is the type of the `ConfigKey` in question.
Guava's predicates provide almost all of the obvious use cases. I've written `ResourcePredicates.urlExists()`
to use with config keys that represent things like files Brooklyn will load and run through
Freemarker. I've verified that this works with resources in bundles. Adding this required
a couple of adjustments to `NonDeploymentManagementContext`.
    See the tests in `ConfigKeyConstraintTest` for most scenarios considered.
    Here's what you see if you give an invalid value for a config key using the `urlExists`

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

    $ git pull config-constraints

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

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

    This closes #890
commit ff5de9118c6ad3b0c1fcf147d209b2dc708232d0
Author: Sam Corbett <>
Date:   2015-08-25T15:51:17Z

    Javadoc improvements

commit a48f0e6589e6208d9680bab0134336b1e4aaad7c
Author: Sam Corbett <>
Date:   2015-08-26T09:58:07Z

    Constraints on ConfigKeys for entities
    And their validation when an entity is first managed.

commit d936a48de61e31eb9d5be1fc10d550853c6d9795
Author: Sam Corbett <>
Date:   2015-08-28T10:37:33Z

    Validation of config constraints on policies and enrichers.

commit 44d2cb6240aaa730473681d7a629e247136ec68b
Author: Sam Corbett <>
Date:   2015-09-11T12:47:26Z

    Config constraint improvements
    * Entity descendants are checked at management
    * Adds ConfigKey#isValueValid(T)
    * Incorporates into ApplicationResource#create

commit 65e54cfbb4f1d62f0500cb7348760dee85d78b7a
Author: Sam Corbett <>
Date:   2015-09-11T16:14:17Z

    Adds a predicate that is true if a resource is available via a
    configurable context object. ConfigConstraints looks for instances of the
    Brooklyn-object-aware predicate and calls apply(T, BrooklynObject) if
    Requires non-deployment management contexts to return useful entitlement
    and OSGi managers.
    Rework contextual predicates
    Context must be passed to apply, not set as a field on the predicate.

commit ecda5a0e84ad88eb5547b1ccff624a67371ac424
Author: Sam Corbett <>
Date:   2015-09-11T17:32:54Z

    Website documentation on constraints


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

View raw message