• Aucun résultat trouvé

Modeling of Services and Service Collaboration in UML 2.0

N/A
N/A
Protected

Academic year: 2022

Partager "Modeling of Services and Service Collaboration in UML 2.0"

Copied!
8
0
0

Texte intégral

(1)

Modeling of Services and Service Collaboratron i n U M L 2 . O

Pctr Wciss and Jaroslav Zcndulka

Dcpt. of Information Systcms, Faculty of Inforrnatiorr Technology, Brno Univcrsity of Technology, BoZetdchova I, 6\2 66 Brno, Czech Republic

{ w e i s s , z e n d u l k a } 0 f i t . v u t b r . c z

Abstract. One of many definitions of Service-Oriented Architecture (SOA) says that SOA is an architectural style for building next-generation distributed information systems. If wc want to get a reliable arrd good working system, it must be well designed first. This paper deals with Scrvice-Oriented Architecture Design (SOAD), especially with modeling of scrviccs. F\rrthermore, abstraction layers of SOA are introduced and possiblc using of object oriented approach on each layer is discussed in this paper. Besides, three types of service collaboration are prcscntcd.

The rnain objective of the paper is to dernonstrate how thesc typcs of collaboration can bc dcscribed in UML 2.0.

Keywords: Scrvicc-Orientcd Architecturc, Service-Orierrted Architec- ture Desigrr, Service Co-operation, service, cornponent.

Introduction

Although service-oriented architecture is not a new concept in the area of dis- tributcd softwarc architccturcs, it comes to the forc in rcccnt ycars thanks to modern technical solutions, e.g. well-defined communication networks and mod- eling disciplincs. SOA irnplementatiorr rarely starts on the green field. That mcans creating a SOA solution is almost based on integrating existing systems by decomposing thcm into scrviccs, business processes, and business rules. As a consequence, the SOAD is composition of well-established practices such as Object-Oricntcd Analyse and Design (OOAD), Enterprise Architecture Design (EAD), Business Proccss Modcling (BPM) and some other innovative elements.

Thc idcas presented in this paper are a part of a greater project, which dcals with a methodology for SOA systems modcling. More precisely, the methodology is aimcd at building models of inner-entcrprisc scrviccs and modcls of collabo- rations of such services . Inputs for thc mcthodology are elements generated by decomposition of lcgacy (nonSOA) systems. For the decomposition an appro- priate method (c.g. SOMA [1]) is used. Another goal of the methodology is to firrd how to rrtake the inrrer.enterprise services accessible fbr consumers who stay outside of a given cntcrprisc.

This paper describes which object-oricntcd (OO) features and techniqucs can be used in SOAD and how UML can bc used for modeling of components, assembling componcnts into scrvices, services and a service collaboration.

(2)

2 Background

There is no 'standard' definition of SOA. In [5] SOA is presented as an approach for building distributed systems that deliver application functionality as serviccs to either end-user applications or other services.

An abstract view depicts SOA as a partially layered architecture. In this view, SOA consists of three layers: component layer, service layer and business process layer. There are two sections in parallel with these layers. They provide tools for integrating components to scrviccs and services to busincss processes and tools for monitoring and maintaining security and QoS of SOA applications.

Fig. 1. SOA as a partially layered architecture.

It is evident that the key element of SOA is a seru'ice. Each service is a com- position of collaborating cornponents. Components are responsible for providing service's functionality and maintaining the quality of service.

Services are looselv coupled software entit,ies wit;h well-defined, published i.nterf aces. Thc scrvicc interface separates provided functionality from its implc- mentation (services are implementation-indcpendcnt) and forms so-called service dcscription. The service description is available for searching, dynamic binding and invocation of a given service by a service consumer. The communication between services is bascd on rrlessage sendi,ng.

On a higher abstraction level, scrviccs can be asscmbled into a busi,ness processes. In SOA terms, a business process consists of a series of operations which are executed in an ordcrcd scqucncc according to a set of busincss rules.

The process of sequencing, selcction, and cxccution of busincss rules is referred to as serui,ce choreographg. Typically, choreographed services are invoked in order to respond to busincss events.

More information about SOA principles can be found in [5] and [ ].

Object-oriented analysis and dcsign (OOAD) is an approach in which a sys- tcm is modcled as a collection of classes. The system behavior is achieved by

Business process Business process layer

D

p

a

@ O C

=.

.

lo

=

o

=. =

(3)

Modeling of Services and Service Collaboration in UML 2.0 3l collaboration of instances (objccts) of these classes, and the state of the system is thc combined state of all the objccts in it. Collaboration among objects is achicvcd by scnding messages. Since SOA is a new paradigm and services and obiects are two different concepts, the question is "Could OOAD or a part of OOAD bc used in SOAD?" The following paragraph discusses which OO fca- tures and techniqucs [8] can be used in SOAD. As mentioned in Introduction, this papcr dcals only with components and services. Conscqucntly, using OO at the busincss process layer is not described.

- Inf ormation hi,di,ng: SOA services are for scrvicc consumers black boxes with well-defined interf'aces. The goal is to separate what service does (its interface) from how it does it (its implemcntation). From the services point of view, components arc also black boxes. Services have only information about components intcrfaccs and route requests (for a scrvice) from a consumer to subordinate components.

- Messaging is the fundamental communication model for components and scrvices in SOA.

- Inheri,tance car' only be considered on a specification level of component and service modcling.

- Polymorphi.sm dcscribes the situation where the result (of a behavior) de- pends on the class of an objcct the behavior of which is invoked. In other words, two or more classes accept the same message, but respond on it differ- cntly. The possible use of polymorphism in SOAD is similar to inheritance.

- Classes and instances: Classes are templates for crcating instances (ob- jects). From SOA point of view, this concept can be applicd to both compo- nents and scrvices.

- Encapsulat'ion: A service encapsulates the state and bchavior of a number of components.

It results from the previous paragraph that except inheritance and polymorphism thc underlying OO features can bc used in SOA for modeling of components or scrvices. It should be pointed out that all OO featurcs including inheritance and polymorphism can be used for modeling thc inner structure of components.

3 Three Types of Collaboration among Services

To model collaborations of services inside an enterprisc, it is useful to distin- guish severai categorics of collaborations. Each category is defined by a set of communication rules (a protocol) and by the purposc of the collaboration. The categories are following:

- Thc Seruice Co - operati,on describes a collaboration of services, in which one service has to use another service(s) to fulfil incoming requests.

- The Seru'ice Aggregati,on is a set of rulcs which defines how to create a new service from two (or morc) existing serviccs. The new service provides combined functionality of its building services.

(4)

- The Seru'ice Choreography is such collaboration of serviccs that supports business process.

The basic concept of service co-operation modeling is explaincd latter in this paper. More about service choreography can be found in [5], [4] and [2], the scrvice aggrcgation is objcct of futurc research.

4 Using UML in SOAD

As mcntioned bcfore, object-oriented technology and languages are great ways to design and irrrplement courponents. Unified Modeling Language (UML) is a specification language fbr object modeling. Since there exists a relationship bctween OO and SOAD (described in scction 2), UML can be used in SOAD.

UML providcs extension mechanisms (stereotypes, tagged values, constraints) which cnable to model services. This chaptcr describes thc use of UML 2.0 [10] for modeling components, scrvices and scrvice collaboration. Furthermore, stercotypes for modeling SOA components and serviccs are presented.

4.L Models of Components and Services

In this papcr, we use a simple example of co-opcrating services to demonstrate the use of the proposcd modeling techniques. We assume two collaborating ser- vices: Smath and Splus. Smath offers calculation of some mathematical opera- tions, but in fact it docs not perform the opcration. It collaborates with other scrvices. Wc consider only one operation hcrc the sum. The service that really performs it is rcferred to as Splus. A part of this example is shown in Figure 2.

The figure depicts a model of Smath. The structure of this model is explained in the following paragraph.

A servicc is modcled as a stereotype service , which is derived from the clement component of the UML. Therc are two possible abstract views of a service - an cxternal and internal one. The internal view (or "white-box" view) shows how the extcrnal behavior is realized internally. In this case, the inner structure depicts how component instances arc interconnected to providc the required functionality. An example of this view is shown in Figure 2 . This level is used only for components interconnection modeling inside a service. The other abstract vicw, the extcrnal view (or "black-box" view), is used to model serviccs in scrvice collaboration. It hides the inner structure (implementation) of services.

The mapping between the internal and external view is by means of a delegation connector . It is reprcsented by a port and an UML predefined-stereotype of dependcncy detegate The port is shown as a small square symbol on the boundary of the symbol denoting a service.

A port delegatcs to a set of subordinate components (and vice versa ). At cxecution time, signals will bc delivered to the appropriate instance. In thc cases whcre multiplc target instances support the handling of the same signal, the signal will be delivcred to all these subordinate instances.

(5)

Modeling of Services and Service Collaboration in UML 2.0 33 Component modeling is easy, bccause UML provides a modeling element component (a subclass of Class in the UML metamodel). A component is a self contained unit that is ablc to intcract with its environment through its provided and requircd interf aces (Classif iers in the UML metamodcl). A component can be rcplacecl at run-tirne by a componcnt that offers equivalent functionality based on intcrface compatibility. Components are modeled as "black-boxes".

Fig.2. A Scrvice diagram - internal view of Smath. Notation: Irnath.p is thc providcd interfacc of the scrvice Smath, Imath.r is the required interface of Snath.

4.2 Co-operatingServices

Co-opcrating services have following properties:

- service can receivc infinite number of incoming messages - incomming requests are qucued up into thc input queue - request processing and communication are processed in parallel - thc service description of each co-opcrating scrvice is known

Following two sections introducc fundamcntals of static and dynamic mod- eling of servicc co-opcration. Since we focus on modeling services inside an en- terprise, we assume services with fine-grained interfaces.

4.3 Static Models of Co-operating Services

In gcneral, cach servicc can provide its functionality to other services and it can also rcquire somc functionality from other scrvices. The formcr role of the service is rcfcrred to as a "servicc providcr" and the latter one as a "service consumer').

Because cach service can play both roles, it should realize a provided interfacc of thc scrvice provider and has a rcquired intcrface of the scrvice provider. In

h{trJn.p | | lc*urrtr

,"T"*

,

| <<component>>

I

| :ccheck

I

(6)

addition, sincc the communication of the serviccs is asynchronous, our model is based on thc Observer pattern [6].

Figure 3 depicts a static model of co-operating services Snath and Splus.

Here, the servicc Snath plays the role of a service consumer and thc scrvice Splus plays the rolc of a servicc provider. Both services realize intcrfaces: IProvider and fConsumer. IProvider contains a mcthod attach(service). Using this method, a servicc consumer registers at the servicc provider. The registration also includes a service requcst, which is representcd as a service parametcr of thc attachO operation in the model. Such requests arc queued. It is modeled by mcans of aggregation with the service provider being an aggregate. As soon as the service provider completcs the requcst processing, a method notifyConsumero sends a messagc with the result to the service consumer. The corresponding operation in the model is setResult(servicerslt).

-i- -

I

theConsumer- > set Result(servicersft )

r---l---r

| <<servtce>>

|

|

=o'*

|

Fig.3. A rnodel of co-opcrating serviccs (Service diagram - external view).

4.4 Dynamic Models of Co-operating Services

If we want to model scrvice-to-servicc connection during service co-operation, we can not usc the approach we used to model components composition inside a servicc (section 4.1). Components are assembled into services in advance in design time. On the other hand, services can be discovered and are bound dy- namically. Consequently, we can model service co-operation only by means of UML behavioral models, namely state machinc and interaction diagrams. We have chosen a sequence diagram to model communication of services. Since the rnodeled entities are services, thc diagram have to fulfill the fbllowing restrictions:

- Lifelines are scrvices.

- All messages among scrvices are asynchronous.

(7)

Modeling of Services and Service Collaboration in UML 2.0 3 5 Thc second rcstriction cnsures that a sender does not wait for a rcplay (after a rcquest was sent) and the sender can acccpt anothcr incoming messages or proccss stored requcsts (replics). Figurc 4 shows communication of services Smath and Splus from Figurc 3.

5ervice Communicdtion

X a

' atlach(service)

atlach (service)

notifyConsumer0 set Result(servicersft )

notityConsumer0

Fig.4. A Scquence diagram. This diagram shows dctails of commurrication between Snath and Splus.

5 Conclusion and F\rture Work

This paper briefly discusses the use of object-oriented approach in SOAD. It is shown that information hiding, messaging, classes and instances, and cncapsula- tion arc concepts that can be used in SOAD. In addition, they are supported by UML. Thereforc, UML was chosen as a modeling languagc for components, ser- vices and servicc co-operation. UML providcs well-defined diagrams for modeling composition of componcnts inside a service and for modeling collaborations of serviccs including thcir communication. The future work will focus on improvc- mcnt and extension of the approach mentioned above, especially on creating a meta-model of servicc co-operation and service aggregation that will enablc to develop more advanccd and sophisticated models. In addition, it would be uscful to create some vcrification methods for created models .

Th'is research has been supported bg the Grant Agencg of Czech Republ'ic arants No. 102/05/0723 "A Framework for Formal Speci,ficati,ons and Prototypi'ng of

(8)

- L .

2 .

3 . 4 .

Informati,on System's Network Appli,cati,ons" and by the Research Plan No. MSM 0 0 2 1 6 3 0 5 28 " S ecuri,ty- Ori,ented Res earch i,n Informati,on Technologg " .

References

r r .

6 .

Arsanjani, A.: Service-orierrted rnodeling and architecturc. Document is avail- able on URL http: llwww-728.ibm.com/developerworks/wcbservices/library/ws- soa-dcsignl/

Bcnatallah, B., Dijkman, R., Dumas, M. and Maamar, Z.: Service Composition:

Conccpts, Techniqucs, Tools, and tcnds. In Stojanovic, Z. and Dahanayake, A.

(Eds): Scrvicc-Oricntcd Softwarc Systcm Enginccring. Idea Group (2005), ISBN r - 5 9 1 4 0 - 4 2 6 - 6 .

Booch, G., Rumbaugh, J., Jacobson, L: Unified Modeling Language User Guide.

Addison-Wesley (1999), ISBN 0-201-57168-1

Endrci, M., et al.: Patterns: Scrvice-Orientcd Architccture and Web Ser- vices. IBM Redbooks (2004), ISBN 0-738-45317-X. Also available at URL:

http : / /vuut. redbooks . ibn. coro,/redbooks/pdf s/ sg246303 . pdf (February 2006) Erl, T.: Service-Oriented Architecture: Concepts, Technology, and Design. Prentice H a l l P T R ( 2 0 0 5 ) , I S B N 0 - 1 3 - 1 8 5 8 5 8 - 0

Gamma, E. et al.: Design Patterns: Elemcnts of Rcusablc Object-Oriented Soft- ware. Addison-Weslcy Profcssional Computing Series (1995), ISBN-10: 0201633612 Heckel, R., Lohmann M., Thone, S.: Towards a UML Profile for Service-Oriented Architecturcs. Documcnt is availablc on URL ttp: / / citeseer. ist . psu. edu/heckel03towards . html (April 2006)

Jacobson, I.: Object-oriented software enginecring, A Use-Case Driven Approach.

A C M P r c s s ( 1 9 9 2 ) , I S B N 0 - 2 0 1 - 5 4 4 3 5 - 0

Johnston, S.: IIML 2.0 Profilc for Software Services. Docurnent is availablc orr URL http : / / vlr:;r - I28. ibn . con/developerworks /rat ional/ l- ibr ary / 05 / 4I9- soa/

(February 2006)

Unified Modelirrg Language - UML 2 Superstructure. Docurnent is available on URL http: / /wvu. ong. orgltechnology/documents/formal/un1.htn (Febru- ary 2006)

7

8 . 9 .

1 0 .

Références

Documents relatifs

We describe entities and relationships relevant for the description of addi- ction within the Mental Functioning Ontology, Chemical Entities of Biological Interest Ontology,

From the point of view of this workshop, the most important balance is be- tween giving freedom of action to the learner, which recognises the importance of students’ autonomy

En este caso, es decir, para la generación de contenidos median- te la colaboración entre profesores de secundaria, hay muchos obstáculos a superar antes de que el modelo

That is what happens in quasi- belief, according to Sperber: the representation which is embedded in a validating meta- representation ('Lacan says that...' or 'The teacher

(L to R) Howard Chodos, MHCC Special Advisor, Mental Health Strategy for Canada; Mary Bartram, MHCC Senior Advisor, Government Relations, Mental Health Strategy for Canada;

We prove a theorem concerning the quotient structure that parallels the gener- alized dual girth conjecture proved in [1] and the Holmes–Thompson dual volumes theorem [6], which in

Two months later sitting on the street at night she was begging for money with her boyfriend I gave them five dollars. but they didn’t recognize me or thank me for the money which

The latest studies, which exam- ined the cases of thousands of women exposed to metronidazole during pregnancy, including a Medicaid cohort study, a large case- control study, and