Introduction to J2EE Technologies

J2EE is comprised of many APIs that can be used to build enterprise applications. The  list of technologies that make up J2EE is as follows:
  • Java Servlets
  • Java Server Pages (JSP)
  • Enterprise JavaBeans (EJB)
  • Java Message Service (JMS)
  • Java Naming and Directory Interface (JNDI)
  • Java Database Connectivity (JDBC)
  • Java Mail
  • Java Transaction Service (JTS)
  • Java Transaction API (JTA)
  • J2EE Connector Architecture (J2EE-CA, or JCA)
From a developer perspective, the main technologies are EJB, JSP, Java Servlets, JDBC and JMS, although JNDI is used for locating EJBs and other enterprise resources.
Servlets :- Java Servlets are the Java equivalent of CGI scripts that can be used to perform processing and the servicing of client requests on a web server. Servlets are simply Java classes that implement a predefined interface and used to dynamically generate content for presentation to the user by embedding markup language (e.g. HTML) inside the Java code. As Servlets are written in Java, they have access to the rich library of features provided by Java, including access to databases and other enterprise resources such as EJB.
      These are Server side components that define HTTP specific servlet classes but not restricted to HTTP.
   Servlets can respond to any type of request , these are commonly used to extend  the applications hosted by servers and can be used to deliver dynamic content.
      They are better choice than CGI (common gateway interface) as they are portable, scalable and easy to maintain.


Figure 1 Servlets(EE Web Components)

JSP (Java Server Pages) :- It  is other than servlet technology for presenting information to the user over the web and uses Java code, embedded into the HTML - the opposite of servlets but much similar to  Microsoft ASP. Generally all the pages are written as HTML files with embedded Java source code known as scriptlets.  It is very easy to build large pages containing lots of embedded Java code and business logic so it provide easy integration with JavaBeans and another feature called JSP tag extensions. These custom tags (also known as custom actions) allow re-usable functionality to be encapsulated into XML-like tags that can be easily used on the pages by both page developers and designers. There are some special features of JSP.
      Similar to Servlets but unlike servlets , JSPs are text based documents that are combination of HTML and JSP tags, java code & other information.
      JSP clearly separates presentation logic and business logic.
      JSP pages are lightweight and fast and provide a lot of scalability to web applications.




Figure 2 JSP(EE Web Components)

Enterprise Java Beans

EJB defines a model for building server-side, reusable components and it is a major part of the J2EE specification. Three types of enterprise beans supported by J2EE which are very well known as - session beans, entity beans and message-driven beans.


Figure 3:- Types of Beans
1.   Session beans are considered as extensions to the client application and used to model the different business processes. These session beans are further divided into two types - stateful and stateless. Stateful session beans(Single client) are used to record conversational state for a single client between requests and stateless session beans(multiple Clients) are shared between any numbers of clients at any one time.
2.     Entity beans are used to model persistent business entities for example data in a database. For a common mapping is to model an entity bean on a table, there being one instance of that bean for every row in the table. For achieving the persistence, there are two different methods - container managed and bean managed persistence. In container managed persistence, a mapping is defined at deployment time between the persistent properties in the bean and the columns in the table while in bean managed persistence, developers write the JDBC code that performs the create, read, update and delete operations.
3.   Message-driven beans allow functionality to be executed on an asynchronous basis, when triggered by JMS messages, a message-oriented middleware.
    
 Some Basic features of EJB :-

      Server-side components, modular, reusable, and having specific units of functionality
    Similar to the Java classes,  but are subject to special restrictions and must provide specific interfaces for container and client use and access
    Used for applications that require scalability, transactional processing, or availability to multiple client types.

Figure 4:- Enterprise Java Beans

JMS :- Messaging is a method of communication between different software components or applications, it is a peer-to-peer facility, through which a messaging client can send messages to, and receive messages from, any other client so each client has to connect to a messaging agent which can provide facilities for creating, sending, receiving, and reading messages. JMS is a Java API that presents an interface into message-oriented middleware such as IBM MQSeries, SonicMQ and so on. Like JDBC, JMS also provide a mechanism to Java applications by which they can integrate with all systems using a common programming interface irrespective of the underlying messaging system. JMS allows messages to be sent and received using a point-to-point or publish/subscribe paradigm.
  Enterprise messaging provides a reliable, flexible service for the asynchronous exchange of critical business data and events throughout an enterprise.
   The JMS API adds to this a common API and provider framework that enables the development of portable, message based applications in the Java programming language.
      Message-driven bean, enables the asynchronous consumption of messages.
      Message sends and received, can participate in Java Transaction API (JTA) transactions.

JDBC :- The Java Database Connectivity (JDBC) API is the industry standard for database- connectivity between the Java programming applications and a wide range of databases like  SQL and other tabular data sources, such as spreadsheets or flat files. The JDBC API provides a call-level API for SQL-based database access.
JDBC technology allows you to use the Java programming language to exploit "Write Once, Run Anywhere" capabilities for applications that require access to enterprise data.
      JDBCTM technology is an API that lets you access virtually any tabular data source from the Java programming language.
      Cross-DBMS connectivity to a wide range of SQL databases
      Access to other tabular data sources, such as spreadsheets or flat files.

JNDI :-  The Java Naming and Directory Interface(JNDI) is an application programming interface (API) that provides naming and directory functionality to applications written using the Java. It is defined to be independent of any specific directory service implementation.
      It is designed especially for Java by using Java's object model.
      Using JNDI, Java applications can store and retrieve named Java objects of any type.

JTA :- Java Transaction API (JTA) specifies standard Java interfaces between a transaction manager and the parties involved in a distributed transaction system: the resource manager, the application server, and the transactional applications. Developers can define the transactional properties of Enterprise JavaBeansTM technology based components during design or deployment using declarative statements in the deployment descriptor.
Java Mail
      The JavaMailTM 1.2 API provides a set of abstract classes that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology-based mail and messaging applications.
      J2EE contains JAF – JavaBeans Activation Framework since it is required by JavaMail Supports common mail protocols are IMAP, POP, SMTP, MIME.

JAAS
      Authentication of users, to reliably and securely determine who is currently executing Java code, regardless of whether the code is running as an application, an applet, a bean, or a servlet; and
      Authorization of users to ensure they have the access control rights (permissions) required to do the actions performed.
XML
      Java EE 6 includes JAXP 1.3 support, as well as Servlet Filters and XML JSPTM documents.
      The JavaTM API for XML Processing ("JAXP") supports processing of XML documents using DOM, SAX, and XSLT.
      The portability and extensibility of both XML and Java make them the ideal choice for the flexibility and wide availability requirements of this new web.


No comments:

Post a Comment