Service Event Type: File System Monitor
A File System Monitor service event type is defined to monitor a specified directory on the SAP Mobile Platform Server host file system for changes. When a file system monitor service event is defined and published to the Server, the Server will begin monitoring the directory the service event has been defined to watch, which is then the source back-end system for the service event. When a change occurs to the contents of this directory, the Server will attempt to open each file in the directory for reading. Once a file is opened successfully, the service event’s defined command will be executed, followed by its read, data state, and update step definitions to update the destination back-end system.
If the Agentry Server is unable to open a file for reading, it will wait a short period and attempt the operation again. If it is unable to open the file after this second attempt, it will skip the file and process the next on found in the directory. When a file is successfully opened, the defined command for the service event is executed for that file. The service events child step usage definitions are then processed. Once this is complete, the next file in the directory is processed according this same procedure. Note that the Agentry Server will delete all files from the directory that it successfully processes. To prevent this behavior, the command should include copying the file to a different location, or rename the file to one that does not match the File Filter attribute of the service event definition.
The command defined for this service event type is primarily intended to prepare files for transfer or reading by the service event. The command can be any executable file type and is a Windows batch file (.bat) by default. The file type may be changed by editing the file extension of the file name in the File attribute of the Command tab.
A file system monitor service event includes the document mapping child definition type. The service event may contain one or more of these child definitions, each of which will map a file or file-related data to the properties of the object type targeted by the service event; or alternately one of the other data components of the application.
File System Monitor Service Event Attributes
- Name: The internal unique name for the service event definition, must be unique among all service events defined within the same module.
- Connection: This attribute references a File system connection type to the Agentry Server’s host file system. The directory monitored by the service event must exist on this file system. The Agentry Server must have read-write access to this directory. The system connection must be of type File System and must exist prior to defining the service event.
- Directory: This attribute specifies the directory to be monitored by the service event. This path can be either a full path beginning with the file system root, or it may be a relative path to the installation location of the Agentry Server. The Server must have read-write privileges to this directory. Changes to this directory monitored by the service event include the addition of new files or modifications of existing files determined by changes to the modification date in the file’s metadata.
- File Filter: This attribute can contain any file name matching characters to specify which files or file types the service event should monitor. This value can include wild cards in the form of asterisks. Any files at the location specified by the Directory attribute that match the file name pattern specified in File Filter will be monitored. Any others will be ignored by the service event. If File Filter is left blank, all files within the directory will be monitored.
- Object Type: This attribute specifies the target object type of the service event. The properties of this object will store the data retrieved from the source back end to be updated to the destination back end. This may include child object collections where necessary.
- Read Steps: This attribute specifies whether to retrieve data from the source back end system using the read steps defined in the service event, or those defined in the target object type of the service event. When this attribute is true, the object’s read steps will be used and the service event’s read steps will not be processed.