UNIT 4
1.Introduction to Enterprise JavaBeans
2.Working with Session Beans
3.Working with Message Driven Bean
4.Interceptors
5.Java Naming and Directory Interface
INTRODUCTION TO ENTERPRISE JAVABEANS
ENTERPRISE BEAN
• Business components developed using EJB architecture are called as Enterprise
JavaBeans Components or Enterprise Beans.
• EJB is a server-side component that encapsulates the code that fullfill the
purpose of the application.
• Main purpose of introducing EJB s for building distributed components.
• It is powerful & sophisticated technology that helps developersto built business
applications that support very large no of users simultaneously.
• EJB is capable of maintaining data integrity even though data is processed
concurrently by multiple users, thus making them transaction enabled.
• EJB components can be assembled and reassembled into different distributed
applications as per the requirements.
ENTERPRISE BEAN CONTAINER
BENEFITS OF ENTERPRISE BEAN
1. Complete focus only on business logic
2. Reusable components
3. Portable
4. Fast building of applications.
5. One business logic having many presentation logics.
6. Distributed Deployment.
7. Application Interoperability.
1.COMPLETE FOUCUS ONLY ON BUSINESS LOGIC
• Enterprise bean live and run in the server under the control if EJB container.
• It provides all big infrastructure services such as: Security,Networking,Persistence
etc. during deployment
• Developers can use these services with minimal effort and time, thus making
writing an EJB easy.
• EJB model seprates system level services from business logic, which permits
server vendor to concentrate on system level functionalities, while developer can
concentrate fully on business logic.
2. RESUABLE COMPONENTS
• An enterprise bean can be reused by assembling them in several different
applications.
• For each application, making simple changes in DD without changing the source
code can customize its behaviour with underlying services.
• Other applications can resuse the deployed bean, by making calls to its client
view interfaces.
3. PORTABLE
• EJB use Java language which is portable across multiple platforms.
• With EJB’s write-once-deploy-anywhere concept, developers & customers are
free from being at the mercy of application server vendor.
• The EJB environment automatically maps component to the underlying vendor-
specific infrastructure services.
4. FAST BUILDING OF APPLICATIONS
• With component based EJB architecture, the development, enhancing the
functionalities and maintenance of complex enterprise applications becomes
easier.
• With its clear definition of roles and well defined interfaces, the EJB architecture
promotes & supports team-based devlpomentnand lessens the demands on
individual developers.
5. ONE BUSINESS LOGIC HAVE MANY PRESENTATION LOGIC
• The EJB model allows the business developer to concentrate on business logic
while Web page designer concentrates on formatting the output.
• This sepration makes it possible to develop multiple presentation logic for the
same business process or to change the presentation logic of a business process
without needing to modify the code that implements business process.
6. DISTRIBUTED DEPLOYMENT
• The enterprise bean, business components of distributed system are deployed
carocss multiple servers on network.
• EJB architecture provides infrastructure where one bean can communicate with
another bean object or client situated on different machines working in different
environment successfully.
7. APPLICATION INTEROPERABILITY
• EJB architecture is mapped to standards followed by CORBA, which is an
industrial standard.
• Hence, its relatively simple to craft an EJB and make it work with components
developed in different language like VC++ and many more using CORBA.
• The EJB’s client-view interface serves as a well defined integration point between
components built using different programming languages.
TYPES OF ENTERPISE BEAN
ENTERPRISE BEAN APPLICATION
FILES CREATED TO DEVELOP
ENTERPRISE BEAN
DESCRIPTION
Enterpise Bean class • It is the class that implements the business methods
of the enterpise bean and any life cycle callback
methods.
Business Interfaces • It defines the business methods implemented by the
entrpise bean class.
Helper Classes • Other classes that are needed by the enterpsie bean
class such as exception and utility classes.
2. WORKING WITH SESSION BEANS
TYPES OF SESSION BEANS DESCRIPTION
1. STATELESS SESSION BEANS 1. They are the business objects that hold conversations for a single client-invoked method calls.
2. They do not maintain any conversational state associated with any client.
3. Two or more different clients cannot share a stateless session bean instance.
4. These beans are used for simple tasks.They have 2 common features:
a. They represent actions.
b. They can be performed in a single step.
2. STATEFULL SESSION BEANS 1. It is a server side object designed to hold data on behalf of a particular client.
2. It holds conversation for multiple client-invoked method calls.
3. It provides easy and robust way to handle conversational state.
4. This bean is designed to service business processes that span multiple method requests.
5. It should be used to store session oriented data.
6. They are useful :
a) The bean’s state represents the interaction between bean and specific user.
b) Bean needs to hold information about the client across method invocations.
3. SINGLETON SESSION BEAN 1. It is used to share application-wide data & support concurrent access.
2. They are instantiated once per application& exist for lifecycle of the application.
3. All singleton session beans are transactional & thread safe by default.
4. These kind of session beans are useful where single enterprise bean instance is shared across
What is Naming Service?
• Enterprise applications are crafted using multiple modules.These are the objects
of that modules.
• Each of these objects, when instantiated in memory must be bound to a specific
address that will permit it ot be instantly located , on demand.
• Handles to such objects are often referred to as references or pointers.
• Such handles can be local to the memory of a single computer or be spread
across the memory of multiple computers in a distributed environment.
• Handles are often not human readable and frequently have communication
protocols, plateform and current execution environment information bound to
them.
WHAT IS A DIRECTORY SERVICE?
• A directory service is a software application ,which stores and organizes information about computer network’s
users and network resources.
• This allows network administrator to manage user’s access to network resources.
• Directory services act as an abstraction layer between users and shared resources on a network.
• A directory service , called a naming service binds names of network resources to their respective network
addresses.
• With the name/service type of directory , a user does not have to remember the physical address of a network
resource.
• Simply providing name will locate the resource using the directory service.
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx
UNIT 4.pptx

UNIT 4.pptx

  • 1.
    UNIT 4 1.Introduction toEnterprise JavaBeans 2.Working with Session Beans 3.Working with Message Driven Bean 4.Interceptors 5.Java Naming and Directory Interface
  • 2.
  • 8.
    ENTERPRISE BEAN • Businesscomponents developed using EJB architecture are called as Enterprise JavaBeans Components or Enterprise Beans. • EJB is a server-side component that encapsulates the code that fullfill the purpose of the application. • Main purpose of introducing EJB s for building distributed components. • It is powerful & sophisticated technology that helps developersto built business applications that support very large no of users simultaneously. • EJB is capable of maintaining data integrity even though data is processed concurrently by multiple users, thus making them transaction enabled. • EJB components can be assembled and reassembled into different distributed applications as per the requirements.
  • 9.
  • 11.
    BENEFITS OF ENTERPRISEBEAN 1. Complete focus only on business logic 2. Reusable components 3. Portable 4. Fast building of applications. 5. One business logic having many presentation logics. 6. Distributed Deployment. 7. Application Interoperability.
  • 12.
    1.COMPLETE FOUCUS ONLYON BUSINESS LOGIC • Enterprise bean live and run in the server under the control if EJB container. • It provides all big infrastructure services such as: Security,Networking,Persistence etc. during deployment • Developers can use these services with minimal effort and time, thus making writing an EJB easy. • EJB model seprates system level services from business logic, which permits server vendor to concentrate on system level functionalities, while developer can concentrate fully on business logic.
  • 13.
    2. RESUABLE COMPONENTS •An enterprise bean can be reused by assembling them in several different applications. • For each application, making simple changes in DD without changing the source code can customize its behaviour with underlying services. • Other applications can resuse the deployed bean, by making calls to its client view interfaces. 3. PORTABLE • EJB use Java language which is portable across multiple platforms. • With EJB’s write-once-deploy-anywhere concept, developers & customers are free from being at the mercy of application server vendor. • The EJB environment automatically maps component to the underlying vendor- specific infrastructure services.
  • 14.
    4. FAST BUILDINGOF APPLICATIONS • With component based EJB architecture, the development, enhancing the functionalities and maintenance of complex enterprise applications becomes easier. • With its clear definition of roles and well defined interfaces, the EJB architecture promotes & supports team-based devlpomentnand lessens the demands on individual developers. 5. ONE BUSINESS LOGIC HAVE MANY PRESENTATION LOGIC • The EJB model allows the business developer to concentrate on business logic while Web page designer concentrates on formatting the output. • This sepration makes it possible to develop multiple presentation logic for the same business process or to change the presentation logic of a business process without needing to modify the code that implements business process.
  • 15.
    6. DISTRIBUTED DEPLOYMENT •The enterprise bean, business components of distributed system are deployed carocss multiple servers on network. • EJB architecture provides infrastructure where one bean can communicate with another bean object or client situated on different machines working in different environment successfully. 7. APPLICATION INTEROPERABILITY • EJB architecture is mapped to standards followed by CORBA, which is an industrial standard. • Hence, its relatively simple to craft an EJB and make it work with components developed in different language like VC++ and many more using CORBA. • The EJB’s client-view interface serves as a well defined integration point between components built using different programming languages.
  • 16.
  • 23.
    ENTERPRISE BEAN APPLICATION FILESCREATED TO DEVELOP ENTERPRISE BEAN DESCRIPTION Enterpise Bean class • It is the class that implements the business methods of the enterpise bean and any life cycle callback methods. Business Interfaces • It defines the business methods implemented by the entrpise bean class. Helper Classes • Other classes that are needed by the enterpsie bean class such as exception and utility classes.
  • 27.
    2. WORKING WITHSESSION BEANS
  • 30.
    TYPES OF SESSIONBEANS DESCRIPTION 1. STATELESS SESSION BEANS 1. They are the business objects that hold conversations for a single client-invoked method calls. 2. They do not maintain any conversational state associated with any client. 3. Two or more different clients cannot share a stateless session bean instance. 4. These beans are used for simple tasks.They have 2 common features: a. They represent actions. b. They can be performed in a single step. 2. STATEFULL SESSION BEANS 1. It is a server side object designed to hold data on behalf of a particular client. 2. It holds conversation for multiple client-invoked method calls. 3. It provides easy and robust way to handle conversational state. 4. This bean is designed to service business processes that span multiple method requests. 5. It should be used to store session oriented data. 6. They are useful : a) The bean’s state represents the interaction between bean and specific user. b) Bean needs to hold information about the client across method invocations. 3. SINGLETON SESSION BEAN 1. It is used to share application-wide data & support concurrent access. 2. They are instantiated once per application& exist for lifecycle of the application. 3. All singleton session beans are transactional & thread safe by default. 4. These kind of session beans are useful where single enterprise bean instance is shared across
  • 44.
    What is NamingService? • Enterprise applications are crafted using multiple modules.These are the objects of that modules. • Each of these objects, when instantiated in memory must be bound to a specific address that will permit it ot be instantly located , on demand. • Handles to such objects are often referred to as references or pointers. • Such handles can be local to the memory of a single computer or be spread across the memory of multiple computers in a distributed environment. • Handles are often not human readable and frequently have communication protocols, plateform and current execution environment information bound to them.
  • 47.
    WHAT IS ADIRECTORY SERVICE? • A directory service is a software application ,which stores and organizes information about computer network’s users and network resources. • This allows network administrator to manage user’s access to network resources. • Directory services act as an abstraction layer between users and shared resources on a network. • A directory service , called a naming service binds names of network resources to their respective network addresses. • With the name/service type of directory , a user does not have to remember the physical address of a network resource. • Simply providing name will locate the resource using the directory service.