Enterprise Java Beans (EJB)
Enterprise Java Beans:
Enterprise JavaBeans (EJB) technology is the server-side component architecture for Java Platform, Enterprise Edition (Java EE). EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology.
Bean can be called as a reusable component. Enterprise Java Bean is a bean designed to run inside an EJB server. EJB is supplemented by a deployment descriptor, an XML file which provides the container with information about how the bean is to be deployed.
EJB Roles:
Enterprise Bean Provider - application domain expert who writes the Java code and the deployment descriptor. Work product is ejb jar files.
Application Assembler - assembles beans into larger units and with other components such as JSP..etc and also producing jar files.
Deployer - installs the jar files in specific environment
Server provider - provides the environment to run EJBs in different servers such as BEA, IBM, Sun. etc.
Container provider - provides the thing the server runs in.
EJB class will interact with other EJBs via interfaces.
Different Types of EJB's:
Session Beans -- represent an interaction or work process which lies on behalf on the client.
Stateless Session Beans - No information will be retained by the object between method calls
Stateful Session Beans - Data will be retained by the object
Entity Beans - represent persistence objects, typically stored in a database.
They are of two types.
Container managed persistence -- Mean the server generates the necessary SQL to insert/update/delete data.
Bean managed persistence -- Programmer writes the necessary code
Message Beans -- process Java Message Service (JMS) messages
Interfaces in EJB:
Entity and Session Beans can support two kinds of client interfaces
Home interfaces Used to create, find and destroy bean instances this will be Obtained via a name (JNDI)
Business interface Provides business logic API, Obtained from home interfaces
Interface versions:
Remote interfaces can be used anywhere and are most flexible.
Local interfaces can only be used inside the EJB server but these are more efficient
Bean class have to implement SessionBean or EntityBean interfaces.
Remote interface will extend javax.ejb.EJBObject class
Home interface will extend javax.ejb.EJBHome class
Archive files:
Java archive (jar) files are used to package data for deployment
ear - Enterprise Archive file
war - Web archive file
rar - resource adapter
0 comments:
Post a Comment