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软件库是一 ...
 
随机推荐
- java String 空指针异常
			
如下代码中,第8行和第10行均会提示Exception in thread "main" java.lang.NullPointerException. 第12行的写法可行. im ...
 - *[topcoder]IncrementingSequence
			
http://community.topcoder.com/stat?c=problem_statement&pm=12107 此题想了半天,当时瞥到了Greedy,所以就想着贪心,最后的方法 ...
 - [mock]7月25日
			
1. 将一个数组分成左右两部分,使得右边的某个连续子段和减去左边的某个连续字段和最小[7,8,9,|3,5,-1] sum right - sum left minimal 想到左右分一刀,O(n), ...
 - centos下hadoop2.6.0集群搭建详细过程
			
一 .centos集群环境配置 1.创建一个namenode节点,5个datanode节点 主机名 IP namenodezsw 192.168.129.158 datanode1zsw 192.16 ...
 - 8、双向一对多的关联关系(等同于双向多对一。1的一方有对n的一方的集合的引用,同时n的一方有对1的一方的引用)
			
双向一对多关联关系 “双向一对多关联关系”等同于“双向多对一关联关系”:1的一方有对n的一方的集合的引用,同时n的一方有对1的一方的引用. 还是用客户Customer和订单Order来解释: “一对多 ...
 - 2、JPA的HelloWorld
			
这一节写一个JPA的HelloWorld来体验一下. 一.建立工程 按照 1.创建一个JPA project(解决“at least one user library must be selected ...
 - netty websocket协议开发
			
websocket的好处我们就不用多说了,就是用于解决长连接.服务推送等需要的一种技术. 以下我们来看一个例子: package com.ming.netty.http.websocket; impo ...
 - [CF676C]Vasya and String(尺取法,原题)
			
题目链接:http://codeforces.com/contest/676/problem/C 原题题解链接:http://www.cnblogs.com/vincentX/p/5405468.ht ...
 - grunt + compass retina sprites
			
https://github.com/AdamBrodzinski/Retina-Sprites-for-Compass
 - find-all-duplicates-in-an-array(典型的数组中的重复数,不错,我做出来了,可是发现别人有更好的做法)
			
https://leetcode.com/problems/find-all-duplicates-in-an-array/ 典型的数组中的重复数.这次是通过跳转法,一个个跳转排查的.因为查过的不会重 ...