Part 3. Creating application patterns in Rational Application Developer
There are two ways to create an application pattern between Rational Application Developer and Workload Deployer. You can create a new skeletal application pattern in Rational Application Developer based upon a selection of Java enterprise, Web, or OSGi application projects in your workspace and publish it to Workload Deployer. Or, you can create an application pattern in Workload Deployer and acquire it into your Rational Application Developer workspace. The latter approach is the more common of the two and is covered in Part 5. Creating application patterns in Workload Deployer. Both approaches result in the creation of an application pattern that effectively resides both in the Workload Deployer storehouse and your Rational Application Developer workspace.
In this part of the tutorial, you use Rational Application Developer to create a new skeletal virtual application pattern in preparation for publishing it to Workload Deployer.
Virtual application patterns are represented by normal files within your workspace. They can be kept in any kind of project. However, it is best to place them in a simple project dedicated to holding virtual application patterns.
Note: The New Cloud Application File wizard warns you against storing virtual application pattern files in specific kinds of projects, including Java EE, Web, and OSGi application projects. The simplest reason for this warning is that virtual application pattern files have no meaning within these kinds of projects. If a virtual application pattern file is created or modified within one of these types of projects, the project may be needlessly flagged for re-publication. Remember that virtual application pattern files compose Java EE, Web, and OSGi application projects – not the other way around.
- From the Rational Application Developer main menu, select File > New > Project to open the New Project wizard.
- Select General > Project.
- Click Next.
- In the Project name field, type Cloud apps. In practice, any name will do.
- Accept all other defaults and click Finish.
- In the Enterprise Explorer, right-click on project Cloud apps and select New > Other to open the New wizard.
- Select Cloud Application > Cloud Application.
- Click Next to proceed to the Cloud Application page.
- Select the Cloud apps project if it is not already selected.
- In the File name field, type Webby.json.
- Click Next to proceed to the "Select a Workload Deployer descriptor" page.
- Select the Descriptor combo box to review the
choices (see Figure 11), but do not change its default setting,
which should be the name of the Workload Deployer server you
created in Part 2. Exploring the Workload Deployer servers.
Figure 11. Selecting a pattern type
In this context, a descriptor is literally the description of the key capabilities of an actual or typical Workload Deployer. The descriptor you choose has a bearing on the behavior of other aspects of the tools.
For example, if you select the descriptor for an actual or typical Workload Deployer of Version 3.0, the Web Application Pattern Type 2.0 is excluded from the Pattern type combo box since that pattern type is only available in Workload Deployer V3.1 or higher.
Actual descriptors correspond to the host names or IP addresses of Workload Deployer servers configurations defined in Rational Application Developer. The information stored within an actual descriptor is downloaded from Workload Deployer.
Typical descriptors are pre-loaded into Rational Application Developer. They represent the capabilities of a standard installation of Workload Deployer. Typical descriptors are useful if you need to begin developing virtual application patterns in Rational Application Developer, but do not have an actual Workload Deployer to use.
- The Pattern type combo box is set by default to "Web Application
Pattern Type 2.0". Keep this default, but first select the
Pattern type combo box to review the other
Rational Application Developer V8.0.4 supports two pattern types:
- Web Application Pattern Type 2.0: This is suited to OSGi applications and Java EE 6 or lower applications. Workload Deployer relies on WebSphere Application Server V8.0 for hosting Java EE, Web, and OSGi application components.
- WebApp Pattern Type 1.0: This is suited to OSGi applications and Java EE 5 or lower applications. Workload Deployer relies on WebSphere Application Server V7.0 for hosting Java EE, Web, and OSGi application components.
- Review the list of Supported components. This is information only, telling you what types of components are supported both by Rational Application Developer and Workload Deployer identified in the Descriptor field above. Selecting items in the list has no effect.
- Click Next to proceed to the Associate Application Model page.
- Click Add to open the New Component and Project
Association dialog as shown in Figure 12.
Figure 12. Selecting a project to associate
- Accept the default Component name.
Note: In practice, you usually choose a more descriptive name for your component, but for the purposes of this tutorial, the default is acceptable.
- Select Webby from the list of application
This list shows all projects in your workspace that you can use to implement the types of components supported by both Rational Application Developer and Workload Deployer, namely Web application (WAR), Java EE enterprise application (EAR), and OSGi application (EBA) projects.
The Filter check boxes control what types of projects are shown in the list. For example, if you un-check the EAR and OSGi check boxes, the list of application projects shrink to show only
- Click OK to return to the Associate Application
Model page as shown on Figure 13.
Figure 13. The associated Web project
- Confirm that there is a single entry in the table of Associations
for component Component, type WAR, and project Webby.
Notice the Edit and Remove buttons are available to change your associations. Do not use them now.
- Click Finish.
Rational Application Developer generates a new virtual application pattern JSON file, Webby.json, into a pre-determined folder called applicationModels in the Cloud apps project. In the Enterprise Explorer, expand the Cloud apps project, then expand its applicationModels folder to reveal the file Webby.json.
- Rational Application Developer opens the virtual application
pattern JSON file in the JSON editor. Close the editor.
Important: The editor is opened mainly for information purposes. Unless you are an advanced user, perform all editing of virtual application patterns in the Workload Deployer Virtual Application Builder, not the JSON editor in Rational Application Developer.
The virtual application pattern JSON file is a conventional workspace file resource. Therefore, several standard actions are available in the context menu for it. Only two of these actions are in any way specific to the Workload Deployer nature of the file.
- In the Enterprise Explorer, expand and right-click on Cloud apps > applicationModels > Webby.json to open the context menu.
- Select Associate Application Model to open the
Associate Application Model dialog.
This dialog enables you to manage the associations between projects in your workspace and the components of the virtual application pattern.
- Do not make any changes. Click Cancel to dismiss the dialog.
- Right-click again on Webby.json, then select Properties to open the Properties dialog for Webby.json.
- Select Workload Deployer Descriptor.
The Workload Deployer Descriptor properties page enables you to change the descriptor used to guide your development of the virtual application pattern. The Details section of the page is for information purposes only. Any changes or selections you make using the Pattern type or Support components controls are ignored.
- Do not make any changes. Click Cancel to dismiss the dialog.
The first time a virtual application pattern JSON file is added to a given project, Rational Application Developer equips the project with the IBM Workload Deployer Application facet.
- In the Enterprise Explorer, right-click on project Cloud
apps and select Properties to open
the Properties dialog for the Cloud apps project as shown in
Figure 14. Cloud application project properties
- Select Validation to show the Validation properties page.
- Check Add Validation Builder to project. If this
control is not present, bypass this step.
By default, general projects like the one you created at the beginning of this part of the tutorial do not include the validation builder. A project without the validation builder is ignored by the validators in Rational Application Developer as shown under Preferences > Validation, including the Cloud Application Validator.
- Select Project Facets to show the Project Facets page.
- Observe that the IBM Workload Deployer
Application facet is checked. Do not make
The first time a virtual application pattern JSON file is added to a given project, Rational Application Developer equips the project with this facet. The facet helps the Rational Application Developer Workload Deployer tools to quickly identify projects that contain virtual application patterns.
- Click OK to dismiss the Properties dialog.