File Transfer

This document describes how to configure the system to transfer transaction files between central and remote sites.

Web Transfer

If the central server is visible to the remote sites via the Internet or through a virtual private network then users can configure the system to transfer transaction files by communicating directly with the web server at central using the HTTP protocol. This form of file transfer has the advantage of being easy to set up, fast, and simple to manage the connection with existing firewalls.

Normally, the remote sites are installed as standalone programs instead of being run on a web server that is always running. In this situation, the remote sites have to initiate communication with the central site whose web application is always running. It is possible for the central site to initiate communication with each remote site but this is a rare configuration due to the requirement to have a web server running at every remote site.

Configuring Remote Sites

To configure a remote site to be able to communicate with the central web server take the following steps:

  1. Start the remote system by running go.bat from the installation folder (usually C:\EdmWeb).

  2. Log the remote user out and log in as a user with permission to edit the location table.

  3. Click Locations – Edit Locations and Groups to open the location form.

  4. Click in the Location ID field, press Ctrl-F to open the find dialog, enter 0, and press OK to find the location record for the central location (usually location 0).

  5. Set the Transfer host field to servername:8080/edm where servername is the name or IP address of the central web server and :8080 is the port number used by the server. The :8080 can be left off if the central web server uses the default port 80.

  6. Set the Transfer user id field to remote.

  7. Set the Transfer password field to remote.

  8. Set the Transfer company field to HQ (or whatever name you used for the central site you are communicating with).

Transferring Files

The system comes with a batch file called transfer_web.bat that transfers the transaction files, processes the transactions, and then transfers the results. Once the transfer fields have been filled in for the central location record, you can transfer and process transactions by simply running transfer_web.bat from the installation folder (usually C:\EdmWeb).

If the transfer does not appear to work for any reason, review the log.txt file in the installation folder (usually C:\EdmWeb\WEB-INF) to see the error information.

Transferring Directories

The system can keep entire directories synchronized between the central server and remote sites.

Updating a local directory to match a directory on the server

The updateLocalDirToMatchWebDir function can be used to synchronize a local directory with a directory on the server. This can be used to keep a directory of image or document files at remote sites synchronized with a directory on the server.

To send a transaction to tell remote sites to synchronize a local folder with a server folder when the server folder contents have changed, set up a menu item with an action like this:

sendEvaluateTransaction( 'updateLocalDirToMatchWebDir( ''files/images'', ''c:\edmweb\files\images'', true )', '1', '', '0-Default Package', '', true )

To have remote sites synchronize a local with a server folder every day, call the function in transfer_web.bat before the 'Exit()' function like this:

... updateLocalDirToMatchWebDir( 'files/images', 'c:\edmweb\files\images', true ) + Exit()

See updateLocalDirToMatchWebDir function documentation for details.

Updating a directory on the server to match a local directory

The updateWebDirToMatchLocalDir function can be used to update a directory on the server to match a local directory. This can be used to keep a directory of image or document files at remote sites synchronized with a directory on the server.

To send a transaction to tell remote sites to update a server folder to match a local folder, set up a menu item with an action like this:

sendEvaluateTransaction( 'updateWebDirToMatchLocalDir( ''files/images'', ''c:\edmweb\files\images'', true )', '1', '', '0-Default Package', '', true )

To have remote sites synchronize a local with a server folder every day, call the function in transfer_web.bat before the 'Exit()' function like this:

... updateWebDirToMatchLocalDir( 'files/images', 'c:\edmweb\files\images', true ) + Exit()

See updateWebDirToMatchLocalDir function documentation for details.

Amazon S3 Transfer

EDM can take advantage of the Amazon Simple Storage Service (S3) to leverage the power of cloud computing to transfer transaction files or entire directories between the central site and remote sites. S3 gives users access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon uses to run its own global network of web sites.

Setting up your Amazon account

Users will need to have their own Amazon Web Services (AWS) account with access to S3 to use the Amazon transaction file transfer.

The encryptAmazonCredentials function can be used to encrypt a property file containing the Amazon Web Services (AWS) access key and secret key. The encrypted credentials can then be passed to the functions that send and receive transaction files from Amazon S3 so that they can successfully log into AWS. The encrypted property file can be sent to remote sites so that they can also connect to AWS to send and receive transaction files without making the AWS access key and secret key visible to personnel at the site.

To create an encrypted AWS credentials file take the following steps:

  1. Create a file called aws.properties containing the lines below with your valid AWS account keys:
    accessKey = myaccesskey
    secretKey = mysecretkey
  2. Use the Upload File link on the EDM page to upload the file to the server (leave the server folder blank to upload the the webapps\edm\Files directory).
  3. Add an EDM menu item to encrypt the file with the name Encrypt Amazon Credentials and the action encryptAmazonCredentials( 'Files\aws.properties' ) and click the new menu item.
  4. Move the encrypted aws.properties file from the web server's webapps\edm\Files directory to the web-inf\classes directory to make it inaccessible to browser users.
  5. Copy the aws.properties file to the C:\EdmWeb folder at remote sites that will use S3.

See encryptAmazonCredentials function documentation for details.

Transferring central transaction files to and from Amazon S3

At central sites, the administrator can create a scheduled task to send any outgoing transaction files to S3 and receive any incoming files from S3 on a regular basis. To create a scheduled task to send and receive files every 15 minutes add a scheduled task to config.xml like this:

<schedule
	frequency = "TIMED"
	time = "1/1/2001 12:15 AM"
	task = "receiveTransactionFilesFromAmazon( '*', 
			'mybucket', 
			'incoming', 
			getPropertyFileValue( 'credentials', 'web-inf\classes\aws.properties' ) )
		+ sendTransactionFilesToAmazon( '*', 
			'mybucket', 
			'outgoing', 
			getPropertyFileValue( 'credentials', 'web-inf\classes\aws.properties' ) )"
/>

See sendTransactionFilesToAmazon and receiveTransactionFilesFromAmazon function documentation for details.

Transferring remote transaction files to and from Amazon S3

At remote sites, to use Amazon to transfer transaction files, put the encrypted AWS credentials properties file in the C:\EdmWeb directory and start EDM with a startup expression like the one shown below from transfer_amazon.bat:

call "C:\EdmWeb\go" "-expr=ShowWarnings(0) + ShowErrors(0) + receiveTransactionFilesFromAmazon( '*', 'mybucket', 'outgoing', getPropertyFileValue( 'credentials', 'aws.properties' ) ) + ProcessTransactions('*') + sendTransactionFilesToAmazon( '*', 'mybucket', 'incoming', getPropertyFileValue( 'credentials', 'aws.properties' ) ) + Exit()" "-nomenu"

To use the Amazon file transfer at remote sites, the remote user will need execute permission for the getPropertyFileValue, receiveTransactionFilesFromAmazon, and sendTransactionFilesToAmazon functions in the policy.xml file. These permissions have been added to the default policy file that is installed when EDM is installed.

Updating an S3 directory to match a directory on the central server

The updateAmazonDirToMatchLocalDir function updates an Amazon S3 directory to match a local directory. This can be used to easily update large numbers of files on Amazon S3, such as image or document files, so that remote sites can retrieve them with the updateLocalDirToMatchAmazonDir function. For example, if the central EDM web server has a directory with all the image files used by the POS system at remote sites, a directory on Amazon S3 can updated to match the server directory.

To update the S3 directory 'Files/Images' to match the local directory 'C:\Images',create an EDM menu item with an action like this:

updateLocalDirToMatchAmazonDir( 'Files/Images', 'C:\Images', true, 'mybucket', getPropertyFileValue( 'credentials', 'aws.properties' ) )

See updateAmazonDirToMatchLocalDir function documentation for details.

Updating a directory at a remote site to match a directory on S3

The updateLocalDirToMatchAmazonDir function updates a local directory to match a directory on Amazon S3. This can be used to easily update large numbers of files at remote sites such as image or document files. For example, if remote sites have a directory with all the image files used by the POS system, a directory can be created on S3 that contains the latest image files and the remote site can compare the directories periodically or on demand to download any new or updated files and delete any files that no longer need to be kept.

To update the local directory 'C:\Images' to match the S3 directory 'Files/Images' each day during end-of-day transaction processing, add the following expression to transfer_amazon.bat:

updateLocalDirToMatchAmazonDir( 'Files/Images', 'C:\Images', true, 'mybucket', getPropertyFileValue( 'credentials', 'aws.properties' ) )

If you only want the remote sites to synchronize a local directory with an S3 directory when the S3 directory has been updated then, after updating the S3 directory, use an EDM menu item to send an 'evaluate' transaction to the desired sites. When the sites process the transaction they will call the function to update the local directory to match the files in the directory on S3. The menu item action would be like this:

sendEvaluateTransaction( 'updateLocalDirToMatchAmazonDir( ''Files/Images'', 'C:\Images'', true, ''mybucket'', getPropertyFileValue( ''credentials'', ''aws.properties'' ) )', '', '', '', '', true )

See updateLocalDirToMatchAmazonDir function documentation for details.

FTP Transfer

If the central location and remote locations are not connected in some kind of virtual private network then some other mechanism must be used to transfer transaction files between the central and remote systems. The system can use the Internet's File Transfer Protocol (FTP) to transfer transaction files between locations and an FTP server. Typically, the remote locations will initiate the transfer because they process transactions automatically as part of their end of day process and, therefore, know when they are ready to send and receive transactions.

There are three ways to handle the FTP transfers:

Central FTP Server – The central system stores incoming and outgoing files in the home directory of the FTP server located on the local area network or even on the central system itself. Remote locations use FTP to transfer files to the FTP server on the central network. The FTP server must be visible to the remote locations either over the Internet or some sort of virtual private network. This is the simplest and most efficient configuration because it eliminates having to use FTP to transfer files from the central Outgoing and Incoming directories to the FTP server.

Internet FTP Server – Both the central and remote systems use FTP to transfer files to an FTP server on the Internet. This requires both the central and remote locations to have Internet access.

Remote FTP Servers – The central system uses FTP to transfer files to an FTP server running at each remote location. Remote systems store their incoming and outgoing files in the home directory of the FTP server located on the local area network or even on the remote system itself. The remote FTP servers must be visible to the central system either over the Internet or some sort of virtual private network.

The recommended way to set up the system is to run the FTP system on a computer that the central system can directly access via the network, or, if another computer is not available, on the central system computer.

Setting Up an FTP Server

In order to use FTP to transfer transaction files, the headquarters system and the remote systems must have access to an FTP server and must know the FTP host name, the userid, and password to access the server. It may be convenient to create a special user for the system that directs the user to a home directory created specially to hold the incoming and outgoing transaction files. For example, the FTP server administrator could create a user called TRANS whose home directory is the TRANS directory. The TRANS directory would contain an incoming and outgoing directory. Both the incoming and outgoing directories will contain a subdirectory for each remote location. The name of the subdirectory is the location id of the remote location.

Here's a sample directory layout for the FTP server using TRANS as the home directory:

\TRANS
    \Incoming
        \1
        \2
    \Outgoing
        \1
        \2

Central FTP Server

In the central FTP server configuration, the FTP server is located on the local area network or even on the central system itself. The central system stores incoming and outgoing files directly in the home directory of the FTP server. Remote locations use FTP to transfer files to the FTP server on the central network. The FTP server must be visible to the remote locations either over the Internet or some sort of virtual private network. This is the simplest and most efficient configuration because it eliminates having to use FTP to transfer files from the central Outgoing and Incoming directories to the FTP server.

System Requirements

Central system: Must be able to map a drive letter to the home directory of the FTP server (the default directory after logging in to the FTP server).

Remote system: Must be able to access the FTP server either over the Internet or some type of virtual private network.

Configuring The Central System

Configure the central system to use the FTP home directory by taking the following steps:

  1. Map a drive letter (like X:) to the FTP home directory.

  2. Click on Edit System Parameters on the Configuration tab.

  3. Set the Local Send Directory field to X:\TRANS\Outgoing\%REMOTELOCATIONID% (where X is the drive letter mapped to the home directory on the FTP server).

  4. Set the Local Receive Directory field to X:\TRANS\Incoming\%REMOTELOCATIONID% (where X is the drive letter mapped to the home directory on the FTP server).

  5. Note that the remote send directory and remote receive directory are not used in this configuration.

  6. If there are any files in the central system's local Incoming or Outgoing directories, move them to the directories on the FTP server.

Configuring the Remote System

Configure the remote system by taking the following steps:

  1. Start the system and click on View Application and enter the password (initially set to PSI).

  2. Click on the Forms tab and double-click on CDMConfiguration.

  3. Set the Remote Send Directory field to TRANS\Outgoing\%LOCALLOCATIONID%

  4. Set the Remote Receive Directory field to TRANS\Incoming\%LOCALLOCATIONID%

  5. Close the form.

  6. Double-click on the CDMLocationsAndGroups form.

  7. If the central location record (usually location id 0) is not displayed, move to the location record for the central location.

  8. Set the FTP Host (i.e. ftp.mycompany.com), FTP user id, and FTP password fields to appropriate values. The FTP host can have the host name optionally followed by a colon and a port number if the FTP server does not use the default port 21. For example, if you are connecting to an FTP server that uses port 999, enter the host name followed by a colon and the port number like this ftp.mycompany.com:999.

  9. Close the form and the application window.

  10. Create a batch file to transfer transaction files, process the transactions, and transfer the response files.

    See Batch Process for File Transfer at Remote Locations for an example batch file that will transfer the files, process the transactions, and then transfer the response files.

Testing the FTP Transfer

To test the FTP transfer, take the following steps:

  1. On the central system, generate a transaction for the remote location such as a Request Table Refresh.

  2. On the remote system, double-click the transfer batch file in the Windows Explorer.

  3. On the central system, verify that the files in the Outgoing directory for the remote location are gone and that there are now transactions in the Incoming directory for the remote location.

  4. On the central system, process the transactions and verify that processing was successful.

Internet FTP Server

In the Internet FTP server configuration, the FTP server is located somewhere on the Internet and both the central and remote systems access the FTP server using an Internet connection. In this configuration, both central and remote systems must perform a file transfer operation in order to move transactions between the systems.

System Requirements

Central system: Must be able to access the FTP server either over the Internet or some type of virtual private network.

Remote system: Must be able to access the FTP server either over the Internet or some type of virtual private network.

Configuring The Central System

Configure the central system by taking the following steps:

  1. Click on Edit System Parameters on the Configuration tab.

  2. Set the Local Send Directory field to Outgoing\%REMOTELOCATIONID%

  3. Set the Local Receive Directory field to Incoming\%REMOTELOCATIONID%

  4. Set the Remote Send Directory field to TRANS\Incoming\%REMOTELOCATIONID%

  5. Set the Remote Receive Directory field to TRANS\Outgoing\%REMOTELOCATIONID%

  6. Close the configuration form.

  7. Click Edit Locations and Groups on the Locations tab of the central main menu.

  8. Move to the location record for the central location (usually location id 0).

  9. Set the FTP Host (ie. ftp.mycompany.com), FTP user id, and FTP password fields to appropriate values. The FTP host can have the host name optionally followed by a colon and a port number if the FTP server does not use the default port 21. For example, if you are connecting to an FTP server that uses port 999, enter the host name followed by a colon and the port number like this ftp.mycompany.com:999.

  10. Close the location form.

  11. Create a way to transfer and process transaction file from the central location. This can either be a batch file which can be scheduled to automatically run or a button on the main menu if you want to manually control when the transfer occurs.

    See Batch Process for File Transfer at Central Locations for an example batch file that will transfer the files, process the transactions, and then transfer the response files.

    See Changing the Process Transactions Button to Also Transfer Files for instructions on changing the Process Transactions button on the main menu to transfer transaction files before and after processing transactions.

Configuring the Remote System

Configure the remote system by taking the following steps:

  1. Start the system and click on View Application and enter the password (initially set to PSI).

  2. Click on the Forms tab and double-click on CDMConfiguration.

  3. Set the Remote Send Directory field to TRANS\Outgoing\%LOCALLOCATIONID%

  4. Set the Remote Receive Directory field to TRANS\Incoming\%LOCALLOCATIONID%

  5. Close the form.

  6. Double-click on the CDMLocationsAndGroups form.

  7. If the central location record (usually location id 0) is not displayed, move to the location record for the central location.

  8. Set the FTP Host (ie. ftp.mycompany.com), FTP user id, and FTP password fields to appropriate values. The FTP host can have the host name optionally followed by a colon and a port number if the FTP server does not use the default port 21. For example, if you are connecting to an FTP server that uses port 999, enter the host name followed by a colon and the port number like this ftp.mycompany.com:999.

  9. Close the form and the application window.

  10. Create a batch file to transfer transaction files, process the transactions, and transfer the response files.

    See Batch Process for File Transfer at Remote Locations for an example batch file that will transfer the files, process the transactions, and then transfer the response files.

Testing the FTP Transfer

To test the FTP transfer, take the following steps:

  1. On the central system, generate a transaction for the remote location such as a Request Table Refresh.

  2. On the central system, transfer the transaction files to/from the FTP server either by clicking the Process Transactions button on the menu (if it has been changed to also transfer files), or, by double-clicking the transfer batch file in the Windows explorer.

  3. On the remote system, transfer the transaction files to/from the FTP server by double-clicking the transfer batch file in the Windows Explorer.

  4. On the central system, transfer and process transaction files by clicking the Process Transactions button on the menu (if it has been changed to also transfer files), or, by double-clicking the transfer batch file in the Windows explorer. Verify that procesing was successful.

Remote FTP Server

In the remote FTP server configuration, there is an FTP server running at each remote location and the central system connects to the FTP server to transfer transaction files. To use this configuration, the FTP server at each remote location must be visible to the central system either through the Internet or some sort of virtual private network. This configuration will take more time to process because it has to connect to a different FTP server for each remote location.

System Requirements

Central system: Must be able to access the FTP server either over the Internet or some type of virtual private network.

Remote system: Must be able to map a drive letter to the home directory of the FTP server (the default directory after logging in to the FTP server).

Configuring The Central System

Configure the central system by taking the following steps:

  1. Click on Edit System Parameters on the Configuration tab.

  2. Set the Local Send Directory field to Outgoing\%REMOTELOCATIONID%

  3. Set the Local Receive Directory field to Incoming\%REMOTELOCATIONID%

  4. Set the Remote Send Directory field to TRANS\Outgoing\%LOCALLOCATIONID%

  5. Set the Remote Receive Directory field to TRANS\Incoming\%LOCALLOCATIONID%

  6. Close the configuration form.

  7. Click Edit Locations and Groups on the Locations tab of the central main menu.

  8. FOR EACH REMOTE LOCATION, set the FTP Host (may be the IP address), FTP user id, and FTP password fields to appropriate values for the remote location. The FTP host can have the host name optionally followed by a colon and a port number if the FTP server does not use the default port 21. For example, if you are connecting to an FTP server that uses port 999, enter the host name followed by a colon and the port number like this 123.456.789.012:999.

  9. Close the location form.

  10. Tell the central system not to use a central FTP server by making sure that the FTP Host field in the central location record is blank.

  11. Create a way to transfer and process transaction files from the central location. This can either be a batch file which can be scheduled to automatically run or a button on the main menu if you want to manually control when the transfer occurs.

    See Batch Process for File Transfer at Central Locations for an example batch file that will transfer the files, process the transactions, and then transfer the response files.

    See Changing the Process Transactions Button to Also Transfer Files for instructions on changing the Process Transactions button on the main menu to transfer transaction files before and after processing transactions.

Configuring the Remote System

In the remote FTP server configuration, the remote system reads and writes transaction files directly from the home directory of the FTP server running on either the remote system itself or somewhere on the local area network at the remote location.

Configure the remote system to use the FTP home directory by taking the following steps:

  1. Map a drive letter (like X:) to the FTP home directory.

  2. Start the system and click on View Application and enter the password (initially set to PSI).

  3. Click on the Forms tab and double-click on CDMConfiguration.

  4. Set the Local Send Directory field to X:\TRANS\Outgoing\%REMOTELOCATIONID% (where X: is the drive letter mapped to the FTP home directory).

  5. Set the Local Receive Directory field to X:\TRANS\Incoming\%REMOTELOCATIONID% (where X: is the drive letter mapped to the FTP home directory).

  6. Close the form.

Testing the FTP Transfer

To test the FTP transfer, take the following steps:

  1. On the central system, generate a transaction for the remote location such as a Request Table Refresh.

  2. On the central system, transfer the transaction files to/from the FTP server either by clicking the Process Transactions button on the menu (if it has been changed to also transfer files), or, by double-clicking the transfer batch file in the Windows explorer.

  3. On the remote system, click the Process Transactions button on the main menu.

  4. On the central system, transfer and process transaction files by clicking the Process Transactions button on the menu (if it has been changed to also transfer files), or, by double-clicking the transfer batch file in the Windows explorer. Verify that procesing was successful.

Batch Process for File Transfer at Central Locations

At central locations, a batch file similar to the following will transfer the files, process the transactions, and then transfer the response files. Notice that the parameter to the TransferLocationFilesViaFTP('*') function is '*' instead of a location number. This means transfer to all locations that have a valid FTP host set in their location record. Make sure the directory names in the SET lines are correct and if you want the system to stop on errors, change the parameter to the ShowWarnings and ShowErrors functions from 0 to 1.

@echo off
echo Processing transactions files at headquarters...
set JAVA_HOME=C:\Program Files\Java\jre1.5.0_02\bin
set DIR=C:\jakarta-tomcat-5.5.7\webapps\edm
set CLASSPATH=C:\jakarta-tomcat-5.5.7\shared\lib\edmjni.jar
"%JAVA_HOME%\java.exe" "-Duser.dir=%DIR%" -jar %DIR%\WEB-INF\lib\system.jar "-cfg=%DIR%\WEB-INF\classes\config.xml" "-user=remote" "-pwd=remote" "-expr=ShowWarnings(0)+ShowErrors(0)+transferLocationFilesViaFtp('*')+ProcessTransactions('*')+transferLocationFilesViaFtp('*')+Exit()"

Batch Process for File Transfer at Remote Locations

At remote locations, the system provides batch files called transfer_web.bat and transfer_ftp.bat that will transfer the files, process the transactions, and then transfer the response files. In order for the batch file to operate correctly, the location record for the central location must have a valid transfer host, user id, and password. If you want the system to stop on errors, change the parameter to the ShowWarnings and ShowErrors functions from 0 to 1.

Changing the Process Transactions Menu Options to Also Transfer Files

For manual control over the transaction file transfer and processing, you can change the Process All Transactions option and the Process Selected Transactions option on the main menu to transfer transaction files both before and after processing the transaction files. The files are transferred before processing to get any new transactions. The files are transferred after processing to send back status transactions to let the sender know the results of the transaction processing.

To add FTP file transfer to the transaction processing menu options, take the following steps:

  1. Use a text editor to edit the menu_app_version.xml file in the folder containing the system configuration files.

  2. Find the menu with the name="Transactions".

  3. Find the item with the name="Process All Transactions" and change the action attribute to: TransferLocationFilesViaFTP('*')+ProcessTransactions('*')+TransferLocationFilesViaFTP('*')

  4. Find the item with the name="Process Selected Transactions" and change the action attribute to: TransferLocationFilesViaFTP('')+ProcessTransactions('')+TransferLocationFilesViaFTP('')

  5. Close and save the menu file.

  6. If system is running in a web server, use Control Panel - Administrative Tools - Services to restart the Apache Tomcat service.

Note: To use the web transfer function instead of the FTP transfer function, replace TransferLocationFilesViaFTP with TransferLocationFilesViaWeb in the instructions above.

Adding File Transfer to the Menu

To add file transfer to the transaction menu, take the following steps:

  1. Use a text editor to edit the menu_app_version.xml file in the folder containing the system configuration files.

  2. Find the menu with the name="Transactions".

  3. Add an item line like this: <item name="Transfer Files" action="transferLocationFilesViaFtp('*')"/>

  4. Close and save the menu file.

  5. If system is running in a web server, use Control Panel - Administrative Tools - Services to restart the Apache Tomcat service.

Note: To use the web transfer function instead of the FTP transfer function, replace TransferLocationFilesViaFTP with TransferLocationFilesViaWeb in the instructions above.

Managing Files

The system has the ability to manage files for multiple remote sites just like it can manage database records for multiple remote sites. The Send File and Request File transactions can be used to send and receive files from sites. Each time you send or request a file you can check the Synchronize checkbox if you want that file to be sent to the site whenever it is updated and the SendRemoteFiles function is executed.

For example, to manage the file C:\POS\Print.frm for all sites, the first thing that has to happen is you have to get a copy of the file from each site and store it at the central location and mark the file as synchronized.

  1. Select Transactions – RequestFile

  2. Select the desired locations

  3. In the From File: field, enter C:\POS\Print.frm

  4. In the To File: field, enter Files\Print_%REMOTESITEID%.frm

  5. Check the Overwrite checkbox if the files already exist at central and you want to overwrite them.

  6. Check the Synchronize checkbox so the system will remember which files go to each site.

  7. Transfer and process transactions with all sites.

In our example, after transferring and processing transactions, on the central server you will have the new folder C:\jakarta-tomcat-5.5.7\webapps\edm\Files and in the folder you will have a file from each site with the site number as part of the name. For example, if you have sites 101, 102, and 103, you would have the files PRINT_101.FRM, PRINT_102.FRM, and PRINT_103.FRM.

Notice that the remote file and folder names can have variables in them so users can send and receive files from multiple stores with one command. The variables %THISSITEID%, %THISSITENAME%, %THISCUSTOMID%, %REMOTESITEID%, %REMOTESITENAME%, %REMOTECUSTOMID%, %CENTRALSITEID%, %CENTRALSITENAME%, %CENTRALCUSTOMID% used in the file path or name will be replaced with this site's id, name, or custom id, the remote site's id, name, or custom id, or the central site's id, name, or custom id respectively.

Sending Files to Sites

Now if you want to update the Print.frm filr for site 101, just edit C:\jakarta-tomcat-5.5.7\webapps\edm\Files\Print_101.frm and then select Transactions – Send Updated Remote Files on the EDM central main menu. If you want to send the files to the sites whether they have been updated or not, select Transactions – Send All Remote Files.

SendRemoteFiles goes through the records in the CDMRemoteFiles table to see which files should be sent to which sites. For each selected site, the system finds all the files that are supposed to be synchronized for that site and, if the file has been updated or if the sendUpdatedOnly flag is false, the system sends the file to the site using a SendFile transaction.

Automatically Sending Updated Files

To automatically send the files any time they are updated, just schedule the SendRemoteFiles function to be executed periodically by putting a line like the following in your config.xml file:

<schedule frequency = "DAILY" time = "4:15 AM" task = "SendRemoteFiles( true, '*', '', '-Remote File Package', '', true )" />

The parameters of the SendRemoteFiles function are:

sendUpdatedOnly
True if only files that have been updated should be sent.
siteList
Comma-separated list of site numbers to which files should be sent (* means all, blank means prompt user to select).
effectiveDate
Date file should be copied to destination.
packageName
Name of package to hold transactions (blank means prompt user to select).
packageDescription
Description of package if a new package is to be created.
commit
True if package containing file transactions should be committed.

Sharing a File Across Multiple Sites

To share a file across multiple sites, simply send the same file to multiple sites with the synchronize flag set. For example, if sites 101 and 102 use the same Print.frm file, we could create a Print_Group_A.frm file and send it to both sites with the synchronize flag set. Then the system will remember that that file goes to both sites and whenever the SendRemoteFiles function is called after the file has been updated, the file will be sent to both sites.

Keep in mind that if the system is initially set up to send Print_101.frm to site 101 and then changed to send Print_Group_A.frm to site 101, as long as both files exist, the system will still send either of them if it is updated and SendRemoteFiles is called. To avoid this you can either delete the file that should no longer be sent to the site or delete the record in the CDMRemoteFiles table that has the invalid file name and site name.