Download Enterprise Java Beans

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Enterprise Java Beans
COPMILED BY BJ
1
CHAPTER 3. EJB Architecture
•
•
•
•
Overview of EJB software architecture.
View of EJB Conversation.
Building and Deploying EJBs.
Roles in EJB.
COPMILED BY BJ
2
Application Server
• Application server provides Middleware
Services Such as polling,Networking,Security
Caching & transaction management to
distributed Enterprise application.
COPMILED BY BJ
3
Enterprise Java Beans
• EJB provides a consistent framework for creating
distributed n-tier middleware architecture. it
enables the development & deployment of
component based robust, highly scalable &
transactional business applications.
• An EJB is server side component that executes
specific business logic which is deployed on
Application server & provides services to local &
remote client.
• Its A component model For developing objectoriented distributed enterprise-level applications
COPMILED BY BJ
4
Advantages Of EJB
• Simplifies development of small & large enterprise
application by providing standard system level
services to the component from container.
• Its component based architecture promotes
reusability of existing component.
• Its scalability facilitates easy addition/removal of
server side resources.
• Its Business logic resides in bean component so
client need to concentrate only on development of
user interface
COPMILED BY BJ
5
Advantages Of EJB
•
•
•
•
•
•
Transaction management
Platform independence
Scalable environment
Secure access
Multi-tier architecture
easier development process
COPMILED BY BJ
6
Disadvantages of EJB
It has a large complicated specification
It has heavy-weighted framework.
Its difficult to code and debug
Its only suitable for highly scalable secure
transactional object
• It has steep learning curve
•
•
•
•
COPMILED BY BJ
7
Architecture of EJB
COPMILED BY BJ
8
Architecture of EJB
• 1) EJB SERVER
It Host EJB Containter.It provides the execution
environment for the server component & also provides
System Services such as Multiprocessing, load balancing,
device acces,naming & transaction processing.
2) EJB Container
It serves as an interface between EJB & outside world.
An EJB Client cannot access the bean directly however it
can access the bean through Container-Generated Method.
Container can be categorized on basis of its type
Session Container contains transient,nonpersistent
EJBs,Entity Container Conatins Persistent EJBs whose states
are saved between invocation.
COPMILED BY BJ
9
Architecture of EJB
The Container host following Component
-> EJB Object -: client invokes bean instance through EJB
Object it accept request from client & delegate it to Bean
instance .
-> Remote interface -:it duplicate the methods of bean class
hence all client access remote object through this interface
-> Home Object -: The client creates & destroy EJB object
through EJB object factory called home object.
-> Home interface -: it expose the methods for creating
destroying & finding bean object through Home interface.
-> Local interface -: its used instead of remote interface to
make process faster for creating bean through home
interface & calling through remote interface.
COPMILED BY BJ
10
Architecture of EJB
3) Enterprise beans -:
-> They are JavaEE Component that implements business
logic of the application. The EJB container act as runtime
Environment for enterprise beans.
-> It provides System level Services such as security &
transaction to its enterprise beans.
They are of three types depends on functionality
-> Session beans represent an action or a process that
executes Synchronously
-> Message driven beans -: represent an action or a process
that executes asynchronously.
-> Entity beans -: represents data or unique record in
database.
COPMILED BY BJ
11
Architecture of EJB
4) EJB Client -: it make use of EJB beans to perform their
operation. Client locate EJB Container using JNDI then
invoke EJB beans through container.
5) Deployment Descriptor
It’s a list of properties & elements as follows
Home & remote interface ->bean management
Bean implementation class -> lifecycle requirement
JNDI name for beans
->persistent Requirement
Environment variables
Transactional attributes
COPMILED BY BJ
Security requirement such access
right/roles
12
View of EJB Conversion (bean invocation process)
COPMILED BY BJ
13
View of EJB Conversion
• EJB is a Server side component to get the services
hosted by EJB, the client has to communicate with
the ejb Component. To converse with Enterprise
beans the client has to perform foll.task
1)Locating the enterprise Bean -:
• its done through naming service that associates a
symbolic name with object a DNS maps the
symbolic m/c name to ip.
• when client queries DNS server for a particular
bean object the IP address is returned if the DNS
server can resolve the same. otherwise Client
queries for another DNS for the same object. Once
server is able to resolve the name it returns address
to client.
COPMILED BY BJ
14
• There two ways used by client to find a beans
• 1) Using Java Naming & Directory Interface
java client uses JNDI to lookup EJB component
JNDI call returns a ref to obj implementng EJB
component.
• 2) Using CORBA’S Common object
service(cos)
naming service of COS can also be used for this
purpose.
COPMILED BY BJ
15
b) Accessing Bean
The look method in the naming service returns a
refrence to the home object that implements
a home interface of the EJB component. The
client then uses the home interface to lookup
for existing ejb instances if no such instances
is available then new one is created
This lookup method returns a refrence to the ejb
object remote interface.the client then uses
this intrface to interact with the EJB object in
the server.
COPMILED BY BJ
16
c)Calling bean’ method
Once the client obtain the refrence of the
remote object it can then invoke the public
methods on the remote ejb object
d) Destroying Bean
When the client has completed its interaction
with the remote enterprise bean it invoke the
remove() on the home interface or on the
objects remote interface. This method
implication on diffrent types of beans
COPMILED BY BJ
17
a)When remove() method is invokes on stateful
session beans the container can discard it and
free the space occupied by it.
b) When remove() method is invokes on
stateless session beans the simply returns the
instance in to the pool
c) When remove() method is invokes on Entity
beans it removes the underlying object from
persistence Storage.
COPMILED BY BJ
18
ROLES IN EJB
COPMILED BY BJ
19
ROLES IN EJB
• To have an ejb deployed and running needs more
than an application server and
components.parties associated with EJB
development and deployment as shown in fig.
• 1)Bean provider
He supplies the business componetnts that can be
assembled in to an enterprise application each
business component is an individual Entity tha t
can perform its task
• 2)Application asembler
He is responsible for integrating the component
COPMILED BY BJ
20
To develop the enterprise application. he may
also need to provide user interface client
program he is analogous to system integrator
• 3)EJB deployer
He configures the security ,transactions and the
performance of the system this is essential to
install the application in application server he
receicves the EJB-JAR files and install it in
container.He is like System Administrator.
• 4)System Administrator
He is responsible for maintaining and
monitoring the deployed system he uses
monitoring and mangement tools for this
purpose.
COPMILED BY BJ
21
• 5)EJB Container/Server provider
An ejb server provider provides services to the
ejb container which provide services to an
enterprise bean he supplies the ejb container
and the run time environment for the
beans.also provides middleware services to the
component and manages them.
• 6)Tool vendors
They supply IDEs to facilate the rapid modeling
building and debuging of the components
some e.g of such tools are Rational rose
modeling,Eclipse for buildng application and
junit for testing.
COPMILED BY BJ
22
JAVA Beans vs Enterprise Java Beans
1)JavaBeans may be visible or non-visible at runtime.
2)JavaBeans are intended to be local to a single process and are
primarily intended to run on the client side. Although one can
develop server-side JavaBeans, it is far easier to develop them using
the EJB specification instead.
3)JavaBeans is a component technology to create generic Java
components that can be composed together into applets and
applications.
4)JavaBeans have an external interface called the properties interface,
which allows a builder tool to interpret the functionality of the bean.
5)JavaBeans may have BeanInfo classes, property editors or Customizers
6)JavaBeans have no types.
7)No explicit support exists for transactions in JavaBeans.
8)Component bridges are available for JavaBeans.
9) JavaBeans is a framework for client-side
Java components
COPMILED BY BJ
23
JAVA Beans vs Enterprise Java Beans
1)An EJB is a no visual, remote object.
2)EJB's are remotely executable components or business objects that can be
deployed only on the server.
3)Even though EJB is a component technology, it neither builds upon nor
extends the original JavaBean specification.
4)EJBs have a deployment descriptor that describes its functionality to an
external builder tool or IDE
5)EJB's have no concept of BeanInfo classes, property editors or customizers
and provide no additional information other than that described in the
deployment descriptor.
6)EJBs are of three types - session beans ,message driven beans and entity
beans.
7)EJB's may be transactional and the EJB servers provide transactional support.
8)An EJB cannot be deployed as an ActiveX control because ActiveX controls
are intended to run at the Client side and EJB's are server side components.
9) Enterprise JavaBeans is a framework for building and deploying server-side
COPMILED BY BJ
24
Java components
JAVA Beans vs Enterprise Java Beans
• Java bean uses Single tier architecture While EJB
uses Multi tier architecture
• Conceptually both are related because both are
components but their specifications are
different. The specifications do not build on
each other or rely on each other
COPMILED BY BJ
25
Thank you
COPMILED BY BJ
26