5678.Intro to J2EE

Embed Size (px)

Citation preview

  • 8/6/2019 5678.Intro to J2EE

    1/31

    J2EE

  • 8/6/2019 5678.Intro to J2EE

    2/31

  • 8/6/2019 5678.Intro to J2EE

    3/31

    The JavaTM Platform

    Most of you know there are three flavors of Java - Micro Edition,

    Standard Edition, and Enterprise Edition. These three flavors of Java represent

    three distinct target market segments each of which has unique issues and

    requirements that need to be addressed somewhat differently.

  • 8/6/2019 5678.Intro to J2EE

    4/31

    What is J2EE? Sun's J2EE architecture is multi tiered architecture and it

    eliminates all the problems of two-tier architecture. It alsoeliminates the need of writing thin-client multithreadapplications, which were earlier used to write distributedtransactional applications for the enterprise.

  • 8/6/2019 5678.Intro to J2EE

    5/31

    What is J2EE?

    Thin-client multi tiered applications are very fast, secure andreliable. But writing the thin-client multi tiered applicationsare not easy and it involves many lines of complicated codeto handle transaction and state management,multithreading, resource pooling and other complex low-level details.

    In the Java TM 2 Platform, Enterprise Edition (J2EE tm), low-level details are separated from the business logic. Now thedevelopers will more concentrate on the business logic

    rather than the low-level details. Low-level details aremanaged by the application container of the applicationserver.

  • 8/6/2019 5678.Intro to J2EE

    6/31

  • 8/6/2019 5678.Intro to J2EE

    7/31

    Need for Enterprise programming

    A well designed enterprise application should meet thefollowing goals

    Robustness

    Performance Object Oriented design Principles

    Avoid Complexity

    Maintainable and Extensible

    Easy to Test Promote reuse

    Support for the multiple client types

    Portability

  • 8/6/2019 5678.Intro to J2EE

    8/31

    Advantages of J2EE

    Specifically there are two major paths to developenterprise applications first is .NET platformsuite by Microsoft and second J2EE by Sun. There

    are lot of other companies also like BEA, IBM,Oracle, etc. Having all these choices Java has agreat acceptance because of followingadvantages

    Platform Independence

    Managed Objects

    Reusability

    Modularity

  • 8/6/2019 5678.Intro to J2EE

    9/31

    Platform Independence

    Enterprise applications comprises of wide

    variety of information which has to spread

    across many different type of platforms.

    Hence, it is essential to have a programming

    language that is capable of running across the

    different platforms and that is Java.

  • 8/6/2019 5678.Intro to J2EE

    10/31

    Managed Objects

    The platform independent J2EE provides a

    managed environment for component.

    J2EE applications are container-centric.

    Another important property of the J2EE

    applications is the ease by which it can

    modify and control the behavior of

    applications without changing the codes.

  • 8/6/2019 5678.Intro to J2EE

    11/31

    Reusability

    In the programming field, the code reuse is the

    most important and desired feature. This can

    be done by following ways

    To segregate an applications requirements

    into individual components.

    To use object oriented technology to

    encapsulate shared functionality.

    Java uses both the ways.

  • 8/6/2019 5678.Intro to J2EE

    12/31

    Modularity

    When we develop a complete server-side

    application, the program get large and

    complex very quickly. It is always best to

    break down the application into variousmodules that are individually responsible for

    a specific task. This also makes the

    application much easier to maintain andunderstand.

  • 8/6/2019 5678.Intro to J2EE

    13/31

    Enterprise Architecture Types

    A software application composition can be broken

    down into three logical layers

    User Interface Presentation Layer

    Processing Business Rule Layer

    Reading and Writing Data Data Access Layer

  • 8/6/2019 5678.Intro to J2EE

    14/31

    Single Tier Architecture

    Some applications aredeveloped to run on a single

    computer.In these type of applications all

    functionalities are embeddedwith in the same layer, suchas user interface, processing,data manipulation, etc.

    Such type of architecture is

    called single

    tier systems.

    User Interface

    Processing

    Reading/Writing

    Data

  • 8/6/2019 5678.Intro to J2EE

    15/31

    Two Tier Architecture

    User

    Interface

    On

    Clients

    Business Rule

    Data Access

    On

    Server

    Before the invention of

    PCs, applications were

    developed to run on

    mainframe based client-server environment which

    used a thin client and

    thick server. Because

    application was

    predominantly run on

    server side.

  • 8/6/2019 5678.Intro to J2EE

    16/31

    Layers of Two Tier

    Architecture

    The approach of these applications are centralizedin which multiple users are allowed to work

    simultaneously. Clients provide only userinterface and rest of all the processes are run onserver side. All the services and data accessprovided by server is shared by all the usersworking on the application.

    User Interface Layer

    Business Rule, Data Access Layer

  • 8/6/2019 5678.Intro to J2EE

    17/31

    Three Tier Architecture

    In this type application logic is divided intothree layers

    1. Presentation Layer User Interface Tier

    2. Business Logic LayerBusiness Rule Tier

    3. Data Layer

    Data-Store Tier

    Clients Application Server Database Server

  • 8/6/2019 5678.Intro to J2EE

    18/31

    Layers of Three Tier Architecture

    Data-Store Tier This tier is concerned with the

    storage and retrieval of data from databases.

    User Interface Layer

    Business Rule Layer

    Data Access Layer

    User-Interface Tier

    This

    tier handles the user

    interface logic. This is

    normally on the client side. Business Rule Tier This

    tier handles all of the

    business rules logic andvalidates user input from

    user interface tier.

  • 8/6/2019 5678.Intro to J2EE

    19/31

    Advantages of Three Tier Architecture

    Moving business rule components to anapplication server can boost performance.

    Multiple application servers can take

    advantage of load balancing and improvesystem fault tolerance.

    Changes to business rule can migrate to asmall number of application servers insteadof a large number of workstations.

    This also provides better code encapsulationallowing different people or even companies

    to implement each tier.

  • 8/6/2019 5678.Intro to J2EE

    20/31

    Multi Tier Architecture

    Presentation LayerUser Interface Tier

    Presentation Logic Layer

    User InterfaceOriented Business Logic Tier

    Business Logic LayerBusiness Rule Tier

    Data Layer

    Data-Store Tier

    UIOrientedBusinessRule

    Application Server Database ServerBusiness RuleClients

  • 8/6/2019 5678.Intro to J2EE

    21/31

    Layers of Multi Tier Architecture

    1.This handles the UI logic, whichincludes the actual presentationof screens and collectinformation.

    2.This layer handles business rule

    logic that supports the UI. Forexample, validation of user input.3.This is responsible for data

    manipulation and integration. Itcan combine data from SQL

    databases with flat files or evenInternet resources.4.This layer handles the storage and

    retrieval of data from databases,files, and other data sources.

    1 - User Interface Layer

    2-UI-Business Rule Layer

    3 - Business Rule Layer

    4Data Access Layer

  • 8/6/2019 5678.Intro to J2EE

    22/31

    Advantages of Multi Tier Architecture

    The central idea in multi-tier architecture is to keep theservices physically close to data they work with.Multi-tier architecture lets us put UI Oriented business

    rule components which are an excellent candidates for JavaBeans which let us to create reasonable, platform independent components.

    Data oriented business rule components are an excellentcandidates for Enterprise Java Beans (EJB) which providesthe facility of distributed programming.

    Multi tier is a component based architecture. Thereforebusiness logic services that support the UI can remainphysically close to the client. Remaining applicationservices can scale as additional resources become available.

    The multi tier architecture is flexible about the placementand the presence of application servers.

  • 8/6/2019 5678.Intro to J2EE

    23/31

    J2EE Architecture

    The J2EE Architecture allows the programmers to divide their workinto two major categories

    Presentation Logic

    Presentation Logic consists of all the program (JSP and Servlets),

    images and html files that are used to interact with the client.These files are archived into .war file. These files are installed onthe web server and these interact with the users.

    Business Logic

    These are EJB applications which implement the business logic of

    the system and are archived into .jar file. Business logic runs onthe application server.

    These two types of archives are bundled into complete J2EEapplications, and delivered as Enterprise Archive (EAR) file.

  • 8/6/2019 5678.Intro to J2EE

    24/31

  • 8/6/2019 5678.Intro to J2EE

    25/31

    A typical J2EE Environment

    EIS-TierClient - Tier Middle-Tier

    Enterprise

    InformationSystem

    (RDBMS,

    ERP,

    Legacy

    Applications)

    Client

    Client

    Client

    EJB Container

    JNDI,

    JMS,

    JavaMail

    Enterprise

    bean

    Enterprise

    bean

    Enterprise

    bean

    Client

    Web

    Container

    (Servlets,

    JSP Pages,

    HTML, XML)

  • 8/6/2019 5678.Intro to J2EE

    26/31

    J2EE Components

    The J2EE platform is a distributed applicationserver environment, i.e. Java environmentcomprises of following components

    A runtime infrastructure for managing andhosting applications. All runtime applicationsare located in this server.

    A set of Java APIs to build applications. These

    Java APIs describe the programming model forJ2EE applications. For example, Java ServletTechnology, EJB Technology, JSP technology, etc.

  • 8/6/2019 5678.Intro to J2EE

    27/31

    J2EE Containers

    Containers are the interface between a

    component and the low-level platform-

    specific functionality that supports the

    component.

    Before a Web, enterprise bean, or application

    client component can be executed, it must be

    assembled into a J2EE application anddeployed into its container.

  • 8/6/2019 5678.Intro to J2EE

    28/31

    Container Types

    The deployment process installs J2EE application components in

    the J2EE containers illustrated in Figure

    http://java.sun.com/j2ee/1.3/docs/tutorial/doc/Overview4.htmlhttp://java.sun.com/j2ee/1.3/docs/tutorial/doc/Overview4.html
  • 8/6/2019 5678.Intro to J2EE

    29/31

    Container Types

    J2EE server - The runtime portion of a J2EEproduct. A J2EE server provides EJB and Webcontainers.

    Enterprise JavaBeans (EJB) container - Managesthe execution of enterprise beans for J2EEapplications. Enterprise beans and their containerrun on the J2EE server.

    Web container - Manages the execution of JSPpage and Servlet components for J2EEapplications. Web components and their containerrun on the J2EE server.

  • 8/6/2019 5678.Intro to J2EE

    30/31

    Container Types

    Application client container - Manages the

    execution of application client components.

    Application clients and their container run onthe client.

    Applet container - Manages the execution of

    applets. Consists of a Web browser and JavaPlug-in running on the client together.

  • 8/6/2019 5678.Intro to J2EE

    31/31

    J2EE TechnologiesJ2EE Architecture consists of following

    technologies:

    Java Database Connectivity (JDBC)

    Java Naming and Directory Interface (JNDI) Enterprise Java Beans (EJB)

    Java Server Pages (JSP)

    Java Servlets Remote Method Invocation (RMI)

    Java IDL/CORBA