
InternetInternet EngineeringEngineering TomaszTomasz BabczyBabczy ńński,ski, ZofiaZofia KruczkiewiczKruczkiewicz TomaszTomasz KubikKubik InformationInformation systemssystems modellingmodelling –– UMLUML andand serviceservice descriptiondescription languageslanguages Design patterns used to build the Business Tier D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns 1. A definition of the Business Tier – a five-tiered model of logical separation of tasks 2. Basic Business Tier design issues 3. Bad practices when designing the Business Tier 4. Analysis of basic design issues Design patterns used to build the Business Tier D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns 1. The definition of the Business 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 Interacting with the user, device and user interface Customer applications, applets, elements of presentation the graphical user interface Presentation Tier Login, session management, content creation and delivery, JSP Pages, servlets, and other user form atting and validation interface elements Business Tier Business logic, transactions, EJB components and other business data and services objects Integration Tier Resource adapters, external systems, mechanisms for JMS, JDBC, connectors and connections resource, control flow with external systems Resource Tier Resources, data and external Databases, external systems and other services resources Business Tier (Tutorial Java EE 5) Application Client Web Browser, And Optional Web Pages, JavaBeans Applets, and Client Tier Components Optional JavaBeans Components JavaBeens Web Pages Components Servlets Web Tier (Optional) Java EE Java Persistence Entities Business Tier Server Session Beans Message-Driven Beans Database and EIS Tier Legacy Systems Design patterns used to build the Business Tier D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns 1. The definition of the Business Tier – a five- tiered model of logical separation of tasks 2. Basic Business Tier design issues Basic issues of Business Tier design 1. Using session components 2. Use of Entity components 3. Caching references and handles to remote enterprise bean components Using session components (1) The session component (EJB specification) is characterized as follows: • It is used by one customer or user • There is only for the duration of the session • It is destroyed during the failure of container • It is not a permanent object • There is a time limit of its life • It may participate in transactions • It can be used to modelling communication such as stateful or stateless between the Client and Business Tier components Using session components (2) – Component stateless session: • Do not store customer session data • Can be allocated any instance of the stateless session component for each customer from a pool of stateless session components • They are used in case of a service that requires only one method call – Component stateful session: • Stores session state • Components are returned into a pool of session stateful component only when the client has completed its session • If the service requires a number of method calls to complete the transaction, which is a conversational process. This choice improves the scalability of the system Using session components (3) • Storing session state: – Web Applications store the session state of clients in the Presentation Tier – Applications, with different types of clients, are keeping the session state in the Business Tier • Managing session state is dependent on: – Hardware – Network Traffic Management – The use of clustering for Web container – The use of clusters for the EJB container – Linking client session to a particular server in the cluster – Session Replication – Session Persistence Using Entity components – EJB specification (1) • Entity components are distributed, shared and persistent transactional objects, which work inside EJB containers • Entity components are used as the data of some business services • EJB containers provide additional infrastructure to support scalability, security, performance, clustering • Specification of Entity components (EJB specification): – They represent an object-oriented view of life – They participate in transactions – They are shared by multiple users – They have a long life – They are resistant to a failure of the container. This type of system crashes are usually invisible to customers Using Entity components – EJB specification (2) The Entity component must contain the business logic associated with the providing of services, which is self-sufficient in terms of handling their own data and data objects belonging to the dependent objects (POJO objects) . Keys in Entity components (for databases services): • A complex primary key requires a definition of class that implements the Serializable interface. Attributes of this class are the key attributes of the main complex key • The primary key class must redefine the hashCode and equals methods • If the primary key consists of a single attribute, then you can use the built-in type of the key Design patterns used to build the Business Tier D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns 1. The definition of the Business Tier – a five- tiered model of logical separation of tasks 2. Basic Business Tier design issues 3. Bad practices when designing the Business Tier Bad practices (1) • Mapping an object model directly on the model of Entity components – Impact: • Large container load • Generating high traffic – Solution: • Reducing the number of components - an application of the Composite Entity pattern • Creating a tier of access to services - the use of the Session Facade pattern Bad practices (2) • Mapping the relational model directly on the model of Entity components – Impact: • Large number of Entity components • Complex relalationships between Entity components – Solution: • Reducing the number of components - an application of the Composite Entity pattern • Moving the business logic to the Seession components - the use of the Session Facade pattern Bad practices (3) • Mapping each use case at a one session component – Effects • A large number of session components - high complexity applications – Solution • Session Facade pattern • Sharing all the attributes of components by the method of setting and collecting: set and get – Impact: • Large network traffic – Solution: • Transfer Object pattern Bad practices (4) • The client stores data of business components – Impact: • Large network traffic • Dependence on the model of client applications • Difficulties in modifying the software – Solution: • Transfer Object Assembler pattern • Embedding search services on the client side – Impact: • Visualization of the complexity of an application to the client • Redundant code - in case of changes to modify the code in many places in the application – Solution: • Business Delegate pattern • Locator Service pattern Other bad practices (5) • The use of components of the Entity as read-only objects • Using the Entity objects as a minor component • Saving an entire graph of related Entity components • Disclosure of the exceptions relating to EJB to customers outside the EJB Tier • Stateless session component restores session state for each call • Searching data using the methods, that return references to remote objects Design patterns used to build the Business Tier D.Alur, J.Crupi, D. Malks, Core J2EE. Desin Patterns 1. The definition of the Business Tier – a five- tiered model of logical separation of tasks 2. Basic Business Tier design issues 3. Bad practices when designing the Business Tier 4. Analysis of basic design issues Design cases 1. Conceal from the client program the complexity of remote communication with business service component 2. Transparent and uniform way to search services and business components 3. Sharing components and business services to remote clients (take control of the business objects and reducing network traffic, or improve efficiency) 4. Centralization of some business logic components and business services 5. The object model is an implementation of the conceptual model, which is the domain model, containing relationships and business logic 6. Use of Entity components to implement the conceptual domain model 7. Transferring data between tiers of application (reducing network traffic by reducing the number of remote calls, or improve efficiency) 8. Making lists of objects for remote clients applications Problem 1 – Conceal from the client program the complexity of remote communication with business service component Servlets and JSP with Session Logic of Data presentation logic Acc es Component with and: many searches business logic of and calls of business s ervices services, error services of other layers ect C lien t Se ssion Code of S er vlets, Co m po n en t Data Access D atabase JS P Client Tie r Presentation Inte gration R eso ur ce B u sine ss Tier Tie r Tie r T ier Servlets and JSP presentation Session Logic of Data logic and Business Delegate for Component with Ac ces separating layers but searches o f business logic of business services services C lient C ode of Data Se rvlets , B u sin ess Session Datab ase Acce ss Component JS P Deleg ate 1 Client T ier Presentation Integ ration B u sin ess R esourc e Tier Tier Tier T ier Refactorization by using Business Delegate component Session Entity Business Session Entity Component Component Delegate 1 Component Component 1 1
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages59 Page
-
File Size-