[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No Subject



<P>
Now let's jump forward to some point in the near future when the major
DBMS and transaction monitor vendors all support the Java platform for
the enterprise.  (Coincidentally, as I was in the process of writing
this article, Oracle announced the fall 1998 release of Oracle8.1 and
its "300% Java" initiative.  Surprise!  It will fully support the EJB
1.0 specification.  Using EJB and JDBC, you could build server
components, accessible via CORBA/IIOP, that take advantage of the EJB
APIs.  This means that your entire component, or bean, could be
uprooted from Oracle8.1 and installed in an EJB-aware Sybase server
with no changes to the code.

<P>
Is the light fully on and blazing in your head yet?  If not, read on.
(Even if it is, don't link out of here just yet!)

<P>
We'll spend the rest of this article discussing EJB
from a fairly high-level perspective.  In the coming months, as real
products that implement this specification begin to emerge, we'll
build some live applications that take advantage of this revolutionary
new API.

<P>
<FONT SIZE="+1"><STRONG>EJB: Server-side component model for the future</STRONG></FONT><BR>
EJB promises to standardize middle-tier server
development in a way that no other technology to date has been able to
do.  Not only does EJB have the backing of the major enterprise players
(IBM, Sun, Baan, BEA Systems, Netscape, Novell, Oracle, Sybase,
Informix, Lotus, Gemstone, Tandem, and others), but the popularity of
Java, and, most importantly, the need for a well-thought-out,
easy-to-use, portable component model for server applications have made
this technology a shoo-in for success.

<P>
Rather than coming up with my own definition, I'll quote Sun's 
documentation definition of EJB:

<P>
<blockquote>
<em>Enterprise JavaBeans is a cross-platform component architecture for
the development and deployment of multi-tier, distributed, scalable,
object-oriented Java applications.  Enterprise JavaBeans makes it
</em>easy<em> to write business applications as components by providing
a set of automatic services to support scalable transactional
application server components.  Enterprise JavaBeans can be deployed on
top of existing transaction processing systems including traditional
transaction processing monitors, web servers, database servers,
application servers, etc.</em>
</blockquote>

<P>
The EJB 1.0 specification unequivocally states the goals behind the
design of the EJB component model. Here are just a few of them:

<P>
<UL>
<LI>EJB will be the standard component architecture for building
distributed object-oriented business applications in the Java
programming language.

<P>
<LI>EJB will make it easy to write applications: Application developers
will not have to understand low-level transaction and state management
details, multithreading, resource pooling, and other complex low-level
APIs.

<P>
<LI>The EJB architecture will define the contracts that enable tools
from multiple vendors to develop and deploy components that can
interoperate at runtime.

<P>
<LI>The EJB architecture will be compatible with existing server
platforms. Vendors will be able to extend their existing products to
support EJB.

<P>
<LI>The EJB architecture will be compatible with CORBA.
</UL>

<P>
It should come as no surprise to find that EJB, like all other Java
technologies, is a platform-independent, object-oriented technology.
Each Enterprise JavaBean will be required to execute within a component
execution environment that must comply with the EJB 1.0 specification.
This approach will ensure that each execution environment (or
<em>container</em>) implements a defined set of interfaces.  The end
result will be that each Enterprise JavaBean can be uprooted from one
execution environment and placed in another one without requiring any
recoding (that is, assuming that no vendor-specific APIs are used).
Each Enterprise JavaBean will be required to define and implement a
Java remote interface so that it can be accessed from a Java client
using RMI.  This makes RMI the default communications mechanism for
Enterprise JavaBeans.  It is important to note, however, that
Enterprise JavaBeans can also be accessed via the CORBA Internet
InterORB Protocol (IIOP).  This will allow Enterprise JavaBeans to be
accessed from both Java clients (using RMI) and other clients (via
IIOP).  The CORBA implementation details will be hidden from the EJB
developer.

<P>
Naturally, an Enterprise JavaBean can make use of all of the existing
features inherent in the Java platform, including threads, persistence,
and security.

<P>
<FONT SIZE="+1"><STRONG>What is a JavaBean and how does it differ from an Enterprise JavaBean?</STRONG></FONT><BR>
JavaBeans is the name of the component model developed for Java and
included with the Java 1.1 platform.  It provides a mechanism for
component-based development in Java, and more often than not, JavaBeans
are visual components --  grids, calendars, and charts, for example --
that are reused across applications.  Each JavaBean can be viewed by
its client container application as a set of properties, methods, and
events that can be manipulated at design-time and at runtime. Java's
serialization and introspection capabilities allow JavaBeans to be
dragged onto a form in a Java IDE (Visual Caf&eacute;, for example),
have their properties set by the developer at design-time, then be
viewed and manipulated by a user at runtime. A standard JavaBean is, by
definition, a client-side component that cannot, by default, be
accessed and manipulated by other clients at runtime.

<P>
Enterprise JavaBeans, meanwhile, have no user interface component and
reside entirely on an EJB-aware server.  In the future, this could be a
transaction processing monitor such as BEA's Tuxedo, a database
management system such as Oracle or Sybase, or a Web application server
from Netscape or NetDynamics.  The Enterprise JavaBeans 1.0
specification details the requirements that these server containers
must meet and how they will work with Enterprise JavaBeans components.
While standard JavaBeans properties are hard-wired into code,
Enterprise JavaBeans support customization at runtime via environment
properties.  Enterprise JavaBeans also differ in the way they are
actually distributed.  A new distribution format, known as an
<EM>ejb-jar</EM> file contains a JAR file manifest, Java class files
for the Enterprise JavaBean, deployment descriptors, and environment
properties specifying the properties the bean will require at runtime.

<P>
Currently, two types of Enterprise JavaBeans are described in the
specification:  Entity and session beans.  Session objects will exist
for the life of a single client application and disappear should the
server crash.  Entity objects are persistent objects that may be used
by many users across crashes or shutdowns of the server.  To comply
with the EJB 1.0 specification, a container need only support session
objects, although entity object support will be a requirement in the
2.0 specification.

<P>
<FONT SIZE="+1"><STRONG>Transaction management using EJB</STRONG></FONT><BR>
Most notable among all of an Enterprise JavaBean's features is its
support for distributed transactions.  Thanks to the required
capabilities of an EJB container, an EJB developer can
seamlessly update multiple databases distributed across multiple
locations without having to write any of the "low-level" logic that
becomes necessary to commit or rollback multiple transactions.  Each
EJB container is required to implement the
<code>javax.jts.UserTransaction</code> interface, shown below, which is
a small portion of the Java Transaction Service (JTS) API.

<P>
<PRE>
public interface javax.jts.UserTransaction
{
	public final static int STATUS_ACTIVE;
	public final static int STATUS_COMMITTED;
	public final static int STATUS_COMMITTING;
	public final static int STATUS_MARKED_ROLLBACK;
	public final static int STATUS_NO_TRANSACTION;
	public final static int STATUS_PREPARED;
	public final static int STATUS_PREPARING;
	public final static int STATUS_ROLLEDBACK;
	public final static int STATUS_ROLLING_BACK;
	public final static int STATUS_UNKNOWN;
	public abstract void begin();
	public abstract void commit();
	public abstract int getStatus();
	public abstract void rollback();
	public abstract void setRollbackOnly();
	public abstract void setTransactionTimeout(int seconds);
}
</PRE>

<P>
In addition to performing transactions across multiple databases at multiple locations, an Enterprise JavaBean can also initiate multiple transactions across multiple EJB servers.  The EJB servers work together to propagate the transaction context across each server, a process that is totally transparent to both the client and Enterprise JavaBean component programmer.  Each Enterprise JavaBean possesses a transactional attribute that can be modified by tools provided with the container/server application. The possible values of this attribute include:

<P>
<UL>
<LI><code>TX_NOT_SUPPORTED</code> -- The bean does not support transactions
<LI><code>TX_BEAN_MANAGED</code> -- The bean uses the <code>javax.jts.UserTransaction</code> interface to demarcate transaction boundaries
<LI><code>TX_REQUIRED</code> -- The bean must execute within the context of a transaction
<LI><code>TX_SUPPORTS</code> -- The bean supports, but doesn't require, a transaction context
<LI><code>TX_REQUIRES_NEW</code> -- The bean must execute within a new transaction context
<LI><code>TX_MANDATORY</code> -- The bean must execute within an existing client transaction context
</UL>

<P>
The ability to seamlessly perform distributed transactions in a vendor- and platform-independent manner is perhaps this technology's biggest drawing card.  To reiterate, this will allow an Enterprise JavaBean to be moved transparently among different vendors' EJB
containers with no code change (assuming that no vendor-specific APIs are used when building the Enterprise JavaBean).  

<P>
<FONT SIZE="+1"><STRONG>The relationship between CORBA and EJB</STRONG></FONT><BR>
In addition to distributed transaction coordination, the EJB specification also defines how Enterprise JavaBeans will map to CORBA objects.  Due to the requirements in the specification, the following scenarios will be possible:

<P>
<UL>
<LI>A CORBA client (written in C++, COBOL, or any other programming language supported by CORBA) can access Enterprise JavaBeans

<P>
<LI>A client program can mix calls to CORBA and EJB objects within a transaction

<P>
<LI>A transaction can span multiple EJB objects that are located on multiple CORBA-based EJB servers, provided by different vendors
</UL>

<P>
This means that there are two basic types of clients that can use an Enterprise JavaBean:

<P>
<OL>
<LI>An Enterprise JavaBean/CORBA client that uses the JNDI to locate objects, RMI over IIOP to communicate with remote objects, and the <code>javax.jts.UserTransaction</code> to perform transactions.  Note that this client can be written with no knowledge of CORBA or its Interface Definition Language (IDL).  Instead, the runtime implicitly uses IDL based on the Enterprise JavaBeans Java remote interface.

<P>
<LI>A standard CORBA client written in a programming language with a CORBA IDL mapping defined.  This type of client would locate the client using a COS naming service, CORBA IDL to manipulate the objects, and the Object Transaction Service (OTS) to perform transactions.
</OL>

<P>
Note that in order for the first client type to exist, the ability to use RMI
over IIOP must also exist.  This ability is not currently in place,
but Sun is working on it.  When completed, RMI over IIOP will make
use of the CORBA pass-by-value extension and will allow Java
applications to fully interoperate with CORBA applications developed in
other programming languages.  This technology is expected via an "early
access" release this summer, and will also ship as a standard extension
to JDK 1.2.

<P>
I'm hoping that you can now see the value of my previous columns (see
<a href="#resources">Resources</a>), which focused on the CORBA
specification and showed how it worked so seamlessly with Java.  In the
near future, CORBA will be the glue binding both client and server
objects together, no matter if they were written in Java, C++, COBOL,
or even Smalltalk. 

<P>
<FONT SIZE="+1"><STRONG>Conclusion</STRONG></FONT><BR>
EJB promises to become the one technology that truly
solidifies Java's foothold in the world of enterprise computing.  Just
as many IS managers were beginning to fear that Java was becoming a language
useful only for building animated dancing-head applets, Sun has
produced a specification that could become the standard for building
interoperable, distributed, component software development. 

<P>
We will be looking at the Java platform for the enterprise in more
depth in coming months, and will, of course, particularly focus on
areas of interest to the world of distributed objects.  My mailbag is overflowing
with reader requests for column topics -- such as a further explanation 
of CORBA's DII capabilities, a look at the Java Transaction Service, and in-depth remote
method invocation -- which should keep me busy over the next several months. Nonetheless, if you'd lke to add any specific technology or topic for future coverage, please contact me with your suggestions.
  
<IMG HEIGHT="8" WIDTH="8" SRC="http://www.javaworld.com/javaworld/icons/dingbat.gif">
<P>

<!-- end body text -->

<P>
<FORM METHOD="POST" ACTION="http://www.javaworld.com/javaworld/cgi-bin/jw-nav.cgi">
<SELECT NAME="jump_list">
<option value="http://www.javaworld.com/javaworld/jw-06-1998/index.html">
Also this month in JavaWorld
<option value="http://www.javaworld.com/javaworld/jw-06-1998/index.html#nuts"> 
Nuts & Bolts:
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-undoredo.html"> - Add an undo/redo function to your Java application with Swing 
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-techniques.html"> - Object finalization and cleanup
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-indepth.html"> - Using threads with collections, part 2</strong></h2>
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-media.html"> - Introduction to Java media programming
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-step.html"> - Step by Step: Draw textured spheres
<OPTION VALUE="http://www.javaworld.com/javaworld/javatips/jw-javatip54.html"> - Java Tip 54: Returning data in reference arguments via JNI
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-howto.html"> - Agents: An introduction
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-object-pool.html"> - Build your own ObjectPool in Java 
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-beans.html"> - Turn Java classes into JavaBeans
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-sound.html"> - Improve your programs with practical audio

<option value="http://www.javaworld.com/javaworld/jw-06-1998/index.html#news">
News & Views:
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-realworld-crossworlds.html"> - Real-world Java: CrossWorlds packages processware with Java 
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-blundon.html"> - Java in Wonderland 
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-newsbriefs.html"> - News and New Product Briefs (5/15/98)
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-bookreview.html"> - Data structures and algorithms: A comparative review of 5 Java DS&A books 
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-realworld-etrade.html"> - E-Trade to keep bulls and bears in line with Java
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-letters.html"> - Letters to the Editor
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-iw-javamarket.html"> - Java draws wide market interest
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-iw-win98.html"> - Sun to seek injunction barring incompatible versions of Java in Windows 98
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-jcentral.html"> - Code-centric search tool strives to reduce Java development time
<OPTION VALUE="http://www.javaworld.com/javaworld/jw-06-1998/jw-06-pollresults.html"> - Java Plug-in reader poll highlights 
</SELECT>
<INPUT TYPE="SUBMIT" VALUE="Go">
</FORM>

<P>
<P>
<CENTER><IMG WIDTH="432" HEIGHT="7" SRC="http://www.javaworld.com/javaworld/icons/greenline.gif"></CENTER>
<P>
<A NAME="resources"><STRONG>Resources</STRONG></A>
<UL>
<LI>Find out more about the Java Naming and Directory Interface, another piece of the enterprise platform, which is intended to give Java developers the tools required to access naming and directory services for enterprise-class applications<br>
<a href="http://java.sun.com/products/jndi/">http://java.sun.com/products/jndi/</a> 

<LI>Check out the Enterprise JavaBeans 1.0 specification<br> <a href="http://java.sun.com/products/ejb/docs.html">http://java.sun.com/products/ejb/docs.html</a>

<LI>Get more information, plus a really slick demo (with great applets) on Java Management API (JMAPI)<br>
<a href="http://java.sun.com/products/JavaManagement/">http://java.sun.com/products/JavaManagement/</a>

<LI>Look over the Java Message Services (JMS) specification<br> <a href="http://java.sun.com/products/jms/docs.html">http://java.sun.com/products/jms/docs.html</a>

<LI>Look over the Java Transaction Service (JTS) specification and interfaces<br>
<a href="http://java.sun.com/products/jts/">http://java.sun.com/products/jts/</a>

<LI>Oracle Corporation's Network Computing Architecture<br>
<a href="http://www.oracle.com/nca/">http://www.oracle.com/nca/</a>

<LI>Find out more about Oracle's decision to fully support the Enterprise JavaBeans 1.0 specification in Oracle8.1<br> <a href="http://www.oracle.com/cgi-bin/press/printpr.cgi?file=980415.9987.html&mode=corp&td=1&tm=5&fd=1&fm=04&status=Search&ty=98&limit=50&fy=98">http://www.oracle.com/cgi-bin/press/printpr.cgi?file=980415.9987.html&mode=corp&td=1&tm=5&fd=1&fm=04&status=Search&ty=98&limit=50&fy=98</a>

<LI>Two great <em>JavaWorld</em> articles explore RMI and RMI/JavaIDL in Java 1.2
<UL>
<LI>"<a href="http://www.javaworld.com/javaworld/jw-10-1997/jw-10-step.html">Increase the functionality in your distributed client/server apps</a>"<br>
<LI>"<a href="http://www.javaworld.com/javaworld/jw-04-1998/jw-04-distributed.html">Java 1.2 extends Java's distributed object capabilities</a>"
</UL>

<LI>Take a look at a number of great <em>JavaWorld</em> articles covering JDBC<br>  
<a href="http://www.javaworld.com/javaworld/common/jw-ti-jdbc.html">http://www.javaworld.com/javaworld/common/jw-ti-jdbc.html</a>
</UL>

<strong>Previous Distributed Object columns</strong>
<UL>
<LI>"<A HREF="http://www.javaworld.com/javaworld/jw-04-1998/jw-04-distributed.html">Java 1.2 extends Java's distributed object capabilities</A>" -- Find out what RMI and Java IDL, Java 1.2's seemingly similar distributed object technologies, have to offer you.

<LI>"<A HREF="http://www.javaworld.com/javaworld/jw-01-1998/jw-01-corbalegacy.html">Applied CORBA: Integrating legacy code with the Web</A>" -- Find out how to Webify existing object-oriented code.

<LI>"<A HREF="http://www.javaworld.com/javaworld/jw-10-1997/jw-10-corbajava.html">CORBA meets Java</A>" -- Learn to build a distributed Java applet that accesses server objects using CORBA.
</UL>
</UL>
<CENTER><IMG WIDTH="432" HEIGHT="7" SRC="http://www.javaworld.com/javaworld/icons/greenline.gif"></CENTER>
<P>
<STRONG>About the author</STRONG><BR>

Bryan Morgan is a senior member of the technical staff with  <A HREF="http://www.tasc.com/">TASC Inc.</A> (http://www.tasc.com). He currently is using CORBA and Java to build a distributed spatial query application as part of an internal R&D project. Bryan has co-authored several books for Sams Publishing, including <EM>Visual J++ Unleashed</EM> and <EM>Java Developer's Reference</EM>. He holds a B.S. in Electrical Engineering from Clemson University.

Reach Bryan at <A NAME="author" HREF="http://www.javaworld.com/javaworld/cgi-bin/jw-mailto.cgi?bryan.morgan@javaworld.com+/javaworld/jw-06-1998/jw-06-distributed.html+author">bryan.morgan@javaworld.com</a>.
<BR CLEAR="ALL")

<P>
<FORM METHOD="POST" ACTION="http://www.javaworld.com/javaworld/cgi-bin/jw-mini-survey.cgi?1998-jw-06-distributed.html">
<a name="mini-ditka">
<strong>What did you think of this article?</strong><br>
</a>

<table width="100%" cellpadding="0" border="0">
<tr> <td align="left" valign="top" rowspan="1" colspan="1">

<INPUT TYPE="radio" NAME="worth" VALUE="3">-Very worth reading<br>
<INPUT TYPE="radio" NAME="worth" VALUE="2">-Worth reading<br>
<INPUT TYPE="radio" NAME="worth" VALUE="1">-Not worth reading<br>

</td> <td align="left" valign="top" rowspan="1" colspan="1">

<INPUT TYPE="radio" NAME="length" VALUE="3">-Too long<br>
<INPUT TYPE="radio" NAME="length" VALUE="2">-Just right<br>
<INPUT TYPE="radio" NAME="length" VALUE="1">-Too short<br>

</td> <td align="left" valign="top" rowspan="1" colspan="1">

<INPUT TYPE="radio" NAME="tech" VALUE="3">-Too technical<br>
<INPUT TYPE="radio" NAME="tech" VALUE="2">-Just right<br>
<INPUT TYPE="radio" NAME="tech" VALUE="1">-Not technical enough<br>

</td>
</tr>
</table>

<table cellpadding="0" border="0">
<tr> <td align="left" valign="top" rowspan="1" colspan="1">

<TEXTAREA NAME="comments" COLS="40" ROWS="3">Comments: </TEXTAREA>

</td> </tr>
<tr> <td align="left" valign="top" rowspan="1" colspan="2">

<TEXTAREA NAME="comments" COLS="30" ROWS="1" WRAP="VIRTUAL">Name: </TEXTAREA>

</td> </tr>
<tr> <td align="left" valign="top" rowspan="1" colspan="2">

<TEXTAREA NAME="comments" COLS="30" ROWS="1" WRAP="VIRTUAL">Email: </TEXTAREA>

</td> </tr>
<tr> <td align="left" valign="top" rowspan="1" colspan="1">

<TEXTAREA NAME="comments" COLS="30" ROWS="1" WRAP="VIRTUAL">Company Name: </TEXTAREA>
&nbsp;&nbsp;&nbsp;&nbsp;

</td> <td align="left" valign="bottom">

<INPUT TYPE="submit" VALUE="Send data">

</td> </tr> </table>

</FORM>
<P>
<center>
<a href="http://www.javaworld.com/javaworld/jw-06-1998/index.html"><img border="0" width="74" height="21" src="http://www.javaworld.com/javaworld/icons/b-home.gif" alt="[JavaWorld Main Page]"></a>
<a href="http://www.javaworld.com/javaworld/search.html"><img border="0" width="107" height="21" src="http://www.javaworld.com/javaworld/icons/b-search.gif" alt="[JavaWorld Search]"></a>
<a href="http://www.javaworld.com/javaworld/jw-06-1998/index.html#nuts"><img border="0" width="107" height="21" src="http://www.javaworld.com/javaworld/icons/b-nuts2.gif" alt="[Nuts & Bolts]"></a>
<a href="http://www.javaworld.com/javaworld/jw-06-1998/index.html#news"><img border="0" width="107" height="21" src="http://www.javaworld.com/javaworld/icons/b-news.gif" alt="[News & Views]"></a>
<a href="http://www.javaworld.com/javaworld/jw-06-1998/index.html#res"><img border="0" width="107" height="21" src="http://www.javaworld.com/javaworld/icons/b-jr.gif" alt="[Java Resources]"></a>
</center>
<P>
<CENTER><A HREF="http://www.javaworld.com/javaworld/common/jw-copyright98.html"><IMG BORDER="0" width="338" height="20" SRC="http://www.javaworld.com/javaworld/icons/b-copyright98.gif" ALT="[(c) Copyright 1998 Web Publishing Inc., an IDG Communications company]"></A></CENTER>
<P>
If you have problems with this magazine, contact
<A NAME="webmaster" HREF="http://www.javaworld.com/javaworld/cgi-bin/jw-mailto.cgi?webmaster@javaworld.com+/javaworld/jw-06-1998/jw-06-distributed.html+webmaster">webmaster@javaworld.com</A>
<BR>
URL: http://www.javaworld.com/javaworld/jw-06-1998/jw-06-distributed.html
<BR>
Last modified: <!--#echo var="LAST_MODIFIED"-->
</TD></TR></TABLE></BODY>
</HTML>

To unsubscribe send a note to majordomo@cs.fiu.edu with the body of the message
being: unsubscribe cadse-orb