Skip to main content

Validation in WebSphere Studio Application Developer

R. Daly, Software Developer, IBM Toronto Lab
R. Daly is a software developer for WebSphere Studio Application Developer at the IBM Toronto Lab. She is currently responsible for the validation framework and the EJB validator. You can reach her at ruthdaly@ca.ibm.com.
Barry Searle, Migration Team Leader, IBM Toronto Lab
Photo: Barry Searle
Barry Searle is the Migration Team Leader for WebSphere Studio Application Developer. He is a professional engineer who has worked at the IBM Toronto Lab for over ten years on various application development tools. Prior to that he had many years of industry experience developing command and control systems and leading complex communications development projects. You can reach Barry at searle@ca.ibm.com.

Summary:  WebSphere Studio Application Developer automatically validates your code and lets you customize which validators execute and which mode they operate in. This article explains how to configure validation modes to optimize response time according to your own development procedures. It also explains how validation options relate to autobuild options, and it includes handy plug-in that lets you change validation modes globally.

Date:  01 May 2002
Level:  Intermediate
Activity:  140 views

Introduction

Anyone working with WebSphere® Studio Application Developer (hereafter called "Application Developer") notices that it periodically validates your work. What you may not know is that you can configure which validators execute and when they execute. You can operate in full or automatic mode. Although the build and validation configuration options can appear interchangeable to beginners, each drives different behavior. Automatic mode always relies on the Studio Workbench ("Eclipse platform") builds, while full mode relies on builds only if a validator requires it. Accompanying this article is a utility plug-in that enables you to switch between validation modes in Application Developer, Version 4.X. This plug-in lets you switch globally from one validation mode to another, instead of requiring you to switch it on each project. This plug-in is only for Application Developer, Version 4.x since we expect that version Version 5.x will incorporate these features.

The download code below has been tested with Application Developer 4.0.3 on Windows® 2000 and works as described, but may not work with future versions of the product. The code is not part of Application Developer and is not officially supported. Before downloading and using this code, you will be asked to read and accept a license agreement. If you have suggestions or encounter problems, please e-mail the author.


Validators and validation modes

Your first step is to decide which validators you want to run and then choose when they run. Most validators operate on certain types of projects (such as Web or Enterprise JavaBeansTM [EJB] ) and you can configure which validators execute on each project in your workspace. A workspace consists of the files, folders, and projects that you set up in the workbench. Two different Web projects in your workspace can use different subsets of the validators configured on Web projects. To enable or disable a validator, go to the Navigator view (Perspective => Show View => Navigator) and select or clear the validator's checkbox on the Validation page of the project's Properties wizard. When a validator is disabled, its messages (if any) associated with the selected project and its contents are deleted from the Task View. You cannot make a validator ignore a particular rule; enabled validators check every rule.

Validation can operate in full mode or automatic incremental mode. Full mode launches every validator, while automatic mode starts only the incremental validators. An incremental validator can validate a subset of a project, while a full validation validates the entire project every time the validator executes. When operating in full mode, the enabled validators execute when you click Run Validation. In automatic mode, the enabled incremental validators execute after you save a change to aresource.


Types of builds

These modes are affected by the "AutoBuild widget," which you enable by selecting Window => Preferences => Perform build automatically on resource modification. The AutoBuild checkbox controls whether or not the workbench starts an incremental build whenever a resource is changed. If AutoBuild is selected, every builder runs on every saved change, and then every project that depends on those changes is built. When the AutoBuild checkbox is cleared, the workbench keeps track of the resource changes, but does not start a build. Instead, you start a build manually by clicking Build Project, Rebuild Project, or Rebuild All.

  • Build Project starts an incremental build on the selected project, using the list of resource changes
  • Rebuild Project ignores the list of resource changes and rebuilds everything in the selected project
  • Rebuild All rebuilds every project in your workspace

AutoBuild affects validation because there is a validation builder.


Configuring validation

Consider several factors when you decide which validation mode to use. Some validators have dependencies that must be satisfied before the validator executes. Some users prefer to speed up response time by delaying validation until all work is complete. Others want Application Developer to invoke validation automatically, so that they do not need to track manually when and on what validation should run. If at least one validator depends on the output of a builder, then you must build the project before you click Run Validation (for example, the EJB validator depends on the JavaTM Builder because the EJB validator verifies .class files). You have the following choices:

  • Enable automatic validation if you do not want to have to remember to invoke validation before you perform a production action such as deploying or exporting code.
  • Enable full validation with automatic builds and without automatic validation if you want other builders to build, such as the compilation of .java files, and want to delay validation until everything is ready. When ready, click Run Validation.
  • Enable full validation without automatic builds and without automatic validation when you have a group of changes to make and you do not want any builds until everything is complete. When ready, click Build Project (for an incremental build) or Rebuild Project (for a full build), and then click Run Validation.

By default, the validation framework enables automatic validation.

To switch between the modes, you need to use the AutoBuild and "AutoValidate" checkboxes. AutoValidate is the checkbox labeled Run validation automatically on resource modification on the Validation page in the project's Properties wizard. When both AutoBuild and AutoValidate are selected, automatic validation occurs. When AutoBuild is cleared, AutoValidate is disabled. For full validation, clear AutoValidate, or AutoBuild, or both:

Table 1.

Validation ModeAutoBuildAutoValidate
Automatic validationonon
Full validation with automatic buildsonoff
Full validation without automatic buildsoffoff (disabled when AutoBuild is cleared)

After validation has run, you may want more information about a particular validation message that was reported. Application Developer does not provide a comprehensive list of validation messages, because the list would be too large. Instead, post the text of the message or a copy of it to the newsgroup. To copy a message, open WordPad, highlight the message in the task list, and drag the message over to WordPad. Include that text in your post to the newsgroup: news://news.software.ibm.com/ibm.software.websphere.studio.application-site-developer. You may be referred to another newsgroup if the message does not belong to a validator or tool. In Application Developer 5.X, we plan to provide information in the documentation on validation messages.


Validation plug-in utility

The plug-in utility with this article will help Application Developer 4.X users switch between auto and full validation mode easily. The utility provides three pop-up menu items and one drop-down menu item:

1.1 Enable auto validation on all projects
1.2 Enable full validation on all projects
1.3 Add the Revalidate All action to the Project menu
2.1 Revalidate All

In Application Developer 4.X, the auto validation option is available only on the project's Validation page. Because the Properties wizard is available on only one project at a time, changing from auto to full validation mode and vice versa is cumbersome for large workspaces. Menu items 1.1 and 1.2 simplify this process by providing a global mechanism to turn on auto or full validation. In Application Developer 5.X, a global preference page is planned to provide the functionality of the 1.1 and 1.2 menu items.

The drop-down menu item is convenient when you are operating in full validation mode. Revalidate All invokes a full validation on every project in the workbench. Use this option when you do not want to run any validation until all of your work is complete. Unfortunately, Revalidate All does not appear on the menu until you activate the plug-in utility. Using pop-up menu item 1.1 or 1.2 activates the utility; alternatively, you can add the drop-down menu item explicitly by clicking menu item 1.3. All of the menu items are available in the Navigator view, J2EE view, and Java perspective.

Install the plug-in utility into Application Developer 4.X by unzipping com.ibm.etools.validation.extras.zip into the plug-ins directory (the default directory is C:\Application Developer\plugins. The utility is installed correctly if the following directory exists: C:\Application Developer\plugins\com.ibm.etools.validation.extras. To uninstall the utility, delete the com.ibm.etools.validation.extras directory and its contents.


Summary

In Application Developer, you customize which validators execute and which mode they operate in. Validation modes are affected by the workbench's build controls, because validation is implemented as a builder. However, although affected by the builds, you can disable validation independently of the eclipse builds. We hope the plug-in utility will be helpful when you need to switch between validation modes for every project in your Application Developer 4.X workspace.

Top of page



Download

NameSizeDownload method
etools.validation.extras.zip9.0 KBFTP|HTTP

Information about download methods


Resources

About the authors

R. Daly is a software developer for WebSphere Studio Application Developer at the IBM Toronto Lab. She is currently responsible for the validation framework and the EJB validator. You can reach her at ruthdaly@ca.ibm.com.

Photo: Barry Searle

Barry Searle is the Migration Team Leader for WebSphere Studio Application Developer. He is a professional engineer who has worked at the IBM Toronto Lab for over ten years on various application development tools. Prior to that he had many years of industry experience developing command and control systems and leading complex communications development projects. You can reach Barry at searle@ca.ibm.com.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=13763
ArticleTitle=Validation in WebSphere Studio Application Developer
publish-date=05012002
author1-email=
author1-email-cc=
author2-email=
author2-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers