Software Architecture & Design 6CCS3SAD Dr Kevin Lano

Software Architecture & Design 6CCS3SAD Dr Kevin Lano

Software Architecture & Design 6CCS3SAD Dr Kevin Lano Session 8: Sample Enterprise Platform Java Enterprise Edition March 6th, 2020 Learning Outcomes At the end of this session you should be able to: Explain the basis of Java Enterprise Edition; and Define Java EE architectures for enterprise information systems (EIS). 18/02/2016 3

This week A concrete component platform Java Enterprise Edition No programming, just architectural aspects Further enterprise styles (EIS patterns) 18/02/2016 4 Abstractions & Implementations Abstract Abstract view view (platform (platform independent, independent, written written in in UML2)

UML2) Abstract Abstract system system architecture architecture Domain-Specific Domain-Specific Models Models (platform (platform specific, specific, written written in in UML2 UML2 with with extra extra notation) notation)

Implementations Implementations Mobile Mobile platforms platforms 18/02/2016 OO: OO: simple simple Enterprise Enterprise middleware middleware architecture architecture Java:

Java: EJB, EJB, JMS, JMS, JSP JSP Safety Safety critical critical architecture architecture .NET: .NET: COM+, COM+, ASP ASP This This week

week CORBA CORBA Embedded Embedded system system architecture architecture C C 5 Enterprise Systems Business systems for large scale organizations Many users Integrate wide range of different workflows

Mission critical Involve money System failure can result in financial loss Need fault-tolerance, efficiency, scalability, trustworthiness, ... Often called Quality-of-Service (QoS) properties 18/02/2016 6 Application Servers Application servers assume an n-tiered style Application servers house business-logic components within a middle tier Other tiers need additional middleware 18/02/2016 ASP.NET or JSP (Presentation

tier) COM+ or EJB (Business logic tier) DB, NoSQL, ... (Data tier) 7 Enterprise System Architectures Typically 5 tiers: Client tier: UI components for direct interaction with clients Presentation tier: UI logic components & helpers Business tier: business functions and logical representations of business data Integration tier: components mediating

between business tier & data sources Resource tier: databases, web services, etc 11/02/2016 8 Typical EIS 5-tier architecture ClientUI ClientUI Controller Controller Session Session Bean Bean Data Data Access

Access Object Object 11/02/2016 Database Database Client tier View View ValueObject ValueObject WebService WebService Client Client

WebService WebService Presentation tier Business tier Integration tier Resource tier Example: EIS 5-tier architecture ClientSession ClientSession OnlineStoreFacade OnlineStoreFacade ProductVO ProductVO

Catalog Catalog Catalog Catalog Access Access 11/02/2016 Database Database Client tier Checkout Checkout Payment Payment Payment

Payment Management Management CreditCard CreditCard WebService WebService Presentation tier Business tier Integration tier Resource tier EIS architectures in more detail Client tier: display/receive information to/from user Transmit information to/from presentation tier

Can be web-based or other UI technology Typical components of this tier are HTML pages. 18/02/2016 11 EIS architectures in more detail Presentation tier: manages interaction with user Relays user requests to the business tier Typical components of this tier are controller and view components, such as servlets and JSPs. MVC pattern often used for UI interaction. Helper objects such as backing beans. 18/02/2016 12

EIS architectures in more detail Business tier: components implement business rules and data of the application. Typical components are session beans and entity beans. Value objects used to transfer data between this tier and others. 18/02/2016 13 EIS architectures in more detail Integration tier: mediates between business tier and resource tier Manages data retrieval, using interfaces such as JDBC. Contains data-access objects (DAOs) and

service activators. Insulates business and higher tiers from direct knowledge of how data is stored and retrieved. 18/02/2016 14 EIS architectures in more detail Resource tier: contains persistent data storage & other resources Databases; internal clouds, links to external services such as credit card authorisation services, business-to-business services, external clouds. 18/02/2016 15 Java Enterprise Edition

Extends Java standard edition 8 Defines facilities for distributed enterprise applications Web application facilities: Servlets, Java Server Pages (JSPs), Java Server Faces (JSF) Enterprise Java Beans (EJBs) express business logic of application Java Persistence API manages persistence of business data Web services: SOAP-based or RESTful 18/02/2016 16 Enterprise JavaBeans Session Beans Business functionality components Stateless, Statefull or Singleton Local or Remote interfaces for use by same or different JVM Message-driven Beans

Business objects driven by events (messages) Entity Beans Java classes with persistent data 18/02/2016 17 Enterprise JavaBeans Stateless Session Beans Business components dedicated to a single client Do not retain state between method calls Suitable for one-off operations Can be pooled in object pools Statefull Session Beans Also dedicated to single client, but retain state related

to that client Suitable for sessions involving sequence of operations as part of a workflow/interaction (eg., a shopping cart) 18/02/2016 18 Writing EJB Components A Java EE class is a EJB component if Annotated with @Stateless, @Stateful, @Singleton, @MessageDriven import import javax.ejb.Stateless; javax.ejb.Stateless; @Stateless @Stateless public public class class RegisterBean RegisterBean implements implements

// // Local Local or or remote remote interfaces interfaces {{ // // operations operations }} 18/02/2016 19 Entity bean example @Entity public class Student implements Serializable { @Id private String id; private String name; private Course course;

public Student() { } public Student(String nme, Course crse) { name = nme; course = crse; } @ManyToOne public Course getCourse() { return course; } public void setCourse(Course cx) { course = cx; } } 18/02/2016 20 Session bean example import javax.ejb.Stateless; @Stateless public class RegisterBean implements RegisterOps { @PersistenceContext private EntityManager em; public Student registerStudent(String sname, String cname) { Course crse = em.find(Course.class,cname); Student stud = new Student(sname,crse);

crse.getStudents().add(stud); em.persist(stud); return stud; } }18/02/2016 21 Session bean example EntityManager class synchronises entity and database data. Session bean can be used via remote interface: import javax.ejb.Remote; @Remote public interface RegisterOps { public Student registerStudent(String sname, String cname); } 18/02/2016

22 Writing Java EE Components import import javax.ejb.Stateless; javax.ejb.Stateless; @Stateless @Stateless public public class class RegisterBean RegisterBean implements implements RegisterOps RegisterOps // // Local Local or or remote

remote interfaces interfaces {{ // // operations operations }} <> <> RegisterBean RegisterBean RegisterOps Stereotype Stereotype <> <> marks marks stateless stateless session session bean bean component

component 18/02/2016 23 Bank system EIS EIS for bank Staff interface supports operations to create a customer record, create accounts, link & unlink accounts from customers MVC pattern for presentation tier Business tier has session bean for staff operations, processes business data Presentation tier view receives value objects for this business data 18/02/2016 24 Bank system 5-tier architecture StaffUI

StaffUI StaffController StaffController Business tier <> <> StaffOps StaffOps Client tier StaffView StaffView Presentation tier CustomerVO CustomerVO

AccountVO AccountVO 11/02/2016 EIS Patterns Presentation tier: Intercepting Filter: defines pluggable filters for pre and post-processing of requests/responses, eg: for security checking. Front Controller: defines a single point of access, through which all requests pass. Enables centralised handling of authentication, etc View Helper: supports view components Composite View: composes a view out of parts (subviews). 18/02/2016 26 EIS Patterns

Business tier: Value Object: object for transferring business entity (entity bean) data between tiers Session Faade: hides complex interactions between business objects Service Locator: abstracts details of service/resource lookup. 18/02/2016 27 EIS Patterns Integration tier: Data Access Object: provides abstraction of data source access. Service Activator: implements asynchronous processing of service components. Already seen Front Controller, View Helper, Session Faade, Value Object. 18/02/2016

28 Intercepting Filter Provides flexible and configurable means to add filtering, pre and post processing, to request handling. Client requests are checked before being processed, eg: is client's IP address from a trusted network? Does client have a valid session? Is client's browser supported by the application? Pattern uses chain of filters to carry out successive tests. (Cf: Chain of Responsibility design pattern). 18/02/2016 29 Intercepting Filter Client

Component Filter1 Client Tier Filter2 Filter3 Presentation Tier Application entry point 18/02/2016 30 Intercepting Filter: example Web Client

Host Verification Client Tier Request Verification Session Validation <> Customer Operations 18/02/2016 Presentation Tier

Business Tier 31 Data Access Object Abstracts from details of particular data technologies, hiding these from business layer. The variety of different APIs used for persistent data (JDBC, JSON, XML, B2B services, etc) makes it difficult to migrate a system if these are invoked directly from business objects. Pattern decouples business tier from data storage, DAO interacts with data sources instead. 18/02/2016 32 Data Access Object

Business Component Value Object Data Access Object Business Tier Integration Tier Resource Tier Data source/ Resource 18/02/2016 33

DAO example <> CustomerVO StaffOps AccountVO Business Tier Integration Tier BankDAO Resource Tier Bank Database 18/02/2016

34 Service Activator Provides means to access synchronous services via asynchronous calls. Application needs to carry out processing with computationally expensive services (internal or external), which should be executed in background Pattern decouples service execution from business tier, manages the interaction with the services. 18/02/2016 35 Service Activator Business Component

Business Tier <> <> Service Activator <> Service1 18/02/2016 Integration Tier Service2 Resource Tier

36 Coming Up Mobile Application Architectures Clouds, Services, Microservices, SOA 18/02/2016 37

Recently Viewed Presentations

  • The Collective Mind Organizational Change Management and Communications

    The Collective Mind Organizational Change Management and Communications

    Jana Markowitz PMI Memphis PDD 2013 ... (see "listening and adapting" in first bullet) Some external customers and suppliers may need to know what is changing too Some communication must be face-to-face because everyone knows important messages are delivered in...
  • Physics 322: Introduction to Special Relativity  Motivation:  Michelson-Morley

    Physics 322: Introduction to Special Relativity Motivation: Michelson-Morley

    In 1676 Ole Roemer first determined the speed of light (how can this be done with 17'th cent equipment. ... General Relativity predicts that space itself originated at the Big Bang The Big Bang The Big Bang Model of the...
  • ALVIN HIGH SCHOOL SENIOR CLASS of 2018 PARENT/STUDENT INFORMATION

    ALVIN HIGH SCHOOL SENIOR CLASS of 2018 PARENT/STUDENT INFORMATION

    -Order at Balfour.com or LK129 -Contact [email protected] ... If you have taken English Dual Credit, and/or successfully passed TSI or met the SAT/ACT exemption, you do not need any additional testing in Reading or Writing.
  • Venus de Milo

    Venus de Milo

    Georges Sorel - Marxism is a religion; democracy is bad. Existentialism - stressed meaninglessness of existence. Moral values found in yourself. Jean-Paul Sartre. Albert Camus (The Stranger) Soren Kierkegaard - impossible to prove God - takes a leap of faith....
  • Snort &amp; ACID - Del Mar College

    Snort & ACID - Del Mar College

    The System Architecture consists of these main parts: Sniffer "Promiscuous Mode" NIC Preprocessor frag2, stream4, http_decode Detection Engine Using Rules Logging and Alerting plugins log mysql, alert smb Packets on the wire Snort Detection Process Records in a SQL db...
  • bazinga! improves condo living WINDOWS AZURE CSV: bazinga!

    bazinga! improves condo living WINDOWS AZURE CSV: bazinga!

    WINDOWS AZURE CSV: . bazinga! Technologies. WEB SITE: www.mybazinga.com. LOCATION: Vancouver, Canada. ORG SIZE: Small. INDUSTRY:Residential Real Estate
  • IRBs: What&#x27;s the Problem and What&#x27;s the Solution

    IRBs: What's the Problem and What's the Solution

    IRB member with conflicting interest [45 CFR 46.107(e)] Inappropriate use of expedited review for initial or continuing review [45 CFR 46.110(b)(1)] ... University of Florida. Columbia University. Miriam Hospital. Cleveland Clinic Foundation. University of Wisconsin, Madison.
  • Getting to Work with Ventures! Promoting Success for

    Getting to Work with Ventures! Promoting Success for

    Agenda. 4. Best Teaching Practices - Tips & Techniques. The Multilevel Classroom / Classroom Management. Teacher as Facilitator / Instructional Strategies. 5. The Six-Step Lesson Plan: Ventures, 2nd Edition. 6. Working with the . Ventures. Series: Walk Through Teacher's Edition,...