Monday, December 29, 2014

5.4.8 Database Synchronization Application

            There are two database storage devices involve in each synchronization process which are between server computer and infomediary device. The process of the database synchronization is the same on both offline server computer and online server computer. Infomediary device acted as a data mule where later on, the database storage being synchronized with the server computer. Both side synchronization performed by the database synchronization application. FreeFilesync version 4.6 used as a database synchronization application and running on a server computer. Samba File sharing application bridged the data flow between server computers and infomediary device. Server computer synchronization discussed in Part A and infomediary device discussed in Part B.

Part A: Server Computer Synchronization           
            Offline server computer and online server computer configured identically for the database synchronization purpose. FreeFilesync installed as “Portable” to respective location such as “C:\PEmailOffline\FreeFileSync” to enable the application mobility features where it can be transfer and use on other machine. These options remove dependencies on a dedicated computer and enable the portable database synchronization.
Following the configuration in Part B, infomediary device can be accessed by opening “Windows Explorer” and entering location path such as “\\data mule”. Accessing this path for the first time will require the username and password as per configuration on infomediary device.  Windows XP automatically store logon information for network locations. This stored username and password can be edited later from the user accounts menu in windows control panel. When infomediary device is connected to the server computer network, the server computer automatically have access to the infomediary device network sharing path. New folders to stored email data for database synchronization created in infomediary device network sharing path such as “\\data mule\share2\”. Two email data path for storing mail server data and web server data which are required for database synchronization created in infomediary device storage as the example shown in Table 5.12.

\\data mule\share2\pemailsync\UniServer\pemail
\\data mule\share2\pemailsync\hMailServer\Data
Table 5.12: Infomediary Device Data Synchronization Folder

Mail data will be stored in this location in infomediary device each time database synchronization process occurs. Email data path for storing mail server data and web server data which are required for database synchronization at the server computer configured in the FreeFilesync application as the example shown in Table 5.13.

C:\PEmailOffline\UniServer\usr\local\mysql\data\pemail
C:\PEmailOffline\hMailServer\Data
Table 5.13: Mail Server Data Synchronization Folder

Email data paths in the server computer configured in the left side of FreeFilesync while email data path for the infomediary device configured in the right side of FreeFilesync as shown in Figure 5.4.

FreeFileSync Database Synchronization Path
FreeFileSync Database Synchronization Path

Figure 5.4: Database Synchronization Path
Comparison settings for “compare” is configured to “File Content” and “synchronize” is configured to “Automatic”. File data comparisons can be performed manually by using the “Compare” button and file data synchronization can be performed manually by using the “Synchronize…” and “Start” button. Both files data comparison and synchronization function can be executed with a particular setting by using a batch job. A batch job is a set of programs processed with a sequence of commands to be executed listed in a file which often called a batch file. This sequence of commands executes as a single unit job. A batch job is useful for automatic file synchronization. Batch job created with the same configuration where the “Compare” configured to “File Content” and “Synchronize…” configured to “Automatic”. Batch Settings configured with “Show progress log” enable and “Error handling” configured to “Ignore errors”.
Batch job saved as “SyncJobOffline.ffs_batch” in C:\PEmailOffline\FreeFileSync. Mail server data and web server data paths that need to be monitor configured in RealtimeSync as the example shown in Figure 5.5.
FreeFileSync Realtime Synchronize Setting
FreeFileSync Realtime Synchronize Setting

Figure 5.5: Realtime Synchronize Setting
“StartFFS.bat” configured in “command line” section. The program will run when “Start” button clicked, and remain idle in the system tray. Whenever any changes made on these respective paths or when all paths are available will trigger data synchronization process command line script, “StartFFS.bat”. Table 5.14 shows the batch script for “StartFFS.bat”. "FreeFileSync.exe SyncJobOffline.ffs_batch" line will execute File Synchronization application, FreeFileSync with a batch job setting "SyncJobOffline.ffs_batch".
"start C:\PEmailOffline\hMailServer\DataDirectorySynchronizer.exe" will execute hMailServer Data Directory Synchronizer. This tool checks all message files in the data folder and search files with extension .eml. HMailServer will insert the message into user account if any .eml file found in the user directory and  the message will be inserted into the delivery queue if the .eml file found in the Data root directory [30]. “C:\PEmailOffline\UniServer\unicon\program\unidelay.exe 20" line gives a twenty second delay to allow text to be read. Both hmailserver and Uniserver need to be restarted for the mail database synchronization update. "start C:\PEmailOffline\hMailServer\Bin\stop_hmailserver.bat" line will stop the hmailserver service and "start C:\PEmailOffline\UniServer\Stop_Server.bat" line will stop Uniserver service. "start C:\PEmailOffline\UniServer\Start_Server.bat" line and "start C:\PEmailOffline\hMailServer\Bin\start_hmailserver.bat" line will start the hmailserver service and Uniserver service.
FreeFileSync.exe SyncJobOffline.ffs_batch
start C:\PEmailOffline\hMailServer\DataDirectorySynchronizer.exe
C:\PEmailOffline\UniServer\unicon\program\unidelay.exe 20
start C:\PEmailOffline\hMailServer\Bin\stop_hmailserver.bat
start C:\PEmailOffline\UniServer\Stop_Server.bat
C:\PEmailOffline\UniServer\unicon\program\unidelay.exe 10
start C:\PEmailOffline\UniServer\Start_Server.bat
start C:\PEmailOffline\hMailServer\Bin\start_hmailserver.bat
Table 5.14: StartFFS.bat Script
Part B: Infomediary Device
            Samba File sharing used for data receiving applications from the server computer. Infomediary device which is an android phone connected to the Wi-Fi access point of offline server computer or online server computer to perform mail database synchronization. When a network connection is established, Samba File sharing application will show “network fileshare” status as “disabled-not running” for the first time running. Samba File sharing application preference configuration for password, username, Workgroup name, NetBIOS name configured accordingly as the example shown in Figure 5.6. Second Shared Folder selected under “Other File share Settings” since the database will be stored in the external SD card. External SD card is used because it offers larger storage size up to 32GB.
Android Samba File Sharing
Android Samba File Sharing

Password:
Username: SDCARD
Workgroup: SDKCH (Should be the same as server computer Workgroup)
NETBIOS Name: data mule
Figure 5.6: Samba File sharing application configuration
Samba File sharing application can be configured to stay connected mode. This mode available under “Wake Locks” menu with the available option which is “Screen Wake Lock”, “Wi-Fi Wake Lock” and “Multicast Lock”. This is useful to ensure the Wi-Fi stay active and connected as soon as the respective Wi-Fi access point (AP) available the in infomediary device networking range. New folder such as “pemailsync” created in “\\data mule\share2\” to store mail server data and web server data.

No comments:

Post a Comment