400 likes | 566 Views
E142 Introduction to J2EE and EAServer. Meyer Tanuan Software Engineering Manager e-Business Division mtanuan@sybase.com. Session Objectives. To learn the major steps in building a robust, secure and scalable web-based application using J2EE technologies
E N D
E142 Introduction to J2EE and EAServer Meyer Tanuan Software Engineering Manager e-Business Division mtanuan@sybase.com
Session Objectives • To learn the major steps in building a robust, secure and scalable web-based application using J2EE technologies • To learn the features of Sybase EAServer that makes developing web-based applications easier
Agenda • Multi-tier Distributed Applications • Problems Solved by EAServer • Developing J2EE Applications • EAServer Features • Summary
Multi-tier Distributed Applications Presentation (First Tier) Business Logic (Middle Tier) Backend (Third Tier) Application Server Web Server ERP, CRM Database: Sybase, Oracle DB2, MS SQL • Thin Client • Windows client • Java Client • - Browser client • Mobile Client Sybase EAServer Enterprise computing is a heterogeneous environment !
Why Use an Application Server? Software Developer • Reusable business objects • Application partitioning • Business rule processing • Cross-platform integration • Standard approach to developing business components System Administrator • Scalability: number of users, number of components • Incremental upgrade: adding servers • Standard deployment procedures
Problems Solved by EAServer Complex design and development • EAServer supports J2EE platform • PowerJ or IDE plug-ins support EJB, JSP, Servlets • EAServer has many built-in services Proprietary Technology Issues • supports open standards • supports wide-range of clients, components technologies, web server interfaces, Unix and NT platforms
Problems Solved by EAServer (2) Performance Issues • Scalable, multithreaded, multiprocessor engine • Clustering, load balancing • DB connection pooling, dynamic page caching, etc. Complex deployment • Jaguar Manager: GUI-based deployment tool • Jagtool & Jagant: command-line deployment tool
EAServer Has Many Built-in Services EAServer provides basic services for hosting components • Connection pooling • Transaction management • Component life cycle • Security • Multi-threading • Name services • Messaging • and more…
Java 2 Enterprise Edition (J2EE) Defines a standard for developing multi-tier applications • Vendors collaborate on standards and compete on implementation • All the pieces of the application are portable across platforms and servers Simplifies application development • Developer focuses on application logic • EAServer handles complexity of lower level services
RMI/IIOP Developing J2EE Applications HTTP Server JSPEngine JDBC HTTP HTML Servlet Container JNDI EJB Container EAServer Browser-based and software-based clients can access the same components !
EAServer CTS J2EE Development Process Step 1. Develop the Components • Use J2EE wizard to create skeleton programs • Write and compile the application-specific code • Build the Java archive file (*.ear, *.war, *.jar) Step 2. Deploy to EAServer CTS JB, TCC, VC JAR, WAR or EAR file Jaguar Manager
EAServer is J2EE-branded Technology Java 2 SDK, Standard Edition RMI/IIOP JDBC JNDI Servlet JavaServer Pages™ JavaMail, JavaBeans Activation Framework Java Transaction Service Enterprise JavaBeans Java Transaction API Java Message Service Java API for XML Parsing J2EE Connector Architecture Version 1.3 1.2 2.0 1.2 2.3 1.2 1.2 1.0 2.0 1.0 1.0.2 1.1 1.0
Key J2EE APIs Component Technologies • Servlets • Java Server Pages (JSP) • Enterprise Java Beans (EJB) Service Technologies • Java Database Connectivity API (JDBC) • Java Naming and Directory Interface (JNDI) • Java Transaction API and Service (JTA) Communication Technologies • Messaging (JMS, JavaMail), Internet Protocols, etc.
1. J2EE Component: Servlets • Server-side Java program that extends the functionality of a Web Server • Used to dynamically generate HTML documents • Comparable to: • Common Gateway Interface (CGI) • Netscape NSAPI • Microsoft ISAPI • Apache Modules
<HTML> Aruba Bermuda Bahamas </HTML> Dynamic Page GenerationUsing Servlets http://www.myvacation.com/servlet/ListDest HTTP Server Servlet Container JDBC HTML HTTP EAServer
Servlets as Part of J2EE Contribution • Provides platform/server independent and scalable architecture for developing HTTP-based applications Limitations • Modification of static content requires recompilation • Business logic not reusableby non-Web clients Addressed by JSP Addressed by EJB
2. J2EE Component: Java Server Pages • Web scripting technology • Creation of dynamic content using static templates • Combine markup (HTML or XML) with Java Code to produce a dynamic Web Page • Similar to Microsoft ASP • Uses Javaas its scripting language • Full power of the Java language • Simple tags allow non-Java developer to generate dynamic content
<HTML> Aruba Bermuda Bahamas </HTML> Dynamic Page GenerationUsing Java Server Pages (JSP) http://www.myvacation.com/ListDest.jsp HTTP Server JSPEngine JDBC HTML HTTP Servlet Container EAServer
A Simple JSP <html> <body> <%@ page language="java" import="" %> <H1>Welcome back, <% String user = (String) session.getAttribute("user"); out.println(user); %> </H1> </body> </html>
Java Server Pages and Servlets • Servlets • HTML enclosed in Java code • JSP • Java code enclosed in HTML • Easier to author • Better tool support
Dynamic Page GenerationUsing JSP and Servlets HTTP Server JSPEngine JDBC HTML HTTP Servlet Container EAServer • Limitations • Violates application partitioning • Business logic not reusable • Limited support for non-Web clients
3. J2EE Component: Enterprise JavaBeans (EJB) • Server-side component model allowing developers to concentrate on business logic • EJB server handles complexity of lower level services • Component life cycle • Persistence, etc. • EJB API guarantees components to be portable across EJB Servers
Using Enterprise JavaBeans (EJB) http://www.myvacation.com/Trips.jsp HTTP Server JSPEngine JDBC HTML HTTP Servlet Container JNDI EJB Container RMI/IIOP • Simplify JSP • Reuse business logic EAServer
EJB: Entity Beans • Used to • Represent a business entity (like a row in a database table) • Provide standard access and validation for business entities • Persistent (live beyond server lifetime) • Usually represent data in a database • Examples • Customer, Order, ...
EJB: Entity Beans Used to • Represent a business entity (like a row in a database table) • Provide standard access and validation for business entities Persistent (live beyond server lifetime) • Usually represent data in a database Examples: • Customer, Order, …
EJB: Container Managed Persistence Developers can focus on application logic • Bean to database mappings can be saved in EAServer-specific deployment descriptors in XML • Declarative management of relationships between beans and dependent objects • Tool support: PowerJ 4.1, PowerDesigner 9.0 Database and vendor independence • Standard Query Language (EJB-QL) based on CMP bean definitions
EJB: Session Beans Used to • Manage processes and tasks (for a single session) • Model the workflow of Entity beans • Retrieve and update data that can't be adequately captured in an entity bean No persistent state Examples: • Find a list of trips • Make a purchase
EJB Example Booking .JSP book( ) Booking (Session) Authorization (Session) authorize( ) Order (Entity) create( )
EJB 2.0: Message Driven Beans Used to • Manage complex ongoing process with extended latency between activities • Manage loosely-coupled communication • receive JMS messages asynchronously MDB listens to a JMS destination: queue or topic Only one business method: onMessage Example: • Order Fulfillment Process: InvoiceMDB
4. J2EE Service: JDBC API Application JDBC • Standard database access API for building database independent applications • Driver Example: com.sybase.jdbc2.jdbc.SybDriver Driver Driver Driver Driver Sybase Oracle SQL Server Others
5. J2EE Service: JNDI Application JNDI • Standard name server API for building name server independent applications • Driver Example: com.sybase.ejb.InitialContextFactory Driver Driver Driver Driver Sybase LDAP CosNaming Others
6. J2EE Service: Java Transaction API Used to • Combine multiple components and EIS accesses into a single transaction • J2EE propagates transactions without programming effort JTA Transactions begin • Implicitly by EJB server • Explicitly in code using interface javax.transaction.UserTransaction Example: • book() method calls authorize() and create()
Data Access Dynamic Web Content JSP Servlet PowerDynamo JDBC Component Types ODBC C/C++ PB CORBA Native EJB MDB Active X/ COM JNDI LBHA Security Transaction ConnectionPooling JDMK JMS JAXP Threading Connectors Common Processes EAServer 4.0 Architecture
EAServer: Standards • Components • C, C++ • Java, JavaBeans, EJB, • CORBA • ActiveX/COM • PowerBuilder NVOs • Web Servers • Major (NSAPI, ISAPI) • All (CGI) • Distributed Protocols • Objects: IIOP, IIOPS • Web: HTTP, HTTPS • Database: TDS, TDSS • Platforms/Processors • NT, Unix, SMP • Data Access • JDBC • ODBC • CT-Library • OCI • Security • SSL 3.0 • X.509 v.3 • RSA • Integrated OS security • Naming • CORBA: CosNaming • Java: JNDI • Storage: LDAP
Other EAServer Enterprise-level Infrastructure • Clustering • Synchronization • Load Balancing • High Availability • Security • Authentication • Authorization (roles) • Encryption (SSL, Public Key) • Database Connectivity • Performance • Messaging, …
Webserver Redirector Plug-ins • Client sends Http(s) requests to a Web server in the DMZ • Provides a software-based solution for http load balancing and failover • Available for IIS, Apache, Netscape and iPlanet Web servers DMZ EAServer Web server
Summary EAServer • Solves many problems common to multi-tier distributed applications • Supports J2EE Platform to simplify design and development • Has many built-in services • Supports many component types using CORBA • Provides enterprise-level infrastructure Developers can focus on application logic !
For More Information • EAServer: http://www.sybase.com/products/easerver • PowerJ J2EE Tutorial (MyVacation example) • EAServer documentation: Feature Guide, Getting Started, System Administration Guide • J2EE specifications and samples: http://java.sun.com/j2ee • Book: Taming Jaguar, by Mike Barlotta & Jason Weiss • Sybase Education Courses: Building Web Applications Using EAStudio, EAServer Administration • Other Techwave Sessions