SlideShare une entreprise Scribd logo
1  sur  67
Understanding Server-Side Technologies

1
Understanding Java EE–Related
Tiers and Technologies

• Exam Objective 8.4 Describe at a high level the
fundamental benefits and drawbacks of using J2EE
server-side technologies, and describe and compare the
basic characteristics of the web-tier, business-tier, and
EIS tier.

2
3
4
• The main disadvantage to the Java EE architecture is its
complexity. To be able.
• to program with the Java EE APIs as a software maintainer
you must know the fundamentals of Java very well.

• To be able to effectively develop code in the Java EE
environment, you should understand the more advanced
object-oriented features of the language, including the various
design patterns

5
Enterprise Tiers

6
Understanding the Web Tier
• The web tier is the tier within an enterprise system that
contains the presentation layer. Servlets and JavaServer
Pages are part of the web tier.
• These are web application technologies used for creating
dynamic web content.
• JavaServer Pages deliver web pages from the web tier.
Servlets handle HTTP web requests from the web tier.
• There are many web containers that implement the JSP
and servlets specifications such as Apache Tomcat, Jetty,
and the Sun Java System Web Server.
7
• The JavaServer Faces (JSF) API and JavaServer Pages
Standard Tag Library (JSTL) provide additional web contents
solutions.
• JSF is a user-interface component framework that lets you
easily build components, add validators and converters to the
values of those components, and provides page navigation
and state management support.
• JSTL is a tag library that is built off of the JSP framework.

8
Understanding the Business Tier
• The business tier is the tier within an enterprise system
that contains the business logic.
• Enterprise JavaBeans is one of the major components of
the business tier.

9
Understanding the EIS Tier
• The Enterprise Information System (EIS) tier is the tier within
an enterprise system that contains the data layer.
• Common activities are persistence support through
database management systems.
• The EIS tier includes databases, relational databases,
legacy applications, enterprise resource planning systems,
CRM systems, and legacy data stores. The EIS tier is
typically on its own machine.
• For example, an enterprisescale Oracle database can reside
on its own server and is interfaced with remotely.
10
11
Understanding Server-Side Solutions
• Exam Objective 8.1 Describe at a high level the basic
characteristics of: EJB, servlets, JSP, JMS, JNDI, SMTP, JAXRPC, Web Services (including SOAP, UDDI, WSDL, and XML),
and JavaMail.

12
Java Web Services
• Java web services are XML-based messaging protocols
that enable business-tobusiness communications. XML
helps achieve the underlying goal of web services, which
is to send and receive messages in a standardized
format.
• Java web services were introduced in J2EE 1.4 as part of
the Java Web Services Development Pack (JWSDP).

13
•
•
•
•
•
•
•
•
•
•

JAX-WS Version 2.0 EA (Java API for XML Web Services)
Fast Infoset Version 1.0.1
Sun Java Streaming XML Parser Version 1.0 EA
XML Digital Signature Version 1.0.1
XML and Web Services Security Version 2.0 EA2
JAXB Version 2.0 EA (Java Architecture for XML Binding)
JAXP Version 1.3.1_01 (Java API for XML Processing)
JAXR Version 1.0.8_01 EA (Java API for XML Registries)
JAX-RPC Version 1.1.3_01 EA (Java API for XML-based RPC)
SAAJ Version 1.3 EA (SOAP with Attachments API for Java)
14
• For the SCJA exam, the only related web services
technologies you will need to know are XML, JAXRPC
(covered in the next section), and the three foundational
standards of web services (SOAP, UDDI, and WSDL).

15
XML
• The Extensible Markup Language (XML) is a general-purpose
specification used for creating markup languages with the
design purposes of transporting and storing data.
• Web-based solutions make common use of XML files such as
configuration, deployment descriptor, and tag libraries files.
Again, XML was designed to structure, store, and/or carry
data, not to display data.

16
Simple Object Access Protocol
• The Simple Object Access Protocol (SOAP) is a simple
XML-based communication protocol used for information
exchange within a decentralized and distributed
environment.
• SOAP is used in various situations such as messaging
and remote procedure calls.

17
• SOAP is made up of three main parts: the envelope, the
encoding rules, and the RPC.
• The envelope is the root XML element that contains the
message recipient,message content, and processing
information of the message.
• The encoding rules specify how the data-type instances
will be exchanged.
• The RPCs defines the convention for representing the
remote calls and responses procedure calls.

18
<SOAP-ENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/ soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<s:GetDinnerSpecial xmlns:m="Specified-URI">
<Dish>Shrimp Scampi with Linguini</Dish>
</s:GetDinnerSpecial>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
19
WSDL
• The Web Service Definition Language (WSDL) is an XML
standard for businesses and individuals to access
available services that each provide.
• The WSDL XML documents include a set of definitions.
These definitions describe network services as a set of
endpoints operating on messages containing either
document or procedureoriented information.
• These elements are described and bound to network
protocols and message formats to define an endpoint.
• More specifically, an endpoint is a WSDL port that
represents the contact point of the service.
• This endpoint consists of the protocol and location
information.

20
UDDI
• The Universal Description, Discovery, and Integration
(UDDI) specification is an XML-based registry that is used
by businesses to make their services and general
business descriptions available through the Internet.
• UDDI can communicate via CORBA, SOAP, or the Java
RMI protocols. UDDI makes use of WSDL in describing
interfaces to web services.
• As such, the UDDI specification includes a set of WSDL
definitions for modifying and searching its registry, and
the registry itself includes the web service’s metadata and
a pointer to the WSDL service description.
21
SMTP and the JavaMail API
• The Simple Mail Transfer Protocol (SMTP) and the
JavaMail API are often used together to provide e-mailing
solutions.
• use the JavaMail API to send the e-mail to the desired
recipient by connecting and sending the e-mail from an
SMTP server.

22
23
Java API for XML-Based Remote
Procedure Call

24
25
Understanding Dynamic Web Content
Solutions

• Exam Objective 8.2 Describe at a high level the basic
characteristics of servlet and JSP support for HTML thin-clients.

26
Understanding Dynamic Web Content
Solutions

27
28
29
What is Servlet?
• Java™ objects which are based on servlet framework and
APIs and extend the functionality of a HTTP server.
• Mapped to URLs and managed by container with a simple
architecture
• Available and running on all major web servers and app
servers
• Platform and server independent

30
First Servlet Code
Public class HelloServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response){
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<title>Hello World!</title>");
}
...
}

31
What is JSP Technology?

• Enables separation of business logic from
presentation
> Presentation is in the form of HTML or
XML/XSLT
> – Business logic is implemented as Java
Beans or custom tags
> – Better maintainability, reusability
• Extensible via custom tags
• Builds on Servlet technology
32
What is JSP page?
• A text-based document capable of returning dynamic
content to a client browser
• Contains both static and dynamic content
> Static content: HTML, XML
> Dynamic content: programming code, and
JavaBeans, custom tags

33
JSP Sample Code

<html>
Hello World!
<br>
<jsp:useBean id="clock"
class=“calendar.JspCalendar” />
Today is
<ul>
<li>Day of month: <%= clock.getDayOfMonth() %>
<li>Year: <%= clock.getYear() %>
</ul>
</html>

34
Servlets and JSP - Comparison

35
JSP Benefits
• Content and display logic are separated
• Simplify development with JSP, JavaBeans and custom
tags
• Supports software reuse through the use of components
• Recompile automatically when changes are made to the
source file
• Easier to author web pages
• Platform-independent

36
Should I Use Servlet or JSP?

• In practice, servlet and JSP are used together
> via MVC (Model, View, Controller) architecture
> Servlet handles Controller
> JSP handles View

37
What Is an Enterprise Bean?
• Written in the Java programming language, an enterprise
bean is a server-side component that encapsulates the
business logic of an application.

38
Benefits of Enterprise Beans
• the EJB container provides system-level services to enterprise
beans,the bean developer can concentrate on solving business
problems.
• The client developer does not have to code the routines that
implement business rules or access databases. As a result, the
clients are thinner, a benefit that is particularly important for
clients that run on small devices.
• enterprise beans are portable components, the application
assembler can build new applications from existing beans.
These applications can run on any compliant Java EE server
provided that they use the standard APIs.
39
When to Use Enterprise Beans
• To accommodate a growing number of users, you may need to
distribute an application’s components across multiple
machines.Not only can the enterprise beans of an application
run on different machines, but also their location will remain
transparent to the clients.
• Enterprise beans support transactions, the mechanisms that
manage the concurrent access of shared objects.
• The application will have a variety of clients. With only a few
lines of code, remote clients can easily locate enterprise
beans. These clients can be thin, various, and numerous.
40
Types of Enterprise Beans

• Session Performs a task for a client;
optionally may implement a web service.
• Message-Driven Acts as a listener for a
particular messaging type, such as the
Java Message Service API.
41
What Is a Session Bean?
• As its name suggests, a session bean is similar to an
interactive session.
• A session bean is not shared; it can have only one client,
in the same way that an interactive session can have only
one user.
• Like an interactive session, a session bean is not
persistent.
• When the client terminates, its session bean appears to
terminate and is no longer associated with the client.

42
State Management Modes
Stateful Session Beans :conversational state
• In a stateful session bean,the instance variables represent
the state of a unique client-bean session.
• The state is retained for the duration of the client-bean
session.
• If the client removes the bean or terminates, the session
ends and the state disappears.
43
Stateless Session Beans
• When a client invokes the methods of a stateless bean, the
bean’s instance variables may contain a state specific to that
client, but only for the duration of the invocation.
• Except during method invocation, all instances of a stateless
bean are equivalent, allowing the EJB container to assign an
instance to any client.

• Typically, an application requires fewer stateless session
beans than stateful session beans to support the same number
of clients.
44
When to Use Session Beans
In general, you should use a session bean if the following
circumstances hold:
• At any given time, only one client has access to the bean
instance.
• The state of the bean is not persistent, existing only for a
short period (perhaps a few hours).
• The bean implements a web service.

45
Stateful session beans are appropriate if any of the following conditions are
true:
• The bean’s state represents the interaction between the bean and a
specific client.
• The bean needs to hold information about the client across method
invocations.
• The bean mediates between the client and the other components of the
application,presenting a simplified view to the client.
• Behind the scenes, the bean manages the work flow of several enterprise
beans
To improve performance, you might choose a stateless session bean if it has
any of these traits:
• The bean’s state has no data for a specific client.
• In a single method invocation, the bean performs a generic task for all
clients. For example,you might use a stateless session bean to send an
email that confirms an online order.
46
What Is a Message-Driven Bean?
• A message-driven bean is an enterprise bean that allows
Java EE applications to process messages
asynchronously.

• The messages can be sent by any Java EE component
(an application client, another enterprise bean, or a web
component) or by a JMS application.
• Message-driven beans can process JMS messages or
other kinds of messages.
47
What Makes Message-Driven Beans
Different from Session Beans?
• The most visible difference between message-driven beans and session
beans is that clients do not access message-driven beans through
interface.
In several respects, a message-driven bean resembles a stateless session
bean.
• A message-driven bean’s instances retain no data or conversational
state for a specific client.
• All instances of a message-driven bean are equivalent, allowing the EJB
container to assign a message to any message-driven bean instance.
The container can pool these instances to allow streams of messages to
be processed concurrently.
• A single message-driven bean can process messages from multiple
clients.
48
Message driven beans have the following
characteristics:

They execute upon receipt of a single client
message.
• They are invoked asynchronously.
• They are relatively short-lived.
• They do not represent directly shared data in
the database, but they can access and update
this data.
• They can be transaction-aware.
• They are stateless.

49
Defining Client Access with Interfaces
• A client can access a session bean only through the
methods defined in the bean’s business interface(client’s
view of a bean). method implementations and deployment
settings are hidden from the client.
• Well-designed interfaces simplify the development and
maintenance of Java EE applications.
• Not only do clean interfaces shield the clients from any
complexities in the EJB tier, but they also allow the beans
to change internally without affecting the clients.
• The type of client access allowed by the enterprise beans:
remote, local, or web service?
50
Remote Clients
A remote client of an enterprise bean has the following
traits:
• It can run on a different machine and a different Java
virtual machine (JVM) than the enterprise bean it
accesses. (It is not required to run on a different JVM.)
• It can be a web component, an application client, or
another enterprise bean.
• To a remote client, the location of the enterprise bean is
transparent.

51
@Remote
public interface InterfaceName { ... }
@Remote(InterfaceName.class)
public class BeanName implements InterfaceName { ... }

52
Local Clients
A local client has these characteristics:
• It must run in the same JVM as the enterprise bean it
accesses.
• It can be a web component or another enterprise bean.
• To the local client, the location of the enterprise bean it
accesses is not transparent
the business interface is by default a local interface.
• @Local
• public interface InterfaceName { ... }
53
Deciding on Remote or Local Access
• Tight or loose coupling of related beans: For example, if a
session bean that processes sales orders calls a session bean
that emails a confirmation message to the customer, these
beans are tightly coupled.
> Same logical unit local  increase performance

• Type of client and Component distribution : the type of
access depends on how you want to distribute your
components, application clients, web components, other
enterprise beans.
• Performance: remote calls may be slower than local calls.
In the future you can distribute your components to accommodate
the growing demands on your applicationRemote
54
55
56
57
58
59
60
61
62
63
64
65
66
67

Contenu connexe

Tendances

Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 
Ibm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideIbm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideKhemnath Chauhan
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologySimon Ritter
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questionspraveen_guda
 
java database connection (jdbc)
java database connection (jdbc)java database connection (jdbc)
java database connection (jdbc)Sanjay Gunjal
 
Java web services soap rest training from hyderabad
Java web services soap rest training from hyderabadJava web services soap rest training from hyderabad
Java web services soap rest training from hyderabadFuturePoint Technologies
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overviewodedns
 
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...Pallepati Vasavi
 
IBM Websphere concepts
IBM Websphere conceptsIBM Websphere concepts
IBM Websphere conceptsKuldeep Saxena
 
J2EE and Servlet
J2EE and Servlet J2EE and Servlet
J2EE and Servlet Rishikesh .
 
J2ee and web services
J2ee and web servicesJ2ee and web services
J2ee and web servicesJauhar Amir
 

Tendances (19)

Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
Ibm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guideIbm web sphere_job_interview_preparation_guide
Ibm web sphere_job_interview_preparation_guide
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
 
java database connection (jdbc)
java database connection (jdbc)java database connection (jdbc)
java database connection (jdbc)
 
Jdbc drivers
Jdbc driversJdbc drivers
Jdbc drivers
 
Java web services soap rest training from hyderabad
Java web services soap rest training from hyderabadJava web services soap rest training from hyderabad
Java web services soap rest training from hyderabad
 
Aws
AwsAws
Aws
 
Jdbc driver types
Jdbc driver typesJdbc driver types
Jdbc driver types
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overview
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
 
Jdbc
JdbcJdbc
Jdbc
 
IBM Websphere concepts
IBM Websphere conceptsIBM Websphere concepts
IBM Websphere concepts
 
Devjyotippt
DevjyotipptDevjyotippt
Devjyotippt
 
J2EE and Servlet
J2EE and Servlet J2EE and Servlet
J2EE and Servlet
 
Java ee introduction
Java ee introductionJava ee introduction
Java ee introduction
 
J2ee and web services
J2ee and web servicesJ2ee and web services
J2ee and web services
 
J2ee
J2eeJ2ee
J2ee
 

Similaire à Chapter 12:Understanding Server-Side Technologies

Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesIt Academy
 
Oracle fusion middleware 11g - IBANK
Oracle fusion middleware 11g - IBANKOracle fusion middleware 11g - IBANK
Oracle fusion middleware 11g - IBANKibankuk
 
Oracle fusion middleware 11g - iBANK
Oracle fusion middleware 11g - iBANKOracle fusion middleware 11g - iBANK
Oracle fusion middleware 11g - iBANKibankuk
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music storeADEEBANADEEM
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptKalsoomTahir2
 
Web programming and development - Introduction
Web programming and development - IntroductionWeb programming and development - Introduction
Web programming and development - IntroductionJoel Briza
 
Bala Sr Java Developer
Bala  Sr Java DeveloperBala  Sr Java Developer
Bala Sr Java DeveloperJava Dev
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
Java Training in Chennai
Java Training in Chennai Java Training in Chennai
Java Training in Chennai raj esaki
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC vipin kumar
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Reviewnetc2012
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application developmentClarence Ho
 
Oracle Weblogic for EBS and obiee (R12.2)
Oracle Weblogic for EBS and obiee (R12.2)Oracle Weblogic for EBS and obiee (R12.2)
Oracle Weblogic for EBS and obiee (R12.2)Berry Clemens
 
Orpos and store practices
Orpos and store practicesOrpos and store practices
Orpos and store practicesShyamChakrapani
 

Similaire à Chapter 12:Understanding Server-Side Technologies (20)

Chapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration TechnologiesChapter 10:Understanding Java Related Platforms and Integration Technologies
Chapter 10:Understanding Java Related Platforms and Integration Technologies
 
Oracle fusion middleware 11g - IBANK
Oracle fusion middleware 11g - IBANKOracle fusion middleware 11g - IBANK
Oracle fusion middleware 11g - IBANK
 
Oracle fusion middleware 11g - iBANK
Oracle fusion middleware 11g - iBANKOracle fusion middleware 11g - iBANK
Oracle fusion middleware 11g - iBANK
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
 
4. J2EE.pptx
4. J2EE.pptx4. J2EE.pptx
4. J2EE.pptx
 
Java part 3
Java part  3Java part  3
Java part 3
 
Web programming and development - Introduction
Web programming and development - IntroductionWeb programming and development - Introduction
Web programming and development - Introduction
 
Bala Sr Java Developer
Bala  Sr Java DeveloperBala  Sr Java Developer
Bala Sr Java Developer
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
Java Training in Chennai
Java Training in Chennai Java Training in Chennai
Java Training in Chennai
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application development
 
Introduction to weblogic
Introduction to weblogicIntroduction to weblogic
Introduction to weblogic
 
J2 ee architecture
J2 ee architectureJ2 ee architecture
J2 ee architecture
 
Oracle Weblogic for EBS and obiee (R12.2)
Oracle Weblogic for EBS and obiee (R12.2)Oracle Weblogic for EBS and obiee (R12.2)
Oracle Weblogic for EBS and obiee (R12.2)
 
Weblogic application server
Weblogic application serverWeblogic application server
Weblogic application server
 
Orpos and store practices
Orpos and store practicesOrpos and store practices
Orpos and store practices
 

Plus de It Academy

Chapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesChapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesIt Academy
 
Chapter 9:Representing Object-Oriented Concepts with UML
Chapter 9:Representing Object-Oriented Concepts with UMLChapter 9:Representing Object-Oriented Concepts with UML
Chapter 9:Representing Object-Oriented Concepts with UMLIt Academy
 
Chapter8:Understanding Polymorphism
Chapter8:Understanding PolymorphismChapter8:Understanding Polymorphism
Chapter8:Understanding PolymorphismIt Academy
 
Chapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceChapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceIt Academy
 
Chapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their RelationshipsChapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their RelationshipsIt Academy
 
Chapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class ConstructionChapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class ConstructionIt Academy
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsIt Academy
 
Chapter 3:Programming with Java Operators and Strings
Chapter 3:Programming with Java Operators and  StringsChapter 3:Programming with Java Operators and  Strings
Chapter 3:Programming with Java Operators and StringsIt Academy
 
Chapter 3 : Programming with Java Operators and Strings
Chapter 3 : Programming with Java Operators and  StringsChapter 3 : Programming with Java Operators and  Strings
Chapter 3 : Programming with Java Operators and StringsIt Academy
 
Chapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java StatementsChapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java StatementsIt Academy
 
chap 10 : Development (scjp/ocjp)
chap 10 : Development (scjp/ocjp)chap 10 : Development (scjp/ocjp)
chap 10 : Development (scjp/ocjp)It Academy
 
Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)It Academy
 
chap 8 : The java.lang and java.util Packages (scjp/ocjp)
chap 8 : The java.lang and java.util Packages (scjp/ocjp)chap 8 : The java.lang and java.util Packages (scjp/ocjp)
chap 8 : The java.lang and java.util Packages (scjp/ocjp)It Academy
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)It Academy
 
chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)It Academy
 
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)It Academy
 
chap4 : Converting and Casting (scjp/ocjp)
chap4 : Converting and Casting (scjp/ocjp)chap4 : Converting and Casting (scjp/ocjp)
chap4 : Converting and Casting (scjp/ocjp)It Academy
 
chp 3 : Modifiers (scjp/ocjp)
chp 3 : Modifiers (scjp/ocjp)chp 3 : Modifiers (scjp/ocjp)
chp 3 : Modifiers (scjp/ocjp)It Academy
 

Plus de It Academy (20)

Chapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesChapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side Technologies
 
Chapter 9:Representing Object-Oriented Concepts with UML
Chapter 9:Representing Object-Oriented Concepts with UMLChapter 9:Representing Object-Oriented Concepts with UML
Chapter 9:Representing Object-Oriented Concepts with UML
 
Chapter8:Understanding Polymorphism
Chapter8:Understanding PolymorphismChapter8:Understanding Polymorphism
Chapter8:Understanding Polymorphism
 
Chapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceChapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class Inheritance
 
Chapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their RelationshipsChapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their Relationships
 
Chapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class ConstructionChapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class Construction
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic Concepts
 
Chapter 3:Programming with Java Operators and Strings
Chapter 3:Programming with Java Operators and  StringsChapter 3:Programming with Java Operators and  Strings
Chapter 3:Programming with Java Operators and Strings
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Chapter 3 : Programming with Java Operators and Strings
Chapter 3 : Programming with Java Operators and  StringsChapter 3 : Programming with Java Operators and  Strings
Chapter 3 : Programming with Java Operators and Strings
 
Chapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java StatementsChapter 2 : Programming with Java Statements
Chapter 2 : Programming with Java Statements
 
Chapter 1 :
Chapter 1 : Chapter 1 :
Chapter 1 :
 
chap 10 : Development (scjp/ocjp)
chap 10 : Development (scjp/ocjp)chap 10 : Development (scjp/ocjp)
chap 10 : Development (scjp/ocjp)
 
Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)Chap 9 : I/O and Streams (scjp/ocjp)
Chap 9 : I/O and Streams (scjp/ocjp)
 
chap 8 : The java.lang and java.util Packages (scjp/ocjp)
chap 8 : The java.lang and java.util Packages (scjp/ocjp)chap 8 : The java.lang and java.util Packages (scjp/ocjp)
chap 8 : The java.lang and java.util Packages (scjp/ocjp)
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)
 
chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)chap 6 : Objects and classes (scjp/ocjp)
chap 6 : Objects and classes (scjp/ocjp)
 
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)
chap4 ; Flow Control, Assertions, and Exception Handling (scjp/ocjp)
 
chap4 : Converting and Casting (scjp/ocjp)
chap4 : Converting and Casting (scjp/ocjp)chap4 : Converting and Casting (scjp/ocjp)
chap4 : Converting and Casting (scjp/ocjp)
 
chp 3 : Modifiers (scjp/ocjp)
chp 3 : Modifiers (scjp/ocjp)chp 3 : Modifiers (scjp/ocjp)
chp 3 : Modifiers (scjp/ocjp)
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Chapter 12:Understanding Server-Side Technologies

  • 2. Understanding Java EE–Related Tiers and Technologies • Exam Objective 8.4 Describe at a high level the fundamental benefits and drawbacks of using J2EE server-side technologies, and describe and compare the basic characteristics of the web-tier, business-tier, and EIS tier. 2
  • 3. 3
  • 4. 4
  • 5. • The main disadvantage to the Java EE architecture is its complexity. To be able. • to program with the Java EE APIs as a software maintainer you must know the fundamentals of Java very well. • To be able to effectively develop code in the Java EE environment, you should understand the more advanced object-oriented features of the language, including the various design patterns 5
  • 7. Understanding the Web Tier • The web tier is the tier within an enterprise system that contains the presentation layer. Servlets and JavaServer Pages are part of the web tier. • These are web application technologies used for creating dynamic web content. • JavaServer Pages deliver web pages from the web tier. Servlets handle HTTP web requests from the web tier. • There are many web containers that implement the JSP and servlets specifications such as Apache Tomcat, Jetty, and the Sun Java System Web Server. 7
  • 8. • The JavaServer Faces (JSF) API and JavaServer Pages Standard Tag Library (JSTL) provide additional web contents solutions. • JSF is a user-interface component framework that lets you easily build components, add validators and converters to the values of those components, and provides page navigation and state management support. • JSTL is a tag library that is built off of the JSP framework. 8
  • 9. Understanding the Business Tier • The business tier is the tier within an enterprise system that contains the business logic. • Enterprise JavaBeans is one of the major components of the business tier. 9
  • 10. Understanding the EIS Tier • The Enterprise Information System (EIS) tier is the tier within an enterprise system that contains the data layer. • Common activities are persistence support through database management systems. • The EIS tier includes databases, relational databases, legacy applications, enterprise resource planning systems, CRM systems, and legacy data stores. The EIS tier is typically on its own machine. • For example, an enterprisescale Oracle database can reside on its own server and is interfaced with remotely. 10
  • 11. 11
  • 12. Understanding Server-Side Solutions • Exam Objective 8.1 Describe at a high level the basic characteristics of: EJB, servlets, JSP, JMS, JNDI, SMTP, JAXRPC, Web Services (including SOAP, UDDI, WSDL, and XML), and JavaMail. 12
  • 13. Java Web Services • Java web services are XML-based messaging protocols that enable business-tobusiness communications. XML helps achieve the underlying goal of web services, which is to send and receive messages in a standardized format. • Java web services were introduced in J2EE 1.4 as part of the Java Web Services Development Pack (JWSDP). 13
  • 14. • • • • • • • • • • JAX-WS Version 2.0 EA (Java API for XML Web Services) Fast Infoset Version 1.0.1 Sun Java Streaming XML Parser Version 1.0 EA XML Digital Signature Version 1.0.1 XML and Web Services Security Version 2.0 EA2 JAXB Version 2.0 EA (Java Architecture for XML Binding) JAXP Version 1.3.1_01 (Java API for XML Processing) JAXR Version 1.0.8_01 EA (Java API for XML Registries) JAX-RPC Version 1.1.3_01 EA (Java API for XML-based RPC) SAAJ Version 1.3 EA (SOAP with Attachments API for Java) 14
  • 15. • For the SCJA exam, the only related web services technologies you will need to know are XML, JAXRPC (covered in the next section), and the three foundational standards of web services (SOAP, UDDI, and WSDL). 15
  • 16. XML • The Extensible Markup Language (XML) is a general-purpose specification used for creating markup languages with the design purposes of transporting and storing data. • Web-based solutions make common use of XML files such as configuration, deployment descriptor, and tag libraries files. Again, XML was designed to structure, store, and/or carry data, not to display data. 16
  • 17. Simple Object Access Protocol • The Simple Object Access Protocol (SOAP) is a simple XML-based communication protocol used for information exchange within a decentralized and distributed environment. • SOAP is used in various situations such as messaging and remote procedure calls. 17
  • 18. • SOAP is made up of three main parts: the envelope, the encoding rules, and the RPC. • The envelope is the root XML element that contains the message recipient,message content, and processing information of the message. • The encoding rules specify how the data-type instances will be exchanged. • The RPCs defines the convention for representing the remote calls and responses procedure calls. 18
  • 20. WSDL • The Web Service Definition Language (WSDL) is an XML standard for businesses and individuals to access available services that each provide. • The WSDL XML documents include a set of definitions. These definitions describe network services as a set of endpoints operating on messages containing either document or procedureoriented information. • These elements are described and bound to network protocols and message formats to define an endpoint. • More specifically, an endpoint is a WSDL port that represents the contact point of the service. • This endpoint consists of the protocol and location information. 20
  • 21. UDDI • The Universal Description, Discovery, and Integration (UDDI) specification is an XML-based registry that is used by businesses to make their services and general business descriptions available through the Internet. • UDDI can communicate via CORBA, SOAP, or the Java RMI protocols. UDDI makes use of WSDL in describing interfaces to web services. • As such, the UDDI specification includes a set of WSDL definitions for modifying and searching its registry, and the registry itself includes the web service’s metadata and a pointer to the WSDL service description. 21
  • 22. SMTP and the JavaMail API • The Simple Mail Transfer Protocol (SMTP) and the JavaMail API are often used together to provide e-mailing solutions. • use the JavaMail API to send the e-mail to the desired recipient by connecting and sending the e-mail from an SMTP server. 22
  • 23. 23
  • 24. Java API for XML-Based Remote Procedure Call 24
  • 25. 25
  • 26. Understanding Dynamic Web Content Solutions • Exam Objective 8.2 Describe at a high level the basic characteristics of servlet and JSP support for HTML thin-clients. 26
  • 27. Understanding Dynamic Web Content Solutions 27
  • 28. 28
  • 29. 29
  • 30. What is Servlet? • Java™ objects which are based on servlet framework and APIs and extend the functionality of a HTTP server. • Mapped to URLs and managed by container with a simple architecture • Available and running on all major web servers and app servers • Platform and server independent 30
  • 31. First Servlet Code Public class HelloServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response){ response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<title>Hello World!</title>"); } ... } 31
  • 32. What is JSP Technology? • Enables separation of business logic from presentation > Presentation is in the form of HTML or XML/XSLT > – Business logic is implemented as Java Beans or custom tags > – Better maintainability, reusability • Extensible via custom tags • Builds on Servlet technology 32
  • 33. What is JSP page? • A text-based document capable of returning dynamic content to a client browser • Contains both static and dynamic content > Static content: HTML, XML > Dynamic content: programming code, and JavaBeans, custom tags 33
  • 34. JSP Sample Code <html> Hello World! <br> <jsp:useBean id="clock" class=“calendar.JspCalendar” /> Today is <ul> <li>Day of month: <%= clock.getDayOfMonth() %> <li>Year: <%= clock.getYear() %> </ul> </html> 34
  • 35. Servlets and JSP - Comparison 35
  • 36. JSP Benefits • Content and display logic are separated • Simplify development with JSP, JavaBeans and custom tags • Supports software reuse through the use of components • Recompile automatically when changes are made to the source file • Easier to author web pages • Platform-independent 36
  • 37. Should I Use Servlet or JSP? • In practice, servlet and JSP are used together > via MVC (Model, View, Controller) architecture > Servlet handles Controller > JSP handles View 37
  • 38. What Is an Enterprise Bean? • Written in the Java programming language, an enterprise bean is a server-side component that encapsulates the business logic of an application. 38
  • 39. Benefits of Enterprise Beans • the EJB container provides system-level services to enterprise beans,the bean developer can concentrate on solving business problems. • The client developer does not have to code the routines that implement business rules or access databases. As a result, the clients are thinner, a benefit that is particularly important for clients that run on small devices. • enterprise beans are portable components, the application assembler can build new applications from existing beans. These applications can run on any compliant Java EE server provided that they use the standard APIs. 39
  • 40. When to Use Enterprise Beans • To accommodate a growing number of users, you may need to distribute an application’s components across multiple machines.Not only can the enterprise beans of an application run on different machines, but also their location will remain transparent to the clients. • Enterprise beans support transactions, the mechanisms that manage the concurrent access of shared objects. • The application will have a variety of clients. With only a few lines of code, remote clients can easily locate enterprise beans. These clients can be thin, various, and numerous. 40
  • 41. Types of Enterprise Beans • Session Performs a task for a client; optionally may implement a web service. • Message-Driven Acts as a listener for a particular messaging type, such as the Java Message Service API. 41
  • 42. What Is a Session Bean? • As its name suggests, a session bean is similar to an interactive session. • A session bean is not shared; it can have only one client, in the same way that an interactive session can have only one user. • Like an interactive session, a session bean is not persistent. • When the client terminates, its session bean appears to terminate and is no longer associated with the client. 42
  • 43. State Management Modes Stateful Session Beans :conversational state • In a stateful session bean,the instance variables represent the state of a unique client-bean session. • The state is retained for the duration of the client-bean session. • If the client removes the bean or terminates, the session ends and the state disappears. 43
  • 44. Stateless Session Beans • When a client invokes the methods of a stateless bean, the bean’s instance variables may contain a state specific to that client, but only for the duration of the invocation. • Except during method invocation, all instances of a stateless bean are equivalent, allowing the EJB container to assign an instance to any client. • Typically, an application requires fewer stateless session beans than stateful session beans to support the same number of clients. 44
  • 45. When to Use Session Beans In general, you should use a session bean if the following circumstances hold: • At any given time, only one client has access to the bean instance. • The state of the bean is not persistent, existing only for a short period (perhaps a few hours). • The bean implements a web service. 45
  • 46. Stateful session beans are appropriate if any of the following conditions are true: • The bean’s state represents the interaction between the bean and a specific client. • The bean needs to hold information about the client across method invocations. • The bean mediates between the client and the other components of the application,presenting a simplified view to the client. • Behind the scenes, the bean manages the work flow of several enterprise beans To improve performance, you might choose a stateless session bean if it has any of these traits: • The bean’s state has no data for a specific client. • In a single method invocation, the bean performs a generic task for all clients. For example,you might use a stateless session bean to send an email that confirms an online order. 46
  • 47. What Is a Message-Driven Bean? • A message-driven bean is an enterprise bean that allows Java EE applications to process messages asynchronously. • The messages can be sent by any Java EE component (an application client, another enterprise bean, or a web component) or by a JMS application. • Message-driven beans can process JMS messages or other kinds of messages. 47
  • 48. What Makes Message-Driven Beans Different from Session Beans? • The most visible difference between message-driven beans and session beans is that clients do not access message-driven beans through interface. In several respects, a message-driven bean resembles a stateless session bean. • A message-driven bean’s instances retain no data or conversational state for a specific client. • All instances of a message-driven bean are equivalent, allowing the EJB container to assign a message to any message-driven bean instance. The container can pool these instances to allow streams of messages to be processed concurrently. • A single message-driven bean can process messages from multiple clients. 48
  • 49. Message driven beans have the following characteristics: They execute upon receipt of a single client message. • They are invoked asynchronously. • They are relatively short-lived. • They do not represent directly shared data in the database, but they can access and update this data. • They can be transaction-aware. • They are stateless. 49
  • 50. Defining Client Access with Interfaces • A client can access a session bean only through the methods defined in the bean’s business interface(client’s view of a bean). method implementations and deployment settings are hidden from the client. • Well-designed interfaces simplify the development and maintenance of Java EE applications. • Not only do clean interfaces shield the clients from any complexities in the EJB tier, but they also allow the beans to change internally without affecting the clients. • The type of client access allowed by the enterprise beans: remote, local, or web service? 50
  • 51. Remote Clients A remote client of an enterprise bean has the following traits: • It can run on a different machine and a different Java virtual machine (JVM) than the enterprise bean it accesses. (It is not required to run on a different JVM.) • It can be a web component, an application client, or another enterprise bean. • To a remote client, the location of the enterprise bean is transparent. 51
  • 52. @Remote public interface InterfaceName { ... } @Remote(InterfaceName.class) public class BeanName implements InterfaceName { ... } 52
  • 53. Local Clients A local client has these characteristics: • It must run in the same JVM as the enterprise bean it accesses. • It can be a web component or another enterprise bean. • To the local client, the location of the enterprise bean it accesses is not transparent the business interface is by default a local interface. • @Local • public interface InterfaceName { ... } 53
  • 54. Deciding on Remote or Local Access • Tight or loose coupling of related beans: For example, if a session bean that processes sales orders calls a session bean that emails a confirmation message to the customer, these beans are tightly coupled. > Same logical unit local  increase performance • Type of client and Component distribution : the type of access depends on how you want to distribute your components, application clients, web components, other enterprise beans. • Performance: remote calls may be slower than local calls. In the future you can distribute your components to accommodate the growing demands on your applicationRemote 54
  • 55. 55
  • 56. 56
  • 57. 57
  • 58. 58
  • 59. 59
  • 60. 60
  • 61. 61
  • 62. 62
  • 63. 63
  • 64. 64
  • 65. 65
  • 66. 66
  • 67. 67