...
The Remote Data Transfer Module provides a platform for other modules to transmit data between OpenMRS installations with ease. It also provides stand-alone functionality for transmitting user selected files to other OpenMRS installations via the web interface.
[edit]
How to use the modules user interface (UI)
After installing the latest version of the Remote Data Transfer (RDT) Module .omod file into your OpenMRS via the standard module installation procedure, links to following pages will appear on the OpenMRS Adminstration page.[edit]
Configuration
This page allows you to configure the current server and any destination servers that you wish to send data to.
...
- Description (Optional): A short description of the remote server.
[edit]
Send File
This page is used for sending single files of any type to a specific server.
...
Clicking Add will add the file to the queue. The to initiate the actual sending process either one of the Online or Offline methods should be used (described below).[edit]
Online Transfer
Online transfer will immediately send all queue items to the selected servers. The transmitting and receiving servers must be connected by a network for this to work. Where no network connection is available offline transfer can be used.
[edit]
Offline Transfer
Here data for selected servers can be downloaded as a single file and transferred manually to the remote server (via USB Pen or equivalent). Simply select the server to download items for in “Download Transfer Data File” and choose where you want to save the file. On the receiving end the file can be uploaded by clicking browse, selecting the transfer file, and then clicking upload. It is necessary to make a return trip with data from the remote server to the local server before the data can be confirmed as sent (See “Status”below).[edit]
View Transfers
This page keeps a track of all data sent or waiting to be sent, as well as data received from other servers. The columns in the table are self explanatory but there are a few things to note.
...
-note: when data is received from a server that is not configured it will automatically be created as a server. (only serverId will be recorded, other information can be filled out later manually)[edit]
How to use the application programming interface (API)
The following information will guide you through setting up and getting started with using Remote Data Transfer (RDT) Module within your own module.[edit]
Setup
Prerequisites – The latest version of the RDT Module .omod file should be downloaded and included in the classpath of your module.
Require Module – The following code should be placed in yours config.xml file to insure that RDT is always loaded before your module can be installed in the OpenMRS system. This will insure that you are always able to register listeners with the module when the system is started (see below for registering listeners).<require_modules>
<require_module>org.openmrs.module.remotedatatransfer</require_module>
</require_modules>
Implement RemoteDataTransferListener – To be informed of when new data arrives for your module it is necessary to implement a listener. This is a class that inplements the RemoteDataTransferListener interface. An example of what this class might look like is below. The main function of this class is to allow code from within your module to be executed when data arrives that has been tagged with the tags that your module is setup to listen for. These tags are also specified in your implementation of this interface:
Code Block |
---|
public class TestModule Listener implements RemoteDataTransferListener { protected final Log log = LogFactory.getLog(getClass()); @Override public void dataReceived(RemoteDataTransferReceivedItem receivedItem) { //PERFORM ACTIONS HERE } @Override public List<String> getSupportedTags() { String\[\] list = {"kdmtestmodule1","kdmtestmodule2"}; return Arrays.asList(list); } } |
dataReceived – This method is executed when data is received that has been taggeed with any of the tags in getSupportedTags. The appropriate RemoteDataTransferReceivedItem is made available via a parameter. Some of the most useful properties of this object are listed:
...
Register Listener – In order for the listener that has been implemented to be registered with RDT the following code must be added in yours module's moduleApplicationContext.xml.
Code Block |
---|
<bean class="org.openmrs.module.remotedatatransfer.impl.RemoteDataTransferServiceImpl">
<property name="listener">
<bean id="moduleListener" class=" (MODULE_PACKAGE).ModuleListener"/>
</property>
</bean>
|
note
...
-
...
ModuleListener
...
should
...
be
...
replaced
...
by
...
the
...
name
...
of
...
your
...
implemented
...
module
...
listener
...
class.
...
[edit]
Service/API Methods
After setting up the module API functions are made available by starting the RDT service. This is done as follows:
Code Block |
---|
RemoteDataTransferService service = Context.getService(RemoteDataTransferService.class); |
Now service methods can be called using the newly created service object. For example to send data:
Code Block |
---|
service.sendData("DATA0101", service.getServer("SERVER001"),"TAG1"); \\ |
[edit]
Known Issues
Out of memory error
...
If you are receiving this error message when trying to send files you will need to increase the max_allowed_packet size in mysql.[edit]
Resources
...