17-04-2012, 02:43 PM
Enterprise Java Beans (EJB) integration
peycckycuv62659PEYCCKYCUV.ppt (Size: 237 KB / Downloads: 40)
CDATA
CDATA Sections are used to escape blocks of text containing characters which would otherwise be recognized as markup.
CDATA blocks have been provided as a convenience measure when you want to include large blocks of special characters as character data, but you do not want to have to use entity references all the time.
For example writing a tutorial about XML would contain:
"In XML you need elements which have a starting tag <song> and end tag</song>"
The markup for this sentence would be:
<div> In XML you need elements which have a starting tag <song> and end tag </song></div>
In order to avoid this misconvenience, XML has a method to treat markup as text (or CDATA). This is done by simply enclosing the text with markup that we want to displayed (not interpreted) in a CDATA element.
"<!CDATA[In XML you need elements which have a starting tag <song> and end stag </song>]]>"
Environment elements
Each enterprise bean defines its OWN set of environment entries. All instances of an enterprise bean within the same home share the same environment entries;
the environment entries are not shared with other enterprise beans. Enterprise bean instances are NOT ALLOWED to modify the bean's environment at runtime.
Each env-entry element describes a single environment entry. The env-entry element consists of an optional description of the environment entry,
Referencing EJB
EJB can refer other EJB either locally or remotely by using <ejb-local-ref> element or <ejb-ref> element.
<ejb-local-ref> is used to declare a local reference to EJB’s that are co-located in the same container and should be deployed in the same EJB-JAR file.
Reference Other Resource
External references are specified by <resource-ref>
<description> is used to describe the external resource
<res-ref-name> is the name assigned to the external resource.
<res-type> specifies the type of the resource
<res-auth>indicates the service responsible for login.
Stateless vs Stateful
Statelesss session beans are more resource efficient than a Stateful session bean because a stateless bean is used by the EJB container to service another request instead of waiting for the next method call.
Stateless is shared amongst clients where stateful is dedicates to a client.
The more clients use the statefull session bean ,the more resources are necessary to support those clients
Entity Java Bean
It is used to manage a collection of data retrieved from a database and stored in memory.
It inserts,Updates,removes data while maintaining the integrity of data.
Data collected and managed by entity bean is called persistant data which in managed in two ways.
Bean Managed Persistance
Container Managed Persistance.
CMP entity bean remote interface
Import javax.ejb.EJBObject;
Import java.rmi.RemoteException;
Public interface myEJBRemote extends EJBObject{
Public getProduct() throws RemoteException;
Public setProduct(Product prod()) throws Remote Exception;
JAR File
EJB classes and related files are packaged together into JAR file for deployment.
It is a compressed format which is designed to reduce the size
JAR file used to Package an EJB must contain the following
EJB Classes
Dependent Classes
Remote Interface
Home Interface
Dependent Interfaces
Primary Key Class
Deployment Descriptor
peycckycuv62659PEYCCKYCUV.ppt (Size: 237 KB / Downloads: 40)
CDATA
CDATA Sections are used to escape blocks of text containing characters which would otherwise be recognized as markup.
CDATA blocks have been provided as a convenience measure when you want to include large blocks of special characters as character data, but you do not want to have to use entity references all the time.
For example writing a tutorial about XML would contain:
"In XML you need elements which have a starting tag <song> and end tag</song>"
The markup for this sentence would be:
<div> In XML you need elements which have a starting tag <song> and end tag </song></div>
In order to avoid this misconvenience, XML has a method to treat markup as text (or CDATA). This is done by simply enclosing the text with markup that we want to displayed (not interpreted) in a CDATA element.
"<!CDATA[In XML you need elements which have a starting tag <song> and end stag </song>]]>"
Environment elements
Each enterprise bean defines its OWN set of environment entries. All instances of an enterprise bean within the same home share the same environment entries;
the environment entries are not shared with other enterprise beans. Enterprise bean instances are NOT ALLOWED to modify the bean's environment at runtime.
Each env-entry element describes a single environment entry. The env-entry element consists of an optional description of the environment entry,
Referencing EJB
EJB can refer other EJB either locally or remotely by using <ejb-local-ref> element or <ejb-ref> element.
<ejb-local-ref> is used to declare a local reference to EJB’s that are co-located in the same container and should be deployed in the same EJB-JAR file.
Reference Other Resource
External references are specified by <resource-ref>
<description> is used to describe the external resource
<res-ref-name> is the name assigned to the external resource.
<res-type> specifies the type of the resource
<res-auth>indicates the service responsible for login.
Stateless vs Stateful
Statelesss session beans are more resource efficient than a Stateful session bean because a stateless bean is used by the EJB container to service another request instead of waiting for the next method call.
Stateless is shared amongst clients where stateful is dedicates to a client.
The more clients use the statefull session bean ,the more resources are necessary to support those clients
Entity Java Bean
It is used to manage a collection of data retrieved from a database and stored in memory.
It inserts,Updates,removes data while maintaining the integrity of data.
Data collected and managed by entity bean is called persistant data which in managed in two ways.
Bean Managed Persistance
Container Managed Persistance.
CMP entity bean remote interface
Import javax.ejb.EJBObject;
Import java.rmi.RemoteException;
Public interface myEJBRemote extends EJBObject{
Public getProduct() throws RemoteException;
Public setProduct(Product prod()) throws Remote Exception;
JAR File
EJB classes and related files are packaged together into JAR file for deployment.
It is a compressed format which is designed to reduce the size
JAR file used to Package an EJB must contain the following
EJB Classes
Dependent Classes
Remote Interface
Home Interface
Dependent Interfaces
Primary Key Class
Deployment Descriptor