CONTENTS | PREV | NEXT | INDEX J2EE BluePrints



6.7 Programming Access to Data and Functions

In an application that requires access to an enterprise information system, an Application Component Provider is responsible for programming access to resources managed by the enterprise information system, including tables, stored procedures, business objects, and transaction programs. The Application Component Provider also has to write the business and application logic when developing functionality of applications that target enterprise information system.

The API for accessing an enterprise information system belongs to two categories: a client-level API to access data and execute functions (for example, java.sql.PreparedStatement and java.sql.ResultSet in JDBC 2.0) and a system-level API for getting connections and demarcating transactions (for example, javax.sql.DataSource in JDBC 2.0).

In the J2EE programming model, a container assumes primary responsibility for managing connection pooling, transactions, and security. The level of service provided is based on the declarative specification of application requirements by an Application Component Provider or Deployer. This leaves an Application Component Provider to concentrate on programming access to data and functions being managed by an enterprise information system.


6.7.1 Client API for Enterprise Information System Access

A client API for accessing data and functions can be difficult to understand and use for one or more of the following reasons:

These factors increase the need for tools to support end-to-end application development. Application Component Providers also have to use additional programming techniques to simplify enterprise information system integration.


6.7.2 Tools for Application Development

The J2EE programming model recognizes that Application Component Providers will rely on enterprise development tools for simplifying development during enterprise information system integration. These tools will come from different vendors, provide varied functionalities, and serve various steps in the application development process. A number of these tools will be integrated together to form an end-to-end development environment. The tools include:

Since programming access to enterprise information system data and functions is a complex application development task in itself, we recommend that application development tools should be used to reduce the effort and complexity involved in enterprise information system integration.


6.7.3 Access Objects

A component can access data and functions in an enterprise information system in a couple of ways, either directly by using the corresponding client API or indirectly by abstracting the complexity and low-level details of enterprise information system access API into higher level access objects. An Application Component Provider comes across these access objects in different forms, scopes, and structure.

The use of access objects provides several advantages:

Since access objects primarily provide a programming technique to simplify application development through one or more of the above advantages, we recommend that Application Component Providers consider using them anywhere they need to access data or functions in an enterprise information system. In some cases tools may be available to generate such access objects. In other cases they will need to be hand-coded by Application Component Providers.

6.7.3.1 Guidelines for Access Objects

Here are some guidelines to follow in developing access objects:

6.7.3.2 Examples of Access Objects

Access objects can be used in a number of ways, as represented in the following examples:


PurchaseFunction pf = // instantiate access object for PurchaseFunction
// set fields for this purchase order
pf.setCustomer("Wombat Inc");
pf.setMaterial(...);
pf.setSalesOrganization(...);
po.execute();
// now get the result of purchase requisition using getter methods
6.7.3.3 Usage Scenarios for Access Objects

A component can use access objects in different ways depending on the functionality they offer. A couple of common ways to use access objects would be:



CONTENTS | PREV | NEXT | INDEX
Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved.