Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew...

50
Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    0

Transcript of Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew...

Page 1: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

Business Process Execution Language (BPEL), its metrics and

Control Flow Graph (CFG)

by Esubalew Alemneh

Page 2: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

2

Contents1. Introduction to BPEL

– BPEL can’t work alone– BPEL process Structure – Benefits of BPEL

2. Metrics of BPEL– Size Metrics– Complexity Metrics

3. Static code Analysis – Scanner and Parser– Static code Analysis to calculate metrics– example

4. BPEL control flow graph

Page 3: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

3

Introduction

• Now a days the speed of internet is alarmingly increasing.

• In other hand huge numbers of web service applications are available distributed throughout the world.

• These applications can be composed to create new web service applications promoting reusability.

• BPEL is one of the means to do this. • Evolved from WSFL and XLANG;

Page 4: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

4

Introduction (cont’d)• BPEL (WSBPEL or BPEL4WS), is an XML-based web

service composition language for business processes.

• Web service composition refers to the creation of new web services by combination of existing ones[1].

• Web service is a software system designed to support interoperable machine-to-machine interaction over a network [15].

• A business process is a collection of related, structured activities or tasks that produce a specific service or product [15].

Page 5: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

5

Introduction (cont’d)• In other words we can say that BPEL is an

orchestration language. Web Service 1

Web Service 2

Web Service 3Web Service Orchestration Engine

Figure 1. BPEL is orchestration language

•Message exchange sequence is Controlled by the orchestration Designer.

Page 6: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

6

Introduction (cont’d)

• A BPEL process can be defined using the notion of abstract process and/or executable process.

• Abstract process is partially specified process that is not intended to be executed.

• Executable process are fully specified and thus can be executed.

Page 7: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

7

BPEL can’t work alone

• BPEL is layered on top of web service technology stack.

• It uses existing XML specifications such as WSDL, XPath, SOAP and XML Schema. – WSDL defines the operations (i.e., the methods) and

message types used by a web service.– XML Schema is used for data modeling– XPath expressions are used for handling of XML

Schema based data.– SOAP is used for messages exchanged,

Page 8: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

8

BPEL Processes Structure

• BPEL process has two sections; global declarations section and process definition section.

<process name=”Process_Name” …> Global Declarations Process Definitions (activity) </process>

• Global declarations contain extensions, imports, partnerLinks, Variables, CorrelationSets, faultHandlers, eventHandlers, etc

Page 9: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

9

Process Definition

• Process definition contains process activities• Activities represent the actions to be carried out

within a business process.• There are two types of activities in BPEL; basic

activities and structured activities.• Basic activities are those that are considered to

be atomic, meaning that they cannot be subdivided.

• Structured activities are those activities which can contain other activities.

Page 10: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

10

Basic Activities

• receive:- The job of the receive activity is to wait for an incoming message from a partner.

• reply:- Used to send a response to a request previously accepted through a receive activity.

• reply activity must be always preceded by receive activity.

• It is the combination of the two that defines the process's synchronous interactions.

• invoke:- used to invoke or call a web service.• An Invoke can be either one-way or it can use a

request-response exchange.

Page 11: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

11

Basic Activities (cont’d)

• assign:- Manipulating data variables.– Assign Activities, using their internal Copy operations,

control the movement of data in a BPEL process. – One Assign activity can have many internal Copy

commands

• throw:- Signaling faults and exceptions.• wait:- Waiting for some time.• exit:- Terminating the entire process.• empty:- An activity that does not do anything

Page 12: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

12

Structured Activities

• sequence:- Structures a set of activities to be invoked in an ordered sequence.

<sequence> activity+

</sequence>

Scope:- provides fault and compensation handling capabilities to the activities nested within it.

Page 13: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

13

Structured Activities (cont’d)

• if :- Provides a construct to choose one activity among a collection of activities.

<if> <condition expressionLanguage="anyURI"?>bool-expr</condition>

activity <elseif>*

<condition expressionLanguage="anyURI"?>bool-expr</condition> activity

</elseif> <else>?

activity </else>

</if>

Page 14: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

14

Structured Activities (cont’d)

• Pick:- Used to have the process wait until one of a set of events is triggered.

– Message events via onMessage element– Alarm events via onAlarm element

Page 15: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

15

Structured Activities (cont’d)<pick createInstance="yes|no"? > <onMessage partnerLink="ncname" portType="qname“ operation

="ncname" variable="ncname"? messageExchange="ncname"?>+<correlations>?

<correlation set="ncname" initiate="yes|no"?>+</correlations><fromParts>?<fromPart part="ncname“ toVariable="BPELVariableName" />+</fromParts>activity

</onMessage><onAlarm>*

(<for expressionLanguage="anyURI">duration-expr</for>|<until expressionLanguage="anyURI">deadline-expr</until>)activity

</onAlarm></pick

Page 16: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

16

Structured Activities (cont’d)

• while:- Defines the notion of loops. • It executes an activity repeatedly until its

associated Boolean condition is no longer true.

<while> <condition expressionLanguage="anyURI"?>

bool-expr </ condition>activity

</while>

Page 17: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

17

Structured Activities (cont’d)

• repeatUntil:- Is a looping activity which executes activity contained inside it at least once.

<repeatUntil>

activity

<condition expressionLanguage = "anyURI“?>

bool-expr

</condition>

</repeatUntil>

Page 18: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

18

Structured Activities (cont’d)

• flow:- Enables the concurrent execution of activities. • It defines a set of activities that will be invoked in

parallel.

<flow> <links>?

<link name="NCName">+ </links> activity+

</flow>

• The links put their own constraints on how the activities of a process are set to run.

Page 19: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

19

Structured Activities (cont’d)

• forEach:- forEach activity executes its scope activity exactly N+1 times serially in iteration or concurrently where N is the difference between finalCounterValue and startCounterValue.

• Based on the complitionCondition all activities inside scope activity of forEach activity might not be executed.

Page 20: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

20

Structured Activities (cont’d)

<forEach counterName="BPELVariableName" parallel = "yes|no“ > <startCounterValue expressionLanguage="anyURI"?>

unsigned-integer-expression </startCounterValue> <finalCounterValue expressionLanguage="anyURI"?>

unsigned-integer-expression </finalCounterValue> <completionCondition>? <branches expressionLanguage="anyURI"?

successfulBranchesOnly="yes|no"?>? unsigned-integer-expression

</branches> </completionCondition> <scope ...>.......</scope>

</forEach>

Page 21: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

21

Example BPEL Source Code

Page 22: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

22

Benefits of BPEL

• Industry-wide language for expressing business processes---standard by OASIS – Leverage a common skill set and language• Designed to fit naturally into the Web services stack – Is expressed entirely in XML – Uses and extends WSDL 1.1 – Uses XML Schema 1.0 for the data model• Portable across platform and vendor – Will run on any BPEL-compliant engine• Interoperable between interacting processes – Layering on top of Web services stack

Page 23: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

23

Metrics of BPEL

• Software metric is a measure of some property of a piece of software or its specifications [15].

• Effective management of any process requires quantification, measurement, and modeling.

• Metrics are useful for [12];– prioritizing remediation efforts– allocating resources among multiple projects– quantify the amount of risk associated with a piece of

code.– getting feedback on the effectiveness of the security

process

Page 24: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

24

Metrics of BPEL

• The BPEL language is quite new, and much hasn’t been done on its metrics.

• However, there are some metrics which are proposed but almost all of them are not validated.

• Most of the metrics are inspired from the traditional software program metrics.

• Broadly BPEL metrics can be classified in to two; Size metrics and complexity metrics.

Page 25: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

25

Size Metrics

• BPEL has three size metrics

• 1. Number of Activities (NOA) – Count all activities in a process.

• 2. Number of activities, joints and splits of a process (NOAJS).– count the number of activities, joints and splits

in a process

Page 26: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

26

Size Metrics (cont’d)

3. Number of activities and control-flow elements (NOAC).– number of activities and control-flow elements in a

process.

• There are four types of control flow elements in BPEL– Sequencing:- <sequence>– Branching:- <if>, <pick>– Iteration:- <while>, <repeatUntil>, <forEach p=n>– concurrent execution:-<flow>, <forEach p=y>

Page 27: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

27

Complexity Metrics

• BPEL by its nature is very complex. • High complexity results in

– poor understandability– less flexibility – less quality – more chance of failure– more errors and defects, and exceptions

• leading to processes requiring more time to design, test and maintain.

• There is no a single measure for process complexity

Page 28: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

28

Complexity Metrics (cont’d)

1. Control Flow Complexity (CFC)• There are two independent approaches to

develop a CFC metric to analyze business processes. – Based on the complexity of each activity.– Based on process joins and splits.

• In the first approach, a formula has been provided for each activity.

• Example, for while activity CFC (W) = log2 (CFC (a) +2)* CFC (a) • Then the CFC of a process is the cumulative

effect of complexity of all activities it contains.

Page 29: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

29

Complexity Metrics (cont’d)

• The second CFC metrics is calculated based on the splits and joins of a process.

• It is proposed as a design time metrics.• To calculate it from source code we need to

determine control flow graph of a process.• A Split is an activity (node) with more than one

outgoing transition.• A Join is an activity (node) with more than one

incoming transition.

Page 30: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

30

Complexity Metrics (cont’d)

• Where,– CFCXOR split (a) = fan-out(a) , a is a XOR-split activity

of P

– CFCOR split (a) = 2fan-out(a)-1 , a is an OR-split activity of P

– CFCAND split (a) = 1 , a is an AND-split activity of P

Page 31: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

31

Complexity Metrics (cont’d)

2. Data Flow Complexity (DFC)• The study of DFC involves the analysis of XML

Schema data types and the input and output messages of web service.

• Three metrics are proposed:– data complexity– interface complexity– interface integration complexity.

• ICBPEL Process (P) = Length * (Fan-in *Fan-out) 2

Page 32: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

32

Complexity Metrics (cont’d)

3. McCabe’s cyclomatic complexity (MCC)

• Calculated as

MCCBPEL Process(P) = e+n-2

• where e is total number of edges and n is total number of nodes in the process control graph.

Page 33: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

33

Complexity Metrics (cont’d)

4. Halstead-based process complexity (HPC).

• Determine [22],– Number of distinct operators (n1) – Number of distinct operands (n2) – Total number of operators (N1) – Total number of operands (N2)

• Calculate the metrics– Process Length: N = n1*log2(n1) + n2*log2(n2)– Process Volume: V = (N1+N2)*log2(n1+n2)– Process Difficulty: D = (n1/2)*(N2/n2)

Page 34: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

34

Complexity Metrics (cont’d)

5. Process Graph Complexity (PGC)

• Graph theory provides a rich set of graph metrics.

• Coefficient of network Complexity (CNC)– CNC = number of arcs / (number of activities,

joins, and splits)• Structuredness of process graph

– Number of structured activities

Page 35: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

35

Static code Analysis

• Static code analysis is the analysis of computer software that is performed without actually executing programs [15].

• The analysis can be manual inspection or automated one.

• It is important for [15, 11] – finding low-level errors – software metrics calculation – testing

Page 36: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

36

Scanner and Parser

• Automatic static analysis have two important components; Scanner and Parser.

• Scanner is a lexical analyzer which is responsible for;– converting character stream to token stream– strips out white space, comments

• Token is categorized block of text [15]. • Tokens are frequently defined by regular

expressions (example. Digits(0|1|2|…|9) )

Page 37: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

37

Scanner and Parser (cont’d)

• Parser is responsible for– Checking input for grammatical correctness– Determines syntax of token stream– construct intermediate representation– produce meaningful error messages

• It needs – mathematical model of syntax, context free

grammar– algorithm for testing syntax, parsing

Page 38: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

38

Scanner and Parser (cont’d)

Fig 3. scanner and parser in compilers

Error

IR (usually AST)Tokens

Source code

Specification (in RE)

Scanner Parser

Specification (in Grammar)

Page 39: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

39

Static Analysis for metrics calculation

TokensSource code Scanner Parser Metrics

Token separators

•Assume that the source code is synthetically correct

Fig 4. scanner and parser for metrics computation

Page 40: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

40

Example, NOA• Global declaration

– Identify all activities and store them in some data structure.

• Scanner– Open source code file for reading– If there is more line read a line at a time, else return

tokens – If the line is comment line go to 3– Break a line into tokens and store it in some data

structure

• Parser– Take a token and compare it with the content of globally

declared and initialized date structure.– If there is a match increase NOA by 1.– Do the above two steps until no more tokens are left

Page 41: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

41

public Vector<String> scanner(String path){

String line = null; Scanner input= new Scanner(new FileInputStream(path)); StringTokenizer st; Vector<String> tokens=new Vector<String>();

while(input.hasNextLine()){ line=input.nextLine(); if(line is comment line) continue; //break the line into tokens st = new StringTokenizer(line, " <,>\"=", false); String temp=null; while (st.hasMoreTokens()){ temp=st.nextToken(); tokens.add(temp); } } return tokens;

}

Page 42: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

42

final String activities = {“receive”, “reply”, … };

public int parser(Vector<String> tokens){int NOA=0;String token = null;for(int i = 0; i<tokens.size(); i++){

token = tokens.get(i);

for(int j=0;j<activities.length;j++) if(token.equals(activities[j])) NOA++;

}return NOA;

}

Page 43: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

43

BPEL Control flow graph

• CFG promotes the understandability of the source code.

• This is particularly important for complex programming languages like BPEL.

• The formal definition of the BPEL control flow graph as given in [9] is;

BFG = <N, E, S, F>,where, – N is set of nodes – E is set of edges – S start node – F set of final nodes

Page 44: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

44

BPEL Control flow graph (cont’d)

• There are two types of edges– Implicit edges – Explicit links

• Mapping rules– What type of edges/links exist between

activities– Determines which activities form which type of

nodes

Page 45: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

45

BPEL Control flow graph (cont’d)

Node Designation

Normal node

Decision node

Merge Node

Fork Node

Join node

Start/Final Node /

Page 46: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

46

BPEL Control flow graph, example

Fig 5. Control flow graph for PurchaseorderProcess.bpel

Page 47: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

47

Conclusion

• BPEL had become the de facto standard for process orchestration, even prior to the publication of the BPEL 2.0.

• It is a broadly adopted process orchestration standard supported by many vendors today.

• However, regarding to its metrics and CFG much hasn’t been done.

• The proposed metrics must be validated using empirical investigations.

• As CFG is vital for metrics calculation and for understandability the process emphasis should also be given here.

Page 48: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

48

References1. Fundamentals of BPEL, Active BPEL2. J. Cardoso, J. Mendling, G. Neuwmann and H.A. Reijers. A Discourse on

Complexity of Process Models. BPM 2006 workshops, LNCs 4103. 2006.3. Michael Havey, Essential Busines Process Modeling, Publisher: O'Reilly,

ebook, 2005.4. A close look at BPEL (magazine)5. BPEL's Growing Up(magazine)6. C Ouyang, E Verbeek, Wil M.P. van der Aalst, S Breutel, M Dumas, and

A.H.M. ter Hofstede. WofBPEL: A Tool for Automated Analysis of BPEL Processes. 2005.

7. Frederic Servais, Verifying and Testing BPEL Process, masters thesis, 2007.

8. A. Arkin, S. Askary, B. Bloch, F. Curbera, Y. Goland, N. Kartha, C. K. Liu, S. Thatte, P. Yendluri, and A. Yiu, editors. Web Services Business Process Execution Language Version 2.0. WS-BPEL TC OASIS, May 2005. Available via: http://www.oasis-open.org/committees/download.php/12791/.

9. Y Yuan, Z Li, Wei Sun. A Graph-search Based Approach to BPEL4WS Test Generation, 2006.

10. J. Cardoso, Complexity Analysis of BPEL web Process, Journal of Software Process: Improvement and Practice, 2006.

Page 49: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

49

References11. http://www.testingfaqs.org/t-static.html.12. https://www.informit.com/articles/article.aspx?p=768662&seqNum=313. J Carduso. Complexity analaysis of BPEL web services. Software

process: improvement and Practical Journal. 2006.14. Ms Weidlich, Efficient Analysis of BPEL 2.0 Processes using pi-Calculus,

200715. http://www.en.wikipedia.com16. Y Qianz, Y Xuz, Z Wangz, GPuz, H Zhuz, and C CaiyTool Support for

BPEL Verification in ActiveBPEL Engine , 2007.17. Design and Implementation of a Framework for Testing BPEL

Compositions18. R.M. Pariizi and A.A.A Ghani. An Ensemble of Complexity Metrics for

BPEL web Process. Ninth ACIS International Conference on Software Engineering, Artificial intellegince, Networking, and Parallel/Distributed Computing. 2008.

19. AJcFGraph 20. Structural Testing of Concurrent Programs21. Choy Kho Yee, Design and Implementation of Test Case Generation Tool

for BPEL Unit Testing, thesis, 2007.22. http://www.verifysoft.com/en_halstead_metrics.html

Page 50: Business Process Execution Language (BPEL), its metrics and Control Flow Graph (CFG) by Esubalew Alemneh.

50

Thank you