Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
InternetInternet EngineeringEngineering
Tomasz BabczyTomasz Babczyńński, ski, ZofiaZofia KruczkiewiczKruczkiewiczTomasz KubikTomasz Kubik
InformationInformation systems systems modellingmodelling–– UML and UML and service description languagesservice description languages
I. Design patterns used to build the Integration
TierD.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
1. The definition of the Integration Tier – a five-tiered model of logical separation of tasks
2. Basic Integration Tier design issues
3. Bad practices when designing the IntegrationTier
4. Analysis of basic design issues
Design patterns used to build the Integration
TierD.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
1. The definition of the Integration Tier – a five-tiered model of logical separation of tasks
Multitiered Information System by D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
Client Tier
Customer applications, applets, elements of
the graphical user interface
Presentation Tier JSP Pages, servlets, and other user
interface elements
Business Tier EJB components and other business
objects
Integration Tier JMS, JDBC, connectors and connections
with external systems
Resource Tier Databases, external systems and other
resources
Interacting with the user, device and user interface
presentation
Login, session management, content creation and delivery,
formatting and validation
Business logic, transactions, data and services
Resource adapters, external systems, mechanisms for
resource, control flow
Resources, data and external services
EIS (Enterprise Information System ) Tier(Tutorial Java EE 5)
Business Tier
Application Client
And Optional
JavaBeans
Components
Web Browser,
Web Pages,
Applets, and
Optional
JavaBeans
Components
Client Tier
Java EE
Server
EIS Tier Database and
Legacy Systems
Java Persistence Entities
Session Beans
Message-Driven Beans
Web Tier
Web Pages
Servlets
JavaBeens
Components
(Optional)
Design patterns used to build the Integration
TierD.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
1. The definition of the Integration Tier – a five-tiered model of logical separation of tasks
2. Basic Integration Tier design issues
Basic issues of Integration Tier design
1. Managing access to data
2. Managing connections to a database - the pool calls
Managing access to data (1)
• Data access code is embedded in the Presentation Tier or Business Tier, which is used for other purposes such as:
– Servlet, EJB component– As a result, these classes are occupied with additional
functions, performance and scalability. It would be better to introduce the Integration Tier and affecting place the code to access data there.
• Data access code is located in a tier of integration, but does not cache the results obtained during the various accesses to databases.– If you need to increase scalability and improve performance,
cache processing results in a database, avoiding duplication of operations directly at the database level.
Managing access to data (2)
•Data access code is extracted from the classes that are used to
meet other objectives
•Data access code should be placed logically and physically closer
to a data source
Any class
Code of Data Access
Client, Presentation or Business Tier
ResourceTier
ResourceTier
Data Bases
Data Bases
Any class
Code of Data Access
Client, Presentation or Business Tier
Integration Tier
Manage connections to a database - the pool calls
Connections
returned to
connection
pool
Client,
Presentation or Business
Layer
Resource
Layer
DAO
DAO
DAO
Data Bases
Client, Presentation or
Business Layer
Resource
Layer
Data Bases
DAO
DAO
DAO
Used active connection
Active connections
Used active
connection
Active connections
Database connections are not
shared, which decreases
performance and scalability.
The pool of shared connections
improves performance and scalability
Design patterns used to build the Integration
TierD.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
1. The definition of the Integration Tier – a five-tiered model of logical separation of tasks
2. Basic Integration Tier design issues
3. Bad practices when designing the IntegrationTier
Bad practices
• Performing data validation
• Data structures from Presentation Tier are available
• Data structures from Business Tiers are available
• Sharing the Presentation and Business Tiers of objects an active connection to the database
• Direct integration of exception handling in the tiers of the presentation and business
• To transmit data between Presentation and Business Tiers and the tier of integration is not used auxiliary object class
• No encryption of sensitive data
Design patterns used to build the Integration
TierD.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns
1. The definition of the Integration Tier – a five-tiered model of logical separation of tasks
2. Basic Integration Tier design issues
3. Bad practices when designing the IntegrationTier
4. Analysis of Basic design issues
Design cases
1. Hiding data access logic in a separate tier
2. Separation of persistence mechanisms from the
object model
3. Asynchronic calls of services
4. Facility of access to services by using the XML
Langugew and internet protocols
Problem 1 – Hiding data access logic in a separate tier.
Data Access Object
Client Tier
Servlets,JSP
Business Tier
ClientBusinessDelegate
1
DataBase
ResourceTier
Code of Data Access
Integration Tier
Presentation Tier
Servlets and JSP with presentation logic and
controller to separate layers
Session Component with business logic
Data Acces logic with
direct accesss to databases
Session Component
relational or
object-oriented
database, LDAP,
file system,
repository XML
Architecture of information system
Requirements
• You need to implement data access mechanisms to retrieve and modify data in the permanent storage
• The persistent storage system should be separated from the rest of application - it does not disclose exceptions, data structures, objects related to types of sql libraries
• You should create an uniform interface to access data stored in various sources for example. in RDBMS, LDAP, OODB, XML repository, flat file
• Data access logics should be organized and data access functionsshould be hidden in one location to achieve greater portability and ease of maintenance code
• It can be stateless
• It does not cache data obtained during data collection
Implementation
• Custom data access object
• Data Access Factory
• A collection of transfer objects
• Buffered collection of lines
• Collection of read-only
• lines Wrapper List (Wrapper Rowset List)
Result
• Hides data access
• Creates object-oriented mechanisms for data access and conceals of database schemas
• Facilitates data migration by replacing the DAO Tier
• Reduces the complexity of client code
• Introduces an additional tier
• Puts all the data access code inside a separate tier
• A design requires a hierarchy of classes
• Introduces complexity for the use of object-oriented data access methods
implements
the CRUD
operations
relational or object-
oriented database,
LDAP, file system,
repository XML result of a query
Download data
Insert data
Update data
Delete data
Problem 2 – The separation of persistence mechanisms
from the object model. Domain Store
Possible solutions of persistence mechanisms
• No object model exists - a solution to the problem 1
• Persistence mechanism is implemented in containers, which are objects of "entity" (strategy-CMP Container-Managed Persistence) - no inheritance in the object model
• Persistence mechanism is implemented at the premises of "entity" (strategy BMP - Bean-Managed Persistence); code of persistence mixed with the object model (no inheritance)
• The mechanism of persistence is placed in the object model of "entity" - code of persistence mixed with the object model
• The mechanism of persistence is separated from the object model of "entity" based on all object-oriented patterns
Model of Business Tier based on 2, 3, 5 solutions of persitsence
C lien t
Bu sin ess
lo gic
Se ss io n
F ac ade as Se ss io n
F acad e
T ransa c tion L og ic m anag ed by
Se ssion C om pon ent,
s pe cia l com pon en ts
o r C on tene r
C l ient or P resen ta tion
T ie r B usin ess T ie r
Co mpon entEnti ty A
C omp onentEn tity B
Co mpon entEnti ty C
Architecture of 5-tiered information system
Servlets,
JSP
Client
Entity
Component
Business
Delegate 1 Data
Base
Code of Data Access
Servlets and JSP with
presentation logic and controller to separate layers
Session Component with business logic, Entity Components as
persistence transaction objects
Data Acces
logic with JPA accesss to
databases
Session Component
Client Tier
Business Tier
Resource
Tier
Integration
Tier Presentation Tier
Requirements
• Implementation of persistence mechanisms in business objects such as "entity " should be avoided
• It should be refrained from objects of type "entity" that use the persistence mechanisms of the container.
• The application can run in a web container.
• Object models use inheritance and complex relationships.
• The mechanism of persistence can be realized in two ways:
– make your own skeleton of persistence
– or use a out-of-box solutions based on JDO or own O-R solutions,
Result
• Create custom implementation of persistence is a complex task• Loading and saving multi-level tree of objects requires
optimization• Allows you to better understand the mechanisms of persistence
principles• Advanced mechanisms for persistence may be too powerful for a
simple object model• Facilitated testing of object model• Separation of business object model from the persistence logic
Implementation
• Custom implementation of persistence• Downloading of the on-demand• JDO (Java Data Object)
Data model
Business Tier
Create and persist business object
Download data
Create and perform the Query
II. Example of multitiered web application
1. Two examples of architectures of the multitieredapplication as the Visual Web Java Server Pagesapplications
2. The Visual Web Java Server Pages applicationbased on synchronization data by application
2.1. Structure of project
2.2. Business Service Subtier
2.3. Application Service of Business Tier
2.4. Integration Tier
2.5. Presentation Tier
Example of multitiered web application
1. Two examples of the architectures of the
multitiered application as the Visual Web Java
Server Pages applications
JavaServer Faces Standard Request-Response Life Cycle
Example of the architecture of web application based on
synchronization data by databases (1)
ApplicationBean1
Application Service
Sun pattern
SessionBean1 Session Facade
Sun pattern
JSF Pages JSF Pages JSF Pages
Client1 Client2 Client3
Data base
Library
Directory
Object Model Gof Patterns: Facade: TFacade Factory: TFactory Flyweight: TTitle_book
Integration Layer (EntityManager,…)
TopLink Gof and Sun Patterns: Domain Store Transfer Object Facade (XXXController) Factory
SessionBean1 Session Facade
Sun pattern
SessionBean1 Session Facade
Sun pattern
Object Model Gof Patterns: Facade: TFacade Factory: TFactory Flyweight: TTitle_book
Integration Layer (EntityManager,…)
TopLink Gof and Sun Patterns: Domain Store Transfer Object Facade (XXXController) Factory
Object Model Gof Patterns: Facade: TFacade
Factory: TFactory Flyweight: TTitle_book
Integration Layer (EntityManager,…)
TopLink Gof and Sun Patterns: Domain Store Transfer Object Facade (XXXController) Factory
Resource
Tier
Integration
Tier
Business
Tier
Presentation
Tier
Client
Tier
Architecture of web application based on
synchronization data by databases (2)
• many clients of the Client Tier as the www pages
• many JSF pages of the Presentation Tier – each client has ownpages
• many Session Facade Components of the Business Tier(SessionBean1) as remote facades of the Business Service Subtier (Java Application project) based on the POJO objects –each client has own SessionBean1 and the own Business Service Subtier
• own Domain Store Components of the Integration Tier
Applicat ionBean1 Application Service
Sun pattern
SessionBean1
Session Facade
Sun pattern
JSF Page JSF Page JSF Page
Client1 Client2 C lient3
Data Base
Library Directory
Object Model Gof Patterns:
Facade: TFacade Factory: TFactory Flyweight: TTitle_book
Integration Layer (EntityManager,…) TopLink Gof and Sun Patterns: Domain Store Transfer Object
Facade (XXXController) Factory
SessionBean1
Session Facade
Sun pattern
SessionBean1
Session Facade
Sun pattern
Resource
Tier
Integration
Tier
Business
Tier
Presentation
Tier
Client
Tier
Example of the architecture of web application based on
synchronization data by application (1)
Architecture of web application based on
synchronization data by application (2)
• many clients of the Client Tier as the www pages
• many JSF pages of the Presentation Tier – each client has ownpages
• common Application Service Component of the Business Tier(ApplicationBean1) as the remote facade of the Business Service Subtier (Java Application project) based on the POJO objects – each client uses the common ApplicationBean1
• common Domain Store Components of the Integration Tier
Example of multiered web application
1. Two examples of architectures of the multitiered
application as the Visual Web Java Server Pages
applications
2. The Visual Web Java Server Pages application
based on synchronization datas by application
2.1. Structure of project
Integration
Tier:
Facades of
Domain Store
Business Tier:
Business
Service Subtier
as Application
Service with
Object model
Presentation
Tier:
JSF pages
Business Tier:
Application
Service
Presentation
Tier
Business Tier:
Session Façade
Application Service
Classes of
Presentation Tier
Business Tier
Integration Tier
Example of multitiered web application
1. Two examples of architectures of the multitiered
application as the Visual Web Java Server Pages
applications
2. The Visual Web Java Server Pages application
based on synchronization datas by application
2.1. Structure of project
2.2. Business Service Subtier
Classes
of
Business
Service
Subtier
Facade of
Business Service Subtier
as POJO class (1):
business logic methods
of subtier
Facade of
Business Service Subtier
as POJO class (2):
business logic methods of
subtier
Facade of
Business Service Subtier
as POJO class (3):
summarization of business logic
Example of Entity class from
Object Model of
Business Service Subtier (1):
Persistence Annotation
Example of Entity class from
Object Model of
Business Service Subtier (2):
business logic methods
Example of multitiered web application
1. Two examples of architectures of the multitiered
application as the Visual Web Java Server Pages
applications
2. The Visual Web Java Server Pages application
based on synchronization datas by application
2.1. Structure of project
2.2. Business Service Subtier
2.3. Application Service of Business Tier
binding data
of JSF
Component
remote method for methods of
Business Service Subtier
Example of multitiered web application
1. Two examples of architectures of the multitiered
application as the Visual Web Java Server Pages
applications
2. The Visual Web Java Server Pages application
based on synchronization datas by application
2.1. Structure of project
2.2. Business Service Subtier
2.3. Application Service of Business Tier
2.4. Integration Tier
Example of
Controller class as
Facade of
Integration Tier
Tables generated from
Entities of Object Model of
Business Service Subtier by
Domain Store Components of
Integration Tier
Example of multiered web application
1. Two examples of architectures of the multitieredapplication as the Visual Web Java Server Pages applications
2. The Visual Web Java Server Pages applicationbased on synchronization datas by application
2.1. Structure of project
2.2. Business Service Subtier
2.3. Application Service of Business Tier
2.4. Integration Tier
2.5. Presentation Tier
Links to other pages of web
application
addtitle_action
Method of event: the click of
the addtitle button
Method of www response
Methods the FragmentBox
Component as the subview
of the Titles form view
storetitle_action
Method of event: the click of
the storetitle button
Method of www response