Enterprise Project

by Laura Cigardi
17,350 views Published on Jan 21, 2013
Applies to: 7.0 or higher
Table of contents

What is an Enterprise Project?

From WebRatio 7 it's possible to find and use the Enterprise Project. Using an Enterprise Project aims to:

  • Divide a project of great size in sub-projects to give an opportunity to organize work in a team with different access modes, managed by the repository.
  • Reduce the amount of memory occupied during editing.
  • Allow a more rapid generation of individual parts of a project.
  • Share the Data Model and the Modules between different projects to save development time and to centralize common logic without having to manage duplicates.

How can I create and configure an Enteprise Project?

An Enterprise Project is composed by projects of different natures:

  • A unique Data Model Project.
  • One or more than one Web Model Project.
  • One or more than one Module Project.
  • One or more than one referenced BPM Projects.

The Data Model Project, the Web Model Project and the Module Project are new types of project specifically designed as components of the Enterprise Project. The Data Model Project contains the Data Model of the application and it is unique in the Enterprise Project. The Web Model Project is similar to the traditional Web Project except that is doesn't contain the Data Model. The Module Project contains the modules that you wish to share among all the other projects of the Enterprise Project.

To create an Enterprise Project select File → New → Enterprise Project. A wizard dialog will appear allowing you to specify the name of the Enterprise Project (e.g. Acme Enterprise Project) and the name of the Data Model Project (e.g. Acme Data Model). The Data Model is mandatory and it is common to all the other projects composing the Enterprise Project (Web Model projects, Module projects and BPM projects).

In the WebRatio Explorer View, the Enterprise Project and its sub-projects are filtered in the tree and they appear as children of the Enterprise Project node.

Enterprise Project node

Enterprise Project Node

To open the Enterprise Project double-click on the Model.wr file. In the working area you can see the Enterprise Project structure with all the components and the dependency projects.

Enterprise Project view

Enterprise Project View

Enterprise Project structure:

It shows the structure of the Enterprise Project in terms of composing projects. You can add/remove sub-projects:

  • To add a sub-project click on the "Add..." button:
    • Add WebModel Project: add a new model project which permits to define the user interface and services.
    • Add Module Project: add a new model project which permits to define the shared modules.
  • To remove a sub-project click on the "Remove" button. N.B. This operation must be carefully executed, because the sub-project will be deleted from the workspace.

Double-clicking on a sub-project opens an ad-hoc editor with the contents of the sub-project (Data Model, Web Model, Module).

Enterprise Project dependencies:

It shows the list of projects on which the sub-projects composing the Enterprise Project depend, allowing you to add/remove project dependencies.

The Styles Projects and Components Projects which already appear in the list (tagged with plug-in) are the ones included in WebRatio and they can be removed, if unused. The WebRatio default projects instead cannot be removed and therefore they are hidden. You can see them by clicking on the "Show WebRatio Default Projects" button in the top-right ( Show default style projects icon ).

N.B. The project dependencies must be explicitly specified at the Enterprise Project level. Therefore if your Web Model project depends on a specific project inside the workspace, you have to declare the project dependency in the "Model.wr" file of the Enterprise Project.

The Enterprise Project can also be opened in absence of one or more than one containing projects inside the workspace: a message will appear beside the project name informing you that the referenced project is closed, or it is not in the workspace.

Enterprise Project Structure

Enterprise Project structure

Renaming sub-projects:

You can rename a Data Model Project, a Web Model Project, or a Module Project, in this way:

  • Select the project in the WebRatio Explorer View.
  • Right click on the project → Rename. Write the new name.
  • The Enterprise Project structure displayes the "Project not in the workspace" message besides the initially selected project.

Enterprise Project Structure after rename

Enterprise Project structure after renaming a sub-project

  • Right-click on the project → Fix reference. Choose the renamed project to adjust the reference.

Enterprise Project fix reference

Enterprise Project structure - fix reference of a renamed project

Import an existing Web Project into an Enterprise Project

The import wizard allows you to import an existing Web Project into an Enterprise Project. In this way you can simply create an Enterprise Project starting from existing Web Projects. Click File → Import... → WebRatio Enterprise → Web Project Into Enterprise Project.

Import dialog

Import wizard

A wizard will guide you during the import process. Basically you have to choose the source Web Project with its views to import and the target Enterprise Project. Regarding the data:

  • The Data Model will be imported into the Data Model Project. The import wizard offers you the possibility to specify the name of the package which will include all the entitites and relationships of the imported Web Project.
  • You can configure how the existing database of the Web Project will be merged with the ones which may be already available in the Data Model Project. You can merge the database of the imported Web Project with a database of the Data Model Project, or you can keep it separate.

At the end of the import process, the Web Project will become a Web Model Project composing an Enterprise Project. Its Data Model elements will be added to the Data Model Project.

Types of sub-projects

Enterprise Project Structure

Enterprise Project Structure

The Enterprise Project is composed by the following sub-projects:

  • Data Model Project (mandatory)
  • Web Model Project(s)
  • Module Project(s)

You can open a sub-project by double-clicking on the sub-project name in the Enterprise Project Structure tree. This action causes the opening of the "Model.wr" file of the sub-project.

The Project tab of each sub-project is composed by:

  • The Views part: it shows the views composing the project.
  • The Enterprise Project Structure part: it shows the Enterprise Project Structure tree. It's only in read-mode (you cannot add or remove sub-projects).
  • The toolbar: it contains the Generate Project button and the Deploy As button.

Enterprise Project and sub projects

Enterprise Project sub-project

Data Model Project

The Data Model Project contains the Data Model of the Web Application, which describes the conceptual data organization. The Enterprise Project can contain only one Data Model Project.

Data Model Project

Enterprise Project - Data Model Project

The Entities and Relationships inside the Data Model Project are visible to all the sub-projects. If you wish to graphically separate the Data Model elements used by each Model Project you can group them in several packages, each of them contains the entities and relationships related to a specific Model project.

N.B. The Data Model updates (addition, removal, changing of an entity / relationship) will be seen by the other sub-projects after the saving operation.

Web Model Project

The Web Model Project contains the Web model elements of the Web Application. The possible views composing the Web Model Project are the Site View, the Service View and the Module View.

You can Add/Remove a view by clicking on the "Add..." or "Remove" buttons.

Web Model Project

Enterprise Project - Web Model Project

The Web Model Project, composing the Enterprise Project, is different from the traditional Web Project for the following features:

  • The Web Model Project does not contain the Data Model. The Data Model in fact is defined into the Data Model Project: this means that it is shared among several projects. In the traditional Web Project instead, the Data Model belongs to the Web Project and its visibility is limited to the Web Project.
  • The Web Model Project dependencies have to be explicitly declared at the Enterprise Project level. The traditional Web Project instead depends on all the projects in the workspace; you can specify a filtered list of dependency projects directly in the Web Project.

In the following picture you can see an example of Web Project view. Differently from the Web Model Project view you can notice the Data Model node and the Dependencies section.

An example of Web Project

Web Project

Module Project

The Module Project contains the modules that are shared among all the Web Model Projects. The modules needed by several Web Model Projects are managed in a centralized way, thus avoiding the module duplications inside each project. The Module Project could be seen as a library, which can be used several times in different projects.

You can Add/Remove a module by clicking on the "Add..." or "Remove" buttons.

Module Project

Enterprise Project - Module Project

The Enterprise Project allows the definition of the modules:

  • In the Module Project: the modules are visible to all the Web Model Projects composing the Enterprise Project.
  • In the Module View of a Web Model Project: the modules are visible only in the Web Model Project. Their usage is limited in the Web Model Project.

You can define shared modules starting from local modules inside a Web Model Project:

  • Right-click on the Module View → Refactor → Make shared.
  • Choose the target Module Project. The module will be moved to a Module Project, therefore it is shared among all the Web Model Projects.

The module sharing process makes visible on the outside only the following module types:

  • The Operation Module.
  • The Hybrid Module without Content Pages.

Communication between different kind of subprojects

The Enterprise Project is composed by several sub-projects, which interact for exchanging information and functionality. The following schema shows the relationships among the sub-projects composing an Enterprise Project.

Communication between sub-projects

Enterprise Project sub-projects and interactions

The Enterprise Project box is the "Model.wr" file which defines the Enterprise Project structure and the Enterprise Project dependencies, while the other boxes represents the Data Model Project, the Web Model Projects and the Module Projects.

  • The information declared at the Enterprise Project level is visible by all the sub-projects. In particular the Running Profile, the Service/Data Providers, the Locale, the Bundle Key, the Context Parameter and the Condition Expression.
  • The Enterprise Project can contain one and only one Data Model Project that is shared among the sub-projects. The Data Model Project uses the information specified at the Enterprise Project level and it exposes to all the sub-projects its entities, attributes, relationships, subtypes and databases.
  • The Web Model Project uses the information defined at the Enterprise Project level and it sees the Data Model. A Web Model Project can interact with other Web Model Projects (each Web Model Project exposes its collector parameter) and it can reference the shared modules contained in the Module Project (only the Operation Modules and the Hybrid Modules without a Content Page).
  • The Module Project uses the information defined at the Enterprise Project level and it sees the Data Model. A Module Project can only interact with other Module Projects. It exposes its Operation Modules and Hybrid Modules.
  • The BPM Project is referenced by the Web Model Project.

Interaction among the Web Model Projects:

The Web Model Project communicates one with the other through the usage of Jump Units, which allow to move ("jump") within the application (e.g. you move from Page 1 belonging to Web Model Project 1 to Page 2 belonging to Web Model Project 2).

The Jump Unit requires to specify the Collector Unit property, which refers to a Parameter Collector Unit inside any Web Model Project. Therefore, the Parameter Collector Unit allows to define the target project and model element of a jump inside the application.

The only model elements that a Web Model Project makes available to all the other Web Model Projects are the Collector Parameters. This information is enough to jump to another Web Model Project element.

Context Parameters, Condition Expressions

The Enterprise Project, the Web Model Project and the Module Project can exchange the Context Parameters and the Condition Expressions:

  • The Context Parameters / Condition Expressions defined at the Enterprise Project level can be seen by the sub-projects composing the Enterprise Project.
  • The Context Parameters / Condition Expressions defined at Enterprise Project level or inside the Module Project can be make local to a Web Model Project. Right click on the Context Parameter → Refactor → Make local to WebModel Projects... For example:

Make Context Parameter local to WebModel Projects

Make Context Parameter local to WebModel Projects

Make Context Parameter local to WebModel Projects

Make Context Parameter local to WebModel Projects

The Context Parameters / Condition Expressions will be moved from the Enterprise Project node or the Module Project node to the specified Web Model Projects, therefore they can be used only within the Web Model Projects.

  • The Context Parameters defined inside a WebModel Project can be shared among all the sub-projects composing the Enterprise Project, by right clicking on the Context Parameter → Refactor → Make shared...

Share Context Parameter

Share a Context Parameter

The Context Parameters will be moved from the Web Model Project to the Enterprise Project node, therefore they can be used inside any sub-project.

Modules

The Module Project and the Web Model Project can exchange the modules:

  • The modules defined in the Module View of a Web Model Project can be shared with all the sub-projects by simply moving them into a Module Project. Right click on the Module View → Refactor → Make shared. This operation moves the modules inside the Module Project.

Share Module

Share modules

  • The modules inside a Module Project can be limited to specific Web Model Projects by clicking on the Module View → Refactor → Make local to WebModel Projects.... Note that this operation moves the modules to a Web Model Project, therefore they are no more shared.

Make modules local to WebModel Projects

Make modules local to WebModel Projects

How can I deploy an Enteprise Project?

The Enterprise Project represents a complex application at enterprise level, which needs to be generated and deployed on an application server (e.g. JBoss).

Generation

In order to generate and deploy the entire application, you can click the Generate Enterprise Project button.

Generate Enterprise Project command

Generate Enterprise Project

Alternatively, you can generate and deploy only a specific sub-project which composes the Enterprise Project (Data Model Project, Web Model Project, Module Project), by clicking the Generate DataModel Project, the Generate WebModel Project, or the Generate Module Project button.

Generate Data Model Project command

Generate DataModel Project

Generate Web Model Project command

Generate WebModel Project

Generate Module Project command

Generate Module Project

Result of the generation

The generation process ends with the creation of the ".ear" archive of the application, which contains the war/jar archives of the components of the application, the required libraries and the deployment descriptors. The .ear archive is placed inside the location specified with the "webapps_loc" variable (e.g. <JBoss installation path>/standalone/deployments). To configure the "webapps_loc" variable: Window → Preferences → WebRatio → Variables.

The .ear archives has the following structure:

Structure of the Enterprise Project .ear archive

Structure of the Enterprise Project .ear archive

  • "<Enterprise Project Name>_ROOT.jar": it contains the common runtime configuration files (e.g. RTXConfig.properties), the common descriptors and the common ".properties" files (e.g. log4j, fckeditor, bundle localization files).
  • "<Enterprise Project Name>_ROOT.war": it contains the common files related to Struts configuration.
  • "<DataModel Project name>.jar": it contains the files for the application's data management: the entity Java beans, the "datamodel.xml" file with the information about the persistent data, the "application_vdb.hibernate.cfg.xml" and "session_vdb.hibernate.cfg.xml" Hibernate files with the information about the volatile data (respectively at application scope and session scope).
  • "<WebProject name>.war": it contains the .jsp pages of the Web application and the application folders.
  • "<Module Projec name>.war": it contains files and folders related to the modules inside the Module Project.
  • "lib": libraries required by the enterprise application.
  • "META-INF": it contains the "application.xml" and the "jboss-deployment-structure.xml" deployment descriptors.

Deploy

The enterprise application is packaged as an ".ear" archive. To successfully deploy the application, you need an application server, such as JBoss (http://www.jboss.org/jbossas/downloads/). JBoss 7.1.0 Final is the recommended and tested version.

At the end of the generation process, if the "webapps_loc" variable has been appropriately configured, you should find the ".ear" archive in the deployment folder of your application server. For example, in case of JBoss: <JBoss installation path>/standalone/deployments.

Start the application server for starting the deployment. If the process ends with success, you can type the application URL in the browser and view your application.

Deployment plan

The common deployment tasks (enterprise application generation, .ear packaging,...) can be automated through the definition of a Deploy Configuration. A Deploy Configuration is described by some configuration properties and a set of tasks to be executed. You can manage your deploy configurations and run one of them in order to deploy an application.

To define a Deploy Configuration open the Deploy Configuration dialog through the Deploy icon located in the main toolbar:

Deploy iconDeploy icon

Create a new "Local(Enterprise)" launch configuration and configure it. For example, you need to specify the Enterprise Project in the workspace you wish to deploy, the Application Server (e.g. JBoss) and the set of tasks to be executed during the deployment process. At the end, click "Apply" button to save the Deploy Configuration.
Since the deployment process generates a .ear file and you need to use an application server (e.g. JBoss) for the application deploy, the only possible deployment configuration is "Local (Enterprise)".

Deploy Configurations dialog

Deploy Configurations

You can deploy your application by launching the Deploy Configuration. Simply click on the Deploy icon and choose the saved Deploy Configuration from the menu.

Run a deploy configuration command

Run a Deploy Configuration

 
 

Related Learning Objects