Java Technology Architecture Planning and Design
Student Guide
Sun Microsystems, Inc. MS BRM01-209 500 Eldorado Boulevard Broomfield, Colorado 80021 U.S.A.
Part Number 805-4478-01 Revision A.1, July 1999
This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any.
Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a
registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun Logo, Solaris, Java, JavaSoft, JavaBeans, Enterprise JavaBeans, JDBC, SunTea, 100% Pure
Java, JavaHelp, SunLink, JDK, JavaStation, JavaStar, JavaScope, JavaSpec, JavaScript, Java HotSpot, Java Workshop, JavaOS, Java Naming and Directory Interface, Solstice SunScreen, and NFS are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. Netscape Navigator is a trademark of Netscape Communications Corporation.
The OPEN LOOK and Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun licensees who implement OPEN LOOK GUIs and otherwise comply with Sun written license agreements.
RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR 52.227- 14(g) (2)(6/87) and FAR 52.227-19(6/87), or DFAR 252.227-7015 (b)(6/95) and DFAR 227.7202-3(a).
DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS, AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
Please Recycle
About This Course
Course Goal
Java Technology Architecture Planning and Design provides you with the knowledge base to create Java™ technology enterprise applications. As the architect, you take the object model and define the communication techniques that will be used between distributed objects and between objects and nonobject-oriented applications and data sources.
When you design an architecture, make sure the application is built for scalability, flexibility, security and performance, and promotes and takes advantage of object reuse.
Upon completion of this course, you should be able to advise customers on the benefits of using Java technology and object-oriented technologies, evaluate the suitability of a proposed Java application, and build distributed object architectures to meet customer requirements.
xiii
Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services July 1999, Revision A.1
Each module begins with a course map that enables you to see what you have accomplished and where you are going in reference to the course goal. A complete map of this course is shown below.
Foundation
Introduction to the Java Technology Architecture Process
Basic Principles
Designing a Java
Java Technology
Technology Architecture
Architecture Details
Advanced Principles
Integration With Existing
Creating New
Applications and Databases Application Architectures
Security and Performance Principles
Designing a Secure Java Designing an Architecture Technology Architecture
for Performance
Deployment
The Java Technology Architecture in Production
xiv
Java Technology Architecture Planning and Design
Module-by-Module Overview
● Module 1 – Introduction to the Java Technology Architecture
Process This module explains the role of a person who creates Java
technology architectures with respect to the application development process. This role is compared to the roles of people who write Java technology programs or develop Java applications.
● Module 2 – Designing a Java Technology Architecture This module uses a case study to introduce the basic concepts of
Java technology architecture. ● Module 3 – Java Technology Architecture Details
This module delves into the Java technology three-tier architecture, and looks at the decisions and trade-offs that need to
be made for each of the tiers. Case studies are used to explain the various architectural details.
About This Course
xv
Module-by-Module Overview
● Module 4 – Integration With Existing Applications and Databases This module focuses on the third tier of the Java technology
architecture, and how a Java application can be seamlessly integrated into this tier.
● Module 5 – Creating New Application Architectures This module looks at the options for building new Java application
architectures. ● Module 6 – Designing a Secure Java Technology Architecture
Many Java technology solutions incorporate a public network such as the Internet. This module looks at how security is incorporated into the Java application architecture.
● Module 7 – Designing an Architecture for Performance This module discusses the performance implications of a Java
technology architecture.
xvi
Java Technology Architecture Planning and Design
Module-by-Module Overview
● Module 8 – The Java Technology Architecture in Production This module looks at architectural design decisions that might
affect the implementation of a Java technology solution. ● Appendix A – References
This appendix contains reference information and Web site information that is not directly relevant to the course material but may be useful to students.
● Appendix B – Case Studies
This appendix contains case study exercises and detailed instructions for students to work on those case studies.
About This Course
xvii
Upon completion of this course, you should be able to: ● Describe the role of an architect of Java technology ● State the advantages of a distributed object architecture ● Advise on how to use Java technology to maximize business
benefits ● State the major architectural issues and trade-offs faced when
designing enterprise Java technology solutions ● Evaluate the advantages and disadvantages of using Java
technology for enterprise applications (including cost, reusability, performance, and manageability)
● Design a multi-tier Java technology architecture that meets
customer requirements ● Compare a Java technology object-oriented architecture with
common object request broker architecture (CORBA) and distributed component object model (DCOM) alternatives and discuss the pros and cons of each architecture for a set of customer requirements
● Design a Java technology architecture that integrates with existing
systems ● Design a Java technology architecture for a new, enterprise-wide
application ● Evaluate the performance and security of a proposed Java
technology architecture ● Integrate security constraints into a Java application architecture ● Recommend techniques for effectively deploying and distributing
Java technology solutions in production ● Given a Java technology prototype or pilot application, advise on
how it can be effectively moved to production status
xviii
Java Technology Architecture Planning and Design
The skills for Java Technology Architecture Planning and Design are shown in the first column of the matrix below. The black boxes indicate the main coverage for a topic; the gray boxes indicate the topic is briefly discussed.
Module
Skills Gained
Describe the role of an architect of Java technology State the advantages of a distributed object architecture Advise on how to use Java technology to maximize business benefits State the major architectural issues and trade-offs faced when
designing enterprise Java technology solutions Evaluate the advantages and disadvantages of using Java technology
for enterprise applications (including cost, reusability, performance, and manageability)
Design a multi-tier Java technology architecture that meets customer requirements
Compare a Java technology object-oriented architecture with CORBA and DCOM alternatives and discuss the pros and cons of each architecture for a set of customer requirements
Design a Java technology architecture that integrates with existing systems
Design a Java technology architecture for a new, enterprise application
Evaluate the performance and security of a proposed Java technology architecture
Integrate security constraints into a Java application architecture Recommend techniques for effectively deploying and distributing
Java technology solutions in production Given a Java technology prototype or pilot application, advise on
how it can be effectively moved to production status
About This Course
xix
The table below provides a rough estimate of pacing for this course.
About This Course
A.M.
Module 1 – Introduction to the Java
A.M.
Technology Architecture Process Module 2 – Designing a Java Technology
P.M.
Architecture Module 3 – Java Technology Architecture
A.M./P.M.
Details Module 4 – Integration With Existing
A.M. Applications and Databases
P.M.
Module 5 – Creating New Application A.M/P. M. Architectures
Module 6 – Designing a Secure Java P.M. A.M. Technology Architecture
Module 7 – Designing an Architecture for A.M. Performance
Module 8 – The Java Technology P.M. Architecture in Production
xx
Java Technology Architecture Planning and Design
Topics Not Covered
This course does not cover the topics shown on the above overhead. Many of the topics listed on the overhead are covered in other courses offered by Sun Educational Services:
● Object-oriented analysis and design – Covered in OO-225: Object- Oriented Design and Analysis with OMT/UML and OO-226: Java
Analysis and Design Using UML. ● Java technology programming – Covered in SL-275: Java
Programming ● Java technology distributed programming concepts and
application programming interfaces (APIs) – Covered in SL-301: Distributed Programming with Java
Refer to the Sun Educational Services catalog for specific information and registration.
About This Course
xxi
How Prepared Are You?
To be sure you are prepared to take this course, can you answer yes to the following?
● Explain basic object-oriented terms and concepts ● Describe the client-server architecture ● Explain the unique features of the Java programming language
and environment ● Compare the Java programming language to other programming
languages ● Describe the runtime environment for Java technology ● Explain what an API is
xi
Java Technology Architecture Planning and Design
How Prepared Are You?
● List the common Java technology APIs and briefly describe the
purpose of each ● Describe the difference between an applet and an application ● Explain the basic Java technology security model
About This Course
xxiii
Introductions
Now that you have been introduced to the course, introduce yourself to each other and the instructor, addressing the items shown on the above overhead.
xxiv
Java Technology Architecture Planning and Design
How to Use Course Materials
To enable you to succeed in this course, these course materials employ
a learning model that is composed of the following components: ● Course map – Each module starts with an overview of the content
so you can see how the module fits into your overall course goal. ● Relevance – The relevance section at the start of each module
provides scenarios or questions that introduce you to the information contained in the module and provoke you to think about Java technology architectural issues.
● Lecture – The instructor will present information specific to the topic of the module. This information will help you learn the
knowledge and skills necessary to complete the case studies. ● Case studies – Case study exercises will give you the opportunity
to apply the concepts presented in the lecture. ● Overhead image – Reduced overhead images for the course are
included in the course materials to help you easily follow where the instructor is at any point in time. Overheads do not appear on every page.
About This Course
xxv
● Check your progress – Module objectives are restated, sometimes in question format, so that before moving on to the next module
you are sure that you can accomplish the objectives of the current module.
● Think beyond – Thought-provoking questions are posed to help you apply the content of the module or predict the content in the next module.
xxvi
Java Technology Architecture Planning and Design
The following icons and typographical conventions are used in this course to represent various training elements and alternative learning resources.
Icons
Additional resources – Indicates additional reference materials are available.
Discussion – Indicates a small-group or class discussion on the current topic is recommended at this time.
Note – Additional important, reinforcing, interesting or special information.
About This Course
xxvii
Typographical Conventions
Courier is used for the names of command, files, and directories, as well as on-screen computer output. For example:
Use ls -al to list all files. system% You have mail.
Courier bold is used for characters and numbers that you type. For example:
system% su Password:
Courier italic is used for variables and command-line placeholders that are replaced with a real name or value. For example:
To delete a file, type rm filename. Palatino italics is used for book titles, new words or terms, or words
that are emphasized. For example: Read Chapter 6 in User’s Guide.
These are called class options. You must be root to do this.
xxviii
Java Technology Architecture Planning and Design
Introduction to the Java Technology Architecture Process
Course Map
This module explains the architecture process with respect to the application development process and compares it to the roles of those who write Java technology programs and develop Java applications.
Foundation
Introduction to the Java Technology Architecture Process
Basic Principles
Designing a Java
Java Technology
Technology Architecture
Architecture Details
Advanced Principles
Integration With Existing
Creating New
Applications and Databases
Application Architectures
Security and Performance Principles
Designing a Secure Java
Designing an Architecture
Technology Architecture
for Performance
Deployment
The Java Technology Architecture in Production
1-1
Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services July 1999, Revision A.1
Discussion – As an architect of Java applications, you must have a wide range of skills and experience beyond Java programming language skills. Consider the following questions:
● How can I use Java technology with my current environment? ● Where do these Java technologies fit in with my current
environment? ● Why should I use Java technology on my server? ● Why should I use remote method invocation (RMI) instead of
CORBA? Isn’t CORBA an open standard? ● Can I use Active X clients with Java technology? ● If I use Java technology, will there be issues between the various
Java Development Kit (JDK ™ ) versions? ● What is an object request broker (ORB) and where does it reside? ● How will an ORB work with my customer information control
system (CICS) system? ● Can I use CORBA clients with Java technology? ● Should I sign my own Java technology applets or go through a
Certification Authority? ● What tools are there for managing Java technology applets and
server applications? ● Will Java technology overload my network? ● Should my company convert from Smalltalk to Java technology? ● How can I find out how much memory a Java application or
applet requires at runtime?
1-2
Java Technology Architecture Planning and Design
Upon completion of this module, you should be able to: ● Describe the duties performed by an architect of Java technology ● State how a Java technology architectural design fits into an
application development life cycle ● State the advantages of using a distributed object architecture
implementation ● Explain the advantages of using the Java programming language
instead of an alternative language such as C++ ● Explain how an object-oriented architecture can solve business
problems
References
Additional resources – The following references can provide additional details on the topics discussed in this module:
● Bass, Clements, and Kazman. 1998. Software Architecture. Addison-
Wesley. ● Rumbaugh, James et al. 1991. Object-Oriented Modeling and Design.
Prentice Hall. ● Frank Buschmann et al. 1996. Pattern Oriented Software Architecture:
A System of Patterns. Wiley. ● Blaha, Michael. Object-Oriented Modeling and Design for Database
Applications. Prentice Hall. ● Fowler, Martin. 1997. UML Distilled Addison-Wesley. ● Harmon and Watson. 1998. Understanding UML: the Developers
Guide (With a Web-based Application in Java). Morgan. ● Appendix B, ‘‘References.”
Introduction to the Java Technology Architecture Process
1-3
An architect of Java applications is involved at some level in all stages of the Java application design and development process (Figure 1-1). The architect is primarily responsible for defining the ways that distributed Java software components will interact with each other and with components and modules that do not support Java technology.
The architect may be called on to advise customer management (at a high level), or to work on-site at a customer location (at a technical level). Decisions made by the architect can have a far-reaching effect and impact customer organizations.
Overall system architecture
Java technology architecture
Figure 1-1
Various Architectures
1-4
Java Technology Architecture Planning and Design
What Does an Architect Do?
Tasks
The architect needs to have business knowledge as well as computer architecture experience and Java technology industry knowledge, to:
● Advise management on the use of Java technology for maximizing
business benefits ● Demonstrate Java technology expertise to the customer ● Develop a detailed set of application requirements from a high-
level list, and obtain customer agreement upon success criteria. ● Evaluate Java technology applicability for a given customer
against other object languages, or the hypertext markup language (HTML) and common gateway interface (CGI) scripts
● Evaluate the advantages and disadvantages of using Java technology for an enterprise application (including cost, security,
reusability, performance, and manageability considerations)
Introduction to the Java Technology Architecture Process
1-5
Tasks (Continued)
● Recommend third-party Java and object-oriented technologies and products that can meet the customer’s requirements
● Develop project plans and design documents for customers ● Train and mentor customers on Java technology architecture, and
Java technology design principles and interfaces ● Analyze customer-proposed application designs and architectures ● For a given set of business requirements, design a distributed
object architecture using Java technology ● Act as part of a team, which may include the customer, that
designs, develops, and implements enterprise-wide Java technology solutions
● Defend the integrity of the architecture over the project’s lifecycle
1-6
Java Technology Architecture Planning and Design
What Does an Architect Do?
Optional Tasks
The following are not part of the core architect tasks, but may be requested by the customer:
● Determine if this is a programming or a business problem ● Drive the analysis and design phases of application development ● Develop pilot applications for proof of concept ● Discuss and suggest improvements to the customer’s processes
Introduction to the Java Technology Architecture Process
1-7
What Does an Architect Do?
Java Technology Architecture Goals
An architect of Java technology applications should additionally seek an appropriate balance between these features of the architecture:
● Application performance and throughput ● Use of component design ● Adherence to company security policy ● Compatibility with the existing systems, network, and data
architectures ● Object reuse
1-8
Java Technology Architecture Planning and Design
What Does an Architect Do?
Constraining Factors
The architecture may be constrained and influenced by many factors, including
● Resources, including budget, time, and customer expertise ● Existing systems, data, infrastructure, interfaces, and build/buy
choices ● Network bandwidth and performance ● Human/machine Interface ● Standards ● Security needs
Introduction to the Java Technology Architecture Process
1-9
System Architecture in Perspective
Overview
“The software architecture of a program or computing system is the structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships among them.” (Bass, Len; Clements, Paul; and Kazman, Rick. 1998. Software Architecture in Practice. Addison-Wesley.)
Figure 1-2 shows the flow of an object-oriented development project. Note that this is an iterative process, which may take several iterations to achieve. If the application is large and complex, it may be broken into viable chunks which can be prototyped in isolation.
The architecture phase of an application usually follows the business analysis, and precedes the actual programming phase. With the case of Java technology, which does not require any particular design process, the analysis and design may be done using an object-oriented notation such as object modeling technique (OMT), which defines processes, or its successor unified modeling language (UML), which does not define processes, only a notation.
1-10
Java Technology Architecture Planning and Design
An Example Process
Outputs Business process
Process
Constraints
New workflow reengineering
Business operations,
costs, and
Problem domain analysis
Business
constraints
use case diagrams
Object-oriented
Class analysis
Unknown business
requirements
diagrams
Architecture UML package design
Environmental
design OMT subsystem design
and technology
constraints
Deployment diagrams
Object-oriented
State, Process, design
Reusability
build or buy
Interaction, and Sequence diagrams
Object classes software classes
Generate Java
Build or buy tools
Language choice
Reuse library
Production Test
Deployment Deploy
Figure 1-2
Object-Oriented Deployment Project
Introduction to the Java Technology Architecture Process
1-11
System Architecture in Perspective
Process Steps
Java applications development, like all object-oriented development, benefits most from an iterative development process.
Note – Companies do not have to follow these steps rigidly (some companies may go directly from the requirements step to the architecture step). However, the maximum benefits from object technology are obtained when a methodology is used throughout the entire application development life-cycle.
The steps taken in the architecture process are
1. Create a business requirements/problem statement. The architect’s involvement varies at this stage (it may be minimal if the customer has a formal business process, or may be heavy if the architect is also the designer).
1-12
Java Technology Architecture Planning and Design
Process Steps (Continued)
2. Conduct an object-oriented analysis. The architect should be involved at this stage (however, the customer may actually do the analysis). The architect should ensure the class diagram correctly models the business requirements.
3. Reuse analysis. Ideally, the architect will have reuse in mind at all times during the design process, but this is particularly relevant during the main analysis phase.
4. Develop an architecture. The architecture is the blueprint for building the application and defines the distribution of the object classes on different computers, and the protocols and middleware for connecting and integrating with existing or non- object systems. The architecture may be affected by the locations of the end users, and the pre-existing architectures of legacy systems.
Introduction to the Java Technology Architecture Process
1-13
Process Steps (Continued)
5. Create an object-oriented design. The architect should be involved at this stage, as an advisor (though this is customer dependent). The architect may advise customer designers on object reuse, inheritance decisions, and “buy versus build” decisions about object classes.
6. Code, test, and implement the application. The architect is typically not involved here, except as a project coordinator or advisor.
7. Deploy the application or the prototype. The architect is typically not involved here, except as a project coordinator or advisor. Note that the deployment architecture may differ from the design architecture.
Note – Architectural design patterns are useful architectural models for common application requirements, such as user interface design, and component architectures. The architect can develop new patterns, reference common patterns, or use industry-specific patterns.
1-14
Java Technology Architecture Planning and Design
Why Is an Architecture Needed?
Attempting to go from business requirements directly to the coding stage will produce an unworkable and unmaintainable system. This is why architecture is so important. A well-planned architecture can anticipate potential application troublespots and ensure the success of the application in production.
The application should provide ● Robustness, against incorrect input, and against new requirements ● Scalability ● Portability ● Good performance
Introduction to the Java Technology Architecture Process
1-15
● Integration with existing systems and data ● Appropriate use of new technology ● Appropriate use of protocols, middleware, and standards
Successfully architected applications can be distributed and sold to customers, partners, and others in different environments.
The importance of good architecture cannot be overstressed—the architecture affects the scalability, flexibility, robustness, performance, security, and cost of the application in production.
Note – The architect’s success is measured by these factors.
The architectural documentation should assist in use and extension of the classes. It should also provide some insight into class internals.
1-16
Java Technology Architecture Planning and Design
Architecture Diagrams
There is no standard notation for drawing an architecture. The architect may wish to use UML notation as follows:
● Class diagrams are used when talking to customer analysts. ● UML package diagrams are used to describe the architecture to the
customer. Packages are advantageous for designing architectures, since they allow for the isolation of parts of the application which can then be developed independently. This also promotes flexibility, since a package can be exchanged for a different package if necessary.
● Dependency diagrams are used to show the dependencies
between packages. ● UML deployment diagrams are used to show how the architecture
is divided into tiers.
Introduction to the Java Technology Architecture Process
1-17
Other UML diagrams, such as sequence diagrams and collaboration diagrams, can also be used (Figure 1-3). These include
Figure 1-3
UML Notations Used in Architecture Drawings ● Packages that represent logical software modules (groups of
classes). Links between packages are indicated with arrows. Packages can be stacked within other packages.
● Components that show classes and how they interact. Class diagrams can show subclasses, instances, and associations.
Instances are prefixed with a colon (:) and underlined. Active objects are shown within the instance. Dependencies are indicated with lines.
● Nodes that indicate deployment tiers, such as clients, servers, and
so forth. Packages can be shown within nodes.
1-18
Java Technology Architecture Planning and Design
This course focuses on the impact of Java technology on application architectures. However, you should understand the basic architectural concepts of layering and tiering.
The three-tier (or greater) architecture breaks an application into discreet functions (presentation, business logic, and data access logic). These functions are known as tiers.
Tiers are logical, and may be implemented on physically separate servers. Provided the tiers have been well thought out and created, the tiers can be moved to different physical servers, or an extra tier can be inserted without requiring any changes to the application code. Business rules can be changed without affecting the other tiers.
Presentation tier
Data access tier API
Business logic tier
API TCP layer
API
TCP layer IP layer
TCP layer
IP layer Network
IP layer
Network
Network
TCP = Transmission Control Protocol IP = Internet Protocol
Application architecture
Figure 1-4
Three-Tier Architecture
Introduction to the Java Technology Architecture Process
1-19
The prime architectural focus is the mapping of a business function or system service to a tier. Tiers allow the application to be separated out onto different hardware platforms.
Though each tier can be run on separate physical hardware, the architecture is independent, allowing for different distribution models of the architecture. For instance, multiple tiers may be implemented to run on the same hardware platform or on separate platforms, and additional tiers can be inserted for scalability and flexibility.
1-20
Java Technology Architecture Planning and Design
Tier-to-Tier Communication
Protocols
Application tiers communicate across a network and relay data to one another using communication protocols such as:
● Sockets ● Remote procedure calls (RPCs) ● Messaging
API Constraints
Applications use APIs to access these communication protocols. In a two-tier client-server architecture, structured query language (SQL) calls to a database are passed from client to server using one of the listed mechanisms. In many cases, the API and protocol libraries are provided by the database vendor or fourth generation language (4GL) tool vendor, so the choice is dictated by the vendor.
Introduction to the Java Technology Architecture Process
1-21
Sockets
Sockets are used for sending and receiving streams of data bi- directionally between two applications.
Client tier
Server tier
Database tier
GUI Linked
business logic
access
logic libraries
Server Server
socket socket
GUI = graphical user interface
Figure 1-5
Tier-to-Tier Communication Using Sockets
1-22
Java Technology Architecture Planning and Design
Remote Procedure Calls
Remote procedure calls (RPCs) are used for calling a remote application.
Messaging
Messaging protocols are used for sending data as messages between two applications. Data is placed on a queue by the sending tier and retrieved from the queue by the recipient tier.
Note – Other communication protocols, such as IBM APPC, and middleware, such as transaction monitors, will be discussed in later modules.
Introduction to the Java Technology Architecture Process
1-23
Socket calls and RPCs are not object-oriented by design (Figure 1-6): Object call to method
Object may receive on another object.
arguments of
Remote Method
Parameters and previously unknown
Invocation (RMI)
return values are types; classes may objects.
be loaded as needed. Object call to method
Object must receive on another object.
arguments of known
Internet Inter-ORB
Parameters and types. Methods must
protocol (IIOP)
return values are
be preinstalled on structures.
server. Procedure call to
Data and execution another program.
requests transferred
RPC
Parameters and between client and return values are
server. Procedures structures.
preloaded on server. Socket call transfers
Only data is byte stream data
transferred between
Socket
between two client and server. programs.
Interpretation must be explicitly coded.
Figure 1-6
Distributed Object Architectures, Sockets, and RPCs Socket calls are the most basic form of communication, and require
both sides to agree on the format of data to be exchanged. The programmer is responsible for encoding and decoding the data between the different machine architectures.
RPCs provide more abstraction than sockets. The programmer uses standard procedural programming calls to call a remote program.The programmer does not have to encode the data (the RPC does the encoding using some form of external data representation). However, RPCs may be proprietary to a vendor system and are not guaranteed to fully interoperate with another vendor RPC.
1-24
Java Technology Architecture Planning and Design
Object-to-object communication is the highest level of abstraction, allowing for applications to be designed, developed and distributed in
a way that parallels business operations. ● An object can invoke methods on a remote object in the same way
that it invokes methods on local objects. ● With a distributed object-oriented application, the objects that
make up the application can be split up and run on multiple tiers throughout a network on computers that best fit the task of each object without having to change the rest of the application using these objects. For example, an object that performs intense computations, such as three-dimensional renderings, might be placed on a more powerful computer, rather than on an average desktop computer.
● Neither programmers nor users should be concerned about where
a specific object resides. The architect determines the deployment location. Objects can be easily moved about, as the needs of the business dictate. Objects can also be migrated to new platforms without program changes.
Introduction to the Java Technology Architecture Process
1-25
Discussion – What is the advantage of having objects at each tier?
1-26
Java Technology Architecture Planning and Design
Distributed Object Frameworks
Distributed object frameworks allow distributed objects to communicate across networks. The framework supplies the infrastructure (APIs and network protocols), allowing the programmer to focus on the business logic. Examples of such frameworks are:
● JavaSoft™’s Remote Method Invocation (RMI) ● The Object Management Group’s Common Object Request Broker
Architecture (CORBA) ● Microsoft’s Distributed interNet Application Architecture (DNA)
which contains the Component Object model (COM) and the Distributed Component Object model (DCOM)
Note – RMI, CORBA, and DNA are usually implemented on top of APIs such as RPCs or sockets.
Introduction to the Java Technology Architecture Process
1-27
Object Languages
Some popular object-oriented (OO) programming languages are Java, C++, and Smalltalk. Table 1-1 gives a comparison of these languages.
Table 1-1 Comparison of Object Languages
Objected-Oriented Pure OO
Not pure OO
Pure OO
Growing rapidly in use Widely in use
Slow growth rate
Standard
Implementations may
vary by vendor
vary across vendors may vary across
(standard is maintained
vendors
by Java technology licensing)
Reusable
Yes
Hard to obtain reuse Yes
Web Support
Java Technology Architecture Planning and Design
Smalltalk Platform
Java
C++
Cross-platform virtual
Platform dependent Cross-platform
Dependence
machine (many
virtual machine
implementations)
(few implementations)
Security
Provides security for
No built-in security No built-in
Internet (sandbox)
for Internet
security for Internet
API Use
Java technology API set Lack of enterprise
Lack of enterprise
enhances usability of
APIs
APIs
Java technology
Cost
Sun’s JDK is free. Some GNU is Not UNIX
Cost issue for
development systems
(GNU) compilers
Smalltalk
are chargeable
are free, otherwise
environment
there may be a small cost for the compiler
Features
Safe language (no
Pointers and
Garbage
pointer manipulation)
memory leaks
collection
and garbage collection
Introduction to the Java Technology Architecture Process
1-29
Overview
The typical three-tier architecture for a Java application is shown in Figure 1-7.
Logical application view
Tier one
Tier two
Tier three
• User interface
• Legacy • Input validation
• Business logic
• Business rules
application and data
• Data input
• Client session
access logic
management
• Local • Database calculations
• Database connection
server logic
• Remote object access
• Web browser with • Web (HTTP) server • Database optional Java
products
• Java application or servlet
applet • Legacy products
• Non-Java application
• Java application and applications
• Middleware such as
• Transaction
transaction monitors
processing
• Protocol converters
systems
• Terminal emulators
HTTP = Hypertext transfer protocol
Figure 1-7
Basic Three-Tier Java Technology Architecture
1-30
Java Technology Architecture Planning and Design
Overview (Continued)
As shown in Figure 1-7, tier one (the client tier) provides the graphical user interface (GUI), forms for data entry, and local validation of data. Computations can be performed at this stage (for example, summarizing or totaling a list of items entered on an order, sorting data). The client tier can be implemented as a Java applet that is downloaded to the client and runs within a Web browser, or as a Web browser form. The client tier does not connect directly to a database back end.
Tier two consists of an “application server.” The application server handles connections from client applications, performs most of the business logic, and interfaces to databases and applications at tier three. The application server can be written in the Java programming language or in a traditional language such as C or C++. This tier can additionally provide the following services to the client tier:
● Remote object access (CORBA, Java technology RMI) ● Database connectivity, access, and update ● Processing of transactions ● Load balancing ● Protocol conversions (for example, IBM 3270 to HTML) ● Terminal emulation (for example, IBM TN3270) ● Security services (proxy servers and access control) ● Email services ● File services ● Print services
Introduction to the Java Technology Architecture Process
1-31
Overview (Continued)
The Web server, though not strictly part of the application architecture, is used to download applets to the client platform, as well as respond to Web uniform resource locator (URL) requests from tier one.
Tier three consists of the database server and physical database store, or legacy applications and legacy data stores. Application logic can be embedded here as triggers and stored procedures in the database. Tier three can be physically implemented on the same server as tier two, or can be implemented on one or more back-end servers.
Note – The architecture can have more than three tiers. This will be discussed later.
The architect defines the logical application tiers and how they communicate, and how they can be implemented on physical platforms:
● Tier two provides the opportunity for scalability in a Java
technology architecture. ● The architect should design tier two for scalability, so that it can be
scaled up as the number of tier one clients increases. For example,
a second application server can be added without affecting either tier one or tier three.
1-32
Java Technology Architecture Planning and Design
Basic Three-Tier Java Technology Architecture
Applets, Applications, and Servlets
Java applets are invoked by the HTML <applet> tag and downloaded to the client from a Web hypertext transfer protocol (HTTP) server. Applets have to conform to certain security restrictions if they are not signed.
Java applications are not subject to the security restrictions of applets. Applications do not need a Web browser, and must be pre-loaded onto the client or server platform (they are not automatically downloaded).
Servlets reside on the Web server and perform the same functionality as applications, except that they are invoked by the Web server.
Introduction to the Java Technology Architecture Process
1-33
Discussion – What are some of the advantages of a three-tier architecture over a two-tier architecture?
1-34
Java Technology Architecture Planning and Design
Introduction to the Java Technology Architecture Process
1-35
Comparison of Three-Tier Communication Mechanisms
Application tiers communicate using a wide range of protocols. As shown in Table 1-2, these include asynchronous message queuing, RPCs, and sockets (the most common).
Object-oriented applications use object-oriented interfaces layered on top of these protocols. The architect needs to select the appropriate type of underlying protocol to best serve the application requirements. Table 1-2 compares the various protocols using the following definitions:
● Asynchronous communication enables the calling object to
continue processing. ● Synchronous communication blocks the calling object from
processing until the called object completes. ● Conversational communication gives the calling object the option
to continue processing or wait for a response. Conversational communication is sometimes referred to as peer-to-peer.
1-36
Java Technology Architecture Planning and Design
Table 1-2 Three-Tier Communication Mechanisms Conversational/
Loosely coupled
Tightly coupled application design. application design. application
Tightly coupled
Application
No wait time.
Wait time for
design.
Characteristics
remote procedure
No wait time.
to execute.
Can work in
Network must be
Network must be
disconnect mode.
Network does not
Characteristics
have to be available.
Performance not
Performs best on
Performance not
Application
affected by
high-speed local
affected by
Latency
network speed.
area network
network speed.
(LAN).
Suits
Suits transaction
Suits data
publish/subscribe processing.
Better for high- performance mainframe access.
Message queuing
Remote procedure Socket call
Example
IBM MQSeries.
call.
IBM LU6.2.
Introduction to the Java Technology Architecture Process
1-37
Synchronous and Asynchronous Architectures
A well designed Java technology architecture should be independent of the actual communication mechanism. However, the architect should still decide early on which parts of the application must be synchronous, and which parts can take advantage of messaging.
● Synchronous applications make more demands on the application development, and on the eventual deployment. The architecture must be robust and fail-safe, and cope with error situations such as
the network or remote server being unavailable. The deployment configuration must provide for the level of reliability with redundant network and server components.
● Asynchronous applications can use the features provided by messaging products for reliability, so there are fewer demands on
the development.
1-38
Java Technology Architecture Planning and Design
Introduction to the Java Technology Architecture Process
1-39
Defining a Java technology architecture is no different than designing
a multi-tiered client-server application; however, there are considerations due to the use of object technology, the Internet, the Web, and the use of the Java programming language (Figure 1-8).
Mainframe
RDBMS
CICS IMS
Service network
Web browser Web browser Embedded
JVM
Java application
Java applet
HTML
RDBMS = Relational database management system IMS = Information management system
Figure 1-8
Overall Java Technology Architecture The simplest Java technology architecture adds the following
components and services to the application architecture: ● Tier one
▼ Java Virtual Machine (JVM) or Web browser that supports Java
technology ▼ HTML pages or Java technology applets that are downloaded
from the tier two Web server ▼ Network interface to tier two transmission control
protocol/Internet protocol (TCP/IP) or TCP/IP over point-to- point protocol (PPP)
▼ Communication protocols to tier two
1-40
Java Technology Architecture Planning and Design
● Tier two
▼ Web server for downloading applets and HTML pages ▼ Application server (purchased or developed business logic) ▼ Security services (authentication, for example) ▼ General services (print, email, file, directory, and so forth) ▼ Middleware to tier three (ORBs, transaction monitors, and so
forth) ▼ Communications protocols to tier three
Introduction to the Java Technology Architecture Process
1-41
Discussion – Take a few minutes to discuss some typical issues and considerations that an architect must deal with. For example:
● Java technology environmental and infrastructure issues ● Object reusability ● Designing the various application tiers and splitting logic among
the tiers ● Placement and mapping of the tiers onto physical servers ● Specifying the protocols between the tiers (object or non-object) ● Performance implications for the architecture ● Network implications for the architecture (LAN, wide area
network [WAN], Internet, private network) ● Designing an architecture for scalability and flexibility (so that
objects can be moved easily in deployment) ● Designing an architecture for security ● Designing an architecture for portability
1-42
Java Technology Architecture Planning and Design
Before continuing on to the next module, check that you are able to accomplish or answer the following:
❑ Describe the duties performed by an architect of Java technology ❑ State how a Java technology architectural design fits into an
application development life cycle ❑ State the advantages of using a distributed object architecture
implementation ❑ Explain the advantages of using the Java programming language
instead of an alternative language such as C++ ❑ Explain how an object-oriented architecture can solve business
problems
Introduction to the Java Technology Architecture Process
1-43
How do you approach designing an architecture based on Java technology?
1-44
Java Technology Architecture Planning and Design
Designing a Java Technology Architecture
Course Map
This module uses a case study to introduce the basic concepts of Java technology architecture.
Foundation
Introduction to the Java Technology Architecture Process
Basic Principles
Designing a Java
Java Technology
Technology Architecture
Architecture Details
Advanced Principles
Integration With Existing
Creating New
Applications and Databases
Application Architectures
Security and Performance Principles
Designing a Secure Java
Designing an Architecture
Technology Architecture
for Performance
Deployment
The Java Technology Architecture in Production
2-1
Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services July 1999, Revision A.1
Discussion – You have been presented with a set of requirements from a customer for a business application. The customer is interested in hearing if the Java technology model is applicable and how Java technology can be used to increase the business benefits of the application. The customer is not currently using Java technology.
You are scheduled for a one-hour, informal meeting with the customer’s project manager, technical architect and lead programmer. At this meeting you should be prepared to draft a high-level architecture for this application using Java technology, and explain how it can benefit their business.
● Do you have enough information from the customer? What additional questions might you ask the customer? What additional information might you need from the customer (for instance, data models or entity-relationship diagrams)?
● What do you need to know about the customer’s business and his or her information technology (IT) environment?
● How can you assess how Java technology will benefit the
customer? ● How do you create a Java application?
2-2
Java Technology Architecture Planning and Design
Upon completion of this module, you should be able to: ● Evaluate the applicability of a Java technology solution for a given
customer application requirement ● Design a basic three-tier architecture for a set of customer
requirements ● Explain the advantages of using Java technology RMI for a given
customer architecture ● State the major architectural issues and trade-offs faced when
designing a distributed Java technology solution ● Discuss the advantages of servlets rather than common gateway
interface (CGI) scripts ● List common communication protocols used in a three-tier Java
technology architecture
References
Additional resources – The following references can provide additional details on the topics discussed in this module:
● Berg, Daniel J. and Fritzinger, Steven. Advanced Techniques for Java
Developers. Wiley. 1998. ● Appendix B, ‘‘References.”
Designing a Java Technology Architecture
2-3
Expense Collection and Reimbursement System (ECARS) is an existing application for employee submission of business expenses requests and reports on-line. It is a two-tier client-server application—the workflow is illustrated in Figure 2-1.
Manager Employee
Approval code
Email Expense Expense report approval
Database
Expense
Audit checks
payment
Figure 2-1
ECARS Application Workflow
2-4
Java Technology Architecture Planning and Design