j2 ee vs. .net workshop
DESCRIPTION
J2EE & .Net, which one do you like?TRANSCRIPT
© Nguon Viet Software LLC | Slide 1 June, 2007
J2EE vs. .NETJ2EE vs. .NET
A Technical Workshop from A Technical Workshop from
NGUON VIET SOFTWARE LLCNGUON VIET SOFTWARE LLC
© Nguon Viet Software LLC | Slide 2 June, 2007
ObjectivesObjectives
To understand the Distributed SystemTo understand the Distributed System To understand the J2EE TechnologyTo understand the J2EE Technology To understand the .NET TechnologyTo understand the .NET Technology To know the difference between J2EE and .NETTo know the difference between J2EE and .NET
© Nguon Viet Software LLC | Slide 3 June, 2007
What is a Distributed System?What is a Distributed System?
A system made up of distinct sub-systems/ components that are A system made up of distinct sub-systems/ components that are distributed across multiple computers on a network.distributed across multiple computers on a network.
AvailabilityAvailability
Manageability Manageability
PerformancePerformance
ReliabilityReliability Scalability Scalability Securability Securability
Data
Databases
External Applications
Legacy Systems
Business Logic
Application Servers
Application Server
Rich Client
Presentation
Web Server
Web Server
Workstation
Workstation
Workstation
Workstation
Firewall
Firewall
Firewall
Firewall
© Nguon Viet Software LLC | Slide 4 June, 2007
J2EEJ2EEFrameworkFramework
© Nguon Viet Software LLC | Slide 5 June, 2007
J2EEJ2EE
The application server maintains controls and provides The application server maintains controls and provides services through an interface or framework known as a services through an interface or framework known as a containercontainer
There are five defined container types in the J2EE There are five defined container types in the J2EE specificationspecification Three of these are server-side containersThree of these are server-side containers The other two container types are client-sideThe other two container types are client-side
ContainersContainers
© Nguon Viet Software LLC | Slide 6 June, 2007
J2EEJ2EE
A servlet is a server-side component Written in Java Extends the capabilities of servers Accessed via request-response programming model
What can Servlet do? Share information Maintain in client state Filter requests and responses Control web flows
Usage Used to develop the presentation (A controller in web tier)
ServletServlet
© Nguon Viet Software LLC | Slide 7 June, 2007
J2EEJ2EEJSPJSP
A A JSP pageJSP page is a text document that contains two types of is a text document that contains two types of texttext Static data: HTML, SVG, WML, and XMLStatic data: HTML, SVG, WML, and XML JSP elements: Construct dynamic contentJSP elements: Construct dynamic content
What can JSP do?What can JSP do? Generate dynamic pages to interact with usersGenerate dynamic pages to interact with users Transfer control to another web componentTransfer control to another web component Access server-side objectsAccess server-side objects Support Tag LibrarySupport Tag Library
UsageUsage Used to develop the presentationUsed to develop the presentation
© Nguon Viet Software LLC | Slide 8 June, 2007
J2EEJ2EEEJBEJB
An An enterprise java bean enterprise java bean is a server-side component that can is a server-side component that can be deployed in a distributed multi-tier environment.be deployed in a distributed multi-tier environment.
Enterprise JavaBeans (EJBs)Enterprise JavaBeans (EJBs)
Session BeanSession Bean(SB)(SB)
Entity Bean Entity Bean (EB)(EB)
Message Driven Bean Message Driven Bean (MDB)(MDB)
StatelessStateless(SLSB)(SLSB)
StatefulStateful(SFSB)(SFSB)
Bean Managed Bean Managed PersistencePersistence
(BMP)(BMP)
Container ManagedContainer Managed PersistencePersistence
(CMP)(CMP)
Synchronous CommunicationSynchronous Communication Asynchronous CommunicationAsynchronous Communication
© Nguon Viet Software LLC | Slide 9 June, 2007
J2EEJ2EEEJBEJB
EJB usually plays roles in business tierEJB usually plays roles in business tier
© Nguon Viet Software LLC | Slide 10 June, 2007
J2EEJ2EEService TechnologiesService Technologies
JMS (Java™ Messaging Service) Standard API for messaging
JavaMail™ API allows an application component to send Internet mail.
JAF (JavaBeans™ Activation Framework) Supports handling data in different MIME types
JAXP (Java™ API for XML Parsing) SAX and DOM parser XSLT transform
JCA (J2EE™ Connector Architecture) The Connector architecture is a J2EE SPI that allows resource
adapters that support access to Enterprise Information Systems to be plugged in to any J2EE product.
© Nguon Viet Software LLC | Slide 11 June, 2007
J2EEJ2EEService TechnologiesService Technologies
JDBC APIJDBC API API for connectivity with relational database systems.API for connectivity with relational database systems.
JTA (Java™ Transaction API)JTA (Java™ Transaction API) An application-level demarcation interface that is used by the An application-level demarcation interface that is used by the
container and application components to demarcate transaction container and application components to demarcate transaction boundaries.boundaries.
An interface between the transaction manager and a resource An interface between the transaction manager and a resource managermanager
JNDI (Java Naming and Directory Interface™)JNDI (Java Naming and Directory Interface™) Standard API for naming and directory access.Standard API for naming and directory access.
Security ServicesSecurity Services The Java™ Authentication and Authorization Service (JAAS) The Java™ Authentication and Authorization Service (JAAS)
enables services to authenticate and enforce access controls upon enables services to authenticate and enforce access controls upon usersusers.
© Nguon Viet Software LLC | Slide 12 June, 2007
J2EEJ2EE
WebWeb ServicesServices J2EE provides full support for both clients of web services as well J2EE provides full support for both clients of web services as well
as web service endpoints.as web service endpoints. ManagementManagement
The Java 2 Platform, Enterprise Edition Management Specification The Java 2 Platform, Enterprise Edition Management Specification defines APIs for managing J2EE servers using a special defines APIs for managing J2EE servers using a special management enterprise bean.management enterprise bean.
The Java™ Management Extensions (JMX) API is also used to The Java™ Management Extensions (JMX) API is also used to provide some management support.provide some management support.
DeploymentDeployment The Java 2 Platform, Enterprise Edition Deployment Specification The Java 2 Platform, Enterprise Edition Deployment Specification
defines a contract between deployment tools and J2EE products.defines a contract between deployment tools and J2EE products.
Service TechnologiesService Technologies
© Nguon Viet Software LLC | Slide 13 June, 2007
J2EEJ2EECommunication TechnologiesCommunication Technologies
InternetInternet protocols protocols TCP/IP, HTTP, HTTPS/SSL.TCP/IP, HTTP, HTTPS/SSL.
OMG ProtocolsOMG Protocols Java IDL (Java Interface Definition language)Java IDL (Java Interface Definition language)
Allows J2EE application components to invoke external CORBA Allows J2EE application components to invoke external CORBA objects using the IIOP protocol.objects using the IIOP protocol.
RMI-IIOP (Java Remote Method Invocation over Internet Inter-ORB RMI-IIOP (Java Remote Method Invocation over Internet Inter-ORB Protocol technology)Protocol technology)
To enable interoperability between J2EE productsTo enable interoperability between J2EE products
© Nguon Viet Software LLC | Slide 14 June, 2007
J2EEJ2EESecuritySecurity
Web Application Security: Authentication:
HTTP Basic and Digest Authentication Form-Based Authentication HTTPS Client Authentication
Authorization Declarative Security Programmatic Security
Confidentiality and Integrity EJB Security
Authentication (JAAS) Authorization
Declarative Security Programmatic Security
© Nguon Viet Software LLC | Slide 15 June, 2007
J2EEJ2EESecuritySecurity
Security InteroperabilitySecurity Interoperability IIOP/SSLIIOP/SSL CSlv2CSlv2
Web Services SecurityWeb Services Security End-to-End SecurityEnd-to-End Security XML Digital Signature and XML EncryptionXML Digital Signature and XML Encryption SAMLSAML WS-SecurityWS-Security
© Nguon Viet Software LLC | Slide 16 June, 2007
J2EEJ2EETransactionTransaction
Support distributed transaction Supports Flat transaction modelSupports Flat transaction model Does not supports Nested transaction modelDoes not supports Nested transaction model
Provide ACID (Atomicity, Consistency, Isolation, and Durability) properties
© Nguon Viet Software LLC | Slide 17 June, 2007
J2EEJ2EE
There are two types of transactions Container-Managed TransactionsContainer-Managed Transactions
Bean-Managed TransactionsBean-Managed Transactions
TransactionTransaction
Container-Managed demarcationContainer-Managed demarcation
Bean-Managed demarcationBean-Managed demarcationDatabase A Database B
Client
EJB server
Begin
Commit
Bean A
Bean A
Bean A
Bean A
Database A
EJB server
Database B
EJB server
ClientBean
ABean
A
Bean A
Bean A
Begin
Commit
Begin
Commit
© Nguon Viet Software LLC | Slide 18 June, 2007
.NET.NET
.NET is the Microsoft solution for Web services, the next .NET is the Microsoft solution for Web services, the next generation of software that connects our world of generation of software that connects our world of information, devices, and people in a unified, personalized information, devices, and people in a unified, personalized wayway
Supports multiple operating systemsSupports multiple operating systems Supports multiple programming languages. But you’ll have Supports multiple programming languages. But you’ll have
to use special .NET variantsto use special .NET variants Supported by one vendorSupported by one vendor
© Nguon Viet Software LLC | Slide 19 June, 2007
.NET.NETFrameworkFramework
Windows COM+ Services
Common Language Runtime
Base Class Library
ADO.NET and XML
ASP.NET/Web Forms Windows Forms
Common Language Specification
VB C++ C# JScript …V
isua
l Stu
dio
.NE
T
.NET Remoting
© Nguon Viet Software LLC | Slide 20 June, 2007
.NET.NET
Consists of two components:Consists of two components: The form with its controls (.aspx file)The form with its controls (.aspx file) The code behind it that handles events associated with the form's The code behind it that handles events associated with the form's
controlscontrols Code behind file can be written in any .NET languages (C#, Code behind file can be written in any .NET languages (C#,
VB.NET…)VB.NET…)
ASP.NET/Web FormsASP.NET/Web Forms
Web Form UI (aspx)
Code behind Class
System.Web.UI.Page
Code behind association
Inherits
© Nguon Viet Software LLC | Slide 21 June, 2007
.NET.NET
Provides a unified programming model for standard Windows application development Window API
.NET Window Form.NET Window Form
Windows FormsWindows Forms
HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain);
Form form = new Form();form.Text = "Main Window";form.Show();
How much simpler ?
© Nguon Viet Software LLC | Slide 22 June, 2007
.NET.NET
Provides a hierarchy of classes to create UI components Provides a hierarchy of classes to create UI components such as Forms, TextBoxes, Buttons,…such as Forms, TextBoxes, Buttons,…
Any .NET language can use this collection of classes that Any .NET language can use this collection of classes that make up the Windows Forms object model.make up the Windows Forms object model.
Fully supports and integrates with Web Services, ADO.NET, Fully supports and integrates with Web Services, ADO.NET, and the .NET Framework base classes.and the .NET Framework base classes.
Windows FormsWindows Forms
© Nguon Viet Software LLC | Slide 23 June, 2007
.NET.NET.NET Remoting.NET Remoting
Application Domain
Allows to instantiate components on remote computer and use Allows to instantiate components on remote computer and use them as local componentsthem as local components
Communicate channels: HTTP or TCPCommunicate channels: HTTP or TCP Deployment: Window form application, Console application,Deployment: Window form application, Console application,
Dedicated window service, IIS (with ASP.NET)Dedicated window service, IIS (with ASP.NET)
Application Domain
Client Object
Component
Direct access to component
Component
Communication between AppDomains
ProxyChannel
© Nguon Viet Software LLC | Slide 24 June, 2007
.NET.NETXML Web ServicesXML Web Services
Allow access to software components through standard web Allow access to software components through standard web protocols such as HTTP, SMTP,…protocols such as HTTP, SMTP,…
Base on XML and SOAP Base on XML and SOAP Can be written in any .NET language (C#, VB.NET,…)Can be written in any .NET language (C#, VB.NET,…)
InternetSearch for Web
Service functionality
InternetSearch for Web
Service functionality
1
2
3
4
Web Service Vendor
WSDL File
Web Service
UDDI Registry
Discovery
Interface
SOAP MessagesInternetInternet
DISCO File
© Nguon Viet Software LLC | Slide 25 June, 2007
.NET.NETADO.NETADO.NET
Provides consistent access to data sources such as SQL Server, Provides consistent access to data sources such as SQL Server, Oracle, Access,...Oracle, Access,...
Leverages Current ADO KnowledgeLeverages Current ADO Knowledge Supports the N-Tier Programming ModelSupports the N-Tier Programming Model Supports XMLSupports XML
© Nguon Viet Software LLC | Slide 26 June, 2007
.NET.NETCOM+ (Serviced components) COM+ (Serviced components)
The .NET Framework enables you to create components The .NET Framework enables you to create components called called serviced componentsserviced components, to access COM+ services, to access COM+ services
System.EnterpriseServicesSystem.EnterpriseServices namespace provides namespace provides classes, interfaces and attributes for communicating with classes, interfaces and attributes for communicating with Component ServicesComponent Services
Component Services of COM+Component Services of COM+ TransactionsTransactions Queued ComponentsQueued Components SecuritySecurity JIT ActivationJIT Activation Object PoolingObject Pooling
© Nguon Viet Software LLC | Slide 27 June, 2007
.NET.NETTransaction Transaction
Provide ACID propertiesProvide ACID properties AAtomicitytomicity CConsistency onsistency IIsolationsolation DDurabilityurability
Serviced Components have the ability to participate in Serviced Components have the ability to participate in transactions by voting on the outcome of the transactions by voting on the outcome of the operationsoperations
© Nguon Viet Software LLC | Slide 28 June, 2007
.NET.NETSecurity Security
.NET Framework security.NET Framework security Role-based securityRole-based security Code access securityCode access security Code signingCode signing
What is the codeEvidence-based authentication
What does the code doPermission-based
Authorization
CASPolicyCAS
Policy
UserUser
CodeCode
Code Access Security
Security Resources
Privileged Operation
Security Resources
Privileged Operation
Evidence
© Nguon Viet Software LLC | Slide 29 June, 2007
.NET.NETSecurity Security
ASP.NET securityASP.NET security AuthenticationAuthentication
Forms-based authenticationForms-based authentication Windows authenticationWindows authentication Passport authenticationPassport authentication
Authorization and ImpersonationAuthorization and Impersonation URL authorization URL authorization Resource authorizationResource authorization
© Nguon Viet Software LLC | Slide 30 June, 2007
.NET.NETSecurity Security
What is the codeEvidence-based authentication
Authenticated Caller’sAccess token (or
IUSR_MachineAccess token)
ASP ProcessesOriginal Caller
Fixed proxy Identity
Authorization
Web permissionsNTFS Permission
IP Address Restriction
Authorization
Web permissionsNTFS Permission
IP Address Restriction
Authentication
Anonymous Basic Digest
Integrated Certificate
Authentication
Anonymous Basic Digest
Integrated Certificate
ASP.NET(aspnet_wp.exe)
Authorization
File AuthorizationURL
Authorization.NET Roles
Authorization
File AuthorizationURL
Authorization.NET Roles
Authentication
WindowsForms
Passport None
Authentication
WindowsForms
Passport None
HTTPRequests
SSL
1
Web Server
2 3 5 6
4
Local or Remote Resource
Local or Remote Resource
7
Identity
ASP.NET ASP.NET SecuritySecurity
© Nguon Viet Software LLC | Slide 31 June, 2007
.NET.NETBase Class LibraryBase Class Library
System System
System.DataSystem.Data
System.WebSystem.Web
Globalization
Diagnostics
Configuration
Collections
Resources
Reflection
Net
IO
Threading
Text
Service Process
Security
OleDb
Common
SqlTypes
SqlClient
Runtime
InteropServices
Remoting
Serialization
Configuration SessionState
Caching Security
Services
Description
Discovery
Protocols
UI
HTMLControls
Web Controls
System.XmlSystem.Xml
XPath
Schema
XPath
Serialization
System.DrawingSystem.Drawing
Imaging
Drawing2D
Text
Printing
System.Windows.FormsSystem.Windows.Forms
Design Component Model
© Nguon Viet Software LLC | Slide 32 June, 2007
J2EE Distributed SystemJ2EE Distributed System
Data
Databases
External Applications
Legacy Systems
Business Logic
Application Servers
Application Server
Presentation
Web Server
Web Server
Workstation
Workstation
Workstation
Workstation
Firewall
Firewall
Firewall
Firewall
Swing
JSP
Servlet
Browser
HT
TP
EJB - Session
EJB-Entity
EJB-MDB
JMS
Java mail
RM
I/II
OP
, S
OA
P
Oracle Database
MS SQL Database
Data in XML Format
JDB
C/J
DO
© Nguon Viet Software LLC | Slide 33 June, 2007
.NET Distributed System.NET Distributed System
Data
Databases
External Applications
Legacy Systems
Business Logic
Application Servers
Application Server
Presentation
Web Server
Web Server
Workstation
Workstation
Workstation
Workstation
Firewall
Firewall
Firewall
Firewall
Windows Forms
ASP.NET/ Web Forms
ASP.NET/ XML Web Services
Browser
HT
TP
Managed Classes
(Base Class Library)
COM+ DCOM (Serviced
Components)
.NE
T R
em
oti
ng
, S
OA
P
Oracle Database
MS SQL Database
AD
O.N
ET
Data in XML Format
© Nguon Viet Software LLC | Slide 34 June, 2007
J2EE vs. .NETJ2EE vs. .NET
TechnologyTechnology J2EEJ2EE .NET.NET
TechnologyTechnology
Type of Technology Standard (Specification) Product
Programming Language Java C#, J# , C++, VB.NET, Cobol
Library Java API Based and Extended classes
Run-time Environment JVM CLR
Distributed Protocol RMI-IIOP, SOAP, CORBA DCOM, SOAP
Platform Support Multiple Platforms Windows
Presentation Tier TechnologiesPresentation Tier Technologies
Infrastructure Standard (Specification). There are several web servers
IIS
Programming Model JSP, Servlet, Swing ASP.NET, WebForms, WindowForms
Technologies EquivalencesTechnologies Equivalences
© Nguon Viet Software LLC | Slide 35 June, 2007
J2EE vs. .NETJ2EE vs. .NET
TechnologyTechnology J2EEJ2EE .NET.NET
Business Logic Tier TechnologiesBusiness Logic Tier Technologies
Infrastructure EJB ( Session Bean, Entity Bean and Message Driven Bean). Provided by the server
COM+. Provided by the Platform
Asynchronous JMS MSMQ
Distributed Transaction JTS MS-DTC
Connectivity JDBC, JCA (Java Connector Architecture)
ADO.NET, HIS (Host Integration Server)
Naming and Directory Service
JNDI(Java Naming and Directory Interface)
ADSI (Active Directory Services Interface)
Security JAAS, supported by the Server
COM+ Security , Supported by platform
Technologies EquivalencesTechnologies Equivalences
© Nguon Viet Software LLC | Slide 36 June, 2007
J2EE vs. .NETJ2EE vs. .NET
TechnologyTechnology J2EEJ2EE .NET.NET
Other TechnologiesOther Technologies
Web Services XML Web Services XML Web Services
XML Parser JAXP Build-in
Technologies EquivalencesTechnologies Equivalences
© Nguon Viet Software LLC | Slide 37 June, 2007
J2EE or NET?J2EE or NET?
CriteriaCriteria J2EEJ2EE .NET.NET CommentsComments
Easy of use Easy of use (Development (Development Environment)Environment)
VB.NET and C# are easier to use than J2EEVB.NET and C# are easier to use than J2EE
because of VS.NETbecause of VS.NET
ScalabilityScalability Execute Java code on mainframeExecute Java code on mainframe
Single LanguageSingle Language
Multiple Platforms Multiple Platforms
Java can run on many platformsJava can run on many platforms
Multiple Languages,Multiple Languages,
Single platformSingle platform
VB, C#, J#, etc. all run in the same run-time VB, C#, J#, etc. all run in the same run-time environmentenvironment
ReliabilityReliability VB/COM developed in 1993 (J2EE – 1999)VB/COM developed in 1993 (J2EE – 1999)
PerformancePerformance Both will perform equally wellBoth will perform equally well
Speed of Speed of developmentdevelopment
Visual Basic code is easier to learnVisual Basic code is easier to learn
ReuseReuse Deploy same code on multiple platforms andDeploy same code on multiple platforms and
multiple projectsmultiple projects
Open StandardOpen Standard Java, JVM are open standardsJava, JVM are open standards
ScorecardScorecard
© Nguon Viet Software LLC | Slide 38 June, 2007
J2EE or .NET?J2EE or .NET?
© Nguon Viet Software LLC | Slide 39 June, 2007
ReferencesReferences
MicrosoftMicrosoftwww.microsoft.com
SUNSUNwww.sun.com
IBMIBMwww.ibm.com
J2EE vs. .NETJ2EE vs. .NET The Platform Wars: .NET vs. J2EEThe Platform Wars: .NET vs. J2EE
Brian G. Lyons, Number Six Software, Inc.Brian G. Lyons, Number Six Software, Inc. J2EE vs. .NETJ2EE vs. .NET
Roger Sessions, ObjectWatch, Inc.Roger Sessions, ObjectWatch, Inc.
© Nguon Viet Software LLC | Slide 40 June, 2007
AppendixAppendix
Session Beans: A session bean Session Beans: A session bean represents a single client represents a single client inside the Application Serverinside the Application Server Stateful session beans: Can maintain a conversational state for the Stateful session beans: Can maintain a conversational state for the
clientclient Stateless session beans: Does not maintain a conversational state Stateless session beans: Does not maintain a conversational state
for the clientfor the client Message Driven BeansMessage Driven Beans
Allows J2EE applications to process messages asynchronouslyAllows J2EE applications to process messages asynchronously Entity Beans: An entity represents a business object and Entity Beans: An entity represents a business object and an an
in-memory view of persistent data (data in a database)in-memory view of persistent data (data in a database) Container-Managed Persistence: Declarative persistentContainer-Managed Persistence: Declarative persistent Bean-Managed Persistence: Programmatic persistentBean-Managed Persistence: Programmatic persistent
J2EE-EJBJ2EE-EJB
© Nguon Viet Software LLC | Slide 41 June, 2007
GlossaryGlossary
Acronyms/Acronyms/
AbbreviationsAbbreviations DefinitionsDefinitions
JTA Java Transaction API
JAAS Java Authentication Authorization Service
EJB Enterprise Java Bean
JNDI Java Naming Directory Interface
XML Extensible Markup Language
XSL Extensible Style sheet LanguageExtensible Style sheet Language
XSLTXSLT XSL TransformationXSL Transformation
JSPJSP Java Server PageJava Server Page
JDBC Java Database Connectivity
EIS Enterprise Information System
DTO Data Transfer Object
MVC Model View Controller
JDOJDO Java Data ObjectJava Data Object
© Nguon Viet Software LLC | Slide 42 June, 2007
GlossaryGlossary
Acronyms/Acronyms/
AbbreviationsAbbreviations DefinitionsDefinitions
WMLWML Wap Markup Language Wap Markup Language
OMGOMG Object Management GroupObject Management Group
CORBACORBA Common Object Request Broker ArchitectureCommon Object Request Broker Architecture
RMI-JRMIRMI-JRMI Remote Method Invocation - Java Remote Method ProtocolRemote Method Invocation - Java Remote Method Protocol
RMI-IIOPRMI-IIOP Java Remote Method Invocation over Internet Inter-ORB Protocol Java Remote Method Invocation over Internet Inter-ORB Protocol technologytechnology
IDLIDL Java Interface Definition languageJava Interface Definition language
Windows DNAWindows DNA Microsoft Windows DMicrosoft Windows Digital igital interinterNNet Applications et Applications AArchitecturerchitecture
OMGOMG Object Management GroupObject Management Group
CORBACORBA Common Object Request Broker ArchitectureCommon Object Request Broker Architecture
SOAP Simple Object Access Protocol
JITJIT Just-In-Time
MIMEMIME Multipurpose Internet Mail ExtensionMultipurpose Internet Mail Extension