Introduction to J2EE
- Introduction to J2EE
- Model 1 Architecture
- Model 2 Architecture[ MVC : Model View Controller ]
- J2EE as Multi Tier Architecture
- Terminology in J2EE
- J2EE Containers and its Type
- Application Servers Available for J2EE Components
|Introduction To J2EE|
The Java Platform, Enterprise Edition or Java EE (formerly known as Java 2 Platform, Enterprise Edition or J2EE) has undergone several changes since 1.0 as well as numerous additions of new specifications.
- JPE (May 1998)
- J2EE 1.2 (December 12 1999)
- J2EE 1.3 (September 24 2001)
- J2EE 1.4 (November 11 2003)
- Java EE 5 (May 11 2006)
- Java EE 6 (Dec 10, 2009)
The Java EE platform uses a distributed multi-tiered application model for enterprise applications:
- Application logic is divided into components according to function, and the various application components that make up a Java EE application.
- They are installed on different machines depending on the tier in the multi-tiered Java EE environment to which the application component belongs
|Model 1 Architecture|
|Model 2 Architecture|
Model 2 Architecture Also know as MVC Model. [ MVC : Model View Controller ]
Flow of Model – 2 Architecture:
|J2EE as Multi Tier Architecture|
The following figure explains the Distributed Multi-tiered Application.
Features of Distributed Multi-tiered Applications:
- Security constraints can be defined at deployment time.
- Java EE applications are made up of components.
- A Java EE client can be a Web client or an Application client.
- A Web page received from the Web tier can include an embedded applet.
- An application client runs on a client machine and provides a way for users to handle tasks that require a richer user interface than can be provided by a markup language.
- The server and client tiers might also include components based on the JavaBeans component architecture to manage the data flow between an application client or applet and components running on the Java EE server.
|Terminology in J2EE|
What is Web Application?
- A Web application is a built of the Web components that perform specific tasks and are able to expose their services over the Web.
- It is build using active and passive resources.
Active resources have their own processing capabilities; As for example Servlets, JSP.
Passive resources do not have processing capabilities; for example, html pages.
Web applications and the Web application server:
- A Web application resides in a Web application server (or application server).
- The application server provides the Web application with easy and managed access to the resources of the system.
Java EE Web components are either servlets or pages created using JSP technology (JSP pages) and/or Java Server faces technology.
Business code, which is logic that solves or meets the needs of a particular business domain such as banking, retail, or finance is handled by enterprise beans running in the business tier.
Enterprise Information System Tier:
The enterprise information system tier handles EIS software and includes enterprise infrastructure systems such as
- enterprise resource planning (ERP),
- mainframe transaction processing,
- database systems, and
- other legacy information systems.
Normally, thin-client multi-tiered applications are hard to write because they involve many lines of intricate code to handle transaction and state management, multithreading, resource pooling, and other complex low-level details.
The component-based and platform-independent J2EE architecture makes J2EE applications easy to write because business logic is organized into reusable components.
In addition, the J2EE server provides underlying services in the form of a container for every component type. Because you do not have to develop these services yourself, you are free to concentrate on solving the business problem at hand.
- Containers are the interface between a component and the low-level platform-specific functionality that supports the component.
- Before a web component, enterprise bean, or application client component can be executed, it must be assembled into a J2EE module and deployed into its container.
- Container settings customize the underlying support provided by the J2EE server, including services such as
- transaction management,
- Java Naming and Directory Interface [ JNDI ] lookups, and
- remote connectivity.
- Here are some of the highlights:
- The J2EE security model lets you configure a web component or enterprise bean so that system resources are accessed only by authorized users.
- The J2EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit.
- JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access naming and directory services.
- The J2EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.
- Because the J2EE architecture provides configurable services, application components within the same J2EE application can behave differently based on where they are deployed. For example, an enterprise bean can have security settings that allow it a certain level of access to database data in one production environment and another level of database access in another production environment.
- The container also manages nonconfigurable services such as
- enterprise bean and servlet life cycles,
- database connection resource pooling,
- data persistence, and access to the J2EE platform APIs. Although data persistence is a nonconfigurable service, the J2EE architecture lets you override container-managed persistence by including the appropriate code in your enterprise bean implementation when you want more control than the default container-managed persistence provides. For example, you might use bean-managed persistence to implement your own finder (search) methods or to create a customized database cache.
The deployment process installs J2EE application components in the J2EE containers illustrated as below:
The runtime portion of a J2EE product. A J2EE server provides EJB and web containers.
Enterprise JavaBeans (EJB) container
Manages the execution of enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server.
Manages the execution of JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.
Application client container
Manages the execution of application client components. Application clients and their container run on the client.
Manages the execution of applets. Consists of a web browser and Java Plug-in running on the client together.
|Application Servers Available for J2EE Components|
Application Servers Available for J2EE Components:
- An application server is a software framework dedicated to the efficient execution of procedures (scripts, routines, programs, …) for supporting the construction of applications.
- The term was created in the context of web applications.
- In these, the application server acts as a set of components accessible to the software developer through an API defined by the platform itself.
- These components are usually performed in the same machine where the web server is running, and their main job is to support the construction of dynamic pages.
- List of Servers
- WebLogic Server ( bea System / Oracle Corp. )
- WebSphere Application Server and WebSphere Application Server Community Edition (IBM)
- JBoss ( Red Hat )
- Sun GlassFish Enterprise Server (based on GlassFish Application Server) ( Sun Microsystems )
- Glassfish Application Server ( Open Source )
- Apache Tomcat ( Apache Software Foundation ) [ Web Server ]
- Tcat Server (MuleSoft)
- tc Server (SpringSource)
- Sybase Enterprise Application Server (Sybase Inc)
- JRun (Adobe Systems)
- Apache Geronimo (Apache Software Foundation)
- Oracle OC4J (Oracle)
- SAP Netweaver AS (ABAP/Java) (SAP)
- WebObjects (Apple Inc.)
Advantages of application servers
Data and code integrity
- By centralizing business logic on an individual server or on a small number of server machines, updates and upgrades to the application for all users can be guaranteed.
- There is no risk of old versions of the application accessing or manipulating data in an older, incompatible manner.
- Changes to the application configuration, such as a move of database server, or system settings, can take place centrally.
- A central point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.
- By limiting the network traffic to performance-tier traffic the client-server model improves the performance of large applications in heavy usage environments.
Total Cost of Ownership (TCO)
- In combination, the benefits above may result in cost savings to an organization developing enterprise applications.
- In practice, however, the technical challenges of writing software that conforms to that paradigm, combined with the need for software distribution to distribute client code, somewhat negate these benefits.
- A transaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work).
- End-users can benefit from a system-wide standard behaviour, from reduced time to develop, and from reduced costs
- As the server does a lot of the tedious code-generation, developers can focus on business logic.