Java Reference
In-Depth Information
Another feature is the
Select Target
pop-up. When the caret is in
EJB
-related Java
code (
EJB
class,
Component
interface,
Home
interface, or deployment descriptor),
pressing
Alt+F1
calls the
Select Target
pop-up with the
J2EE
View option.
Finally, selecting
J2EE
View opens (if it was closed) the
J2EE
tab of the
Project
view and navigates to the chosen class, interface, or deployment descriptor
within it.
All editing actions are two-way: Changes in Java code and deployment
descriptors are instantly displayed in the
J2EE
tab, and vice versa.
Refactoring EJBs
According to Martin Fowler in
Refactoring: Improving the Design of Existing Code
(Addison-Wesley, 2000), refactoring is “the process of changing a software system
in such a way that it doesn't alter the external behavior of the code, yet improves
its internal structure. It's a disciplined way to clean up code that minimizes the
chances of including bugs.” If you have some code and need to improve it, refac-
torings can be very useful. In this case,
EJB
s are complex structures, and changing
the code manually is often too cumbersome.
Automated refactorings for
EJB
s in
IDEA
are as follows:
When you refactor a method in an interface, the implementing method in
an
EJB
class is also refactored, and vice versa. For instance, if you wish to
rename a method called
createXXX()
in a
Home
interface,
IDEA
suggests
renaming the method to
ejbCreateXXX()
in an
EJB
class that implements
the
createXXX()
method.
■
When a method is refactored, corresponding links in the deployment
descriptor are updated.
■
When you rename a
CMP
or
CMR
field accessor,
IDEA
suggests renaming
the entire field with all its accessors and deployment descriptor refer-
ences instead.
■
You can easily rename or change all class names for particular
EJB
(avail-
able from the visual property editor of
EJB
; see figure 11.12).
■
11.2.2
Working with J2EE application modules
The
J2EE
application module is an umbrella for a complete
J2EE
server applica-
tion and thus serves as a container for
J2EE
components, like web or
EJB
modules.
It groups them into a single module and lets you deploy them together. Such an
application can be deployed to any
J2EE
-compliant server in the form of a
J2EE