]
Antonio Goncalves commented on FORGE-2316:
------------------------------------------
2:01:38 agoncal So Stacks and Scaffolding could be mix and match:
22:01:55 agoncal stack-setup JAVAEE7
22:02:12 agoncal project-new --name My2TierProj
22:02:14 gastaldi how would that be different from javaee-setup --javaEEVersion 7?
22:02:19 gastaldi ah
22:02:25 agoncal scaffold --provider Faces
22:02:28 gastaldi you mean stacks as being an environmental thing
22:02:36 agoncal But what you could also do is :
22:02:41 gastaldi stack-setup WILDFLY
22:02:41 agoncal stack-setup JAVAEE7
22:02:45 agoncal (same stack)
22:02:50 gastaldi interesting
22:02:56 gastaldi stack-setup SPRING
22:02:57 agoncal project-new --name My3TierProj
22:03:06 bobmcw has quit: Remote host closed the connection.
22:03:09 agoncal scaffold --provider Faces --architecture 3-TIER
22:03:22 agoncal Yes, exactly
22:03:34 agoncal stack-setup JAVAEE7-MICROSERVICE
22:03:41 gastaldi as for the architecture, we could enhance the FacesScaffoldProvider to
do that
22:03:53 agoncal (using the full Java EE API, but with WildflySwar for example)
22:04:12 agoncal I think it's too restrictive
22:04:21 agoncal FacesScaffoldProvider is for JSF
22:04:39 gastaldi you mean 3-TIER based on the chosen stack
22:04:41 gastaldi stack-setup ANGULAR
22:04:46 agoncal But what if you want a Service tier with a JSF UI *and* a REST
interface
22:05:01 gastaldi a bit unlikely, but possible ;)
22:05:10 agoncal Yes, 3-Tier in Java EE 7 is : JPA -> EJB(JTA) -> JSF
22:05:42 agoncal 2-Tier in Java EE 7 is : JPA -> JSF(JTA)
22:05:52 gastaldi yes
22:06:04 agoncal So there is a difference between stack (basically the set of APIs you
will be using)
22:06:18 gastaldi 4-Tier : add JMS to the stack :)
22:06:19 agoncal and the way you will be using those APIs (2-Tier, 3-Tier...)
22:06:23 agoncal yes
22:06:51 gastaldi yeah, that sounds nice
22:07:10 agoncal That will be in Forge 3 using Java 8 ;o)
Brainstorming on introducing "Stacks"
-------------------------------------
Key: FORGE-2316
URL:
https://issues.jboss.org/browse/FORGE-2316
Project: Forge
Issue Type: Task
Reporter: Antonio Goncalves
Fix For: 2.x Future
At the moment Forge generates code without having a real notion of a technical stack. For
example, creating a JPA Entity for a Java EE 6 application could be different from a Java
EE 7 application :
* The {{persistence.xml}} version if different (2.0 / 2.1)
* The {{properties}} are different (e.g. schema generation in 2.1)
* The syntax is different ({{List<MyEntity> m = new ArrayList<MyEntity>}}
while it could use diamond syntax for a Java EE 7 stack)
The stack could be choosen when the project is created :
* {{project-new --named myproj}} : let's the developper use Forge without any special
stack
* {{project-new --named myproj --stack JavaEE7}} : the generated code will follow Java EE
7
h3. Possible stacks
A stack would bundle certain facets. Therefore we could have as many stacks as needed. As
an example, we could have the following stacks :
* Java EE 6 : JPA 2.0, CDI 1.0, JSF 2.0, Bean Validation 1.0, JTA 1.1
* Java EE 7 : JPA 2.1, CDI 1.1, JSF 2.2, Bean Validation 1.1, JTA 1.2, Batch 1.0
* Micro Java EE 7 Service: JPA 2.1, CDI 1.1, JSF 2.2, Bean Validation 1.1, JTA 1.2, Batch
1.0 (but with special Microservice configuration)
* Java EE 8 : JPA 2.1, CDI 2.0, JSF 2.3, Bean Validation 1.2, JTA 1.2, Batch 1.0, JCache
1.1, MVC 1.0
* Spring 3.x
* Spring 4.x
* ....
h3. Differences in having stacks
h4. Filtering commands
When you pick up a Stack, it gives you access or not to certain commands. For example, if
you create a project with a Java EE 6 stack, you won't have access to any Batch,
MVC... commands
{code:title=Java EE 6 stack}
$ project-new --named myproj --stack JavaEE6
$ jpa-new-entity --named MyEntity
{code}
{code:title=Java EE 7 stack}
$ project-new --named myproj --stack JavaEE7
$ jpa-new-entity --named MyEntity
$ mvc-new-controller --named MyController // only available on EE7
{code}
h4. Setting up command versions
When you pick up a Stack, it filters the commands that have the right version for the
right stack. For example, if you create a Java EE 6 stack, you will get JPA 2.0 commands,
for a Java EE 7 stack, the JPA 2.1 commands. Also, the {{version}} parameters will be
disabled
{code:title=No stack}
$ project-new --named myproj
$ jpa-new-entity --named MyEntity --jpaVersion 2.1
$ cdi-new-bean --named MyBean --cdiVersion 1.1
{code}
{code:title=Java EE 6 stack}
$ project-new --named myproj --stack JavaEE6
$ jpa-new-entity --named MyEntity // no --jpaVersion because it is automatically set to
2.0
{code}
{code:title=Java EE 7 stack}
$ project-new --named myproj --stack JavaEE7
$ jpa-new-entity --named MyEntity // no --jpaVersion because it is automatically set to
2.1
$ jpa-new-converter --named MyConvert // JPA Converters are only available in 2.1
{code}