Title: Internet Engineering Course
1Internet Engineering Course
- Web Application Architectures
2Agenda
- Application servers
- J2EE
- .Net
- Comparison between J2EE and .Net
31. Application Servers
- In the beginning, there was darkness and cold.
Then,
Centralized, non-distributed
4Application Servers
- In the 90s, systems should be client-server
5Application Servers
- Today, enterprise applications use the multi-tier
model
6Three-Tier Architecture
7Web Application Architecture
8Application Servers
- Multi-tier applications have several
independent components - An application server provides the infrastructure
and services to run such applications
9Application Servers
- Application server products can be separated into
3 categories - J2EE-based solutions
- Non-J2EE solutions (PHP, ColdFusion, Perl, etc.)
- And the Microsoft solution (ASP/COM and now .NET
with ASP.NET, VB.NET, C, etc.)
10J2EE Application Servers
- Major J2EE products
- BEA WebLogic
- IBM WebSphere
- Sun iPlanet Application Server
- Oracle 9iAS
- HP/Bluestone Total-e-Server
- Borland AppServer
- Jboss (free open source)
11Web Server and Application Server
App Server 1
Internet Browser
Web Server(HTTP Server)
HTTP(S)
App Server 2
12 What is J2EE?
- It is a public specification that embodies
several technologies - Current version is 1.4
- J2EE defines a model for developing multi-tier,
web based, enterprise applications with
distributed components
13J2EE Architecture
14J2EE Benefits
- High availability
- Scalability
- Integration with existing systems
- Freedom to choose vendors of application servers,
tools, components - Multi-platform
15J2EE Benefits
- Flexibility of scenarios and support to several
types of clients - Programming productivity
- Services allow developer to focus on business
- Component development facilitates maintenance and
reuse - Enables deploy-time behaviors
- Supports division of labor
16Main technologies
- JavaServer Pages (JSP)
- Servlet
- Enterprise JavaBeans (EJB)
- JSPs, servlets and EJBs are application components
17JSP
- Used for web pages with dynamic content
- Processes HTTP requests (non-blocking
call-and-return) - Accepts HTML tags, special JSP tags, and
scriptlets of Java code - Separates static content from presentation logic
- Can be created by web designer using HTML tools
18Servlet
- Used for web pages with dynamic content
- Processes HTTP requests (non-blocking
call-and-return) - Written in Java uses print statements to render
HTML - Loaded into memory once and then called many
times - Provides APIs for session management
19A Sample Scenario
Other Components
Web Server
JSP
(1) get a.jsp
(2) process
Client
(5) HTTP file
Servlet Impl.
(3) gen. Servlet
Database
(4) result
Servlet
JVM
20EJB
- EJBs are distributed components used to implement
business logic (no UI) - Developer concentrates on business logic
- Availability, scalability, security,
interoperability and integrability handled by the
J2EE server - Client of EJBs can be JSPs, servlets, other EJBs
and external aplications - Clients see interfaces
21J2EE Multi-tier Model
22J2EE Application Scenarios
- Multi-tier typical application
23J2EE Application Scenarios
24J2EE Application Scenarios
25J2EE Application Scenarios
26J2EE Services and APIs
- Java Message Service (JMS)
- Implicit invocation
- Communication is loosely coupled, reliable and
asynchronous - Supports 2 models
- point-to-point
- publish/subscribe
27JMS
- Point-to-point
- Destination is queue
28JMS
- Publish-subscribe
- Destination is topic
29J2EE Services and APIs
- JNDI - Naming and directory services
- Applications use JNDI to locate objects, such as
environment entries, EJBs, datasources, message
queues - JNDI is implementation independent
- Underlying implementation varies LDAP, DNS,
DBMS, etc.
30J2EE Services and APIs
- Transaction service
- Controls transactions automatically
- You can demarcate transactions explicitly
- Or you can specify relationships between methods
that make up a single transaction
31J2EE Services and APIs
- Security
- Java Authentication and Authorization Service
(JAAS) is the standard for J2EE security - Authentication via userid/password or digital
certificates - Role-based authorization limits access of users
to resources (URLs, EJB methods) - Embedded security realm
32J2EE Services and APIs
- J2EE Connector Architecture
- Integration to non-J2EE systems, such as
mainframes and ERPs. - Standard API to access different EIS
- Vendors implement EIS-specific resource adapters
- Support to Corba clients
33J2EE Services and APIs
- JDBC
- JavaMail
- Java API for XML Parsing (JAXP)
- Web services APIs
343. EJB a closer look
35Home Interface
- Methods to create, remove or locate EJB objects
- The home interface implementation is the home
object (generated) - The home object is a factory
36Remote Interface
- Business methods available to clients
- The remote interface implementation is the EJB
object (generated) - The EJB object acts as a proxy to the EJB instance
37Remoting in Java
- Several possibilities RMI/CORBA
- RMI can use JRMP or IIOP as a transport protocol
- Not pluggable changes in the code are necessary
Client
Server
Stub/Skeleton-Layer
Stub
Skeleton
Remote Reference Manager
Transport Layer
38EJB The Big Picture
39EJB at runtime
- Client can be local or remote
40EJB at runtime
41Types of EJB
New!
42Session Bean
- Stateful session bean
- Retains conversational state (data) on behalf of
an individual client - If state changed during this invocation, the same
state will be available upon the following
invocation - Example shopping cart
43Session Bean
- Stateless session bean
- Contains no user-specific data
- Business process that provides a generic service
- Container can pool stateless beans
- Example shopping catalog
44Entity Bean
- Represents business data stored in a database ?
persistent object - Underlying data is normally one row of a table
- A primary key uniquely identifies each bean
instance - Allows shared access from multiple clients
- Can live past the duration of clients session
- Example shopping order
45Entity Bean
- Bean-managed persistence (BMP) bean developer
writes JDBC code to access the database allows
better control for the developer - Container-managed persistence (CMP) container
generates all JDBC code to access the database
developer has less code to write, but also less
control
46Message-Driven Bean
- Message consumer for a JMS queue or topic
- Benefits from EJB container services that are not
available to standard JMS consumers - Has no home or remote interface
- Example order processing stock info
47Example of EJB Application
- It consists of number of clients accessing
session beans and entity beans - Each Session bean provides specialized processing
on behalf of client - e.g. Travel Agent session bean makes travel
reservations while Flight Scheduler bean
schedules planes to fly on various routes. - Each Entity Bean represent different type of
business entity. - e.g.Passengers, seats, planes, flights are
entity beans
48Example EJB Application
49JBoss- J2EE Product
- FIND OUT MORE ABOUT
- TODAYS MOST SUCCESSFUL OPEN
- SOURCE- DEVELOPED PPLICATION
- SERVER
50What is Jboss?
- Created in 1999, JBoss is the product of an
OpenSource developer community dedicated to
developing the best J2EE-compliant application
server in the market - With 1000 developers worldwide and a steadily
growing number of downloads per month, reaching
72,000 for October 01 (per independent
www.sourceforge.net), JBoss is arguably the most
downloaded application server in the world today - Distributed under an LGPL license, JBoss is
absolutely FREE for use. No cost. Period.
51JBoss- Application Server
52Introduction to .NET Framework
53.NET What Is It?
- Software platform
- Language neutral
- In other words
- .NET is not a language (Runtime and a library
for writing and executing written programs in any
compliant language)
54What Is .NET
- .Net is a new framework for developing web-based
and windows-based applications within the
Microsoft environment. - The framework offers a fundamental shift in
Microsoft strategy it moves application
development from client-centric to
server-centric.
55.NET What Is It?
Operating System Hardware
56Framework, Languages, And Tools
VB
VC
VC
Visual Studio.NET
JScript
Common Language Specification
ASP.NET Web Services and Web Forms
WindowsForms
ADO.NET Data and XML
Base Class Library
Common Language Runtime
57The .NET Framework.NET Framework Services
- Common Language Runtime
- Windows Forms
- ASP.NET
- Web Forms
- Web Services
- ADO.NET, evolution of ADO
- Visual Studio.NET
58Common Language Runtime (CLR)
- CLR works like a virtual machine in executing all
languages. - All .NET languages must obey the rules and
standards imposed by CLR. Examples - Object declaration, creation and use
- Data types, language libraries
- Error and exception handling
- Interactive Development Environment (IDE)
59Common Language Runtime
- Development
- Mixed language applications
- Common Language Specification (CLS)
- Common Type System (CTS)
- Standard class framework
- Automatic memory management
- Consistent error handling and safer execution
- Potentially multi-platform
- Deployment
- Removal of registration dependency
- Safety fewer versioning problems
60Common Language RuntimeMultiple Language Support
- CTS is a rich type system built into the CLR
- Implements various types (int, double, etc)
- And operations on those types
- CLS is a set of specifications that language and
library designers need to follow - This will ensure interoperability between
languages
61Intermediate Language (IL)
- .NET languages are not compiled to machine code.
They are compiled to an Intermediate Language
(IL). - CLR accepts the IL code and recompiles it to
machine code. The recompilation is just-in-time
(JIT) meaning it is done as soon as a function or
subroutine is called. - The JIT code stays in memory for subsequent
calls. In cases where there is not enough memory
it is discarded thus making JIT process
interpretive.
62Languages
- Languages provided by MS
- VB, C, C, J, JScript
- Third-parties are building
- APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon,
Perl, Python, Scheme, Smalltalk
63Compilation in .NET
C
Compiler
VB.NET
MSIL Metadata
Loader/ Verifier
JIT
C
Garbage Collection, Security, Multithreading, ...
Managed Code
Execution
Perl
64Windows Forms
- Framework for Building Rich Clients
- RAD (Rapid Application Development)
- Rich set of controls
- Data aware
- ActiveX Support
- Licensing
- Accessibility
- Printing support
- Unicode support
- UI inheritance
65ASP.NET
- ASP.NET, the platform services that allow to
program Web Applications and Web Services in any
.NET language - ASP.NET Uses .NET languages to generate HTML
pages. HTML page is targeted to the capabilities
of the requesting Browser - ASP.NET Program is compiled into a .NET class
and cached the first time it is called. All
subsequent calls use the cached version.
66ASP.NET
- Logical Evolution of ASP
- Supports multiple languages
- Improved performance
- Control-based, event-driven execution model
- More productive
- Cleanly encapsulated functionality
67ASP.NET Web Forms
- Allows clean cut code
- Code-behind Web Forms
- Easier for tools to generate
- Code within is compiled then executed
- Improved handling of state information
- Support for ASP.NET server controls
- Data validation
- Data bound grids
68ASP.NET Web Services
- A technical definition
- A programmable application component accessible
via standard Web protocols
69Web Services
- It is just an application
- that exposes its features and capabilities over
the network - using XML
- to allow for the creation of powerful new
applications that are more than the sum of their
parts
70ADO.NET(Data and XML)
- New objects (e.g., DataSets)
- Separates connected / disconnected issues
- Language neutral data access
- Uses same types as CLR
- Great support for XML
71Visual Studio.NET
- Development tool that contains a rich set of
productivity and debugging features
72Summary of .NET
- The .NET Framework
- Dramatically simplifies development and
deployment - Provides robust and secure execution environment
- Supports multiple programming languages
73Comparison between J2EE and .NET
74J2EE Enterprise Java
- J2EE Java 2 Enterprise Edition
- Superset of Java 2 Standard Edition (J2SE)
- Adds enterprise features to Java Libraries
- Defined through the Java Community Process (JCP)
- Wholly owned property of Sun Microsystems
75J2EE Solutions vs Microsoft .Net Solutions
Similarities
- Both multi-tiered, similar computing technologies
- Both support standards
- Both offer different tools ways to achieve the
same goal. - A lot of parallelism can be seen.
- Very difficult to compare and qualify the
comparison because each has its own advantages
disadvantages.
76Microsoft .Net vs. J2EE ComparisonLanguage
- C and Java both derive from C and C.
- MS says C combines the power of VC with the
ease of usage of VB - Significant features include garbage collection,
hierarchical namespaces) are present in both. - Different Syntax but same result.
- Java runs on any platform with a Java VM. C only
runs in Windows for the foreseeable future. - C is implicitly tied into the CLR and is
compiled entirely into native code. Java code
runs as Java Virtual Machine and executes byte
code
77Microsoft .Net vs. J2EE ComparisonJava vs. C
- // This is a comment in Java code
- class HelloWorld
- public static void main(String args)
- for(int i 1 ilt 100 i)
System.out.println("Hello!") -
- // This is a comment in C
- using System
- class HelloWorldstatic void Main() for(int
i1 ilt100 i) Console.WriteLine("Hello")
-
78Microsoft .Net vs. J2EE ComparisonPresentation
Layer
- ASP() vs. JSP
- ASP() can use Visual Basic, C, and possibly
other languages for code snippets. - JSPs use Java code (snippets, or JavaBean
references), compiled into Java - Win Forms/Web Forms Vs Swing/Java Server Faces
79Microsoft .Net vs. J2EE - A technical Comparison
Common Elements
- Concepts J2EE .NET
- Presentation JSP/Servlets ASP.NET
- Business Logic EJB/Servlets Code Behind,
Remoted Classes - Language Java C, VB.NET
- Platform Any Windows
- DB Connectivity JDBC ADO.NET (OLE-DB,
ODBC) - Web Services JWSDP Web Services
- Messaging JMS MTS
- Runtime JRE CLR
- Transaction JTA/JTS, XA Com, DTC
- Distributed computing RMI, CORBA, SOAP SOAP,
DCOM - XML Parser JAXP, Others Built-in
(System.XML)
80Microsoft .Net vs. J2EE Scorecard
81 A typical .NET Enterprise Solution
IIS on W2k Server
SQL Server
Browser
.NET managed component
ASP .NET
Windows Client
82A typical J2EE Enterprise Solution
Java App Server
DB Server
Browser
EJB
Servlet JSP
Java Client
83Porting Java Pet Store (Example) to .NET
15500
Lines of Code Required
14,273
14000
.NET Petshop
11500
Java Pet Store
9000
7500
5,891
5,404
4,410
5000
2,865
2,566
2500
710
761
412
74
User Interface
Data Tier
Middle Tier
Configuration
Total Lines of Code
84Forrester Report The State of Technology
Adoption Source http//download.microsoft.com/do
wnload/c/7/5/c75837dc-90bb-44d8-ae70-db7bcc5980b9/
TheStateofTechnologyAdoption.pdf
85Microsoft .Net vs. J2EE Comparison CLR vs JVM
Java
C
Managed C/C
Lots of other Languages
VB .Net
Byte Codes
MSIL
CLR Runtime Services
JRE (JVM) Runtime Services
Windows OS
Mac
Unix
Linux
Win
Both are middle layers between an intermediate
language the underlying OS
86.Net Disadvantages
- Security
- .NET better than prior frameworks (DNA, DCOM,
ActiveX, etc.), but still based on Windows - Immaturity
- Version 1.0 issues, likely to change in future
- Language changes for developers new to .NET
- Application migration to .NET costly
- Not enough real world use yet to evaluate
- Vendor lock-in
- Future direction determined by Microsoft.
87Choosing between Java/J2EE and .Net
- The ultimate choice usually depends not on
technical superiority, but on - Cultural/political preferences
- Customer preference
- Vendor relations
- Cost
- Platform Dependency
- Skill set of your developers
88Sources Resources
- The J2EE Tutorial. Sun Microsystems
- IBM WebSphere Application Server manuals
- BEA WebLogic Server manuals
- www.java.sun.com/j2ee
- www.theserverside.com
89Sources Resources
- Java 2 Platform Enterprise Edition Specification,
v1.3 - Designing Enterprise Applications with the Java
2, Enterprise Edition. Nicholas Kassen and the
Enterprise Team - Does the App Server Maket Still Exist?
Jean-Christophe Cimetiere - The State of The J2EE Application Server Market.
Floyd Marinescu