MyEclipse Logo

MyEclipse for Spring - Reference

Niel Eyde

Skyway Software, Inc.


Table of Contents

1. Overview
1. Spring MVC Scaffolding (CRUD)
2. Spring DSL
2. Code Generation Wizards
1. Add Spring Code Generation Capabilities...
1.1. Setup
1.2. Web Layer Generation
1.3. Service Layer Generation
1.4. Domain Layer Generation
1.5. Data Access Layer Generation
1.6. Runtime Dependencies
1.7. Summary
2. Add Spring Runtime Dependencies...
2.1. Intro
2.2. Runtime Dependencies
2.3. Copy Static Content
2.4. Summary
3. Scaffold Spring MVC CRUD Application from...
3.1. Select Project
3.2. Select Artifact Types
3.3. Select Artifacts for Scaffolding
3.4. SelectPrimaryKeys (for java bean scaffolding only)
3.5. Application Layers and Packages
3.6. Specify Persistence Connection
3.7. Select Target Folders
3.8. Select DB Connection (for DB scaffolding only)
3.9. Select Database Tables (for DB scaffolding only)
3.10. Database Scaffolding Options (for DB scaffolding only)
3.11. Summary
4. Scaffold Spring Security
4.1. Select Location
3. Spring DSL
1. Project Editor
1.1. Overview Tab
1.2. Category Mapping Tab
1.3. Web Application Tab
1.4. Enterprise Configuration Tab
1.5. Spring Configuration Tab
1.6. Code Generation Tab
4. Service
1. New Skyway Service Wizard
1.1. New Service
2. Service Editor
2.1. Overview Tab
2.2. Variables Tab
2.3. Spring Bean Configuration Tab
2.4. Code Generation Tab
2.5. JAXWS Web Service Tab
2.6. DWR Tab
5. Controller
1. New Web Controller Wizard
1.1. New Web Controller
2. Web Controller Editor
2.1. Overview Tab
2.2. Spring MVC Tab
2.3. Variables Tab
2.4. Spring Bean Configuration Tab
2.5. Code Generation Tab
6. Component
1. New Component Wizard
1.1. New Component
2. Component Editor
2.1. Overview Tab
2.2. Variables Tab
2.3. Code Generation Tab
2.4. Spring Bean Configuration Tab
7. Operation
1. New Operation Wizard
1.1. New Operation
1.2. Operation Options
2. Operation Editor
2.1. Overview Tab
2.2. Input / Outputs Tab
2.3. Spring Bean Configuration Tab
2.4. Code Generation Tab
8. Web Flow
1. New Web Flow Wizard
1.1. New Web Flow
1.2. Web Flow Domain Model
2. Web Flow Editor
9. Domain Objects
1. New Domain Object Wizard
1.1. New Domain Object
2. Domain Object Editor
2.1. Overview Tab
2.2. Persistence Mapping Tab
2.3. Code Generation Tab
10. Data Access Object
1. Data Access Object Wizard.
1.1. New Data Access Object
1.2. Add Domain Objects
2. Data Access Object Editor
2.1. Overview Tab
2.2. Spring Bean Configuration Tab
2.3. Database Configuration Tab
2.4. Code Generation Tab
11. Named Query
1. Named Query Wizard
1.1. New Named Query
2. Named Query Editor
2.1. Overview Tab
2.2. Inputs / Outputs Tab
2.3. Query Text Tab
2.4. Spring Bean Configuration Tab
12. Exception
1. New Exception Wizard
1.1. New Exception
2. Exception Editor
2.1. Overview Tab
2.2. Code Generation Tab
13. Model Package
1. New Model Package Wizard
1.1. New Model Package
14. Project Properties
1. Spring Code Generation
1.1. Properties
15. Workspace Preferences
1. Workspace Preferences
1.1. Code Generation
1.2. Deployment
1.3. Modeling
1.4. Webflow Diagram

List of Tables

2.1. Add Spring Code Generation Capabilities - Setup Panel
2.2. Add Spring Code Generation Capabilities - Web Layer Generation Panel
2.3. Add Spring Code Generation Capabilities - Service Layer Generation Panel
2.4. Add Spring Code Generation Capabilities - Domain Layer Generation Panel
2.5. Add Spring Code Generation Capabilities - Web Layer Generation Panel
2.6. Add Spring Code Generation Capabilities - Runtime Dependencies Panel
2.7. Add Spring Runtime Dependencies - Runtime Dependencies Panel
2.8. Artifact Category Mappings Window
2.9. Scaffold Spring MVC CRUD Application - Select Project Panel
2.10. Scaffolding Artifact Types
2.11. Scaffold Spring MVC CRUD Application - Select Artifact Type(s) Panel
2.12. Scaffold Spring MVC CRUD Application - Select Artifacts for Scaffolding Panel
2.13. Scaffold Spring MVC CRUD Application - Select Primary Key(s) Panel
2.14. Scaffold Spring MVC CRUD Application - Application Layers and Packages Panel
2.15. Scaffold Spring MVC CRUD Application - Specify Persistence Connection Panel
2.16. Scaffold Spring MVC CRUD Application - Select Target FoldersPanel
2.17. Scaffold Spring MVC CRUD Application - Select DB Connection Panel
2.18. Scaffold Spring MVC CRUD Application - Select Database Tables Panel
2.19. Scaffold Spring MVC CRUD Application - Select DB Scaffolding Options Panel
2.20. Scaffold Spring MVC CRUD Application - Summary Panel
2.21. Scaffold Spring Security - Select Location Panel
3.1. Project Editor - Overview Tab
3.2. Project Editor - Category Mapping Tab
3.3. Project Editor - Web Application Tab
3.4. Project Editor - Enterprise configuration Tab
3.5. Project Editor - Spring Configuration Tab
3.6. Project Editor - Code Generation Tab - Persistent Collection Type
3.7. Project Editor - Code Generation Tab - Code Generation
3.8. Code Generation Tokens
4.1. New Skyway Service Window
4.2. Skyway Service Editor - Overview tab
4.3. Service Editor - Variables Tab
4.4. Skyway Service Editor - Spring Bean Configuration tab
4.5. Skyway Service Editor - JAXWS Web Service Tab - Web Service Details
4.6. Skyway Service Editor - JAXWS Web Service Tab - Web Service - Advanced
4.7. Skyway Service Editor - JAXWS Web Service Tab - Method Details
4.8. Skyway Service Editor - JAXWS Web Service Tab - Method Details - Advanced
4.9. Skyway Service Editor - JAXWS Web Service Tab - Parameter Details
4.10. Skyway Service Editor - DWR Tab - DWR Service Details
4.11. Skyway Service Editor - DWR Tab - DWR Method Details
5.1. New Web Controller Window
5.2. Web Controller Editor - Overview Tab
5.3. Spring MVC Annotations - Description
5.4. Web Controller Editor - Spring MVC Tab (Controller)
5.5. Web Controller Editor - Spring MVC Tab (Operation)
5.6. Web Controller Editor - Variables Tab
5.7. Web Controller Editor - Spring Bean Configuration Tab
6.1. New Component Window
6.2. Component Editor - Overview Tab
6.3. Component Editor - Variable Tab
6.4. Web Controller Editor - Spring Bean Configuration Tab
7.1. New Skyway Operation Window
7.2. Operation Options Window
7.3. Operation Editor - Overview Tab
7.4. Operation Editor - Inputs/Outputs Tab
7.5. Operation Editor - Spring Bean Configuration Tab
8.1. New Web Flow Window
8.2. Create Web Flow Domain Window
9.1. New Domain Object Window
9.2. Domain Object Editor - Overview Tab
9.3. Relationship Types
9.4. Domain Object Editor - Persistence Mapping Tab
10.1. New Data Access Object Window
10.2. Add Domain Object Window
10.3. Data Access Object Editor - Overview Tab
10.4. Data Access object Editor - Database Configuration Tab
10.5. Data Access Object Editor - Database Configuration Tab
11.1. New Named Query Window
11.2. Named Query Editor - Overview Tab
11.3. Named Query - Inputs/Outputs tab
11.4. Named Query - Query Text tab
11.5. Named Query - Spring Bean Configuration tab
12.1. New Exception Window
12.2. Exception Editor - Overview Tab
13.1. New Model Package Window
14.1. Spring Code Generation Properties
15.1. New Model Package Window
15.2. New Model Package Window
15.3. New Model Package Window
15.4. New Model Package Window

List of Examples

5.1. Spring MVC Annotations - Example

Chapter 1. Overview

1. Spring MVC Scaffolding (CRUD)

Scaffolding consists of generating full or major portions of an application by applying standard application patterns from a minimal set of inputs provided by the developer. In some cases the scaffolded applications are used as-is, but in other cases the scaffolded artifacts are used as a starting point for additional customization by a developer. In either case scaffolding, originally popularized by the RAILS and GRAILS frameworks, is very effective at jump-starting application development.

Spring MVC is a web framework from the creators of the Spring. While it isn't the only Spring-based web framework, it is one of the mostly commonly used web frameworks. Spring MVC refers to the web framework and also the application architecture, where application logic is partitioned into different layers. Each layer has it's own responsibilities, and all layers can be generated using the Spring MVC Scaffolding wizard.

Application Architecture:

  • Web Layer - responding to user events; implemented with Spring MVC (@Controller)

  • Service Layer - core application logic; implemented with Spring (@Service)

  • Domain Layer - application domain model; implemented with JPA (@Entity)

  • Data Access Layer - data access logic; implemented with Spring (@Repository)

MyEclipse for Spring uses the Create-Read-Update-Delete (CRUD) application pattern for generating applications that allows the end-user to manage application data. While CRUD isn't the only application pattern, it's a fairly typical application pattern. While not all web applications are satisfied solely by the CRUD application pattern, developers find that the resulting generated application artifacts lend themselves to being easily re-used, customized and extended. CRUD applications are tied to an application domain model that is used as the input into the scaffolding engine. The domain model can exist in many forms, and the Spring MVC Scaffolding wizard supports the use of Java beans, JPA entities, database tables, and Spring DSL Domain Objects as inputs.

2. Spring DSL

The Spring DSL defines 11 abstractions, which include Spring DSL, Model Package, Web Controller, Service, Component, Domain Object, Data Access Object, Named Query, Exception and Flow. Each abstraction has a direct correlation to Java, Spring, and JPA artifacts and will generate into a distinct set of code or configuration artifacts.

This is the Spring DSL model:

Here's a high-level summary of each Spring DSL component.

Summary of Spring DSL Components

  • Spring DSL - used for project-wide configuration of Spring code generation.

  • Model Package - used for namespacing and grouping related Spring DSL components. A model package can contain any top-level Spring DSL elements, including other model packages. Model packages correlate directly to java packages, and Spring DSL artifacts created in a model package will be generated into a matching Java package.

  • Web Controller - used for defining the web layer of an application using Spring MVC. Web Controllers are generated into @Controller annotated Spring components, a specialized stereotype for web layer components.

  • Service - used for defining a service layer components. Services get generated into @Service annotated Spring components, a specialized stereotype for service layer components.

  • Component - used for defining a general-purpose Spring managed java bean. A component gets generated into @Component annotated Spring components, a generic stereotype for Spring managed components with configurable scope.

  • Operation - used to define methods for both Controllers, Services and Components.. Operations represent application logic, and they use inputs and outputs for exchanging data. Operations are generated directly in the respective Controller, Service, and Component class, and they are generated slightly differently to account for the different implementations needed for the Spring stereotypes.

  • Domain Object - used to define the domain model of the application. By default a domain object is generated into a plain old java object (POJO). If a domain object is associated with a data access object, then the domain object is annotated as an @Entity (JPA) annotated class, and it's associated with a primary key class (@IdClass). Fields can be added to domain objects by using the basic data types, and a domain object can have relationships to other domain objects.

  • Data Access Object (DAO) - used to separate data access logic from application logic. A DAO manages the persistence of domain objects, and it is generated into @Repository annotated Spring components, a specialized stereotype for data access layer components. A DAO can also contain predefined queries called Named Queries.

  • Named Query - used for defining queries for the data access objects (DAOs). Named queries are defined using either SQL or JPQL (Java Persistence Query Language), and Named Queries are generated into @NamedQueries and @NamedQuery annotations in Spring @Repository components.

  • Exception - used to define custom exceptions. Exceptions are generated into exception classes in Java.

  • Flow - used to implement the web layer of an application using Spring Web Flow.

Each Spring DSL component has an associated editor. Spring DSL-based development consists of a developer creating instances of the Spring DSL components, and configuring them using the associated editor. When code generation is invoked, the relevent code and configuration artifacts will be generated acccording to the configuration of the respective component.

Chapter 2. Code Generation Wizards

1. Add Spring Code Generation Capabilities...

The Add Spring Code Generation Capabilities is used to add Spring code generation functionality to a project. This wizard has various various capabilities that can be optionally added to the current project, including:

  • enabling Code Generation Builder for automated code generation

  • enabling Code Synchronization Builder for automated reverse engineering of Spring/Java artifacts

  • enabling Spring DSL visibility, including enabling Spring DSL node in project

  • applying Spring Nature to project for viewing and editting Spring configuration via Spring Elements node

  • enabling code generation by application layer (web, service, domain and DAO)

  • configuring target projects and folders for code generation

  • adding Spring application runtime dependencies to project

By default this wizard is setup with conventional defaults which enable all options. When clicking on Finish from the Setup panel, all the default configuration options will be applied to the current project. In order to customize the configuration, there are seven optional steps to the wizard.

Add Spring Code Generation Capabilities >> Setup >> Web Layer Generation >> Service Layer Generation >> Domain Layer Generation >> Data Access Layer Generation >> Runtime Dependencies >> Summary

1.1. Setup

The Setup panel is for specifying which builders should be enabled, whether the Spring Nature should be applied to the project, and whether the Spring DSL should be visible.

Table 2.1. Add Spring Code Generation Capabilities - Setup Panel

OptionDescription
Install Skyway Code Generation builderEnables the code generation builder to automatically generate code when relevant artifacts are updated. Code generation can always be manually invoked (right-click-->Generate), but this builder will automatically observe changes to artifacts and generate code.
Install Skyway Code Synchronization builderEnables the code synchronization builder to automatically synchronize the code generation model (metadata) from changes to the code Java source files. Code synchronization can always be manually invoked (right-click-->Update Models from Source), but this builder will observe changes to Java code and automatically update the model.
Apply Spring NatureAdd Spring Nature to current project to enable viewing/editting Spring configurations using Spring Elements node. When applied, all generated Spring context files will be preconfigured with Spring Elements.
Show Spring DSLEnables a Spring DSL view of the current project. The Spring DSL node will be added to the project, and the Spring code generation metadata can be viewed and editted using the Spring DSL.

1.2. Web Layer Generation

The Web Layer Generation panel is used for enabling and configuring code generation for the web layer of a Spring application, including controllers (@Controller), JUnit tests, and web layer Spring context files.

If enabled, this panel lets you specify the project and folders to generate to. While you will typically want to generate to the same project where the code generation metadata (Spring DSL) is stored, in some cases you may want to generate to a different project. For example, you may want to keep all your metadata in one project and have all code and configuration files generated to another project. Alternatively you may want to generate each layer to a separate project. In either case you have full control over the target project and folders.

Table 2.2. Add Spring Code Generation Capabilities - Web Layer Generation Panel

OptionDescription
Enable web layer code generationThis enables generation of web layer artifacts from code generation metadata. If disabled, any current or new web layer metadata will be ignored from a code generation standpoint. Web layer code generation can always be turned on/off or customized using the Code Generation panel of the Spring DSL Editor.
Target ProjectThe target project is the destination project for web layer code generation. While you will typically want to generate to the same project where the code generation metadata is stored (Generate to this project), in some cases you may want to generate to a different project (Generate to another Eclipse project).
Target Project Configuration

Specify the destination folder for generated Java code (Source folder) and configuration files (Resources folder). If the specified folders aren't already configured as source folders, the Source and Resource folders are automatically added as source folders (see Java Build Path).

The default target source folder is the "generated" folder. This is done to keep the generated code separate from any existing source code which by default is typically in the "src" folder. The wizard will automatically configure the "generated" folder to be an Eclipse source folder. If you prefer to generate directly into your "src" folder, you can select the "src" folder from this panel.

The default resources folder is "resources" folder. All application configuration files are genered here. The wizard will automatically configure the "generated" folder to be an Eclipse source folder.


1.3. Service Layer Generation

The Service Layer Generation panel is used for enabling and configuring code generation for the service layer of a Spring application, including services (@Service), service interfaces, JAX-WS web services, direct web remoting (DWR) services, JUnit tests, and service layer Spring context files.

If enabled, this panel lets you specify the project and folders to generate to. While you will typically want to generate to the same project where the code generation metadata (Spring DSL) is stored, in some cases you may want to generate to a different project. For example, you may want to keep all your metadata in one project and have all code and configuration files generated to another project. Alternatively you may want to generate each layer to a separate project. In either case you have full control over the target project and folders.

Table 2.3. Add Spring Code Generation Capabilities - Service Layer Generation Panel

OptionDescription
Enable service layer code generationThis enables generation of service layer artifacts from code generation metadata. If disabled, any current or new service layer metadata will be ignored from a code generation standpoint. Service layer code generation can always be turned on/off or customizedd using the Code Generation panel of the Project Editor.
Target ProjectThe target project is the destination project for service layer code generation. While you will typically want to generate to the same project where the code generation metadata is stored (Generate to this project), in some cases you may want to generate to a different project (Generate to another Eclipse project).
Target Project Configuration

Specify the destination folder for generated Java code (Source folder) and configuration files (Resources folder). If the specified folders aren't already configured as source folders, the Source and Resource folders are automatically added as source folders (see Java Build Path).

The default target source folder is the "generated" folder. This is done to keep the generated code separate from any existing source code which by default is typically in the "src" folder. The wizard will automatically configure the "generated" folder to be an Eclipse source folder. If you prefer to generate directly into your "src" folder, you can select the "src" folder from this panel.

The default resources folder is "resources" folder. All application configuration files are genered here. The wizard will automatically configure the "generated" folder to be an Eclipse source folder.


1.4. Domain Layer Generation

The Domain Layer Generation panel is used for enabling and configuring code generation for the domain layer of a Spring application, including POJOs, primary key classes, bean info classes, JPA Entities (@Entity), Spring Components (@Component), JUnit tests, and domain layer Spring context files.

If enabled, this panel lets you specify the project and folders to generate to. While you will typically want to generate to the same project where the code generation metadata (Spring DSL) is stored, in some cases you may want to generate to a different project. For example, you may want to keep all your metadata in one project and have all code and configuration files generated to another project. Alternatively you may want to generate each layer to a separate project. In either case you have full control over the target project and folders.

Table 2.4. Add Spring Code Generation Capabilities - Domain Layer Generation Panel

OptionDescription
Enable domain layer code generationThis enables generation of domain layer artifacts from code generation metadata. If disabled, any current or new domain layer metadata will be ignored from a code generation standpoint. domain layer code generation can always be turned on/off or customized using the Code Generation panel of the Project Editor.
Target ProjectThe target project is the destination project for domain layer code generation. While you will typically want to generate to the same project where the code generation metadata is stored (Generate to this project), in some cases you may want to generate to a different project (Generate to another Eclipse project).
Target Project Configuration

Specify the destination folder for generated Java code (Source folder) and configuration files (Resources folder). If the specified folders aren't already configured as source folders, the Source and Resource folders are automatically added as source folders (see Java Build Path).

The default target source folder is the "generated" folder. This is done to keep the generated code separate from any existing source code which by default is typically in the "src" folder. The wizard will automatically configure the "generated" folder to be an Eclipse source folder. If you prefer to generate directly into your "src" folder, you can select the "src" folder from this panel.

The default resources folder is "resources" folder. All application configuration files are genered here. The wizard will automatically configure the "generated" folder to be an Eclipse source folder.


1.5. Data Access Layer Generation

The Data Access Layer Generation panel is used for enabling and configuring code generation for the DAO layer of a Spring application, including Spring repositories (@Repositiry), JUnit tests, and DAO layer Spring context files.

If enabled, this panel lets you specify the project and folders to generate to. While you will typically want to generate to the same project where the code generation metadata (Spring DSL) is stored, in some cases you may want to generate to a different project. For example, you may want to keep all your metadata in one project and have all code and configuration files generated to another project. Alternatively you may want to generate each layer to a separate project. In either case you have full control over the target project and folders.

Table 2.5. Add Spring Code Generation Capabilities - Web Layer Generation Panel

OptionDescription
Enable data access layer code generationThis enables generation of DAO layer artifacts from code generation metadata. If disabled, any current or new DAO layer metadata will be ignored from a code generation standpoint. DAO layer code generation can always be turned on/off or customized using the Code Generation panel of the Project Editor.
Target ProjectThe target project is the destination project for DAO layer code generation. While you will typically want to generate to the same project where the code generation metadata is stored (Generate to this project), in some cases you may want to generate to a different project (Generate to another Eclipse project).
Target Project Configuration

Specify the destination folder for generated Java code (Source folder) and configuration files (Resources folder). If the specified folders aren't already configured as source folders, the Source and Resource folders are automatically added as source folders (see Java Build Path).

The default target source folder is the "generated" folder. This is done to keep the generated code separate from any existing source code which by default is typically in the "src" folder. The wizard will automatically configure the "generated" folder to be an Eclipse source folder. If you prefer to generate directly into your "src" folder, you can select the "src" folder from this panel.

The default resources folder is "resources" folder. All application configuration files are genered here. The wizard will automatically configure the "generated" folder to be an Eclipse source folder.


1.6. Runtime Dependencies

The Runtime Dependencies panel is for adding dependent libraries to the current project. While you can independently add and remove libraries from the project, this panel can bootstrap the project with a full set of libraries typically needed by a Spring application, including Spring libraries plus many other runtime libraries.

This panel lets you add project dependencies in three ways:

  • Copy libraries to a project folder (lib), and add libraries to build path (Benefit: more portable projects because projects aren't reliant on MyEclipse for Spring plugins)

  • Use Eclipse classpath containers, and add classpath containers to build path (Benefit: smaller projects because libs are included)

  • Update Maven POM files (Benefit: Maven manages dependencies)

The libraries to add to the current project can be enabled or disabled by library group or library. The library groups can be expanded to see the specific libraries and versions.

Table 2.6. Add Spring Code Generation Capabilities - Runtime Dependencies Panel

OptionsDescription
Use Eclipse classpath containers instead of copying libraries into the projectBy default (for non-Maven projects) the dependencies are added to the current project by copying the selected libraries into the specified library folder. When the classpath container option is selected, the libraries will be added using Eclipse classpath containers.
Library folderThe project folder where libraries should be copied into
Library groups / libraries

The set of library groups and libraries that can be added to the current project. The checked groups/libraries will be added as dependencies to the current project.


1.7. Summary

The Summary panel provides a summary of all the actions to be performed by the wizard when the Finish button is clicked.

2. Add Spring Runtime Dependencies...

The Add Spring Runtime Dependencies... Wizard is used to add dependent libraries to an Eclipse project. There are three steps to the wizard.

Add Spring Runtime Dependencies >> Intro >> Runtime Dependencies >> Static Content >> Summary

2.1. Intro

The Intro panel provides an overview of the wizard.

2.2. Runtime Dependencies

The Runtime Dependencies panel is for adding dependent libraries to the current project. While you can independently add and remove libraries from the project, this panel can bootstrap the project with a full set of libraries typically needed by a Spring application, including Spring libraries plus many other runtime libraries.

This panel lets you add project dependencies in three ways:

  • Copy libraries to a project folder (lib), and add libraries to build path (Benefit: more portable projects because projects aren't reliant on MyEclipse for Spring plugins)

  • Use Eclipse classpath containers, and add classpath containers to build path (Benefit: smaller projects because libs are included)

  • Update Maven POM files (Benefit: Maven manages dependencies)

The libraries to add to the current project can be enabled or disabled by library group or library. The library groups can be expanded to see the specific libraries and versions.

Table 2.7. Add Spring Runtime Dependencies - Runtime Dependencies Panel

OptionsDescription
Use Eclipse classpath containers instead of copying libraries into the projectBy default (for non-Maven projects) the dependencies are added to the current project by copying the selected libraries into the specified library folder. When the classpath container option is selected, the libraries will be added using Eclipse classpath containers.
Library folderThe project folder where libraries should be copied into
Library groups / libraries

The set of library groups and libraries that can be added to the current project. The checked groups/libraries will be added as dependencies to the current project.


2.3. Copy Static Content

The Copy Static Content panel is for boostrapping the web content folder with required web content files (i.e. javascript, jsp pages).

Table 2.8. Artifact Category Mappings Window

DetailsDescription
Copy Static Web Content into this projectThis option determines whether static content will be added to the current project.
Content (folder)Identifies the web content folder. This folder is automatically derived from the project configuration for MyEclipse Web Projects and Dynamic Web Projects.

2.4. Summary

The Summary panel provides a summary of all the actions to be performed by the wizard when the Finish button is clicked.

3. Scaffold Spring MVC CRUD Application from...

As explained in Spring MVC scaffolding, scaffolding can generate full or major portions of an application by applying standard application patterns from a minimal set of existing artifacts provided by the developer.

This wizard has many panels for guiding you through the scaffolding process. The wizard will dynamically determine the relevant panels based on the artitfacts you are scaffolding from and the configuration of the project. The three most common scaffolding scenarios are:

Scaffolding from Java Beans

Scaffold Spring MVC CRUD Application from... >> Select Project >> Select Artifact Type(s) >> Select Artifacts >> Select Primary Keys >> Application Layers and Packages >> Persistence Connection >> Target Folders >> Summary

Scaffolding from JPA Entities and Spring DSL Domain Objects

Scaffold Spring MVC CRUD Application from... >> Select Project >> Select Artifact Type(s) >> Select Artifacts >> Application Layers and Packages >> Persistence Connection >> Target Folders >> Summary

Scaffolding from Database Tables

Scaffold Spring MVC CRUD Application from... >> Select Project >> Select Artifact Type(s) >> Select DB Connection >> Select Tables >> DB Scaffolding Options >> Application Layers and Packages >> Target Folders >> Summary

3.1. Select Project

The Select Project panel is for selecting the project that contains the artifacts that will be used as inputs for Spring MVC scaffolding and/or selecting the destination project for scaffolded artifacts

Table 2.9. Scaffold Spring MVC CRUD Application - Select Project Panel

OptionDescription
ProjectList of all open Eclipse projects. Select the one project that should be scanned for scaffolding inputs. If scaffolding from database tables, the selected project will be the target project.

3.2. Select Artifact Types

The Select Artifact Types panel is used for specifying which type of artifacts should be used for scaffolding. You can select from multiple artifact types:

Table 2.10. Scaffolding Artifact Types

TypeDescription
Database SchemaFor scaffolding from existing database tables. You will be prompted for a database connection to select the database tables that should be used for scaffolding a Spring web application. Scaffolding from a database schema must be done independent of the artifact types. When you select this option, the other artifact types are disabled. You would need to re-run this wizard to scaffold from other artifact types.
JPA EntitiesFor scaffolding from existing JPA Entities in the current project. The wizard will scan for classes that have the @Entity annotation.
Java BeansFor scaffolding from existing Java beans in the current project. The wizard will scan for non-annotated Java classes that follow the java bean convention (getters/setters for class attributes and zero arg constructor)
Spring DSL Domain ObjectsFor scaffolding from existing Spring DSL Domain Objects. If the current project has been configured with Spring DSL support (using Add Spring Code Generation Capabilities wizard), this wizard will scan for all Spring DSL Domain Objects.

Table 2.11. Scaffold Spring MVC CRUD Application - Select Artifact Type(s) Panel

TypeDescription
Database SchemaScaffold from database schema
JPA EntitiesScaffold from JPA Entities in current project
Java BeansScaffold from Java Beans in current project
Spring DSL Domain ObjectsScaffold from Spring DSL Domain Objects in current project

3.3. Select Artifacts for Scaffolding

The Select Artifacts for Scaffolding panel is used for selecting the artifacts for scaffolding based on the selected artifact types.

Table 2.12. Scaffold Spring MVC CRUD Application - Select Artifacts for Scaffolding Panel

DetailsDescription
Matching ArtifactsThis is a list of artifacts that are available for scaffolding from. This list was derived by the wizard by scanning the selected project or folder for artifacts that match the specified artifact type(s).
Select ArtifactsThis is the list of selected artifacts for scaffolding. The artifacts are selected by adding them from the Matching Artifacts list.

3.4. SelectPrimaryKeys (for java bean scaffolding only)

The Select Primary Key(s) panel is for specifying the fields for any selected Java bean(s) that uniquely identify an instance of the Java bean.

Table 2.13. Scaffold Spring MVC CRUD Application - Select Primary Key(s) Panel

DetailsDescription
Java BeansLists all the Java beans that have been selected for scaffolding and require the specification of primary keys.
Primary KeysAs each Java bean is selected, the fields of the Java bean will be listed. One or more fields must be specified as the primary key for each bean in the Java beans table.

3.5. Application Layers and Packages

The Application Layers and Packages panel is used for selecting which layers will be scaffolded and what package name should be used for generated Java/Spring code.

The selections on this panel depend on what you're trying to generate. By default all layers are enabled, and this will result in the generation of a fully implemented Spring MVC application. However you may be interested in only scaffolding a few layers of the application. For example you may already have implemented the JPA and DAO layer by hand or with other tooling, and you would only want to scaffold the web and service layer. Perhaps you are planning to implement your back-end with Spring, but you want to implement the UI layer with Spring Web Flow, Google Web Toolkit (GWT), or Adobe Flex. In that case you would probably only want to scaffold the service, domain and DAO layers.

Table 2.14. Scaffold Spring MVC CRUD Application - Application Layers and Packages Panel

DetailsDescription
Base PackageThe base package name for all scaffolded application layers. The package name for all others layers will be derived from the base package. For each layer a sub-package (web, service, and dao) will be appended to the base package.
Scaffold web layer artifactsSelected by default. Specifies whether the web layer will be scaffolded, including Spring controllers (@Controller), Spring components (@Component), JUnit tests, JSP pages, Sitemesh configurations, localization files, and web layer Spring context files.
Package (web)The package name for all generated Java source code for the web layer.
Scaffold service layer artifactsSelected by default. Specifies whether the service layer will be scaffolded, including including Spring services (@Service), service interfaces, JUnit tests, and service layer Spring context files.
Package (service)The package name for all generated Java source code for the service layer.
Scaffold DAO layer artifactsSelected by default. Specifies whether the data access object (DAO) layer will be scaffolded, including Spring data access objects (@Repository), JPA named queries (@NamedQueries), JUnit tests, and DAO layer Spring context files.
Package (dao)The package name for all generated Java source code for the dao layer.

3.6. Specify Persistence Connection

The Specify Persistence Connection panel is used for configuring the runtime persistence connection of the scaffolded application by selecting a workspace database connection. The selected database connection properties will be used to configure the persistence connection properties for the scaffolded application.

Table 2.15. Scaffold Spring MVC CRUD Application - Specify Persistence Connection Panel

DetailsDescription
DB ConnectionLists all the current MyEclipse DB connections. Select the connection that should be used to configure the application's runtime persistence connection.

3.7. Select Target Folders

The Select Target Folders panel is for specifying where source code, configuration files and dependent libraries should be installed.

Table 2.16. Scaffold Spring MVC CRUD Application - Select Target FoldersPanel

DetailsDescription
Source FolderSpecify the destination folder for generated Java code.
Resources FolderSpecify the destination folder for generated configuration files.
Web Content FolderSpecify the destination folder for generated web layer resources.
Use Eclipse classpath containers instead of copying libraries into projectUnselected by default.
Library FolderThe folder where dependent libraries should be copied.

3.8. Select DB Connection (for DB scaffolding only)

The Select DB Connection panel is for specifying the database connection for accessing the database tables that should be used for scaffolding.

Table 2.17. Scaffold Spring MVC CRUD Application - Select DB Connection Panel

DetailsDescription
DB ConnectionLists all the current MyEclipse DB connections. Select the connection for accessing DB tables.

3.9. Select Database Tables (for DB scaffolding only)

The Select Database Tables panel is for selecting the database tables that should be used for scaffolding.

Select the schema where the desired database tables are located. The dialects will be defaulted based on the data connection properties, but they can be overridden.

Select all the tables, including associated tables, that should be used for scaffolding.

Table 2.18. Scaffold Spring MVC CRUD Application - Select Database Tables Panel

DetailsDescription
SchemaUsed to select the schema that has the tables for scaffolding from. The schema dropdown will list all schemas from the selected database connection.
DialectThe Hibernate dialect to use the specified database. This value will be defaulted according to the selected database connection.
MetaData Dialect 
TablesThe list of tables that were found in the selected schema. This table will be empty until a schema is selected.
ScaffoldingThe list of tables that should be used for scaffolding. One or more tables can be moved from the Tables list to the scaffolding list.

3.10. Database Scaffolding Options (for DB scaffolding only)

The Database Scaffolding Options panel is for step is for specifying the folder in the project that will contain all the Skyway modeling artifacts.

The following table lists the objects that are going to be generated. When scaffolding associations (one-to-one or one-to-many) the generated application will enable associated objects to be managed as part of a parent object. Please check the objects that should be treated as parent objects. Unchecked objects will be treated as associated objects.

The object name is automatically derived from the table name, but you can override the object name by double-clicking on the name and specifying a new name.

Table 2.19. Scaffold Spring MVC CRUD Application - Select DB Scaffolding Options Panel

DetailsDescription
Folder to create for modelsThis is the sub-folder in your project that contains your model information. Default name "model". Enter a new name if desired.

3.11. Summary

The Summary panel provides a summary of all the actions to be performed by the wizard when the Finish button is clicked.

Table 2.20. Scaffold Spring MVC CRUD Application - Summary Panel

DetailsDescription
Check boxSelect checkbox to use Maven to create projects for generated code. The decision to use Maven can only be made at project creation. If not using Maven, all artifact categories must be generated to the same project. If using Maven, you have the choice to split artifact categories between two or more projects.
CategoryThe category for a specific artifact entry. The available categories are: Domain, DAO, Service Layer, Web Layer and Models.
Project

The specific Eclipse project that the artifact category should be generated to. During the initial creation of the project, the ${project.name} token can be used to create projects based on the project name.

Id

The id used to reference the category from the Code Generation tab.

EditSelect an artifact category and click this button to invoke the Code Generation window. Click the Select buttons to pick a new Project and/or Package.

4. Scaffold Spring Security

Security is an important part of a web application, and Spring Security provides a set of security services that integrate with Spring-based applications. Spring Security offers a lot of options, but it can be difficult to quickly get a project bootstrapped with Spring Security.

The Scaffold Spring Security wizard will configure the application for Spring Security, which includes:

Spring Security scaffolding:

  1. Creating a JPA entity (User)and a data access object (UserDAO) for storing user credentials. The entity and DAO store basic user data, and they can be further customized as needed.

  2. Creating a JPA entity (Authorities) and data access object (AuthoritiesDAO) for storing authorization data. The entity and DAO store basic user data, and they can be further customized as needed.

  3. Enabling Spring security in the Security Settings section of the Enterprise Configuration tab.

  4. Configuring Secured URLs in the Security Settings section of the Enterprise Configuration tab.

  5. Configuring Secured Services in the Security Settings section of the Enterprise Configuration tab.

  6. Configuring Secured Data Access Objects in the Security Settings section of the Enterprise Configuration tab.

  7. Configuring Security Views in the Security Settings section of the Enterprise Configuration tab, including login, login success, login failure, logout success, and access denied views.

  8. Configuring Security Information Sources in the Security Settings section of the Enterprise Configuration tab, including database configuration with queries for AuthoritiesDAO and UserDAO.

  9. Creating dedicated Spring Security context files: project-security-context.xml, generated-project-security-context.xml

Scaffold Spring Security >> Select Location

4.1. Select Location

The Select Location panel prompts you for the package for User/Authorities JPA entities and DAO.

Table 2.21. Scaffold Spring Security - Select Location Panel

DetailsDescription
PackageThe package for User/Authorities JPA entities and DAO.

Chapter 3. Spring DSL

The following sections describe the Project wizards and editors.

1. Project Editor

The Project Editor is accessed by double-clicking on the Spring DSL node in the project, and it's comprised of the Overview Tab, the Web Application Tab, the Enterprise Configuration Tab, the Spring Configuration Tab, the Category Mapping Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

1.1. Overview Tab

The Overview tab allows a user to describe the project and link to other tabs in the Project Editor. Refer to the following figure and table for details on this tab.

Table 3.1. Project Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the Project. Refer to Skyway Naming Conventions for details on special rules and exceptions.
DescriptionProvide a meaningful description of the Project.

1.2. Category Mapping Tab

Use the Category Mapping tab to reconfigure the target projects for each artifact category. Each Spring DSL artifact is associated with an artifact category, and the artifact category can be individually configured to generate to a particular Eclipse project.

The Category Mapping tab is also used to disable automated updates to project dependencies. For a Maven-based project this option will prevent MyEclipse for Spring from automatically updating the Maven pom file (pom.xml). For an Eclipse-based project this option will prevent MyEclipse for Spring from automatically updating your classpath (build path). If disabled, you are responsible from manually maintaining the project classpath.

Table 3.2. Project Editor - Category Mapping Tab

DetailsDescription
Artifact CategoriesArtifact Categories is used to configure the destination projects for artifact categories.
CategoryThe category for a specific artifact entry. The available categories are: Domain, DAO, Service Layer, Web Layer and Models. This column is read-only.
Project

The specific Eclipse project that the artifact category should be generated to. This setting is originally set by the Add Spring Code Generation Capabilities wizard when specifying the target project for web, service,domain and DAO layers. It can be reconfigured here or by re-running wizard.

Id

The id used to reference the category from the Code Generation tab.

EditSelect an artifact category and click this button to invoke the Project picker.

1.3. Web Application Tab

The Web Application tab is used to specify the default suffix that's used for operation URLs (for controllers) that are created using the New Operation Wizard.

Table 3.3. Project Editor - Web Application Tab

DetailsDescription
Default URL Mapping SuffixThe suffix to be appended to the end of new URL mappings.

1.4. Enterprise Configuration Tab

The Enterprise Configuration tab of the Project Editor allows a user to configure the Spring Security settings for the project.

Table 3.4. Project Editor - Enterprise configuration Tab

DetailsDescription
Secured URLSThis subsection allows a user to specify urls and set them as secured.
URL PatternLists the URL patterns added.
SecuredClick this check box to secure the associated URL.
AddClick this button to Add a new URL pattern.
RemoveClick this button to remove a selected URL from the URL Pattern list.
Up/DownClick these buttons to change the order of the selected URL from the URL Pattern list.
Secured ResourcesThis subsection allows a user to specify urls and set them as secured.
ServiceDisplays the project's services available to secure.
SecuredClick this check box to secure the associated Service.
Data Access ObjectDisplays the project's data access objects available to secure.
SecuredClick this check box to secure the associated Data Access Object.
Configured ViewsThis subsection allows a user to select the views that will handle security functions.
Login ViewDefault page: /login.jsp
Login Failure ViewDefault page: t/login.jsp?login_error=1
Login Success ViewDefault page: /success.jsp
Access Denied ViewDefault page: /accessDenied.jspp
Security Information SourceThis subsection allows a user to configure the security information source as either Database or LDAP.
DatabaseSelect this radio button to configure database settings.
LDAPSelect this radio button to configure LDAP settings.

1.5. Spring Configuration Tab

The Spring Configuration tab allows a user to configure the mail server.

Table 3.5. Project Editor - Spring Configuration Tab

DetailsDescription
Mail ServerEnter the mail server. By default this is not set. When the mail server is specified, a mail sender bean is emitted into service context file.

1.6. Code Generation Tab

The Code Generation tab is for configuring various project-level code generation options, including the collection type that should be use for persistent relationships, the templates project that should be used for code generation, and the default code generation options for the generated code.

Persistent Collection Type

Select the type of collection to use for persistent relationships.

Table 3.6. Project Editor - Code Generation Tab - Persistent Collection Type

DetailsDescription
Ordered Set

Interface Type: java.util.Set

Implementation Type: java.util.LinkedHashSet

List

Interface Type: java.util.List

Implementation Type: java.util.ArrayList

Set

Interface Type: java.util.Set

Implementation Type: java.util.HashSet

Sorted Set

Interface Type: java.util.SortedSet

Implementation Type: java.util.TreeSet

Custom

Interface Type: <pick the interface>

Implementation Type: <pick an implementation of the interface>


Code Generation

This section configures the default code generation settings for the entire project. From the Project Editor there's an entry for every artifact that is generated using MyEclipse for Spring. The settings can be overridden individually on an artifact by using the artifact's code generation tab, which will only contain entries for the artifacts generated resources.

Table 3.7. Project Editor - Code Generation Tab - Code Generation

DetailsDescription
GenerateSpecifies whether this resource should be generated. By default all resources are generated and regenerated, but you can disable this at the project level by unchecking the checkbox for the resources that should no longer be generated.
NameA friendly name for the resource that is represented by the configuration entry.
FilenameThe name of the file that should be generated for the resource. You can reference the artifact name by using the ${model.name} expression in the filename.
PackageThe package name that should be used for the generated resource. This setting only applies to resources that get generated into JAVA classes. You can reference the model package that the artifact was created in by using the ${model.package} expression in the package name,
PathThe directory where the resource should be generated to. You can reference the category mapping (from the Category Mapping tab) location in the path by using the ${category} expression. You can also reference the model package that the artifact was created in by using the ${model.package} expression in the path. To generate the resource to multiple locations, you can specify multiple paths (comma delimited).
CategorySpecifies the category that the resource is generated into. As you reconfigure the category mappings, you can change the project that the resource gets generated into.

Here's a list of available code generation tokens that can be used for configuring code generation options.

Table 3.8. Code Generation Tokens

TokenDescription
${model.name}References the name given to the artifact in the Spring DSL.
${parent.name]References the name of the parent artifact for artifacts that have a parent artifact (i.e. Controller/Operation and Service/Operation)
${model.package}References the model package that contains the artifact in the Spring DSL.
${category}References the project path configured for the category (using Category Mapping tab).

Chapter 4. Service

The logic found in a typical web application is associated with either (a) the behaviour of the application or (b) the business logic. While a Controller could technically be used to implement the both the behavior and business logic, the classic MVC pattern prescribes that the controller layer should be focussed on implementing the behaviour of the application, and the service layer focusses on implementing the business logic.

The Spring framework supports the @Service annotation which is a specialized stereotype for service layer components, and the Spring DSL Service artifact supports the creation of Spring services by:

Service

  1. providing a New Service wizard

  2. providing a Service Editor for editing Spring Services (either from the Spring DSL or directly from the Spring @Service class)

  3. generating a Spring Service interface

  4. generating a Spring Service implementation classes (annotated with @Service)

  5. generating a JUnit test classes for service testing

  6. [optional] enablement of the service for Java API for XML Web Services (JAX-WS - SOAP)

  7. [optional] enablement of the service for Direct Web Remoting (Javascript/JSON)

While Services are often used in a Spring MVC application, Services are also applicable to just about any other presentation technology related Spring. If you are using a presentation technology other than Spring MVC (i.e. Spring Web Flow, Struts, GWT, AJAX, or Adobe Flex), they can all use Services for implementing the back-end business logic.

1. New Skyway Service Wizard

The New Skyway Service wizard is for creating new Spring Services for a development project.

New Skyway Service >> New Service

1.1. New Service

The New Service window is for specifying the name of the service and the model package that will contain the service.

Table 4.1. New Skyway Service Window

DetailsDescription
Service NameEnter the name of the new Service then click the Finish button.

2. Service Editor

The Service Editor is comprised of the Overview Tab, the Variables Tab, the Spring Bean Configuration Tab, the JAXWS Tab, the DWR Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

The Service Editor can be used for configuring either a Spring DSL Service or Spring service class (@Service). To open a service class, right-click on the service class and select Open With --> Service Editor.

2.1. Overview Tab

The Overview tab is used for providing a description of the Service, navigating to the files generated from the Service, and navigating to the other Service configuration tabs. Refer to the following figure and table for details on this tab.

Table 4.2. Skyway Service Editor - Overview tab

DetailsDescription
NameIdentifies the name of the new Service.
FilesClick the Views link to display the generated source code.
DescriptionProvide a meaningful description of the Service.

2.2. Variables Tab

The Variables tab is used for defining Service variables. Service variables are available to all service operations. Refer to the following figure and table for details on this tab.

Table 4.3. Service Editor - Variables Tab

DetailsDescription
NameIdentify the variable name. Refer to Skyway Naming Conventions for details on special rules and exceptions.
TypeSelect the data type of the variable. In addition to primitive data types, a variable may have the type of a Domain Object that has been created and defined in Skyway. Click the desired row in the Type column to invoke the Select Type Picker. Select the desired data type and click OK.
CollectionIdentify whether the parameter is a Collection.
Initial ValueOptional) a variable can be initialized with data by populating this column with the initial value.

2.3. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Service. Refer to the following figure and table for details on this tab.

Table 4.4. Skyway Service Editor - Spring Bean Configuration tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.
ScopeThe scope for this bean. List of Available Scopes

2.4. Code Generation Tab

The Code Generation tab is for configuring the generation options for a Service. This tab shows you all the code artifacts that are generated and managed by the Spring DSL Service. Each entry in this table represents a code artifact that is generated for the Service. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each Service using the code generation tab from the respective Service.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

2.5. JAXWS Web Service Tab

The JAXWS Web Service tab is used for configuring the web service options for the Service. By default a Service isn't web service enabled. This tab is for enabling the Service to be published as a Web Service and for configuring the JAX-WS options for the Service and Operations. Refer to the following figure and tables for details on this tab.

When a Spring DSL Service is published as a web service, an endpoint interface is generated and annotated with the JAX-WS @WebService annotation. The following table describes the configuration options for the web service.

Table 4.5. Skyway Service Editor - JAXWS Web Service Tab - Web Service Details

DetailsDescription
Publish Web Servicedetermines whether the Spring service will be published as a JAX-WS web service (@WebService)
Service Namemaps to the serviceName parameter of the @WebService annotation
Target Namespacemaps to the targetNamespace parameter of the @WebService annotation
Endpoint Interface 
Port Namemaps to the portName and name parameters of the @WebService annotation
WSDL Locationthe location of the WSDL representing the web service
Binding Type 
Service Mode 

The handler chain and SOAP binding can be configured at the web service level. The @HandlerChain and @SOAPBinding annotations are generated into the endpoint interface.

Table 4.6. Skyway Service Editor - JAXWS Web Service Tab - Web Service - Advanced

DetailsDescription
Handler Chaindetermines whether this service will have a custom handler chain (@HandlerChain)
Namethe name of the handler chain ; maps to the name parameter of the @HandlerChain annotation
Filethe name of the handler chain configuration file; maps to the file parameter of the @HandlerChain annotation
SOAP Binding 
Stylemaps to the style parameter of the @SOAPBinding annotation
Parameter Stylemaps to the parameterStyle parameter of the @SOAPBinding annotation
Usemaps to the use parameter of the @SOAPBinding annotation

Unless otherwise excluded, each operation in a Spring DSL Service is published as a web method. The operation in the endpoint interface is generated and annotated with the JAX-WS @WebMethod annotation. The following table describes the configuration options for the web method.

Table 4.7. Skyway Service Editor - JAXWS Web Service Tab - Method Details

DetailsDescription
Excludedetermines whether the current operation will be excluded from the web service; by default all operations are included in a web service
Namemaps to the operationName parameter of the @WebMethod annotation; the name is defaulted to the name of the Spring DSL operation artifact
Actionmaps to the action parameter of the @WebMethod annotation

While the SOAP binding can be configured at the web service level, JAX-WS allows the SOAP binding to be customized at the web method level. The custom configurations in the following table will be reflected in the @SOAPBinding annotation generated for the web method. The request (@RequestWrapper) and response (@ResponseWrapper) of the web method can be also configured.

Table 4.8. Skyway Service Editor - JAXWS Web Service Tab - Method Details - Advanced

DetailsDescription
SOAP Binding 
Stylemaps to the style parameter of the @SOAPBinding annotation
Parameter Stylemaps to the parameterStyle parameter of the @SOAPBinding annotation
Usemaps to the use parameter of the @SOAPBinding annotation
Request Wrapper 
Local Namemaps to the localName parameter of the @RequestWrapper annotation
Target Namespacemaps to the targetNamespace parameter of the @RequestWrapper annotation
Class Namemaps to the className parameter of the @RequestWrapper annotation
Response Wrapper 
Local Namemaps to the localName parameter of the @RespondWrapper annotation
Target Namespacemaps to the targetNamespace parameter of the @ResponseWrapper annotation
Class Namemaps to the className parameter of the @ResponseWrapper annotation

In JAX-WS the input parameters of a web method are configured using the @WebParam annotation. The following table lists the configuration options that will generated for the @WebParam annotation.

Table 4.9. Skyway Service Editor - JAXWS Web Service Tab - Parameter Details

DetailsDescription
Skyway Inputmaps to the style parameter of the @WebParam annotation
Namemaps to the name parameter of the @WebParam annotation
Part Namemaps to the partName parameter of the @WebParam annotation
Target Namespacemaps to the targetNamespace parameter of the @WebParam annotation
Modemaps to the mode parameter of the @WebParam annotation
Headermaps to the header parameter of the @WebParam annotation

2.6. DWR Tab

The DWR tab is used for configuring the DWR (direct web remoting) options for the Service. By default a Service isn't DWR enabled. This tab is for enabling the Service to be published as a Javascript library (that uses JSON for data transferring) using DWR. Refer to the following figure and table for details on this tab.

The following table describes the configuration options for the DWR service.

Table 4.10. Skyway Service Editor - DWR Tab - DWR Service Details

DetailsDescription
Publishdetermines whether the service will be published as a DWR service
Javascript Namethe name of the dynamically generated javascript for the service

Unless otherwise excluded, each operation in a Spring DSL Service is published as a javascript function. The following table describes the DWR configuration options for the operations.

Table 4.11. Skyway Service Editor - DWR Tab - DWR Method Details

DetailsDescription
Excludedetermines whether the current operation will be excluded from DWR; by default all operations are included in a service that is published for DWR.
Method Namethe name of the dynamically generated javascript methd; the name is defaulted to the name of the Spring DSL operation artifact

DWR will automatically generates some pages that can assist in developing with DWR. The DWR Service index page lists all the classes known to DWR. It's usefull for verifying which Spring DSL services are or are not DWR enabled. The URL for the accessing the index page is http://server:port//context/dwr/index.html

Chapter 5. Controller

In the context of a Spring MVC application, the controller is responsible for receiving requests from a web client (typically from end-user generated events) and invoking a request handler, which orchestrates all the server logic necessary for processing the request. Spring MVC supports the grouping of request handlers related to an application task into a Controller.

The Spring framework supports the @Controller annotation which is a specialized stereotype for web layer components, and the Spring DSL Controller artifact supports the creation of Spring controllers by:

Controller

  1. providing a New Controller wizard

  2. providing a Controller Editor for editing Spring Controllers (either from the Spring DSL or directly from the Spring @Controller class

  3. generating a Spring Controller implementation classes (annotated with @Controller)

  4. generating a JUnit test classes for controller testing

  5. managing the association of URLs to request handlers

1. New Web Controller Wizard

The New Web Controller wizard is for adding a controller to the application.

New Skyway Web Controller >> New Web Controller

1.1. New Web Controller

The New Web Controller window is for specifying the name of the web controller and the model package that will contain the web controller.

Table 5.1. New Web Controller Window

DetailsDescription
File NameEnter the desired file name in the File Name text box and click the Finish button. Refer to Skyway Naming Conventions for details on special rules and exceptions.

2. Web Controller Editor

The Skyway Web Controller Editor is comprised of the Overview Tab, the Spring MVC Tab, the Variables Tab, the Spring Configuration Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for providing a description of the Controller, navigating to the files generated from the Controller, and navigating to the other Controller configuration tabs. Refer to the following figure and table for details on this tab.

Table 5.2. Web Controller Editor - Overview Tab

DetailsDescription
NameIdentifies the Web Controller name.
FilesClick the Views link to display the generated source code.
DescriptionProvide a meaningful description of the Web Controller.
Define URL MappingsClick this link to jump to the URL Mapping tab.

2.2. Spring MVC Tab

When Operations are added to a Controller, they are generated as Java methods in the controller. The Spring MVC framework provides a variety of annotations for specifying the behaviour of the Java methods and managing data binding, and the Sprint MVC tab assists in annotating the Java methods and configuring the annotations.

Here's a summary of the Spring MVC annotations:

Table 5.3. Spring MVC Annotations - Description

AnnotationDescription
@RequestMappingUsed to map URLs to a controller class or controller method. The @RequestMapping annotation is typically used with a controller method. When a request comes in that matches the specified URL, the respective Java method will be used to handle the request.
@RequestParamUsed to map a request parameter to an argument of a request handler. The @RequestParm annotation is applied on the method argument of a request handler. This provides the request handler with access to the request parameter. The Spring MVC framework will automatically convert the parameter to the method argument type.
@ModelAttribute

The annotation has two purposes:

@ModelAttribute

  1. Used to map a model attribute (i.e. form backing object) to an argument of a request handler. The @ModelAttribute annotation is applied on the method parameter (method signature) of a request handler. This provides the request handler with access to the object. The Spring MVC framework will automatically convert the parameter to the method argument type.

  2. Used to denote controller methods that provide reference data. When the @ModelAttribute annotation is applied on a controller method, the Spring MVC framework will execute the method prior to executing any request handlers. These methods will typically load reference data that will be used by request handlers (via controller variables) or JSP pages (via reference to @ModelAttribute value).

@InitBinderUsed to customize the data binding for a controller. The Spring MVC has some default data binding. Both the @RequestParam and @ModelAttribute annotations convert (bind) the data to Java types, but the converters can be customized by an @InitBinder annotated method in the controller.

An example might be helpful for understanding how the Spring MVC annotations are used with annotation-based controllers.

Example 5.1. Spring MVC Annotations - Example

@Scope("singleton")
@Controller("CustomerController")
public class CustomerController {

  @RequestMapping(method = { RequestMethod.GET, RequestMethod.POST }, value = "/saveCustomer.html")1
  public String saveCustomer(@ModelAttribute(value = "customer") Customer customer2) {
     // 
  }

  @RequestMapping(method = { RequestMethod.GET, RequestMethod.POST }, value = "/selectCustomer.html")
  public ModelAndView selectCustomer(@RequestParam(required = true, value = "customernumberKey") 
                                     Integer customernumberKey3) {
    //
  }

  @InitBinder
  public void initBinder(WebDataBinder binder, HttpServletRequest request)4 { // Register static property editors.
    binder.registerCustomEditor(java.util.Calendar.class, new org.execution.databinding.CustomCalendarEditor());
  }

  @ModelAttribute(value = "cities")5
  public Set<Cities> getCities() {
   //
  }
}

1

The @RequestMapping annotation specifies that saveCustomer() method should handle URL requests for "/saveCustomer.html".

2

The @ModelAttribute annotation specifies that customer form data (command object) should be bound to the customer method parameter. The saveCustomer() method will have access to the form data by using the command method parameter.

3

The @RequestParam annotation specifies that the request parameter "customernumberKey should be converted to an Integer and bound to the customernumberKey variable.

4

The @InitBinder annotation specifies the method that should be used by the Spring MVC framework to register any custom data binding converters for the controller.

5

The @ModelAttribute annotation specifies that the getCities() method should be run prior to any request handler in the controller. Any class variables set by this method will be available to the request handlers. The method output will be also available as model data in any views (JSP) under the specified key ("cities").

The Spring MVC panel helps configure the Spring MVC annotations for the methods and method parameters in a controller. When clicking on the controller, the controller properties will be displayed for editting. When explanding the controller and clicking on an operation, the operation properties will be displayed for editting.

Table 5.4. Web Controller Editor - Spring MVC Tab (Controller)

ParameterDescription
Controller / Methods

This table shows the controller and it's associated methods. Clicking on the controller will display the annotation configuration panel for the controller. Clicking on a controller method will display the annotation configuration panel for the controller method.

Request MappingConfigures the controller to handle requests for the given URL. Furthermore you can configure the request mapping for GET, POST, OPTIONS, PUT and DELETE.
Operation Request Mappings

[READ ONLY] This table shows all the operations that are configured as request mappings. It shows the operation name and configured URL. The Launch link enables the immediate launch of the specified URL in the default Eclipse browser.


Table 5.5. Web Controller Editor - Spring MVC Tab (Operation)

ParameterDescription
Operation Details

Enables the configuration of the operation as either a request handler (@RequestMapping), model attribute (@ModelAttribute) or init binder (@InitBinder). A given operation can only be either a request handler, model attribute or init binder method.

Request Mapping

Configures the operation to handle requests for the given URL. Furthermore you can configure the request mapping for GET, POST, OPTIONS, PUT and DELETE.

The request mapping table will show all operation parameters and enables the configuration of each parameter. The Mapped As column is for configuring whether the parameter is a Model Attribute, Request Parameter, or Unmapped. The Mapped Name can be configured. The Required column is for specifying whether the parameter is required.

For new operations the mapped name is defaulted to the parameter name, and the Mapped As is determined by the parameter type. All parameters are considered to be required.

Model Attribute

Configures the operation to be a model attribute using the given name.

InitBinder

Configures the operation to be an Init Binder. Optionally you can specify a list of form parameters that should use the specific init binder.


2.3. Variables Tab

The Variables tab is used for defining Controller variables. Controller variables are available to all controller operations. Refer to the following figure and table for details on this tab.

Table 5.6. Web Controller Editor - Variables Tab

DetailsDescription
NameIdentify the variable name. Refer to Skyway Naming Conventions for details on special rules and exceptions.
TypeSelect the data type of the variable. In addition to primitive data types, a variable may have the type of a Data Type that has been created and defined in Skyway. Click the desired row in the Type column to invoke the Select Type Picker. Select the desired data type and click OK.
CollectionIdentify whether the variable is a Collection.
Initial Value(Optional) a variable can be initialized with data by populating this column with the initial value.
On Request

Identify whether the variable should be annotated with the Spring @ModelAttribute.

  • Enabled - The variable (getter method) is annotated with @ModelAttribute, and this causes the model to be automatically enriched with the variable. Therefore the variable doesn't need be added as an output parameter of an operation, because it will be automatically included by Spring in the model.

  • Disabled - The variable is available to all operations, but it's not automatically tied to the model.


2.4. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Controller. Refer to the following figure and table for details on this tab.

Table 5.7. Web Controller Editor - Spring Bean Configuration Tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.
ScopeThe scope for this bean. List of Available Scopes

2.5. Code Generation Tab

The Code Generation tab is for configuring the generation options for a Controller. This tab shows you all the code artifacts that are generated and managed by the Spring DSL Controller. Each entry in this table represents a code artifact that is generated for the Controller. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

Chapter 6. Component

A Component is general purpose java class, and the Spring framework supports the @Component annotation for identifying and managing these generic java beans. A component isn't tied to any particular tier of an application, and it can be used for many different purposes, including the definition of data transfer objects, form backing objects and aggregating application logic that needs to be accessible to Spring Web Flow applications. The Spring DSL Component artifact supports the creation of Spring components by:

Service

  1. providing a New Component wizard

  2. providing a Component Editor for editing Spring Controllers (either from the Spring DSL or directly from the Spring @Component class)

  3. generating a Spring Component implementation classes (annotated with @Component)

  4. generating a JUnit test classes for component testing

1. New Component Wizard

The New Component wizard is for adding a component to a project.

New Skyway Component >> New Component

1.1. New Component

The New Component window is for specifying the name of the component and the model package that will contain the component.

Table 6.1. New Component Window

DetailsDescription
Component NameEnter the desired name for the Component then click the Finish button.

2. Component Editor

The Component Editor is comprised of the Overview Tab, the Variables Tab, the Code Generation Tab, and the Spring Bean Configuration tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for providing a description of the Component, navigating to the files generated from the Component, and navigating to the other Component configuration tabs. Refer to the following figure and table for details on this tab.

Table 6.2. Component Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the Component.
FilesClick the Views link to display the generated source code.
DescriptionProvide a meaningful description of the Component.
Define Variablesclick this link to jump to the Variables tab.
Define Constantsclick this link to jump to the Constants tab.
ScopeDefine the scope of the model. Valid options are Session or Request.

2.2. Variables Tab

The Variables tab is used for defining Component variables. Component variables are available to all component operations. Refer to the following figure and table for details on this tab.

Table 6.3. Component Editor - Variable Tab

DetailsDescription
NameIdentify the variable name.
TypeSelect the data type of the variable. In addition to primitive data types, a variable may have the type of a Domain Object that has been created and defined in Skyway. Click the desired row in the Type column to invoke the Select Type picker. Select the desired data type and click OK
Initial Value(Optional) a variable can be initialized with data by populating this column with the initial value.

2.3. Code Generation Tab

The Code Generation tab is for configuring the generation options for a Component. This tab shows you all the code artifacts that are generated and managed by the Spring DSL Component. Each entry in this table represents a code artifact that is generated for the Component. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

2.4. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Component. Refer to the following figure and table for details on this tab.

Table 6.4. Web Controller Editor - Spring Bean Configuration Tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.
ScopeThe scope for this bean. List of Available Scopes

Chapter 7. Operation

An Operation is a Spring DSL artifact that defines methods for Services, Controllers and Components. Operations are visual representations of Java methods, and they are shown as children artifacts to the respective Service, Controller or Component in the Spring DSL explorer. Operations use inputs and outputs for exchanging data, and they are generated as methods directly into the respective class.

The following sections describe the Operation wizards and editors.

1. New Operation Wizard

The New Operation wizard is for adding a new operation to either a controller or service.

New Skyway Operation >> New Operation >> Operation Options

1.1. New Operation

The New Operation window is for specifying the name of the operation and the controller, component or service that will contain the operation.

Table 7.1. New Skyway Operation Window

DetailsDescription
Operation NameEnter the name of the new Operation then click the Finish button.
DescriptionEnter a meaningful description for this Operation then click the Finish button.

1.2. Operation Options

If you are using model-driven development to implement your operations, then an action can automatically be created. If you aren't using MDD, then you should disable this option.

Table 7.2. Operation Options Window

DetailsDescription
Create a URL MappingFor Controller Operations Only: Enable this checkbox to create a URL Mapping for this operation. URL Mappings can also be added at a later time.
URLFor Controller Operations Only: When "Create a URL Mapping" is enabled, the URL is for specifying the URL for the URL Mapping. A default URL mapping is derived from the controller name and operation name, but the URL is completely configurable by the developer.
Create an "entry point" actionEnable this checkbox to create an entry point Action for this operation. Actions are used to use Skyway's drag-n-drop modeling to implement the logic of the operation. An operation can have multiple actions, but only one Action can be the entry point action. The entry point action can be configured at a later time.
Action nameWhen "Create a entry point action" is enabled, the Action name is for specifying the name. The name is default to "Default Action" which can be overridden in the Skyway section of Eclipse preferences.

2. Operation Editor

The Skyway Operation Editor is comprised of the Overview Tab, the Input/Outputs Tab, the Spring Bean Configuration Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for providing a description of the Operation, navigating to the files generated from the Operation, navigating to the other configuration tabs, and defining operation exceptions. Refer to the following figure and table for details on this tab.

Table 7.3. Operation Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the new Operation.
FilesClick the Views link to display the generated source code.
DescriptionEnter a meaningful description for this Operation.
Define Inputs and OutputsClick this link to jump to the Inputs/Outputs tab.
Define VariablesClick this link to jump to the Variables tab.
Define ConstantsClick this link to jump to the Constants tab.
Entry PointClick this link to open the editor for the selected action, or enter the path/name of the action directly into the textbox.
Select...Click this button to open the Action Selector and select the desired action from the list of available actions associated with this operation.
ExceptionsIn the Exception tab, the user can configure Exceptions thrown by the Operation. The configured exceptions will be available to Catch Steps of calling processes. If any exception occurs and it's not listed in the operation interface, the exception will be ignored. The user may define any of the following exception types: Any Exception from any Project on their Designer desktop, All Skyway Step Exceptions, Skyway Step Exceptions listed individually, Non Custom Exceptions

2.2. Input / Outputs Tab

The Inputs/Outputs tab defines the input and output parameters of a particular operation. When this operation is invoked, the consumer (client) or the operation is required to map variables to the input and output parameters. Refer to the following figure and table for details on this tab.

Table 7.4. Operation Editor - Inputs/Outputs Tab

DetailsDescription
InputsDefine the Inputs to this Operation.
NameIdentify the input parameter name.
TypeSelect the data type of the parameter. In addition to primitive data types, an input parameter may have the type of a Domain Object that has been created and defined in Skyway. To select a Domain Object as the variable type, choose the Domain Object option from the Type drop-down menu. Select the desired data type from the data type picker and click OK.
CollectionIdentify whether the parameter is a Collection
AddClick this button to add an input variable. The default is Input_1, incrementing as additional variables are added until they are renamed.
OutputsDefine the Outputs to this Operation.
NameIdentify the input parameter name.
TypeDisplays the data type of the input variable selected in the Assignment column.
AssignmentSelect the Operation variable to assign to the output variable. Any variable from the variable list on the Variables sub-tab may be mapped to an output variable.
AddClick this button to add an output variable. The default is Output_1, incrementing as additional variables are added until they are renamed.

2.3. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Operation. Refer to the following figure and table for details on this tab.

Table 7.5. Operation Editor - Spring Bean Configuration Tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.

2.4. Code Generation Tab

The Code Generation tab is for configuring the generation options for an Operation. The implementation of an operation will be generated into the respective controller, component or service. However this tab shows any additional code artifacts that are generated and managed by the Spring DSL Operation. Each entry in this table represents a code artifact that is generated for the Operation. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

Chapter 8. Web Flow

There are many alternatives to Spring MVC for building the front-end of an application, including Spring Web Flow, GWT, and Adobe Flex. This chapter will focus on the Spring Web Flow accelerators. Spring Web Flow is a project from Spring for simplifying the development of web applications. While Spring Web Flow is compatible with Spring MVC, Spring Web Flow uses flows instead of controllers for implementing the web layer of an application. Since Spring Web Flow has functionality for managing application state, it is best suited for implementing the functionality where the activity being performed by the end-user spans multiple page requests, all the pages need to be treated as a unit of work.

With Spring Web Flow the group of related steps to accomplish a task are referred to as a Flow. While this functionality can be implemented with Spring MVC, Spring Web Flow has features that make it considerably easier. However in order to gain the benefits of Spring Web Flow, a developer needs to have a pretty in-depth knowledge of Spring and Spring Web Flow, and Spring Web Flow adds additional configuration requirements to your web application. While authoring the flow of an application using XML is elegant, implementing flows using XML can be difficult and tedious because it’s hard to visualize the application flow from the xml.

MyEclipse for Spring reduces the complexity of adding Spring Web Flow support by automatically bootstrapping the project for you. The moment you add the first flow to your project, MyEclipse for Spring will add the necessary Spring configuration and libraries. That by itself is a significant time saver, but MyEclipse for Spring goes one step further in regards to Spring Web Flow. In addition to configuring your application, MyEclipse for Spring also provides a custom Spring Web Flow editor for authoring flows. You start with an empty canvas which represents a single flow, and you drop different web flow states (i.e. view, decision, action, subflow and stop) onto the canvas. State transitions are defined by drawing lines between the states and specifying the event associated with the transition. Actions can be added to flows and states.

Flows are a group of related steps for accomplishing a task in an application. Some of the benefits of using Spring Web Flow are

  1. XML-based flow definitions - The flow of the application is defined in XML. No custom Java is needed to implement a flow

  2. Expression language support - An expression language let’s you leverage logic from the other layers of the web application. Logic that a developer would typically put into a controller, that isn’t handled by Spring Web Flow, can beexpressed in XML using the expression language

  3. State management - Variables can be scoped (many scopes are supported), and Spring Web Flow will automatically handle the cleanup of those variables when they are out-of-scope.

  4. Modularization of flow logic - Flows can be re-used from other flows.

A Flow is responsible for orchestrating the task (steps) and supporting the user events associated with the task. Instead of the MVC-based approach of creating a controller and multiple operations for implementing a conversation, with Spring Web Flow you define a flow with states and expressions. Instead of the MVC-based approach of defining URL mappings, with Spring Web Flow you define events. Spring Web Flow also let's you easily separate your logic for handling a user event (on event id) from the pre-load logic (on entry) for a particular state.

The following sections describe the Web Flow wizards and editors.

1. New Web Flow Wizard

The New Web Flow wizard is for adding a new Spring flow to the project.

New Web Flow >> New Web Flow >> Web Flow Domain

1.1. New Web Flow

The New Web Flow window is for specifying the name of the flow and the model package that will contain the flow.

Table 8.1. New Web Flow Window

DetailsDescription
File NameEnter the desired file name in the File Name text box and click the Finish button. Refer to Skyway Naming Conventions for details on special rules and exceptions.

1.2. Web Flow Domain Model

Table 8.2. Create Web Flow Domain Window

DetailsDescription
File Namethe location of the flow xml file. This needs to be located inside the WEB-INF directory.

2. Web Flow Editor

The Web Flow Editor consists of a canvas and palette of Web Flow Artifacts.

Chapter 9. Domain Objects

An application typically consists of a distinct set of inter-related application objects (domain objects) that embody the functionality and characteristics of the system being built. All of the application objects are cumulatively referred to as the domain model. A development effort usually begins with analysis of the problem domain, and domain modeling is frequently the first step in designing an application. Domain modeling is the analysis of data objects that are used in a business, analysis of the attributes of those objects, and the identification of the relationships between these data objects.

The domain model is defined by creating custom domain objects that encompass the attributes of the domain objects and relating the domain objects to each other.

The following sections describe the Domain Object wizards and editors.

1. New Domain Object Wizard

The New Domain Object wizard is for creating new domain objects for a development project.

New Domain Object >> Domain Object

1.1. New Domain Object

The New Domain Object window is for specifying the name of the domain object and the model package that will contain the domain object.

Table 9.1. New Domain Object Window

DetailsDescription
Domain Object NameEnter the name of the new Domain Object then click the Finish button. The Domain Object Editor is displayed.

2. Domain Object Editor

The Skyway Domain Object Editor is comprised of the Overview Tab, the Persistance Mapping Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

The Service Editor can be used for configuring a Service in the Spring DSL or by right-clicking (Open-With) an @Service annotated java class.

2.1. Overview Tab

The Overview tab is used for configuring the domain object fields, managing relationships and providing a description. Refer to the following figure and table for details on this tab.

This editor allows a user to describe the domain object, set relationships between other domain objects, and create and edit fields in the domian object. Refer to the following figure and table for details on this tab.

Table 9.2. Domain Object Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the new Domain Object.
FilesClick the Views link to display the generated source code.
DescriptionEnter a meaningful description for this Domain Object.
RelationshipsCreate and manage relationships between this and other Domain Objects by defining the Type, Name and Inverse Name. Click the Add button to add a Domain Object.
FieldsCreate and edit fields in this domain object by defining Display Name, Type, and if whether it's a Collection. Click the Add button to add a field to this Domain Object.

The domain object editor allows you to define relationships to a domain object.

Relationship Type

The Relationship Type defines the cardinality of the relationship from the perspective of the current Domain Object. The options are:

Table 9.3. Relationship Types

TypeDescription
One-to-Onea domain object is related to a single occurrence of the other domain object
One-to-Manya domain object is related to many occurrences of the other domain object; the opposite side of a Many-to-One relationship
Many-to-Onea domain object is related to a single occurrence of the other domain object; the opposite side of a One-to-Many relationship
Many-to-Manya domain object is related to many occurrences of the other domain object, and vice versa

Bidirectional Relationships

When a relationship is added to another domain object, a unidirectional relationship is implied. Two independent unidirectional relationships can be linked together to create a bidirectional relationship. If you decide to define a bidirectional relationship, the cardinality and relationship names need to match.

Relationships Names

When defining a relationship between two data objects, the Domain Object editor will prompt you for a relationship name and a reverse name. These names will be used for accessing each other's related data. The relationship name is used to identify the relationship from the perspective of the current domain object. The reverse name is used to identify the relationship from the target data object type back to the current domain object.

Regarding relationship names, the Domain Object editor will default the domain object name as the relationship names, but you can very easily changed the name. It's a good idea to change these relationship names to something more semantically meaningful. While they have no impact on the functionality, these names will be the what you will see as your referencing these relationships in the services you create. These names should be meaningful, and it's recommended that you name them with the appropriate plurality for the relationship type.

2.2. Persistence Mapping Tab

The Persistence Mapping tab is used to control how the Domain Object will map into persistence in a database and how it will display throughout the rest of the project. This tab includes the Table and Field Mapping and Relationships sections. The Persistence Mapping tab will let you override the default table name and field names. Refer to the following figure and table for details on this tab.

Table 9.4. Domain Object Editor - Persistence Mapping Tab

DetailsDescription
Table NamePre-populated with the name of the Domain Object by default. This name can be modified.
Schema 
Catalog 
Column NameThe name of the database column that this Field will be stored in. If left blank, the name of the Field will be used. This name is "suggested" as a user can override it during deployment.
LengthLength of text field. Defautl is 512 characters.
Precision 
Scale 
FetchPull-down menu. Select the desired value of either Lazy, Eager, Unset.
OptionSelect the desired column option. Valid values are: Insertable, Updateable, Nullable, and Unique.

When a domain object in configured to be persisted to a database, the database name and fields will be derived from the domain object. However there are occasions where a developer may want the table names and field names to be different than the object. When a domain object is created, MyEclipse for Spring will use the following peristence mapping defaults:

  1. Table name = domain object name

  2. Table field names = domain object field names

    This settings can be modified from this panel panel. The settings in this panel will drive the configuration of the ORM framework.

2.3. Code Generation Tab

The Code Generation tab is for configuring the generation options for a Domain Object. This tab shows you all the code artifacts that are generated and managed by the Domain Oject. Each entry in this table represents a code artifact that is generated for the Domain Object. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

Chapter 10. Data Access Object

Data Access Objects (DAO) is a pattern for separating data access logic from business logic. Data Access Objects are abstract representations of real databases (or persistence mechanisms), and they manage persistence for a set of JPA Entities (domain objects). When writing code to read, write, delete and update persisted data objects, with DAO there is no need to know the details of the database (vendor, version, IP, etc.).

The following sections describe the Data Access Object wizards and editors.

1. Data Access Object Wizard.

The New Data Access Object wizard is for creating new data access objects for a development project.

New Data Access Object >> Data Access Object >> Add Domain Objects

1.1. New Data Access Object

The New Data Access window is for specifying the name of the data access object and the model package that will contain the data access object.

Table 10.1. New Data Access Object Window

DetailsDescription
File NameEnter the name of the new Data Access Object in the File Name text box then click the Next button to add a Domain Object. Data Access Objects can have duplicate names as long as they are stored in separate Services or in separate folders within a service.

1.2. Add Domain Objects

When you create a DAO, you can associate one or more domain objects with the DAO.

Table 10.2. Add Domain Object Window

DetailsDescription
Domain ObjectsAdd the domain objects that are managed by this data access object. A data access object must have atleast one domain object.

2. Data Access Object Editor

The Data Access Object Editor is comprised of the Overview Tab, the Database Configuration Tab, the Spring Bean Configuration Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for associating domain objects to the DAO, providing a description of the DAO, and navigating to the files generated from the DAO. Refer to the following figure and table for details on this tab.

Table 10.3. Data Access Object Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the new Data Access Object.
FilesClick the Views link to display the generated source code.
DescriptionEnter a meaningful description for this Data Access Object.
Domain ObjectsSelect and add Domain Objects to be managed by this Data Access Object.

2.2. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Data Access Object. Refer to the following figure and table for details on this tab.

Table 10.4. Data Access object Editor - Database Configuration Tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.
ScopeThe scope for this bean. List of Available Scopes

2.3. Database Configuration Tab

The Database Configuration tab allows a user to select a database for this Data Access Object. Refer to the following figure and table for details on this tab.

Table 10.5. Data Access Object Editor - Database Configuration Tab

DetailsDescription
ConnectionSelect a database connection from the list of available databases in the drop-down menu.
Create New ConnectionClick this link to invoke the New Connection Profile window. See the To Create a New Connection section for details on configuring a new connection. After creating a new connection it will become available in the Connection drop-down list.
Enable Persistance Provider SQL LoggingSelect this checkbox to enable SQL Logging capability.
Allow Persistence Provider to create/update tablesSelect this checkbox to allow the designated persistence provider to create/update tables to the database.
Minimum Connection Pool SizeDefault value is 1.
Maximum Connection Pool SizeDefault value is 10.
Enable XA Data SourceSelect this checkbox to specify an XA Data Source.
XA Data Source Class NameEnter the Data Source class name.
Import TypesClick this link to import domain objects from the database. Once the domain objects are discovered, they can be used just like domain objects created in Skyway.

2.4. Code Generation Tab

The Code Generation tab is for configuring the generation options for a Data Access Object. This tab shows you all the code artifacts that are generated and managed by the Spring DSL DAO. Each entry in this table represents a code artifact that is generated for the DAO. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

Chapter 11. Named Query

The following sections describe the Named Query wizards and editors.

1. Named Query Wizard

The New Named Query wizard is for adding a new named query to a data access object.

New Named Query >> Named Query

1.1. New Named Query

The New Named Query window is for specifying the name of the named query and the data access object that will contain the named query.

Table 11.1. New Named Query Window

DetailsDescription
Named Query NameEnter the name of the new Named Query then click the Finish button to display the Named Query Editor.

2. Named Query Editor

The Skyway Named Query Editor is comprised of the Overview Tab, the Input/Outputs Tab, the Query Text Tab, the Spring Bean Configuration Tab, and the Code Generation Tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for providing a description of the named query, navigating to the files generated from the named query, and navigating to the other Named Query configuration tabs. Refer to the following figure and table for details on this tab.

Table 11.2. Named Query Editor - Overview Tab

DetailsDescription
NameIdentifies the name of the new Named Query.
FilesClick the Views link to display the generated source code.
DescriptionEnter a meaningful description for this Named Query.
Define Inputs and OutputsClick this link to jump to the Inputs/Outputs tab.
Define the Query TextClick this link to jump to the Query Text tab.

2.2. Inputs / Outputs Tab

The Inputs/Outputs tab defines the input and output parameters of a particular named query. When this query is invoked, the consumer of the name query is required to map variables to the input and output parameters. Refer to the following figure and table for details on this tab.

Table 11.3. Named Query - Inputs/Outputs tab

DetailsDescription
InputsInputs are a mechanism for exchanging data with the consumer of the named query. When a consumer calls a named query, they must provide all the input variables defined by the query.
NameIdentify the input parameter name.
TypeSelect the data type of the parameter. In addition to primitive data types, an input parameter may have the type of a Domain Object that has been created and defined in Skyway. To select a Domain Object as the variable type, choose the Domain Object option from the Type drop-down menu. Select the desired data type from the data type picker and click OK.
CollectionIdentify whether the parameter is a Collection.
AddClick this button to add an input variable. The default is Input_1, incrementing as additional variables are added until they are renamed.
OutputsOutputs are another mechanism for exchanging data with the consumer of the named query. When a consumer calls a named query, they must accept all the output variables defined by the named query.
NameIdentify the output parameter name.
TypeSelect the data type of the parameter. In addition to primitive data types, an output parameter may have the type of a Domain Object that has been created and defined in Skyway. To select a Domain Object as the variable type, choose the Domain Object option from the Type drop-down menu. Select the desired data type from the data type picker and click OK.
CollectionIdentify whether the parameter is a Collection.
AddClick this button to add an output variable. The default is Output_1, incrementing as additional variables are added until they are renamed.

2.3. Query Text Tab

The Query Text tab defines the query in either SQL or JPQL.Refer to the following figure and table for details on this tab.

Table 11.4. Named Query - Query Text tab

DetailsDescription
Query Type

Specifies the query language will be used in the named query.

The options are:

  • JPQL - for specifying queries using the JPA specific syntax. The persisted objects are managed by JPA.

  • SQL - for specifying queries to the underlying DB using SQL syntax. This option is usefull for queries that are syntactically specific to the underlying DB and intended to be executed using JDBC. This option does not use JPA.

  • JPA Native - for specifying queries to underlying DB using SQL syntax (similar to SQL option), but the resulting data will be synchronized into the persisted Objects that JPA is managing.

Query TextDefine the Query text to execute.
InsertClick this button to invoke a Variable picker and select the input or output variable to include in the expression.
Edit ExpressionClick this button to invoke the Expression Editor and build a valid expression. Click the OK button.

2.4. Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the scope and @Transaction annotations for the Named Query. Refer to the following figure and table for details on this tab.

Table 11.5. Named Query - Spring Bean Configuration tab

DetailsDescription
Enable TransactionSpecified whether the Spring transactional annotation should be emitted in this artifact's generated code
Read OnlySpecifies a read-only transaction.
TimeoutSpecifies how long a transaction may run before timing out.
IsolationSpecifies the degree of isolation this transaction has from the work of other transactions.
PropagationSpecifies the transaction propagation.
Rollback ClassNamesSpecifies the exceptions that must cause a rollback.
No Rollback ClassNamesSpecifies the exceptions that must not cause a rollback.

Chapter 12. Exception

The following sections describe the Exception wizards and editors.

1. New Exception Wizard

The New Exception wizard is for adding a custom exception to a project.

New Skyway Exception >> New Exception

1.1. New Exception

The New Exception window is for specifying the name of the exception and the model package that will contain the exception.

Table 12.1. New Exception Window

DetailsDescription
Exception NameEnter the desired name for the Exception then click the Finish button.

2. Exception Editor

The Skyway Exception Editor is comprised of the Overview Tab and the Code Generation Tab. The follow sections describe each tab in detail.

2.1. Overview Tab

The Overview tab is used for providing a description of the Exception, navigating to the files generated from the Exception, and navigating to the other Exception configuration tabs. Refer to the following figure and table for details on this tab.

Table 12.2. Exception Editor - Overview Tab

DetailsDescription
FilesClick the Views link to display the generated source code.
DescriptionProvide a meaningful description of the Exception.

2.2. Code Generation Tab

The Code Generation tab is for configuring the generation options for an Exception. This tab shows you all the code artifacts that are generated and managed by the Spring DSL Exception. Each entry in this table represents a code artifact that is generated for the Exception. In addition to enabling and disabling code generation on an artifact-by-artifact basis, you can also customize the name of the artifact, the package used, and the location where the artifact is generated to.

Code Generation

The code generation settings can be specified at the project level, which will control the code generation settings for the entire project. The code generation settings can also be customized for each artifact using the code generation tab from the respective editor for the artifact.

For a description of the code generation settings available from the Service Editor, please refer the to Code Generation tab of the Project Editor.

Chapter 13. Model Package

A Model Package is a Spring DSL artifact for namespacing and grouping related Spring DSL components. A model package can contain any top-level Spring DSL elements, including other model packages. Model packages correlate directly to java packages (and UML packages), and Spring DSL artifacts created in a model package will be generated into a matching Java package.

In Java application development it is common to use packages for organizing and namespacing Java resources according to their functionality, and Model Packages serve the same purpose, except that they group generated artifacts.

1. New Model Package Wizard

The New Model Package wizard is for adding a new package to a project.

New Web Flow >> New Model Package

1.1. New Model Package

The New Model Package window is for specifying the name of the model package.

Table 13.1. New Model Package Window

DetailsDescription
PackageThe name of the package to add to the project.

Chapter 14. Project Properties

The following sections describes the addition project properties that are contributed by the Add Spring Code Generation Capabilities wizard.

1. Spring Code Generation

1.1. Properties

This panel is for configuring the Spring Code Generation properties of the current project.

Table 14.1. Spring Code Generation Properties

DetailsDescription
Skyway Code GeneratorEnables the code generation builder to automatically generate code when relevant artifacts are updated. Code generation can always be manually invoked (right-click-->Generate), but this builder will automatically observe changes to artifacts and generate code.
Skyway Code SynchronizationEnables the code synchronization builder to automatically synchronize the code generation model (metadata) from changes to the code Java source files. Code synchronization can always be manually invoked (right-click-->Update Models from Source), but this builder will observe changes to Java code and automatically update the model.
Show the DSL in Project ExplorerEnables a Spring DSL view of the current project. The Spring DSL node will be added to the project, and the Spring code generation metadata can be viewed and editted using the Spring DSL.

Chapter 15. Workspace Preferences

The following sections describe the Model Package wizards.

1. Workspace Preferences

1.1. Code Generation

This panel controls the code generation preferences of the current Eclipse workspace.

Table 15.1. New Model Package Window

DetailsDescription
TodoTODO

1.2. Deployment

This panel controls the deployment preferences of the current Eclipse workspace.

Table 15.2. New Model Package Window

DetailsDescription
TodoTODO

1.3. Modeling

This panel controls the modeling preferences of the current Eclipse workspace.

Table 15.3. New Model Package Window

DetailsDescription
TodoTODO

1.4. Webflow Diagram

This panel controls the web flow diagram preferences of the current Eclipse workspace.

Table 15.4. New Model Package Window

DetailsDescription
TodoTODO