380 likes | 629 Views
Java 2 Enterprise Edition. Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16 th March 2006. Outline. What is J2EE? Java 2 Platform Architecture J2EE and .NET Why J2EE? What Does J2EE Add? J2EE 1.4 APIs Enterprise JavaBeans Transactions Security Web-Services
E N D
Java 2 Enterprise Edition Presented by: Reem Osama Shehata Supervised by: Dr. Sherif Aly 16th March 2006
Outline • What is J2EE? • Java 2 Platform Architecture • J2EE and .NET • Why J2EE? • What Does J2EE Add? • J2EE 1.4 APIs • Enterprise JavaBeans • Transactions • Security • Web-Services • J2EE Architecture • Deployment • Demo (An Auction House)
What is J2EE? • Java 2Platform, Enterprise Edition • Anything after v.1.1 is “Java 2” • Corporation-wide, larger scale web-deployed applications • Support for huge numbers of users • Also J2SE • “Standard Edition” for desktop applications • Also J2ME • “Micro Edition” for small, light applications running on PDAs, cell phones, pagers
Java 2 Platform Architecture Optional Packages Optional Packages Java 2 Enterprise Edition (J2EE) Java 2 Standard Edition (J2SE) Personal Profile Foundation Profile MIDP CDC CLDC Java Virtual Machine KVM Java 2 Micro Edition(J2ME)
J2EE and .NET • J2EE is a Sun Microsystems initiative • .NET is a Microsoft initiative • a “product” • Features closely match J2EE • Not as widely supported • Single vendor for OS (Win), database (SQL), app server (IIS), programming languages (C#), ASP • Has been slow to take off • Not portable (Java is portable)
Why J2EE? • Increased demand for distributed transactional applications • Extended Enterprises and Fast-moving and demanding world of e-commerce and information technology • Component-based approach to the design, development, assembly, and deployment of enterprise applications • Eliminates or drastically reduces user administration and training by providing the first tier users with easy access to business complexities
Why J2EE? Provides services to a broad range of users, these services need to be: • Highly available, to meet the needs of today’s global business environment. • Secure, to protect the privacy of users and the integrity of the enterprise. • Reliable and scalable, to ensure that business transactions are accurately and promptly processed.
So…. • The Java™ 2 Platform, Enterprise Edition (J2EE™) reduces the cost and complexity of developing multi-tier, enterprise services. • J2EE applications can be rapidly deployed and easily enhanced as the enterprise responds to competitive pressures. • Enhanced web services, J2EE includes simplified web services support and the latest web services APIs, making it an ideal implementation platform for Service-Oriented Architectures (SOA).
What does J2EE add? Support for • Enterprise JavaBeans (EJBs) • Java Server Pages (JSPs) • Enhanced Web-Services • XML • JMS And Others…..
Enterprise JavaBeans Technology (EJBs) Java Servlet Technology JavaServer Pages Technology (JSP) Java Message Service (JMS) Java Transaction (JTA) JavaMail JDBC API Java Naming and Directory Interface (JNDI) JavaBeans Activation Framework (JAF) Java API for XML Processing (JAXP) Java API for XML-Based RPC SOAP with Attachments API for Java Java API for XML Registries J2EE Connector Architecture J2EE 1.4 APIs
Enterprise JavaBeans • An Enterprise JavaBeans™ (EJB™) component, or enterprise bean, is a body of code having fields and methods to implement modules of business logic. You can think of an enterprise bean as a building block that can be used alone or with other enterprise beans to execute business logic on the J2EE server. • The EJB container and not the bean developer is responsible for system-level services such as transaction management and security authorization. • The client developer is relieved from coding the business logic. As a result the clients are thinner which is better for support by small devices. • Because the beans are portable they can be used and built upon on any compliant J2EE server which saves time and effort.
Transactions • What is a transaction? • The steps within a transaction are a unified whole, a transaction is often defined as an indivisible unit of work. • Transactions control the concurrent access of data by multiple programs. In the event of a system failure, transactions make sure that after recovery the data will be in a consistent state. • A transaction can end in two ways: with a commit or with a rollback. • The Java Transaction API (JTA) provides a standard interface for demarcating transactions. • The J2EE architecture provides a default auto commit to handle transaction commits and rollbacks.
Security • In Enterprise applications you often need to protect resources to ensure that only authorized users have access. • Security for components is provided by their containers. • A container provides two kinds of security: declarative and programmatic security. • Secure Socket Layer (SSL) technology allows web browsers and web servers to communicate over a secure connection. • Each tier has its own security module. • The Java Authentication and Authorization Service (JAAS) provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it.
Web-Services • Web services are web-based enterprise applications that use open, XML-based standards and transport protocols to exchange data with calling clients. • No low-level programming is needed because the XML API implementations do the work of translating the application data to and from an XML-based data stream that is sent over the standardized XML-based transport protocols (Simple Object Access Protocol- SOAP).
Java Servlet Technologyand JavaServer Pages • Java servlet technology lets you define HTTP-specific servlet classes. A servlet class extends the capabilities of servers that host applications that are accessed by way of a request-response programming model. • JavaServer Pages™ (JSP) technology lets you put parts of servlet code directly into a text-based document. A JSP page is a text-based document that contains two types of text: static data (which can be expressed in any text-based format such as HTML, WML, and XML) and JSP elements, which determine how the page constructs dynamic content.
Java Message Service API • The Java Message Service (JMS) API is a messaging standard that allows J2EE application components to create, send, receive, and read messages. Thus, It enables distributed communication.
JavaMail API • J2EE applications use the JavaMail™ API to send email notifications. The Java-Mail API has two parts: an application-level interface used by the application components to send mail, and a service provider interface. • The J2EE platform includes JavaMail with a service provider that allows application components to send Internet mail. • It is very needed in enterprise applications as they usually require the sending of confirmation mails for all types of transactional processes.
JavaBeans Activation Framework • The JavaBeans Activation Framework (JAF) is included because JavaMail uses it. JAF provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.
Java API for XML Processing • The Java API for XML Processing (JAXP) supports the processing of XML documents using Document Object Model (DOM), Simple API for XML (SAX), and Extensible Stylesheet Language Transformations (XSLT). • JAXP enables applications to parse and transform XML documents independent of a particular XML processing implementation.
Java API for XML-Based RPC • The Java API for XML-based RPC (JAX-RPC) uses the SOAP standard and HTTP, so client programs can make XML-based remote procedure calls (RPCs) over the Internet. • It combine HTTP with a Java technology version of the Secure Socket Layer (SSL) and Transport Layer Security (TLS) protocols to establish basic or mutual authentication.
Java API for XML Registries • The Java API for XML Registries (JAXR) lets you access business and generalpurpose registries over the web. JAXR supports the ebXML Registry and Repository standards and the emerging UDDI (Universal Description, Discovery and Integration ) specifications. • By using JAXR, developers can learn a single API and gain access to both of these important registry technologies.
J2EE Connector Architecture • The J2EE Connector architecture is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems (EISs) that can be plugged into any J2EE product. • A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager of the EIS. • It is different for each database or EIS.
Java Naming and Directory Interface (JNDI) • It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. • Using JNDI, a J2EE application can store and retrieve any type of named Java object.
Simplified System Integration The J2EE APIs enable systems and applications integration through the following: • Unified application model across tiers with enterprise beans • Simplified request-and-response mechanism with JSP pages and servlets • Reliable security model with JAAS • XML-based data interchange integration with JAXP, SAAJ, and JAX-RPC • Simplified interoperability with the J2EE Connector architecture • Easy database connectivity with the JDBC API • Enterprise application integration with message-driven beans and JMS, JTA, and JNDI
J2EE Architecture • A distributed multitiered application model for enterprise applications • Client-tier components run on the client machine. • Web-tier components run on the J2EE server. • Business-tier components run on the J2EE server. • Enterprise information system (EIS)-tier software runs on the EIS server.
Deployment The technologies needed • NetBeans IDE 4.1: http://www.netbeans.info/downloads • Application Server The Sun Java System Application Server Platform Edition 8.1 • The Java 2 Software Development Kit, Standard Edition (J2SE SDK) 1.4.2_06 or higher http://java.sun.com/j2ee/1.4/download.html#sdk You can also download the Application Server bundled with the IDE from: • http://www.netbeans.info/downloads
Application Server Installation Tips • Note the HTTP port at which the server is installed. The default port is 8080. If 8080 is in use during installation and the installer chooses another port or if you decide to change it yourself, you will need to update the configuration files in your application. • In the Admin configuration pane of the Application Server installer, Select the “Don’t Prompt for Admin User Name” radio button. This will save the user name and password so that you won’t need to provide them when performing administrative operations with the IDE. You will still have to provide the user name and password to log in to the Admin Console.
Demo • The example application is a web-based auction house written for the Enterprise JavaBeansTM platform • The three tiers in the web-based auction house example consists of the thin-client servlet, the Enterprise JavaBeans server (the application server), and the database server as shown in the figure:
Enterprise JavaBeans • Entity Beans • AuctionItemBean and RegistrationBean • Session Beans • SellerBean and BidderBean The auction house example implements a complete Enterprise JavaBeans solution by providing only the business logic and using the underlying services provided by the architecture
Deploying the Auction Example • Java Archive (JAR) file format is a compression and file packaging format and tool for bundling executable files with other related application files so they can be deployed as a single unit. The auction application has three units of files to deploy to three different locations. • The HTML files that make up the auction application user interface deploy to a publicly accessible location under the web server. • The Enterprise Beans deploy to an internal location accessible to your production installation of the Enterprise JavaBeans server. • The Administration applet deploys to an internal location accessible to auction administrators where it is run from their browsers.
Deploying the Auction Example (cont’d) • Bundle and Deploy the HTML Files • Bundle and Deploy the Enterprise Beans • Bundle and Deploy the Administration Applet Using the jar tool file:///E:/Reem/advancedJava/java/JDCBook/JDCBook/jar.html#html Example Mockup E:\Reem\advancedJava\java\JDCBook\JDCBook\Auction\index.html