PE开发基础:

开发平台PowerEngine:

开发新功能:

业务逻辑处理:

1、Transaction:交易
2、Chain:链、责任链
3、Command:命令
4、Template:模板
5、Action:动作

PE交易处理流程:

无论一个交易的发送渠道是HTTP还是TCP,最终针对每一个渠道的Adapter会将请求的Form(HTTP)或报文(TCP)转换成与渠道无关的Context。
当渠道Adapter将数据转换为渠道无关的Context后,将控制权交给PowerEngine核心控制模块,根据该交易的交易Id,来确认该交易需要经过的处理过程。
  1. 首先执行Chain中的一系列Commands,若有其中一个Command认为需结束处理,则处理立刻结束;
  2. 当Chain执行到Delegate Command时,开始执行Template;
  3. 不同的Template会调用不同的Actions,以完成实际的交易处理。

简言之,根据交易Id可以唯一地确定Template,根据Template可以唯一地确定Chain,一旦确定了Chain,系统就按流程图所示开始执行处理。

总结:首先根据<transcation>中的id号,找到模板(template),然后再根据模板找到责任链(chain),一旦确认chain就按照流程图执行,从chain中执行command,执行到deletegatecommand后结束,跳到模板,再去执行<action>,然后跳转到相应的jsp页面。(/posweb/WebContent/WEB-INF/zh_CN/pos/LoanBaseInformationQuery.jsp)

Transaction:

一个业务处理功能的入口。
关键点:
    交易id
    引用的模板
    定义的action
    数据交验
    返回页面的渠道
transaction定义:
[html] view plain copy

 
  1. <transaction id=“preManagerAdd" template="引用的模版Id">
  2. <!--交易级定义的Actions.由模版来确定这些Actions的调用方法。-->
  3. <actions>
  4. <ref name="act01" >交易级定义的Action</ref>
  5. </actions>
  6. <!--对每一个域的有效性检查-->
  7. <fields>
  8. <field name="域名1">Style名称</field>
  9. 。。。
  10. </fields>
  11. <!--渠道的定义-->
  12. <channels>
  13. <!--HTTP渠道的定义-->
  14. <channel type="http">
  15. <param name="success">result.jsp</param>
  16. ......
  17. </channel>
  18. </channels>
  19. </transaction>
 
举例:posaction工程
/posaction/src/config/pos/trs/pos.xml
[html] view plain copy

 
  1. <transaction id="LoanBaseInformationQuery" template="queryTemplate">
  2. <description>
  3. @funcName
  4. @trsName 贷款基本信息查询
  5. @author
  6. @version 1.0
  7. @remark
  8. @fromPages
  9. </description>
  10. <actions>//交易级的action
  11. <ref name="action">LoanBaseInformationQueryAction</ref>
  12. </actions>
  13. <fields>
  14. <field name="ContractNo"></field>
  15. </fields>
  16. <channels>
  17. <channel type="http">
  18. <param name="success">pos/LoanBaseInformationQuery</param>
  19. </channel>
  20. </channels>
  21. </transaction>
  22. <action id="LoanBaseInformationQueryAction"
  23. class="com.csii.ibs.pos.action.LoanBaseInformationQueryAction" parent="BaseQueryAction">
  24. </action>

Template:

Template定义:
<template id="模版Id" class="Full qualified class name of this Template" chain="引用的责任链Id">
各个Template:
emptyTemplate(空模板):
pageLoaderTemplate(初始化模板):
queryTemplate(查询模板)
trsConfirmTemplate(确认模板)
twoPhaseTrsTemplate(防重复提交)
entryTrsWorkflow(审核提交模板)
 
*交易级同名的Action将覆盖模版级
 
/poscommon/src/config/template.xml
[html] view plain copy

 
  1. <template id="queryTemplate" class="com.csii.pe.template.ExecutableSequenceTemplate" chain="chainForRoleControlMV">
  2. <actions>//模板级的action
  3. <ref name="action">Placeholder</ref>
  4. <ref name="preAction">WriteQueryTrsJournal</ref>
  5. </actions>
  6. </template>

Chain:

系统级的交易逻辑抽象,如:交易的权限、登陆控制、日志和输入检查等 。
Chain定义:
<chain id="chain Id.">
<commands>
<ref>引用的command Id.</ref>
.......
</commands>
</chain>
-------------------------------------------------------------------------------------------------------------
/poscommon/src/config/chain.xml
[html] view plain copy

 
  1. <chain id="chainForRoleControlMV">
  2. <commands>
  3. <ref>MultiVersionViewCommand</ref>
  4. <ref>roleControlCommand</ref>
  5. <ref>validationCommand</ref>
  6. <ref>ruleCommand</ref>
  7. <ref>delegateCommand</ref>
  8. <ref>${chain.monitor}</ref>
  9. </commands>
  10. </chain>

Command:

Command定义:

<command id="command Id." class=" Full qualified class name of this Template" />
系统默认定义的commands:

  • DelegateCommand:每一个Chain必须有一个而且仅限于一个DelegateComand;
  • ValidationCommand:执行系统级的基于Style的有效性检查;
  • LoginControlCommand:用于控制用户访问服务的频率,主要用于登录交易。
  • RoleControlCommand:用于控制用户访问服务的权限,主要用于控制需要用户登录的交易的权限控制。对不需要用户登录的交易,不用该Command。
/poscommon/src/config/chain.xml
[html] view plain copy

 
  1. //......
  2. <command id="delegateCommand" class="com.csii.pe.chain.command.DelegateCommand" />
  3. //.......

Action:

Action是PowerEngine业务处理的最小单元,Action也是具体单个应用开发者需要直接面对的对象,通过Action实现交易单元处理,是交易的具体动作。
Action的定义:
<action id=“action Id” class=“Full qualified class name of this action”>   
<param name="property name">property value</param>
......
<ref name="property name">引用的对象的Id</ref>
......
</action>
 
Action只是一个Marker Interface。为了Action能进行特定的处理,开发人员应该实现相应的Interface。
init ()
Execute()
Submit()
Prepare()
 

Bean定义继承方式:

[html] view plain copy

 
  1. <action id="BaseQueryAction" class="com.csii.ibs.action.IbsQueryAction">
  2. <ref name="trsCodeResolver">hostTrsCodeResolver</ref>
  3. <ref name="returnCodeValidator">hostReturnCodeValidator</ref>
  4. <ref name="transportBean">${BaseQueryAction.hostTransportBean}</ref>
  5. </action>
  6. 继承
  7. <action id="ActBalAction" class="com.csii.ibs.query.action.ActBalAction" parent="BaseQueryAction">
  8. </action>
  9. 等同
  10. <action id="ActBalAction" class="com.csii.ibs.query.action.ActBalAction" parent="BaseQueryAction">
  11. <ref name="trsCodeResolver">hostTrsCodeResolver</ref>
  12. <ref name="returnCodeValidator">hostReturnCodeValidator</ref>
  13. <ref name="transportBean">${BaseQueryAction.hostTransportBean}</ref>
  14. </action>

Action:

BaseQueryAction(IbsQueryAction)
BaseTwoPhaseAction(IbsTwoPhaseAction)
CachedPagableQueryAction
DBPagableQueryAction

/poscommon/src/config/action.xml
[html] view plain copy

 
  1. <action id="WriteQueryTrsJournal" class="com.csii.ibs.common.jnl.WriteQueryTrsJournal">
  2. <ref name="idFactory">idFactory</ref>
  3. <param name="jnlSql">common.insertQryLog</param>
  4. </action>

PE框架学习的更多相关文章

  1. PE框架学习之道:PE框架——发送报文流程

    PE框架发送报文,适用于PE及VX技术 步骤: 1.在action中使用发送报文,要指定报文在router端的交易名称 2.如果使用supe.execute(context)来发送,不需要第一步 3. ...

  2. PE框架学习之道:PE框架——style的配置

    1.在style.xml中定义style     <style id="NumberStyle"> <setting> <param name=&qu ...

  3. 框架学习之道:PE框架简介

    1.PE框架开发新功能所需的部分 2.PE框架工作流程(重要) 首先根据<transcation>中的id号,找到模板(template),然后再根据模板找到责任链(chain),一旦确认 ...

  4. Android接口和框架学习

    Android接口和框架学习 缩写: HAL:HardwareAbstraction Layer.硬件抽象层 CTS:CompatibilityTest Suite,兼容性測试套件 Android让你 ...

  5. IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习保护API

    IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习之保护API. 使用IdentityServer4 来实现使用客户端凭据保护ASP.N ...

  6. Hadoop学习笔记—18.Sqoop框架学习

    一.Sqoop基础:连接关系型数据库与Hadoop的桥梁 1.1 Sqoop的基本概念 Hadoop正成为企业用于大数据分析的最热门选择,但想将你的数据移植过去并不容易.Apache Sqoop正在加 ...

  7. Spring框架学习一

    Spring框架学习,转自http://blog.csdn.net/lishuangzhe7047/article/details/20740209 Spring框架学习(一) 1.什么是Spring ...

  8. EF框架学习手记

    转载: [ASP.NET MVC]: - EF框架学习手记 1.EF(Entity Framework)实体框架EF是ADO.NET中的一组支持开发面向数据的软件应用程序的技术,是微软的一个ORM框架 ...

  9. web框架学习列表

    转载自鲁塔弗的博客,原文网址:http://lutaf.com/148.htm web framework层出不穷,特别是ruby/python,各有10+个,php/java也是一大堆 根据我自己的 ...

随机推荐

  1. 设置tomcat配置文件,在Myeclipse中修改jsp文件之后不用重启tomcat

    在Myeclipse中创建的Web程序在修改类或者jsp页面后需要重动ttomcat的,要重新加载一次的,即重新启动tomcat一次.重启时比较慢,及浪费资源及时间, 设置tomcat配置文件,在My ...

  2. LXD 2.0 系列(一):LXD 入门

    LXD是提供了RESTAPI的LXC 容器管理器,主要是管理linux容器的第三方管理器.也许现在您还没有听说过,下面我们就来入门——介绍一下LXD 什么是 LXD ? 简单地说,LXD 就是一个提供 ...

  3. Linux挂载命令mount用法及参数详解

    导读 mount是Linux下的一个命令,它可以将分区挂接到Linux的一个文件夹下,从而将分区和该目录联系起来,因此我们只要访问这个文件夹,就相当于访问该分区了. 挂接命令(mount) 首先,介绍 ...

  4. Grunt的配置及使用(压缩合并js/css)

    Grunt的配置及使用(压缩合并js/css) 安装 前提是你已经安装了nodejs和npm. 你能够在 nodejs.org 下载安装包安装.也能够通过包管理器(比方在 Mac 上用 homebre ...

  5. LeetCode 303 Range Sum Query - Immutable(范围总和查询-永久不变)(*)

    翻译 给定一个整型数组nums,找出在索引i到j(i小于等于j)之间(包含i和j)的全部元素之和. 比如: 给定nums = [-2,0,3,-5,2,-1] sumRange(0, 2) -> ...

  6. SqlInXml 动态配置化

    XML 描述方式. 整合Ognl+IBatis 根据Map型的输入参数, 动态组装Sql语句. 使用sqlRoot的 source="mysql01" 配置, 将自动读取mysql ...

  7. GCC高级测试功能扩展——程序性能测试工具gprof、程序覆盖测试工具gcov

    gprof是GNU组织下的一个比较有用的性能测试功能: 主要功能:   找出应用程序中消耗CPU时间最多的函数: 产生程序运行时的函数调用关系.调用次数 基本原理:   首先用户要使用gprof工具, ...

  8. Linux ext2/ext3文件系统详解

    转载: Linux ext2/ext3文件系统使用索引节点来记录文件信息,作用像windows的文件分配表.索引节点是一个结构,它包含了一个文件的长度.创建及修改时间.权限.所属关系.磁盘中的位置等信 ...

  9. linux动态链接库导出函数控制

    windows 环境的vc的话,可以方便的指定__declspec(dllexport) 关键字来控制是否把dll中的函数导出.我也来测试一下linux下面是如何做的:先看gcc 和ld的相关选项 = ...

  10. Linux环境下的make和makefile详解

    无论是在Linux还是在Unix环境中,make都是一个非常重要的编译命令.不管是自己进行项目开发还是安装应用软件,我们都经常要用到make或make install.利用make工具,我们可以将大型 ...