Apache OFBiz 学习笔记 之 服务引擎 一
<!-- Service Engine Configuration -->
<engine name="entity-auto" class="org.ofbiz.service.engine.EntityAutoEngine"/>
<engine name="group" class="org.ofbiz.service.group.ServiceGroupEngine"/>
<engine name="interface" class="org.ofbiz.service.engine.InterfaceEngine"/>
<engine name="java" class="org.ofbiz.service.engine.StandardJavaEngine"/>
<engine name="simple" class="org.ofbiz.minilang.SimpleServiceEngine"/>
<engine name="script" class="org.ofbiz.service.engine.ScriptEngine"/>
<!-- Engines that can be replaced by the generic script engine -->
<engine name="bsh" class="org.ofbiz.service.engine.BeanShellEngine"/>
<engine name="groovy" class="org.ofbiz.service.engine.GroovyEngine">
<parameter name="scriptBaseClass" value="org.ofbiz.service.engine.GroovyBaseScript"/>
</engine>
<engine name="jacl" class="org.ofbiz.service.engine.BSFEngine"/>
<engine name="javascript" class="org.ofbiz.service.engine.ScriptEngine"/>
<engine name="jpython" class="org.ofbiz.service.engine.BSFEngine"/>
<!-- -->
<engine name="route" class="org.ofbiz.service.engine.RouteEngine"/>
<engine name="http" class="org.ofbiz.service.engine.HttpEngine"/>
<engine name="jms" class="org.ofbiz.service.jms.JmsServiceEngine"/>
<engine name="rmi" class="org.ofbiz.service.rmi.RmiServiceEngine"/>
<engine name="soap" class="org.ofbiz.service.engine.SOAPClientEngine"/>
<engine name="ofbiz-workflow" class="org.ofbiz.workflow.WorkflowEngine"/>
<engine name="workflow" class="org.ofbiz.shark.service.SharkServiceEngine"/>
|
属性名
|
是否必须
|
描述
|
|
name
|
Y
|
服务引擎的名字,必须唯一
|
|
class
|
Y
|
GenericEngine接口的实现类
|
<!-- Name of the service to use for authorization -->
<authorization service-name="userLogin"/>
服务位置:
<service-location name="main-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="main-http" location="http://localhost:8080/webtools/control/httpService"/> <service-location name="entity-sync-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="entity-sync-http" location="http://localhost:8080/webtools/control/httpService"/> <service-location name="rita-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="eedcc-test" location="http://localhost:8080/webtools/control/httpService"/>
<!-- Thread pool configuration (max/min threads, uses to live and time to live) -->
<thread-pool send-to-pool="pool"
purge-job-days="4"
failed-retry-min="3"
ttl="18000000"
wait-millis="750"
jobs="10"
min-threads="5"
max-threads="15"
poll-enabled="true"
poll-db-millis="20000">
<run-from-pool name="pool"/>
</thread-pool>
|
属性名
|
是否必须
|
描述
|
|
Ttl
|
Y
|
每个请求线程的存活时间。达到时间线程将被销毁
|
|
wait-millis
|
Y
|
每个请求线程在检查通过运行前休眠的时间
|
|
jobs
|
Y
|
每个请求线程在销毁之前可运行的工作数
|
|
min-threads
|
Y
|
线程池中保持的请求线程的最小数
|
|
max-threads
|
Y
|
线程池中将会创建请求线程的最大数
|
| poll-enabled | Y | 为‘true’scheduler就会poll数据库来调度工作 |
| poll-db-millis | Y | 如果线程池可用,本属性用来定义池化线程运行的频率 |
<service name="createNote" engine="java"
location="org.ofbiz.common.CommonServices" invoke="createNote">
<description>Create a new note record</description>
<attribute name="partyId" type="String" mode="INOUT" optional="true"/>
<attribute name="noteName" type="String" mode="IN" optional="true"/>
<attribute name="note" type="String" mode="IN" allow-html="safe"/>
<attribute name="noteId" type="String" mode="OUT"/>
</service>
|
属性
|
是否必须
|
说明
|
缺省值
|
|
name
|
Y
|
服务的唯一名称
|
|
|
engine
|
Y
|
引擎的名称(在serviceengine.xml中定义)
|
|
|
location
|
N
|
位置或服务包类的包名
|
|
|
invoke
|
N
|
服务的方法名
|
|
|
auth
|
N
|
服务是否要求授权?(true/false)
|
true
|
| debug | N | 当调用服务时,是否启动详细调试?(true/false) | true |
| default-entity-name | N | 使用自动属性(auto-attribute)的缺省实体 | |
| export | N | 这个服务是否允许通过SOAP/HTTP/JMS访问?(true/false) | false |
| validate | N | 是否对服务参数的名字和类型进行验证?(true/false) | true |
| max-retry | N | 异步调用服务失败时,最大重复次数 | -1(无限次) |
| use-transaction | N | 是否使用事务 | true |
| require-new-transaction | N | 在使用事务的情况下是否启动新事务 | true |
| semaphore | N | 并发调用服务时使用的信号量: none:当多个线程调用服务时,并发执行服务 wait:当多个线程调用服务时,采用排队的方法调用服务 fail:当服务正在被执行时,其他任何试图要调用该服务的线程都将调用失败 |
none |
| semaphore-wait-seconds | N | 当sempaphore="wait"时,调用服务的线程要等待的超时时间, 超时调用失败 |
300 |
| semaphore-sleep | N | 当sempaphore="wait"时,1毫秒内做几次检查 (检查服务能否被调用) |
300 |
| transaction-timeout | N | 该服务的事务超时时间,当该服务启动新事务才有效 | 0 |
|
属性
|
是否必须
|
描述
|
缺省值
|
|
name
|
Y
|
这个是属性的名字
|
|
|
type
|
Y
|
对象的类型(String,java.util.Date)等
|
|
|
model
|
Y
|
这个参数是输入、输出或输入输出(IN/OUT/INOUT)
|
|
|
optional
|
N
|
这个参数是否可选?(true/false)
|
false
|
|
default-value
|
N
|
默认值
|
|
| form-label | N | 对应的表单项显示名称 | |
| entity-name | N | 对象名 | |
| field-name | N | 属性名 | |
| string-map-prefix | N | Map类型参数的前缀 | |
| string-list-prefix | N | List类型参数的后缀 | |
| form-display | N | 是否在表单中显示?(true/false) | true |
我们参考几个service的定义看看service
<!-- simple condition implementation -->
<service name="effectiveDateEcaCondition" engine="java" auth="false" use-transaction="false"
location="org.ofbiz.service.ServiceUtil" invoke="genericDateCondition">
<implements service="serviceEcaConditionInterface"/>
<attribute name="fromDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
<attribute name="thruDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
</service>
参考二:applications/accounting/servicedef/services_finaccount.xml
<service name="refundGcPurchase" engine="java" require-new-transaction="true" use-transaction="true"
location="org.ofbiz.accounting.payment.GiftCertificateServices" invoke="refundGcPurchase" auth="true">
<description>Creates return for reload on failure</description>
<attribute name="orderItem" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
</service>
参考三:framework\service\servicedef\services.xml
<!-- Service Engine Services -->
<service name="purgeOldJobs" engine="java"
location="org.ofbiz.service.ServiceUtil" invoke="purgeOldJobs" auth="true" use-transaction="false" semaphore="wait">
<description>Cleans out old jobs which have been around longer then what is defined in serviceengine.xml</description>
<required-permissions join-type="AND">
<check-permission permission="SERVICE_INVOKE_ANY"/>
</required-permissions>
<!-- this service has no attributes -->
</service>
Apache OFBiz 学习笔记 之 服务引擎 一的更多相关文章
- Apache OFBiz 学习笔记 之 服务引擎 二
加载服务定义文件 ofbiz-component.xml:所有的服务定义文件在每个组件的ofbi-component.xml文件中 加载服务定义 例:framework/common/ofbi ...
- Apache OFBiz 学习笔记 之 实体引擎
1.概述 entity engine和常见的ORM有一点很大的不同,他的mapping object只有一个 GenericEntity,称它的entity engine 为adaptive ...
- Apache Flink学习笔记
Apache Flink学习笔记 简介 大数据的计算引擎分为4代 第一代:Hadoop承载的MapReduce.它将计算分为两个阶段,分别为Map和Reduce.对于上层应用来说,就要想办法去拆分算法 ...
- SpringCloud学习笔记:服务支撑组件
SpringCloud学习笔记:服务支撑组件 服务支撑组件 在微服务的演进过程中,为了最大化利用微服务的优势,保障系统的高可用性,需要通过一些服务支撑组件来协助服务间有效的协作.各个服务支撑组件的原理 ...
- Apache Ignite 学习笔记(一): Ignite介绍、部署安装和REST/SQL客户端使用
Apache Ignite 介绍 Ignite是什么呢?先引用一段官网关于Ignite的描述: Ignite is memory-centric distributed database, cachi ...
- Dubbo -- 系统学习 笔记 -- 示例 -- 服务分组
Dubbo -- 系统学习 笔记 -- 目录 示例 想完整的运行起来,请参见:快速启动,这里只列出各种场景的配置方式 服务分组 当一个接口有多种实现时,可以用group区分. <dubbo:se ...
- 树莓派学习笔记——Restful服务 采用slim php apache
0.前言 前些时间沉迷于Restful,采用PHP+Slim+MySQL实现了一些简单的API函数.但是这些工作都是在windows中实现(采用wamp server集成安装包),但是转到li ...
- Apache Lucene学习笔记
Hadoop概述 Apache lucene: 全球第一个开源的全文检索引擎工具包 完整的查询引擎和搜索引擎 部分文本分析引擎 开发人员在此基础建立完整的全文检索引擎 以下为转载:http://www ...
- Apache Hadoop学习笔记一
官网:http://hadoop.apache.org/ 1 什么是Hadoop? Apache™Hadoop®项目开发了用于可靠,可扩展的分布式计算的开源软件. Apache Hadoop软件库是一 ...
随机推荐
- SDUT 1220 完美数
完美数 Time Limit: 1000ms Memory limit: 65536K 题目描述 任何一个自然数的约数中都有1和它本身,我们把小于它本身的因数叫做这个自然数的真约数. 如6的所有真 ...
- struts2 json关于Date日期的解析
在get方法前加上: @JSON(format="yyyy-MM-dd HH:mm:ss")
- 此版本的 SQL Server 不支持用户实例登录标志。该连接将关闭“的解决
此版本的 SQL Server 不支持用户实例登录标志.该连接将关闭“的解决(转) 2008-10-04 13:31 错误提示:说明: 执行当前 Web 请求期间,出现未处理的异常.请检查堆栈跟踪信息 ...
- cv 论文(CNN相关)
最近发现很多以前看的论文都忘了,所以想写点东西来整理下之前的paper,paper主要是cv(computer vision)方向的. 第一篇:Gradient-based learning appl ...
- 对于linux下system()函数的深度理解(整理)
原谅: http://blog.sina.com.cn/s/blog_8043547601017qk0.html 这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同 ...
- ASP.NET中App_Code,App_Data等文件夹的作用
http://www.cnblogs.com/shiyu007/archive/2007/12/04/982264.html 1. Bin文件夹 Bin文件夹包含应用程序所需的,用于控件.组件或者需 ...
- 龙芯将两款 CPU 核开源,这意味着什么?
10月21日,教育部计算机类教学指导委员会.中国计算机学会教育专委会将2016 CNCC期间在山西太原举办“面向计算机系统能力培养的龙芯CPU高校开源计划”活动,在活动中,龙芯中科宣布将GS132和G ...
- hadoop拾遗(三)---- 多种输入
虽然一个MapReduce作业的输入可能包含多个输入文件(由文件glob.过滤器和路径组成),但所有文件都由同一个InputFormat和同一个Mapper来解释.然而,数据格式往往会随时间而演变,所 ...
- C#语句及案例
今天学习了,C#语句部分的分支语句,差点转不过弯来. 语句分类: 1.顺序语句 2.选择语句(分支语句) 3.循环语句 分支语句 (一)if(){} ; 按照顺序哪个if条件适合,执行哪个. 不合适就 ...
- jpa-hibernate配置转换
persistence.xml spring-demo-cfg.xml hibernate配置文件 Spring Data JPA:为简化JPA的开发提供帮助.EntityManager的创建与销毁. ...