SlideShare a Scribd company logo
1 of 64
WELCOME TO VIBRANT
TECHNOLOGIES & COMPUTERS
--------------------------
ONLINE EJB TRAINING PPTS
Address: K1/4 2nd Floor,Sec-15/16 Market Opp to Vaidehi
Hotel, Vashi, Navi Mumbai, Maharashtra 400703
Phone:098929 00103
Contact Us On : Vibranttechnologies.co.in
∗ What is EJB?
∗ Key features of EJB technology
∗ EJB vs JavaBeans
∗ Varieties of Beans
∗ Why use EJBs in your design?
∗ EJB Architecture
∗ EJB Container and its Services
∗ Services provided by an EJB container
∗ How the Container Provides Services
∗ Contracts
∗ Rules for the bean programmer
∗ Interposition : method call to an EJB Container from a remote client
∗ Interposition diagram
∗ Working with EJBs
∗ EJB Clients
∗ The Client Developer’s View
∗ EJB’s interface
Contact Us On :
www.vibranttechnologies.co.in
Content :
∗ Client.java
∗ Client contd..
∗ The Bean Programmer’s view
∗ Interface EJB Object
∗ Order Management code..
∗ Order ManagementBean code..
∗ Interface EJBHome
∗ The xml file : ejb-jar.xml
∗ Structure of JAR file
∗ What you can’t do in an EJB component?
∗ EJB Components on the Web
∗ Implementation of MVC in a web site
∗ Design of the EJB Tier
∗ Analysis Objects
∗ View of interaction between control
∗ objects and entity objects
Contact Us On :
www.vibranttechnologies.co.in
Content :
∗ 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.
What is EJB?
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
What is EJB?
Contact Us On :
www.vibranttechnologies.co.in
∗ EJB components are server-side components
written entirely in the Java programming
language
∗ EJB components contain business logic only - no
System-level programming
∗ System-level services (i.e. "plumbing") such as
transactions, security, Life-cycle, threading,
persistence, etc. are automatically managed for
the EJB component by the EJB server
Key features of EJB technology
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Key features of EJB technology
Contact Us On :
www.vibranttechnologies.co.in
∗ 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)
EJB vs JavaBeans
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Contact Us On :
www.vibranttechnologies.co.in
∗ Session Beans
Stateful session bean
Stateless session bean
∗ Entity Beans
With container-managed persistence
With bean-managed persistence
∗ Message-Driven Beans
Varieties of Beans
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
Why use EJBs in your design?
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
Why use EJBs in your design?
Contact Us On :
www.vibranttechnologies.co.in
EJB Architecture
J2EE Application Server
EJB Container
Application Logic DataClient
RDBMS
Corba
Mail
RMI
JDBC
Java
Mail
JMS
JTA
Session Bean
Entity Bean
Client
Application
∗ 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
Roles in EJB Development
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
Roles in EJB Development
Contact Us On :
www.vibranttechnologies.co.in
Roles in EJB Development
EJB
Provider
Application
Assembler
App Server/
EJB Container
Provider
Deployer
System
Administrator
∗ A container is an execution environment for a
component. The component lives in the container and
the container provides the services for the
component.
∗ Similarly, a container lives in an application server,
which provides an execution environment for it and
other containers.
EJB Container and its Services
Contact Us On :
www.vibranttechnologies.co.in
∗ Persistence
Ex: simple connection pooling, automatic
persistence, etc. EJBs created with application
development tools will encapsulate data access in
components.
Services provided by an EJB container
Contact Us On :
www.vibranttechnologies.co.in
∗ Declarative transactions
∗ Data caching
∗ Declarative Security
∗ Error Handling
∗ Component Framework for Business Logic
∗ Scalability and Fall-Over
∗ Portability
∗ Manageability
Services provided by an EJB container
Contact Us On :
www.vibranttechnologies.co.in
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.
How the Container Provides Services
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
How the Container Provides Services
Contact Us On :
www.vibranttechnologies.co.in
Contracts
EJB Container/Application
Server
Enterprise JavaBean
Client
Contact Us On :
www.vibranttechnologies.co.in
∗ The developer of the EJB component must implement the
business methods in the implementation class
∗ The bean provider must implement the ejbCreate(),
ejbPostCreate(),ejbRemove() methods 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
∗ For session beans, the bean provider must implement the
container callbacks defined in the javax.ejb.SessionBean
interface
Rules for the bean programmer
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Contact Us On :
www.vibranttechnologies.co.in
∗ First, the client makes a call on the RMI stub
∗ This RMI stub interposes on the method call in order
to marshal parameters and send the information
across the network
∗ A skeleton on the server side unmarshals the
parameters and delivers them to the EJB Container
Interposition : method call to an EJB
Container from a remote client
Contact Us On :
www.vibranttechnologies.co.in
Interposition diagram
Interposition class
Client
Container
generated
class
EJB
RMI
Stub
RMI
Stub
Network
∗ The container will examine the security credentials of the
caller of the method
∗ It will start or join with any required transactions
∗ It will make any necessary calls to persistence functions
∗ It will trigger various callbacks to allow the EJB
Component to acquire resources
∗ Only after all this is done will the actual business method
be called
∗ Once it is called, the container will do some more work
with transactions, persistence, callbacks and returns data
or exception to the remote client
Interposition : from EJB Container
to EJBs
Contact Us On :
www.vibranttechnologies.co.in
The Enterprise JavaBeans specification is written for
three audiences:
∗ The Client developer
∗ The EJB developer
∗ The EJB container developer
Working with EJBs
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
The Client Developer’s View
Contact Us On :
Vibranttechnologies.co.in
∗ 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 interface
Contact Us On :
www.vibranttechnologies.co.in
∗ A client programmer will acquire an EJB’s
home interface through JNDI, and they use
this home interface to :
Sample client application
pseudo code
Create or find
instance of bean
Execute methods Reference
(Handle)
Remove bean
Contact Us On :
www.vibranttechnologies.co.in
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
Contact Us On :
www.vibranttechnologies.co.in
// 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(); }
} }
Client contd..
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
The Bean Programmer’s view
Contact Us On :
www.vibranttechnologies.co.in
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
Contact Us On :
www.vibranttechnologies.co.in
∗ 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..
Contact Us On :
www.vibranttechnologies.co.in
∗ 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; }
Order ManagementBean code..
Contact Us On :
www.vibranttechnologies.co.in
∗ 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}
∗ }
OrderManagementBean code..
Contact Us On :
www.vibranttechnologies.co.in
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
Contact Us On
www.vibranttechnologies.co.in
∗ package orderMgmt;
∗ import javax.ejb.*;
∗ public interface OrderManagementHome extends
javax.ejb.EJBHome
∗ {
∗ public OrderManagement create()
∗ throws java.rmi.RemoteException,
javax.ejb.CreateException;
∗ }
OrderManagementHome code..
Contact Us On :
www.vibranttechnologies.co.in
<?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
Contact Us On :
www.vibranttechnologies.co.in
<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>
The xml file : ejb-jar.xml
Contact Us On :
www.vibranttechnologies.co.in
META -INF
ejb-jar.xml
orderMgmt
OrderManagement.class
OrderManagementHome.class
OrderManagementBean.class
Structure of JAR file
Contact Us On :
www.vibranttechnologies.co.in
∗ You cannot use Reflection API to access
information inaccessible to you.
∗ You cannot create a class loader or replace a
security manager.
∗ You cannot set the socket factory used by
ServerSocket or Socket
∗ You cannot use the object substitution
features of the serialization protocol
What you can’t do in an EJB component?
Contact Us On :
www.vibranttechnologies.co.in
∗ use Threads or the Threading API
∗ use the AWT
∗ Act as a Network Server
∗ use Read/Write static fields
∗ use java.io package
∗ Load a native library
∗ use “this” as an Argument or Return value
∗ use Loopback Calls
What you can’t do in an EJB
component?
Contact Us On :
www.vibranttechnologies.co.in
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.
EJB Components on the
Web
Contact Us On :
www.vibranttechnologies.co.in
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
∗ UML use cases: UML is the Unified Modeling
Language, the standard language for expressing the
model of the software system that we intend to build.
∗ Use cases are subset of UML that expresses the
functionality of the software to be delivered. Use
cases describe what to do, but not how to do it.
Design of the EJB Tier
Contact Us On :
www.vibranttechnologies.co.in
∗ Interface Objects : The 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.
Analysis Objects
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
Control Objects
Contact Us On :
www.vibranttechnologies.co.in
∗ 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.
Entity Objects
Contact Us On :
www.vibranttechnologies.co.in
∗ 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, 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
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Contact Us On :
www.vibranttechnologies.co.in
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
∗ Interface Object :
Stereotype icons in UML
Entity Object :
Control Object :
∗ Actor User Interface Type Interface Object Impl’ation
Engineer Visual Basic Session Bean (RMI/IIOP)
Customer Web Application JavaBean proxy / S Bean
Operator Swing GUI Session Bean
Manager Web Application JavaBean proxy / S Bean
Crew Palm Pilot XHTML Servelet to Session Bean
Management Web Application JavaBean proxy / S Bean
Translation of analysis model into implementation
View of use case actors and their
respective interface objects
Engineer
Customer
Operator
Manager
Crew
Manage-
-ment
VB App
Web App
Swing app
Web App
Web App
Palm App
View of interaction of interface
and control objects
Ship
order
Build
Product
Select
Cancel
Place
Create
List
Overdue
VB
App
Web
App
Web
App
Web
App
Swing
App
Palm
App
View of interaction between control
objects and entity objects
RoutingProduct
Order
Shipment
Account
Supplier
Shipping
Company
Customer
Create
Product
Place
Order
Cancel
Order
Select for
Manufacture
Build
Product
Ship
Order
List
Overdue
∗ 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
Summary
Contact Us On :
www.vibranttechnologies.co.in
∗ 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
Summary
Contact Us On :
www.vibranttechnologies.co.in
Contact Us On : Vibranttechnologies.co.in

More Related Content

Viewers also liked

PyDiff - what python can teach us about beer
PyDiff - what python can teach us about beerPyDiff - what python can teach us about beer
PyDiff - what python can teach us about beerMartin Chorley
 
Complete price list of ishu gems
Complete price list of ishu gemsComplete price list of ishu gems
Complete price list of ishu gemsIshu Gems
 
Copyright and open source licensing
Copyright and open source licensingCopyright and open source licensing
Copyright and open source licensingRitambhara Agrawal
 
One Week | One Tool: ultra-rapid open source development among strangers
One Week | One Tool: ultra-rapid open source development among strangersOne Week | One Tool: ultra-rapid open source development among strangers
One Week | One Tool: ultra-rapid open source development among strangersrshanrath
 
Best training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingBest training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingvibrantuser
 
Update on Virtualization in Debian
Update on Virtualization in DebianUpdate on Virtualization in Debian
Update on Virtualization in DebianHenning Sprang
 
Developing a library_copyright_policy
Developing a library_copyright_policyDeveloping a library_copyright_policy
Developing a library_copyright_policyPDA Ekniga
 
Free Software/Free Culture Collaboration
Free Software/Free Culture CollaborationFree Software/Free Culture Collaboration
Free Software/Free Culture CollaborationMike Linksvayer
 
Maven Application Lifecycle Management for Alfresco
Maven Application Lifecycle Management for AlfrescoMaven Application Lifecycle Management for Alfresco
Maven Application Lifecycle Management for Alfrescoguest67a9ba
 
Ejb course in-mumbai
Ejb course in-mumbaiEjb course in-mumbai
Ejb course in-mumbaivibrantuser
 
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib...
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib..."Open Source licensing and software quality" by Monty Michael Widenius @ eLib...
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib...eLiberatica
 
How to join open source development
How to join open source developmentHow to join open source development
How to join open source developmentKan-Ru Chen
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with TomcatSudha Ch
 
Open Source Development And Media
Open Source Development And MediaOpen Source Development And Media
Open Source Development And MediaAndy Li
 
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and Demo
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and DemoTechEd NZ 2014: Intelligent Systems Service - Concept, Code and Demo
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and DemoIntergen
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係Kiwamu Okabe
 
BDM37 - Simon Grondin - Scaling an API proxy in OCaml
BDM37 - Simon Grondin - Scaling an API proxy in OCamlBDM37 - Simon Grondin - Scaling an API proxy in OCaml
BDM37 - Simon Grondin - Scaling an API proxy in OCamlBig Data Montreal
 

Viewers also liked (20)

PyDiff - what python can teach us about beer
PyDiff - what python can teach us about beerPyDiff - what python can teach us about beer
PyDiff - what python can teach us about beer
 
Country Club Asia’s Biggest New Year Bash 2015
Country Club Asia’s Biggest New Year Bash 2015Country Club Asia’s Biggest New Year Bash 2015
Country Club Asia’s Biggest New Year Bash 2015
 
Complete price list of ishu gems
Complete price list of ishu gemsComplete price list of ishu gems
Complete price list of ishu gems
 
Copyright and open source licensing
Copyright and open source licensingCopyright and open source licensing
Copyright and open source licensing
 
One Week | One Tool: ultra-rapid open source development among strangers
One Week | One Tool: ultra-rapid open source development among strangersOne Week | One Tool: ultra-rapid open source development among strangers
One Week | One Tool: ultra-rapid open source development among strangers
 
Best training-in-mumbai-shell scripting
Best training-in-mumbai-shell scriptingBest training-in-mumbai-shell scripting
Best training-in-mumbai-shell scripting
 
Update on Virtualization in Debian
Update on Virtualization in DebianUpdate on Virtualization in Debian
Update on Virtualization in Debian
 
Developing a library_copyright_policy
Developing a library_copyright_policyDeveloping a library_copyright_policy
Developing a library_copyright_policy
 
Free Software/Free Culture Collaboration
Free Software/Free Culture CollaborationFree Software/Free Culture Collaboration
Free Software/Free Culture Collaboration
 
Maven Application Lifecycle Management for Alfresco
Maven Application Lifecycle Management for AlfrescoMaven Application Lifecycle Management for Alfresco
Maven Application Lifecycle Management for Alfresco
 
Ejb course in-mumbai
Ejb course in-mumbaiEjb course in-mumbai
Ejb course in-mumbai
 
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib...
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib..."Open Source licensing and software quality" by Monty Michael Widenius @ eLib...
"Open Source licensing and software quality" by Monty Michael Widenius @ eLib...
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
How to join open source development
How to join open source developmentHow to join open source development
How to join open source development
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
 
Open Source Development And Media
Open Source Development And MediaOpen Source Development And Media
Open Source Development And Media
 
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and Demo
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and DemoTechEd NZ 2014: Intelligent Systems Service - Concept, Code and Demo
TechEd NZ 2014: Intelligent Systems Service - Concept, Code and Demo
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係
 
Fitness equipment dubai
Fitness  equipment dubaiFitness  equipment dubai
Fitness equipment dubai
 
BDM37 - Simon Grondin - Scaling an API proxy in OCaml
BDM37 - Simon Grondin - Scaling an API proxy in OCamlBDM37 - Simon Grondin - Scaling an API proxy in OCaml
BDM37 - Simon Grondin - Scaling an API proxy in OCaml
 

Similar to Ejb training institute in navi-mumbai

Similar to Ejb training institute in navi-mumbai (20)

Introcution to EJB
Introcution to EJBIntrocution to EJB
Introcution to EJB
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
Ejb
EjbEjb
Ejb
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
EJB 2
EJB 2EJB 2
EJB 2
 
Ejbandjsp 200119145750
Ejbandjsp 200119145750Ejbandjsp 200119145750
Ejbandjsp 200119145750
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
EJB.docx
EJB.docxEJB.docx
EJB.docx
 
J2ee connector architecture
J2ee connector architectureJ2ee connector architecture
J2ee connector architecture
 
Ejb and jsp
Ejb and jspEjb and jsp
Ejb and jsp
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
EJ NOV-18 (Sol) (E-next.in).pdf
EJ NOV-18 (Sol) (E-next.in).pdfEJ NOV-18 (Sol) (E-next.in).pdf
EJ NOV-18 (Sol) (E-next.in).pdf
 
Suman
SumanSuman
Suman
 
Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021Microservices made easy JavaCro 2021
Microservices made easy JavaCro 2021
 
Introduction to Java EE EJB Component
Introduction to Java EE EJB ComponentIntroduction to Java EE EJB Component
Introduction to Java EE EJB Component
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
Enterprice java
Enterprice javaEnterprice java
Enterprice java
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Ejb training institute in navi-mumbai

  • 1. WELCOME TO VIBRANT TECHNOLOGIES & COMPUTERS -------------------------- ONLINE EJB TRAINING PPTS Address: K1/4 2nd Floor,Sec-15/16 Market Opp to Vaidehi Hotel, Vashi, Navi Mumbai, Maharashtra 400703 Phone:098929 00103
  • 2. Contact Us On : Vibranttechnologies.co.in
  • 3. ∗ What is EJB? ∗ Key features of EJB technology ∗ EJB vs JavaBeans ∗ Varieties of Beans ∗ Why use EJBs in your design? ∗ EJB Architecture ∗ EJB Container and its Services ∗ Services provided by an EJB container ∗ How the Container Provides Services ∗ Contracts ∗ Rules for the bean programmer ∗ Interposition : method call to an EJB Container from a remote client ∗ Interposition diagram ∗ Working with EJBs ∗ EJB Clients ∗ The Client Developer’s View ∗ EJB’s interface Contact Us On : www.vibranttechnologies.co.in Content :
  • 4. ∗ Client.java ∗ Client contd.. ∗ The Bean Programmer’s view ∗ Interface EJB Object ∗ Order Management code.. ∗ Order ManagementBean code.. ∗ Interface EJBHome ∗ The xml file : ejb-jar.xml ∗ Structure of JAR file ∗ What you can’t do in an EJB component? ∗ EJB Components on the Web ∗ Implementation of MVC in a web site ∗ Design of the EJB Tier ∗ Analysis Objects ∗ View of interaction between control ∗ objects and entity objects Contact Us On : www.vibranttechnologies.co.in Content :
  • 5. ∗ 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. What is EJB? Contact Us On : www.vibranttechnologies.co.in
  • 6. ∗ 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. What is EJB? Contact Us On : www.vibranttechnologies.co.in
  • 7. ∗ EJB components are server-side components written entirely in the Java programming language ∗ EJB components contain business logic only - no System-level programming ∗ System-level services (i.e. "plumbing") such as transactions, security, Life-cycle, threading, persistence, etc. are automatically managed for the EJB component by the EJB server Key features of EJB technology Contact Us On : www.vibranttechnologies.co.in
  • 8. ∗ 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 Key features of EJB technology Contact Us On : www.vibranttechnologies.co.in
  • 9. ∗ 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) EJB vs JavaBeans Contact Us On : www.vibranttechnologies.co.in
  • 10. ∗ 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 Contact Us On : www.vibranttechnologies.co.in
  • 11. ∗ Session Beans Stateful session bean Stateless session bean ∗ Entity Beans With container-managed persistence With bean-managed persistence ∗ Message-Driven Beans Varieties of Beans Contact Us On : www.vibranttechnologies.co.in
  • 12. ∗ 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. Why use EJBs in your design? Contact Us On : www.vibranttechnologies.co.in
  • 13. ∗ 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. Why use EJBs in your design? Contact Us On : www.vibranttechnologies.co.in
  • 14. EJB Architecture J2EE Application Server EJB Container Application Logic DataClient RDBMS Corba Mail RMI JDBC Java Mail JMS JTA Session Bean Entity Bean Client Application
  • 15. ∗ 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 Roles in EJB Development Contact Us On : www.vibranttechnologies.co.in
  • 16. ∗ 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. Roles in EJB Development Contact Us On : www.vibranttechnologies.co.in
  • 17. Roles in EJB Development EJB Provider Application Assembler App Server/ EJB Container Provider Deployer System Administrator
  • 18. ∗ A container is an execution environment for a component. The component lives in the container and the container provides the services for the component. ∗ Similarly, a container lives in an application server, which provides an execution environment for it and other containers. EJB Container and its Services Contact Us On : www.vibranttechnologies.co.in
  • 19. ∗ Persistence Ex: simple connection pooling, automatic persistence, etc. EJBs created with application development tools will encapsulate data access in components. Services provided by an EJB container Contact Us On : www.vibranttechnologies.co.in
  • 20. ∗ Declarative transactions ∗ Data caching ∗ Declarative Security ∗ Error Handling ∗ Component Framework for Business Logic ∗ Scalability and Fall-Over ∗ Portability ∗ Manageability Services provided by an EJB container Contact Us On : www.vibranttechnologies.co.in
  • 21. 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. How the Container Provides Services Contact Us On : www.vibranttechnologies.co.in
  • 22. ∗ 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. How the Container Provides Services Contact Us On : www.vibranttechnologies.co.in
  • 24. ∗ The developer of the EJB component must implement the business methods in the implementation class ∗ The bean provider must implement the ejbCreate(), ejbPostCreate(),ejbRemove() methods 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 ∗ For session beans, the bean provider must implement the container callbacks defined in the javax.ejb.SessionBean interface Rules for the bean programmer Contact Us On : www.vibranttechnologies.co.in
  • 25. ∗ 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 Contact Us On : www.vibranttechnologies.co.in
  • 26. ∗ First, the client makes a call on the RMI stub ∗ This RMI stub interposes on the method call in order to marshal parameters and send the information across the network ∗ A skeleton on the server side unmarshals the parameters and delivers them to the EJB Container Interposition : method call to an EJB Container from a remote client Contact Us On : www.vibranttechnologies.co.in
  • 28. ∗ The container will examine the security credentials of the caller of the method ∗ It will start or join with any required transactions ∗ It will make any necessary calls to persistence functions ∗ It will trigger various callbacks to allow the EJB Component to acquire resources ∗ Only after all this is done will the actual business method be called ∗ Once it is called, the container will do some more work with transactions, persistence, callbacks and returns data or exception to the remote client Interposition : from EJB Container to EJBs Contact Us On : www.vibranttechnologies.co.in
  • 29. The Enterprise JavaBeans specification is written for three audiences: ∗ The Client developer ∗ The EJB developer ∗ The EJB container developer Working with EJBs Contact Us On : www.vibranttechnologies.co.in
  • 30. ∗ 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 Contact Us On : www.vibranttechnologies.co.in
  • 31. ∗ 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. The Client Developer’s View Contact Us On : Vibranttechnologies.co.in
  • 32. ∗ 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 interface Contact Us On : www.vibranttechnologies.co.in
  • 33. ∗ A client programmer will acquire an EJB’s home interface through JNDI, and they use this home interface to : Sample client application pseudo code Create or find instance of bean Execute methods Reference (Handle) Remove bean Contact Us On : www.vibranttechnologies.co.in
  • 34. 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 Contact Us On : www.vibranttechnologies.co.in
  • 35. // 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(); } } } Client contd.. Contact Us On : www.vibranttechnologies.co.in
  • 36. ∗ 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. The Bean Programmer’s view Contact Us On : www.vibranttechnologies.co.in
  • 37. 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 Contact Us On : www.vibranttechnologies.co.in
  • 38. ∗ 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.. Contact Us On : www.vibranttechnologies.co.in
  • 39. ∗ 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; } Order ManagementBean code.. Contact Us On : www.vibranttechnologies.co.in
  • 40. ∗ 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} ∗ } OrderManagementBean code.. Contact Us On : www.vibranttechnologies.co.in
  • 41. 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 Contact Us On www.vibranttechnologies.co.in
  • 42. ∗ package orderMgmt; ∗ import javax.ejb.*; ∗ public interface OrderManagementHome extends javax.ejb.EJBHome ∗ { ∗ public OrderManagement create() ∗ throws java.rmi.RemoteException, javax.ejb.CreateException; ∗ } OrderManagementHome code.. Contact Us On : www.vibranttechnologies.co.in
  • 46. ∗ You cannot use Reflection API to access information inaccessible to you. ∗ You cannot create a class loader or replace a security manager. ∗ You cannot set the socket factory used by ServerSocket or Socket ∗ You cannot use the object substitution features of the serialization protocol What you can’t do in an EJB component? Contact Us On : www.vibranttechnologies.co.in
  • 47. ∗ use Threads or the Threading API ∗ use the AWT ∗ Act as a Network Server ∗ use Read/Write static fields ∗ use java.io package ∗ Load a native library ∗ use “this” as an Argument or Return value ∗ use Loopback Calls What you can’t do in an EJB component? Contact Us On : www.vibranttechnologies.co.in
  • 48. 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. EJB Components on the Web Contact Us On : www.vibranttechnologies.co.in
  • 49. 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
  • 50. ∗ UML use cases: UML is the Unified Modeling Language, the standard language for expressing the model of the software system that we intend to build. ∗ Use cases are subset of UML that expresses the functionality of the software to be delivered. Use cases describe what to do, but not how to do it. Design of the EJB Tier Contact Us On : www.vibranttechnologies.co.in
  • 51. ∗ Interface Objects : The 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. Analysis Objects Contact Us On : www.vibranttechnologies.co.in
  • 52. ∗ 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. Control Objects Contact Us On : www.vibranttechnologies.co.in
  • 53. ∗ 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. Entity Objects Contact Us On : www.vibranttechnologies.co.in
  • 54. ∗ 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, 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 Contact Us On : www.vibranttechnologies.co.in
  • 55. ∗ 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 Contact Us On : www.vibranttechnologies.co.in
  • 56. 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
  • 57. ∗ Interface Object : Stereotype icons in UML Entity Object : Control Object :
  • 58. ∗ Actor User Interface Type Interface Object Impl’ation Engineer Visual Basic Session Bean (RMI/IIOP) Customer Web Application JavaBean proxy / S Bean Operator Swing GUI Session Bean Manager Web Application JavaBean proxy / S Bean Crew Palm Pilot XHTML Servelet to Session Bean Management Web Application JavaBean proxy / S Bean Translation of analysis model into implementation
  • 59. View of use case actors and their respective interface objects Engineer Customer Operator Manager Crew Manage- -ment VB App Web App Swing app Web App Web App Palm App
  • 60. View of interaction of interface and control objects Ship order Build Product Select Cancel Place Create List Overdue VB App Web App Web App Web App Swing App Palm App
  • 61. View of interaction between control objects and entity objects RoutingProduct Order Shipment Account Supplier Shipping Company Customer Create Product Place Order Cancel Order Select for Manufacture Build Product Ship Order List Overdue
  • 62. ∗ 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 Summary Contact Us On : www.vibranttechnologies.co.in
  • 63. ∗ 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 Summary Contact Us On : www.vibranttechnologies.co.in
  • 64. Contact Us On : Vibranttechnologies.co.in