aim
for building integrated, enterprise-class applications that share information, deliver services, and automate collaboration among networked companies at Internet volume and speed
11.12.2003
separate of presentation, business logic, and data provide the underlying core functionality necessary for the development and deployment of business-driven application connect legacy systems, and Web Services
CENG 520 Gokce Banu Laleci 2
Why?
applications with complex business logic potentially servicing tens of thousands of concurrent users in real-time require a scalability and reliability Distributed system
11.12.2003
RMI Load balancing Transparent fail over Back-end integration Transaction Clustering Dynamic redeployement Clean shutdown
Logging and auditing System management Threading Message-oriented middleware Object life cycle Resource polling Security Caching
4
11.12.2003
Adds..
a new layer of functions and services between Web servers and underlying applications and databases
11.12.2003
speeds application development and relieves developers of the effort and expense of creating these crucial services on their own Load balancing Fault tolerance Web Services Legacy integration Transaction management Security Messaging Multi-threading Persistence Database connectivity Resource pooling Development, testing, and packaging facilities
CENG 520 Gokce Banu Laleci 6
11.12.2003
11.12.2003
J2EE based..
J2EE Patterns
TM
11.12.2003
J2EE based
BEA WebLogic Java Application Server IBM WebSphere Java Application Server Oracle 9i Java Application Server Sun ONE Java Application Server (iPlanet) HP Application Server (HP-AS) (Bluestone) JBoss Application Server Enhydra Application Server
CENG 520 Gokce Banu Laleci 9
11.12.2003
Java Servlets & Java Server Pages (JSP) Enterprise Java Beans (EJB) Java Transaction API (JTA) Java Transaction Service (JTS) Java API for XML Parsing (JAXP) Java Messaging Service (JMS) Message Driven Beans (MDB) Remote Method Invocation (RMI) Java Database Connection 2 (JDBC2) Java Connector Architecture (JCA) Java Naming and Directory Interface (JNDI) JavaBeans Activation Framework (JAF)
CENG 520 Gokce Banu Laleci 10
11.12.2003
managing the user interfaces of applications, including desktop applications, Web browsers, and pervasive devices contains the business logic provides connectivity with enterprise systems and databases
CENG 520 Gokce Banu Laleci 11
11.12.2003
Subscriber 1 Presentation
Subscriber 3
11.12.2003
12
Presentation Layer
Thin clients
such as Web browsers that send HTTP requests and receive HTTP responses for static HTML or dynamic Web pages built by Java Servlets and Java Server Pages (JSPs) such as Java applets and applications, ActiveX controls, or Visual Basic clients that run on a desktop and communicate with BEA WebLogic Server through CORBA, Java RMI,IIOP, or COM+
CENG 520 Gokce Banu Laleci 13
Thick clients
11.12.2003
Presentation Layer
Pervasive devices
including wireless phones, PDAs, smart appliances, and other emerging remote clients that communicate with the server via specific and usually very compact
Web Services
that connect to the system using Web Services technologies, such as SOAP,UDDI, and WSDL
CENG 520 Gokce Banu Laleci 14
11.12.2003
Presentation Layer
Servlet and JSP results caching and JSP tags caching provides high-reliability, scalability, monitoring, and other features required by enterprise applications plug-ins for Apache, iPlanet, and Microsoft IIS Web servers
11.12.2003
15
Additional Features
Virtual hosting
www.company1.com and www.company2.com scalability and high-availability insulates clients from hardware or power failures by eliminating single points of failure Incoming requests can be distributed across multiple instances of AS
CENG 520 Gokce Banu Laleci 16
Clustering
Load balancing
11.12.2003
Additional Features
The data contained in Web components can be replicated across multiple machines In the event of a failure, current client session information is maintained
11.12.2003
17
Business Layer
contains the applications business logic independent of the user interface, including distributed components, running in the application server environment Enterprise Java Beans
11.12.2003
18
11.12.2003
19
Generic java component model Can be either visible or not Local to a single process on the client side Uses BeanInfo classes to define themselves
Standard for building distributed systems Non-visible remote objects Remotely executable comp. deployed in the server Uses Deployment descriptor to describe itself
20
11.12.2003
Why EJB
Architectural independence from middleware WORA for sever side components Establishes roles for application development Take care of transaction management Provides distributed transaction support Portable Integrates seamlessly with CORBA
CENG 520 Gokce Banu Laleci 21
11.12.2003
11.12.2003
22
Remote invocation Pool and cache services Security Transaction Integration with external data sources
11.12.2003
23
Containers
Interface btw EJBeans & outside world EJB Clients never access an EJB directlyany access is done through containergenerated methods in turn invoke bean methods
11.12.2003
24
Home interface
Contains factory methods for locating, creating and instances of EJBs The EJB developer defines the Home Interface for his bean Object generated by the Container vendor
11.12.2003
25
An example
11.12.2003
26
Lists the business methods present in EJB Interface defined by the developer Object created by the container vendor Clients use this object to invoke business methods
11.12.2003
27
An example
11.12.2003
28
EJB Client
Finds EJB containers using JNDI Uses EJB container to invoke EJB methods Uses Home Object to locate, create or destroy and EJB class Uses the EJBObject instance to invoke methods
11.12.2003
29
JNDI
Client API provides naming & directory services for Java Apps Does not replace DNS, CORBA, RMI etc Allows multiple directory services coexist Provides a federated name server
30
11.12.2003
An example
// get the JNDI naming context Context initialCtx = new InitialContext (); // use the context to lookup the EJB Home interface AccountHome home =(AccountHome)initialCtx.lookup ("com/~gopalan/Account"); // use the Home Interface to create a Session bean object Account account = home.create (1234, "Athul", 1000671.54d);
11.12.2003 CENG 520 Gokce Banu Laleci 31
EJB Types
11.12.2003
32
Entity Beans
Used to represent business data in an application Correspond with information stored in databases or other persistent storage Have primary key Participate in transactions Long-lived Can survive EJB server clashes Multiple clients can access and work with the same entity bean When not used Preserved in persistent location and returned to the pool When used Can be cached
CENG 520 Gokce Banu Laleci 33
11.12.2003
11.12.2003
34
Persistence
Container Managed Container is responsible for saving state of bean Container needs to generate DB calls Bean persistence is independent of data source specify container-managed fields in Deployment Descriptor
Bean Managed Bean is itself responsible for saving its own state Bean needs to code its own DB calls Bean persistence is hardcoded and is hence less adaptable
11.12.2003
35
Session Beans
Execute on behalf of a single client They may or may-not be transaction-aware They may or may-not update data in the underlying database Their lifetime is limited to that of the client and hence they are relatively short-lived They do not survive server crashes They do not represent data in the database Since they only represent conversational state with a single client, their identity is hidden
CENG 520 Gokce Banu Laleci 36
11.12.2003
Stateless/Stateful
Stateless Session Bean Have no internal state need not be passivated or activated Objects can be pooled to service multiple clients Stateful Session Bean Have internal state need to handle Activation/Passivation One Session Bean object per client
11.12.2003
37
Message-Driven Beans
Do not have home or remote interface Used to integrate with JMS Called JMS message consumers
Listen from a message from JMS server Performs a set of actions defined when message is received
11.12.2003
38
Deployment Descriptors
11.12.2003
39
Additional Features
Instance pooling
pre-load a given number of instances and prepare them for use, thereby saving time by not having to create a new instance for each request EJBs can be deployed in a cluster of BEA WebLogic Servers by means of distributed naming and directory facilities
CENG 520 Gokce Banu Laleci 40
Clustering
11.12.2003
Additional Features
replicate state that EJB hold across a cluster of separate physical AS processes creating redundancy in case of transparently fail-over to a backup machine in the cluster in the event of a failure route requests from remote clients to EJB components using a predetermined algorithm or custom-algorithm
CENG 520 Gokce Banu Laleci 41
Load balancing
11.12.2003
Additional Features
EJB Caching
store a configurable number of EJBs in memory to save on database access In case another instance of the server in the cluster updates the same bean, all the cached instances of the bean cached in the cluster will be invalidated, and reloaded with the next access increases performance and reduces the load on the database
CENG 520 Gokce Banu Laleci 42
11.12.2003
Back-End Layer
databases, ERP, CRM, mainframe or other existing applications messaging, e-mail, Web Services, and other technologies to connect and communicate with enterprise systems
Integration layer
11.12.2003
43
Databases
JDBC
Thin clients servlet, JSP Thick clients RMI to remote databases most recommended way is to use entity beans and benefit from the underlying services Connection pooling
11.12.2003
44
Integration
integrating new applications with any legacy Enterprise Information System (EIS) J2EE Connector Architecture (J2CA) CORBA
integration with legacy systems that implement the CORBA specifications bi-directional interoperability with Microsoft s COM+ can access data in Microsoft applications, communicate with Visual Basic clients
CENG 520 Gokce Banu Laleci 45
COM/DCOM (COM+)
11.12.2003
JCA
a standard architecture for connecting the J2EE platform to heterogeneous EIS systems
ERP, mainframe transaction processing, database systems, and legacy applications not written in the Java programming language enables the integration of EISs with application servers and enterprise applications
11.12.2003
46
JCA
enables an EIS vendor to provide a standard resource adapter for its EIS The resource adapter plugs into an application server, providing connectivity between the EIS, the application server, and the enterprise application An EIS vendor needs to provide just one standard resource adapter which has the capability to plug in to any application server that supports the J2EE Connector architecture
11.12.2003
47
JCA
Multiple resource adapters are pluggable into an application server enables application components deployed on the application server to access the underlying EIS systems
11.12.2003
48
JCA
11.12.2003
49
Resource Adapter
To achieve a standard system-level pluggability between application servers and EISs, the J2EE Connector architecture defines a standard set of system-level contracts between an application server and EIS The resource adapter implements the EISside of these system-level contracts
CENG 520 Gokce Banu Laleci 50
11.12.2003
Resource Adapter
system-level software driver used by an application server or an application client to connect to an EIS By plugging into an application server, the resource adapter collaborates with the server to provide the underlying mechanisms, the transactions, security, and connection pooling mechanisms A resource adapter is used within the address space of the application server
CENG 520 Gokce Banu Laleci 51
11.12.2003
Application Contract
An application server and an EIS collaborate to keep all system-level mechanisms, such as transactions, security, and connection management, transparent from the application components A Connection Management contract A Transaction Management contract Security contract A Message Inflow contract A Lifecycle Management contract A Work Management contract
CENG 520 Gokce Banu Laleci 52
11.12.2003
Automatically wraps the business components in to Web services Support for WSDL and UDDI Publish, search, host Support for Web Services Security standard Reliable SOAP implementation based on a sequence of asynchronous SOAP communications, receipts, and notifications guaranteed delivery, exactly-once delivery, ordered conversation A set of convenient graphical tools for development, search, and composing of the Web Services BEA WebLogic Workshop
CENG 520 Gokce Banu Laleci 53
11.12.2003
Messaging
Application
11.12.2003
54
MOM
Provides
Guaranteed message delivery Fault tolerance Load balancing of destinations Subscription mech. Tibco Rendezvous IBM MQSeries BEA Tuxedo/Q Microsoft MSMQ
CENG 520 Gokce Banu Laleci 55
Proprietary solutions
11.12.2003
API
to allow existing companies to JMS-enable their applications without impacting client-side development
Supports
Publish/subscribe Point-to-point
CENG 520 Gokce Banu Laleci 56
11.12.2003
JMS System
11.12.2003
JMS Connection Factory JMS Connection JMS Session JMS Producer Or JMS Consumer
Client
1:RetrieveJ MS Driver Connection Factory
JNDI
Naming Service
11.12.2003 CENG 520 Gokce Banu Laleci 58
Example
try { queueConnectionFactory =(QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory"); queue =(Queue)jndiContext.lookup(queueName); } try { queueConnection = queueConnectionFactory.createQueueConnection(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueSender =queueSession.createSender(queue); message =queueSession.createTextMessage(); for (int i =0;i <NUM_MSGS;i++){ message.setText("This is message "+(i +1)); System.out.println("Sending message:"+ message.getText()); queueSender.send(message); }
11.12.2003 CENG 520 Gokce Banu Laleci 59
Just to consume messages Not a component interface onMessage method Threading Life cycle management
CENG 520 Gokce Banu Laleci 60
11.12.2003
Security
Java Authentication and Authorization Server (JAAS) Encryption Auditing HTTPS, basic HTTP authentication with Base64 encoding for services protected by firewalls Role based security User and group definition Built-in security data store retains the role,profile,and entitlement data,and is built on a highly optimized LDAP directory Single Sign-On WS-Security
CENG 520 Gokce Banu Laleci 61
11.12.2003
JAAS
Portable interface Java applications to remain independent from underlying authentication technologies Basic Digest Certificate
CENG 520 Gokce Banu Laleci 62
Authentication
11.12.2003
Authorization
Programmatic
Hard code security checks in to your bean code Through deployment descriptor Container handles the rest
Declarative
11.12.2003
63
Role based
Each user must be uniquely identified User should be assigned one or more security roles Each security role is assigned a set of method permissions
11.12.2003
64
11.12.2003
65
11.12.2003
66
Transaction
ACID
Many operations are bundled together and appear as one atomic unit
11.12.2003
67
ACID
Consistency
A transaction leaves the system in a consistent state Protects concurrently executing transactions from seeing each others incomplete results Guarantees that updates to managed resources, such as database records, survive failures
CENG 520 Gokce Banu Laleci 68
Isolation
Durability
11.12.2003
Transaction
Type
Flat Nested Resource managers are transaction aware They do no not make the changes persistent until a commit statement issued
11.12.2003
69
EJB never interact with a transaction manager or a resource manager The container handles all the low-level things Demarcating transactional boundries
11.12.2003
70
Programmatic Transactions
Put the transaction logic in to your application code The programmer is responsible for issuing
Client Code
1:call method
EJB object
EJB
4:perform business operations
11.12.2003
Transaction Service
71
Declarative Transactions
11.12.2003
72
Declarative Transactions
Client Code
1:call method 3:call begin EJB Container
EJB object
2:delegate
Transaction Service
EJB
4:perform business operations
11.12.2003
73
Client Code
Transaction Service
EJB object
2:delegate
EJB
4:perform business operations
11.12.2003
74
Container-Managed Transactions
11.12.2003
75
11.12.2003
76
Beans transaction
T2 T1 T2 T2 None T1 Error T1 None None None error
77
Programmatic Transactions
Multiple parties participating in a transaction Basic interfaces that transactional object, resources, resource managers, and transaction managers use to interoperate
11.12.2003
78
Corba OTS
Java Transaction Service Java Transaction API To have various vendors to interoperate Used by AS Application developers Programmaticaly control transaction boundaries
CENG 520 Gokce Banu Laleci 79
JTA
11.12.2003
11.12.2003
80
Example
11.12.2003
81