Java comes with its own middleware for distributed programming called RMI (Remote Method Invocation). RMI is also the core middleware used by Enterprise Java Beans (EJB). Because RMI uses the CORBA/IIOP stack as transport layer, it is possible to use CORBA to interoperate with every distributed Java application (not only with genuine CORBA applications written in Java). This technology is based on the OMG Java-to-IDL mapping specification. J-Integra® Espresso's Java Connectivity feature supports this mapping (i.e. .NET code may interoperate with Java RMI applications in server or client mode).
Originally intended for embedded programming (named "Oak" at that time), Java was primarily designed for client side applications, specifically as the basis for "Applet" technology for use in the context of a web page.
Like its predecessors (mainly C++ and Smalltalk), Java is a pure object oriented language. It is strongly typed, has an efficient memory management system ("garbage collection"), and runs on top of the Java Virtual Machine (JVM). The specification of the JVM is public, and Java has subsequently been ported to a great variety of platforms. From the point of view of its basic structure, Java and C# are pretty similar.
With its second version ("Java 2"), Java was leveraged by some important enhancements, clearly targeting the server side:
The Java 2 Enterprise Edition (J2EE) is a broad collection of "enterprise level" APIs. Most of it is freely available from Sun. 3rd-party components are usually attached via Service Provider Interfaces (SPIs), using generic configuration mechanisms. Within J2EE, there are standard APIs for crypthographic algorithms, for transaction processing, for access to naming and directory services, for accessing Message Oriented Middleware (MOM), and messaging in general.
All these APIs are integrated within an embracing architecture, which is commonly associated with the term "Application Server" (or "AppServer" for short). An AppServer will usually be embedded within a 3 or 4 Layer Architecture:
The very core of the AppServer sitting in the center of this architecture is the EJB Server, hosting one or more EJB Containers (the EJB Server and EJB Containers are typically provided by the same vendor, so there is no clear demarcation between both). They provide a rich enterprise-oriented infrastructure for Enterprise Java Bean components. EJBs have some well-defined attributes:
The EJB 1.0 standard (the current version is 2.0) defined a pure EJB Architecture. The EJB Server did not host any other components than EJBs. So EJB was a mere middle-tier technology for providing business logic. Since EJB 1.1, Java Server Pages (JSP) allow spreading Java code snippets across an HTML page. The code snippets will be dynamically compiled into standard Servlets hosted by the web server's Servlet Engine. The J2EE Architecture allows integration of all components of a web application (EJBs, as well as Servlets/JSPs) within one hosting environment. The following is a short summary of the whole J2EE architecture:
Behind J2EE, there is a fine grained component model (as opposed to the more coarse grained CORBA components). Though a CORBA component usually embraces a big chunk of business logic (most of the time a whole application on its own), Enterprise Java Beans prefer smaller components (e.g. a single account in a banking application may be represented by a dedicated 'Account EJB', and the process of generating a consolidated balance over a couple of accounts by a 'Balance EJB'). This concept leads to the following distinctions:
A common problem with fine grained component models is the management of large amounts of similar objects (e.g. thousands of accounts within a bank application). Usually, one uses the approach of an explicit SELECT statement on a database table to retrieve the intended object. But this is not possible if the database access is encapsulated within a fine grained component (e.g. within an "AccountBean").
EJBs resolve this issue by using the "Home" pattern:
The actual EJB will be generated from these classes (provided by the developer) within the (vendor specific) deployment process. Therefore, the Bean Class does not "syntactically" implement the Remote Interface (using Java's "implements" clause). There is only a rather weak syntactical connection between the parts of the bean.
During deployment, each bean's Home Interface will be registered with its name within a naming service. It can be retrieved by any (Java) client using the Java Naming and Directory Interface (JNDI). The Home Interface serves as a factory for the bean's instances. Once the client has access to the bean's Home Interface, it may create a new instance or (for Entity Beans) retrieve an existing instance.
Using J-Integra® Espresso, the standard EJB architecture may be accessed by Microsoft's .NET framework, thus allowing EJBs to be accessed by Microsoft's popular .NET presentation logic (which is tightly integrated into the most widespread client desktop platforms today).