Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 29

Unit-I

Introduction to J2EE
J2EE Overview

• ABC of Programming Languages


– Assembly Language Programming
– C and C + + languages
– Java
• Features of Java
– Portable
– Platform independent
– Secure
– Automatic garbage collection
Birth of J2EE

• Java originally designed for programs that


controlled electronic devices.

Java the programming language of


• choice for programming enterprise-
wide, web-centric applications.

Client/server model (two-tier) to multi-


tier architecture. (e.g. hotel booking
by an travel agent)
Birth of J2EE - Contd

•For the Internet to grow, web applications required a way


to interact with backend services such as a database and
dynamically generate web pages.
– Common Gateway Interface (CGI) technology
– Not scalable for more number of web clients
– Java servlet
– Web developers need knowledge in JAVA rather than HTML
– JSP (Java Server Pages)
– Little knowledge in JAVA and more in HTML

• Web-centric application for enterprise is Even though it is


complex to create, debug, distribute and maintain, J2EE
reduce the complexity of developing multi-tier applications.
• Java Editions are three types:

J2SE : Java 2 Standard Edition (for Stand alone Applications)


-API’s needed to build a JAVA application or applet

J2EE : Java 2 Enterprise Edition (Business applications)


-Enhanced version of J2SE
- API’s needed to build multi-tier architecture

J2ME : Java 2 Mobile Edition (Mobile application development)


-API’s needed to build a wireless JAVA application.

- J2SE , J2EE , J2ME are open and standard based platform for
developing and deploying and managing applications.
Why J2EE
Why ? →“ J2EE simplifies the creation of an enterprise-wide
applications, because functionality is encapsulated in
components of J2EE “.
The collaboration of industry leaders in the JCP (Java
Community Program) results in J2EE became the industry
standard enterprise environment.
J2EE based application components communicated using
HTTP, XML, HTML, CORBA,
RMI(Remote method Invocation),
IIOP (Internet inter-ORB Protocol),
SSL (Secured Socket layer)
All J2EE programs are implemented in Java, so the corporation
can utilize the for developing J2EE applications. existing Java
programmers
Why J2EE - contd
• Java Beans, Servlets and JSP are three major components of J2EE.
In addition to that, Seven J2EE standards are,
1. CORBA Compliance
• Java IDL & RMI-IIOP for interfacing java programs to any enterprise system
2. JAVA mail API
• Efficient exchange information (customer ↔ e-commerce sites)
3. Java Message Services (JMS)
• Link between java components (fault-tolerant msgs, asynch mode)
4. Java Naming & Directory Interface (JNDI) API
• Look-up objects → Locating objects in various servers
5. Java Transaction API (JTA)
• Managing transactions- One transaction may involve multiple components
6. JDBC API
• Interact with DBMS
7. XML Deployment Description
• This defines the environment and functionality of components when they deployed
in J2EE container.
J2EE APIs and Technologies

1. Java Database Connectivity (JDBC) API


2. Remote Method Invocation (RMI)
3. Java IDL : allows any Java object to communicate
with other objects in any language by means of IDL.
4. Enterprise Java Beans (EJB) : components used in
business tier of J2EE.
5. Servlets and Java Server Pages (JSP)
6. Java Message Service (JMS)
7. JavaMail API
8. Java API for XML Processing (JAXP) and many
more
Distributive Systems
Definition : “ Instead of limiting an application in one
machine, an application became a collaborative development
effort that utilized software services that were available
throughout network. “

Software Objects
A software object is a software service that is written in
OO language and can be used by a program.
Two protocols developed to access software objects.
- CORBA (Common Object Request Broker Architecture)
- DCOM (Distributed Common Object Model)
• Web services
• Web services is a web of services where services are
software building blocks that are available on a
network from which programmers can efficiently
create large-scale distributive systems.

• Three new standards:


• WSDL (Web Services Description Language) -
publish web services
• UDDI (Universal Description, Discovery, and
Integration) - locate web services
• SOAP (Software Oriented Architecture Protocol) -
invoke a particular web service
Multi-tier architecture

• A tier is an abstract concept that defines a group of


technologies that provides one or more services to
its clients.
• Multi-tier architecture is composed of clients,
resources, components (service), and containers.
• A client refers to a program that requests a service
from a component.
• A resource is anything a component needs to
provide a service, and a component is part of tier
that consists of a collection of classes or a program
that performs a function to provide the service.
• A container is software that manages a component
and provides a component with system services.
• The relationship between a container and a
component is sometimes referred to as a contract,
whose terms are governed by an application
programming interface (API).
• An API defines rules a component must follow and
the services a component will receive from the
container.
• Components are responsible for implementation of
business logic.
• A client uses a client protocol to access a service
that is associated with a particular tier.
• A protocol is a standard method of communication
that both a client and the tier/component/resource
understand.
• Normally large organizations employ multi-tier
architecture because it is easy to build an
application that is flexible, scalable and responsive
to the expectation of clients.
• A browser is a client and requests a service from a
web server using HTTP.
• J2EE is four-tier architecture
– Client Tier (Presentation tier or Application tier)
– Web tier
– Enterprise JavaBeans Tier (EJB or Business tier)
– Enterprise Information Systems (EIS) Tier
• Two or more tiers can physically reside on the same
Java Virtual Machine although each tier provides a
specific type of functionality to an application.
• Some of the APIs of J2EE components can be used
on more than one tier (i.e. XML API), while other
APIs (i.e. EJB API) or associated with a particular
tier.
Client tier implementation

• Client tier consists of programs that interact with the


user.
• It prompts the user for input and then converts the
user’s response into requests that are forwarded to
software on a component that processes the
request and returns results to the client program.

• J2EE clients can be classified as follows


1. Application Client is a Java application that operates
within the application client container.
2. Applet Client is a component used by a web client
that operates within the applet container.
3. Web client is a software (usually browser) that accesses
resources located on the web tier.
4. EJB client can access one or more enterprise javabeans that
are located on the EJB tier rather than resources on the web
tier.
5. EIS clients are the interface between users and resources
located on the EIS tier.
6. Web service peer is a unique type of clientthat forms a peer-
to-peer relationship with other components on the web tier
rather than a true client/server relationship.
7. Multi-tier clients can access components located on tiers
other than the tier where the multi-tier client resides.
Web Tier Implementation

• Responsibilities of web tier


• Accepting requests from other software that was sent
using POST,GET and PUT operations.
• Transmit data such as images and dynamic contents
• Act as intermediary between components working on
the web tier and other vtiers and the client tier.
• Two types of components that work on web tier are
• Servlet
• JSP
EJB tier implementation

• EJB is a class that contains business logic and is


callable from a servlet or a JSP.
• This tier provides concurrency, scalability, lifecycle
management, and fault tolerance.
• It manages instances of components.
• A key benefit of using a EJB container and EJB
server is that this technology makes proper use of
programmer's expertise.
• Collectively the EJB container and EJB server are
responsible for low-level services that are required
to implement business logic of an EJB e.g. thread
management, process management, security etc.
EIS tier implementation

• This tier provides flexibility to developers of J2EE


applications since it include variety of resources and
support connectivity to resources such as legacy
systems, DBMS and systems provided by third
parties that are accessible to components of J2EE
infrastructure.
• This connectivity is made possible through the use
of CORBA and Java Connectors or through
proprietary protocols.
• It defines all the elements that are needed to
communicate between J2EE application and non-
J2EE software.
Myths of Using Inheritance
Three reasons for using the inheritance in enterprise
applications:
• 1.Enables functionalities and data be reused without
having rewrite that in several times in an application.

• 2.Inheritance is also used to embellish both a


functionality and data.

• 3.Class that Inherits functionality can modify the


functionality without affecting the original
functionality.

The relationship between the derrived and the base


class is called coupling.
A common error is for the developer to rely heavily on
inheritance, which results in an application built on
coupled classes.
“Inheritance can be defined as the process where one class
• acquires the properties (methods and fields) of another.
With the use of inheritance the information is made
manageable in a hierarchical order.”

• Extends Keyword:
- extends is the keyword used in Java for
inheritance.


`
The Best Practice is to identify functionalities that is
common among real world objects that are used by an
application.

Place these features into a base class.The remaining features


that are unique placed in a derived class.

When there is a function common among unlike real world


objects place in interface.
Effects of Inheritance:

Ripple Effect : The ripple effect occur whenever a
• change is made to the base class .Changes to a base
class made ripple downs to all the derived classes
and might causes negative impact.
Object transmute : data and methods of an existing

class are moved to another class after existing class is
deleted.
• Refactoring strategy : the developers divide changes
into small modifications and then make each small
modification, followed by thorough testing.
Maintainable classes

 Coupling occurs when there is a class dependent on


another class e.g. derived class is dependent on base
class.

Cohesion describes how well a class' functionality is
focused i.e. a class that has broad functionality isn't as
cohesive as a class that has single functionality.

Avoid packages with cross dependencies.
 The best practice is to design an enterprise
application with highly cohesive classes and
minimum coupling.

You might also like