对称DS和Java [英] Symmetric DS and Java

查看:152
本文介绍了对称DS和Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过扩展它提供的接口来扩展对称DS功能.有谁知道开发过程应该是什么?在文档中,它仅说明将JAR文件放在何处(包含扩展接口的类)以及如何将其添加到spring上下文中,而没有说明如何开发它们.即需要哪些库来获取接口,以及应该遵循什么过程来进行开发/测试.每次修改并构建jar文件,然后将其复制到对称服务器文件夹中进行测试,似乎很麻烦.

I need to extend Symmetric DS functionality by extending the interfaces it provides. Does anyone has any idea what the development process should be? In the documentation it only explains where to put the JAR file (containing the classes extending the interfaces) and how to add them to spring context but doesnt explain how to develop them. i.e. what libraries are needed to get the interfaces and what process should be followed to develop/test. It seems very cumbersome to each time modify and build the jar file then copy it to the symmetricds server folder to test.

请问有人对此有任何经验吗?谢谢

Does anyone has any experience with this please? thanks

推荐答案

在默认包中扩展类DatabaseWriterFilterAdapter,即在实现的顶部没有package ...;.如果您需要访问数据库,请实现接口ISymmetricEngineAware并覆盖其设置程序void setSymmetricEngine(ISymmetricEngine),该设置程序将在初始化时由Spring调用.将您的编写器过滤器实现命名为例如MyWriterFilter.

Extend the class DatabaseWriterFilterAdapter in a default package, i.e. no package ...; at the top of the implementation. If you need to access the db implement the interface ISymmetricEngineAware and override its setter void setSymmetricEngine(ISymmetricEngine) that will be called by Spring upon initialization. Name your writer filter implementation for example MyWriterFilter.

覆盖实现任何必要转换的方法boolean beforeWrite(DataContext, Table, CsvData)boolean afterWrite(DataContext, Table, CsvData)中的一个或两个.

Override either one or both methods boolean beforeWrite(DataContext, Table, CsvData) or boolean afterWrite(DataContext, Table, CsvData) implementing whatever transformation necessary.

找到文件ftp-extensions.xml,并在同一目录中添加子目录conf.将文件symmetric-extensions.xml添加到该conf子目录,其内容为:

Find the file ftp-extensions.xml and in the same directory add a subdirectory conf. Add a file symmetric-extensions.xml to that conf subdirectory with content:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
       default-lazy-init="true">
  <bean id="myWriterFilter" class="MyWriterFilter" />
</beans>

使用jUnit测试和某些功能测试(作为对分布式系统执行同步的对称D的一部分)对类MyWriterFilter进行测试,就像其他任何类一样.

Test the class MyWriterFilter as any other class with jUnit tests and with some functional tests as part of symmetricDs performing syncing for your distributed system.

这篇关于对称DS和Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆