OSB 自定义XPath Function

此文翻译、整理出自<OSB Cookbook>自定义XPath函数章

1 编写你自己要实现的java类,将其打包成jar.
package osbcookbook.util.checksum;

import  java.util.zip.CRC32;
import  java.util.zip.Checksum;

public  class  ChecksunUtil {
       
         public  static  long  calculateChecksum (String data) {
              Checksum checksum =  new  CRC32();
              checksum.update(data.getBytes(), 0, data.getBytes().  length );
                return  checksum.getValue();
       }
}

2 复制%Middleware_HOME%\Oracle_OSB1\config\xpath-functions下的osb-build-in.xml,修改<xpf:function/>元素,定义我们自己的xpath函数,更改文件名.保存
<?xml version="1.0" encoding="UTF-8"?>
<xpf:xpathFunctions xmlns:xpf="http://www.bea.com/wli/sb/xpath/config">
    <xpf:category id="%OSB_FUNCTIONS%">
        <xpf:function>
             <xpf:function>
            <xpf:name>calculateChecksum</xpf:name>
            <xpf:comment>Return the checksum of the given string passed as parameter</xpf:comment>
            <xpf:namespaceURI>http://osbcookbook.org/xquery/xquery-functions</xpf:namespaceURI>
            <xpf:className>osbcookbook.util.checksum.</xpf:className>
            <xpf:method>long calculateChecksum(java.lang.String)</xpf:method>
            <xpf:isDeterministic>true</xpf:isDeterministic>
            <xpf:scope>Pipeline</xpf:scope>
            <xpf:scope>SplitJoin</xpf:scope>
        </xpf:function>
        </xpf:function>
    </xpf:category>
</xpf:xpathFunctions>

4 将我们编写的jar包放在%Middleware_HOME%\Oracle_OSB1\config\xpath-functions文件夹下


5 重启OSB项目在所domain的Weblogic server,重启OEPE.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值