You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Torsten Juergeleit (JIRA)" <ji...@apache.org> on 2015/09/06 00:08:45 UTC
[jira] [Commented] (ISIS-369) For GSOC: Kemble: A domain-specific
language aligned with the Apache Isis programming conventions.
[ https://issues.apache.org/jira/browse/ISIS-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14732116#comment-14732116 ]
Torsten Juergeleit commented on ISIS-369:
-----------------------------------------
An implementation (alpha version) of this DSL can be found here \[1\]. A corresponding formal description of the implemented DSL is available here \[2\].
\[1\] https://github.com/vaulttec/isis-script
\[2\] https://github.com/vaulttec/isis-script/blob/develop/dsl.md#isis-script-dsl
> For GSOC: Kemble: A domain-specific language aligned with the Apache Isis programming conventions.
> --------------------------------------------------------------------------------------------------
>
> Key: ISIS-369
> URL: https://issues.apache.org/jira/browse/ISIS-369
> Project: Isis
> Issue Type: New Feature
> Components: ZZZ: GSOC
> Reporter: Dan Haywood
> Labels: ddd, domain-driven-design, dsl, framework, gsoc, gsoc2014, nakedobjects
>
> The obvious technology to use is Eclipse's XText [http://www.eclipse.org/Xtext/]. The grammar can be based on Xbase, which provides full Java type compatibility and extended language constructs (in common with in XTend, [http://www.eclipse.org/xtend/]).
> NB: xtext now has an FX-based UML integration; see: http://vimeo.com/104115680
> ~~~
> grammar org.apache.isis.kemble.Kemble
> with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations
> Below is a sketch of what that DSL might look like.
> For entities:
> @... // Isis and selected JDO annotations here
> entity Customer {
> ...
>
> inject ProductRepository products;
> inject OrderRepository orders;
> }
> where:
> - the products, orders imply an instance variable and a setter to allow services to be injected into
> - DomainObjectContainer container is provided automatically as a field
> For entity properties:
> entity Customer {
> @ ... // annotations here
> [derived] property String firstName {
> modify;
> clear;
> default;
> choices;
> hide;
> disable;
> validate;
> }
> }
> where
> - property is a keyword
> - String firstName
> - implies the instance variable and the getter
> - annotations can be specified, apply to the getter
> - derived is an optional keyword
> - if present, then only the hide keyword may be used
> - if present, then the getter is in the business logic interface, not structural.
> - modify;
> - is optional
> - if present, implies the modifyXxx(String value) method
> - clear;
> - is optional
> - if present, implies the void clearXxx() method
> - default;
> - is optional
> - if present, implies the String defaultXxx() method
> - choices;
> - is optional
> - if present, implies the Collection<String> choicesXxx() method
> - hide;
> - is optional
> - if present, implies the boolean hideXxx() method
> - disable;
> - is optional
> - if present, implies the String disableXxx() method
> - validate;
> - is optional
> - if present, implies the String validateXxx(String value) method
>
> similarly for entity collections:
> entity Customer {
> @ ... // annotations here
> [derived] collection List<Order> orders {
> addTo;
> removeFrom;
> hide;
> disable;
> validateAddTo;
> validateRemoveFrom;
> }
> }
> where
> - collection is a keyword
> - derived is an optional keyword
> - if present, then only the hide keyword may be used
> - if present, then the getter is in the business logic interface, not structural.
> - addTo;
> - is optional
> - if present ,implies void addTo(Order o) { }
> - removeFrom;
> - is optional
> - if present ,implies void removeFrom(Order o) { }
> - hide;
> - as properties
> - disable;
> - as properties
> - validateAddTo;
> - is optional
> - if present ,implies String validateAddToXxx(Order o) { ... }
> - validateRemoveFrom;
> - is optional
> - if present ,implies String validateRemoveFromXxx(Order o) { ... }
>
> and similarly for entity actions:
> entity Customer {
> @... // annotations here
> action Order placeOrder {
> param Product product {
> default;
> choices;
> autoComplete;
> validate;
> },
> param int quantity {
> default;
> choices;
> autoComplete;
> validate;
> },
> param String description {
> default;
> choices;
> autoComplete;
> validate;
> }
> }
> hide;
> disable;
> validate;
> }
> }
> where
> - the name of the parameter would imply @Named(...)
> - param's default:
> - is optional
> - corresponds to: Product default0PlaceOrder() { ... }
> or: int default1PlaceOrder() { ... }
> or: String default2PlaceOrder() { ... }
> - param's choices
> - is optional
> - corresponds to: Collection<Product> default0PlaceOrder() { ... }
> or: Collection<Integer> choices1PlaceOrder(Product p) { ... }
> or: Collection<String> choices2PlaceOrder(Product p, int quantity) { ... }
> - note how the Nth method has N-1 params
> - ALSO: cannot have both choices and autoComplete
> - param's autoComplete
> - is optional
> - corresponds to Collection<Product> autoComplete0PlaceOrder(String search) { ... }
> or: Collection<Integer> autoComplete1PlaceOrder(Product p, String search) { ... }
> or: Collection<String> autoComplete2PlaceOrder(Product p, int quantity, String search) { ... }
> - note how the Nth method has N-1 params + search arg
> - ALSO: cannot have both choices and autoComplete
> validate for the parameters apply to that parameter
> - is optional
> - corresponds to String validate0PlaceOrder(Product p) { ... }
> or: String validate1PlaceOrder(int quantity) { ... }
> or: String validate2PlaceOrder(String search) { ... }
> - hide
> - is optional
> - corresponds to boolean hidePlaceOrder() { ... }
> - disable
> - is optional
> - corresponds to String disablePlaceOrder() { ... }
> - validate (at action level)
> - corresponds to validateXxx(...)
> - to validate the set of arguments rather than an individual parameter
>
>
> ~~~~~~~~~~~~
> THIS STUFF OUT OF SCOPE/NOT NECESSARY
> For values:
> value FractionalNumber {
> int numerator;
> int denominator;
> }
> is basically the same as Lombok @Data
> requires information in @ValueSemanticsProvider to be specified (somehow, not sure exactly how)
> ~~~~~~~~~~~~
> THIS STUFF OUT OF SCOPE/NOT NECESSARY
> For services/repositories:
> service ProductRepository {
> }
> where:
> - any services are injected into as for entities
> - DomainObjectContainer container is provided for free, again as for entities
> - actions as for entities
> - properties and collections are disallowed
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)