MyEclipse for Spring Reference – Spring DSL

1. Project Editor

The Spring DSL is only  applicable to projects that have been enabled with Spring code generation  capabilities using the Enable Spring  DSL wizard.

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

Note: Spring scaffolding requires a MyEclipse Spring or Bling subscription.

1.1 Overview Tab

The Overview tab allows a user to describe the project and link to other tabs in the Project Editor.

Project editor – Overview tab
DetailsDescription
NameIdentifies the name of the project.
DescriptionProvide a meaningful description of the project.

1.2 Web Application Tab

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

Project editor – Web Application tab
DetailsDescription
Default URL Mapping SuffixThe suffix to be appended to the end of new URL mappings.

1.3 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 and the default code generation options for the generated code.

The Code Generation section configures the default code generation settings for the entire project. From the Project Editor, there is an entry for every artifact generated using MyEclipse. The settings can be overridden individually on an artifact by using the artifact’s code generation tab, which contains only entries for the artifact’s generated resources.

Project editor – Code Generation tab
OptionsDescription
Persistent Collection Type

Select the type of collection to use for persistent relationships.

    • Ordered SetInterface Type: java.util.Set; Implementation Type: java.util.Set
    • 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>
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 deselecting the checkbox for the resources that should no longer be generated.
NameA friendly name for the resource represented by the configuration entry.
FilenameThe name of the file to be generated for the resource. You can reference the artifact name by using the ${model.name} expression in the filename.
PackageThe package name to be used for the generated resource. This setting applies only to resources that get generated into Java classes. You can reference the model package the artifact was created in by using the ${model.package} expression in the package name.
PathThe directory to which the resource should be generated. 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 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).
CategoryAssociates the artifact with an application layer. This is primarily related to the category mappings where you can change the project into which the resource is generated.

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

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).

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.

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.
SecuredSelect this checkbox 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 resources and set them as secured.
ServiceDisplays the project’s services available to secure.
SecuredSelect this checkbox to secure the associated Service.
Data Access ObjectDisplays the project’s data access objects available to secure.
SecuredSelect this checkbox to secure the associated Data Access Object.
Configured ViewsThis subsection allows a user to select the views that 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.jsp
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.

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 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 prevents MyEclipse from automatically updating the Maven pom file (pom.xml). For an Eclipse-based project, this option prevents MyEclipse from automatically updating your classpath (build path). If disabled, you are responsible from manually maintaining the project classpath.

Project editor – Category Mapping tab
DetailsDescription
Artifact CategoriesUsed to configure the destination project for each available application layer.
CategoryThe application layer name. This column is read-only.
Project

The specific Eclipse project to which the application layer should be generated. This setting is originally set by the Enable Spring DSL wizard when specifying the target project for web, service,domain and DAO layers. It can be reconfigured here or by re-running the 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.


2. Service

The Spring DSL Service is for generating Spring @Service components and managing related source code and configuration files.

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

  • providing a New Service wizard.
  • providing a Service Editor for editing Spring Services managed by the Spring DSL
  • generating a Spring Service interface
  • generating Spring Service implementation classes(annotated with @Service)
  • generating JUnit test classes for service testing
  • [optional] enablement of the service for Java API for XML Web Services (JAX-WS – SOAP)
  • [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 to Spring. If you are using a presentation technology other than Spring MVC (i.e., Spring Web Flow, JSF, Struts, GWT, AJAX, or Adobe Flex), they can all use Services for implementing the back-end business logic.

Tip: For a Service implementation example, try scaffolding a Spring MVC application using the Scaffold Spring MVC Application wizard. It generates a full Spring MVC application, including Spring Services.

2.1 New Service Wizard

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

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

New Service window
DetailsDescription
Service NameName of the new Service

2.2 Service Editor

The Service Editor is used for configuring a Spring DSL Service, and it’s comprised of the Overview tab, the Variables tab, the Code Generation tab, the Flex tab, the DWR tab, the JAXWS tab, and the Spring Bean Configuration tab. The follow sections describe each tab in detail.

2.2.1 Overview Tab

The Overview tab is for providing a description of the Service, navigating to the files generated from the Service, and navigating to the other Service configuration tabs.


Service editor – Overview tab
DetailsDescription
NameName of the new Service
FilesClick the Views link to display the generated source code.
DescriptionProvide a meaningful description of the Service.

2.2.2 Variables Tab

The Variables tab is for defining Service variables. Service variables are available to all service operations.

Service editor – Variables tab
DetailsDescription
NameIdentify the variable name.
TypeSelect the data type of the variable. 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 Value(Optional) a variable can be initialized with data by populating this column with the initial value.

2.2.3 Code Generation Tab

The Code Generation tab is for configuring the generation options for a Service. This tab shows you all code artifacts generated and managed by the Spring DSL Service. Each entry in this table represents a code artifact 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 to where the artifact is generated.

Service editor – Code Generation tab

The code generation settings can be specified at the project level, which controls 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.2.4. Flex Tab

The Flex tab is used for configuring the Adobe Flex options for the Service. By default a Service isn’t Flex enabled. This tab is for enabling the Service to be published as a Flex remote service using Spring-Flex.

Service editor – Flex tab
DetailsDescription
PublishDetermines if the service will be published as a Flex remote service
Destination IdChannel name for the remote Flex service

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

DetailsDescription
ExcludeDetermines if the current operation will be excluded from Flex; by default all operations are included in a service that is published for Flex.
Method NameName of the dynamically generated Flex remote method; the name is defaulted to the name of the Spring DSL operation artifact

2.2.5 JAXWS Web Service Tab

The JAXWS Web Service tab is 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.

Service editor – Web Service Configuration 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.

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 Typemaps to the binding type parameter of the @WebService annotation
Service Modemaps to the service mode parameter of the @WebService annotation

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.

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.

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 are reflected in the @SOAPBinding annotation generated for the web method. The request (@RequestWrapper) and response (@ResponseWrapper) of the web method can be also configured.

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 be generated for the @WebParam annotation.

DetailsDescription
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

Note: The development accelerators related to JAX-WS are implemented using CXF; however other JAX-WS implementations can be used with Spring.

2.2.6 DWR Tab

The DWR tab is 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.

Service editor - DWR tab
DetailsDescription
PublishDetermines if the service will be published as a DWR service
Javascript NameName 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.

DetailsDescription
ExcludeDetermines if the current operation will be excluded from DWR; by default all operations are included in a service that is published for DWR.
Method NameName of the dynamically generated JavaScript method; the name is defaulted to the name of the Spring DSL operation artifact

DWR automatically generates some pages that can assist in developing with DWR. The DWR Service index page lists the classes known to DWR. It's useful 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.

Note: There is a DWR runtime issue caused by a library version mismatch for a dependent Java library. Please see the MyEclipse for Spring Forums for a very easy solution.

2.2.7 Spring Bean Configuration Tab

The Spring Bean Configuration tab is for configuring the @scope and @Transactional annotations for the Service.

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


3. Controller

The Spring DSL Controller is used for generating annotation-based controllers for Spring MVC and managing related source code and configuration files.

The Spring DSL Controller supports the creation of Spring controllers by:

  • providing a New Controller wizard.
  • providing a Controller Editor for editing Spring Controllers managed bythe Spring DSL.
  • generating Spring Controller implementation classes (annotated with @Controller).
  • generating JUnit test classes for controller testing.
  • managing the association of URLs to request handlers.

Tip: For an example implementatation of a Spring Controller, try scaffolding a Spring MVC application using the Scaffold Spring MVC Application  from wizard. It generates a full Spring MVC application, including Spring Controllers.

3.1 New Web Controller Wizard

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

New Web Controller >> New Web Controller

3.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.

New Web Controller Window
DetailsDescription
File NameName of controller file

3.2 Web Controller Editor

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

3.2.1 Overview Tab

The Overview tab is for providing a description of the Controller, navigating to the files generated from the Controller, and navigating to the other Controller configuration tabs.

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.

3.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 behavior of the Java methods and managing data binding, and the Spring MVC tab assists in annotating the Java methods and configuring the annotations.

Here's a summary of the Spring MVC annotations:

  • @RequestMapping
  • @RequestParam
  • @ModelAttribute
  • @InitBinder

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

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

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.

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

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

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 are 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 tab helps configure the Spring MVC annotations for the methods and method parameters in a controller. When clicking the controller, the controller properties are displayed for editing. When expanding the controller and clicking an operation, the operation properties are displayed for editing.

Service editor - Spring MVC tab
ParameterDescription
Controller / Methods

This table shows the controller and its associated methods. Clicking the controller displays the annotation configuration panel for the controller. Clicking a controller method displays 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 the operations 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.

The table below describes the Operation settings.

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 be only 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 shows 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 @ModelAttribute using the given name.

InitBinder

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

3.2.3 Variables Tab

The Variables tab is for defining Controller variables. Controller variables are available to all controller operations.

Web Controller editor - Variables tab
DetailsDescription
NameIdentify the variable name.
TypeSelect the data type of the variable. 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.

3.2.4 Code Generation Tab

The Code Generation tab is for configuring the generation options for a Controller. This tab shows you all code artifacts 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 to which the artifact is generated.

Controller Editor - Code Generation tab

The code generation settings can be specified at the project level, which controls 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.

3.2.5 Spring Bean Configuration Tab

The Spring Bean Configuration tab is for configuring the @Scope and @Transactional annotations for the Controller.

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


4. Component

The Spring DSL Component is for generating Spring @Components and managing related source code and configuration files.

The Spring DSL Component supports the creation of Spring @Components by:

  • providing a New Component wizard.
  • providing a Component Editor for editing Spring Controllers managed bythe Spring DSL.
  • generating Spring Component implementation classes(annotated with @Component).
  • generating JUnit test classes for component testing.

4.1 New Component Wizard

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

New Component >> New Component 

4.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.

New Component window
DetailsDescription
Component NameName for the component

4.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 following sections describe each tab in detail.

4.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 other Component configuration tabs.

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.

4.2.2 Variables Tab

The Variables tab is for defining Component variables. Component variables are available to all component operations.

Component editor - Variables tab
DetailsDescription
NameIdentify the variable name.
TypeSelect the data type of the variable. 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.

4.2.3 Code Generation Tab

The Code Generation tab is for configuring the generation options for a Component. This tab shows all code artifacts 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 to which the artifact is generated.

Component editor - Code Generaton tab

You can configure code generation settings at the project level to 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.

4.2.4 Spring Bean Configuration Tab

The Spring Bean Configuration tab is for configuring the @scope and @Transactional annotations for the Component.

Component editor - Spring Bean Configuration tab
DetailsDescription
Enable TransactionSpecifies 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 can 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.


5.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.

Service Operations - Methods in a service are typically either core methods (public; used by service clients) or helper methods, and every method in the service has an associated Operation. In a Spring application, the core methods are typically configured with transactional properties.

Controller Operations - Methods in a controller are typically either request handlers (public; used by web clients) or helper methods, and every method in the controller has an associated Operation. In a Spring application, the core methods are typically configured with request mappings.

5.1 New Operation Wizard

The New Operation wizard is for adding a new operation to either a controller, service or component. By default, all operations created with the New Operation wizard are considered a public API operation, and this can be customized from the Overview tab of the Operation editor.

New Operation >> New Operation >> Operation Options 

5.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.

New Operation window
DetailsDescription
Operation NameName of the new Operation

5.1.2 Operation Options (for Controllers Only)

If you are creating a new operation in a controller, the New Operation wizard automaticallys create URL mapping (@RequestMapping) for the operation. Request mappings can also be managed using the Spring MVC tab.

Operation Options window
DetailsDescription
Create a URL MappingFor Controller Operations Only: Select this checkbox to create a URL Mapping for this operation. URL Mappings can also be added at a later time using Spring MVC tab.
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.

5.2 Operation Editor

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

5.2.1 Overview Tab

The Overview tab is for providing a description of the Operation, navigating to the files generated from the Operation, navigating to other configuration tabs, and defining operation exceptions.

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.
ExceptionsIn the Exception tab, configure exceptions thrown by the operation.
VisibilitySpecifies the visibility (public, private or protected) of the operation.
APISpecifies if the operation should be considered part of the the public API of the service, controller, or component. You might not want some operations (i.e., getters/setters) to be reflected in secondary generation artifacts (i.e., interfaces, unit tests, web services, etc...), and the API setting specifies which operations should be considered public. Public operations are reflected in secondary artifacts.

5.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.

Operation editor - Inputs/Outputs tab
DetailsDescription
InputsDefine the Inputs to this operation.
NameIdentify the input parameter name.
TypeSelect the data type of the parameter. 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 if 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.

5.2.3 Code Generation Tab

The Code Generation tab is for configuring the generation options for an operation. The implementation of an operation is generated into the respective controller, component, or service. However, this tab shows additional code artifacts generated and managed by the Spring DSL Operation. Each entry in this table represents a code artifact 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 to which the artifact is generated.

Operation Editor - Code Generation tab

You can specifiy code generation settings at the project level to control code generation 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.

5.2.4 Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the @scope and @Transactional annotations for the Operation.

Operation Editor - Spring Bean Configuration tab
DetailsDescription
Enable TransactionSpecifies 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 can 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


6.Web Flow

The Spring DSL Web Flow is for generating flows for Spring Web Flow and managing related source code and configuration files.

The Spring DSL Web Flow supports the creation of flows by:


6.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 

6.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.

New Web Flow window
DetailsDescription
File NameNew web flow filename

6.1.2 Web Flow Domain Model

Create Web Flow Domain window
DetailsDescription
File NameName of the flow .xml file. This needs to be located inside the WEB-INF directory.

Note: When creating a Spring Web Flow diagram, you are prompted for the name and location of the flow. When using the Web Flow editor, there are two XML files involved. The first XML file is the flow itself, and it's used by the Spring framework at runtime to execute the flow. The second XML file is the diagram file, and it's used to store the visual layout (position, fonts, colors) of the diagram. The diagram file is not used at runtime.

6.2 Web Flow Editor

With Spring Web Flow, the group of related steps to accomplish a task are referred to as a flow. 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 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.

The Web Flow editor can be used both with the Spring DSL and without the Spring DSL. When used with the Spring DSL, diagrams are stored in a model package. When used without the Spring DSL, diagrams are stored in the springwebflowDiagrams folder.

Web Flow editor


7. Domain Object

The Spring DSL Domain Object is for defining the domain layer of an application, and it's specifically responsible for generating JPA Entities and managing related source code and configuration files.

The Spring DSL Domain Object supports the creation of JPA Entities by:


7.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 

7.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.

 


New Domain Object window

DetailsDescription
Domain Object NameName of the new Domain Object

7.2 Domain Object Editor

The Domain Object editor is comprised of the Overview tab, the Code Generation tab, and the Persistence Mapping tab. 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.

7.2.1 Overview Tab

The Overview tab is for configuring the domain object fields, managing relationships, and providing a description.

 

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 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. The Relationship Type defines the cardinality of the relationship from the perspective of the current domain object. The options are:

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 of a Many-to-One relationship
Many-to-Onea domain object is related to a single occurrence of the other domain object; the opposite 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 prompts you for a relationship name and a reverse name. These names are used for accessing each other's related data. The relationship name identifies the relationship from the perspective of the current domain object. The reverse name identifies the relationship from the target data object type back to the current domain object.

Regarding relationship names, the Domain Object editor defaults to the domain object name as the relationship name, but you can very easily change the name. It's a good idea to change these relationship names to something more meaningful. While the names have no impact on the functionality, these names are what you see as you reference 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.

7.2.2 Code Generation Tab

The Code Generation tab is for configuring the generation options for a domain object. This tab shows you the code artifacts generated and managed by the domain object. 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 to which the artifact is generated.

Domain Object editor - Code Generation tab

You can specify code generation settings at the project level to control code generation 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.

7.2.3 Persistence Mapping Tab

The Persistence Mapping tab is used to control how the domain object maps into persistence in a database and how it displays throughout the rest of the project. This tab includes the Table and Field Mapping and Relationships sections. The Persistence Mapping tab lets you override the default table name and field names.

Domain Object editor - Persistence Mapping tab
DetailsDescription
Table NamePre-populated with the name of the domain object by default. This name can be modified.
SchemaDatabase schema from which you are mapping
CatalogDatabase catalog from which you are mapping
Column NameThe name of the database column in which this field will be stored. If left blank, the name of the field is used. A user can override this name during deployment.
LengthLength of text field. Default is 512 characters.
PrecisionMaximum number of digits present in a number.
ScaleMaximum number of decimal places in a number.
FetchSelect 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 is configured to be persisted to a database, the database name and fields are derived from the domain object. However there are occasions where a developer might want the table names and field names to be different than the object. When a domain object is created, MyEclipse uses the following persistence mapping defaults:

    • Table name = domain object name
    • Table field names = domain object field names

These settings can be modified from this tab. The settings in this tab drive the configuration of the ORM framework.


8. Data Access Object

The Spring DSL Data Access Object is for generating Spring @Repository components and and managing related source code and configuration files. The Spring DSL Domain Object supports the creation of JPA Entities by:


8.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 >> Select Domain Objects

8.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.

New Data Access Object window
DetailsDescription
File NameEnter the name of the new data access object in the File Name text box, then click Next 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.

8.1.2 Select Domain Objects

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

Add Domain Object window
DetailsDescription
Domain ObjectsAdd domain objects managed by this data access object. A data access object must have at least one domain object.

8.2 Data Access Object Editor

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

8.2.1 Overview Tab

The Overview tab is for associating domain objects to the DAO, providing a description of the DAO, and navigating to the files generated from the DAO.

Data Access Object editor - Overview tab
DetailsDescription
NameName 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.

8.2.2 Code Generation Tab

The Code Generation tab is for configuring the generation options for a data access object. This tab shows the code artifacts 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 to which the artifact is generated.

Data Access Object Editor - Code Generation tab
You can specify code generation settings at the project level to control code generation 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.

8.2.3 Database Configuration Tab

The Database Configuration tab allows a user to select a database for this data access object.

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 becomes available in the Connection drop-down list.
Enable Persistence 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.

8.2.4 Spring Bean Configuration Tab

The Spring Bean Configuration tab is for configuring the @scope and @Transactional annotations for the data access object.

Data Access Object editor - Spring Bean Configuration tab
DetailsDescription
Enable TransactionSpecifies if 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.


9. Named Query

The following sections describe the Named Query wizards and editors.

9.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 

9.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.

New Named Query window
DetailsDescription
Named Query NameName of the new named query

9.2 Named Query Editor

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

9.2.1 Overview Tab

The Overview tab is 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.

Named Query editor - Overview tab
DetailsDescription
NameName 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.

9.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 named query is required to map variables to the input and output parameters.

Named Query editor - 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 input variables defined by the query.
NameInput parameter name.
TypeSelect the data type of the parameter. In addition to primitive data types, an input parameter can have the type of a domain object. To select a domain object as the variable type, choose the domain object option from the Type drop-down list. Select the desired data type from the data type picker, and click OK.
CollectionSpecify if 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 output variables defined by the named query.
NameOutput parameter name.
TypeSelect the data type of the parameter. In addition to primitive data types, an output parameter can have the type of a domain object. To select a domain object as the variable type, choose the domain object option from the Type drop-down list. Select the desired data type from the data type picker, and click OK.
CollectionSpecify if 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.

9.2.3 Query Text Tab

The Query Text tab defines the query in either SQL or JPQL.

Named Query editor - Query Text tab
DetailsDescription
Query TypeSpecifies the query language 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 useful 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 is 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.

9.2.4 Spring Bean Configuration Tab

The Spring Bean Configuration tab is used to configure the @scope and @Transaction annotations for the named query.

Named Query editor - Spring Bean Configuration tab
DetailsDescription
Enable TransactionSpecifies 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.


10.Exception

The following sections describe the Exception wizards and editors.

10.1 New Exception Wizard

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

New Exception >> New Exception 

10.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.

New Exception window
DetailsDescription
Exception NameName for the new exception

10.2 Exception Editor

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

10.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.

Exception editor - Overview tab
DetailsDescription
FilesClick the View link to display the generated source code.
DescriptionProvide a meaningful description of the exception.

10.2.2 Code Generation Tab

The Code Generation tab is for configuring the generation options for an exception. This tab shows you all code artifacts 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 to which the artifact is generated.

Exception editor - Code Generation tab

You can specify code generation settings at the project level to control code generation 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.


11. 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 are generated into a matching Java package. In Java application development, it is common to use packages for organizing and name spacing Java resources according to their function, and Model Packages serve the same purpose, except they group generated artifacts.

11.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 

11.1.1 New Model Package

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

New Model Package window
DetailsDescriptiond
PackageName of the package to add to the project.