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软件库是一 ...
随机推荐
- Android 动画的重复播放
如果你要的加载xml方式设置动画,而且在xml定义了好几个动画元素比如:<set> <alpha android:repeatCount="-1" andr ...
- hdu2544 最短路
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2544 最短路径DIJKSTRA #include<stdio.h> #include<m ...
- 表单验证插件——validate
表单验证插件——validate 该插件自带包含必填.数字.URL在内容的验证规则,即时显示异常信息,此外,还允许自定义验证规则,插件调用方法如下: $(form).validate({options ...
- Exception in thread "AWT-EventQueue-0" java.lang.IllegalThreadStateException
在线程中出现这种错误的原因是多次启动start() 解决方法: 将start()改成 run()
- cojs 简单的01串 题解报告
题意显然是求n位二进制串中不大于其逆序串,取反串,逆序取反串的所有串按字典序排序后的第k个 由于n很小,k很大所以我们可以考虑逐位确定 问题转化为了求方案数,这显然是可以用数位DP做的 设f[len] ...
- 欧拉工程第70题:Totient permutation
题目链接 和上面几题差不多的 Euler's Totient function, φ(n) [sometimes called the phi function]:小于等于n的数并且和n是互质的数的个 ...
- ibatis缓存初探(1)
一,IBATIS 缓存机制使用 1,sqlMapConfig.xml中配置 1.SqlMapConfig.xml中 <settings cacheModelsEnabled="tr ...
- netty是什么?
Netty是什么? 相对于Tomcat这种Web Server(顾名思义主要是提供Web协议相关的服务的),Netty是一个Network Server,是处于Web Server更下层的网络框架,也 ...
- QC、IQC、IPQC、FQC、OQC
品质政策为:全面品管.贯彻制度.提供客户需求的品质:全员参与.及时处理.以达成零缺点的目标. 品质三不政策为:不接受不良品.不制造不良品.不流出不良品. QC即英文QUALITY CONTROL的简称 ...
- C++工具系列博文合集
http://www.cnblogs.com/itech/category/240779.html