Web Application Development Features of Oracle JDeveloper 10g

Web Application Development Features of Oracle JDeveloper 10 g

Up to this point, we have worked through some of the basic features of Oracle JDeveloper 10 g. If all we are looking for is a basic IDE, it should be apparent that Oracle JDeveloper 10 g covers all of the standard amenities one would expect from an IDE. But these days, developers aren t satisfied with adequate ; companies and developers are looking for that edge. Anything that can provide additional productivity is critical in an environment where time to develop takes ever-increasing precedence over the actual content being delivered. Make no mistake, however, projects are still expected to deliver rich content, robust frameworks, and ease of extension and maintainability. Following the traditional method of roll your own framework development is simply not possible for most modern projects and, with the advent of so many proven frameworks, is no longer nearly as necessary.

I recall one of the first frameworks I developed was a dynamic SQL generator that allowed me to collate data across differing databases (including differing database vendors ). Later, I ended up taking over responsibility for our persistence layer. Simply maintaining this framework was nearly a full-time job. Several years later, I developed my first TCF (thin-client framework). The model was based on the J2EE BO-VO-DAO pattern and later had to incorporate EJBs. I spent over a year working with this.

I look back on these efforts now, and it amazes me how much time I spent working on things that could now be solved with off-the-shelf frameworks. My dynamic SQL generator could be replaced by Periscope (for more information about Periscope, go to http://www.tusc.com/periscope). The persistence framework could be replaced by any number of viable candidates, including Hibernate, JDO, TopLink, or ADF. And the idea of developing your own TCF these days is almost laughable with robust frameworks like Struts and Spring on the market. Open source development has really turned framework development on its ear; in many cases, it is now something that ambitious or passionate developers do as side projects rather than byproducts that get generalized out of finalized development efforts, but that is another discussion altogether.

So what is the relevance of this little aside? Well, as I was just saying, Oracle JDeveloper 10 g is an adequate IDE if all we re looking for is just a standard development and debugging tool, but developers need more these days. What one needs to consider, beyond the basics when picking an IDE, is what that IDE offers above and beyond the standard amenities. What is critical is how easily it allows you to integrate with some of these frameworks. In the case of Oracle JDeveloper 10 g, not only does it easily allow you to integrate with these frameworks, it actually comes bundled with some of the most popular major frameworks in the industry today. Oracle JDeveloper 10 g comes integrated (out of the box) with Struts and ADF (which includes Oracle TopLink 10 g ). It also includes several other mission-critical components for successful project development such as native integration with Ant (automated build and deployment), a plug-in for JUnit (for unit testing and integration), and a rich suite of design and modeling tools.

Note  

OracleAS TopLink is a tool that provides mapping between relational databases (like Oracle) and object-oriented languages (like Java). OracleAS TopLink enables developers to: persist Java objects in virtually any relational database supported by a JDBC 2.0 “compliant driver; map any object model to any relational schema, using the OracleAS TopLink Mapping Workbench graphical mapping tool; and use OracleAS TopLink successfully, even if they are unfamiliar with SQL or JDBC, because OracleAS TopLink provides a clean, object-oriented view of relational databases.

As we will see in our advanced examples later in the chapter, Oracle JDeveloper has taken major strides with version 10 g to the point of providing rich functionality outside of the application- tier development realm. Oracle JDeveloper 10 g has taken on additional capabilities to design and develop both the database structure as well as database-embedded functionality (triggers, packages, procedures, etc.). Instead of having your application development tool, your data modeling tool, your database management tool, and your PL/SQL development tool, you could just use Oracle JDeveloper 10 g. Let s take a closer look at some of the features 10 g offers.

Diagramming

Let s start with design. Oracle JDeveloper 10 g has UML diagramming tools that allow you to design both the high-level and detail-oriented specifics of your system. Here are some of the diagrams that Oracle JDeveloper 10 g provides:

  • UML use case diagrams

  • UML class diagrams

  • UML class diagrams from XMI import

  • Java class diagrams

  • Activity diagrams

  • Business components diagrams

  • EJB diagrams

  • Struts config diagrams

  • Web service diagrams

  • Database diagrams

Covering the specifics of each of these kinds of diagrams is outside of the scope of this chapter; however, we will touch on manipulating some of these later, in the advanced examples. The thing to gather from this list is that Oracle JDeveloper 10 g offers a rich suite of UML diagramming capabilities and that many of these can be used to directly manipulate and/or generate code for you.

Struts Integration

Oracle JDeveloper 10 g is integrated with the Jakarta Struts controller framework. Utilization of this framework is optional, but Oracle JDeveloper 10 g has made major strides and taken great effort to ease the learning curve, the difficulty of implementation, and the maintenance involved with implementing this framework. As part of the Struts integration with the ADF framework (which we will discuss next ), Oracle implemented extensions to the standard Struts framework, allowing it to seamlessly integrate with the ADF framework. This allows developers to do some of the amazingly easy prototyping that we will do in our advanced exercise later in the chapter.

The concept of a controller framework is to allow for a centralized configuration of the interactivity of your application while also allowing for modularity on a unit-of-work basis. Struts is also based around the BO-VO (Business Object “Value Object) or DTO (Data Transfer Object) pattern. The framework follows the MVC (Model-View-Controller) pattern by implementing the C (controller) portion of the framework completely and providing hooks to assist in the V (View) portion. The Struts framework consists of four key components:

  • Struts request dispatcher

  • Struts config.xml

  • Struts action classes

  • Struts form classes

The Struts request dispatcher and the Struts config file make up the brains of your application. You will likely never see the request dispatcher unless you end up stepping into it at one point during a debug session (if you re lucky, you ll never see your own brain either, but that doesn t make it any less important). The request dispatcher is what coordinates the transfer of control and handoff of requests within the Struts framework. Oracle created a custom extension to this class in 10 g to integrate it with the data bindings layer of the framework as well as to provide the ability for it to handle event management of its custom extensions to the Struts action class.

The Struts config file is where you lay down the roadmap of your application. It is where all of the pages of your application are defined and linked together via actions, events, and paths to JSPs. This is also where you declare all of your action and form classes so that Struts knows which forms are associated with which actions and which JSP files.

Note  

We will cover the Struts config file in slightly more detail in the advanced example later in the chapter, but if you are really interested in Struts, my suggestion would be to check out the online documentation at http://Struts.apache.org.

Form classes implement the value object pattern in that their sole purpose is to contain data for the application. They can also provide some rudimentary validation logic. This can also be contained within the more advanced Struts validator system in the framework. The form classes are stand-alone Java classes that extend the org.apache.Struts.action.ActionForm class. As mentioned earlier, they are configured within the Struts config file. One of the major benefits of this class within the framework is that the Struts framework utilizes introspection to populate the form class that is associated with an action with the request parameters that map to the values defined within the class. This implies the standard reflection/introspection bean rules in that the values in the form class should be defined as private with appropriate accessors and mutators as needed.

The action class s primary responsibility is to operate between the HTTP request and the business logic defined for the application. It also has the job of determining what event condition applies to navigation and performing the lookup through the framework to locate the appropriate forward to be issued into the request dispatcher. The main entry point to the action class is the execute method, within which your custom decision logic can reside. With the introduction of the ADF framework and the custom Oracle extensions, a great deal of this work is abstracted away from developers so that you need not bother with it if you don t want to. You can now define methods on the DataAction extension for your unit of work (DataAction is an ADF extension of the Struts Action class) to handle specific events when the action is executed. You do this by defining a method in the DataAction that has a signature of

 public void onEVENT(DataActionContext ctx) 

where EVENT is equal to the name of the event you wish to handle. For more information on this, see the Oracle JDeveloper 10 g online documentation.

Alternatively, you can actually view the specific source code by creating a unit of work that has a DataAction extension, opening that extension, highlighting the term DataAction anywhere in the stubbed-out class, right-clicking it, and selecting go to declaration. This is an extremely nice feature of Oracle JDeveloper 10 g in that you can highlight pretty much anything in your source code and select this option. Depending on the context of the item you have selected, either you will go to the line of code where the item was declared (if it is a variable), you will go to the header of the method (if it is a method), or it will open the source file for the class if it is a class type.

The ADF Framework

To cover the ADF framework in detail would require a minimum of a chapter unto itself. What we will try to do in this section is to at least give you some background on what the ADF framework is supposed to be and how it is relevant to the Oracle JDeveloper 10 g environment.

Note  

For a more detailed look at the high-level ADF features, refer to http://www.oracle.com/technology/products/jdev/ collateral /papers/10g/ADF_overview.pdf.

ADF is really about productivity with choice, and for once a corporate tag line delivers on its promise. ADF is a framework whose presence is felt as much or as little in your application as you desire . Its involvement can span all layers of the application development from presentation layer (with UIX or JClient) all the way to the persistence layer (ADF Business Components or TopLink). There are so many potential combinations of ways you could utilize some or all of the ADF framework that it is easier to introduce the framework in a visual manner. Figure 13-11 offers a diagram that is provided by Oracle to represent a high-level map of the ADF framework.

click to expand
Figure 13-11: The Oracle ADF framework

In Figure 13-11, the areas that show shading are those that are completely ADF. The other areas are technologies that ADF integrates with and that are available as integrated options when utilizing the ADF framework. Let s start closest to the client tier and work our way back toward the data tier.

ADF JClient

JClient is the ADF Swing extension. It allows a developer to develop a Swing GUI while still having the robust support of the ADF BC (business components) framework behind it. If you are familiar with BC4J, note that the ADF BC is just BC4J in the context of the ADF framework.

ADF UIX

ADF UIX is the newest incarnation of the UIX tag libraries. This gives an option to utilize the UIX structure as an alternative to the JSP page development.

ADF Data Bindings and Data Controls

The bindings and data controls are what allow the application components to integrate with the ADF BCs so easily. All of the presentation-layer technologies listed have been enhanced or extended to integrate with this new layer.

Note  

The logic behind these technologies is rather complex and outside the scope of this chapter. If you re interested in the nuts and bolts of this layer, feel free to reference the Oracle white paper on the subject: http://www.oracle.com/technology/products/jdev/collateral/papers/10g/ADFBindingPrimer/index.html.

ADF Application Module

The next component is where we actually begin to encounter the components that were previously part of the BC4J framework. The concepts behind these components remain (relatively) the same, so if you re familiar with the BC4J framework, you may want to skip ahead a few sections. If you aren t, understand that the application module is the component that acts as the application interface into our persistence framework if we re utilizing the ADF BCs. The application module aggregates the view objects that we want to have available for this unit of work into a single container that we can access. We will cover working with application modules in more detail later, in the advanced example.

ADF View Object

The view objects are what we utilize to create filtered views of data based on our persistent entity objects (which we will cover next). There are actually quite a few things we can do with the view objects to help us to define how this data is organized. We will cover working with view objects in more detail in the advanced example.

ADF Entity Object

The ADF entity objects are fairly simple to understand. These objects are the base data objects for our framework. Most often, they are a direct reflection of tables in our database, but there are several ways to specify what the source of our persistent data is. Entity objects manage both the storage and retrieval of data into and out of the framework. There are some configuration options available for how entity objects behave. We will cover the entity objects in more detail in the advanced example.

TopLink

TopLink is one of the most widely recognized persistence frameworks in the industry. While looking at the diagram we just covered, you may have noticed TopLink referenced in several places. This is because after Oracle acquired TopLink, it was immediately provided as an option in 9 i . With 10 g , Oracle has integrated TopLink into the ADF framework. If you have a migration path that includes TopLink, you re all set. If you would like to utilize TopLink in place of the ADF BCs, you are able to do so while still retaining other areas of functionality provided by the ADF framework.

Other Integrated Features

There are other features that make use of some of the latest development and deployment technologies available to developers today. These features are integrated into Oracle JDeveloper 10 g and are summarized below.

Ant

Oracle JDeveloper 10 g comes integrated with Ant for automated building and deployment. Many of the most successful development methodologies recommend regular automated builds and deployments to a development environment to verify functionality and validity of the code base. Ant is the most prevalent open source build and deployment tool on the market. It is based around XML-defined build scripts that allow you to specify tasks , the source to be built, the method by which it should be built, and even a destination to deploy the completed application to. If you select a project within your application, right-click, select New, and look under the general section of the drill-down, you should find the Ant section, which gives you the option to import a buildfile, to create one based on the active project, or to create a blank buildfile. If you don t see the option, click the drop-down at the top of the gallery and change it from Project Technologies to All Technologies.

CVS (Concurrent Versions System)

CVS is easily the most widely recognized source control tool in the industry. Besides having functional benefits, it is historically significant. Some of the familiar branded source control tools such as Microsoft Visual Source Safe were actually developed utilizing CVS as the source control tool for the project. Anyone who has been doing development for any period of time will attest to the need for a source control tool available for the project. Anyone who has worked with CVS will be able to speak to the capabilities of the tool, but many may also speak of the difficulty with surmounting its learning curve. Due to the history of the project, it was not developed with any sort of fancy graphical interface ”it is essentially all command-line driven. Oracle JDeveloper 10 g eases some of the integration tasks with this by providing menu-driven options that are translated into command-line executions against the CVS repository you configure. You configure your connection to the CVS repository through the Connections tab of the Applications Navigator and can access the CVS commands themselves through the versioning menu item or by right-clicking appropriate items in the Applications Navigator pane.

JUnit

JUnit is one of the most popular unit testing tools on the market today. It was included as an optional plug-in for Oracle JDeveloper 9.0.3 and continues to be available in 10 g. The concept behind JUnit is simple: Developers create classes that act as external testing units for the code you are developing. These units have individual test cases, which are then aggregated into test suites. By continued aggregation, you can have test suites that encompass a unit of work, aggregate several units of work into a subsystem, and aggregate several subsystems into your entire application. JUnit testing is also available to be executed as an Ant build task, such that when your Ant tasks execute for your nightly build, they execute all of the JUnit tests for the code being built. Thus, not only is the build being tested , but the compilation and functionality tests for the application are all being carried out simultaneously . In the next section, we are going to cover a more advanced application example that will demonstrate several of the features of the 10 g ADF framework.

Note  

The default install of Oracle JDeveloper 10g does not come with the Junit plug-in extension. You must go to OTN to download and install the plug-in. The current plug-in extension is Jdev9052_Junit.zip.



Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net