ProjectsThis chapter introduces the project types and some of the main terms used in Application Developer... J2EE architectureThe Java 2 Platform, Enterprise Edition J2EE is a robust su
Trang 1Figure 3-21 CVS Repository Exploring perspective
Files that exist in the repositories can be viewed by double-clicking them in a branch or version This opens the version of the file specified in the file editor, located at the top right of the workspace
CVS Resource History view—Displays more detailed history of each file
This view provides a list of all the revisions of a resource in the repository From this view you can compare two revisions, replace (get sticky), or revert the corresponding workspace file to the revision (get contents), or open an editor on a revision
More details about using the CVS Repository Exploring perspective can be found
in Chapter 22, “Using Concurrent Versions System” on page 701
Trang 2Install/Update perspective
The Install/Update perspective (Figure 3-22) allows you to check to see whether there are updates for a product's existing features Working with this perspective usually requires access to the Internet
Figure 3-22 Install/Update perspective
The Install/Update perspective contains these views:
Install Configuration view—This view allows you to manage your
workspace configuration The Current Configuration folder shows which local installation locations are part of the workspace configuration, and which features are installed in those locations The Configuration History folder shows a history of changes made to your workspace configuration The Saved Configurations folder show any configurations that were preserved
Feature Updates view—This view allows you to locate and install new
features and feature updates The view contains three standard folders The Sites to Visit folder contains update sites pre-configured by the product you are using The Available Updates is a built-in search results folder used for searching update sites The My Computer folder is a file explorer that can be used to navigate to updates located in the file system
Preview view—This view displays detailed information about the current
active selection Its content changes according to your selection
Trang 3For information about how to work with the Update Manager consult Appendix A,
“Product installation” on page 785
Plug-in Development perspective
You can develop your own Application Developer tools by using the Plug-in Development Environment (PDE) The PDE provides a set of platform extension contributions (views, editors, perspectives, etc.) that collectively streamline the process of developing plug-ins inside the Workbench
In this book we do not describe how to develop plug-ins for Application Developer Figure 3-23 shows the Plug-in Development perspective
Figure 3-23 Plug-in Development perspective
To learn more about plug-in development, refer to The Java Developer’s Guide
to Eclipse (see “Other publications” on page 818)
Trang 4In this chapter we described the perspectives and views that you use with Application Developer to perform your tasks
Trang 6Chapter 4. Projects
This chapter introduces the project types and some of the main terms used in Application Developer
J2EE architecture:
– EAR files – WAR files – JAR files
Projects and folders
Project types:
– Simple project – Java project – Web project – Enterprise Application project – EJB project
– Application Client project – Server project
Creating a new project
4
Trang 7J2EE architecture
The Java 2 Platform, Enterprise Edition (J2EE) is a robust suite of middle-ware application services for server side application development J2EE is an extension of the Java 2 Platform, Standard Edition (J2SE)
J2EE makes all Java enterprise APIs and functionality available and accessible
in a well integrated fashion This helps in simplifying complex problems in the development, deployment, and management of multi-tier, server-centric enterprise solutions
Figure 4-1 shows an overall view comprising the different J2EE technologies
Figure 4-1 J2EE architecture diagram
Web containers and EJB containers
Containers are basically run-time environments that provide components with specific services For example, Web containers provide run-time support to clients by processing requests through invoking JSPs and servlets and returning results from the components to the client Similarly, EJB containers provide
J2SE
Applet Container
Applet
Database
Application Client Container
Application Client
J2SE
WebSphere
Web Container
J2SE
Java Mail JAF
EJB Container EJB
J2SE
Java Mail JAF
HTTP SSL HTTP SSL
Trang 8automated support for transaction and state management of EJB components,
as well as look up and security services
For additional information regarding the J2EE architecture and its technologies, consult the J2EE specification on Sun’s Web Site:
http://java.sun.com/j2ee
EAR files
Enterprise archive (EAR) files represent a J2EE application that can be deployed
in a WebSphere application server EAR files are standard Java archive files and have the file extension ear EAR files also contain a deployment descriptor (an XML file) that describes the contents of the application and contains instructions for the entire application, such as security settings to be used in the run-time environment
An EAR file has the following modules (zero, one, or more of each type):
Web modules
EJB modules
Application client modules
Utility JAR files required by other modules
WAR files
Web archive (WAR) files contain all the components of a Web application These components are usually:
HTML files
CSS files
JSP files
Servlets
Compiled Java files
Images
JAR files
The Java archive (JAR) file format allows you to store multiple files into a single archive file Typically, a JAR file contains the class files and additional resources associated with applets and applications
EJB modules and utility modules are packaged as JAR files
Trang 9Projects and folders
Application Developer organizes all resources into projects
A project in Application Developer is the top-level construct for organizing the different resources It contains files as well as folders In the Workbench you can create different kinds of projects, and they will have a different structure
Unless not specified differently, projects are created in the workspace directory
of Application Developer’s installation folder Also, the metadata is stored in the workspace directory The metadata directory of a workspace directory stores important information about the workspace structure, such as a project’s reference or a resource’s properties
A project is either open or closed When a project is closed, it cannot be changed
in the Workbench and it cannot be referenced from other projects The resources
of a closed project do not appear in the Workbench, but they do reside in the local file system
Application Developer’s project types
Application Developer provides different project types for different tasks
Simple project
A Simple project in Application Developer does not have any default folders and does not have an associated builder The files stored inside the project are not compiled when you select to rebuild all projects in the Workbench
We will use a simple project in Chapter 6, “Developing database applications” on page 139
Java project
A Java project contains Java packages and Java code as java files and class
files Java projects have an associated Java builder that incrementally compiles Java source files as they are changed Java projects can be exported as JAR files or into a directory structure
Tip: Closed projects require less memory Because they are not examined
during builds, closing a project can improve the build time
Trang 10Java projects are used for stand-alone applications or to build utility JAR files for
an enterprise application A detailed example of how to create a new Java project is provided in “Creating and working with a Java project” on page 94
Enterprise Application project
Enterprise Application projects contain references to the resources needed for enterprise applications and can contain a combination of Web modules, EJB modules, application client modules, and JAR files
An Enterprise Application project is deployed in the form of an EAR file In Application Developer, the modules in an Enterprise Application project are mapped to other J2EE projects The mapping information is stored in metadata files within the Enterprise Application project The metadata files are used for exporting the project to an EAR file, and for running the project on the server Application Developer mirrors the layout of a J2EE enterprise application modules with matching project types For each type of module, a project type tailored for that purpose is provided (Figure 4-2)
Figure 4-2 Application Developer projects for J2EE
We will create an Enterprise Application project together with a Web project in Chapter 7, “Developing Web applications” on page 179
EAR Project
EJB Project
Web Project
Client Project
EJB
Web DD
Application DD
HTML, GIF, etc.
Enterprise Bean
Client Class Servlet JSP
EJB Module JAR file
Web Module WAR file
Client Module JAR file
DD = Deployment Descriptor
J2EE Application EAR file
web.xml application.xml
ejb-jar.xml
Application Developer