Você está na página 1de 69

Migration Guide (Migrating from IBM WebSphere Studio Application Developer [WSAD] 5.1.

2 to Sun Java Studio Enterprise 7)

Version 1.0 Last Update: 03/14/05

By Content Management, Web Services, and Development Tools Horizontal Technologies Market Development Engineering

Sun Microsystems, Inc.

Page 1 of 69

Table of Contents
1 Overview..................................................................................................... 3 1.1 Introduction.......................................................................................... 3 1.2 Scope of the Document........................................................................... 3 1.3 Document Organization.......................................................................... 3 2 IDEs Overview............................................................................................. 5 2.1 Sun Java Studio Enterprise 7................................................................... 5 2.2 IBM WebSphere Studio Application Developer 5.1.2.................................... 6 2.3 Differences between Sun JSE 7 and IBM WSAD 5.1.2.................................. 7 3 Migration Steps............................................................................................ 9 3.1 Steps for Migrating a Java Project............................................................ 9 3.2 Steps for Migrating a Web Application..................................................... 10 3.3 Steps for Migrating EJB Projects............................................................. 12 3.3.1 Steps for Migrating a Session EJB Project.......................................... 12 3.3.2 Steps for Migrating a CMP EJB Project............................................... 12 3.3.3 Steps for Migrating a MDB EJB Project.............................................. 13 3.4 Steps for Migrating a Web Services Project.............................................. 15 3.5 Steps for Migrating Team Support.......................................................... 16 4 Migration Examples..................................................................................... 18 4.1 Example for Migrating a Java Project....................................................... 18 4.2 Example for Migrating a Web Application................................................. 24 4.3 Examples for Migrating EJB Projects........................................................ 32 4.3.1 Example for Migrating a Session EJB Project...................................... 32 4.3.2 Example for Migrating a CMP EJB Project........................................... 38 4.3.3 Example for Migrating a MDB EJB Project.......................................... 48 4.4 Example for Migrating a Web Services Project.......................................... 55 4.5 Example for Migrating Team Support...................................................... 64 5 Appendix................................................................................................... 68

Page 2 of 69

1 Overview
1.1 Introduction
This white paper is aimed at providing guidelines for migrating projects from IBM WebSphere Studio Application Developer(WSAD) 5.1.2 IDE to Sun Java Studio Enterprise (JSE) 7 IDE. Guidelines have been provided for the following type of projects:

Migration of Java technology-based, Web, EJB beans (EJB), and Web Service applications from WSAD. Migration of Team Support from WSAD.

Suitable examples have been provided where necessary for better comprehension of the concepts discussed.

1.2 Scope of the Document

Since the aim of this paper is to describe the migration steps between the Integrated Development Environments (IDEs), it should not be used as a tutorial for IBM WSAD 5.1.2 or Sun JSE 7 IDEs. It is assumed that the user is familiar with basic tenets of projects in the IDEs. Migration of multi-layered J2EE applications is beyond the scope of this document. Concepts related to deployment of EJB/Web applications and configuration of associated resources on the Web or Application servers is beyond the scope of this document. Migration of applications across application servers has also not been covered in this document. For information on migration across application servers, please refer to the Appendix.

1.3 Document Organization


Section # 2 2.1 2.2 Section Name IDEs Overview Sun Java Studio Enterprise 7 IBM WebSphere Studio Application Developer 5.1.2 Purpose Provides overview of the IDEs Introduces Sun JSE 7 Introduces IBM WSAD 5.1.2

Page 3 of 69

Section # 2.3

Section Name Differences between Sun JSE 7 and IBM WSAD 5.1.2 Migration Steps

Purpose Explores the differences between Sun JSE 7 and IBM WSAD 5.1.2

3 4 5

Provides steps for migration from IBM WSAD 5.1.2 to Sun JSE 7

Migration Examples Provides examples for migration from IBM WSAD 5.1.2 to Sun JSE 7 Appendix Provides additional information related to the concepts discussed

Page 4 of 69

2 IDEs Overview
2.1 Sun Java Studio Enterprise 7
Sun Java Studio Enterprise (JSE) 7 is a platform for enterprise developers that provides integrated development environment for developing enterprise scale applications and services targeted for deployment on the Sun Java Enterprise System. Sun JSE 7 has been built on top of the NetBeans 3.6 platform. Highlights of Sun JSE 7 2004Q4 include:

Provides J2EE-platform based enterprise applications for creating, extending, and testing EJB components such as Message-Driven, Session, BMP Entity, and CMP Entity beans. Provides a platform for development of Web services and applications based on the Web Application Framework. Provides UML modeling support with live marker less round trip engineering. This includes the capability for synchronization of class model to code and vice versa. Provides the capability for enterprise application profiling along with support for method level code profiling, memory profiling and EJB container profiling. Also supports load testing of applications for multiple users. Provides refactoring capabilities for aiding in Java-based development. Provides collaborative development capabilities to improve team development capabilities, especially in a distributed team development model. Provides integrated support for Sun Java Enterprise System components such as Sun Java System Application server, Sun Java System Web server, Sun Java System Portal server, Sun Java System Directory server, Sun Java System Access Manager and Sun Java System Message Queue. Provides a platform for developing Portal applications. Provides support for developing desktop applications based on Java Swing and AWT. Provides support for XML files, JUnit testing framework, and Ant build scripts.

Sun JSE 7 provides templates for creating projects,modules, and files. It also provides different views for navigation. The main views include Filesystems, Projects and Runtime. It also provides tabs such as Web Application Framework, Versioning, Modeling, Properties, Collaboration, Enterprise Application Profiler, GUI Editing and Debugging. Sun JSE 7 provides the Filesystems tab for mounting or unmounting directories (the directory structure appears as on disk). The IDE also allows the developers to mount or unmount archive files and version control systems. The Projects tab displays the files that are associated with the project. The Runtime tab displays the runtime components such as integrated servers, databases, processes, UDDI Registry, HTTP server and VCS commands. The Web Application Framework displays the logical structure of the application built Page 5 of 69

using Web Application Framework (JATO). The Versioning tab displays the modules for the configured version control system. The Modeling tab displays the UML modeling aids. The Properties tab displays the properties for any selected item which is contextual. The Collaboration tab displays the developer collaboration utilities. The Enterprise Application Profiler window displays the profiling features for any Web, J2EE or Enterprise applications. The Debugging tab displays the debugger details such as Threads, Call Stack, Watches, Breakpoints etc. The illustration shown below depicts some of the views in Sun JSE 7.

Illustration 1. Views in Sun JSE 7

2.2 IBM WebSphere Studio Application Developer 5.1.2


IBM WebSphere Studio Application Developer (WSAD) 5.1.2 is built on top of Eclipse 2.1 platform. It provides an integrated development environment for visually designing, constructing, testing and deploying Web services, portals and multi-tier Java/J2EE applications. It also provides the UML visual editor with standard UML diagrams, graphical performance profiling and trace tools, support for collaboration and sharing of assets Page 6 of 69

across the team, JSF components and Struts tools for constructing Web-based applications. In addition, it also provides support for connecting Web applications to relational databases and Web services. IBM WSAD 5.1.2 provides templates for developing the following type of projects: Eclipse Modeling Framework (EMF), Enterprise Generation Language (EGL), EJB, J2EE, Java, Plug-in Development, Server, Web, and examples. It also provides the following perspectives to work with these projects: Component Test, CVS Repository Exploring, Data, Debug, EGL, EGL Web, Install/Update, J2EE, Java, Java Browsing, Java Type Hierarchy, Plug-in Development, Profile and Logging, Resource, Server, Web, XML and XSL Debug. The illustration below depicts some of the views and perspectives in WSAD 5.1.2.

Illustration 2. Perspectives and Views in IBM WSAD

2.3 Differences between Sun JSE 7 and IBM WSAD 5.1.2


This section explains the basic differences between Sun JSE 7 and IBM WebSphere Studio Application Developer 5.1.2. Sun JSE 7 and IBM WSAD differ in terms of user Page 7 of 69

interface, navigational aids and views. Sun JSE 7 provides Filesystems and Project tabs for navigating with the Java projects. IBM WSAD provides various perspectives with associated views. Sun JSE 7 and IBM WSAD 5.1.2 both provide templates for creating Java, Web, EJB and Web Services applications. Sun JSE 7 provides support for version control systems such as CVS, PVCS, ClearCase and Visual SourceSafe whereas IBM WSAD 5.1.2 provides support for CVS and ClearCase.

Page 8 of 69

3 Migration Steps
3.1 Steps for Migrating a Java Project
This section explains the steps for migrating a standard Java project (including classpath settings etc.) from IBM WSAD 5.1.2 to Sun JSE 7. The project comprises of a Java class file containing the main method. This class also refers to a utility Java library (.jar file). Structure of the application is described below: Directory Project Directory Source Classes Description Contains the Source and the Classes directories. Contains the Java source files. When compiled, classes for these will be generated in the Classes directory. Contains compiled Java classes.

The steps required to migrate the JAVA project to Sun JSE 7 are:

Create a new project. Add the Java source files by mounting the Source directory via Filesystems -> Mount -> Local Directory. Specify a target directory for class files.

Mount the Classes directory as a filesystem to serve as the output for the compiler. Specify this as a target directory (using Tools -> Options -> Building -> Compiler Types) for the class files.

Mount the JAR files used by the project via Filesystems -> Mount -> Archive Files.
Note: Information for the additional JAR files used by a project in IBM WSAD 5.1.2 can also be found from the entries in the .classpath file. The classpathentry tag with path attribute shows the JAR files that were included in the project.

Add the mounted directories and files to the project.


On the Project window, right-click on the root project node and select Add Existing... from the contextual menu. On the Select Objects dialog, select the directories and files to be added to the project. Click on OK to add them to the project.

The migrated application can be verified by compiling and executing the application in Sun JSE 7. Migration of a Java project from IBM WSAD 5.1.2 to Sun JSE 7 has been described with an example in section 4.1.

Page 9 of 69

3.2 Steps for Migrating a Web Application


This section explains the steps for migrating a Web application (JSPs, Servlets) from IBM WebSphere Studio Application Developer 5.1.2 to Sun JSE 7. The Web application in question comprises of JSPs, Servlets, Custom Tags, Applets, Static HTML pages and images. This Web application also refers to a utility Java library (.jar file). It is assumed that the Web project in WSAD 5.1.2 confirms to a typical Web application structure (based on the Sun Microsystems Java Servlet 2.3 Specification) as shown below: Directory Project Directory Description Contains the WEB-INF directory and all files that must be accessible to the client request, such as JSPs, HTML pages, cascading style sheets, images, and JavaScript files. You can place these files directly in the Web application root directory or in subdirectories that do not use the reserved name WEB-INF. (Required) Contains the classes and lib directories, the standard Web application deployment descriptor (web.xml), and possibly a server specific deployment descriptor (<server>-web.xml). This directory is not part of the public document tree of the application; that is, you cannot directly serve any file contained in this directory, or any of its subdirectories, to a client. Contains servlets, other Java classes, and associated resources that are not packaged in Java ARchive (JAR) files.

WEB-INF

WEBINF/classes

WEB-INF/lib Contains associated resources that are packaged in JAR files. The steps required to migrate a Web application are:

Create a new project in Sun JSE 7. Add a new Web Module to the project (This is to mount the WebContent directory in the Web project in the WSAD 5.1.2 workspace). Add the additional Java source files by mounting their directories via Filesystems -> Mount -> Local Directory. Specify a target directory for class files.

Mount the WebContent\WEB-INF\classes directory as a filesystem to serve as the output for the compiler. Specify this as a target directory (using Tools -> Options -> Building -> Compiler Types) for the class files for these additional source files.

Mount any additional JAR files used by the Web project in WSAD via Filesystems -> Mount -> Archive Files.
Note: The additional JAR files used by WSAD 5.1.2 can also be found from the entries in the . classpath file. The classpathentry tag with sourcepath attribute shows the JAR file that was included with the Web project in Eclipse.

Page 10 of 69

Following steps are optional and can be taken for including additional features in the application being migrated:

To make the servlet features available for the project, mark the servlet classes by choosing Tools -> Mark as Servlet.

To test the migrated Web application, perform the following steps:


Compile the source files and the Web module. Specify the Context Root for the Web module. Deploy and execute the Web module to an appropriate Web server.
Note: - Update the server CLASSPATH to add the external .jar archives used by the Web application, if any. - Refer to the IDE help documentation for deploying and executing the Web application.

Migration of the Web project from WSAD 5.1.2 to Sun JSE 7 has been described along with an example in section 4.2.

Page 11 of 69

3.3 Steps for Migrating EJB Projects


Following subsections describe the steps for migrating J2EE 1.3 compliant EJBs (Session, Entity and Message-Driven beans) from WSAD 5.1.2 to Sun JSE 7.

3.3.1 Steps for Migrating a Session EJB Project


Following steps are required to migrate a stateful session EJB from WSAD 5.1.2 to Sun JSE 7: Mount the ejbModule directory (using the absolute path to the ejbModule directory EJB project in the WSAD 5.1.2 workspace on the filesystem).

Select the session bean package from the mounted filesystem. Open the Session bean wizard by right-clicking on the package and selecting New > All Templates....

On the Choose Template page, expand the J2EE node and select Session EJB. Click on Next >. On the Session Bean Name and Properties page, specify the session bean specifics. Click on Next > button. On the Session Bean Class Files page, click on Modify... buttons to select existing EJB class files (for the Home, Remote and Bean Classes).

Click on Finish button to generate the EJB.

To test the migrated session EJB:


Compile and validate the EJB. Deploy and execute the EJB on an appropriate application server.
Note: - Refer to the IDE help documentation for deploying and executing the EJB.

3.3.2 Steps for Migrating a CMP EJB Project


Steps required to migrate a CMP entity EJB (with additional finder methods) from WSAD 5.1.2 to Sun JSE 7 are:

Mount the ejbModule directory (using the absolute path to the ejbModule directory in the EJB project in the WSAD 5.1.2 workspace). Select the CMP bean package from the mounted filesystem. Open the CMP Entity EJB bean wizard by right-clicking on the package and selecting New > All Templates....

On the Choose Template page, expand the J2EE node and select CMP Entity EJB. Click on Next >.

Page 12 of 69

On the CMP Entity Bean Name and Properties page, specify the CMP specifics EJB Name, Package, Source for Entities and Fields (CMP 2.x Bean Class), Component Interfaces. Click on Next > button.. On the Select a CMP 2.x Bean Class page, select the existing EJB class file. Click on Next > button. On the CMP Fields page, select the Primary Key field. Click on Next > button. On the CMP Entity Bean Class Files page, click on Modify Interface... buttons to select existing EJB class files (for the Home, Remote and Primary Key Classes).

Click on Finish button to generate the CMP Entity EJB.

To associate a EJBQL with the bean's finder method:


In the FileSystems section of the Explorer, right-click the method node for the finder method and choose Properties to display the property sheet. Select the EJBQL Query property and click on the ellipses(...) button to define the EJBQL Query.

Note: Values for providing the information for EJBQL can be found from the ejb-jar.xml file found in the META-INF directory in the root directory of the EJB project in the WSAD 5.1.2 workspace.

Click OK to associate the EJBQL Query with the finder method.

To test the migrated CMP EJB:


Compile and validate the EJB. Create a connection to the requisite database. Create a database schema using the connection. Map the CMP Entity bean fields to the database schema fields. Deploy and execute the EJB on an appropriate application server.
Note: - Refer to the IDE help documentation for creating a database connection, capturing the database schema, mapping the CMP and database fields, deploying and executing the EJB.

3.3.3 Steps for Migrating a MDB EJB Project


The steps for migrating a MDB EJB from WSAD 5.1.2 to Sun JSE 7 are:

Mount the ejbModule directory (using the absolute path to the ejbModule directory in the EJB project in the WSAD 5.1.2 workspace on the filesystem) to get access to the MDB EJB associated with the project. Select the package of the MDB EJB from the mounted filesystem. Open the MDB EJB bean wizard by right-clicking on the package and selecting New > All Templates....

Page 13 of 69

On the Choose Template page, expand the J2EE node and select Message-Driven EJB. Click on Next >. On the Message-Driven Bean Name and Properties page, specify the MDB EJB specifics. Click on Next > button. On the Message-Driven Bean Class File page, click on Modify... buttons to select existing bean class file.

Click on Finish button to add the EJB.

To test the migrated MDB EJB:


Compile and validate the EJB. Configure a JMS Resource such as a Queue/Topic along with a JMS Resource Connection Factory and associate the MDB to these resources. Deploy the EJB on an appropriate application server and send messages to the associated JMS queue.
Note: - Refer to the IDE help documentation for configuring the JMS resources, associating the MDB to these resources, deploying and testing the EJB.

Migration of EJBs from WSAD 5.1.2 to Sun JSE 7 has been described along with an example in section 4.3.

Page 14 of 69

3.4 Steps for Migrating a Web Services Project


This section explains the steps for migrating Web services from IBM WSAD 5.1.2 to Sun JSE 7. IBM WSAD generates the files for Web services based on the runtime environment. However, these files are not mountable as a Web service project in Sun JSE 7. The steps in the process to migrate a Web service created using IBM WSAD 5.1.2 to Sun JSE 7 from the .wsdl file is:

Locate the .wsdl file created by IBM WSAD 5.1.2. Mount the directory containing the .wsdl file in the Filesystems view of Sun JSE 7. Create appropriate Java packages. Create a Web service by selecting the Local WSDL file as the input. Select the .wsdl file as the input file.

Sun JSE 7 generates all the Web service related files(.wsdl, EJBs, etc.). It identifies the business methods from the WSDL file and adds them to the generated EJBs (sans the business logic).

Copy the business logic from the business methods of the renamed EJB files to the EJB files generated by Sun JSE 7.

Input and output parameters of methods in the Web service are mapped as input and output Java objects in the business methods of the EJBs generated by Sun JSE 7 if the style and use of the SOAP message binding for the Web service are document and literal. Sun JSE 7 generates the input and output parameter types as they are in the Web service if the style and use of the SOAP message binding for the Web Service are rpc and literal or rpc and encoded. The logical node of the Web service in the Filesystems tab can be used to generate all the Web service related files, Web Service Test Client, and a WSDL file. It can also be used to add another operation (method) to the Web service. The Web service can be tested from the IDE using the generated client. The client can be used to modify the appropriate JAX-RPC version for execution. The IDE also allows the developers to publish the Web service to the UDDI registry that comes bundled with the IDE. Migration of a simple Web service from WSAD 5.1.2 to Sun JSE 7 has been described along with an example in section 4.4.

Page 15 of 69

3.5 Steps for Migrating Team Support


This section describes the steps for migrating the team support from IBM WebSphere Studio Application Developer to Sun JSE 7. It includes migration settings for CVS and ClearCase in IBM WSAD to Sun JSE 7. The properties for a CVS repository in WSAD can be seen by right-clicking on the CVS repository and selecting Properties. It displays the properties such as Connection Type (pserver, ext, or extssh), User, Password, Host, Repository Path and Port.

Illustration 3. CVS Properties in WSAD The CVS Repository properties can be used in Sun JSE 7 to connect to the same CVS repository. To connect to CVS, select Versioning -> Mount Version Control.

Page 16 of 69

Illustration 4. Adding CVS repository in Sun JSE 7

Sun JSE 7 opens up the Versioning tab which displays the hierarchy for the module from the CVS repository. It also displays the VCS Output tab which gives the status of the commands. An example to illustrate the migration of the CVS repository from WSAD 5.1.2 to Sun JSE 7 has been described in section 4.5.

Page 17 of 69

4 Migration Examples
This section contains examples for migrating Java, Web, EJB and Web Services projects from IBM WSAD 5.1.2 to Sun JSE 7.

4.1 Example for Migrating a Java Project


The illustration shown below depicts a Java application, java-app, in IBM WSAD 5.1.2. This application comprises of a Java class file, Tester containing the main method. Tester accesses a class called EmployeeValueObject which was precompiled in a JAR file.

Illustration 5. Java project example in IBM WSAD Structure of the application is described below: Directory java_app Source Description Contains the Source and the Classes directories. Contains the java source files. When compiled, classes for these will be generated in the Classes directory.

Page 18 of 69

Directory Classes

Description Contains compiled Java classes.

This application refers to an external JAR file, java-utils.jar, as depicted in the illustration below:

Illustration 6. Java project properties in IBM WSAD


Note: Information of the jar files referred by a project in WSAD can alternatively be found from the entries in .classpath file for the project, similar to the following: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path=""/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="C:/Sun Compan/Projects/MigrationToJSE7/JavaApps/javautils.jar"/> <classpathentry kind="output" path=""/> </classpath>

The steps required to migrate the java-app project to Sun JSE 7 are:

Create a new project. Add the Java source files by mounting the Source directory via Filesystems -> Mount -> Local Directory as depicted in the illustration below.

Page 19 of 69

Illustration 7. Adding the source repository in Sun JSE 7

Specify a target directory for class files.


Mount the Classes directory as a filesystem to serve as the output for the compiler. Specify this as a target directory (using Tools -> Options -> Building -> Compiler Types) for the class files for the additional source files as shown in the illustration below.

Page 20 of 69

Illustration 8. Specifying target directory for compiled files in Sun JSE 7

Page 21 of 69

Mount the java-utils.jar JAR files used by the project via Filesystems -> Mount -> Archive Files as shown in the illustration below.
Note: Information for the additional JAR files used by a project in IBM WSAD 5.1.2 can also be found from the entries in the .classpath file. The classpathentry tag with path attribute shows the JAR files that were included in the project.

Illustration 9. Adding a JAR in Sun JSE 7

Add the mounted directories and files to the project.


On the Project window, right-click on the root project node and select Add Existing... from the contextual menu. On the Select Objects dialog, select the directories and files to be added to the project. Click on OK to add them to the project.

Page 22 of 69

The migrated application in Sun JSE 7 is shown in the illustration below.

Illustration 10. Migrated Java project in Sun JSE 7 The migrated application can be verified by compiling and executing the application in Sun JSE 7.

Page 23 of 69

4.2 Example for Migrating a Web Application


The illustration shown below depicts a Web application, jsp-app, in WSAD 5.1.2. This application comprises of JSPs, Servlets, Custom Tags, Applets, Static HTML pages and images.

Illustration 11. Example Web application in WSAD 5.1.2 The Web project in WSAD 5.1.2 confirms to a typical Web application (based on the Sun Microsystems Java Servlet 2.3 Specification). Structure of the Web application is described below:

Directory jsp_app JavaSource

Description Contains the JavaSource and the WebContent directories. Contains the servlet source files for the Web project. When compiled, classes for these servlets will be generated in the WEB-INF/classes directory.

Contains the WEB-INF directory and all directories and files that must WebContent be accessible to the client request, such as JSPs, HTML pages, cascading style sheets, images, and JavaScript files. Page 24 of 69

Directory

Description (Required) Contains the classes, lib and the taglib (custom tag libraries) directories, the standard Web application deployment descriptor (web.xml), and possibly a server specific deployment descriptor (<server>-web.xml). This directory is not part of the public document tree of the application; that is, you cannot directly serve any file contained in this directory, or any of its subdirectories, to a client.

WEB-INF

WEBINF/classes

Contains compiled Java classes, and associated resources that are not packaged in JAR files.

Contains associated resources that are packaged in Java ARchive WEB-INF/lib (JAR) files such as the customtags.jar containing the custom tags to be used by the tag library. Apart from the libraries in the WEB-INF/lib folder, this Web application also refers to an external utility Java library, java-utils.jar, as depicted in the illustration below:

Page 25 of 69

Illustration 12. Library settings in WSAD 5.1.2 The steps required to migrate the jsp-app Web application from WSAD 5.1.2 to Sun JSE 7 are:

Create a new project in Sun JSE 7. Name the project using the conventions followed for the WSAD 5.1.2 project, i.e. jsp-app. Add a new Web Module to the project as depicted in the illustration below.

Click on Next > button to specify the absolute path to the directory for the Web module (path to the WebContent directory in the Web project in the WSAD 5.1.2 workspace) as depicted below. (This is to mount the WebContent directory in the Web project in the WSAD 5.1.2 workspace)

Page 26 of 69

Illustration 13. Adding a new Web module in Sun JSE 7

Page 27 of 69

Add all the additional Java source files by mounting their directories via Filesystems -> Mount -> Local Directory as depicted in the illustration below. These are the Java source files for which the class files are to be generated in the WEB-INF\classes folder.

Illustration 14. Adding any additional source repositories in Sun JSE 7

Page 28 of 69

Specify a target directory for class files.


Mount the WebContent\WEB-INF\classes directory as a filesystem to serve as the output for the compiler. Specify this as a target directory (using Tools -> Options -> Building -> Compiler Types) for the class files for the additional source files as shown in the illustration below.

Note: This is needed as the class files for a Web application project should reside in the WEBINF\classes folder, if not bundled with as .jar files.

Illustration 15. Specifying target directory for compiled files in Sun JSE 7

Page 29 of 69

Mount the java-utils.jar JAR files used by the Web project in WSAD 5.1.2 via Filesystems -> Mount -> Archive Files as shown in the illustration below.
Note: The additional JAR files used by WSAD 5.1.2 (along with their location) can also be found from the entries in the .classpath file. The classpathentry tag with sourcepath attribute shows the JAR files that were included with the Web project in WSAD 5.1.2.

Illustration 16. Adding the JAR in Sun JSE 7

Page 30 of 69

A sample migrated application in Sun JSE 7 is shown in the illustration below.

Illustration 17. Migrated Web application in Sun JSE 7 To test the migrated Web application, perform the following steps:

Compile the source files and the Web module. Specify the Context Root for the Web module. Deploy and execute the Web module to an appropriate Web server.
Note: - Update the server CLASSPATH to add the external .jar archives used by the Web application, if any. - Refer to the IDE help documentation for deploying and executing the Web application.

Page 31 of 69

4.3 Examples for Migrating EJB Projects


4.3.1 Example for Migrating a Session EJB Project
The illustration below shows a sample project, session-ejb, containing a stateful session EJB in WSAD5.1.2.

Illustration 18. Stateful session bean in IBM WSAD 5.1.2 This project comprises of a J2EE 1.3 compliant stateful Session EJB. Structure of the project is described below:

Directory session-ejb ejbModule META-INF HelloWorld EJB

Description Contains the ejbModule directory. Contains the META-INF directory and the EJBs. Contains the standard EJB deployment descriptor (ejb-jar.xml), and possibly a server specific deployment descriptor. example.ejb.session package contains the home, remote and bean classes for the EJB.

Page 32 of 69

The steps required to migrate the session EJB associated with this project from WSAD 5.1.2 to Sun JSE 7 are:

Mount the ejbModule directory (using the absolute path to the ejbModule directory in the session-ejb project in the WSAD 5.1.2 workspace on the filesystem) to get access to the session ejb associated with the project. Select the package example.ejb.session from the mounted filesystem. Open the Session bean wizard by right-clicking on the package and selecting New > All Templates....

On the Choose Template page, expand the J2EE node and select Session EJB as shown in the illustration below.

Illustration 19. Adding a new session bean in Sun JSE 7

Click on Next >.

Page 33 of 69

On the Session Bean Name and Properties page, specify the following, as shown in the illustration below:

EJB Name - HelloWorld Package - example.ejb.session State - Stateful Transaction Type Container-Managed Component Interfaces Remote Interfaces Only (Default)

Illustration 20. Session bean name and properties in Sun JSE 7

Click on Next > button.

Page 34 of 69

On the Session Bean Class Files page, click on Modify... buttons to select existing EJB class files (for the Home, Remote and Bean Classes) as shown in the illustration below.

Illustration 21 Selecting bean class files in Sun JSE 7

Page 35 of 69

The following illustration displays the Sun JSE 7 dialog box that can be used to specify an existing bean class.

Illustration 22. Specify an existing bean class in JSE 7

Click on Finish button to generate the EJB.

Page 36 of 69

The migrated Session EJB in Sun JSE 7 is shown in the illustration below.

Illustration 23. HelloWorld session bean in Sun JSE 7 To test the migrated session EJB, perform the following steps:

Compile and validate the EJB. Deploy and execute the EJB on an appropriate application server.
Note: - Refer to the IDE help documentation for deploying and executing the EJB.

Page 37 of 69

4.3.2 Example for Migrating a CMP EJB Project


The following illustration depicts a project, cmp-ejb, containing a CMP entity EJB in WSAD 5.1.2.

Illustration 24. CMP entity EJB in IBM WSAD 5.1.2 This project comprises of a J2EE 1.3 compliant CMP Entity EJB. Structure of the project is shown below:

Directory cmp-ejb ejbModule

Description Contains the ejbModule directory. Contains the META-INF directory and the EJBs. Contains the standard EJB deployment descriptor (ejb-jar.xml), and possibly a server specific deployment descriptor.

META-INF

Apart from this, it also contains the backends\<database> directory for storing the cmp-database mappings (for specifying the mapping of the CMP fields with the database table columns) as shown in the illustration below. Page 38 of 69

Directory

Description example.ejb.entity package contains the home, remote and bean classes for the EJB. This CMP also has a finder method findByUserId to find a user based on the UserId using the EJBQL query select object(o) from UserInfo o where o.userId = ?1.

UserInfo EJB

The following illustration displays the mapping of CMP fields with database table columns in WSAD 5.1.2.

Illustration 25. Mapping of CMP fields with database in IBM WSAD

Page 39 of 69

The steps to migrate the CMP EJB associated with this project from WSAD 5.1.2 to Sun JSE 7 are:

Mount the ejbModule directory (using the absolute path to the ejbModule directory in the cmp-ejb project in the WSAD 5.1.2 workspace) to get access to the CMP EJB associated with the ''cmp-ejb project. Select the package example.ejb.entity from the mounted filesystem. Open the CMP Entity EJB bean wizard by right-clicking on the package and selecting New > All Templates....

On the Choose Template page, expand the J2EE node and select CMP Entity EJB as shown in the illustration below.

Illustration 26. Adding a new CMP entity EJB in Sun JSE 7

Click on Next >.

Page 40 of 69

On the CMP Entity Bean Name and Properties page, specify the following as shown in the illustration below:

EJB Name - UserInfo Package - example.ejb.entity Source for Entities and Fields - CMP 2.x Bean Class Component Interfaces Remote Interfaces Only

Illustration 27. CMP entity bean name and properties in Sun JSE 7

Click on Next > button.

Page 41 of 69

On the Select a CMP 2.x Bean Class page, select the UserInfoBean class as shown in the illustration below.

Illustration 28. Selecting CMP bean class file in Sun JSE 7

Click on Next > button.

Page 42 of 69

On the CMP Fields page, select userId field as the Primary Key as shown in the illustration below.

Illustration 29. Selecting the primary key for a CMP in Sun JSE 7

Click on Next > button.

Page 43 of 69

On the CMP Entity Bean Class Files page, click on Modify Interface... buttons to select existing EJB class files (for the Home, Remote and Primary Key Classes) as shown in the illustration below.

Illustration 30 Selecting bean class files in Sun JSE 7

Page 44 of 69

The following illustration displays the Sun JSE 7 dialog box for defining an existing primary key class as the primary key class for the CMP EJB.

Illustration 31. Specifying primary key class in Sun JSE 7

Click on Finish button to generate the CMP Entity EJB.

Page 45 of 69

To associate the EJB QL to the findByUserId(String userId) finder method, perform the following:

In the FileSystems section of the Explorer, right-click the method node and choose Properties to display the property sheet as shown in the illustration below.

Illustration 32. Finder method Property Sheet in Sun JSE 7

Select the EJBQL Query property and click on the ellipses(...) button to define the EJBQL Query as shown in the illustration below.

Note: Values for providing the information for EJBQL can be found from the ejb-jar.xml file found in the META-INF directory in the root directory of the cmp-ejb project in the WSAD 5.1.2 workspace.

Illustration 33. Specifying EJBQL for a Finder Method in Sun JSE 7

Page 46 of 69

Click OK to associate the EJBQL Query with the finder method.

The migrated CMP EJB in Sun JSE 7 can be shown as in the illustration below.

Illustration 34. CMP entity bean in Sun JSE 7 To test the migrated CMP EJB, perform the following steps:

Compile and validate the EJB. Create a connection to the requisite database. Create a database schema using the connection. Map the CMP Entity bean fields to the database schema fields. Deploy and execute the EJB on an appropriate application server.
Note: - Refer to the IDE help documentation for creating a database connection, capturing the database schema, mapping the CMP and database fields, deploying and executing the EJB.

Page 47 of 69

4.3.3 Example for Migrating a MDB EJB Project


The following illustration depicts the project, mdb-ejb, containing a message driven EJB in WSAD 5.1.2.

Illustration 35. MDB EJB in IBM WSAD 5.1.2 This project comprises of a J2EE 1.3 compliant Message Driven EJB. Structure of the project is described below:

Directory mdb-ejb ejbModule META-INF MessageProcessor EJB

Description Contains the ejbModule directory. Contains the META-INF directory and the EJBs. Contains the standard EJB deployment descriptor (ejbjar.xml), and possibly a server specific deployment descriptor. example.ejb.mdb package contains the bean class for the EJB.

Page 48 of 69

This MDB is configured to receive messages from an associated JMS destination via a ListenerPort as shown in the illustration below.

Illustration 36. MDB configuration for JMS destination in WSAD 5.1.2

Page 49 of 69

The steps to migrate the MDB EJB associated with this project from WSAD 5.1.2 to Sun JSE 7 are:

Mount the ejbModule directory (using the absolute path to the ejbModule directory in the mdb-ejb project in the WSAD 5.1.2 workspace on the filesystem) to get access to the MDB EJB associated with the project. Select the package example.ejb.mdb from the mounted filesystem. Open the MDB bean wizard by right-clicking on the package and selecting New > All Templates....

On the Choose Template page, expand the J2EE node and select Message-Driven EJB as shown in the illustration below.

Illustration 37. Adding a new MDB bean in Sun JSE 7

Click on Next >.

Page 50 of 69

On the Message-Driven Bean Name and Properties page, specify the following as shown in the illustration below:

EJB Name - MessageProcessor Package - example.ejb.mdb Transaction Demarcation Container-Managed Transactions

Illustration 38. Message-driven bean name and properties in Sun JSE 7

Click on Next > button.

Page 51 of 69

On the Message-Driven Bean Class File page, click on Modify Class... button to select an existing bean class file as shown in the illustration below.

Illustration 39. Selecting bean class files in Sun JSE 7

Page 52 of 69

The following illustration displays the Sun JSE 7 dialog box for specifying an existing bean class.

Illustration 40. Specifying an existing bean class in Sun JSE 7

Click on the Finish button to add the EJB.

Page 53 of 69

The migrated MDB EJB in Sun JSE 7 is shown in the illustration below.

Illustration 41. MDB EJB in Sun JSE 7 To test the migrated MDB EJB, perform the following steps:

Compile and validate the EJB. Configure a JMS Resource such as a Queue/Topic along with a JMS Resource Connection Factory and associate the MDB to these resources. Deploy the EJB on an appropriate application server and send messages to the associated JMS queue.
Note: - Refer to the IDE help documentation for configuring the JMS resources, associating the MDB to these resources, deploying and testing the EJB.

Page 54 of 69

4.4 Example for Migrating a Web Services Project


The following illustration displays a Web service named Calculator which exposes two methods: add and subtract. Both the methods take two integer parameters as input and return an integer.

Illustration 42. Sample Web service in WSAD 5.1.2

Page 55 of 69

The Calculator Web Service can be tested and executed from WSAD. It displays the results as shown in the illustration below:

Illustration 43. Sample Web service output in IBM WSAD 5.1.2 The Calculator Web service uses SOAP binding parameters style and use as rpc and encoded. A sample .wsdl file for the Calculator Web service is shown below:
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ejb" xmlns:impl="http://ejb" xmlns:intf="http://ejb" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <schema targetNamespace="http://ejb" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://ejb" xmlns:intf="http://ejb" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <element name="a" type="xsd:int"/> <element name="b" type="xsd:int"/> <element name="substractReturn" type="xsd:int"/> <element name="int" type="xsd:int"/> <element name="addReturn" type="xsd:int"/> </schema> </wsdl:types> <wsdl:message name="substractRequest"> <wsdl:part name="a" type="xsd:int"/> <wsdl:part name="b" type="xsd:int"/>

Page 56 of 69

</wsdl:message> <wsdl:message name="addResponse"> <wsdl:part name="addReturn" type="xsd:int"/> </wsdl:message> <wsdl:message name="addRequest"> <wsdl:part name="a" type="xsd:int"/> <wsdl:part name="b" type="xsd:int"/> </wsdl:message> <wsdl:message name="substractResponse"> <wsdl:part name="substractReturn" type="xsd:int"/> </wsdl:message> <wsdl:portType name="Calculator"> <wsdl:operation name="substract" parameterOrder="a b"> <wsdl:input message="intf:substractRequest" name="substractRequest"/> <wsdl:output message="intf:substractResponse" name="substractResponse"/> </wsdl:operation> <wsdl:operation name="add" parameterOrder="a b"> <wsdl:input message="intf:addRequest" name="addRequest"/> <wsdl:output message="intf:addResponse" name="addResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CalculatorSoapBinding" type="intf:Calculator"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="substract"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="substractRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ejb" use="encoded"/> </wsdl:input> <wsdl:output name="substractResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ejb" use="encoded"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="add"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="addRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ejb" use="encoded"/> </wsdl:input> <wsdl:output name="addResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ejb" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CalculatorService"> <wsdl:port binding="intf:CalculatorSoapBinding" name="Calculator"> <wsdlsoap:address location="http://localhost:9080/TestProjectRouter/services/Calculator"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

Page 57 of 69

Steps needed to migrate this Web service to Sun JSE 7 are:


Mount the directory containing the Calculator.wsdl file from the Filesystems view. Mount a filesystem where the Web service is to be created. Create Java packages such as websvc, ejb and client to hold the source code related to Web service, EJB and the Web service client respectively. Right-click on the websvc package, select New -> All Templates. Select Web Service from the Web Services templates.

Illustration 44. New Web service wizard in Sun JSE 7

Page 58 of 69

Next, specify the name of the Web service, and select Local WSDL File in the Create From options.

Illustration 45. Web service creation options in Sun JSE 7

Page 59 of 69

Select the .wsdl file from IBM WSAD workspace as the input for a similar Web service implementation.

Illustration 46. Select mounted WSDL file in JSE 7

Page 60 of 69

As the business logic for the Web service methods is implemented in EJBs by Sun JSE 7, specify the EJB name and the package to create the EJBs.

Illustration 47. Specify business logic EJBs in Sun JSE 7

Page 61 of 69

Sun JSE 7 generates the Web service and the business methods in EJBs. Copy the business logic into these methods to get the same functionality. If the business methods in WSAD access other modules such as Java projects or EJB projects, refer to sections 4.1 and 4.3. Sun JSE 7 with generated Web service files is shown in the illustration below.

Illustration 48. Sample Web service in Sun JSE 7 To create a Web Service Test client, right-click on the logical node of the Web service. As in the illustration below, it provides an option for the package name.

Page 62 of 69

Illustration 49. Create Web service client in Sun JSE 7 From the generated client files, the Web service can be executed and tested by rightclicking on the client application node. The test output for the Web service is shown in the illustration below.

Illustration 50. Test Web client for the Web service

Page 63 of 69

4.5 Example for Migrating Team Support


The following illustration displays a typical CVS perspective with views such as CVS Repositories, CVS Annotate, CVS Resource History and CVS Editors.

Illustration 51. CVS perspective in IBM WSAD 5.1.2

Page 64 of 69

The properties for the mounted CVS Repository can be displayed by right-clicking on the the repository and selecting the Properties option from CVS Repository tab. The following illustration displays the properties for a sample CVS repository.

Illustration 52. CVS properties in WSAD

Page 65 of 69

The properties captured from Eclipse such as CVS Server Type, CVS Server Name, Port Number (default CVS port number is 2401), User name, Repository path, and the password can be used to connect to the same CVS repository. The following illustration displays the CVS settings to be configured in Sun JSE 7.

Illustration 53. CVS settings in Sun JSE 7

Page 66 of 69

Sun JSE 7 displays the structure of the module in the Versioning tab. The IDE displays the available CVS commands in the Runtime tab. It also opens up the VCS Output tab which displays the status of the commands that have been executed. Sun JSE 7 with typical Version Control System views is shown in the illustration below:

Illustration 54. CVS repository in Sun JSE 7

Page 67 of 69

5 Appendix
References

J2EE Application Migration Guide Sun JSE 7 IDE Help Documentation

Page 68 of 69

Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, JavaServer, JavaBeans, NetBeans, EJB, Enterprise JavaBeans, the Duke logo and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon architecture developed by Sun Microsystems, Inc. This product is covered and controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, Etats-Unis. Tous droits rservs. Lutilisation est soumise aux termes de la Licence. Cette distribution peut comprendre des composants dvelopps par des tierces parties. Sun, Sun Microsystems, le logo Sun, Java, JavaServer, JavaBeans, NetBeans, EJB, EnterpriseJavaBeans, le logo Duke et le logo Java Coffee Cup sont des marques de fabrique ou des marques dposes de Sun Microsystems, Inc. aux Etats-Unis et dans dautres pays. Toutes les marques SPARC sont utilises sous licence et sont des marques de fabrique ou des marques dposes de SPARC International, Inc. aux Etats-Unis et dans d'autres pays. Les produits portant les marques SPARC sont bass sur une architecture dveloppe par Sun Microsystems, Inc. Ce produit est soumis la lgislation amricaine en matire de contrle des exportations et peut tre soumis la rglementation en vigueur dans dautres pays dans le domaine des exportations et importations. Les utilisations, ou utilisateurs finaux, pour des armes nuclaires,des missiles, des armes biologiques et chimiques ou du nuclaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou rexportations vers les pays sous embargo amricain, ou vers des entits figurant sur les listes dexclusion dexportation amricaines, y compris, mais de manire non exhaustive, la liste de personnes qui font objet d'un ordre de ne pas participer, dune faon directe ou indirecte, aux exportations des produits ou des services qui sont rgis par la lgislation amricaine en matire de contrle des exportations et la liste de ressortissants spcifiquement dsigns, sont rigoureusement interdites.

Page 69 of 69

Você também pode gostar