Terry.Li-彬

          虛其心,可解天下之問;專其心,可治天下之學(xué);靜其心,可悟天下之理;恒其心,可成天下之業(yè)。

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            143 隨筆 :: 344 文章 :: 130 評論 :: 0 Trackbacks
          這是Jboss 的jBPM3.12框架的用戶指南的中文翻譯。我的翻譯風(fēng)格是中英文對照,只翻譯部分我認(rèn)為重要的,不翻譯簡單的英文,以免浪費(fèi)你我的時(shí)間。 同時(shí),對于其中的部分內(nèi)容,我會在翻譯中做出解釋和寫上我的理解。 

           

          Chapter 4. Graph Oriented Programming面向圖表編程

          4.1. Introduction介紹

          This chapter can be considered the manifest for JBoss jBPM. It gives a complete overview of the vision and ideas behind current strategy and future directions of the JBoss jBPM project. This vision significantly differs from the traditional approach.

          本章給出一個(gè)完全的現(xiàn)在的Jboss jBPM策略和未來的方向。

          First of all, we believe in multiple process languages. There are different environments and different purposes that require a their own specific process language.

          首先,有多種處理語言,它們應(yīng)用于不同的環(huán)境和目的,需要特殊的處理語言。

          Secondly, Graph Oriented Programming is a new implementation technique that serves as a basis for all graph based process languages.

          第二,面向圖表編程是一個(gè)新的服務(wù)于基于圖表的業(yè)務(wù)處理語言的實(shí)現(xiàn)技術(shù)。

          The main benefit of our approach is that it defines one base technology for all types of process languages.

          Current software development relies more and more on domain specific languages. A typical Java developer will use quite a few domain specific languages. The XML-files in a project that are input for various frameworks can be considered domain specific languages.

          現(xiàn)在的軟件開發(fā)依賴于越來越多的特定領(lǐng)域語言。一個(gè)典型的java開發(fā)者將使用相當(dāng)多的DSL。Xml文件被許多DSL語言所使用。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->Positioning of graph based languages<!--[endif]-->

          Figure 4.1. Positioning of graph based languages

          配置基于圖表的語言

          Domain specific languages for workflow, BPM, orchestration and pageflow are based on the execution of a directed graph. Others like hibernate mapping files, ioc-configuration are not. Graph Oriented Programming is the foundation for all domain specific languages that are based on executing a graph.

          工作流、業(yè)務(wù)處理管理、管弦樂作曲法、頁面流的DSL是基于直接的圖表執(zhí)行的。

          面向圖表編程是所有基于圖表執(zhí)行的DSL的基礎(chǔ)。

          Graph Oriented Programming is a very simple technique that describes how graphs can be defined and executed on a plain OO programming language.

          In Section 4.5, “Application domains”, we'll cover the most often used process languages that can be implemented using Graph Oriented Programming like workflow, BPM, orchestration管弦樂作曲法 and pageflow.

          4.1.1. Domain specific languages

          特定領(lǐng)域語言

          Each process language can be considered a Domain Specific Language (DSL). The DSL perspective gives developers good insight in how process languages are related to plain OO programming. 、

          每一個(gè)處理語言可以比看作是DSL特定領(lǐng)域語言。DSL讓開發(fā)者能夠非常好的使用簡單OO編程來處理。

          This section might give the impression that we're focussed solely on programming environments. None is less true. Graph Oriented Programming includes the whole BPM product continuum from API libraries to fully fledged BPM suite products. BPM suite套件 products are complete software development environments that are centered around business processes. In that type of products, coding in programming languages is avoided as much as possible.

          BPM業(yè)務(wù)處理管理套件產(chǎn)品是完整的軟件開發(fā)環(huán)境。它們是以業(yè)務(wù)處理為中心的。這類產(chǎn)品中,應(yīng)該避免用編程語言編碼。而應(yīng)該使用DSL語言進(jìn)行配置。

          An important aspect of domain specific languages is that each language has a certain grammar. That grammar can be expressed as a domain model. In case of java this is Class, Method, Field, Constructor,... In jPDL this is Node, Transition, Action,... In rules, this is condition, concequence,...

          DSL語言的一個(gè)重要的方面是,每一個(gè)語言應(yīng)該有一個(gè)特定的語法。語法被表示為一個(gè)領(lǐng)域模型。例如,Java包括類、方法、字段、構(gòu)造器等。

          jPDL包括:節(jié)點(diǎn)、轉(zhuǎn)向、動作等。

          Rules規(guī)則語言是:條件,cequence等。

          The main idea of DSL is that developers think in those grammars when authoring artifacts for a specific language. The IDE is build around the grammar of a language. Then, there can be different editors to author the artifacts. E.g. a jPDL process has a graphical editor and a XML source view editor. Also there can be different ways to store the same artifact: for jPDL, this could be a process XML file or the serialized object graph of nodes and transition objects. Another (theoretic) example is java: you could use the java class file format on the system. When a user starts the editor, the sources are generated. When a user saves the compiled class is saved....

          DSL的主要思想是,開發(fā)者用一種特殊的語言創(chuàng)造東西。用這種語言比一般的通用領(lǐng)域語言表達(dá)能力更強(qiáng)。一種DSL語言,可以使用多種編輯器編輯。如,jPDL語言可以使用圖形化編輯器或者手工編寫XML源碼來編寫。

          Where ten years ago, the biggest part of a developer was spend on writing code. Now a shift has taken place towards learning and using domain specific languages. This trend will still continue and the result is that developers will have a big choice between frameworks and writing software in the host platform. JBoss SEAM is a very big step in that direction.

          過去,程序員主要工作是寫Java這樣的通用編程語言的代碼。今天,程序員需要些越來越多的DSL。這種趨勢將會繼續(xù)下去。DSL將會占據(jù)越來越多的領(lǐng)域,支持DSL的框架將會越來越多。Jboss SEAM和Spring就是其中的代表。

              元數(shù)據(jù)編程,DSL將會進(jìn)一步發(fā)展下去!

          Some of those languages are based on execution of a graph. E.g. jPDL for workflow in Java, BPEL for service orchestration, SEAM pageflow,... Graph Oriented Programming is a common foundation for all these type of domain specific languages.

          DSL中的一些語言基于圖表來執(zhí)行。例如,java的工作流語言jPDL,面向服務(wù)架構(gòu)的BPEL,頁面流SEAM等。

          面向圖表編程是所有這些 流程 型的DSL共同的基礎(chǔ)。

          In the future, for each language, a developer will be able to choose an editor that suites him/her best. E.g. a hard core programmer probably will prefer to edit java in the src file format cause that works really fast. But a less experienced java developer might choose a point and click editor to compose a functionality that will result in a java class. The java source editing will be much more flexible.

              在將來,對于每一種語言,可能會有更多的編輯器可供選擇。如,Java橫序員既可以直接編寫源碼,也可以使用圖形化工具來操作,生成Java源碼。如UML等。

          Another way of looking at these domain specific languages (including the programming languages) is from the perspective of structuring software. Object Oriented Programming (OOP) adds structure by grouping methods with their data. Aspect Oriented Programming (AOP) adds a way to extract cross cutting concerns. Dependency Injection (DI) and Inversion of Control (IoC) frameworks adds easy wiring of object graphs. Also graph based execution languages (as covered here) can be helpful to tackle complexity by structuring part of your software project around the execution of a graph.

          另一個(gè)看待那些DSL語言和其他編程語言的角度是,軟件結(jié)構(gòu)的前景。OOP通過把數(shù)據(jù)和方法組合在一起增加了結(jié)構(gòu)。OOP提取公共方面。DI和IOC(依賴注入和反向控制----它們是一回事)提供了容易的裝配對象的方法。

          基于圖表的執(zhí)行語言有助于解決你的軟件在執(zhí)行圖表方面的部分結(jié)構(gòu)的復(fù)雜性問題。

          An intial explanation on Domain Specific Languages (DSL) can be found on Martin Fowler's bliki. But the vision behind it is better elaborated in Martin's article about 'Language Workbenches'.

          4.1.2. Features of graph based languages

          基于圖表語言的特性

          There are numerous graph based process languages. There are big differences in the environment and focus. For instance, BPEL is intended as an XML based service orchestation component on top of an Enterprise Service Bus (ESB) architecture. And a pageflow process language might define how the pages of a webapplication can be navigated. These are two completely different environments.

          有眾多的基于圖表的處理語言。它們的使用環(huán)境和目標(biāo)有著巨大的差異。路例如,BPEL是一個(gè)基于XML格式的服務(wù)組件,是ESB(企業(yè)服務(wù)總線)架構(gòu)的頂層。

          一個(gè)頁面流處理語言可能定義Web應(yīng)用程序的頁面之間如何導(dǎo)航。這是兩個(gè)完全不同的領(lǐng)域。

          Despite all these differences, there are two features that you'll find in almost every process language: support for wait states and a graphical represenation. This is no coincidence because it's exactly those two features that are not sufficiently supported in plain Object Oriented (OO) programming languages like Java.

               不管它們有多大的不同,你可以發(fā)現(xiàn)幾乎所有處理語言有2個(gè)特性是一樣的:

          1,支持等待狀態(tài)

          2,圖形化表示;

          在OO編程語言中不是十分支持這2個(gè)特性。

          Graph Oriented Programming is a technique to implement these two features in an OO programming language. The dependency of Graph Oriented Programming on OO programming implies that all concrete process languages, implemented on top of Graph Oriented Programming, will have to be developed in OOP. But this does not mean that the process languages themselves expose any of this OOP nature. E.g. BPEL doesn't have any relation to OO programming and it can be implemented on top of Graph Oriented Programming.

          基于圖表編程是一個(gè)在OO編程語言中實(shí)現(xiàn)這2個(gè)特性的技術(shù)。所有面向圖表編程的功能都依賴于OO語言去開發(fā)。但這并不意味著處理語言暴露底層OO的實(shí)現(xiàn)。

          例如,BPEL不關(guān)聯(lián)任何OO編程語言,它能被面向圖表編程所實(shí)現(xiàn)。

          4.1.2.1. Support for wait states支持等待狀態(tài)

          An imperative programming language like Java are used to express a sequence of instructions to be executed by one system. There is no wait instruction. An imperative language is perfect for describing e.g. one request response cycle in a server. The system is continuously executing the sequence of instructions till the request is handled and the response is complete.

          Java等命令式語言會飛快地執(zhí)行序列化的指令,沒有等待指令。(實(shí)際有,可以讓線程等待)

          But one such request is typically part of a bigger scenario. E.g. a client submits a purchase order, this purchase order is to be validated by a purchase order manager. After approval, the information must be entered in the ERP system. Many requests to the server are part of the same bigger scenario.

             但那樣一個(gè)請求是一個(gè)更大的情節(jié)中的一部分。例如,一個(gè)客戶端提交一份購買訂單。一個(gè)訂單管理者確認(rèn)訂單有效,然后信息進(jìn)入ERP系統(tǒng)。

          So process languages are languages to describe the bigger scenario. A very important distinction we must make here is scenarios that are executable on one system (or chestration) and scenarios that describe the protocol between multiple systems (choreography). The Graph Oriented Programming implementation technique is only targets process languages that are executable on one machine (or chestration).

          所以程序語言是描述更大場景的語言。一個(gè)非常重要的區(qū)別是,一個(gè)系統(tǒng)內(nèi)部的執(zhí)行和多個(gè)系統(tǒng)的協(xié)議。 

              面向圖表語言的實(shí)現(xiàn)技術(shù)僅僅用于在一臺機(jī)器上執(zhí)行的程序語言。

          So an orchestration process describes the overall scenario in terms of one system. For example: A process is started when a client submits an order. The next step in the process is the order manager's approval. So the system must add an entry in the task list of the order manager and the wait till the order manager provides the required input. When the input is received, the process continues execution. Now a message is sent to the ERP system and again this system will wait until the response comes back.

             所以,一個(gè)管弦樂程序描述一個(gè)系統(tǒng)的整個(gè)期間的情節(jié)。例如:一個(gè)程序開始于一個(gè)客戶端提交訂單。程序中的下一步是訂單管理員承認(rèn)。所以,系統(tǒng)必須在訂單經(jīng)理的任務(wù)列表上增加一個(gè)任務(wù),等待訂單管理者提供需要的輸入。當(dāng)輸入收到以后,程序繼續(xù)執(zhí)行。現(xiàn)在,一個(gè)消息被發(fā)送到ERP系統(tǒng)中,系統(tǒng)將再一次等待知道ERP系統(tǒng)的響應(yīng)返回。此時(shí),任務(wù)結(jié)束。

          So to describe the overall scenario for one system, we need a mechanism to cope with wait states.

              所以,對于描述一個(gè)系統(tǒng)的整個(gè)場景,我們需要一個(gè)機(jī)制來處理等待狀態(tài)。----應(yīng)該就是把工作定義的實(shí)例保存到數(shù)據(jù)庫中。

          In most of the application domains, the execution must be persisted during the wait states. That is why blocking threads is not sufficient. Clever Java programmers might think about the Object.wait() and Object.notify(); methods. Those could be used to simulate wait states but the problem is that threads are not persistable.

              在多數(shù)程序中,等待狀態(tài)應(yīng)該被持久化。所以線程不能充分支持等待狀態(tài)。

          Continuations is a technique to make the thread (and the context variables) persistable. This could be a sufficient to solve the wait state problem. But as we will discuss in the next section, also a graphical representation is important for many of the application domains. And continuations is a technique that is based on imperative programming, so it's unsuitable for the graphical representation.

          Continuations續(xù)集 是一種持久化線程(和線程上下文變量)的技術(shù)。雖然它也能夠支持等待狀態(tài),但是,基于命令式編程語言的“Continuations續(xù)集”不適合圖形化表示。

          So an important aspect of the support for wait states is that executions need to be persistable. Different application domains might have different requirements for persisting such an execution. For most workflow, BPM and orchestration applications, the execution needs to be persisted in a relational database. Typically, a state transition in the process execution will correspond with one transaction in the database.

              所以,最好的支持等待狀態(tài)的技術(shù),是把程序執(zhí)行保存起來。不同的應(yīng)用程序領(lǐng)域?qū)τ诔志没绦驁?zhí)行有不同的需求。對于大多數(shù)工作流、BPM(業(yè)務(wù)程序管理)和管弦樂應(yīng)用程序,程序執(zhí)行應(yīng)該被保存在一個(gè)關(guān)系型數(shù)據(jù)庫中。典型的,在業(yè)務(wù)程序中的一個(gè)狀態(tài)轉(zhuǎn)換應(yīng)用使用數(shù)據(jù)庫的一個(gè)事務(wù)。

          4.1.2.2. Graphical representation圖形表示

          Some aspects of software development can benefit very well from a graph based approach. Business Process Management is one of the most obvious application domains of graph based languages. In that example, the communication between a business analyst and the developer is improved using the graph based diagram of the business process as the common language. See also Section 4.5.1, “Business Process Management (BPM)”.

          一些方面的軟件開發(fā)能夠非常好的借助于基于圖表的表示方法。業(yè)務(wù)程序管理BPM是最明顯的基于圖表的的語言的應(yīng)用程序之一。

              例如,在軟件開發(fā)者和業(yè)務(wù)分析師之間,使用基于圖表的圖來表示業(yè)務(wù)程序進(jìn)行交流。因?yàn)椋瑯I(yè)務(wù)程序分析師作為領(lǐng)域?qū)<遥⒉粫褂镁幊陶Z言。使用基于圖表的DSL特定領(lǐng)域語言便于開發(fā)者和業(yè)務(wù)程序分析師之間的交流。

          Another aspect that can benefit from a graphical representation is pageflow. In this case, the pages, navigation and action commands are shown and linked together in the graphical representation.

              另一個(gè)能夠從圖形表示中獲益的是頁面流。例如,頁面的導(dǎo)航和動作命令使用圖形化表示的方法顯示和鏈接。-----Struts的配置似乎就是一種頁面流。

          In Graph Oriented Programming we target graph diagrams that represent some form of execution. That is a clear differentiation with for instance UML class diagrams, which represent a static model of the OO data structure.

          在面向圖表編程中,我們的目標(biāo)是使用圖表來代表一些格式的業(yè)務(wù)程序的執(zhí)行。這是面向圖表編程語言和UML類圖等的一個(gè)面線的區(qū)別。UML類圖代表的是OO數(shù)據(jù)結(jié)構(gòu)的一個(gè)靜態(tài)的模型。

          面向圖表編程,表示的是一系列的業(yè)務(wù)程序、步驟。類似于UML的活動圖。

          參考:

          1,UML狀態(tài)圖:

          狀態(tài)圖
          在計(jì)算機(jī)系統(tǒng)中,當(dāng)系統(tǒng)和用戶(也可能是其他系統(tǒng))交互的時(shí)候,組成系統(tǒng)的對象為了適應(yīng)交互要經(jīng)歷必要的變化。一種表征系統(tǒng)變化的方法可以說是對想改變了 自己的狀態(tài)以相應(yīng)事件和時(shí)間的流逝。UML 狀態(tài)圖就是展示這種變化的工具,它描述了一個(gè)對象所處的可能狀態(tài)及狀態(tài)間的轉(zhuǎn)移,并給出了狀態(tài)變化序列的起點(diǎn)和終點(diǎn)。要注意,狀態(tài)圖與以上提到的類圖、對 象圖和用例圖有著本質(zhì)的不同。前3種圖能夠?qū)σ粋€(gè)系統(tǒng)或至少一組類、對象或用例建立模型,而狀態(tài)圖只是對單個(gè)對象建立模型。

          另外,狀態(tài)圖和序列圖也不同。序列圖關(guān)注的是多個(gè)對象的狀態(tài),以及它們之間的交互。而狀態(tài)圖和活動圖表示的是一個(gè)對象的狀態(tài)。
          狀態(tài)圖描述一段時(shí)間內(nèi)對象所處的狀態(tài)和狀態(tài)的變化。狀態(tài)的UML圖標(biāo)是一個(gè)圓角矩形,狀態(tài)轉(zhuǎn)移用狀態(tài)之間的有向連線表示。

          2,UML活動圖:

          UML活動圖是狀態(tài)圖的一種擴(kuò)展形式,它展示出對象執(zhí)行某種行為時(shí)或者在業(yè)務(wù)過程中所要精力的步驟和判定點(diǎn)。每個(gè)步驟(活動)用一個(gè)圓角矩形(比狀態(tài)圖更 扁更圓)表示,菱形圖標(biāo)代表判定點(diǎn)。它很像程序設(shè)計(jì)課中學(xué)到的流程圖。UML活動圖可用于表達(dá)一個(gè)對象的操作和一個(gè)業(yè)務(wù)過程。活動圖與狀態(tài)圖的主要區(qū)別 是,狀態(tài)圖圖出顯示的是狀態(tài),而活動圖突出顯示的是活動。

          Also the graphical representation can be seen as a missing feature in OO programming. There is no sensible way in which the execution of an OO program can be represented graphically. So there is no direct relation between an OO program and the graphical view.

              圖形化表示也可以被看作是OO編程的一個(gè)缺失的特性。OO編程中沒有一個(gè)方法能夠使用圖形化表示。所以在OO編程和圖形視圖之間沒有直接的關(guān)聯(lián)。

          In Graph Oriented Programming, the description of the graph is central and it is a real software artifact like e.g. an XML file that describes the process graph. Since the graphical view is an intrinsic part of the software, it is always in sync. There is no need for a manual translation from the graphical requirements into a software design. The software is structured around the graph.

             在面向圖表編程中,圖表的描述是中心,它是真正的軟件產(chǎn)品。如,一個(gè)xml文件描述業(yè)務(wù)處理圖表。因此,圖形化視圖是軟件的固有部分,它總是同時(shí)存在的。不需要手工把圖形需求翻譯到一個(gè)軟件設(shè)計(jì)中。軟件的結(jié)構(gòu)是圍繞圖表的。

              jBPM的process definition生成3個(gè)文件。一個(gè)是xml格式的業(yè)務(wù)程序定義文件。一個(gè)是xml格式的文件,用來存儲元素的位置,另一個(gè)是jpg的圖形文件,展示業(yè)務(wù)程序定義的視圖。

          4.2. Graph Oriented Programming面向圖表編程

          What we present here is an implementation technique for graph based execution languages. The technique presented here is based on runtime interpretation of a graph. Other techniques for graph execution are based on message queues or code generation.

          這里,我們介紹基于圖表執(zhí)行語言的實(shí)現(xiàn)技術(shù)。這是一種運(yùn)行時(shí)解釋的圖表。這樣,可以靈活的改變圖表DSL語言,實(shí)現(xiàn)不同的配置和運(yùn)行結(jié)果。其他圖表執(zhí)行的技術(shù)是基于消息隊(duì)列和代碼生成。

          代碼生成,如源代碼級元數(shù)據(jù)的代碼生成;或者類載入時(shí)更改.class文件。

          This section will explain the strategy on how graph execution can be implemented on top of an OO programming language. For those who are familiar with design patterns, it's a combination of the command pattern and the chain of responsibility pattern.

          本節(jié)解釋我們?nèi)绾卧谝婚TOO編程語言的基礎(chǔ)上實(shí)現(xiàn)圖表執(zhí)行語言的策略。對于那些熟悉設(shè)計(jì)模式的人來說,這是命令模式和責(zé)任鏈模式的結(jié)合。(都屬于行為模式)

          責(zé)任鏈模式讓多個(gè)處理對象能夠處理一個(gè)請求。

          命令模式,使用“接口—實(shí)現(xiàn)類”的方式。一般作為參數(shù)把接口傳給調(diào)用方法。它能夠去除調(diào)用方法的條件判斷代碼。這是“重構(gòu)”中經(jīng)常用到的一種模式,常常用來去除代碼中的條件判斷語句。

          We'll start off with the simplest possible model and then extend it bit by bit.

             我們首先從最簡單的模型開始,一步一步擴(kuò)展它。

          4.2.1. The graph structure圖表結(jié)構(gòu)

          First of all, the structure of the graph is represented with the classes Node and Transition. A transition has a direction so the nodes have leaving- and arriving transitions.

             首先,圖表的結(jié)構(gòu)使用“節(jié)點(diǎn)”/(狀態(tài))和“轉(zhuǎn)向”/(流程箭頭)來表示。

          “轉(zhuǎn)向”有方向性。所以,“節(jié)點(diǎn)”有離開和到達(dá)“轉(zhuǎn)向”。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->Node and Transition classes<!--[endif]-->

          Figure 4.2. Node and Transition classes節(jié)點(diǎn)和轉(zhuǎn)向類

          A node is a command and has an execute method. Subclasses of Node are supposed to override the execute method to implement some specific behaviour for that node type.

              節(jié)點(diǎn)使用了命令模式,只有一個(gè)方法。

          一個(gè)節(jié)點(diǎn)是一個(gè)命令,有一個(gè)執(zhí)行方法。節(jié)點(diǎn)的子類支持覆蓋這個(gè)執(zhí)行方法,根據(jù)節(jié)點(diǎn)的類型實(shí)現(xiàn)不同的方法。

          4.2.2. An execution一個(gè)執(zhí)行

          The execution model that we defined on this graph structure might look similar to finite state machines or UML state diagrams. In fact Graph Oriented Programming can be used to implement those kinds of behaviours, but it also can do much more.

          我們定義在圖表結(jié)構(gòu)上的執(zhí)行模型看上去類似于有限狀態(tài)機(jī)或者UML的狀態(tài)圖。

          實(shí)際上,面向圖表編程能實(shí)現(xiàn)這些行為,還能做得更多。

          An execution (also known as a token) is represented with a class called Execution. An execution has a reference to the current node.

              一個(gè)執(zhí)行(jBPM是token記號類,叫做“業(yè)務(wù)程序流程”比較合適,是一次業(yè)務(wù)程序?qū)嵗囊粋€(gè)流程。)使用一個(gè)叫做Execution執(zhí)行的類來表示。

          一個(gè)執(zhí)行指向現(xiàn)有的節(jié)點(diǎn)。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->The Execution class<!--[endif]-->

          Figure 4.3. The Execution class執(zhí)行類

          Transitions are able to pass the execution from a source node to a destination node with the method take.

          轉(zhuǎn)向能夠傳遞執(zhí)行ExecutionContext給take方法。 執(zhí)行會從從源節(jié)點(diǎn)到達(dá)目標(biāo)節(jié)點(diǎn)

          jBPM中,Token等類的signal()方法表示一次“轉(zhuǎn)向”動作的執(zhí)行。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->The Transition take method<!--[endif]-->

          Figure 4.4. The Transition take method轉(zhuǎn)向的take方法

          When an execution arrives in a node, that node is executed. The Node's execute method is also responsible for propagating傳播 the execution. Propagating the execution means that a node can pass the execution that arrived in the node over one of its leaving transitions to the next node.

          轉(zhuǎn)向---〉節(jié)點(diǎn)---〉轉(zhuǎn)向---〉節(jié)點(diǎn)

          當(dāng)一個(gè)執(zhí)行到達(dá)節(jié)點(diǎn)后,這個(gè)節(jié)點(diǎn)也會被執(zhí)行。這個(gè)執(zhí)行也會把執(zhí)行傳遞下去。通過轉(zhuǎn)向,執(zhí)行點(diǎn)到達(dá)下一個(gè)節(jié)點(diǎn)。

          <!--[if !vml]--><!--[endif]--><!--[if !vml]-->The Node execute method<!--[endif]-->

          參考:

          1jBPM中,狀態(tài)有4種匹配事件的動作:

          <transition name="" to="end">

                 <action name="action1"></action>

                  </transition>

          2,轉(zhuǎn)向只有一個(gè)動作。

          3,動作可以有類class會調(diào)用該“動作處理器”的唯一方法。

          <event type="before-signal">

                   <action name="action1"></action>

                </event>

                <event type="after-signal">

                   <action name="action1"></action>

                </event>

          <event type="node-enter">

                   <action name="action1" class="com.sample.action.MessageActionHandler"></action>

                   <action name="action2"></action>

                </event>

                <event type="node-leave">

                   <action name="action1"></action>

                </event>

          Figure 4.5. The Node execute method節(jié)點(diǎn)執(zhí)行方法

          When a node's execute method does not propagate傳播 the execution, it behaves as a wait state. Also when a new execution is created, it is initialized in some start node and then waits for an event.

          An event is given to an execution and it can trigger the execution to start moving. If the event given to an execution relates to a leaving transition of the current node, the execution takes that transition. The execution then will continue to propagate傳播 until it enters another node that behaves as a wait state.

          <!--[if !vml]--><!--[endif]-->

          節(jié)點(diǎn)/狀態(tài)有2種執(zhí)行方式。一種是類似于Java等命令式的編程語言,一步步往下走;

          另一種節(jié)點(diǎn)是等待狀態(tài)。要等待觸發(fā)。

          jBPM中是單步執(zhí)行,如果需要等待,可以先把“業(yè)務(wù)程序執(zhí)行流程”保存進(jìn)數(shù)據(jù)庫中。

          如果節(jié)點(diǎn)沒有上面那樣的execute執(zhí)行方法,那么就像start節(jié)點(diǎn)那樣是一個(gè)等待狀態(tài),需要觸發(fā)事件才能繼續(xù)執(zhí)行。

          jBPM的jpdl中,基本上都是等待狀態(tài)。需要一步步執(zhí)行。

          <!--[if !vml]-->The Execution event method<!--[endif]-->

          Figure 4.6. The Execution event method執(zhí)行事件方法

          4.2.3. A process language一種業(yè)務(wù)處理語言

          So now we can already see that the two main features are supported : wait states and a graphical representation. During wait states, an Execution just points to a node in the graph. Both the process graph and the Execution can be persisted: E.g. to a relational database with an O/R mapper like hibernate or by serializing the object graph to a file. Also you can see that the nodes and transitions form a graph and hence there is a direct coupling with a graphical representation.

          <!--[if !vml]--><!--[endif]-->

          現(xiàn)在,我們能夠看看面向圖表編程語言支持的2個(gè)特性:等待狀態(tài)和圖形化表示。在等待狀態(tài)期間,一個(gè)“業(yè)務(wù)程序的執(zhí)行”僅僅指向“業(yè)務(wù)程序定義”的一個(gè)節(jié)點(diǎn)。業(yè)務(wù)程序定義/圖表和“業(yè)務(wù)程序的執(zhí)行”都能夠被持久化。如,使用一個(gè)類似hibernate的o-r映射工具保存到關(guān)系數(shù)據(jù)庫中,或者序列化一個(gè)對象到文件中。

          你也能看到一個(gè)圖表/“業(yè)務(wù)程序定義”的節(jié)點(diǎn)和轉(zhuǎn)向。因此,這也是一個(gè)與可視化表示的直接結(jié)合。

          A process language is nothing more then a set of Node-implementations. Each Node-implementation corresponds with a process construct. The exact behaviour of the process construct is implemented by overriding the execute method.

              一個(gè)業(yè)務(wù)處理語言除了一系列節(jié)點(diǎn)實(shí)現(xiàn)之外,沒有什么東西。每一個(gè)節(jié)點(diǎn)實(shí)現(xiàn)處理一個(gè)業(yè)務(wù)處理構(gòu)件。業(yè)務(wù)處理構(gòu)件的準(zhǔn)確行為由實(shí)現(xiàn)類的execute方法來決定。

          Here we show an example process language with 4 process constructs: a start state, a decision, a task and an end state. This example is unrelated to the jPDL process language.

          這里,我們展示一個(gè)簡單的業(yè)務(wù)處理語言,它有4個(gè)業(yè)務(wù)處理構(gòu)件:start狀態(tài)、決定器、任務(wù)和end狀態(tài)。它和jPDL處理語言無關(guān),僅僅為了演示。

          <!--[if !vml]-->An example process language<!--[endif]-->

          Figure 4.7. An example process language

          一個(gè)示例業(yè)務(wù)處理語言

          Concrete node objects can now be used to create process graphs in our example process language.

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->An example process<!--[endif]-->

          Figure 4.8. An example process

          When creating a new execution for this process, we start by positioning the execution in the start node. So as long as the execution does not receive an event, the execution will remain positioned in the start state.

          創(chuàng)建一個(gè)新的業(yè)務(wù)程序的業(yè)務(wù)程序執(zhí)行時(shí),它位于、指向start節(jié)點(diǎn)。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->A new execution<!--[endif]-->

          Figure 4.9. A new execution一個(gè)新的業(yè)務(wù)程序的執(zhí)行

          Now let's look at what happens when an event is fired. In this initial situation, we fire the default event that will correspond with the default transition.

             初始化時(shí),我們激活了默認(rèn)的事件,這將和默認(rèn)的轉(zhuǎn)向通訊。

          That is done by invoking the event method on the execution object. The event method will propagate find the default leaving transition and pass the execution over the transition by invoking the take method on the transition and passing itself in as a parameter.

          事件方法將找到默認(rèn)的離開轉(zhuǎn)向,傳遞執(zhí)行到下一個(gè)狀態(tài)。

          The transition will pass on the execution to the decision node and invoke the execute method. Let's assume the decision's execute implementation performs a calculation and decides to propagate the execution by sending the 'yes'-event to the execution. That will cause the execution to continue over the 'yes' transition and the execution will arrive in the task 'doubleCheck'.

          Let's assume that the execute implementation of the doubleCheck's task node is adds an entry into the checker's task list and then waits for the checker's input by not propagating the execution further.

          Now, the execution will remain positioned in the doubleCheck task node. All nested invocations will start to return until the original event method returns.

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->An execution in the 'doubleCheck' wait state<!--[endif]-->

          Figure 4.10. An execution in the 'doubleCheck' wait state

          4.2.4. Actions動作

          In some application domains there must be a way to include the execution of programming logic without introducing a node for it. In Business Process Management for example this is a very important aspect. The business analyst is in charge of the graphical representation and the developer is responsible for making it executable. It is not acceptable if the developer must change the graphical diagram to include a technical detail in which the business analyst is not interested.

          在許多應(yīng)用程序領(lǐng)域,沒有導(dǎo)入一個(gè)節(jié)點(diǎn),需要有一個(gè)方法包括進(jìn)一個(gè)程序邏輯的執(zhí)行。

          在業(yè)務(wù)處理管理中這是非常重要的一個(gè)方面。業(yè)務(wù)分析員負(fù)責(zé)業(yè)務(wù)程序的圖形化表示。而開發(fā)人員負(fù)責(zé)是業(yè)務(wù)程序可執(zhí)行。

          開發(fā)者不能為了包括一個(gè)技術(shù)而改變業(yè)務(wù)程序表示圖。

          An Action is also a commands with an execute method. Actions can be associated with events.

              一個(gè)動作也是一個(gè)執(zhí)行方法的命令。動作能夠和事件一起使用。

          There are 2 basic events fired by the Node class while an execution is executing: node-leave and node-enter. Along with the events that cause transitions to be taken this gives already a good freedom of injecting programming logic into the execution of a graph.

          當(dāng)一個(gè)業(yè)務(wù)程序執(zhí)行時(shí),節(jié)點(diǎn)類有2個(gè)基本的事件:節(jié)點(diǎn)離開和節(jié)點(diǎn)進(jìn)入事件。

          通過引起轉(zhuǎn)向的事件,能夠把程序邏輯很自由的插入到圖形表示中。

          注:yes,no 是2個(gè)轉(zhuǎn)向,在業(yè)務(wù)程序執(zhí)行的代碼中進(jìn)行判斷,看應(yīng)該使用哪條“轉(zhuǎn)向”。

          <!--[if !vml]--><!--[endif]--> <!--[if !vml]-->Actions that are normally hidden from the graphical view<!--[endif]-->

          Figure 4.11. Actions that are normally hidden from the graphical view

          動作一般隱藏在視圖中

          Each event can be associated with a list of actions. All the actions will be executed with the event fires.

          每一個(gè)事件能夠和一系列動作關(guān)聯(lián)。

          4.2.5. Code example代碼例子

          In order for people to get acquinted with the principles of Graph Oriented Programming, we have developed these 4 classes in less then 130 lines of code. You can just read the code to get an idea or you can actually start playing with them and implement your own node types.

          Here's the example code:

          You can also download the whole (297KB) source project and start playing with it yourself. It includes an eclipse project so just importing it in your eclipse as a project should get you going. Also there are a set of tests that show basic process execution and the advanced graph execution concepts covered in the next section.

          package org.jbpm.gop;

          import java.util.*;

          /**anodeintheprocessgraph*/

          publicclass Node {

           

           String name;

           /**mapseventstotransitions

             *節(jié)點(diǎn)的轉(zhuǎn)向名

             **/

           Map<String,Transition> transitions = new HashMap<String,Transition>();

           /**mapseventstoactions

             *動作map

             **/

           Map<String,List<Action>> actions = new HashMap<String,List<Action>>();

           

           public Node(String name) {

              this.name = name;

           }

           

           /**createanewtransitiontothedestinationnodeand

             *associateitwiththegivenevent

             *增加一個(gè)轉(zhuǎn)向到本節(jié)點(diǎn)。指定目標(biāo)節(jié)點(diǎn)和轉(zhuǎn)向的名字。

             *

             *

             **/

           publicvoid addTransition(String event, Node destination) {

              transitions.put(event, new Transition(destination));

           }

           /**addtheactiontothegivenevent

             *

             *給節(jié)點(diǎn)增加動作。

             **/

           publicvoid addAction(String event, Action action) {

              if (actions.containsKey(event)) {

                actions.get(event).add(action);

              } else {

                List<Action> eventActions = new ArrayList<Action>();

                eventActions.add(action);

                actions.put(event, eventActions);

              }

           }

           /**tobeoverridenbyNodeimplementations.Thedefaultdoesn't

             *propagatetheexecutionsoitbehavesasawaitstate.

             *不考慮節(jié)點(diǎn)的實(shí)現(xiàn)。默認(rèn)不傳播執(zhí)行,所以它是一個(gè)等待狀態(tài)。必須要激發(fā)轉(zhuǎn)向,才能夠繼續(xù)執(zhí)行。

             *

             **/

           publicvoid execute(Execution execution) {

              System.out.println("arrived in wait state "+this);

           }

           public String toString() { return"node '"+name+"'"; }

          }

          =================--------------------------------------=============

          package org.jbpm.gop;

          /**atransitionintheprocessgraph*/

          publicclass Transition {

           Node destination;

           /**createsatransition

             *轉(zhuǎn)向,只有目標(biāo)節(jié)點(diǎn)指針。

             * 

             * */

           public Transition(Node destination) {

              this.destination = destination;

           }

          }

          ----------===================-------------------===================

          package org.jbpm.gop;

          /**acommandthatcanbeinjectedintoaprocessexecution

           *一個(gè)命令模式的接口,用來注入進(jìn)一個(gè)業(yè)務(wù)程序的執(zhí)行中。

           * 

           * */

          publicinterface Action {

           /**tobeoverridenbyActionimplementations

             *根據(jù)不同的執(zhí)行動作需要被重寫。

             *

             **/

           void execute(Execution execution);

          }

          --------===========-----------==============================------

          package org.jbpm.gop;

          import java.util.List;

          /**onepathofexecution

           *一個(gè)業(yè)務(wù)程序定義的一次執(zhí)行路徑

           **/

          publicclass Execution {

           /**pointertothecurrentnode

             *指向現(xiàn)在節(jié)點(diǎn)的指針。這是業(yè)務(wù)程序執(zhí)行唯一保存的東西。有了它,就可以恢復(fù)業(yè)務(wù)程序執(zhí)行的流程。

             * */

           public Node node = null;

           

           /**anexecutionalwaysstartsinagivennode

             *一次業(yè)務(wù)程序執(zhí)行總是在一個(gè)指定的開始節(jié)點(diǎn)執(zhí)行。

             *這是默認(rèn)的節(jié)點(diǎn)對象引用。

             * */

           public Execution(Node node) {

              this.node = node;

           }

           /**executesthecurrentnode'sactionsandtakestheevent'stransition

             *根據(jù)事件執(zhí)行動作。執(zhí)行轉(zhuǎn)向的事件。

             *1,離開節(jié)點(diǎn)事件;

             *2,執(zhí)行進(jìn)入轉(zhuǎn)向

             *  

             * */

           publicvoid event(String event) {

              System.out.println(this+" received event '"+event+"' on "+node);

              fire(event);

              if (node.transitions.containsKey(event)) {

                System.out.println(this+" leaves "+node);

                fire("leave-node");

                take(node.transitions.get(event));

              }

           }

           

           /**takeatransition

             *執(zhí)行轉(zhuǎn)向,轉(zhuǎn)向下一個(gè)節(jié)點(diǎn)

             * */

           void take(Transition transition) {

              System.out.println(this+" takes transition to "+transition.destination);

              node = transition.destination;

              enter(transition.destination);

           }

           

           /**enterthenextnode

             *進(jìn)入下一個(gè)節(jié)點(diǎn)

             *     激活目標(biāo)節(jié)點(diǎn)的 進(jìn)入節(jié)點(diǎn)事件。

             * */

           void enter(Node node) {

              System.out.println(this+" enters "+node);

              fire("enter-node");

              node.execute(this);

           }

           /**firestheactionsofanodeforaspecificevent

             *根據(jù)事件,執(zhí)行動作。

             *     實(shí)際是名-值對的名。

             *

             * */

           void fire(String event) {

              List<Action> eventActions = node.actions.get(event);

              if (eventActions!=null) {

                System.out.println(this+" fires actions for event '"+event);

                for (Action action : eventActions)

                  action.execute(this);

              }

           }

           

           public String toString() {return"execution";}

          }

          4.3. Advanced Graph Oriented Programming Extensions

          高級面向圖表編程擴(kuò)展

          The previous section introduced the plain Graph Oriented Programming model in its simplest form. This section will discuss various aspects of graph based languages and how Graph Oriented Programming can be used or extended to meet these requirements.

          4.3.1. Process variables業(yè)務(wù)程序變量

          Process variables maintain the contextual data of a process execution. In an insurance claim process, the 'claimed amount', 'approved ammount' and 'isPaid' could be good examples of process variables. In many ways, they are similar to the member fields of a class.

          業(yè)務(wù)程序變量維護(hù)業(yè)務(wù)程序執(zhí)行的上下文關(guān)系的數(shù)據(jù)。 類似于線程的本地線程變量。它們非常類似于類的成員變量。

          例如,一個(gè)保險(xiǎn)索賠業(yè)務(wù)程序中,要求索賠金額,核準(zhǔn)金額,已支付金額 是非常好的業(yè)務(wù)程序變量。

          業(yè)務(wù)程序變量,作為Map綁定在一次業(yè)務(wù)程序執(zhí)行對象上。

          Graph Oriented Programming can be easily extended with support for process variables by associating a set of key-value pairs that are associated with an execution. Concurrent execution paths and process composition will complicate things a bit. Scoping rules will define the visibility of process variables in case of concurrent paths of execution or subprocesses.

          'Workflow Data Patterns' is an extensive research report on the types of scoping that can be applied to process variables in the context of subprocessing and concurrent executions.

          4.3.2. Concurrent executions并發(fā)執(zhí)行

          并發(fā)執(zhí)行,指的是,一個(gè)業(yè)務(wù)程序的執(zhí)行有多個(gè)并發(fā)的分支活動。

          Suppose that you're developing a 'sale' process with a graph based process language for workflow. After the client submitted the order, there is a sequence of activities for billing the client and there's also a sequence of activities for shipping the items to the client. As you can imagine, the billing activies and shipping activities can be done in parallel.

          假設(shè)你在使用基于業(yè)務(wù)程序的工作流圖表語言開發(fā)一個(gè)銷售業(yè)務(wù)程序。客戶提交訂單后,有一系列帳單活動和送貨個(gè)客戶的活動。帳單和送貨活動可能是平行的。

          In that case, one execution will not be sufficient to keep track of the whole process state. Let's go though the steps to extend the Graph Oriented Programming model and add support for concurrent executions.

              此時(shí),一個(gè)執(zhí)行將不能夠跟蹤整個(gè)業(yè)務(wù)程序的執(zhí)行狀態(tài)。

          我們擴(kuò)展面向圖表編程模型來增加對并發(fā)執(zhí)行的支持。

          First, let's rename the execution to an execution path. Then we can introduce a new concept called a process execution. A process execution represents one complete execution of a process and it contains many execution paths.

          首先,重命名之前的Execution 為一個(gè)執(zhí)行路徑。  

              它只有一個(gè)指向當(dāng)前節(jié)點(diǎn)的指針。

          引入一個(gè)新的概念----業(yè)務(wù)程序執(zhí)行。 它代表一個(gè)業(yè)務(wù)程序定義的完整的執(zhí)行。它包括了許多個(gè)執(zhí)行路徑。 

              并發(fā)執(zhí)行,就是執(zhí)行路徑并發(fā)。 一個(gè)業(yè)務(wù)程序執(zhí)行有多個(gè)執(zhí)行路徑,可能是并發(fā)的。

          The execution paths can be ordered hierarchically. Meaning that one root execution path is created when a new process execution is instantiated. When the root execution path is forked into multiple concurrent execution paths, the root is the parent and the newly created execution paths are all children of the root. This way, implementation of a join can become straightforward: the implementation of the join just has to verify if all sibling-execution-paths are already positioned in the join node. If that is the case, the parent execution path can resume execution leaving the join node.

          執(zhí)行路徑能被分層次的排序。當(dāng)根路徑被分成多條并發(fā)的執(zhí)行路徑使,會新建子執(zhí)行路徑。   連接節(jié)點(diǎn)。

          如果所有子執(zhí)行路徑都在連接節(jié)點(diǎn)重新合攏,那么就能夠恢復(fù)主節(jié)點(diǎn)在連接節(jié)點(diǎn)的執(zhí)行。

          While the hierarchical execution paths and the join implementation based on sibling execution paths covers a large part of the use cases, other concurrency behaviour might be desirable in specific circumstances. For example when multiple merges relate to one split. In such a situation, other combinations of runtime data and merge implementations are required.

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->Actions that are normally hidden from the graphical view<!--[endif]-->

          Figure 4.12. Actions that are normally hidden from the graphical view

          動作一般隱藏在圖形化視圖下面

          Multiple concurrent paths of execution are often mixed up with multithreaded programming. Especially in the context of workflow and BPM, these are quite different. A process specifies a state machine. Consider for a moment a state machine as being always in a stable state and state transitions are instantanious. Then you can interpret concurrent paths of execution by looking at the events that cause the state transitions. Concurrent execution then means that the events that can be handled are unrelated between the concurrent paths of execution. Now let's assume that state transitions in the process execution relates to a database transition (as explained in Section 4.3.6, “Persistence and Transactions”), then you see that multithreaded programming is actually not even required to support concurrent paths of execution.

          并發(fā)執(zhí)行路徑,常常意味著多線程編程。特別是工作流和業(yè)務(wù)程序管理。

          一個(gè)業(yè)務(wù)程序?qū)嶋H是一個(gè)狀態(tài)機(jī)。狀態(tài)機(jī)在某一個(gè)時(shí)刻總是處于一個(gè)穩(wěn)定的狀態(tài),狀態(tài)轉(zhuǎn)變是即時(shí)完成的。你能夠通過觀察引起狀態(tài)轉(zhuǎn)變的事件來解釋并發(fā)執(zhí)行路徑。事件的處理與并發(fā)執(zhí)行路徑是不相關(guān)的。

          假設(shè),業(yè)務(wù)程序的執(zhí)行中的一個(gè)狀態(tài)轉(zhuǎn)變和數(shù)據(jù)庫中的轉(zhuǎn)變關(guān)聯(lián)(通過數(shù)據(jù)庫事務(wù),把一次轉(zhuǎn)變封裝起來),并發(fā)執(zhí)行路徑實(shí)際上不需要多線程編程。

          4.3.3. Process composition業(yè)務(wù)程序組合

          Process composition is the ability to include a sub process as part of a super process. This advanced feature makes it possible to add abstraction to process modelling. For the business analyst, this feature is important to handle break down large models in smaller blocks.

          The main idea is that the super process has a node in the graph that represents a complete execution of the sub process. When an execution enters the sub-process-node in the super process, several things are to be considered:

          超級業(yè)務(wù)程序有一個(gè)圖表節(jié)點(diǎn),表示一個(gè)完整的子業(yè)務(wù)程序的執(zhí)行。

          當(dāng)一個(gè)業(yè)務(wù)程序執(zhí)行進(jìn)入了子節(jié)點(diǎn)業(yè)務(wù)程序,需要考慮下面幾件事情:

          • First of all, a new execution is created for the sub process.

          首先,為子業(yè)務(wù)程序創(chuàng)建一個(gè)新的業(yè)務(wù)程序執(zhí)行。

          • Optionally some of information stored in the process variables of the super process can be injected from the super process execution into the sub process execution. The most easy form is that the sub process node is configured with a set of variables that are just copied from the super process variables to the sub process variables.

          保存在超級業(yè)務(wù)程序執(zhí)行中的一些業(yè)務(wù)程序變量能夠插入子業(yè)務(wù)程序的執(zhí)行的業(yè)務(wù)程序變量中。

          • The start-node of the sub process should have only one leaving transition. Process languages that support multiple leaving transitions must have a mechanism to choose one of those transitions based on the process variables of the super process.

          子業(yè)務(wù)程序的開始節(jié)點(diǎn)只能有一個(gè)離開轉(zhuǎn)向。

          • The sub process execution is launched by sending an event that corresponds to the default leaving transition of its start state.

          開始狀態(tài)的事件激發(fā)子業(yè)務(wù)程序的執(zhí)行。

          After the sub process entered a wait state, the super process execution will be pointing to the sub-process-node and the sub process execution will be pointing to some wait state.

          When the sub process execution finishes, the super process execution can continue. The following aspects need to be considered at that time:

          子業(yè)務(wù)程序完成后,父級業(yè)務(wù)程序能夠執(zhí)行,需要考慮:

          • Process variable information may need to be copied back from the sub process execution into the super process execution.

          子類業(yè)務(wù)程序執(zhí)行的變量拷到父級業(yè)務(wù)處理程序中。

          • The super process execution should continue. Typically, process languages allow only one leaving transition on a sub process node. In that case the super process execution is propagated over that default single leaving transition.
          • In case a sub process node is allowed more then one leaving transition, a mechanism has to be introduced to select a leaving transition. This selection can be based on either the sub process execution's variables or the end state of the sub process (a typical state machine can have multiple end states).

             如果一個(gè)子業(yè)務(wù)程序允許多個(gè)離開轉(zhuǎn)向,那么需要引入一個(gè)機(jī)制來選擇離開轉(zhuǎn)向。這個(gè)選擇能夠基于子業(yè)務(wù)程序執(zhí)行的變量,或者子業(yè)務(wù)程序的結(jié)束狀態(tài)。(一個(gè)典型的狀態(tài)機(jī)能夠有多個(gè)結(jié)束結(jié)束狀態(tài))

          TODO: bpel's has an implicit暗示 notion 概念of subprocessing, rather then an explicit明確的...

          4.3.4. Synchronous execution同步業(yè)務(wù)程序執(zhí)行路徑

          4.3.5. Asynchronous continuations異步擴(kuò)展

          4.3.6. Persistence and Transactions持久化和事務(wù)

          4.3.7. Services and the environment服務(wù)和環(huán)境

          4.4. Architecture架構(gòu)

          4.5. Application domains架構(gòu)領(lǐng)域

          4.5.1. Business Process Management (BPM)業(yè)務(wù)程序管理

          The goal of BPM is to make an organisation run more efficient. The first step is analysing and describing how work gets done in an organisation. Let's define a business process is a description of the way that people and systems work together to get a perticular job done. Once business processes are described, the search for optimisations can begin.

          BPM業(yè)務(wù)程序管理的目標(biāo)是使一個(gè)組織運(yùn)行的更有效率。第一步是分析和描述組織內(nèi)的工作如何執(zhí)行。

          我們定義一個(gè)業(yè)務(wù)程序,來描述人們和系統(tǒng)一起工作完成工作的程序、步驟。

          Sometimes business processes have evolved organically and merely looking at the overall business process shows some obvious inefficiencies. Searching for modifications that make a business process more efficient is called Business Process Reengineering (BPR). Once a large part of a business process is automated, statistics and audit trails can help to find and identify these inefficiencies.

          BPR業(yè)務(wù)程序/流程重組,改造現(xiàn)在沒有效率的業(yè)務(wù)程序。新的業(yè)務(wù)程序更有效率。一旦大部分業(yè)務(wù)程序?qū)崿F(xiàn)自動化處理,那么統(tǒng)計(jì)和跟蹤就能夠幫助我們找到和標(biāo)識這些低效的原因。

          Another way to improve efficiency can be to automate whole or parts of the business process using information technology.

          另一個(gè)改善效率的方法:使用信息技術(shù)能夠自動化部分或者整個(gè)業(yè)務(wù)程序。

          Automating and modifying business processes are the most common ways of making an organisation run more efficient.

          自動化和修改業(yè)務(wù)程序是最普遍的提供一個(gè)組織的工作效率的方法。

          Managers continiously break down jobs into steps to be executed by their team members. For example a software development manager that organises a team-building event. In that case, the description of the business process might be done only in the head of the manager. Other situations like handling an insurance claim for a large insurance company require a more formal approach to BPM.

          經(jīng)理常常被他們的手下打斷工作。例如,業(yè)務(wù)程序可能僅僅在經(jīng)理的大腦中有個(gè)映像。

              但是,像一個(gè)大型的保險(xiǎn)公司的保單索賠這樣的工作,就需要一個(gè)更加正式的業(yè)務(wù)程序管理BPM。

          The total gain that can be obtained from managing business processes is the efficiency improvements times the number of executions of the process. The cost of managing business processes formally is the extra effort that is spent on analysing, describing, improving and automating the business processes. So that cost has to be taken into consideration when determining which processes will be selected for formal management and/or automation.

             總的目標(biāo)是,大量的業(yè)務(wù)程序的執(zhí)行效率能夠通過管理業(yè)務(wù)程序而得到提高。正式的采用BPM管理業(yè)務(wù)程序的成本是額外的分析業(yè)務(wù)程序,描述業(yè)務(wù)程序,改進(jìn)和自動化業(yè)務(wù)程序。

              所有這些成本必須被認(rèn)真考慮,以決定一項(xiàng)業(yè)務(wù)程序正式的自動化管理是否值得。

          4.5.1.1. Goals of BPM systems

          BPM(業(yè)務(wù)程序管理)系統(tǒng)的目標(biāo)

          4.5.1.2. Process development process

          處理開發(fā)業(yè)務(wù)程序

          4.5.2. Service orchestration

          安排服務(wù)

          orchestration is somtimes supposed to be in the context of service orchestration.

          安排有時(shí)假想在安排服務(wù)。

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->Service<!--[endif]-->

          Figure 4.13. Service

          4.5.2.1. Orchestration compared to Choreography

          安排和舞蹈的比較

          4.5.3. Pageflow頁面流

          4.5.4. Visual programming可視化編程

          ...targetted at less experienced developers.

          針對富有經(jīng)驗(yàn)的開發(fā)者。

          In my opinion, the current java community is a relatively small community of very hard core power users. Of course, the point and click will have a lot of restrictions cannot handle all of Java's constructs. But it will open up a hole new can of fresh (less-experienced) software developers. So different editors for a single language can target different types/levels of developers.

          4.6. Embedding graph based languages

          內(nèi)嵌的基于圖表的語言

          When the BPM engine can be completely integrated into a software development project and when even the BPM engine's database tables in integrated into the project's database, then we speak of an Embeddable BPM engine. That is the goal we target with Graph Oriented Programming: a common foundation for implementing graph based languages.

          面向圖表的編程目標(biāo)是: 實(shí)現(xiàn)基于圖表編程的一個(gè)共同的基礎(chǔ)。

          4.7. Market市場

          4.7.1. The ultimate process language最終的業(yè)務(wù)程序語言

          Traditionally, the vendors賣主 have been searching for the ultimate process language. The approach is to specify a process language as a set of constructs構(gòu)件. Each construct has a graphical representation and a runtime behaviour. In other words, each construct is a node type in the process graph. And a process language is just a set of node constructs.

          一個(gè)業(yè)務(wù)程序語言僅僅是一系列節(jié)點(diǎn)構(gòu)件的集合。

          The idea was that the vendors were searching for the best set of process constructs to form a universally applicable process language. This vision is still found a lot today and we call it searching for the ultimate process language.

          可是用于大部分場合的業(yè)務(wù)程序語言的最好的業(yè)務(wù)程序構(gòu)件集合。

          We believe that the focus should not be on trying to find the ultimate process language, but rather in finding a common foundation that can be used as a basis for process languages in different scenarios and different environment. Graph Oriented Programming as we present it next is to be seen as such a foundation.

          我們認(rèn)為找不到最終的業(yè)務(wù)程序語言,但是應(yīng)該能夠找到所有業(yè)務(wù)程序語言共同的基礎(chǔ)。我們接下來將要向你展示的的這種面向圖表編程語言看來就是這樣一種基礎(chǔ)語言。

          4.7.2. Fragmentation分裂

          The current landscape前景 of workflow工作流, BPM業(yè)務(wù)程序管理 and orchestration安排 solutions is completely fragmented. In this section we'll describe two dimensions in this fragmentation. The first dimension is called the BPM product continuum and it's shown in the next picture. The term was originally coined by Derek Miers and Paul Harmon in 'The 2005 BPM Suites Report'.

          1,不同: 編程語言環(huán)境和BPM套件的不同-------庫和BPM套件來彌合。

          底層OO通用編程語言技術(shù)和基于業(yè)務(wù)的業(yè)務(wù)程序定義的跨度。

          粒度相差太大。必須要使用OO制作的庫實(shí)現(xiàn)BPM的DSL語言系統(tǒng)來定義業(yè)務(wù)程序!

          基于OO的BPM庫和BPM套件是解決之道。

          On the left, you can see the programming languages. This side of the continuum is targeted towards the IT developers. Programming languages are the most flexible and it integrates completely with the other software developed for a perticular project. But it takes quite a bit of programming to implement a business process.

             編程語言面向開發(fā)人員,但對于實(shí)現(xiàn)一個(gè)業(yè)務(wù)程序,粒度太小了。

          On the right, there are the BPM suites套件. These BPM suites are complete software development environments targetted to be used by business analysts業(yè)務(wù)分析員. Software is developed around business processes. No programming has to be done to create executable software in these BPM suites.

          <!--[if !vml]--><!--[endif]-->

          <!--[if !vml]-->The BPM product continuum.<!--[endif]-->

          Figure 4.14. The BPM product continuum.

          BPM產(chǎn)品統(tǒng)一體

          Traditional products mark 1 spot in the BPM product continuum. To be complete, these products tend to aim for the far right of the continuum. This is problematic because it results in monolithic system that is very hard to integrate into a project combines plain OOP software with business processes.

          傳統(tǒng)產(chǎn)品玷污了BPM產(chǎn)品統(tǒng)一體。

          芯片系統(tǒng)(匯編系統(tǒng)?)上是非常難以集成一個(gè)使用業(yè)務(wù)程序的OO軟件的。

          難以把OOP軟件和業(yè)務(wù)程序整合起來。

          Graph Oriented Programming can be built as a simple library that integrates nice with plain programming environment. On the other hand, this library can be packaged and predeployed on a server to become a BPM server. Then other products added and packaged together with the BPM server to become a complete BPM suite.

          面向圖表編程構(gòu)建于一個(gè)簡單的庫上,能與簡單編程環(huán)境很好的整合。

          另一方面,這個(gè)庫能夠被打包和預(yù)部署到一個(gè)服務(wù)器上,從而成為一個(gè)BPM服務(wù)器。其他產(chǎn)品在其上增加和打包,成為一個(gè)完整的BPM套件。

          The net result is that solutions based on Graph Oriented Programming can target the whole continuum. Depending on the requirements in a perticular project, the BPM suite can be peeled and customized to the right level of integration with the software development environment.

          結(jié)果是基于圖表的編程解決方案能夠解決所有問題。依賴于項(xiàng)目的實(shí)際需要,BPM套件能夠去除和定制到正確的級別,和軟件開發(fā)環(huán)境整合起來。

          The other dimension of fragmentation is the application domain. As show above, a BPM application domain is completely different from service orchestration or pageflow. Also in this dimension, traditional products target one single application domain, where Graph Oriented Programming covers the whole range.

          傳統(tǒng)產(chǎn)品的目標(biāo)是針對一個(gè)簡單的應(yīng)用領(lǐng)域。而jBPM這樣的面向圖表語言借助于提煉出廣泛適用的構(gòu)建,試圖用一種語言完全的覆蓋整個(gè)領(lǐng)域。

          2,另一個(gè)分裂的緯度:應(yīng)用程序領(lǐng)域的廣度。上面所示,一個(gè)BPM應(yīng)用程序領(lǐng)域包括從服務(wù)安排到頁面流等完全不同的領(lǐng)域。

          If we set this out in a graph, this gives a clear insight in the current market fragmentation. In the graph based languages market,在基于圖標(biāo)語言的市場, prices are high and volumes are low價(jià)格高體積小. Consolidation is getting started and this technology aims to be a common foundation共同的基礎(chǔ) for what is now a fragmented 分析和高軟市場前景and confusing market landscape.

          <!--[if !vml]--><!--[endif]-->

          如圖:

          高端的DSL語言,解決的問題越簡單;

          ---高效,但是不廣泛有用。

          底端的OO,解決的問題越復(fù)雜。

          -----適應(yīng)性廣,但是低效!

          <!--[if !vml]-->Two dimensions of fragmentation.<!--[endif]-->

          Figure 4.15. Two dimensions of fragmentation.

          分裂的2個(gè)緯度

          4.7.3. Other implementation techniques

          其他實(shí)現(xiàn)技術(shù)

          Based on message queues. 基于消息隊(duì)列

          Based on code generation. 基于代碼生成

          posted on 2007-09-06 12:33 禮物 閱讀(1076) 評論(0)  編輯  收藏 所屬分類: Jbpm
          主站蜘蛛池模板: 沅江市| 铜山县| 富裕县| 石城县| 堆龙德庆县| 北安市| 应用必备| 呼和浩特市| 万荣县| 随州市| 远安县| 比如县| 斗六市| 乡宁县| 通榆县| 太谷县| 安泽县| 萨嘎县| 宜都市| 沧州市| 康马县| 淅川县| 舒城县| 中西区| 当涂县| 松潘县| 灵璧县| 若尔盖县| 辽中县| 武穴市| 方正县| 封丘县| 延川县| 柏乡县| 康平县| 五大连池市| 于都县| 伊川县| 岳西县| 涡阳县| 文成县|