« Die Gier, die nach **** in mir | Main | NKOTB »

Sonntag, Oktober 23, 2011

GWT spring roo ts

Warum roo?

Ich will Spring IOC, DI und frameworks. Ich will eine Java-Umgebung als Hoster, möglichst kostengünstig: GAE. Ich will GWT und GAE und CRUD. ohne dafür GUIs bauen zu müssen. Ich will die neuesten GWT-Sachen (Eventbus, Activity, Places). Ich will mich mit einer einfachen DSL auf die Domäne konzentrieren, nicht auf den Request-Zyklus oder Persistenz.

Aber wie immer gilt auch hier: Besser man ist mal zu Fuß den Weg gegangen, eine Web 2.0 App mit GAE, GWT, Spring zu bauen, ansonsten steht man bei den ersten roo-Fehler im Regen. Und man sollte das "roo-Undo" mit git unbedingt nutzen. Sonst ist schnell mal was hingeneriert, was keiner braucht... In jeden Fall ist post-generatem immer mal gut, zu wissen was roo so alles raushaut.

Basic building blocks:

Editor Framework

You might be wondering how the generated application reads and writes entity objects from and to the view. It is all hidden away inside the GWT Editor Framework, which provides the functionality implicitly, using the marker interface pattern.

The RequestFactory

The RequestFactory and JPA provide an easy way to build data-oriented CRUD applications and together make up the data-access layer of our Roo-generated application.Built to complement the service-oriented GWT RPC and not replace it, the data-oritented RequestFactory is GWT's new mechanism that provides more efficient client/server data transfer. It allows us to define data-centric Entity classes on the server side and to define business logic with EntityProxy on the client side.

Entity

Entity s are server-side Data Access Objects (DAO) in our RequestFactory mechanism and should be placed in a package that will not be converted to JavaScript by GWT.

EntityProxy

Objects that implement the EntityProxy interface are Data Transfer Objects (DTO) and client-side representations of corresponding Entity objects. The exclusive use of EntityProxy interface on the client side relieves us from the requirement of writing GWT-compatible code in our Entity implementations.The BaseProxy interface, along with others that extend EntityProxy interface, enables RequestFactory to determine fields that have changed and send only these changes to the server.

Activity Pattern

In the application that Roo has generated for us, the Activity is the implementation of the Presenter component and IsWidget is the implementation of the View component of our MVP pattern.

Activity

An Activity is completely isolated from the view and contains no widgets or UI code. This isolation greatly simplifies the testing of logic contained within an Activity.

Place

A Place is a bookmarkable state for a Web application. An Activity needs a corresponding Place in order to be accessible via a URL. It has an associated PlaceTokenizer that serializes the Place's state to a URL token.

PlaceController

The PlaceController manages the current Place and navigation between Places in a Web application and makes the back-button and bookmarks work as users would expect.

Also ans Werk mit meinem Medienboten-Projekt und diesem Script:

project --topLevelPackage de.tixus.roo.mb

persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE

enum type --class ~.shared.domain.Gender

enum constant --name MALE

enum constant --name FEMALE

enum type --class ~.shared.domain.TypeOfPerson

enum constant --name CUSTOMER

enum constant --name STAFF

enum type --class ~.shared.domain.MediaKind

enum constant --name BOOK

enum constant --name BIGFONT

enum constant --name CD

entity --class ~.server.domain.Person --testAutomatically

field string --fieldName displayName --notNull

field string --fieldName userName --sizeMin 3 --sizeMax 30 --notNull

field string --fieldName firstName

field string --fieldName lastName

field reference --type Person staff

field enum --fieldName gender --type ~.shared.domain.Gender

field enum --fieldName type --type ~.shared.domain.TypeOfPerson

field boolean --fieldName admin --notNull

entity --class ~.server.domain.MediaItem --testAutomatically

field string --fieldName mediaNumber --notNull

field string --fieldName title --notNull

field string --fieldName shortDescription

field number --type java.lang.Integer publicationYear

field enum --fieldName mediaKind --type ~.shared.domain.MediaKind

field number --type java.lang.Integer amount

field reference --type ~.server.domain.Person lentTo

web mvc setup

web mvc all --package ~.web

-- web mvc language --code de

security setup

gwt setup

logging setup --level DEBUG

>mvn gwt:run

Probleme:

Plugin execution not covered by lifecycle configuration: org.datanucleus:maven-datanucleus-plugin:1.1.4:enhance (execution: default, phase: compile) pom.xml /mb line 710 Maven Project Build Lifecycle Mapping Problem

->Use quick fix

Project configuration is not up-to-date with pom.xml. Run project configuration update mb line 1 Maven Configuration Problem

->maven->update project configuration

->Add roo project nature

Enables roo shell and allows for Google WebApplication

->Run As ... Google WebApplication -Tataa:

Erstellt von tixus um 11:57 PM Kategorien: Software + Java
Powered by
Thingamablog 1.1b6