Professional Documents
Culture Documents
Volume 1 n Number 4
Fall 2006
www.eclipsereview.com
IMPROVING
CODE WITH
STATIC ANALYSIS
Web 2.0!
AJAX Meets
JavaServer Faces
27 Must-Have
Eclipse Plug-Ins
Legacy Modernization with...
NXTware ESB
™
Implementing XML and Service Oriented Architecture doesn’t mean starting from scratch. Why not
integrate and modernize application functions as you need them in Eclipse?
NXTware ESB provides just-in-time modernization from within an Eclipse development environment.
Lower costs and reduce risk by creating SOA interfaces for the business functions you need, when you
need them, with NXTware ESB for Eclipse.
eCube Systems
Learn more about Enterprise Evolution and Enabling Enterprise Evolution
NXTware SOA for Eclipse. Call (866) 493-4224
Copyright eCube Systems LLC
or visit www.ecubesystems.com. San Mateo - Boston - Houston
Vol. 1 n No. 4 n FALL 2006
FEATURES
Cover Illustration: “Earth and Sky,” by Meg Gencay
18 COVER STORY
27 Must-Have Eclipse
Plug-Ins
Rick Wayne takes you on a scenic
tour of his favorite add-ins, covering
lanaguage support, modeling, UI
design, integration, frameworks and
much more.
DEPARTMENTS
27 SOAP? XML? WSDL?
Java? Eclipse!!
7 Context
Happy birthday, Eclipse! It’s been five years, and look
how much the platform and community have grown.
You can leverage Web services using
the Eclipse Web Tools Platform, as
Chrisopher Judd demonstrates. 8 Launchpad
The latest tools, technologies and plug-ins for Eclipse
developers.
38 AJAX Meets
13 Projects
The Data Tools Platform makes it easy to work with
JavaServer Faces relational databases.
Max Katz shows how you can use
component-based development for
building “Web 2.0”–style rich
41 Perspective
Has the open-source Eclipse platform ruined the
Internet applications. commercial tools market—or helped it?
BZ Media LLC | 7 High Street, Suite 407 | Huntington, NY 11743 | +1-631-421-4158 | fax +1-631-421-4130 | www.bzmedia.com | info@bzmedia.com
President | Ted Bahr Executive Vice President | Alan Zeichick
Eclipse Review is published 4 times a year by BZ Media LLC, 7 High Street, Suite 407, Huntington, NY 11743. POSTMASTER: Send address changes to BZ Media, 7 High Street, Suite 407,
Huntington, NY 11743. Ride along is included.
Copyright © 2006 BZ Media LLC. All rights reserved. Eclipse Review is a trademark of BZ Media LLC. Eclipse is a trademark of The Eclipse Foundation.
Sybase WorkSpace:
Do Something More Interesting
A SINGLE ENVIRONMENT OFFERS WHAT YOU NEED FREEDOM TO CUSTOMIZE BASED ON YOUR BUSINESS NEEDS
Sybase WorkSpace is a Java™ toolkit offering the five most important WorkSpace’s modular packaging allows enterprises the flexibility to
design and development tools in an integrated easy-to-use, open decide how to assign business critical tasks to developers, rather than
source framework: requiring them to fit into ill-fitting “roles” predetermined by a vendor.
• database development • mobile development You buy only the pieces you need, enabling you to customize your
• web application development • enterprise modeling environment as you see fit.
• services-oriented development
With Sybase WorkSpace, you’re finally free to do the design and
MAKES DEVELOPMENT AND DESIGN EASY TO LEARN AND USE development that’s interesting to you. For more information and
Using industry-leading integrated model-driven design, visual develop- to download White Papers and an evaluation copy, visit
ment and task-based wizards, Sybase WorkSpace automates mundane www.sybase.com/workspace
tasks and cuts the typical development tool learning curve, freeing
developers to concentrate on what’s important—business logic.
Copyright © 2006 Sybase, Inc. All Rights Reserved. All product and company names are trademarks of their respective owners.
CONTEXT
From the Editor | by Alan Zeichick
EDITORIAL
Editorial Director
Alan Zeichick
+1-650-359-4763
Copy Editor
Laurie O’Connell
Contributing Editor
George Walsh
gwalsh@bzmedia.com
Northwest U.S./Canada
IBM’s commitment to Eclipse was extensible, standards-based components
Paula Miller further demonstrated by its willingness for a tools platform upon which soft-
+1-925-831-3803
pmiller@bzmedia.com
to divest itself of its intellectual proper- ware developers can create specialized,
ty and form the independent Eclipse differentiated and interoperable offer-
Southeast U.S./Europe
Jonathan Sawyer Foundation in February 2004. The ings of tools for system management.”
+1-603-924-4489 unprecedented moves toward open That’s a new direction for the
jsawyer@bzmedia.com
source and open governance launched Foundation, driven by companies like
Northeast/Central U.S./Canada Eclipse into orbit. IBM, Cisco, Intel and Compuware.
David Lyman
+1-978-465-2351 Another advance is the Rich Server
dlyman@bzmedia.com WHERE NO STANDARD IDE Platform User Interface Framework, or
Advertising Traffic HAS GONE BEFORE… RSP-UI. (Gotta love those Eclipse
Phyllis Oakes
+1-631-421-4158 x115
But that’s not what’s sustained it there. acronyms!) This project is conceptually
poakes@bzmedia.com The Eclipse Foundation and its active similar to the Rich Client Platform,
Marketing Manager members have continued to broaden except that it allows the creation of
Marilyn Daly the platform’s charter. They’ve intro- pluggable, componentized, server-side
+1-631-421-4158 x118
mdaly@bzmedia.com duced Eclipse into new areas, going applications, where plug-ins communi-
where no standard IDE has gone before. cate with each other through extension
List Services
Nyla Moshlak To name just a few: The Rich Client points and OSGi services. This project
+1-631-421-4158 x124 Platform has taken on a life of its own. hasn’t made much progress lately, but
nmoshlak@bzmedia.com
The C/C++ Development Tool project the concept is fascinating.
Reprints showed that a Java IDE doesn’t have to A more active project is the
Lisa Abelson
+1-516-379-7097 be limited to just Java. The Device Subversive Project, which seeks to cre-
labelson@bzmedia.com
Software Development Platform helped ate a Subversion plug-in for Eclipse
Accounting programming think inside the box, as with functionality similar to the Eclipse
Viena Isaray
+1-631-421-4158 x110 did the Embedded Rich Client Platform. CVS Team project. If the project is suc-
visaray@bzmedia.com As Eclipse reaches its fifth year, the cessful, the team hopes that Subversion
READER SERVICE organization has a number of fascinat- support will become a core Eclipse fea-
Director of Circulation ing new projects that are either just set- ture. Polarion Software, which sells
Agnes Vanek
+1-631-421-4158 x111 ting sail or making progress. Some are application life-cycle tools for
avanek@bzmedia.com making more progress than others, but Subversion, is running the project. So
Customer Service/Subscriptions that’s what happens in a community. far, it’s on track for release in 2007.
+1-631-421-4158 x124 One new project is COSMOS, which The first five years of Eclipse have
service@bzmedia.com
extends the Eclipse platform outside of been exciting—look how far the tech-
BZ Media is an Associate software development and into more nology, and the organization, have
Member of the Eclipse
Foundation, www.eclipse.org general IT: “The mission of the Eclipse come in a short time. I can’t wait to see
COSMOS Project is to build generic, what happens next.
GWT Designer Delivers AJAX completion, a C/C++ debugger, a named-user licenses costs €980, plus
GUI for Google Web Tool C/C++ launcher, a parser and index- €245 of annual maintenance.
Instantiations is offering GWT er, a search engine, content assist and www.guidancer.com
Designer, a new tool for AJAX Web a Makefile editor and builder. The
applications using the Google Web company builds on Eclipse with several SHORT TAKES
Tool. GWT Designer is built on OSE-aware plug-ins that help develop- Stylebase is a new open-source
WindowBuilder Pro, the company’s ers solve complex system-level prob- tool for maintaining a reuse repository
software for creating Java graphical lems in their application code. These for architectural models and design
user-interface applications for Linux, plug-ins include a system browser for patterns. The software and the reposi-
Mac OS X and Windows. GWT viewing and manipulating OSE system tory assist developers in applying a
Designer provides developers with a objects, a pool profiler for browsing quality-driven architecture design to
rich WYSIWYG GUI construction envi- and analyzing system memory utiliza- software engineering in a way that
ronment. Developers simply drag-and- tion, a run-mode debugger with a pro- promotes software reuse. The tool can
drop composites, layouts and controls gram launcher (loader), and a help be used in three ways: as an electron-
when building user interfaces, which viewer for viewing OSE documents and ic library, where an architect can
can be tested and deployed using the references. All Optima plug-ins support browse the stylebase as a pattern cat-
Java-to-JavaScript compiler provided fully distributed debugging, which alogue; for model evaluation; where
by Google. GWT Designer also enables any target CPU in a connected the architect detects which patterns
includes bidirectional code generation, network to be accessed without the have been used in an architecture
a WYSIWYG designer and Cascading need for a direct connection. model and then checks from the
Style Sheet support. Its GWT applica- www.enea.com stylebase which quality-attributes are
tion launch system has a shortcut for associated with these patterns; and
fast launching using the popup menu GUIdancer Tests Without for constructing a new architecture
or editor hot key. It also has intelli- Coding model, where the architect searches
gent refactoring, where renaming or GUIdancer is an Eclipse-based envi- the knowledge base according to the
moving a module class or remote ronment from Bredex for testing desired quality characteristics.
service updates the module XML file Java/Swing application GUIs that the stylebase.sourceforge.net
and renames any associated Async company claims requires no coding.
and Impl classes. The software costs New in version 1.1, released last GNATbench for Eclipse is a plug-in that
US$39 for an annual subscription. week, is the ability to execute batch provides editing, browsing and build-
www.instantiations.com tests from a command line, support for ing features for Ada (including Ada
testing multilingual applications using 2005) development using AdaCore’s
Real-Time IDE for Enea’s OSE the same test components, new capa- GNAT Pro toolset on the Eclipse plat-
Leverages Eclipse, CDT bilities for trees and tables, and an form. The builder produces executables
Optima is a new Eclipse-based IDE for improved user interface. First released for native systems and embedded
OSE, a time-time operating system in January as a preview, GUIdancer processors (in the context of Wind
from Enea. Optima, which costs $3,000 1.1 for Linux, Mac OS X, Solaris and River’s Workbench), and the debugger
per seat, uses Eclipse 3.1.2 and Windows also now includes an API to supports both native and embedded
C/C++ Development 3.1.1 to provide extend the tool—without code—for system debugging. GNATbench
system-level browsing, debugging, pro- applications that use non-Java/Swing includes an Ada-specific editor, code
filing and analysis tools for large-scale components and actions. To avoid the assistance for Ada, code browsing, a
distributed systems spanning multiple need for programming, GUIdancer project explorer, an integrated builder
processors and operating systems. employs a so-called specification con- and an integrated debugger. The com-
Optima uses the Eclipse Workbench cept, which creates modular, reusable pany offers a separate Ada plug-in for
and Workspace concept for building tests from source code before an appli- Wind River’s VxWorks, but this plug-
images and managing projects, and cation is completed. On the desktop, in produces executables for native
provides plug-ins for most software the program requires Java 1.5, which systems, rather than embedded
configuration management tools. The is included with the Windows down- processors; similarly, the debugger
CDT includes a C/C++ editor with load. The server component runs on supports native system debugging.
language-aware highlighting and code Java 1.3. Demo licenses are free; www.adacore.com
©
Copyright Intel Corporation, 2006. All rights reserved. Intel, the Intel logo, are trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and
brands may be claimed as the property of others.
FOUNDATION
Adoption
A recent Evans Data survey indicated strong growth in be late June 2007. The list of projects is
the awareness and adoption of the Eclipse Rich Client expected to include the entire Callisto
project, plus additional ones. Stay tuned
Platform (RCP). A survey of the Eclipse user community indicated
for more details.
that almost 23 percent of the respondents were using Eclipse RCP.
This is a 130 percent increase over a previous 2005 study. More NEW MEMBERS OF THE
importantly, the survey indicates strong growth and momentum for ECLIPSE FOUNDATION
future RCP usage, with 68 percent of the respondents indicating We would like welcome Simula Labs
they will be using it within the next six months. A great sign of a as a new strategic developer of the
Eclipse Foundation. In addition, Sony
strong future for Eclipse RCP.
Ericsson Mobile, ARM Limited, Active
ECLIPSE EVENTS bug-fix maintenance release for this Grid andKPIT Cummins have joined as
Thanks to BZ Media, the Eclipse com- date. Users can go to the Eclipse update add-in providers. The Eclipse Founda-
munity has a great new Eclipse con- site to download Eclipse 3.2.1 and the tion now has 142 member organiza-
ference to attend. The second annual new releases of the other projects. tions and more than 750 committers.
Eclipse World conference was held
Sept. 6–8, 2006, in Boston. By all IN 2007, IT’S EUROPA! PROJECT UPDATES
accounts it was a great success and a The planning has started for the next Here is a summary of project reviews
great place to get solid technical con- year’s coordinated release train, called that have arisen so far in 2006. We
tent on different Eclipse projects. We Europa. Like Callisto, Europa will fea- hope to make this a regular feature of
look forward to the EclipseWorld ture a coordinated release of the major this column. It is based on the RSS
2007, which will be held Sept. 6–8 in Eclipse projects. The plans still need to feed at www.eclipse.org/projects/
Reston, Virgina. be completed, but we expect the date to reviews-rss.php.
The Eclipse Foundation also
launched a new European event in Table 1 Project Updates
Germany, called Eclipse Summit
Europe. It was held Oct. 11–12 in PROJECT REVIEW DATE
Parallel Tools Platform 1.0 Released Approved Aug. 15
ECM Rich Client Platform (Apogee) Project Approved Aug. 15
Esslingen, Germany, and attracted
Google Summer of Code Project Created and Provisioned Aug. 18
300 Eclipse enthusiasts. The Summit
SVN Team Provider Proposal Updated Aug. 20
featured four technical symposia cov-
ering topics such as modeling, rich Aperi Storage Management Project Created and Provisioned Aug. 24
client applications, server-side Eclipse g-Eclipse Proposal Posted Aug. 25
Embedded Rich Client Platform 1.0 Released Approved Sept. 11
Eclipse Orbit Project Created and Provisioned Sept. 22
and test-driven development for the
COSMOS Proposal Updated Sept. 28
embedded systems space.
Eclipse Platform 3.2 Release Approved Oct. 2
MAINTENANCE RELEASE Subversive Project Proposal Updated Oct. 5
FOR THE ECLIPSE CALLISTO ECM Rich Client Platform (Aprogee) Project Created and Provisioned Oct. 6
g-Eclipse Creation Review Oct. 15
Model-to-Text Transformation Proposal Posted Oct. 16
PROJECTS
AspectJ Development Tools 1.4.1/1.5.3 Release Review Oct. 17
A maintenance release of the Callisto
Model Development Tools Project Created and Provisioned Oct. 18
projects was made available on
September 29, 2006. All 10 projects that Callisto Simultaneous Release Approved Oct. 19
participated in the June Callisto release CDT 3.1 Release Approved Oct. 19
coordinated the availability of their
els for use with the rest of DTP. To • SQL Query: An abstract view of base vendor documentation.
keep the scope manageable in the actual SQL queries
first data source releases, DTP’s • SQL XML Query: An abstract EXPOSING THE VENDOR
designers decided to concentrate on view of XML data processed in DOCUMENT
models for relational data sources. SQL queries Once you’ve generated a database--
Based on the Eclipse Modeling Unlike many other Eclipse plat- specific XMI database vendor docu-
Framework (EMF), it includes mod- form components, you’ll need to do ment, you will need to use the
els for the following: some work to use the models with org.eclipse.datatools.connectivity.sqm
• SQL: Based on the SQL 99/03 your own database. The key steps of .core.databaseDefinition extension
specifications, SQL is the basis this process are to create your data- point to expose it. You can extend the
for the other models base definition and expand the databaseDefinition extension point for
• Database Definition: For spe- Ecore/Genmodel for the SQL Model. org.eclipse.datatools.connnectvity
cializations not covered by the .sqm.core using the following defini-
SQL Specification DATABASE DEFINITION SURVEY tion:
<definition
The SQL Model is a metamodel based
on the SQL 99/03 specifications, version="4.0"
Survey Questions which defines all database elements product="MySql"
for the industry standard. A database
The following questions allow you to gather the infor- productDisplayString="%4.0_ProductStri
ng"
mation necessary to customize a Java program for definition model derives from the SQL
your particular database. Once the information is gath- Model, in which all detailed database
versionDisplayString="%4.0_VersionStri
ng"
ered, you can go through the program and specify the model elements—including tables,
details for the database definition. For example, you columns, user-defined data types, rela-
would probably want to set the schema support to a file="runtime/vendors/MySql_4.0/MySql_
4.0.xmi">
tionships and constraints, stored pro-
value of false if you’re working on a MySQL data-
cedures and their detailed parame- </definition>
base.
ters—are implemented. These values specify a unique
1. What versions do you support? Are the answers to The DTP Model Base provides a name and version string for this
the following questions different depending on which Java program to create a new data- given vendor XMI document—
version you’re discussing? Each database/version
base vendor document and is stored MySQL as the product and 4.0 as
combination should be represented by a unique data-
base vendor document that will then be exposed via in XML Metadata Interchange (XMI) the version.
the org.eclipse.datatools.connectivity.sqm.core format. The Java class uses the If you look at the extension
.databaseDefinition extension point. database definition model as a base, point’s file property, it refers to a
2. Are view triggers supported? then goes through the model ele- particular path to the XMI document
3. What's the maximum identifier length?
ment-by-element, setting specific in the plug-in that exposes it. The
4. What's the maximum comment length?
5. Is sequence supported? details. It walks through items such directory under runtime/vendors
6. Is MQT supported? as columns, views and triggers, corresponds to [product] underscore
7. Is alias supported? specifying available data types and [version,] just like the XMI file’s
8. For columns: qualities for those items. When the name, MySQL_4.0. A display string
a. Is identity supported?
Java program is run, it will create an for the product and version is pro-
b. Is computed supported?
c. Is Identity start value supported? XMI document to serve as the data- vided to make it more human-read-
d. Is identity increment supported?
e. Is Identity maximum supported?
f. Is Identity minimum supported? Table 1 Primitive types supported by the base SQL model
g. Is identity cycle supported?
9. For constraints: Character data Other
Binary data Numeric data
a. Is a clustered primary key supported?
b. Is a clustered unique constraint Character Binary Numeric boolean
supported? character varying binary varying Decimal date
10. What primitive types are supported: character, deci-
mal, double, integer or numeric? The base SQL model character large object binary large object Smallint time
supports the types shown in Table 1. For each, you national character Integer timestamp
would populate your specialized model, as in the exam- national character varying interval
Bigint
ple shown in Listing 1.
national character large Float datalink
To make setting these values easier, the ExampleFor object
VendorPrimitiveWrite.java file found at www.eclipse.org/
datatools/project_modelbase/modelbase_doc/ Real xml
sampleZip/ExampleForVendorPrimitiveWrite.java can be double precision
used.
DatabaseDefinitionFactory.eINSTANCE.createPredefinedDataTypeDefinition();
ECORE/GENMODEL
Typically, you don’t need to alter the characterDataTypeDefinition.setPrimitiveType(PrimitiveType.CHARACTER_LITER-
definition for SQL Model. However, if AL);
characterDataTypeDefinition.getName().add("CHAR");
characterDataTypeDefinition.getName().add("CHARACTER");
you do need to add new model defi-
nition to the SQL Model, complete characterDataTypeDefinition.setMaximumLength(254);
the following steps: characterDataTypeDefinition.setKeyConstraintSupported(true);
characterDataTypeDefinition.getDefaultValueTypes().
add(DefaultValueType.CURRENT_USER_LITER-
• Change the SQL Model file to
add your database element or AL);
create a new Ecore that refer- characterDataTypeDefinition.getDefaultValueTypes().
add(DefaultValueType.NULL_LITERAL);
characterDataTypeDefinition.setLengthSupported(true);
ences the existing SQL Model
Ecore file and extend it. characterDataTypeDefinition.setJdbcEnumType(1);
• Use the Eclipse framework to characterDataTypeDefinition.setJavaClassName("java.lang.String");
generate a new EMF model.
• Generate code to create a new n LISTING 2: PART OF THE EXTENSION MARK-UP USED IN DTP FOR THE
Database Definition Model. EXEMPLARY GENERIC JDBC DRIVER TEMPLATE
<extension
point="org.eclipse.datatools.connectivity.driverExtension">
For example, you may want to add
an event object to the schema ele- <category
ment in the model. You would need id="org.eclipse.datatools.connectivity.db.driverCategory"
name="%org.eclipse.datatools.connectivity.db.driverCategory"/>
<driverTemplate
to create your own model object for
an event and then create a unique createDefault="false"
element that extends the schema ele- emptyJarListIsOK="false"
id="org.eclipse.datatools.connectivity.db.generic.genericDriverTemplate"
jarList=""
ment in the SQL model.
connection management framework, requests. In this case, the sources will require much more pro-
along with associated wizards and JDBCConnectionFactory class pro- cessing, and the benefit to clients is
other UI support. Contributions to vides the implementation. Being a the uniform abstraction delivered by
the connection management frame- factory, an instantiation provides, in the frameworks.
work are made visible by the exten- this case, JDBCConnection objects.
sion point org.eclipse.datatools.con- When the client wants to connect to MAKING THE CONNECTION
nectivity.connectionProfile. Listing 3 the database represented by this Most of the work in using DTP
shows part of the connection profile profile, the code shown in Listing 4 involves creating an EMF-based
definition for generic JDBC. is executed in JDBCConnection. model for the particulars of your
Keep in mind a few key points. Here, we see the use of properties database. Driver and connection sup-
The first is that a connection profile defined by the driver definition and port is attained by leveraging the con-
is associated with a given category specified by the user. After these prop- nectivity frameworks. While the
defined in the category mark-up. erties are retrieved, the code is fairly information given here is not com-
You could reuse a category defined standard for setting up a JDBC connec- plete in every detail, it should contain
elsewhere, for example, to add a tion. enough of a trail guide to help you
connection profile to the categories In this simple case, why do we need navigate the Apache Derby imple-
provided by default. The the overhead of a driver definition and mentation shipped with DTP 0.9 and
connectionProfile mark-up is simply connection profile? At first glance, customize it as necessary.
a declarative way of setting the cate- these seem like overkill, but the main The DTP Enablement project will
gory and name icon in the connec- goal of DTP connectivity is to provide continually include more complete
tion profile. The key implementation an abstraction over the notion of con- and complex examples for databases.
comes in the connectionFactory sec- nection, encapsulating the implementa- These will serve a dual purpose: pro-
tion. A connectionFactory gives the tion details so client tools can work viding data source support close at
implementation class that is respon- with connections uniformly. hand to the DTP core and serving as
sible for creating and maintaining While the generic JDBC case is further examples of what can be
connections based on client straightforward, more complex data built on the Data Tools Platform.
27 Must-Have Eclipse
Plug-Ins: Get Them Now!
n
I
nstalling Eclipse is like moving into a new apartment—
it’s spacious, intelligently laid out, boasts shiny, cleverly BY RICK WAYNE
designed appliances… but it’s bare. To make an apart-
ment livable, you put your stamp on it, you move in your Ruby Development Tools/Radrails
furniture and your wall art and your game console. To www.rubypeople.org and www.radrails.org
make Eclipse really sing as your development environ- License: Common Public License /
ment, you need to extend the basic IDE with tools tailored Eclipse Public License
to your tasks and foibles. It takes serious gumption to admit in this magazine
In short, you need to go on a plug-in hunt. You could that I code so much in Ruby. But I climbed aboard the
simply grab one of the preassembled Eclipse distributions Ruby bandwagon in 2001, when it was nothing but a red
set up with whole sets of plug-ins, and there certainly are Radio Flyer squeaking by with Matz, Dave Thomas, Andy
some excellent ones out there, such as MyEclipse. But Hunt and a couple of kazoos. These days... breathes there
there’s a lot to be said for rolling your own environment, the programmer who hasn’t been swamped by the Rails
and I’ve focused here on the a la carte approach. hype? If you’re intrigued by the idea of painless database-
It wasn’t easy to choose among the hundreds of plug- driven Web app development, grab these two plug-ins and
ins out there, and your mileage may vary. I’ve assembled go for it. RDT makes Eclipse aware of Ruby’s syntax, with
some real stars in each of seven categories: syntax coloring and checking, an outline view, Test::Unit
• Language support integration and Ruby debugging. (Refactoring is Ruby’s
• UI design Achilles’ heel: In RDT, it’s limited to block comment
• UML, modeling and process support /uncomment! And I’ll make you Java hacks a deal: You
• Back-end integration and framework support don’t bring up autocompletion, I won’t bring up checked
• Utilities exceptions.) Radrails provides management tools for con-
• Testing and code analysis figuring and running Rails Web applications. Neither has
A word on licensing: Free is nice, but I haven’t neg- the laundry list of features that you’ll find in, say, J2EE
lected commercially licensed tools either. Somebody is tools, but in a way, that’s the point: Rails frees you from a
paying to write these tools, whether it’s for sale, as a lot of that picayune detail.
corporate contribution to the community, or the leg-
endary spare-time hacker (when I get some, I’ll become oXygen Plug-in Edition
one, I always say). It costs either dollars or opportuni- oxygenxml.com
ties to develop good software like this, so you should License: Commercial
seriously consider paying your share one way or the XML is definitely here to stay, like it or loathe it (YAML,
other. Buy, contribute money, or contribute resources anyone?). Many of the features that make XML easy for
like time or server space to these projects. We’re all the computers to parse make it hellish for humans to edit—
better for it. hence oXygen. This critter handles syntax highlighting and
Sermon over. Without further ado... the winners, if autocompletion, DTD and schema validation (including
you please! XML Schema and Relax NG), and features both an XSLT
transformer and debugger. It also includes refactoring tools
LANGUAGE SUPPORT
Rick Wayne (fewayne@gmail.com) is a software developer for the
Without getting into a which-language-is-best mud-
University of Wisconsin, where he has far too much fun building
wrestling match—I know, but I’ll never get you to
Java and Web applications. He started coding professionally in 1984,
agree—here are some great plug-ins for widely used writing about it in 2000, and teaching it in 2001.
languages.
Figure 1 Omondo EclipseUML generates a ton of UML 2.0 diagrams and sports a handy heard of. Some of the con-
pan-and-zoom tool for navigating them. ventions are a little odd to
those of you weaned on
CUA (“Copy a line with a
single keystroke”—huh?).
But trust me on this one—
it flies. Now, if they’d just
ship a Macintosh version...
PHPEclipse
phpeclipse.de
License: CPL
There are plenty of dedi-
cated PHP IDEs around,
but none of them offer
Eclipse’s potent combina-
tion of cross-platform com-
patibility and a mature
toolset for so many devel-
opment tasks. PHPEclipse
offers syntax coloring for
HTML, XML, CSS and of
course PHP, with code
completion for the latter.
You also get a debugger
and Eclipse’s highly useful
outline view of your code;
when it comes time for
testing, you can control
for XML and XSLT, XQuery, a built-in Subversion client and your test Web and database servers from within Eclipse,
special-purpose editors for specific XML dialects like XSL:FO and see the results right in the IDE.
for PDF production or other page-formatting tasks, the
Scalable Vector Graphics format (with a live preview) and UI DESIGN
the Web Services Definition Language (WSDL). WYSIWYG Java UI design tools appeared shortly after the
dinosaurs died out, but any prehistoric Java hacker watch-
EPIC (Eclipse Perl Integration) ing her Visual Basic colleague at work was likely to turn a
e-p-i-c.sourceforge.net fetching shade of green. And my programming partner,
License: CPL the Finn, still refuses to do UI in Java. I need to get him
Brethren of Perl, I say unto you, suffer no longer one of these.
under vi or EMACS! Step with me into the light of
Eclipse (guess that’s an oxymoron). At any rate, if WindowBuilder Pro 5.1.0
you’re not digging for Rubies or wrestling Pythons, the http://windowbuilderpro.com
Perl world is probably your oyster, and this little plug-in License: Commercial (pared-down version is free)
offers syntax highlighting and on-the-fly checking, Third-gen tools like WindowBuilder Pro ease the pain
quick-reference documentation, expandable code tem- of layouts, event handlers and alignment that used to be
plates, a debugger, an outline view and a regular-expres- our lot. WindowBuilder Pro sports round-trip engineering
sion evaluator. of both Swing and SWT, drag-and-drop rearrangement of
GridBagLayouts and internationalization support, all in
Visual SlickEdit Plug-in pure Swing or SWT—it doesn’t add a single JAR to your
slickedit.com application!
License: Commercial
Until the big-forehead aliens gift us with thought-driven Jigloo SWT/Swing GUI Builder 3.9.2
computers, programming is going to be primarily about cloudgarden.com/jigloo
editing text. Deal. License: Free for noncommercial use
Of course, one way to do so is to put the biggest, Lock-in is beautiful if you’re a vendor, ugly if you’re
baddest text-editing tools available into your personal a coder. Jigloo not only does round-trip GUI design, it’s
box, and SlickEdit is certainly one of those. I’ve been specifically designed to handle UI code generated by
programming for dollars since 1984, and I have to tell hand or in Netbeans, JBuilder or the Visual Editor plug-
you that this thing supports languages I’ve never even in. It can convert a GUI from Swing to SWT and vice
versa, and offers a toolbar button to preview your process that’s useful out of the box, and is supported by
interface. tools integrated with Eclipse. (See Per Kroll and Kurt Sand’s
article in this magazine, “A Development Library at Your
Visual Editor Fingertips,” Summer 2006.) OpenUP/Basic, as its name
eclipse.org/vep/WebContent/main.php implies, draws on IBM Rational’s RUP, but is aimed at small-
License: EPL er teams and smaller projects. This is definitely a project to
The Eclipse Visual Editor Project is primarily infra- watch.
structure for generic visual editors in Eclipse, but happi-
ly ships with GUI builders for both Swing and SWT. Subclipse
Nothing too novel for the end user, of course; you get subclipse.tigris.org
drag-and-drop component placement, round-tripping License: EPL
(the only state saved is in the Java source code, so you I highly respect the venerable CVS revision-control
can edit text or whang GUI components around) and system, but let’s be honest: Subversion is just better. It’s
property editors for the components. New in 1.2 (the smarter about offline work and network traffic, the revi-
latest version at press time) are support for JFace view- sion numbers are per-commit instead of per-file, and
ers, support for Mac OS X and an XML Metadata tags and branches are cheap and simple to use. (And
Interchange (XMI) view for developers who want to see one use case alone motivated me to switch: Renaming
the internal model. folders. ’Nuff said.) The Subclipse plug-in works very
similarly to the CVS Repository Explorer and can handle
UML, MODELING AND PROCESS SUPPORT repositories in local files or served up via the
Perhaps it’s heretical to proclaim in a tools article that Subversion daemon, WebDAV, HTTP or tunneled
communication trumps code-tweaking. But experience through Secure Shell (svn+ssh). Daily operations like
shows that when projects fail, it’s usually because the update, commit and compare against the latest or base
coders and stakeholders are on different wavelengths. rev are just a right-click away, though I admit I do keep
Concision is key, and UML 2.0 is our best shot yet at a the command-line Subversion client around for the
concise, accurate, widely comprehensible channel funkier stuff.
between modelers, architects and programmers. And even
within the programming shop, tools can significantly light- AccuBridge
en the day-to-day load. www.accurev.com/accubridge-eclipse.html
License: Commercial (free plug-in to SCM product)
Omondo EclipseUML Any SCM system stores file revisions, but AccuRev
www.omondo.com excels at the edge use cases that are problematic for CVS
License: Commercial (single-user free version available) or Subversion: promotion, merging, change packages,
Omondo’s EclipseUML supports diagrams common even demonstration of regulatory compliance. The
(class, activity) and
obscure (robustness,
Figure 2 Log4E right-clicks to painlessly add a logging statement to source.
deployment), and neatly
round-trips from your code,
with too many features to
list here. The company’s
support for XML Metadata
Interchange gives us hope
that modeling tools will
one day be interchange-
able—bravo!
AccuBridge plug-in lets you enjoy stream SCM without written in subsequent regens, so your code in the latter
ever leaving the comfy confines of Eclipse. stays safe.
UTILITIES Figure 4 The Findbugs Eclipse Plug-in analyzes your source code for common problems,
The beauty of the Eclipse integrating with Eclipse’s problem list and source markers.
ecosystem is that it
encourages these little
gems of functionality and
integrates them into your
work.
QuickREx
bastian-bergerhoff.com/
eclipse/features/web/
QuickREx/toc.html
License: EPL
Perl hacks used to sneer
at Java coders, parsing
their way through Strings
with index() and
rindex().Once we got regu-
lar expressions, of course,
they went from snobbery
to sympathy. Sure, regexes
are powerful and succinct.
Then again, so was APL,
and frustrated Java pro-
grammers quickly filled up
the 12-step groups.
Not only does QuickREx allow you to rapidly iterate EHEP (Eclipse Hex Editor Plug-in)
toward a regular-expression solution on test text, it ehep.sourceforge.net
offers tab-key suggested completions, automatically License: GNU Public License
escapes those pesky backslashes for you, and allows Like Garrison Keillor’s “A Prairie Home Companion,”
you to compile your best gems in a personal regular- all of our software is sponsored by “Raw… Bits.” And
expression library. sometimes, ya just gotta grit your teeth and plunge into
’em.
Tiger XSLT Mapper Programmer’s text editors like BRIEF, Epsilon and
www.axizon.com SlickEdit have had this basically forever; frankly, I was
License: Commercial nonplussed that Eclipse lacks this feature out of the box.
E
If you don’t use Extensible Stylesheet Language EHEP offers a hex view r of binary files, lets you view
Transformations (XSLT) to modify XML streams, or think them under a variety of encoding schemes (for example,
that it has just jumped the shark, go on to the next ASCII, ISO8859_5 or MacUkraine), and supports search-
plug-in. (If, worse, you think XSLT so transparent that ing for either hex or text strings.
tools are redundant, the door is that-a-way, fella.) But if
you need this plug-in, you almost certainly need it four TESTING AND CODE ANALYSIS
hundred smackers’ worth. It’s nothing less than a point- Test and prevent now, or fix bugs later. It’s really up to
and-click mapper for transforms. you (and your manager or customer), but “now” is a lot
You drag between the source XML on the left and the cheaper and faster.
target XML on the right, it comes up with the trans-
forms for you, in your choice of “optimized” or Lattix LDM
“human-readable” flavors. The reduction in your Tums lattix.com/products/products.html
budget alone might cover it. License: Commercial
“Cycles of dependency” concern more than just wel-
A Plethora of Plug-Ins fare researchers. Useful code necessarily is complex—
but not inevitably unmanageable!
Two great places to start looking for more plug-ins are www.eclipseplugincentral.com To “help you discover, analyze, define and control
and www.eclipse-plugins.info; both sites organize available plug-ins by category, your architecture,” Lattix built LDM. Peter Varhol’s
ranking them by popularity (number of click-throughs) and user rating. A word of recent article in this magazine, “Leaving the Crystal Ball
caution: Some of the plug-ins rise to the top (especially in the latter rankings) on Behind” (Summer 2006), discussed this, showing that it
pretty small sample sizes. visualizesdependencies in a collapsible matrix, helping
you stick to a layered architecture and minimize
dependency cycles.
Parasoft Jtest Figure 5 oXygen is a complete XML/XSL editing suite, with syntax highlighting, autocom
parasoft.com/jsp plete, DTD and schema generation, and XSLT transforms.
/products.jsp
License: Commercial
Combining merciless
code scrutiny with auto-
mated test-case generation,
I predict that Jtest will start
by humbling you and fin-
ish by empowering you. It
applies literally hundreds
of rules (the list is cus-
tomizable, of course) to a
static analysis of your
source code, then automat-
ically generates test cases
to wring it out, and even
helps track down the hard-
to-spot runtime issues.
Cenqua Clover
cenqua.com/clover
License: Commercial
If you’re using Eclipse
and you’re not doing unit
testing… we need to talk,
because I’m interested in
how you stay in business. Even if you are, and your devel- lyzing a profiling session post hoc or comparing two ses-
opers proudly report creating such-and-so-many unit tests sions. You can slice the loaf several ways: by CPU, by
each week… how on earth do you know if they’re writing thread, or by walking the heap to find allocation hotspots.
the right ones? Clover is a code coverage tool aimed at find-
ing out the answer, and it tells you by statements, branches Findbugs Eclipse Plug-in
and methods. Not only does it give you a coverage snap- findbugs.sourceforge.net
shot, but it reports the trend over time; reports come out in License: LGPL
the plug-in’s UI, in HTML, PDF or XML for ingestion into Findbugs is an open-source code analyzer—think of it as
some other tool. Clover won a Productivity Award in last lint for Java on steroids. But there’s a crucial difference:
year’s Jolt Awards and was well regarded by the judges. Findbugs doesn’t deluge you with an undifferentiated wail
about problems pressing and picayune. Instead, it catego-
Eclipse Profiler rizes them usefully: correctness, bad practice and style, and
eclipsecolorer.sourceforge.net/index_profiler.html applies confidence ratings to its analysis, to emphasize
License: CPL what it’s sure is wrong. The Eclipse plug-in, of course, inte-
A basic profiler plug-in, the Eclipse Profiler can display grates Findbugs intelligence into the IDE, decorating your
running threads and a call tree for a thread. Tooltips pro- source windows with problem markers (and adding lines to
vide timing info; you can jump from a call-tree node to its the Problems view); you can control which of its rules are
definition in the code. You can also see profile information run against your code, and the level of hysteria you’re will-
by class or package, filtered to zero in on the items of ing to tolerate. The rules run the gamut from the obviously
interest. Eclipse Profiler can do remote profiling; for exam- broken (test for equality with floating-point numbers)
ple, the Tomcat heap, but you’ll need to manually set up through the working-but-troublesome (circular dependen-
environment variables or command-line switches on the cies among classes) to JUnit idioms and much more.
program being run to do so.
YOUR NEW HOME
EJ Technologies JProfiler We’ve got the furniture in and the boxes unpacked—pizza-
ej-technologies.com party time! (Actually, after cramming all these tools into my
License: Commercial IDE, my living space feels distinctly overstuffed.) Your list of
If you want to get fancier with your profiling and don’t the best plug-ins may certainly differ from mine—in which
mind paying for it, consider JProfiler. As with Eclipse case, we hope to hear from you—a good discussion will
Profiler, remote connections require a bit of command-line benefit all of us. So why not drop us a line at feedback
tweaking, but JProfiler includes wizards to hook up to @bzmedia.com to get the discussion rolling? Enough with
common application servers, and can do tricks like ana- the tools—back to the code!
SAMPLE APPLICATION
The sample application shown in Figure 1 (see page 28)
is a simple dynamic Web page that a travel agent or
customer might use to find information about a destina-
tion based on zip code. The application uses two .NET
Web services found on the public Web services registry
X Methods, located at www.xmethods.net.
The first Web service is the Weather Forecast service
provided by WebserviceX.NET. A service description is
available at www.webservicex.net/WeatherForecast
.asmx. Later on, we’ll use the GetWeatherByZipCode
service to return a seven-day weather forecast as well
as place name, state code, latitude and longitude. Christopher Judd is president and primary consultant of Judd
The second Web service is a Zip Code Information Solutions LLC. (www.juddsolutions.com). Co-author of “Enterprise
Java Development on a Budget” (Apress, 2003) and “Pro Eclipse JST”
service provided by Ripe Development. A service
(Apress, 2005), he also serves as an industry speaker, open source
description is available at www.ripedev.com/testService evangelist and consultant in Java, J2EE, J2ME, Web services and
.aspx. Here, you’ll use the zipCodeToAreaCode and related technologies.
zipCodeToTimeZone methods to return the area code
and time zones, respec- erated class files. The readme.txt file should contain the
Figure 1 Sample tively. version of Axis used to generate the client code as well
application as any other generating instructions. These additional
WEB SERVICE CLIENT files provide traceability in case the service provider
STRATEGY changes the service interface or Axis version conflicts
Underneath the covers, arise.
WTP 1.5 uses version 1.3
of the popular Apache Axis CREATING A WEB SERVICE CLIENT JAR
Web service framework To make a Web service client JAR, create a regular Java
found at http://ws.apache Project per Web service. Then put the service’s WSDL
.org/axis. To develop a file in the root of the project. The WSDL file can often
Web service client, WTP be downloaded from the service provider’s Web site; if
and Axis generate the you can’t find it there, ask the service provider to e-mail
client-stub Java files based it to you.
on the WSDL, which is an With the WSDL in your project, right-click on it and
XML document that choose Web Services > Generate Client to invoke the
describes the Web service Web Service Client wizard. Alternatively, you can use
interface. The WSDL File > New > Web Services > Web Service Client and
includes exposed service- enter a URL if you don’t want to include the WSDL in
method signatures, com- your project.
plex data-type definitions and the URL in which to Figure 4 shows the first step in the Web Service
invoke the service. Client wizard. In the Service definition field, you can
Figure 2 is a graphical representation of the Weather use the browse button to select a WSDL file in your
Forecast WSDL file using the WTP’s WSDL designer. The workspace, on the file system or a URL. In theory, the
WeatherForecastSoap service exposes the service methods Client type field can be used to select a client type. At
of GetWeatherByZipCode and GetWeatherByPlaceName. this time, WTP includes only a Java Proxy client type.
Drilling into the output of GetWeatherByZipCode reveals
the graphical presentation of the complex data type
returned by GetWeatherByZipCode. AN ALTERNATIVE BEST PRACTICE: TREAT
As shown in Figure 3, GetWeatherByZipCode returns
a complex type of WeatherForecasts that contains attrib- THE WEB SERVICE AS YOU WOULD A
utes of PlaceName, StateCode, Latitude, Longitude and
Details. This is an array of WeatherData types that con-
THIRD-PARTY COMPONENT OR LIBRARY.
tain the day and the URL to a weather map, as well as a
temperature for each of the seven days in the forecast. But in the future, this wizard could be extended to sup-
A common antipattern is to generate the Web service port other client types—even a .NET client type.
client-stub code directly into an application. This is an Below the Client type is an innovative slider bar with
antipattern because the generated classes often don’t a graphical representation for selecting how much WTP
meet company code-quality and package-naming stan- and Axis will generate. For a Web service client, the
dards, and require that at least a handful of files be ver- only level that applies is the first level, Develop client.
sion controlled and managed, although they’ll never be Selecting any other level will produce the same results:
modified. In addition, it reduces reuse, because each the Web service client proxy code. The only configura-
application invoking the service must generate and tion to the right and below that applies to generating
maintain its own copies of the same files. the client is Web service runtime; however, just like the
An alternative best practice would be to treat the Web limited Client types at this time, the Web service run-
service as you would a third-party library. In reality, it’s time is currently limited to Axis.
no different than a service provider giving you a JAR file The second page in the wizard prompts for an output
to invoke its service, except that you generate the JAR folder using a drop-down box containing a list of Java
file yourself. In fact, it’s a good idea to include the origi- source directories. Here, the Java clients will be generat-
nal WSDL file and a readme.txt in the JAR with the gen- ed. The wizard also enables the customization of name-
space to package mapping if desired. If this option is
Figure 2 Representation of the WeatherForecast WSDL selected, another page will be added to the wizard to
enable mapping. By default, the wizard will use the
targetNamespace attribute in the wsdl:definitions ele-
ment to create a Java package for the generated Java
source, but be forewarned—this often produces ugly
package names.
For example, the Zip Code Information service target
namespace, http://ripedev.com/xsd/ZipCodeResults.xsd,
generates the unusual package name of for your Web service client to make debugging and
com.ripedev.xsd.ZipCodeResults_xsd. Note that this using the client easier.
package name breaks common Java package-naming Once the Web service client JAR has been created,
conventions of using lowercase names and no under- you may delete the Eclipse Java project and generated
scores. So, using the namespace to the package-mapping code because you can always regenerate it if necessary
page, you can generate the client stubs and complex from the WSDL located in the JAR.
data types in more conventional package names. The
page contains a table with two columns: The first con- CONFIGURING WTP SERVERS
tains the namespace in a HTTP URL format from the Before you can begin creating a Web application in your
WSDL, and the second holds the Java package name it workspace to use the generated and packaged Web serv-
should map to. Use the add button below the table to ice client, configure a WTP server runtime for your
add the desired mappings. application server. Examples of server runtimes include
When the Weather Forecast Web service wizard Web container–only servers such as Apache Tomcat
wraps up, it generates specific files, as described in found at http://tomcat.apache.org or a full-blown JEE
Table 1 (see page 30). In general, though, the wizard application server such as Apache Geronimo, found at
generates a service interface as well as a dynamic proxy http://geronimo.apache.org.
and stub implementation. It also generates a service To create a server runtime configuration in your
locator interface and implementation, and finally, workspace, go to Window > Preferences > Server >
JavaBeans/data transfer objects (DTO) for each of the Installed Runtime. Use the Add button to start the New
complex types required by the Web service. These class- Server Runtime wizard. On the first page of the wizard,
es will be further discussed in the “Using the Web select your desired application server from the list of
Service Client” section. available server runtime. Or, if you don’t see your pre-
The Web Service Client wizard also adds the follow- ferred application server, use the Don’t see your applica-
ing Axis JARs to your project: axis.jar, commons-discov- tion server listed? link.
ery-0.2.jar, jaxrpc.jar, saaj.jar, wsdl4j-1.5.1.jar and com- The second page of the New Server Runtime wizard
mons-logging-1.0.4.jar. This is important because these is specific to the application server chosen on the previ-
JARs must be packaged with your application to use the ous page. The Apache Tomcat 5.5 configuration is typi-
generated Web service client. cal of most server configurations, requiring a directory
Before packaging your Web service client JAR, make where the application server has been installed, as well
sure you create the aforementioned readme.txt file in as a JRE to run the server.
your project. In addition to the version of Axis, you may
also want to include any namespace to package map- Figure 4 Select WSDL and client type step in Web
pings you might have performed. Service Client wizard.
To create the Web service client JAR file, use the
Eclipse export JAR functionality by right-clicking on
your project and selecting Export > Java > JAR file. In
the JAR Export wizard, uncheck the .classpath and
.project files to prevent them from being included in the
JAR. In addition, select a name and location for the
resulting JAR file. A good naming convention is a
descriptive name followed by ws-client to indicate it’s a
Web service client. End the filename with a version
number to accommodate future changes made to the
Web service. An example filename for the Weather
Forecast service is weatherforecast-ws-client-1.0.jar.
You may want to generate a source and JavaDoc JAR
<%
ed, prompting you to select
a server to run on. The sec- String zipCode = request.getParameter("zipCode");
ond page of the wizard will if (zipCode == null || "".equals(zipCode)) {
zipCode = "90210";
}
list of all the Web, EJB and
EAR projects in your current
workspace if your server is a // Weather
WeatherForecastLocator forcastLocator = new WeatherForecastLocator();
WeatherForecastSoap weatherForecastSoap = forcastLocator.getWeatherForecastSoap();
full JEE server, or only Web
projects if your server is a WeatherForecasts forecasts = weatherForecastSoap.getWeatherByZipCode(zipCode);
Web container. Moving the WeatherData[] details = forecasts.getDetails();
pageContext.setAttribute("forecasts", forecasts);
projects from the Available
projects list to the Con- pageContext.setAttribute("details", details);
figured projects list instructs pageContext.setAttribute("zipCode", zipCode);
// Zip Code
WTP to deploy those appli-
cations on server startup. ZipCodeLocator locator = new ZipCodeLocator();
When you click Finished, ZipCodeSoap zipCodeSoap = locator.getZipCodeSoap();
Object areaCode = (Object)zipCodeSoap.zipCodeToAreaCode(zipCode)[0];
String timeZone = (String)zipCodeSoap.zipCodeToTimeZone(zipCode)[0];
the server is started and the
application is deployed.
Once the server is started, pageContext.setAttribute("areaCode", areaCode);
pageContext.setAttribute("timeZone", timeZone);
%>
an internal Web browser will
open and navigate to your
Web application. A server <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
configuration will also be
added to the Server view. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
which can be used to start <title>Travel Agent Zip Code Search</title>
</head>
<body>
and stop the server. The
Server view can also be used
to restart the server in debug <form action="index.jsp">
Zip code: <input type="text" name="zipCode" value="${zipCode}">
<input type="submit">
mode, causing the debugger
to be invoked when it hits </form>
breakpoints in any Java file
Place Names: ${forecasts.placeName}<br/>
State Code: ${forecasts.stateCode}<br/>
or JSP.
And that’s it! Note that Area Code: ${areaCode}<br/>
WTP doesn’t provide any Time Zone: ${timeZone}<br/>
Latitude: ${forecasts.latitude}<br/>
Longitude: ${forecasts.longitude}<br/>
more functionality for gener-
ating Web service clients Allocation Factor: ${forecasts.allocationFactor}<br/>
than is available using the FIPS Code: ${forecasts.fipsCode}<br/>
<p/>
Apache Axis framework’s
command-line utilities or 7 Day Weather Forcast:<p/>
Apache ANT tasks.
<table>
<c:forEach var="detail" items="${details}">
However, its Apache Axis
integration and wizards <tr>
make generating and pack- <td>${detail.day}</td>
<td><img src="${detail.weatherImage}" /></td>
<td>
aging a Java Web service
client quicker and easier. ${detail.maxTemperatureF}°F/${detail.minTemperatureF}°F<br/>
WTP also provides all ${detail.maxTemperatureC}°C/${detail.minTemperatureC}°C<br/>
</td>
</tr>
the features necessary to
build, deploy and test JEE </c:forEach>
applications that use the </table>
</body>
Web service clients it gen-
erates to consume and </html>
aggregate Web services.
Additionally, among tools, the rule APIs, data options available from the Eclipse Run… menu.
exporting and reporting (if theses feature exist at all) To use the static analysis tool, you must create one or
are diverse. more analysis configurations, which are simply lists of
When developing the static analysis tool for TPTP, rules you want to apply to your source code. You can
the development team had two main have as many configurations as you
goals. First, they wanted to make all Figure 2 Static analysis in the like and can use them from many
forms of static analysis consistent Eclipse Workbench places in the Eclipse user interface,
for the user by offering a common such as the main toolbar and menu,
user interface and configuration the Package Explorer or even within
process. They also wanted to pro- an editor.
vide a consistent and common API Building an analysis configuration
for static analysis tool developers to is easy. From the Run… menu,
extend the framework. select the Analysis… option, and the
Both of these themes are prevalent main configuration dialog will
throughout this article, so let’s get appear. This window closely resem-
started by installing TPTP’s static bles the configuration dialogs for
analysis capabilities into the Eclipse running and debugging applications
Workbench. in Eclipse. Select the Analysis entry
As noted, TPTP’s best feature is, in the left side of the window and
of course, its price—free! You can install it seamlessly create a new configuration using either the Toolbar but-
into the Eclipse IDE or almost any tool derived from the ton or context menu in the dialog.
Eclipse platform. Users will benefit from the rich collec- Once a new configuration has been created, the right
tion of code review rules for Java and C++, while side of the dialog will display a tab folder with two tabs.
developers can adopt the API to easily extend the rule The first, the Scope tab, is used to determine the default
set to enhance TPTP’s code review capabilities or to range of resources over which analysis will occur. Note
enforce internal corporate coding conventions. that the values set in this tab are only a guideline and
can be overridden by the user depending on the location
GETTING STARTED WITH TPTP AND STATIC ANALYSIS where static analysis is invoked in the Eclipse user
Whether you’re a developer or end user, to get started interface. The scope selected in this tab is used only
with TPTP static analysis you must meet a few require- when the user starts static analysis from the main menu
ments. First, you need an Eclipse IDE, and the easiest or toolbar. For now, leave the scope selection at its
way to obtain this is by installing the platform’s full default value: the entire workspace.
Callisto release. Note that you can also build up an The second tab in the static analysis configuration
Eclipse environment from component pieces, but this is dialog, the Rules tab, provides functionality for selecting
more challenging. Regardless of which installation different kinds of analysis and rules. The rule list is pre-
method you choose, you’ll find the tools you need at the sented as a tree where the top-level nodes represent the
Eclipse Web site (see the list of resources at the end of analysis provider (for example, types of analysis) and
this article). You’ll need: the deepest nodes represent rules. All the nodes in
• The base Eclipse 3.2 platform between are rule categories, which are simply groupings
• Java support (JDT) of rules and categories that match a
• C++ support (CDT) if you plan Figure 3 The static analysis particular characteristic. Click the
to analyze C/C++code launch configuration Code Review for Java analysis
• TPTP 4.2 platform or later provider checkbox to select all rules
(you’ll use a TPTP 4.3 build for for Java code.
this article) When the rules and scope are
If you choose to use Callisto, you configured, click the Analyze button
can select and install almost every- to begin the code review process. If
thing you need, including the Java not already visible, an Analysis
development tools; however, if you Results view will appear, displaying
plan to analyze C or C++ code, a historical list of each analysis that
you need to download the TPTP has been performed.
C++ Code Review components Congratulations! Your first auto-
from the Eclipse TPTP Web site—at matic code review is now complete,
this point, these components are still in a technical pre- and you can browse the results that have been reported,
view state. view highlighted problems in a Java editor, or, in many
Once you have an environment set up and Eclipse is cases, perform an automatic quick fix.
started, you’ll notice a couple of new user interface ele- One other aspect of TPTP’s static analysis feature is
ments. TPTP static analysis adds new toolbar items to the ability to run multiple forms of analysis at the same
the Eclipse Workbench, and you’ll also see some new time. This capacity is unique in the static analysis mar-
ketplace. Most commercial vendors would be happy to product has reached a customer. With TPTP’s static
sell you a different tool for Java code review or metrics, analysis tools, you can find this sort of bug in seconds,
or similar tools for C++ or other languages. early in the development cycle when it costs almost
Aside from the multiplied costs of owning several dif- nothing to fix.
ferent tools, usability issues often arise, since each tool TPTP currently supports more than 70 Java code
probably functions differently. With TPTP, you can sim- review rules (43 C++ rules) to detect many common
ply select multiple analysis providers when the configu- programming problems. Of course, not every problem
ration is created, and a single analysis process can test reported is serious. You’ll find code review results divid-
code for both languages. ed into one of three severities (Severe, Warning,
Recommendation), but regardless of severity, the issues
WHAT’S IT GOOD FOR? reported are worthy of investigation and correction. So
Now that you’ve got a list of static analysis results, what why would you not run TPTP’s code review? It’s easy to
should you do with it? Obviously, you’ll want to fix any set up and can quickly examine even large workspaces
problems you find, but first, you need to understand to find problems that developers commonly create. Best
what the code review is reporting. Let’s look at a simple of all, you can download code review for no cost.
code example. Suppose you have a method like the one
shown here: DEVELOPING FOR STATIC ANALYSIS
Eventually, the rule sets available with TPTP will show
public String[] getList( boolean flag ) {
if( flag ) {
their limits. For example, suppose you have an internal
String[] list = new String[3]; API for which enforcement rules are needed. Many of
list[0] = “one”; the other free and open source alternatives to TPTP
list[1] = “two”;
list[2] = “three”;
offer no extensibility or restrictive, confusing APIs. Most
commercial analysis tools provide rich APIs, but these
return list; products can be cost-prohibitive. TPTP offers a better
}
return null;
solution because its code review framework is both cost-
} effective and simple to extend. New rules can be created
from existing templates or can be constructed as Java
When you run Java code review on a class containing classes within an Eclipse plug-in. In either case, TPTP
this example, you’ll get the following analysis result for offers you the opportunity to use the power of the
the method: Eclipse editing and debugging facilities to create new
Avoid returning null instead of empty array rules.
So what’s the problem? Well, assume this method is TPTP’s static analysis framework offers a number of
used as it is in the following fragment: key extension points; however, when writing new rules,
for( int i = 0; i <
only a few of these are needed. The following table lists
getList(flag).length; i++ ) { all of the extension points defined for static analysis use—
// Do stuff note that all extension points are in the org.eclipse.tptp
}
.platform.analysis.core namespace.
Now do you see the problem? What happens if
getList() returns null? The for loop will generate a SETTING UP A PLUG-IN FOR NEW RULES
NullPointerException, and the application will fail. If the AND CATEGORIES
flag that controls the method is invoked by a rarely used The confines of this article prevent a detailed descrip-
feature in your product, a basic JUnit test may not find tion of rule plug-in set-up; however, you can find a
this problem during development. detailed tutorial on the TPTP Web site (see the
While this example is trivial, it highlights a common resources at the end of this article). To define this
coding practice that often goes unchecked: The subtle process in its simplest form, take the following steps:
problems that could be found easily by a basic automat- 1. Create a new plug-in project in your Eclipse work-
ed code review typically evade detection until your space.
2. Add the following plug-in dependencies to the
Figure 4 The static analysis results project:
a. org.eclipse.core.runtime
b. org.eclipse.jdt.core
c. org.eclipse.tptp.platform.analysis.core
d. org.eclipse.tptp.platform.analysis.codereview
.java
3. Define your new categories and rules.
Creating New Categories. If you have the source
code for TPTP’s Java code review rules installed, open
the plugin.xml file and you’ll see the analysisCategory
extensions that define all of the categories used in TPTP
(See Listing 1). Table 1 Extension points defined for static analysis use (note that all are in the
Let’s take a closer look. org.eclipse.tptp.platform.analysis.core namespace)
First, notice that the class
field of each category Extension Point Description
analysisProvider Provisions a new type of analysis into the TPTP static analysis
points to the
analysisRule Defines a new analysis rule. Rules are the workhorses of static
While it’s possible to cre-
ating results when those criteria are met (or not met).
class, the default behavior
should be the preferred
analysisRuleQuickFix Defines a process used to correct the results of rules. Quick fixes
way to supply this func-
result.
also declare an id field
that should contain a
rules.
categories usually pro-
duces undesirable effects
analysisRuleSet Rule sets are used to define a quick selection set of rules. For
since the framework will
example, a rule set could easily be created that selects all rules
be unable to distinguish
2001).
One final subtlety of the
category extensions is the
of an analysis. Viewers can take any form that fits the presenta-
category fields. These
items when the end user chooses to export data from an analysis
provider field is used, the
provider.
category is defined as a
top-level category, while
defining the category field
will cause the new catego-
ry to be contained within another category. In either the task for you. If you always extend the
case, the value of these fields is the unique identifier of AbstractAnalysisRule class, your job is half finished.
the owing provider or category, respectively. Note that This abstract class provides all of the common function-
your new category can be placed within an existing cat- ality needed by every rule, and all you really need to do
egory defined by TPTP’s Java code review simply by is implement your own worker method to set the rule
using the correct identifier (you can find these identi- criteria.
fiers in the plugin.xml of the Java rules plug-in). For the example, here you’ll create a rule that
Creating New Rules. Defining your own rules is a generates results anytime the Thread.stop() method is
two-step process. First, create a rule class. Then, define an used. In basic terms, you want to parse all the source
extension to map the rule class into the TPTP static analy- code and look for classes that extend java.lang.Thread
sis space. and call stop(). Listing 2 shows an implementation for
While a detailed description of rule creation is this rule.
beyond the scope of this article, a high-level view can Notice that in Listing 2, the class extends the recom-
be offered to help convey the concepts you will mended AbstractAnalysisRule class, which requires it to
encounter. For a more detailed discussion of Java code implement an analyze() method. The first step this rule
review rules, refer to the tutorials on the TPTP Web site. (and all Java code review rules) takes is to acquire
When you’re creating rule classes, the TPTP static information about the Java file being analyzed. You do
analysis framework goes a long way toward simplifying this by obtaining the CodeReviewResource instance from
ment your rule. First, you can use any of the JDT APIs Notice that the category identifier for your rule speci-
implemented in the Eclipse platform, or you can use the fies one that already exists in TPTP. This will plug the
simplified API supplied by the TPTP analysis frame- rule into the existing TPTP Threads category. When you
work—the latter is streamlined for handling code review start a runtime workbench containing your rule plug-in,
queries and generating results, so the AvoidThreadStop the analysis launch configuration dialog should contain
example will take this approach. your new rule.
After determining the resource being analyzed, the
code next acquires a list of method invocations from the IT’S ONLY THE BEGINNING
resource, then calls the ASTHelper.satisfy() method. In a short article like this one, it’s difficult to provide
This method filters out data that doesn’t fit the filter cri- comprehensive details of a complex subject like static
teria. In our example, the code uses the MIFILTER array analysis; however, you’ve gone through some of the
to discard any method invocations for methods not basic concepts of the TPTP framework. You should now
defined in the java.lang.Thread class and to subsequent- have at least a cursory understanding of how to use the
ly discard any methods that are not calls to stop(). What static analysis component from an end-user perspective,
remains is a list of calls to Thread.stop(). and if you’re a developer, you should have a footing in
Since this rule is trivial, our work is finished. In this place to help create your own rules.
case, any method invocations remaining in the list are If you’re interested in a complete step-by-step proce-
considered violations of the rule, so the dure for creating your own rules, refer to the TPTP Web
generateResultsForASTNodes() method is called to create site, where you’ll find several articles discussing rules as
results for each of them. well as more advanced topics not covered here.
Finally, the Java class being reviewed could be one Keep in mind that TPTP is an open source project to
that extends java.lang.Thread, so you need to take one help the entire community, so if you develop some inter-
more step to check any super method invocations for esting rules or integrate a new type of static analysis
the same Thread.stop() criteria and create results for provider, by all means submit them to the project so
those, as well. that everyone can benefit.
With the rule class created, only one easy step
remains. The rule needs to be integrated into the static RESOURCES
n Eclipse www.eclipse.org
analysis code-review structure so it is available and n TPTP www.eclipse.org/tptp
selectable by the user. To do this, create a simple exten- n TPTP Static Analysis Tutorial Part 1 – A Consistent Analysis Interface, Steve Gütz and Orlando Marquez, 2006,
point=”org.eclipse.tptp.platform.analysis.core.analysisRule”> www.eclipse.org/tptp/home/documents/process/development/static_analysis/TPTP_static_analysis_tutorial_part2
<analysisRule .html
category=”codereview.java.category.threads” n TPTP Static Analysis Tutorial Part 3 – Integrating Your Own Analysis, Steve Gütz, 2006,
class=”com.mycompany.rules.AvoidThreadStop” www.eclipse.org/tptp/home/documents/process/development/static_analysis/TPTP_static_analysis_tutorial_part3
id=”myrules.java.threads.stop” .html
label=”Avoid using Thread.stop()” n “Java and Static Analysis,” Amit Chaturvedi, Dr. Dobb’s Journal, June 2005, www.ddj.com/184406143
Listings
n LISTING 1
JAVA CODE REVIEW CATEGORIES
<extension point=”org.eclipse.tptp.platform.analysis.core.analysisCategory”>
<analysisCategory
class=”org.eclipse.tptp.platform.analysis.core.category.DefaultAnalysisCategory”
id=”codereview.java.j2sebestpractices”
label=”%label.category.j2sebestpractices”
provider=”codereview.java.analysisProvider”
help=”org.eclipse.tptp.platform.analysis.codereview.java.rules.j2sebestpractices”/>
<analysisCategory
class=”org.eclipse.tptp.platform.analysis.core.category.DefaultAnalysisCategory”
id=”codereview.java.category.awt”
label=”%label.category.j2sebestpractices.awt”
category=”codereview.java.j2sebestpractices”
help=”org.eclipse.tptp.platform.analysis.codereview.java.rules.awt”/>
.
.
.
</extension>
Listings
n LISTING 2
AVOIDTHREADSTOP CLASSES
public class AvoidThreadStop
extends AbstractAnalysisRule
{
private static final IRuleFilter[] MIFILTER = {
new DeclaringClassRuleFilter( “java.lang.Thread”, true ),
new MethodNameRuleFilter( “stop”, true )
};
/**
* Analyze this rule
*
* @param history A reference to the history record for this analysis
*/
public void analyze( AnalysisHistory history) {
// Extract the resource being analyzed
CodeReviewResource resource = (CodeReviewResource)getProvider()
.getProperty( history.getHistoryId(),
CodeReviewProvider.RESOURCE_PROPERTY );
Company Buster—Or
The Present and Future of Eclipse | by Bernard Golden
Company Booster?
If you talk to some people, you’ll hear that Eclipse has tool-developer side of the equation.
ruined the commercial development tools market. By this While it’s tempting to paint Eclipse
as a company buster, I believe it’s
way of thinking, a free product has ruined the business prospects of
exactly the opposite—it’s a company
development tools companies. Many people recount this nostalgical- booster.
ly, pining for the days of dozens of tools companies; to their minds,
Eclipse is a scourge in the marketplace. ECLIPSE OFFERS THE OOOMPH
Just as a booster rocket supplies ini-
On the other hand, a vastly more experience is different. I was once tial thrust for a rocket-borne pay-
positive perspective is possible. By consulting to a tools company that load, Eclipse provides a tremendous
this reading, the existing tools com- provided a high-end, extremely amount of oomph for tools. Instead
panies were all exhausted, unprof- capable product. Their tool made of having to create an entire frame-
itable hulks that lived in daily fear programmers more productive, no work within which to deliver a spe-
of the monster from Redmond. The question about it—but they weren’t cial functionality, a tools company
release of the Eclipse framework getting the sales they wanted. So I can rely on Eclipse to take care of a
revivified the existing non-Microsoft interviewed a few end users to lot of the heavy lifting—or perhaps
players, allowing them to emerge in understand the tool decision-making heavy lift-off would be the right
a new form with higher long-term process, and, boy, were my eyes metaphor.
potential. opened about the Power of Free. With the many projects in the
As one might expect, my view- One woman I spoke with about Eclipse Foundation providing the
point leans toward the latter inter- Java development efforts told me technological underpinnings, for-
pretation. The tools business has that the company didn’t have the profit tools companies can operate
always been a difficult one. budget to purchase fancy tools. I much more leanly and in tighter
Microsoft has done an excellent job therefore asked her what they did focus on their special area of expert-
in creating a tools/applications/serv- use to do their Java development. ise. Rather than having to fund,
er ecosystem for which their solu- I expected to hear something like design, build and maintain a bunch
tions are always the best-tuned for emacs or even vi. Her response: of functionality that does nothing to
the environment. Notepad. (I guess I’d have to put differentiate their “secret sauce,”
With a significant portion of the that organization into the Microsoft tools providers can deliver a highly
overall market residing on camp—although one wonders about concentrated functionality payload
Microsoft’s plate, that left smaller the quality of code her organization that serves them in the market.
portions for the rest of the tools turned out.) Far from ruining the commercial
industry. Given the widespread So, for organizations like that tools market, Eclipse has strength-
availability of free tools, selling one, Eclipse presents a real opportu- ened it. If you take a look at the
development tools is a rough job. nity to move to state-of-the-art tools plug-ins on the Eclipse site, the vari-
While it’s tempting to think that within a constrained budget. They ety and specialized capability avail-
people will prefer commercial prod- can achieve higher productivity, able are simply amazing. It’s clear
ucts to “inferior” free ones, my faster time-to-market, better ability that Eclipse is accomplishing its
Bernard Golden is Chief Executive Officer
to recruit and retain skilled employ- job—providing a framework to
of Navica (www.navicasoft.com), a Silicon ees, and a more satisfied workforce. enable differentiated development
Valley consulting firm offering open source (Nobody could be happy program- functionality to find its way into the
strategy, implementation and training ming Java in Notepad!) hands of developers throughout the
services. Just as important, however, is the world.