Agilni Pristup, SOA, Komponente

download Agilni Pristup, SOA, Komponente

of 35

Transcript of Agilni Pristup, SOA, Komponente

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    1/35

    Agilni pristup razvoju softvera

    Servisno orijentisane arhitekture i

    komponentni dizajn softveraBranko Marovi

    ETF/RCUB

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    2/35

    Trendovi

    Programiranje Strukturno

    Objektno

    Servisno

    Programiranje?

    Vizuelne komponente MDA

    Workflow na raznim nivoima (forma, tok interakcije, aplikacija, poslovni sistem)

    Grafiki editori, kutijice i veze (properties, bindings, XML konfiguracije ianotacije...)

    Razvoj ili prilagoavanje kroz konfiguraciju

    Integracija servisa i komponenti

    Tenja da se razvoj vri kroz komponente i kastomizaciju i integracijupostojeih reenja Legacy aplikacije

    Razvijajue trite komponenti

    Open Source biblioteke i moduli

    Postojei veliki komponentni proizvodi koji pokrivaju cele oblasti poslovanja

    Agilne metodologije indukovane zahtevima za brzim reenjima i Open

    Source pokretom

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    3/35

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    4/35

    Agile Methodologies

    Reaction against heavyweight

    methodologies

    The crushing weight of corporate bureaucracyThe rapid pace of information technology

    change

    The dehumanizingof detailed plan-driven

    developmentEvolved from the mid 1990s

    Originally called lightweight methodologies

    Sounds not serious/robust enough

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    5/35

    Agile Methodologies Common

    Principles Produce the first delivery in weeks, to achieve an early win and rapidfeedback

    The art of maximizing the amount of work not done is essential

    Invent simple solutions, so there is less to change and making thosechanges is easier

    Improve design quality continually, making the next iteration less costlyto implement

    est constantly, for earlier, less expensive, defect detection.

    Continuous attention to technical excellence and good design enhancesagility.

    People matter

    Less documentation is possible

    Communication is a critical issue - business people and developersmust work together daily throughout the project

    Modeling tools are not as useful as usually thought

    Working software is the primary measure of progress

    Big up-front design is not required

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    6/35

    Agile Methodologies

    eXtreme Programming (XP)

    SCRUM

    Dynamic Systems Development Method(DSDM)

    Feature-Driven Development (FDD)

    Adaptive Software Development (ASD)

    Crystal Clear

    Agile Modeling

    ......

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    7/35

    Ongoing Debate

    Are we returning back to cowboy coding?

    Not really.

    Agile Methodologies do have disciplines.Criticism

    Hacker Interpretations

    responding to change over following a plan

    Great! Now I have a reason to avoid planning and tojust code up whatever comes next.

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    8/35

    Comparison

    Agile Methodologies

    in turbulent, highly-change environments

    emergent rather than prespecifiable

    need tightly coordinated teamwork

    are suitable for small teams (< 15 or 20 people)

    Plan-Driven Methodologies

    determined in advance

    including via prototyping

    remain relatively stable

    with change rates with

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    9/35

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    10/35

    What is SOA?

    a service?

    A repeatablebusiness task e.g.,check customer credit;

    open new account

    service orientedarchitecture (SOA)?

    An IT architecturalstyle that supports

    integrating yourbusiness as linked

    services

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    11/35

    SOA

    Services are most often designed to ignore the context in

    which they are used

    Value can be created by combining, i.e. composing

    services Non-proprietary service interfaces

    Implementation can be changed in ways that do not

    break all the service consumers

    Service consumer expresses intent Service providers define offers

    Need for mediation

    Typically, model oriented business logic is wrapped

    behind (web) services

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    12/35

    What is SOA?

    ERP/

    Legacy Apps

    Custom Apps

    & Services

    Web services

    WSDL/WSIF

    XML/XML Schema

    SOAP JCA JMS

    BUSINESS SERVICES

    Process FlowLogic

    XSLT/XQuery

    BPEL

    ORCHESTRATE

    Reduce friction, enhance visibility, thrive on change

    PORTAL JSR-168

    INTERACT/ACCESS

    Struts/JSF

    Portal

    Web Application

    API

    WS

    WS-Security

    GATEWAY

    SecurityReliabilityLoggingFailover

    Dynamic Routing

    WS-Policy, SAML

    Web Services Mgmt

    MonitoringOptimization

    BAM

    MONITOR & OPTIMIZE

    JMX

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    13/35

    Orchestrate ServicesOracle BPEL Process Manager

    Oracle BPEL PMOracle BPEL PM

    Credit RatingCredit Rating

    WSDLWSDL

    Service BusService Bus

    Star LoanStar Loan

    Order EntryOrder Entry United LoanUnited Loan

    AADDAAPPTT

    EERR

    AADDAAPPTT

    EERR

    WWSSDDLL

    FulfillmentFulfillment

    AADDAAPPTTEERR

    Application ServerApplication Server

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    14/35

    BPEL Orchestration by Example

    Select Lowest Offer

    10:00am

    Handle Negative

    Credit Exception

    Credit Rating

    start

    end

    BPEL Flow

    ?

    United Loan Star Loan

    Get Rating

    Send Loan Application

    Receive Loan Offer

    03:00pm

    Send Loan Application

    Receive Loan Offer

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    15/35

    Manage / Monitor Services

    Bus. ProcessBus. Process

    Enterprise Service BusEnterprise Service Bus

    WSIF & JBIWSIF & JBI

    In MemoryIn Memory RESTREST JCAJCA COM+COM+ SOAPSOAP

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    16/35

    Business Components

    ControllerController

    JSF/StrutsJSF/Struts

    ViewView

    JSF/JSPJSF/JSP

    ModelModel

    EJB 3.0EJB 3.0

    DeviceDevice

    RendererRenderer

    Enterprise JavaBeans 3.0

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    17/35

    Java Server Faces (JSF)Overview

    Developed through Java Community Processas JSR 127

    Goal: Simplify creation of Java Server GUIsBuilding user interfaces for web applications by

    assembling reuseable UIComponents in a page

    Event-driven component model

    Bind UIComponents to server-side data sources andevent listeners

    Inversion of Control container for JavaBeans

    supports developing applications for browsers thatcommunicate via HTTP to a Java application server

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    18/35

    JSF Architecture

    UIComponent is rendered

    through Renderer class

    Expression Language

    Value Binding is used toaccess managed bean

    also know as a "backing

    bean"

    Managed bean accesses

    J2EE persistence layer

    Renderer

    UI Component Expr. Language

    Managed beanJSF Page

    RDBMS

    J2EE Persistence Layer / JDBC

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    19/35

    JSF Architecture

    with ADF

    EL accesses bindings

    object to value bind UI

    components

    ADF bindings object isset through ADF Filter in

    web.xml

    Bindings object accesses

    ADF Binding container,

    which then accessesDataControl

    Business Services provide

    access to various data

    sources

    ADF bindings Object

    ADF Binding

    Renderer

    UI Component Expr. Language

    JSF Page

    RDBMS

    ADF DataControl

    Business

    Service 1

    Business

    Service 2

    Business

    Service 3

    XMLURL

    WS

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    20/35

    Drag-and-Drop Binding

    Data Control PaletteExpose any business

    service

    Available to any client

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    21/35

    Oracle ADF Faces

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    22/35

    What is JBoss Seam? Java EE 5 application framework for building web applications

    Lean integration of JSF and EJB eliminates the distinction between presentation tier components and

    business logic components

    Provides context management for different scopes:

    application, business process, session, conversation, and user request

    Intensive use of Java 5 annotations generated code does not separate concerns - e.g. business logic also

    determines next page to display

    Code reduction

    no JSF backing beans

    no code that shifts data forth and back between backing beans and

    application logic objects less XML configuration

    annotation-based context/state management

    No SOA

    Open source softwareJavaServer

    Faces

    Seam EJB 3.0

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    23/35

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    24/35

    (1)The EJB3 standard@Entity annotation indicates that the Userclass is an entity bean.

    (2)A Seam component needs a component name specified bythe@Name annotation. This name must be unique within theSeam application. When JSF asks Seam to resolve a contextvariable with a name that is the same as a Seam componentname, and the context variable is currently undefined (null),Seam will instantiate that component, and bind the newinstance to the context variable. In this case, Seam will

    instantiate a User the first time JSF encounters a variablenamed user.

    (3)Whenever Seam instantiates a component, it binds the newinstance to a context variable in the component's defaultcontext. The default context is specified using the@Scopeannotation. The User bean is a session scoped component.

    (4)The EJB standard@Table annotation indicates that the User

    class is mapped to the users table. (5)name, password and username are the persistent attributes of

    the entity bean. All of our persistent attributes define accessormethods. These are needed when this component is used by JSFin the render response and update model values phases.

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    25/35

    public User() {} (6)

    @NotNull@Length(min=5, max=15) (7)

    public String getPassword() { return password; }

    public void setPassword(String password) { this.password = password; }

    @NotNullpublic String getName() { return name; }

    public void setName(String name) { this.name = name;}

    @Id@NotNull@Length(min=5, max=15) (8)

    public String getUsername() { return username; }

    public void setUsername(String username) { this.username = username; }

    }

    User.java Cont

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    26/35

    (6)An empty constructor is both required by both

    the EJB specification and by Seam. (7)The@NotNull and@Length annotations are

    part of the Hibernate Validator framework.

    Seam integrates Hibernate Validator and lets

    you use it for data validation (even if you arenot using Hibernate for persistence).

    (8)The EJB standard @Id annotation indicates the

    primary key attribute of the entity bean.

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    27/35

    @Stateless (1)

    @Name("register")@Interceptors(SeamInterceptor.class) (2)

    public class RegisterAction implements Register {

    @In (3)

    @Valid (4)private User user;

    @PersistenceContext (5)private EntityManager em;

    @In privateFacesContext facesContext; (6)

    @IfInvalid(outcome=Outcome.REDISPLAY) (7)public String register() { (8)

    List existing = em.createQuery("select username ..

    RegistrationAction.java (Session Bean)

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    28/35

    (1)The EJB standard@Stateless annotation. (2)The SeamInterceptor EJB interceptor must be enabled for

    all session beans which are Seam components. (3)The@In annotation marks an attribute of the bean as

    injected by Seam. In this case, the attribute is injected from acontext variable named user (the instance variable name).

    (4)The@Valid annotation is provided by Hibernate Validator. (5)The EJB standard@PersistenceContext annotation. (6)Seam also allows various JSF, Seam and jBPM context

    objects to be injected. To get the current FacesContextinstance injected to a Seam component, just mark an instancevariable named facesContext with the@In annotation.

    (7)The@IfInvalid annotation tells Seam to validate thecomponent state using Hibernate Validator before invoking theaction listener method, and return a different JSF outcome ifthe state is invalid. In this example, the user is validated when

    the register() method is invoked, and the form is redisplayedwith messages if a validation failure occurs.

    (8)The action listener method uses the standard EJB3EntityManager API to interact with the database, and returns theJSF outcome. Note that, since this is a sesson bean, a transactionis automatically begun when the register() method is called, andcommitted when it completes.

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    29/35

    faces-config.xml

    success/registered.jsp

    org.jboss.seam.jsf.SeamPhaseListener

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    30/35

    View pages using JSP with JSF

    Register New User

    Username

    Real Name

    Password

    Successfully Registered New User

    Welcome,

    , you are successfully registered as

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    31/35

    Seam

    jboss-seam-registration.war

    /seam-registration

    jboss-seam-registration.jar

    This deployment descriptor links modules in the

    enterprise archive and binds the web applicationto the context root /seam-registration.

    We've now seen mostof the files in theapplication!

    application.xml

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    32/35

    How it works

    When the form is submitted, JSF asks Seam to resolve thevariable named user. Since there is no value already bound tothat name (in any Seam context), Seam instantiates the usercomponent, and returns the resulting User entity bean instance toJSF after storing it in the Seam session context. JSF binds theform input values to properties of the User entity bean.

    Next, JSF asks Seam to resolve the variable named register.Seam finds the RegisterAction stateless session bean in thestateless context and returns it. JSF invokes the register() actionlistener method.

    Seam intercepts the method call, injects the User entity from thesession context, and the current FacesContext instance, before

    asking Hibernate Validator to validate the session bean instance(and, recursively, the User entity bean instance). If the state isvalid, the invocation proceeds and the register() method is called.If not, Seam returns a null outcome and JSF redisplays the page.

    When JSF comes to render the next JSP page, it asks Seam toresolve the variable named user and uses property values of thereturned User entity from Seam's session scope.

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    33/35

    Sistem za obraun i naplatu

    elektrine energije

    Odabrana je tehnoloki napredna platforma

    troslojna arhitektura

    kompatibilna sa savremenim HW/SW

    Podaci analizirani i rastumaeni (procedureautomatske konverzije)

    normalizovani, preieni i delom rekonstruisani podaci

    Funkcionalnosti realizovane prema potrebama

    poslovnog procesa

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    34/35

    Tehnoloka platforma

    Database Oracle 10g (model podataka)Oracle je industijski standard

    Visokih performansi

    Zamenljiva!

    Oracle Application Server EJB 3.0 (poslovnalogika)Enterprise reenje

    Java transportabilno (J2EE standard)

    Klijent JSF/ADF (prezentaciono okruenje)Fleksibilan sloj za generisanje korisnikog interfejsaIntuitivno jednostavno okruenje za rad

  • 8/3/2019 Agilni Pristup, SOA, Komponente

    35/35

    ta ovo reenje treba da donose

    Osnov za napredne funkcionalnosti

    Web servisi (Aplikacioni server), veza sa SAP, GIS

    Dostupnost podataka

    Internet (zatita za Web pristup, potroai), Intranet

    Ubrzanje poslovnog procesa

    Posledice jednostavnije interakcije

    Maksimalno iskorienje raunarskih resursaSistemski podrana replikacija i pouzdanost podataka