Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6B36D200B62 for ; Fri, 29 Jul 2016 03:35:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 69D2B160A94; Fri, 29 Jul 2016 01:35:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8C45D160A85 for ; Fri, 29 Jul 2016 03:35:07 +0200 (CEST) Received: (qmail 11859 invoked by uid 500); 29 Jul 2016 01:35:06 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 11847 invoked by uid 99); 29 Jul 2016 01:35:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2016 01:35:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B8780C7E7A for ; Fri, 29 Jul 2016 01:35:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=cloudsoftcorp.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id B2PLycRPhUzo for ; Fri, 29 Jul 2016 01:35:03 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 736A95F1F5 for ; Fri, 29 Jul 2016 01:35:03 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id l65so87548513oib.1 for ; Thu, 28 Jul 2016 18:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=zrAitYktTLJAA7iZwfGAVNaePauMY2V4DGoW58JoLcM=; b=KzAj+8N4Cl3hUR6ixLJ1JWp36RmwUdoJym9LI6iA3x+ftDFKpJuLSa9HTmqd+N5BFX NAAI8ZMsDeZz4fHgkrrWhdQQw/6oKEK0oOtril1wp6ikhK1liJ//IEihfyVcxnGo37yM Keur46+bQZsyb4pnziEMvmkgiZCipdTE1EXPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=zrAitYktTLJAA7iZwfGAVNaePauMY2V4DGoW58JoLcM=; b=fNn8UEHayeoizCG+qoQXjPILFGNDrLiHmikMSI2ZKYRRYJriwuUHevv1oHTEbJURln sRRyZpWHwSh69dWKU0loJfqdIE2PlcqRrBikLNK1SpUZtNjDr0sxf+VUoizxTh1f/ejl 4ZFzNIl/NGAJ6Cs+4nqMxzGYSjx8mxPF9y/Z6bS9z5a3tQ5rdqGjrfZUnbc0IT/CMAiX vitaCgNQJ5ssjYG2eXHXoC+J2uekQa6NwFAAVNFaYqACYaygIhZt9sGRkYClU3XDgFFl HSE9vpdtNVYEoDqPCVQ9Lzi2+nCtXwOuS3QIdUq44up6v6cKtsqVEDXBiEJ2F07XE8W1 hZwQ== X-Gm-Message-State: AEkoousTVyvRAIGT//szyiyAcIXGN548kQVwB8mCUmlQiYO3BjgwB66AEkQK3y1JaHMlu+e2e9v74t+UoiL4glrfswNNHZ4xtN0F3wpPMUZU95qVRFYR787t73R4jTZse5VX/Fw9gjYV3rDxZzLbYg== X-Received: by 10.157.41.217 with SMTP id g25mr24597175otd.26.1469756097440; Thu, 28 Jul 2016 18:34:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Kennedy Date: Fri, 29 Jul 2016 01:34:47 +0000 Message-ID: Subject: Re: [PROPOSAL] Brooklyn DSL in YAML using custom YAML types To: dev@brooklyn.apache.org Content-Type: multipart/alternative; boundary=001a1141795018459a0538bc42f8 X-Legal-Virus-Advice: Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by Cloudsoft Corporation Limited in this regard and the recipient should carry out such virus and other checks as it considers appropriate. X-Legal-Confidentiality: This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. Cloudsoft Corporation Limited does not accept responsibility for changes made to this message after it was sent. X-Legal-Company-Info: Cloudsoft Corporation Limited. Registered in Scotland. Number: SC349230. Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP. archived-at: Fri, 29 Jul 2016 01:35:08 -0000 --001a1141795018459a0538bc42f8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi. The 'formatString' example you quote would normally be written like this, though: brooklyn.config: brooklyn.example.db.url: $brooklyn:formatString: - "jdbc:%s%s?user=3D%s\\&password=3D%s" - $brooklyn:component("db").attributeWhenReady("datastore.url") - "visitors" - "brooklyn" - "br00k11n" So, I'm not sure what we gain here? I'll have a proper look at the YAML spec, though, and see if I can understand it better. Cheers, Andrew. On Wed, 13 Jul 2016 at 13:35 Thomas Bouron wrote: > Hi All > > The YAML spec[1] has a very nice and standard way of defining custom type= s > by prefixing any value or object by a `!!`. This seems like a > perfect feature for the Brooklyn DSL instead of the `$brooklyn:`= . > Let's me explain why. > > Right now, a Brooklyn DSL command needs to be written as a string such as= : > $brooklyn:formatString("jdbc:%s%s?user=3D%s\\&password=3D%s", > component("db").attributeWhenReady("datastore.url"), > "visitors", "brooklyn", "br00k11n") > However, any good YAML library (such as js-yaml[2]) to parse and dump YAM= L > <--> JSON would wrap this string in quotes because it contains quotes or > reserved characters. That is the expected behaviour based on the > specification[3]. But this is an issue for the Brooklyn parser as the val= ue > will be treated as a `String` and not as a `DslCommand` object. > > So my proposal is as follow: support the Brooklyn DSL as a standard custo= m > YAML type. We obviously need to avoid any quote or reserved characters. > That is relatively simple for commands that takes only one parameter, for > instance: > > - $brooklyn:component('my-id') could become > - !brooklyn:component my-id > - $brooklyn:entitySpec would become > - !brooklyn:spec > > For the more complex ones, I created a gist[4] that illustrates how this > could work. It is more verbose than the current version but we get a rid = of > the hacky `$brooklyn` and comply fully to the YAML specification. > > Best. > > [1] http://yaml.org/spec/1.2/spec.html > [2] https://github.com/nodeca/js-yaml > [3] http://yaml.org/spec/1.2/spec.html#id2788859 > [4] https://gist.github.com/tbouron/67527796726e10689d8d3c34784cd7ec > > -- > > Thomas Bouron =E2=80=A2 Software Engineer @ Cloudsoft Corporation =E2=80= =A2 > http://www.cloudsoftcorp.com/ > Github: https://github.com/tbouron > Twitter: https://twitter.com/eltibouron > --=20 Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft --001a1141795018459a0538bc42f8--