GRC
HR
SCM
CRM
BI


Article

 

Faster and Easier J2EE-Compliant Design with New Tools from SAP NetWeaver Developer Studio

by Karl Kessler | SAPinsider

July 1, 2003

by Karl Kessler, SAP AG SAPinsider - 2003 (Volume 4), July (Issue 3)
 

The ranks of Java-based programming in the SAP world are growing. SAP Enterprise Portal is written in Java, as are parts of the SAP Exchange Infrastructure. And from the first offering of the SAP J2EE Engine, we’ve already seen SAP customers successfully develop their own Java applications for this J2EE runtime environment. To make J2EE project development and implementation faster and easier for these and future developers, SAP is pairing the J2EE Engine with a new set of integrated, J2EE-compliant development tools, which debut for customers with Release 6.30 of SAP Web Application Server.

SAP NetWeaver Developer Studio is now available in SAP Web Application Server, and includes a J2EE Explorer — a new Eclipse perspective1 for all your activities regarding J2EE development (see Figure 1). J2EE Explorer is the entryway to all the wizards, editors, and modeling tools SAP offers for each layer of your J2EE application project (see sidebar below).

Figure 1 J2EE Explorer in the SAP NetWeaver Development Studio

What Is J2EE?
J2EE is the Java standard for distributed, enterprise-scale Java applications.
The standard specifies all aspects of a multi-tier application, such as:

  • The user interface, running predominantly in a Web browser (the Web tier)

  • The business logic (the Enterprise Java Beans tier)

  • The access to underlying databases (the Java persistence tier)

J2EE also offers solutions to issues such as security (authentication, encryption), transaction management, and connectivity to backend or legacy systems.

SAP NetWeaver provides support for J2EE with the SAP J2EE Engine as the runtime environment, and a new tool set for design and development of J2EE-compliant applications.

Why SAP’s J2EE Tools?
To state the obvious: J2EE is a standard, so as long as your tools are standard-compliant, you could conceivably use any tool for creating J2EE-based applications that will run on any J2EE-compliant server. But there are some very good reasons to use SAP’s own J2EE tools:

  • Integration: SAP’s J2EE tool set is fully integrated in SAP NetWeaver Developer Studio, an integral part of the SAP NetWeaver application platform included in SAP Web Application Server 6.30. With SAP Web AS, you automatically have a range of design tools at your fingertips, including those for J2EE development.

  • Infrastructure: Like SAP’s other Eclipse perspectives (such as Web Dynpro), the J2EE tool set is linked to SAP’s development infrastructure, including the Design Time Repository and the Component Build Service.2 So whether you’re designing an interface based on Web Dynpro or J2EE, you can access the same set of development resources, ensuring consistency and version control.

  • Look and feel: Due to the architecture of SAP NetWeaver Developer Studio, the J2EE tool set is implemented on top of SAP’s tool framework, and offers developers a rich user interface. Anyone on your IT team can review a J2EE application or a Web Dynpro interface and find powerful modeling and design tools with consistent, familiar graphic elements.

  • Runtime environment: The J2EE tool set is linked to SAP’s J2EE runtime environment. Your applications can be immediately deployed, tested, and debugged on the SAP J2EE Engine.

In addition, the SAP J2EE tool set provides a number of ways to significantly accelerate development, while assuring that your work — including user interfaces, application models, and business logic — is strictly J2EE-compliant.

Quick Development Using J2EE Project Wizards
In the Developer Studio, your development efforts are organized as a list of Eclipse projects, all visible via your Eclipse workspace. A particular highlight of the J2EE Explorer is its wizards for developing and maintaining J2EE applications (see Figure 2):

  • Web Project: Here you maintain the Web components of your J2EE applications.

  • Web Application Project: You define the Web descriptor and build the WAR file, which represents the Web tier of your J2EE application.

  • EJB Project: This project hosts all your enterprise java beans (EJBs) containing the business logic.

  • EJB Assembly Project: From here you can build the EJBJAR file, which represents the compiled business logic.

  • Enterprise Application Project: This wizard allows you to maintain the deployment descriptor and to build the EAR archive that can finally be deployed to the J2EE runtime environment.

Figure 2 Wizards for Faster, More Accurate J2EE Design

NOTE!
The Web Services Client Proxy Project wizard is also shown in Figure 2. Web Services are fully integrated inside the J2EE perspective. The dependencies of different project types are reflected in the dependencies of the underlying Eclipse projects. Once a project is built, Eclipse checks for required projects and will build them if necessary.

Developing the User Interface: Java Server Pages and Servlets
For highly sophisticated, flexible Web user interfaces that can run on the J2EE Engine, SAP has developed its own Web user interface model, Web Dynpro technology. 3 Web Dynpro supplements J2EE development, which uses either servlets or JSP to implement a J2EE-standard user interface in a browser.

Servlets are dynamic extensions of the HTTP protocol. They follow a request/response pattern: they react to an HTTP request, such as a URL request in a browser or an HTTP post, and produce a dynamic response, which is simply an HTML page. A servlet must extend the HTTP protocol and therefore extend certain Java base classes. Fortunately, with the SAP J2EE tool set, you do not need to know these classes in detail — the servlet wizard creates a source skeleton for you; just fill it in with your custom code.

JSP is more design-time oriented than servlets; you can specify HTML code in a more document-centric fashion. The HTML code is made dynamic through script code written in Java. The script code is embedded using the standard syntax <% %> in JSP pages. SAP’s J2EE tool set includes a JSP Editor — see Figure 3 — with outstanding features such as:

  • Syntax-based color scheme: Portions of code are colored based on the program’s syntax. Each color represents a different syntax element for easier editing and greater readability.

  • JSP insight: From the JSP Editor, you can inspect the JSP syntax, insert JSP tags, and incrementally add tags and other valid options.For instance, in the JSP Editor in Figure 3, the user can select from valid JSP tags in the dropdown list and place them in the code — just one more step toward error-free J2EE development.

  • Syntax check: After you’ve saved your code, the SAP NetWeaver Developer Studio reads the document type definition (DTD) from the Web that describes the JSP syntax and validates the code automatically. The syntax tree in the outline view (bottom left) illustrates the logical structure of your JSP page.

  • Support for JSP debugging: You can set breakpoints in the JSP page that are interpreted by the J2EE Engine at runtime.
Figure 3 The JSP Editor in SAP NetWeaver Developer Studio

Compared to SAP GUI interfaces, SAP users will find that JSP and servlets support simpler, less dynamic, and more document-oriented (rather than transaction-oriented) interfaces. However, JSP and servlets are meant for use in scenarios that require implementation directly on top of J2EE-standard interfaces — for example, when HTML design is done by external Web designers or when customers want to port their existing J2EE applications to the SAP J2EE Engine.

For those looking ahead to J2EE interfaces that can scale up to manage large-scale, enterprise-level transactions, the SAP J2EE tool set is designed to develop along with future advances in J2EE.

Implementing the Business Logic: Enterprise Java Beans
According to the J2EE standard, all business logic is encapsulated in two types of enterprise java beans (EJBs):

Entity beans, which represent entities that are stored in the underlying relational database.

Session beans, which have no counterpart on the database and therefore encapsulate objects that are created during a session, but are not persisted to the database later.

Both types are implemented as Java classes that support several interfaces, defined by the J2EE standard. These interfaces control how instances are created (home interface) and what functionality the instances offer (remote interface).

Figure 4 Session Bean in SAP NetWeaver Developer Studio

Figure 4 shows a session bean displayed in SAP NetWeaver Developer Studio. On the left is the outline with all business and EJB methods. The parameters for the selected method are also shown. The bean wizard automatically creates the skeleton code for the bean’s implementation, plus all the interfaces that the J2EE specification requires. Then, you can easily navigate to the generated code by selecting the Bean tab at the bottom. With the SAP J2EE tool set, presentation of EJBs is well-structured to offer full insight into the business layer of your J2EE application.

Graphical Representation of J2EE Applications
NetWeaver Developer Studio is developed on top of Eclipse, but the addition of SAP Plug-ins means that all the developer tools share an SAP-specific graphical framework for a consistent look and feel — so the icons and connectors are familiar whether you’re modeling a J2EE or Web Dynpro application.

Like Web Dynpro tools, the J2EE tool set allows the creation of new development objects (in this case, new projects or beans) right from within the model itself.

In Figure 5, a session bean and an entity bean are displayed graphically using UML notation. The session bean has a reference (the blue line) to the entity bean. On the left are palettes of icons for creating new J2EE entities (such as security roles) and linking entities (such as references between EJBs).

Figure 5 Modeling Objects in the SAP NetWeaver Developer Studio

The graphical model not only depicts the current interrelationships between different J2EE entities, it also serves as a starting point for creating new ones. All changes made to the model immediately appear in the outline view (shown back in Figure 3), so your models are always in sync.

Summary
So why use SAP’s J2EE tool set? First, it is included as part of SAP Web Application Server 6.30, where it is an integral part of NetWeaver Developer Studio. It is designed to help you during all phases of J2EE-compliant development, from user interface to business logic, and is integrated with the entire SAP development infrastructure and the SAP J2EE Engine.

Aside from the integration benefits, the rich graphical user interface helps sidestep some of the more tedious and error-prone work that comes with J2EE design, such as maintaining J2EE descriptors manually. Instead, you’ll work with a sophisticated, multi-page editing framework for viewing the original XML source in a very readable way, with tree and tabular displays and powerful modeling tools. Wizards automatically supply consistent, J2EE-compliant code and related services to help speed up design now and prevent time-consuming errors from cropping up later.

Look for the SAP Web Application Server 6.30 for an opportunity to experience the new SAP J2EE tool set. For more information on J2EE tools in the SAP NetWeaver Developer Studio, see http://service.sap.com/technology.


1 Eclipse is the open, Java-based development environment htat SAP is using as the platform for all its new design-time tools for Web applications.

2 The Design-Time Repository holds the development objects required for Java applications, to support version control. The Component Build Service creates corresponding runtime objects for implementation. See “SAP’s Strategy Toward an Integrated, Full-Featured Java Development Environment” in the January-March 2003 issue of SAP Insider (www.SAPinsider.com).


Karl Kessler joined SAP in 1992. He is the Product Manager of the ABAP Workbench and the SAP NetWeaver Developer Studio, and is responsible for all rollout activities. You can reach him via email at karl.kessler@sap.com.

 

An email has been sent to:






More from SAPinsider



COMMENTS

Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!


SAPinsider
FAQ