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软件库是一 ...
随机推荐
- Linux查看随机启动服务
Liunx操作系统跟Windos XP一样,有一批系统服务随机而启动:略懂电脑的Windows XP用户会禁止那些不必要的服务,以提高开机速度:如今安装了Ubuntu操作系统,咱们也有必要了解Ubun ...
- 分享一个安装PE到硬盘的软件
Ton8pe_v5.0下载地址:http://pan.baidu.com/share/link?shareid=424350&uk=4180312589 电脑是XP,有光驱,但是没win8.1 ...
- lintcode:Palindrome Partitioning 分割回文串
题目: 分割回文串 给定一个字符串s,将s分割成一些子串,使每个子串都是回文串. 返回s所有可能的回文串分割方案. 样例 给出 s = "aab",返回 [ ["aa&q ...
- iOS开发--计时器-NSTimer与CADisplayLink
如果程序要让某个方法重复执行,可以借助定时器来完成.CADisplayLink是一个能让我们以和屏幕刷新率相同的频率将内容画到屏幕上的定时器,NSTimer的精确度低了点,比如NSTimer的触发时间 ...
- Android:AlertDialog对话框
1.简单的ALertDialog: Dialog alertDialog = new AlertDialog.Builder(this) .setTitle("标题") .setM ...
- java:接口实例
接口:打印机接口 interface Printer { public void read(); } 函数一:佳能打印机 class CanPrinter implements Printer { p ...
- HDU5087——Revenge of LIS II(BestCoder Round #16)
Revenge of LIS II Problem DescriptionIn computer science, the longest increasing subsequence problem ...
- DAO设计模式 -- 使用数据库连接类连接MySql数据库并实现添加用户
1. DAO简介 DAO设计模式是属于J2EE数据库层的操作,使用DAO设计模式可以简化大量代码,增强程序的可移植性. 2. DAO各部分详解 DAO设计模式包括5个重要的部分,分别为数据 ...
- Java API —— 反射
1.类加载器 1)类的加载 · 当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过加载,连接,初始化三步来实现对这个类进行初始化. · 加载 :就是 ...
- Android下HelloWorld项目的R.java文件介绍
R.java文件介绍 HelloWorld工程中的R.java文件 package com.android.hellworld; public final class R { public s ...