SlideShare a Scribd company logo
June 21, 2017 www.snipe.co.in 1
Prepared :Snipe Team
June 21, 2017 www.snipe.co.in 2
Enterprise Java Beans
June 21, 2017 www.snipe.co.in 3
 What Is EJB??
 Key Features
 Why EJB??
 EJB V/S JavaBeans
 EJB Architecture
 EJB Container Services
 Contracts
 Modules
 MVC Architecture
 Analysis of Objects
 Example of EJB Design,Usecases, UseCase Diagram
 Summary
Agenda
June 21, 2017 www.snipe.co.in 4
What??
EJB is a widely-adopted server-side component architecture for
J2EE.
EJB components are designed to encapsulate business logic,
and to protect the application developer from having to worry
about system level issues.
An EJB is just a collection of Java classes and XML file,
bundled into a single unit. The Java classes must follow certain
rules and provide certain callback methods.
EJB is just a specification. It is not a product.
EJBs are reusable components.
June 21, 2017 www.snipe.co.in 5
Key Features
 EJB architecture is inherently transactional, distributed,
portable, multi-tier, scalable and secure.
 EJB components are fully portable across any EJB server and
any OS, work with any client.
 Components are declaratively customized.
 There are four major parts to every bean:
• the home interface,
• the remote interface,
• the implementation class and
• the XML deployment descriptor
June 21, 2017 www.snipe.co.in 6
Why EJB??
EJB specification provides enterprise-level services, that is, it
provides software services that are fundamental to an
organization’s purpose.
EJB’s API was designed to keep the application programmer
from having to provide systems-level services, so that they are
free to concentrate on business logic.
A requirement of any of the services provided by an EJB
container like transactions, scalability, persistence, security,
future growth possibilities is an appropriate reason to use EJB
in the design of the application.
June 21, 2017 www.snipe.co.in 7
The JavaBeans architecture is meant to provide a format for
general-purpose components whereas the EJB architecture
provides a format for encapsulation and management of
business logic.
JavaBeans has tier of execution at Client and EJB has at Server
(specifically business logic tier)
In JavaBeans the runtime execution environment provides
services like Java libraries, Java application etc. The EJB
runtime environment provides services of Persistence,
declarative transactions and security, connection pooling and
lifecycle services.
EJB Vs JavaBeans
June 21, 2017 www.snipe.co.in 8
J2EE Application Server
Application Logic DataClient
RDBMS
Corba
Mail
RMI
JDBC
Java
Mail
JMS
JTA
Session Bean
EJB Container
Entity Bean
Client
Application
EJB
Architecture
June 21, 2017 www.snipe.co.in 9
Roles in EJB Development
System
Administrator
Application
Assembler
Deployer
App Server/EJB
Container
Provider
EJB
Provider
June 21, 2017 www.snipe.co.in 10
Roles in EJB Development
EJB provider - a person who develops EJB Components.
EJB Deployer - a person responsible for deploying EJB’s in EJB
server.
Application Server/ EJB Container Vendor - one who provides
application server on which the application is deployed.
Application assembler - one who combine the EJB components
with other software to make a complete application.
System administrator - one who manages the application after it
has been deployed into a target environment.
June 21, 2017 www.snipe.co.in 11
EJB Container Services
There are three basic ideas:
 First, there are clearly defined responsibilities between the
various parts of an application using EJB component namely the
client, the EJB container and the EJB component. The definition
of these responsibilities is formally known as a contract.
Second, the services that the container provides are defined in
such a way that they are orthogonal to the component. In other
words, security, persistence, transactions are separate from the
Java files that implement the business logic of the component.
Third, the container interposes on each and every call to an EJB
component so that it can provide its services. In other words, the
container puts itself between the client and the component on
every single business method call.
June 21, 2017 www.snipe.co.in 12
Contracts
EJB Container/Application Server
Enterprise Java Beans
C
Client
• The developer of the EJB component must implement the
business methods in the implementation class
• The bean provider must implement the
ejbCreate(),
ejbPostCreate(),ejbRemove() and the
ejbFind<METHOD>()
methods if the bean is an entity with bean managed persistence.
• The bean provider must define the enterprise bean’s home and
remote interfaces.
Rules for the Bean Programmer
June 21, 2017 www.snipe.co.in 14
• For session beans, the bean provider must implement the
container callbacks defined in the javax.ejb.SessionBean
interface
• For entity beans, the provider must implement the container
callbacks defined in the javax.ejb.EntityBean interface
• The bean provider must not use programming practices that
would interfere with the container’s runtime management of
the enterprise bean instances
Rules for the Bean Programmer
June 21, 2017 www.snipe.co.in 15
Modules
Interposition Diagram
Client
Remote
Stub
Remote
Stub
Container
Generated
Class
EJB
Netw
ork
June 21, 2017 www.snipe.co.in 16
Working With EJBs:
The Enterprise JavaBeans specification is written for
three audiences:
The Client developer
The EJB developer
The EJB container developer
June 21, 2017 www.snipe.co.in 17
EJB Clients are applications that access EJB components in EJB
containers.
There are two possible types:
The first category is application clients which are stand-alone
applications accessing the EJB components using the RMI-IIOP
protocol.
The second category of application clients are components in
the
web container. They are java servlets and JSPs which also
access the EJB components via the RMI-IIOP protocol.
EJB Clients
June 21, 2017 www.snipe.co.in 18
The client has a smaller set of concerns then a bean developer
with regard to using EJBs. Basically, he need to know :
how to find or create a bean,
how to use its methods and
how to release its resources
The client need not worry about the implementation of the EJB,
callbacks that the EJB container will make on the EJB or nature
of the services provided to the EJB.
Client Developer’s View
June 21, 2017 www.snipe.co.in 19
 Home Interface :
• It is primarily for the life cycle operations of the bean: creating,
finding, and removing EJBs.
• The home interface is not associated with a particular bean, just
with a type of bean.
Remote Interface :
• It is for business methods. Logically, it represents a particular
bean on the server.
• The remote interface also provides some infrastructure methods
associated with a bean instance, rather than a bean type.
EJB’s Interfaces
June 21, 2017 www.snipe.co.in 20
Package orderMgmt;
import java.util.properties;
import java.naming.Context; // for name-to-object findings
import java.naming.InitialContext;// context for naming
operations
public class Client {
try {
Properties prop = new Properties();
// server dependent properties for InitialContext
prop.put(Context.INITIAL_CONTEXT_FACTORY,
“org.jnp.interfaces.NamingContextFactory”);
prop.put(Context.PROVIDER_URL, “localhost:1099”);
Context ctx = new InitialContext(prop);
Object objref = ctx.lookup(“OrderManagement”);
Client.java
Continued..
June 21, 2017 www.snipe.co.in 21
// casting home interface reference to the OrderManagementHome
OrderManagementHome home = (OrderManagementHome)
javax.rmi.PortableRemoteObject.narrow
(objref,OrderManagementHome.class);
// home interface to create an instance of the OrderManagement
OrderManagement orderManagement = home.create();
// calling placeOrder()
orderManagement.placeOrder("Dan OConnor",
"Wrox books on programming", 1000);
orderManagement.remove();
System.out.println("Order successfully placed.");
}
catch (Exception e)
{ e.printStackTrace(); }
}
}
June 21, 2017 www.snipe.co.in 22
 Main responsibility is write business logic and structure the
code in a particular structure.
 The structure has 4 files, the home interface, remote interface,
business logic class file and the XML file.
 The XML file called the deployment descriptor, contains
• The structural information about the bean,
• Declares the bean’s external dependencies and
• Specifies certain information about how services such as
transaction and security work.
Bean Programmer’s View
June 21, 2017 www.snipe.co.in 23
package javax.ejb;
public interface javax.ejb.EJBObject extends java.rmi.Remote
{
EJBHome getEJBHome() throws java.rmi.RemoteException;
Handle getHandle() throws java.rmi.RemoteException;
Object getPrimaryKey() throws java.rmi.RemoteException;
boolean isIdentical(EJBObject obj) throws
java.rmi.RemoteException;
void remove() throws java.rmi.RemoteException;
}
Interface EJB Object:
June 21, 2017 www.snipe.co.in 24
package orderMgmt;
import javax.ejb.*;
public interface OrderManagement extends javax.ejb.EJBObject
{
public void placeOrder(String custName, String prodName, int
quantity) throws java.rmi.RemoteException;
public void cancelOrder(String custName, String prodName)
throws java.rmi.RemoteException;
public boolean isShipped(String custName, String prodName)
throws java.rmi.RemoteException;
}
Order Management Code:
June 21, 2017 www.snipe.co.in 25
package orderMgmt;
import javax.ejb.*;
public class OrderManagementEJB implements
javax.ejb.SessionBean
{
public void placeOrder(String custName, String prodName,
int quantity)
{ // ... Business logic ...}
public void cancelOrder(String custName, String prodName)
{ // ... Business logic ...}
public boolean isShipped(String custName, String prodName)
{ // ... Business logic … return true;}
OrderManagementBean code:
Continued…
June 21, 2017 www.snipe.co.in 26
public void ejbCreate()
{ // Can be empty }
public void ejbRemove()
{ // Can be empty }
public void ejbActivate()
{ // Can be empty}
public void ejbPassivate()
{ // Can be empty}
public void setSessionContext( SessionContext ctx )
{ // Can be empty}
}
June 21, 2017 www.snipe.co.in 27
Package javax.ejb;
public interface EJBHome extends java.rmi.Remote
{
EJBMetaData getEJBMetaData () throws
java.rmi.RemoteException;
HomeHandle getHomeHandle() throws
java.rmi.RemoteException;
void remove(Handle handle) throws java.rmi.RemoteException,
java.ejb.RemoveException;
void remove(Object primary key) throws
java.rmi.RemoteException, java.ejb.RemoveException;
}
Interface EJBHome:
June 21, 2017 www.snipe.co.in 28
package orderMgmt;
import javax.ejb.*;
public interface OrderManagementHome extends
javax.ejb.EJBHome
{
public OrderManagement create()
throws java.rmi.RemoteException, javax.ejb.CreateException;
}
OrderManagementHome Code:
June 21, 2017 www.snipe.co.in 29
<?xml version=“1.0”?>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>OrderManagement</ejb-name>
<home>orderMgmt.OrderManagementHome</home>
<remote>orderMgmt.OrderManagement</remote>
<ejb-class>orderMgmt.OrderManagementBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
The XML file:ejb-jar.xml:
Continued..
June 21, 2017 www.snipe.co.in 30
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>OrderManagement</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
June 21, 2017 www.snipe.co.in 31
META -INF
ejb-jar.xml
orderMgmt
OrderManagement.class
OrderManagementHome.class
OrderManagementBean.class
Structure of JAR file:
June 21, 2017 www.snipe.co.in 32
Three classes of objects in MVC architecture:
Model : This is the data and business-logic component. It can serve
multiple views.
View : This is the presentation component or the user-interface
component. There can be different presentations of a single model.
Controller : This is the component that responds to user input.
Translates user-interface events into changes to the model and
defines the way the user-interface reacts to those events.
MVC Architecture
June 21, 2017 www.snipe.co.in 33
Implementation of MVC in a web site
Controller
Model
Browser
Client
view1.jsp
view2.jsp
view3.jsp
Main.jsp
Views
1
2
3
4
5
June 21, 2017 www.snipe.co.in 34
Analysis Objects
 Control objects provide services to the application. They model
functionality that is not naturally associated with a particular
entity or interface. Control objects should be represented by
session beans in the implementation.
 Entity objects model those business objects that should
maintain their state after the use case completes. This means
they represent data in the database. Entity beans are often
represented by entity beans in the implementation model.
 Interface Object is responsible for controlling access to the EJB
tier from any client. An interface object should always be
represented by a session bean in the implementation.
Ex : controller servlet for the web application’s model-view-
controller architecture.
June 21, 2017 www.snipe.co.in 35
Consider the case of a company that develops products, takes
orders for those products, and then manufactures and ships them.
Actors in the company :
An engineer, a web customer,
A phone operator who takes orders from a catalog,
A floor manager who manages the manufacturing process,
A crew member that actually builds the product ordered and a
manager who tracks overdue orders.
An Example of EJB Design:
June 21, 2017 www.snipe.co.in 36
Create a Product
Place an Order
Cancel an Order
Select an Order for Manufacture
Build a Product
Ship an Order
List Overdue Orders
Use Cases
June 21, 2017 www.snipe.co.in 37
Use case diagram from analysis
Engineer
Customer
Operator
Manager
Crew
M’ment
Create Product
Place Order
Cancel Order
Select Order
Build Product
Ship an Order
Overdue Orders
June 21, 2017 www.snipe.co.in 38
EJBs are intended for transactional systems.
EJBs are portable, reusable server-side components that execute
in a container.
Assist developer productivity, extend application capability, and
improve system stability.
Are accessible from many different types of clients.
There are three types of beans : stateful session, stateless session,
and entity.
Continued..
Summary
June 21, 2017 www.snipe.co.in 39
There are four major parts to every bean:
• The home interface, the remote interface, the implementation
class, and the XML deployment descriptor.
• The enterprise bean developer must follow certain rules to get
the benefits of EJB technology.
• The roles of EJBs can be understood by analyzing a model of
your enterprise in terms of interface, control and entity
objects.
June 21, 2017 www.snipe.co.in 40
Thank You

More Related Content

What's hot

Sqlite
SqliteSqlite
Sqlite
Raghu nath
 
LIFE CYCLE OF SERVLET
LIFE CYCLE OF SERVLETLIFE CYCLE OF SERVLET
LIFE CYCLE OF SERVLET
keerthikaA8
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
Guo Albert
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
guest11106b
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
kamal kotecha
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
Sandeep Rawat
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
DrSonali Vyas
 
Java beans
Java beansJava beans
Java beans
Rajkiran Mummadi
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Raghu nath
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
sandeep54552
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
BG Java EE Course
 
Hibernate architecture
Hibernate architectureHibernate architecture
Hibernate architecture
Anurag
 
J2 ee container & components
J2 ee container & componentsJ2 ee container & components
J2 ee container & components
Keshab Nath
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
T11 Sessions
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
Dhruvin Nakrani
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
Peter R. Egli
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
Sandeep Rawat
 
Query processing-and-optimization
Query processing-and-optimizationQuery processing-and-optimization
Query processing-and-optimization
WBUTTUTORIALS
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 

What's hot (20)

Sqlite
SqliteSqlite
Sqlite
 
LIFE CYCLE OF SERVLET
LIFE CYCLE OF SERVLETLIFE CYCLE OF SERVLET
LIFE CYCLE OF SERVLET
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Java beans
Java beansJava beans
Java beans
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Hibernate architecture
Hibernate architectureHibernate architecture
Hibernate architecture
 
J2 ee container & components
J2 ee container & componentsJ2 ee container & components
J2 ee container & components
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
Servlet and servlet life cycle
Servlet and servlet life cycleServlet and servlet life cycle
Servlet and servlet life cycle
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
 
Query processing-and-optimization
Query processing-and-optimizationQuery processing-and-optimization
Query processing-and-optimization
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 

Viewers also liked

Ci
CiCi
Visual basics
Visual basicsVisual basics
Visual basics
Mallikarjuna G D
 
Build tool
Build toolBuild tool
Build tool
Mallikarjuna G D
 
ETL
ETLETL
Jdbc
JdbcJdbc
Maven
MavenMaven
Web services engine
Web services engineWeb services engine
Web services engine
Mallikarjuna G D
 
Ide benchmarking
Ide benchmarkingIde benchmarking
Ide benchmarking
Mallikarjuna G D
 
Project excursion career_orientation
Project excursion career_orientationProject excursion career_orientation
Project excursion career_orientation
Mallikarjuna G D
 
Training
TrainingTraining
Digital marketing
Digital marketingDigital marketing
Digital marketing
Mallikarjuna G D
 

Viewers also liked (11)

Ci
CiCi
Ci
 
Visual basics
Visual basicsVisual basics
Visual basics
 
Build tool
Build toolBuild tool
Build tool
 
ETL
ETLETL
ETL
 
Jdbc
JdbcJdbc
Jdbc
 
Maven
MavenMaven
Maven
 
Web services engine
Web services engineWeb services engine
Web services engine
 
Ide benchmarking
Ide benchmarkingIde benchmarking
Ide benchmarking
 
Project excursion career_orientation
Project excursion career_orientationProject excursion career_orientation
Project excursion career_orientation
 
Training
TrainingTraining
Training
 
Digital marketing
Digital marketingDigital marketing
Digital marketing
 

Similar to Ejb

Aravind vinnakota ejb_architecture
Aravind vinnakota ejb_architectureAravind vinnakota ejb_architecture
Aravind vinnakota ejb_architecture
tayab4687
 
Ejb course in-mumbai
Ejb course in-mumbaiEjb course in-mumbai
Ejb course in-mumbai
vibrantuser
 
Ejb notes
Ejb notesEjb notes
Ejb notes
Mumbai Academisc
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
Alassane Diallo
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
rani marri
 
EJB 2
EJB 2EJB 2
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
Kelum Senanayake
 
Ejb (1)
Ejb (1)Ejb (1)
Ejb (1)
Salman Virani
 
Ejb training institute in navi-mumbai
Ejb training institute in navi-mumbaiEjb training institute in navi-mumbai
Ejb training institute in navi-mumbai
vibrantuser
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Ejbandjsp 200119145750
Ejbandjsp 200119145750Ejbandjsp 200119145750
Ejbandjsp 200119145750
rajshreemuthiah
 
Ejb - september 2006
Ejb  - september 2006Ejb  - september 2006
Ejb - september 2006
achraf_ing
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorial
cribes
 
Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
Tharindu Weerasinghe
 
J2EEFeb11.ppt
J2EEFeb11.pptJ2EEFeb11.ppt
J2EEFeb11.ppt
KalsoomTahir2
 
Ejb and jsp
Ejb and jspEjb and jsp
Ejb and jsp
rajshreemuthiah
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
Simon Ritter
 
Lec2 ecom fall16
Lec2 ecom fall16Lec2 ecom fall16
Lec2 ecom fall16
Zainab Khallouf
 
Design patterns
Design patternsDesign patterns
Design patterns
revamptechnologies
 
Ch4 ejb
Ch4 ejbCh4 ejb

Similar to Ejb (20)

Aravind vinnakota ejb_architecture
Aravind vinnakota ejb_architectureAravind vinnakota ejb_architecture
Aravind vinnakota ejb_architecture
 
Ejb course in-mumbai
Ejb course in-mumbaiEjb course in-mumbai
Ejb course in-mumbai
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
EJB 2
EJB 2EJB 2
EJB 2
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
Ejb (1)
Ejb (1)Ejb (1)
Ejb (1)
 
Ejb training institute in navi-mumbai
Ejb training institute in navi-mumbaiEjb training institute in navi-mumbai
Ejb training institute in navi-mumbai
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Ejbandjsp 200119145750
Ejbandjsp 200119145750Ejbandjsp 200119145750
Ejbandjsp 200119145750
 
Ejb - september 2006
Ejb  - september 2006Ejb  - september 2006
Ejb - september 2006
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorial
 
Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
 
J2EEFeb11.ppt
J2EEFeb11.pptJ2EEFeb11.ppt
J2EEFeb11.ppt
 
Ejb and jsp
Ejb and jspEjb and jsp
Ejb and jsp
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
Lec2 ecom fall16
Lec2 ecom fall16Lec2 ecom fall16
Lec2 ecom fall16
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 

More from Mallikarjuna G D

Reactjs
ReactjsReactjs
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
Mallikarjuna G D
 
CSS
CSSCSS
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
Mallikarjuna G D
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
Mallikarjuna G D
 
Hibernate
HibernateHibernate
Hibernate
Mallikarjuna G D
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
Mallikarjuna G D
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
Mallikarjuna G D
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
Mallikarjuna G D
 
Mmg logistics edu-final
Mmg  logistics edu-finalMmg  logistics edu-final
Mmg logistics edu-final
Mallikarjuna G D
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharp
Mallikarjuna G D
 
Interview preparation devops
Interview preparation devopsInterview preparation devops
Interview preparation devops
Mallikarjuna G D
 
Interview preparation testing
Interview preparation testingInterview preparation testing
Interview preparation testing
Mallikarjuna G D
 
Interview preparation data_science
Interview preparation data_scienceInterview preparation data_science
Interview preparation data_science
Mallikarjuna G D
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_java
Mallikarjuna G D
 
Enterprunership
EnterprunershipEnterprunership
Enterprunership
Mallikarjuna G D
 
Core java
Core javaCore java
Core java
Mallikarjuna G D
 
Type script
Type scriptType script
Type script
Mallikarjuna G D
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
Mallikarjuna G D
 
Git Overview
Git OverviewGit Overview
Git Overview
Mallikarjuna G D
 

More from Mallikarjuna G D (20)

Reactjs
ReactjsReactjs
Reactjs
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 
CSS
CSSCSS
CSS
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Hibernate
HibernateHibernate
Hibernate
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Mmg logistics edu-final
Mmg  logistics edu-finalMmg  logistics edu-final
Mmg logistics edu-final
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharp
 
Interview preparation devops
Interview preparation devopsInterview preparation devops
Interview preparation devops
 
Interview preparation testing
Interview preparation testingInterview preparation testing
Interview preparation testing
 
Interview preparation data_science
Interview preparation data_scienceInterview preparation data_science
Interview preparation data_science
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_java
 
Enterprunership
EnterprunershipEnterprunership
Enterprunership
 
Core java
Core javaCore java
Core java
 
Type script
Type scriptType script
Type script
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
Git Overview
Git OverviewGit Overview
Git Overview
 

Recently uploaded

the potential for the development of autonomous aircraft
the potential for the development of autonomous aircraftthe potential for the development of autonomous aircraft
the potential for the development of autonomous aircraft
huseindihon
 
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
AsiimweJulius2
 
How to Formulate A Good Research Question
How to Formulate A  Good Research QuestionHow to Formulate A  Good Research Question
How to Formulate A Good Research Question
rkpv2002
 
ISO 9001 - 2015 Quality Management Awareness.pdf
ISO 9001 - 2015 Quality Management Awareness.pdfISO 9001 - 2015 Quality Management Awareness.pdf
ISO 9001 - 2015 Quality Management Awareness.pdf
InfoDqms
 
Red Hat Enterprise Linux Administration 9.0 RH124 pdf
Red Hat Enterprise Linux Administration 9.0 RH124 pdfRed Hat Enterprise Linux Administration 9.0 RH124 pdf
Red Hat Enterprise Linux Administration 9.0 RH124 pdf
mdfkobir
 
ANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
ANATOMY OF SOA - Thomas Erl - Service Oriented ArchitectureANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
ANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
Divya Rajasekar
 
Time-State Analytics: MinneAnalytics 2024 Talk
Time-State Analytics: MinneAnalytics 2024 TalkTime-State Analytics: MinneAnalytics 2024 Talk
Time-State Analytics: MinneAnalytics 2024 Talk
Evan Chan
 
The world of Technology Management MEM 814.pptx
The world of Technology Management MEM 814.pptxThe world of Technology Management MEM 814.pptx
The world of Technology Management MEM 814.pptx
engrasjadshahzad
 
Disaster Management and Mitigation presentation
Disaster Management and Mitigation presentationDisaster Management and Mitigation presentation
Disaster Management and Mitigation presentation
RajaRamannaTarigoppu
 
AFCAT STATIC Genral knowledge important CAPSULE.pdf
AFCAT STATIC Genral knowledge important CAPSULE.pdfAFCAT STATIC Genral knowledge important CAPSULE.pdf
AFCAT STATIC Genral knowledge important CAPSULE.pdf
vibhapatil140
 
Hate speech detection using machine learning
Hate speech detection using machine learningHate speech detection using machine learning
Hate speech detection using machine learning
rakeshrocking3
 
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
sunnuchadda
 
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptxIE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
BehairyAhmed2
 
Presentation python programming vtu 6th sem
Presentation python programming vtu 6th semPresentation python programming vtu 6th sem
Presentation python programming vtu 6th sem
ssuser8f6b1d1
 
Technical Seminar of Mca computer vision .ppt
Technical Seminar of Mca computer vision .pptTechnical Seminar of Mca computer vision .ppt
Technical Seminar of Mca computer vision .ppt
AnkitaVerma776806
 
JORC_Review_presentation. 2024 código jorcpdf
JORC_Review_presentation. 2024 código jorcpdfJORC_Review_presentation. 2024 código jorcpdf
JORC_Review_presentation. 2024 código jorcpdf
WilliamsNuezEspetia
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
rawankhanlove256
 
charting the development of the autonomous train
charting the development of the autonomous traincharting the development of the autonomous train
charting the development of the autonomous train
huseindihon
 
If we're running two pumps, why aren't we getting twice as much flow? v.17
If we're running two pumps, why aren't we getting twice as much flow? v.17If we're running two pumps, why aren't we getting twice as much flow? v.17
If we're running two pumps, why aren't we getting twice as much flow? v.17
Brian Gongol
 
Red Hat Enterprise Linux Administration 9.0 RH134 pdf
Red Hat Enterprise Linux Administration 9.0 RH134 pdfRed Hat Enterprise Linux Administration 9.0 RH134 pdf
Red Hat Enterprise Linux Administration 9.0 RH134 pdf
mdfkobir
 

Recently uploaded (20)

the potential for the development of autonomous aircraft
the potential for the development of autonomous aircraftthe potential for the development of autonomous aircraft
the potential for the development of autonomous aircraft
 
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
1. DEE 1203 ELECTRICAL ENGINEERING DRAWING.pdf
 
How to Formulate A Good Research Question
How to Formulate A  Good Research QuestionHow to Formulate A  Good Research Question
How to Formulate A Good Research Question
 
ISO 9001 - 2015 Quality Management Awareness.pdf
ISO 9001 - 2015 Quality Management Awareness.pdfISO 9001 - 2015 Quality Management Awareness.pdf
ISO 9001 - 2015 Quality Management Awareness.pdf
 
Red Hat Enterprise Linux Administration 9.0 RH124 pdf
Red Hat Enterprise Linux Administration 9.0 RH124 pdfRed Hat Enterprise Linux Administration 9.0 RH124 pdf
Red Hat Enterprise Linux Administration 9.0 RH124 pdf
 
ANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
ANATOMY OF SOA - Thomas Erl - Service Oriented ArchitectureANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
ANATOMY OF SOA - Thomas Erl - Service Oriented Architecture
 
Time-State Analytics: MinneAnalytics 2024 Talk
Time-State Analytics: MinneAnalytics 2024 TalkTime-State Analytics: MinneAnalytics 2024 Talk
Time-State Analytics: MinneAnalytics 2024 Talk
 
The world of Technology Management MEM 814.pptx
The world of Technology Management MEM 814.pptxThe world of Technology Management MEM 814.pptx
The world of Technology Management MEM 814.pptx
 
Disaster Management and Mitigation presentation
Disaster Management and Mitigation presentationDisaster Management and Mitigation presentation
Disaster Management and Mitigation presentation
 
AFCAT STATIC Genral knowledge important CAPSULE.pdf
AFCAT STATIC Genral knowledge important CAPSULE.pdfAFCAT STATIC Genral knowledge important CAPSULE.pdf
AFCAT STATIC Genral knowledge important CAPSULE.pdf
 
Hate speech detection using machine learning
Hate speech detection using machine learningHate speech detection using machine learning
Hate speech detection using machine learning
 
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 in City
 
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptxIE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
IE-469-Lecture-Notes-3IE-469-Lecture-Notes-3.pptx
 
Presentation python programming vtu 6th sem
Presentation python programming vtu 6th semPresentation python programming vtu 6th sem
Presentation python programming vtu 6th sem
 
Technical Seminar of Mca computer vision .ppt
Technical Seminar of Mca computer vision .pptTechnical Seminar of Mca computer vision .ppt
Technical Seminar of Mca computer vision .ppt
 
JORC_Review_presentation. 2024 código jorcpdf
JORC_Review_presentation. 2024 código jorcpdfJORC_Review_presentation. 2024 código jorcpdf
JORC_Review_presentation. 2024 código jorcpdf
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
 
charting the development of the autonomous train
charting the development of the autonomous traincharting the development of the autonomous train
charting the development of the autonomous train
 
If we're running two pumps, why aren't we getting twice as much flow? v.17
If we're running two pumps, why aren't we getting twice as much flow? v.17If we're running two pumps, why aren't we getting twice as much flow? v.17
If we're running two pumps, why aren't we getting twice as much flow? v.17
 
Red Hat Enterprise Linux Administration 9.0 RH134 pdf
Red Hat Enterprise Linux Administration 9.0 RH134 pdfRed Hat Enterprise Linux Administration 9.0 RH134 pdf
Red Hat Enterprise Linux Administration 9.0 RH134 pdf
 

Ejb

  • 1. June 21, 2017 www.snipe.co.in 1 Prepared :Snipe Team
  • 2. June 21, 2017 www.snipe.co.in 2 Enterprise Java Beans
  • 3. June 21, 2017 www.snipe.co.in 3  What Is EJB??  Key Features  Why EJB??  EJB V/S JavaBeans  EJB Architecture  EJB Container Services  Contracts  Modules  MVC Architecture  Analysis of Objects  Example of EJB Design,Usecases, UseCase Diagram  Summary Agenda
  • 4. June 21, 2017 www.snipe.co.in 4 What?? EJB is a widely-adopted server-side component architecture for J2EE. EJB components are designed to encapsulate business logic, and to protect the application developer from having to worry about system level issues. An EJB is just a collection of Java classes and XML file, bundled into a single unit. The Java classes must follow certain rules and provide certain callback methods. EJB is just a specification. It is not a product. EJBs are reusable components.
  • 5. June 21, 2017 www.snipe.co.in 5 Key Features  EJB architecture is inherently transactional, distributed, portable, multi-tier, scalable and secure.  EJB components are fully portable across any EJB server and any OS, work with any client.  Components are declaratively customized.  There are four major parts to every bean: • the home interface, • the remote interface, • the implementation class and • the XML deployment descriptor
  • 6. June 21, 2017 www.snipe.co.in 6 Why EJB?? EJB specification provides enterprise-level services, that is, it provides software services that are fundamental to an organization’s purpose. EJB’s API was designed to keep the application programmer from having to provide systems-level services, so that they are free to concentrate on business logic. A requirement of any of the services provided by an EJB container like transactions, scalability, persistence, security, future growth possibilities is an appropriate reason to use EJB in the design of the application.
  • 7. June 21, 2017 www.snipe.co.in 7 The JavaBeans architecture is meant to provide a format for general-purpose components whereas the EJB architecture provides a format for encapsulation and management of business logic. JavaBeans has tier of execution at Client and EJB has at Server (specifically business logic tier) In JavaBeans the runtime execution environment provides services like Java libraries, Java application etc. The EJB runtime environment provides services of Persistence, declarative transactions and security, connection pooling and lifecycle services. EJB Vs JavaBeans
  • 8. June 21, 2017 www.snipe.co.in 8 J2EE Application Server Application Logic DataClient RDBMS Corba Mail RMI JDBC Java Mail JMS JTA Session Bean EJB Container Entity Bean Client Application EJB Architecture
  • 9. June 21, 2017 www.snipe.co.in 9 Roles in EJB Development System Administrator Application Assembler Deployer App Server/EJB Container Provider EJB Provider
  • 10. June 21, 2017 www.snipe.co.in 10 Roles in EJB Development EJB provider - a person who develops EJB Components. EJB Deployer - a person responsible for deploying EJB’s in EJB server. Application Server/ EJB Container Vendor - one who provides application server on which the application is deployed. Application assembler - one who combine the EJB components with other software to make a complete application. System administrator - one who manages the application after it has been deployed into a target environment.
  • 11. June 21, 2017 www.snipe.co.in 11 EJB Container Services There are three basic ideas:  First, there are clearly defined responsibilities between the various parts of an application using EJB component namely the client, the EJB container and the EJB component. The definition of these responsibilities is formally known as a contract. Second, the services that the container provides are defined in such a way that they are orthogonal to the component. In other words, security, persistence, transactions are separate from the Java files that implement the business logic of the component. Third, the container interposes on each and every call to an EJB component so that it can provide its services. In other words, the container puts itself between the client and the component on every single business method call.
  • 12. June 21, 2017 www.snipe.co.in 12 Contracts EJB Container/Application Server Enterprise Java Beans C Client
  • 13. • The developer of the EJB component must implement the business methods in the implementation class • The bean provider must implement the ejbCreate(), ejbPostCreate(),ejbRemove() and the ejbFind<METHOD>() methods if the bean is an entity with bean managed persistence. • The bean provider must define the enterprise bean’s home and remote interfaces. Rules for the Bean Programmer
  • 14. June 21, 2017 www.snipe.co.in 14 • For session beans, the bean provider must implement the container callbacks defined in the javax.ejb.SessionBean interface • For entity beans, the provider must implement the container callbacks defined in the javax.ejb.EntityBean interface • The bean provider must not use programming practices that would interfere with the container’s runtime management of the enterprise bean instances Rules for the Bean Programmer
  • 15. June 21, 2017 www.snipe.co.in 15 Modules Interposition Diagram Client Remote Stub Remote Stub Container Generated Class EJB Netw ork
  • 16. June 21, 2017 www.snipe.co.in 16 Working With EJBs: The Enterprise JavaBeans specification is written for three audiences: The Client developer The EJB developer The EJB container developer
  • 17. June 21, 2017 www.snipe.co.in 17 EJB Clients are applications that access EJB components in EJB containers. There are two possible types: The first category is application clients which are stand-alone applications accessing the EJB components using the RMI-IIOP protocol. The second category of application clients are components in the web container. They are java servlets and JSPs which also access the EJB components via the RMI-IIOP protocol. EJB Clients
  • 18. June 21, 2017 www.snipe.co.in 18 The client has a smaller set of concerns then a bean developer with regard to using EJBs. Basically, he need to know : how to find or create a bean, how to use its methods and how to release its resources The client need not worry about the implementation of the EJB, callbacks that the EJB container will make on the EJB or nature of the services provided to the EJB. Client Developer’s View
  • 19. June 21, 2017 www.snipe.co.in 19  Home Interface : • It is primarily for the life cycle operations of the bean: creating, finding, and removing EJBs. • The home interface is not associated with a particular bean, just with a type of bean. Remote Interface : • It is for business methods. Logically, it represents a particular bean on the server. • The remote interface also provides some infrastructure methods associated with a bean instance, rather than a bean type. EJB’s Interfaces
  • 20. June 21, 2017 www.snipe.co.in 20 Package orderMgmt; import java.util.properties; import java.naming.Context; // for name-to-object findings import java.naming.InitialContext;// context for naming operations public class Client { try { Properties prop = new Properties(); // server dependent properties for InitialContext prop.put(Context.INITIAL_CONTEXT_FACTORY, “org.jnp.interfaces.NamingContextFactory”); prop.put(Context.PROVIDER_URL, “localhost:1099”); Context ctx = new InitialContext(prop); Object objref = ctx.lookup(“OrderManagement”); Client.java Continued..
  • 21. June 21, 2017 www.snipe.co.in 21 // casting home interface reference to the OrderManagementHome OrderManagementHome home = (OrderManagementHome) javax.rmi.PortableRemoteObject.narrow (objref,OrderManagementHome.class); // home interface to create an instance of the OrderManagement OrderManagement orderManagement = home.create(); // calling placeOrder() orderManagement.placeOrder("Dan OConnor", "Wrox books on programming", 1000); orderManagement.remove(); System.out.println("Order successfully placed."); } catch (Exception e) { e.printStackTrace(); } } }
  • 22. June 21, 2017 www.snipe.co.in 22  Main responsibility is write business logic and structure the code in a particular structure.  The structure has 4 files, the home interface, remote interface, business logic class file and the XML file.  The XML file called the deployment descriptor, contains • The structural information about the bean, • Declares the bean’s external dependencies and • Specifies certain information about how services such as transaction and security work. Bean Programmer’s View
  • 23. June 21, 2017 www.snipe.co.in 23 package javax.ejb; public interface javax.ejb.EJBObject extends java.rmi.Remote { EJBHome getEJBHome() throws java.rmi.RemoteException; Handle getHandle() throws java.rmi.RemoteException; Object getPrimaryKey() throws java.rmi.RemoteException; boolean isIdentical(EJBObject obj) throws java.rmi.RemoteException; void remove() throws java.rmi.RemoteException; } Interface EJB Object:
  • 24. June 21, 2017 www.snipe.co.in 24 package orderMgmt; import javax.ejb.*; public interface OrderManagement extends javax.ejb.EJBObject { public void placeOrder(String custName, String prodName, int quantity) throws java.rmi.RemoteException; public void cancelOrder(String custName, String prodName) throws java.rmi.RemoteException; public boolean isShipped(String custName, String prodName) throws java.rmi.RemoteException; } Order Management Code:
  • 25. June 21, 2017 www.snipe.co.in 25 package orderMgmt; import javax.ejb.*; public class OrderManagementEJB implements javax.ejb.SessionBean { public void placeOrder(String custName, String prodName, int quantity) { // ... Business logic ...} public void cancelOrder(String custName, String prodName) { // ... Business logic ...} public boolean isShipped(String custName, String prodName) { // ... Business logic … return true;} OrderManagementBean code: Continued…
  • 26. June 21, 2017 www.snipe.co.in 26 public void ejbCreate() { // Can be empty } public void ejbRemove() { // Can be empty } public void ejbActivate() { // Can be empty} public void ejbPassivate() { // Can be empty} public void setSessionContext( SessionContext ctx ) { // Can be empty} }
  • 27. June 21, 2017 www.snipe.co.in 27 Package javax.ejb; public interface EJBHome extends java.rmi.Remote { EJBMetaData getEJBMetaData () throws java.rmi.RemoteException; HomeHandle getHomeHandle() throws java.rmi.RemoteException; void remove(Handle handle) throws java.rmi.RemoteException, java.ejb.RemoveException; void remove(Object primary key) throws java.rmi.RemoteException, java.ejb.RemoveException; } Interface EJBHome:
  • 28. June 21, 2017 www.snipe.co.in 28 package orderMgmt; import javax.ejb.*; public interface OrderManagementHome extends javax.ejb.EJBHome { public OrderManagement create() throws java.rmi.RemoteException, javax.ejb.CreateException; } OrderManagementHome Code:
  • 29. June 21, 2017 www.snipe.co.in 29 <?xml version=“1.0”?> <ejb-jar> <enterprise-beans> <session> <ejb-name>OrderManagement</ejb-name> <home>orderMgmt.OrderManagementHome</home> <remote>orderMgmt.OrderManagement</remote> <ejb-class>orderMgmt.OrderManagementBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> The XML file:ejb-jar.xml: Continued..
  • 30. June 21, 2017 www.snipe.co.in 30 <assembly-descriptor> <container-transaction> <method> <ejb-name>OrderManagement</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
  • 31. June 21, 2017 www.snipe.co.in 31 META -INF ejb-jar.xml orderMgmt OrderManagement.class OrderManagementHome.class OrderManagementBean.class Structure of JAR file:
  • 32. June 21, 2017 www.snipe.co.in 32 Three classes of objects in MVC architecture: Model : This is the data and business-logic component. It can serve multiple views. View : This is the presentation component or the user-interface component. There can be different presentations of a single model. Controller : This is the component that responds to user input. Translates user-interface events into changes to the model and defines the way the user-interface reacts to those events. MVC Architecture
  • 33. June 21, 2017 www.snipe.co.in 33 Implementation of MVC in a web site Controller Model Browser Client view1.jsp view2.jsp view3.jsp Main.jsp Views 1 2 3 4 5
  • 34. June 21, 2017 www.snipe.co.in 34 Analysis Objects  Control objects provide services to the application. They model functionality that is not naturally associated with a particular entity or interface. Control objects should be represented by session beans in the implementation.  Entity objects model those business objects that should maintain their state after the use case completes. This means they represent data in the database. Entity beans are often represented by entity beans in the implementation model.  Interface Object is responsible for controlling access to the EJB tier from any client. An interface object should always be represented by a session bean in the implementation. Ex : controller servlet for the web application’s model-view- controller architecture.
  • 35. June 21, 2017 www.snipe.co.in 35 Consider the case of a company that develops products, takes orders for those products, and then manufactures and ships them. Actors in the company : An engineer, a web customer, A phone operator who takes orders from a catalog, A floor manager who manages the manufacturing process, A crew member that actually builds the product ordered and a manager who tracks overdue orders. An Example of EJB Design:
  • 36. June 21, 2017 www.snipe.co.in 36 Create a Product Place an Order Cancel an Order Select an Order for Manufacture Build a Product Ship an Order List Overdue Orders Use Cases
  • 37. June 21, 2017 www.snipe.co.in 37 Use case diagram from analysis Engineer Customer Operator Manager Crew M’ment Create Product Place Order Cancel Order Select Order Build Product Ship an Order Overdue Orders
  • 38. June 21, 2017 www.snipe.co.in 38 EJBs are intended for transactional systems. EJBs are portable, reusable server-side components that execute in a container. Assist developer productivity, extend application capability, and improve system stability. Are accessible from many different types of clients. There are three types of beans : stateful session, stateless session, and entity. Continued.. Summary
  • 39. June 21, 2017 www.snipe.co.in 39 There are four major parts to every bean: • The home interface, the remote interface, the implementation class, and the XML deployment descriptor. • The enterprise bean developer must follow certain rules to get the benefits of EJB technology. • The roles of EJBs can be understood by analyzing a model of your enterprise in terms of interface, control and entity objects.
  • 40. June 21, 2017 www.snipe.co.in 40 Thank You