GitHub user ahgittin opened a pull request:

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

    YOML = YAML object mapping language [BIG!]

    *As discussed on mailing list...*
    
    I've been spiking a new approach to our YAML modelling for java objects.
    
    The root problem I want to solve is to that it's tedious, inconsistent, and 
poorly documented how YAML should map on to the Java items.  Every new place we 
want to do this we use ad hoc code.  This is an obstacle to writing new java 
items which can easily be configured in YAML by any Brooklyn user.
    
    The idea of the solution is to have a schema for mapping Java <-> YAML so 
you can simply annotate the Java classes and the job's done.  You get a working 
schema for reading from YAML without having to think about it.  The thinking is 
that this lets us make many more things expressible in YAML, including:
    
    * effectors defined as sequences of tasks
    * common predicates (as has been discussed in #282 [1] and the mailing list)
    * more sensor feeds, policies, etc
    
    I've built a prototype called "YOML" (YAML Object Mapping Language) and 
opened a PR for it [2].
    
    As it stands it supports reading and writing (so we could improve our 
persistence model and be able to output reusable plans from the current state 
of the world -- though I've not worked on those), and it's designed to be very 
flexible, optimizing for the experience of the human reading and writing it.
    
    It also has hooks for reflecting about itself -- meaning we could generate 
documentation and code completion proposals with explanations for everything 
that is YOML'd (though again not implemented).
    
    It's integrated with the new BrooklynTypeRegistry (code which replaces the 
old fixed-type-category catalog, allowing arbitrary types and aliases; it's 
used currently, but not persisted, and we're not taking advantage of it yet; we 
could also use this to restrict who can use which types) and has a 
TypePlanTransformer so we can use it in specific places.  You can use anywhere 
the YAML DSL is supported by saying `$brooklyn:object-yoml: ...`, and it's 
hooked in specially in one place, under brooklyn.initializers if you supply a 
map (previously only a list was allowed), with some sensor/effector tests at 
[3], in short allowing:
    
    - type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
      brooklyn.initializers:
        echo-hi-name-from-config:
          type: ssh-effector
          command: echo hi ${NAME}
          env:
            NAME: $brooklyn:config("name")
        date:
          type: ssh-sensor
          command: date
          period: 100ms
      brooklyn.config:
        name: bob
    
    A detailed write-up is at [4].
    
    I could do an online brown-bag session next week if folks are interested.
    
    [1]  https://github.com/apache/brooklyn-server/pull/282
    [2] (this)
    [3] 
https://github.com/ahgittin/brooklyn-server/blob/yoml/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/yoml/YomlTypeRegistryEntityInitializersTest.java
    [4] 
https://github.com/ahgittin/brooklyn-server/blob/yoml/utils/common/src/main/java/org/apache/brooklyn/util/yoml/sketch.md

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

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

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

    https://github.com/apache/brooklyn-server/pull/363.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 #363
    
----
commit 2a05370de0da5af73cb80276620cd923af0659a6
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-30T13:19:10Z

    bump httpcomponents versions
    
    note core and client are no longer kept in sync; latest version of each has 
been taken

commit 1d4a289ef55834e494ce493046fa1a6ab4b4026e
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-09T16:01:00Z

    Start work on YAML Object Relational Mapping Language

commit 7d350e1b88e0c933eeb97eeabf91a885368d1248
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-28T14:28:02Z

    minor tidies to utils

commit 29e1277254e40a5a21e7ff50042e2844e295cbf6
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-28T14:34:34Z

    add static Maybe.getException(maybe) to avoid messy casts to Absent, and 
Asserts methods

commit 76aec8b48aa9ce7b801a8264c0e86cd909b4ec4c
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-24T10:03:40Z

    more YORML improvements, now dealing with fields in fields, primtives, and 
coercion

commit 0ebe35430a76e8aeb8b6725b751eadabcebb7994
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-24T10:13:27Z

    flesh out much more of YORML

commit b28016bb5b9fce34ddb2c420e371c4686b355e47
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-24T21:50:37Z

    more yorml - implicit types and fail on incomplete read

commit 2ddcf8ee402a1df51bd35639e1f3ed1c49b8c293
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T00:14:31Z

    notes for explicit-field, failing test, and preparatory refactor

commit 2899685a3b69a2881c92da6e3a50d45e732e3697
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T01:23:12Z

    explicit fields basic working for expected types

commit 3f9f677647a32d97ebbecf59fb3d8b1208075717
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T02:04:38Z

    explicit fields working also for declared types
    
    using serializers on the blackboard
    and more refactor using now an internal package
    and cleaning up sketch

commit e52cf60c5d11b350de25021e5536b17e9c0fe22b
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T10:04:12Z

    WIP handling defaults, before switching to phases

commit 6d8d74d6218fdb413d03327262f34150fc437465
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T12:07:48Z

    switching to using phases for YORML conversion
    
    fleshing out how explicit fields will handle defaults/aliases,
    with tests,
    and fixing a bug in primitive handling

commit 8fd869abec5efe333bb9eb26299743cbf49c3c28
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T16:01:10Z

    serializers are inherited and explicit-field respects multiple/inherited
    
    also supporting multiple supertypes in the tests

commit 96bc455b38e062a9198e577a66f39a9bd220316a
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T16:18:54Z

    explicit-field alias control: inherit and exclude field name

commit df53b2c60d0a5df28a3d5b890108dd60e5d3876f
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-27T17:15:53Z

    name mangling for explicit-field, and tidies around constraint

commit e672a5624f299a455c41d3a593692f0ba60a2d1d
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-28T16:38:43Z

    support lists/sets, and tidy

commit 97e86597d668249ac3afca46ed20a4468084fe42
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-29T02:45:30Z

    misc utils minor improvements
    
    mainly around findMethod

commit c7651ac2256c1938495caa866ad683b0d67dad0d
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-29T02:46:17Z

    add yorml map support, fix list support, other minor fixes

commit 027a43a5053e91e388eabb95f510f85067e9efbd
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-29T10:53:38Z

    support enums

commit 0b67b89851c9286d30db946e360b3dd85c00c208
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-29T12:34:13Z

    easy way to make all fields explicit, and related fixes
    
    also failing test for map/list generics which i'm about to fix

commit 9328c3f1da3966c235015dbd5c92c42652d2ae17
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-29T13:37:28Z

    support generics from fields for map/list/set

commit c6daf517b21b462e0a55fcc047e5c0b2f06c9d53
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-06-30T12:36:17Z

    support clever parsing of singleton maps

commit 966a1b93496a692f90d930f41975918d365ad9eb
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-08-12T15:34:06Z

    yorml notes

commit 8824a3e8a37e241d16a4448432a892ac33eb49ce
Author: Alex Heneveld <alex@alexs-macbook-pro.local>
Date:   2016-08-31T14:28:06Z

    rename it YOML as it's not relational

commit a7e332933d44e081095ae67944cff680e5d80343
Author: Alex Heneveld <alex@alexs-macbook-pro.local>
Date:   2016-08-31T15:43:49Z

    docs tweaks

commit b9eef70d4acb13276deadd03afc28746751a5981
Author: Alex Heneveld <alex@alexs-macbook-pro.local>
Date:   2016-09-02T14:49:29Z

    camp yoml transformer and type-registry integration fleshing out
    
    tests demonstrate adding types and resolving them through the brooklyn type 
creation api

commit 81f03f346daf13c9bb55b10dd22b2d06f050beec
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-05T17:49:57Z

    minor yoml improvements

commit bbb178b35ca9681c78393032b031d78ffffb7877
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-07T14:48:12Z

    serializers and supertypes/java-type
    
    better handling for serializer collection and supertypes/java-type in 
underlying yoml and brooklyn registry integration
    and error reporting

commit ea092dbdc0b3db15d355a51ed53e14065e019858
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-07T17:04:19Z

    support annotations for serializers

commit ec0812158472a7b87bf4751603a634814905c3bf
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date:   2016-09-07T21:48:05Z

    support yoml annotations in transformer

----


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

Reply via email to