A P P E N D I X A |
How the IDE Supports Deployment of J2EE Modules and Applications |
The preceding chapter briefly defined deployment for J2EE modules and applications. This chapter looks at the mechanism that makes it possible to deploy and execute a J2EE module or application from within the Sun ONE Studio 4 IDE.
The IDE's deployment facility supports the iterative development of enterprise applications. Assuming that an appropriate web server or application server has been installed, you (or a team) can develop and assemble a web module or a J2EE application, deploy it, execute it for testing purposes, modify the source code or component properties, redeploy and retest, and so on. Notice that reassembly is not required unless testing reveals a problem with the assembly.
For production deployment, the Sun ONE Studio 4 deployment facility is not an alternative to server-supplied deployment tools. When you reach this stage of development, export your application as a WAR or EAR file and deploy it with the server-supplied tools.
This chapter explores the interaction between the IDE and the web server or application server in detail. It explains what happens when you use the IDE's Deploy command. If you understand how the deployment facility works you can use it effectively. The actual procedures for using the deployment facility are in Chapter 9.
Deployment means delivering the deployable form of a module or application to a J2EE runtime environment. The runtime environment takes the form or a web or application server. To deploy to a specific server the IDE must be able to issue valid commands to the server's deployment tool. In addition to this, most servers require server-specific properties in addition to the J2EE standard deployment descriptor, and the IDE must be able to supply these properties.
To enable the IDE to deploy to a variety of web and application servers, the concept of a server plug-in has been developed. A plugin is an IDE module that manages the interaction between the IDE and a specific server product. When you deploy an application, you choose the server to which it will be deployed. The IDE uses the appropriate plugin to process your Deploy command. This enables it to generate the appropriate commands for the server's deployment tool and include the appropriate non-standard property files in the files it passes to the server. This is illustrated in FIGURE A-1.
For the application developer who is deploying an application, the plugins provide:
1. When installing the IDE, install the web server or application server you will be using and the appropriate plugin. (Some servers and some plugins are installed by default. For a complete explanation, see the Sun ONE Studio 4, Enterprise Edition for Java Getting Started Guide.)
2. Develop J2EE components for the application's business logic.
3. Assemble the components into modules and then applications. Use property sheets to supply J2EE standard deployment descriptor elements and non-standard elements required by the server.
4. After the application is assembled, identify the target server instance.
5. Use the IDE's Deploy command to begin the deployment process.
6. The IDE identifies all of the files needed to create a WAR or EAR file for the application.
7. The IDE identifies the server product to which the application is being deployed.
8. The plugin validates the files for the WAR or EAR file.
9. The IDE generates the WAR or EAR file for the application. This includes a J2EE deployment descriptor, separate files with server-specific tags, and any stub or skeleton classes required for remote method invocations.
10. The plugin passes the WAR or EAR file to the server.
11. The server takes over, reads the deployment descriptors and the server-specific deployment files, and deploys the WAR or EAR file according to its own standards.
After this the developer can start a web browser and open an HTTP connection to the deployed application running in the server. If the developer chose to execute a web application, the IDE will automatically start a web browser and open the application's welcome page.
Web modules and J2EE applications are the only items that can actually be deployed to servers and executed. However, you may want to test smaller units of business logic that you are developing. The Sun ONE Studio 4 IDE makes it possible to deploy and execute smaller units of business logic by creating module and applications that contain these components: It can also generate test clients for some types of components. For more information on these features, see Building Web Components and Building Enterprise JavaBeans Components.
Copyright © 2002, Sun Microsystems, Inc. All rights reserved.