Hello and welcome to Java's Karma - The Cosmic Cup. The word Karma originates from Hinduism and means fate or destiny; or the cosmic principle according to which each person is rewarded or punished in one incarnation according to that person's deeds in a previous incarnation. In this column, we will examine Java's Karma - Java in its rapid incarnations; new and upcoming Java technologies that are going to determine Java's role in the computing world.
Indeed, Java has already moved beyond the realm of a programming language and holds the promise of uniting enterprise computing under one large umbrella. We will examine and explore new APIs, learn how to apply existing ones and develop example applications that illustrate how various technologies play together. I would like this column to evolve based on feedback from the readers. If you would like to see coverage on a particular topic, more information on another, or have any suggestions regarding the general theme of the column, please let me know and I will try to address your requests in future articles.
This month we will examine the role of Java in business computing, or the Enterprise. Java has, as promised, extended beyond just a programming language to a platform for distributed computing that holds the promise of solving a myriad of business problems.
When Java first made its public appearance, it was associated with a group of eleven buzzwords - simple, object-oriented, distributed, robust, secure, architecture neutral, portable, interpreted, high performance, multithreaded and dynamic. Of these, simple, object-oriented, portable, interpreted and multithreaded define the nature of the Java programming language. The Java Platform for the Enterprise attempts to make "distributed, robust, secure, architecture neutral, and portable" a reality. High performance is an aspect that will ultimately determine the feasibility of using Java in various applications.
The following sections discuss the APIs that attempt to fulfill the promise of a "Java Enterprise Platform." First, the Java APIs that constitute Enterprise Java are identified. This is followed by brief descriptions of these APIs and discussions of their role in the enterprise. (Note: I use "Java Platform" and "Enterprise APIs" interchangably. All references here to either term should be interpreted as references to the Java Enterprise APIs.
The Java Platform for the
So, is Java a language or a platform? Well, Java made its public debut as a language for the Internet that could be used to develop cool, interactive Web pages. But it has always been more than just another programming language. The language itself provided the core APIs in different fields of computing such as networking, graphics, etc. But it also was structured for expansion and provided hooks for plugging in enhancements and other related technologies in the fields of networking, graphics, telephony, messaging, databases, etc., which would plug and play together to solve computing problems in the business world. Many of these technologies have matured over the last couple of years and are instrumental in defining the role of Java as a platform for distributed computing.
The Java Platform for the Enterprise is a framework that will be used in developing applications for enterprise computing. In today's Internet era, that inherently implies support for a distributed architecture. The Java Platform consists of a group of Java core and extension APIs (i.e., not a part of the standard JDK) supplied by Sun Microsystems, Inc., that support this architecture. These may be categorized as:
There are other Java extension APIs that are not directly a part of the Java Platform but instead support the Platform APIs for development of enterprise applications.
- Enterprise JavaBeans (EJB) and related APIs: Suite of APIs that provides extensions to existing applications and enable a separation between the business logic of a computing solution and the core infrastructure
- Connectivity APIs: Suite of APIs that provides connectivity between core Java applications/applets and other frameworks in distributed computing
- Enterprise Services APIs: Suite of APIs that provides computing services used to develop enterprise applications
The Java Enterprise APIs and their roles are illustrated in Table 1.
The Java Enterprise APIs
The following sections provide a very brief introduction to the Java Enterprise APIs. For the APIs still in their preliminary stages, an overview of the modules they support is provided.
Figure 1 shows how the Enterprise APIs form the architecture of the Java Platform for the Enterprise. The Connectivity APIs and the Enterprise Services are used to build and support the core reusable components of the Java Platform - Enterprise JavaBeans. EJBs may be used directly for the development of business applications.
EJB is the core API for the Java Platform. It defines a server component model for building multi-tier distributed applications by combining Java components developed by different enterprise vendors. EJB component development uses all the other APIs in the Java Platform.
The EJB API has recently been released as a draft specification for public review version 0.9. Discussion of the API will be covered in a future article.
EJB architecture defines five roles in the application development and deployment workflow. These roles are described here:
Java DataBase Connectivity
- Enterprise Beans Provider: An applications domain expert who develops reusable EJBs, each of which implements some business logic
- Application Assembler: A domain expert who creates applications out of EJBs
- Deployer: An expert at a specific operational environment who is responsible for the deployment of EJBs and their containers
- EJB Container Provider: A system-level programmer who develops a scalable, secure, transaction-enabled system
- EJB Server Provider: A specialist in the area of distributed transaction management, distributed object and system-level services who publishes low-level interfaces to allow third parties to develop containers
JDBC is the database connectivity package now included in the core Java API. The API consists of objects used by an application to communicate with the DBMS. In the API, there are four main interfaces, based on relational database concepts:
JDBC enables applications to connect to what is usually the nth tier in an n-tier architecture; i.e., the data source. It enables Java to be database-independent by accessing the databases via Pure Java JDBC drivers.
- DriverManager: Enables applications/ applets to download database drivers via a URL and causes establishment of a connection to the database
- Connection: Represents the connection to the database obtained via a getConnection() method of the DriverManager class
- Statement: Represents a SQL query statement passed to the database
- ResultSet: Represents rows of data returned from the execution of a query against the database
Remote Method Invocation
The Java RMI package is also part of the core Java API. It provides a mechanism for interaction between distributed Java objects that are similar to CORBA's IIOP. In addition, it uses Java's serialization interface to allow transfer of object instances between remote objects. RMI provides the ability for Java objects to execute methods on objects on remote Java objects and get back results from the method call. There are three main interfaces in the API:
Using RMI involves writing a remote object and then writing its server implementation. An Object Registry runs on the server to help locate the server implementation of the remote object. RMI helps define the middle-tier in a distributed Java application.
Some extensions to RMI address reverse mapping; i.e., from the Java language to CORBA IDL.
- Remote: A marker (empty) interface that all remote interfaces must extend
- UnicastRemoteObject: Acts as a base class for server implementations in RMI
- RemoteException: Acts as a base class for many of the exceptions thrown by RMI remote method calls.
Java Interface Definition Language
Java IDL is a Java API that allows development of multi-tier distributed applications by leveraging the standards defined by CORBA. It provides a Java mapping to CORBA and complies with the OMG standard for the CORBA 2.0 IIOP standard. This allows Java IDL programs to be used with CORBA 2.0-compliant ORBs (Object Request Brokers) across TCP/IP networks.
For CORBA programmers, Java provides an OMG-compliant reference implementation of an ORB. It provides the Java language mapping for the CORBA IDL.
In contrast to RMI, Java IDL enables communication between heterogeneous objects; i.e., between objects implemented in Java and other languages like C/C++, Smalltalk, etc.
Java Naming and Directory Interface
The JNDI API provides a unified interface to multiple naming and directory enterprise services. It is designed to be independent of any specific directory implementation and based on access to LDAP, NDS, NIS, DNS, etc. Standard services like name/address lookup, searches and filters are provided by the API. The main interfaces of the JNDI API are:
The JNDI API specification is an extension API to the core JDK.
- Context: Core interface that specifies the naming context; operations such as adding/removing a name to the object-binding, looking up a name, etc.
- DirContext: Defines methods for examining and updating attributes associated with a directory object; also capable of providing a naming context and supporting searches
- Service Provider Interface (SPI): Provides the means by which different naming/directory service providers (SPs) can develop and hook up their directory implementations
Java Management API
The JMAPI provides the user interface guidelines, Java classes and specifications for developing integrated system, network and management applications that can be used across different operating systems, architectures and network protocols. It consists of the following:
Java Transaction Service
- JMAPI Style Guide: Provides guidelines for developing Web-based user interface in Java
- Admin View Module (AVM): An extension of the AWT that is specially designed for developing UI for distributed management applications
- The Base Object Interfaces: Supports constructing objects that represent distributed resources and services comprising the enterprise computing environment
- Managed Container Interfaces: Allows management applications to perform actions on a single group of managed objects, instead of each instance
- Managed Notification Interfaces: Provides the basic foundation from which more complex event management services can be built easily
- Managed Data Interfaces: Supports mapping classes and instances of the Base Objects to a relational database
- Managed Protocol Interfaces: Provides the infrastructure to perform distributed operations securely
- SNMP Interfaces: Allows extensions of the Base Objects to contain information obtained from existing SNMP agents
- Applet Integration Interfaces: Allow software developers to integrate their Java applets into the JavaManagement API
The JTS is a low-level API used by sophisticated transactional application programs, resource managers, transaction processing monitors, transaction-aware communication managers and transaction managers. JTS's role is to ensure their interoperability in the Java environment. JTS is compatible with the Object Management Group's Transaction Service (OTS) specification. JTS extends the OTS specification in two areas: It incorporates the Synchronization interface defined in the in-progress draft of the upcoming revision of OTS, and it specifies how a transaction context can be propagated through other communication protocols.
JTS version 0.5 is open to public review.
Java Message Service
JMS is still in the pre-API stage. It will provide a standard for message-based enterprise communication such as:
- Publish/subscribe for smart communication between objects
- Reliable queuing
- Push/push technologies
In this article we examined the Java Enterprise APIs and learned the role of the Java Platform in the business industry. We briefly examined the roles played by individual APIs that make up the Java Platform for the Enterprise. Detailed information on all these APIs may be obtained from Sun's Java Website, java.sun.com/products.
So far we have browsed over the pieces that make up the Java Enterprise APIs. The larger part of this technology is still in the rudimentary stages and is continually evolving. In some of the forthcoming columns we will explore these APIs in detail and explore how these parts will come together to make the whole.
The Java Platform is not the first attempt in the computing industry to define a common standard for enterprise solutions. IBM tried to standardize the hardware via Personal Computers. Microsoft tried to limit the software to one platform and operating system. With the Java Platform, are we not seeing an attempt to limit enterprise computing to one "software platform?"
About the Author
Ajit Sagar is a member of the Technical Staff at i2 Technologies, Dallas, TX. He holds a B.S. in Electrical Engineering from BITS, Pilani, India and an M.S. in Computer Science from Mississippi State University. Ajit focuses on UI, networking and middleware architecture development.He has 7-1/2 years of programming experience and two in Java.