MonitorFile.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <sect1 id="MonitorFile">
  5. <title><emphasis role="bold">MonitorFile</emphasis></title>
  6. <para><emphasis role="bold">STD.File.MonitorFile<indexterm>
  7. <primary>STD.File.MonitorFile</primary>
  8. </indexterm><indexterm>
  9. <primary>File.MonitorFile</primary>
  10. </indexterm><indexterm>
  11. <primary>MonitorFile</primary>
  12. </indexterm>(</emphasis> <emphasis> event, </emphasis> <emphasis
  13. role="bold">[</emphasis> <emphasis> ip </emphasis> <emphasis role="bold">] ,
  14. </emphasis> <emphasis>filename, </emphasis> <emphasis role="bold">
  15. [</emphasis> <emphasis>,subdirs</emphasis> <emphasis role="bold">]
  16. [</emphasis> <emphasis>,shotcount</emphasis> <emphasis role="bold">]
  17. [</emphasis> <emphasis>,espserverIPport</emphasis> <emphasis role="bold">]
  18. )</emphasis> <emphasis></emphasis></para>
  19. <para><emphasis>dfuwuid </emphasis> <emphasis role="bold">:=
  20. STD.File.fMonitorFile<indexterm>
  21. <primary>STD.File.fMonitorFile</primary>
  22. </indexterm><indexterm>
  23. <primary>File.fMonitorFile</primary>
  24. </indexterm><indexterm>
  25. <primary>fMonitorFile</primary>
  26. </indexterm>(</emphasis> <emphasis> event, </emphasis> <emphasis
  27. role="bold">[</emphasis> <emphasis> ip </emphasis> <emphasis role="bold">] ,
  28. </emphasis> <emphasis>filename, </emphasis> <emphasis role="bold">
  29. [</emphasis> <emphasis>,subdirs</emphasis> <emphasis role="bold">]
  30. [</emphasis> <emphasis>,shotcount</emphasis> <emphasis role="bold">]
  31. [</emphasis> <emphasis>,espserverIPport</emphasis> <emphasis role="bold">]
  32. );</emphasis></para>
  33. <informaltable colsep="0" frame="none" rowsep="0">
  34. <tgroup cols="2">
  35. <colspec colwidth="80.50pt" />
  36. <colspec />
  37. <tbody>
  38. <row>
  39. <entry><emphasis>event</emphasis></entry>
  40. <entry>A null-terminated string containing the user-defined name of
  41. the event to fire when the <emphasis>filename</emphasis>appears.
  42. This value is used as the first parameter to the EVENT
  43. function.</entry>
  44. </row>
  45. <row>
  46. <entry><emphasis>ip</emphasis></entry>
  47. <entry>Optional. A null-terminated string containing the ip address
  48. for the file to monitor. This is typically a landing zone. This may
  49. be omitted only if the <emphasis>filename</emphasis>parameter
  50. contains a complete URL.</entry>
  51. </row>
  52. <row>
  53. <entry><emphasis>filename</emphasis></entry>
  54. <entry>A null-terminated string containing the full path to the file
  55. to monitor. This may contain wildcard characters (* and ?).</entry>
  56. </row>
  57. <row>
  58. <entry><emphasis>subdirs</emphasis></entry>
  59. <entry>Optional. A boolean value indicating whether to include files
  60. in sub-directories that match the wildcard mask when the
  61. <emphasis>filename</emphasis> contains wildcards. If omitted, the
  62. default is false.</entry>
  63. </row>
  64. <row>
  65. <entry><emphasis>shotcount</emphasis></entry>
  66. <entry>Optional. An integer value indicating the number of times to
  67. generate the event before the monitoring job completes. A negative
  68. one (-1) value indicates the monitoring job continues until manually
  69. aborted. If omitted, the default is 1.</entry>
  70. </row>
  71. <row>
  72. <entry><emphasis>espserverIPport</emphasis></entry>
  73. <entry>Optional. A null-terminated string containing the protocol,
  74. IP, port, and directory, or the DNS equivalent, of the ESP server
  75. program. This is usually the same IP and port as ECL Watch, with
  76. “/FileSpray” appended. If omitted, the default is the value
  77. contained in the lib_system.ws_fs_server attribute.</entry>
  78. </row>
  79. <row>
  80. <entry><emphasis>dfuwuid</emphasis></entry>
  81. <entry>The attribute name to recieve the null-terminated string
  82. containing the DFU workunit ID (DFUWUID) generated for the
  83. monitoring job.</entry>
  84. </row>
  85. <row>
  86. <entry>Return:<emphasis> </emphasis></entry>
  87. <entry>fMonitorFile returns a null-terminated string containing the
  88. DFU workunit ID (DFUWUID).</entry>
  89. </row>
  90. </tbody>
  91. </tgroup>
  92. </informaltable>
  93. <para>The <emphasis role="bold">MonitorFile </emphasis>function creates a
  94. file monitor job in the DFU Server. Once the job is received it goes into a
  95. 'monitoring' mode (which can be seen in the eclwatch DFU Workunit display),
  96. which polls at a fixed interval (default 15 mins). If an appropriately named
  97. file arrives in this interval it will fire the <emphasis>event</emphasis>
  98. with the name of the triggering object as the event subtype (see the EVENT
  99. function).</para>
  100. <para>This process continues until either:</para>
  101. <para>1) The <emphasis>shotcount</emphasis> number of events have been
  102. generated.</para>
  103. <para>2) The user aborts the DFU workunit.</para>
  104. <para>The STD.File.AbortDfuWorkunit and STD.File.WaitDfuWorkunit functions
  105. can be used to abort or wait for the DFU job by passing them the returned
  106. <emphasis>dfuwuid</emphasis>.</para>
  107. <para><emphasis role="bold">Note the following caveats and
  108. restrictions:</emphasis></para>
  109. <para>1) Events are only generated when the monitor job starts or
  110. subsequently on the polling interval.</para>
  111. <para>2) Note that the <emphasis>event</emphasis> is generated if the file
  112. has been created since the last polling interval. Therefore, the
  113. <emphasis>event</emphasis> may occur before the file is closed and the data
  114. all written. To ensure the file is not subsequently read before it is
  115. complete you should use a technique that will preclude this possibility,
  116. such as using a separate 'flag' file instead of the file, itself or renaming
  117. the file once it has been created and completely written.</para>
  118. <para>3) The EVENT function's subtype parameter (its 2nd parameter) when
  119. monitoring physical files is the full URL of the file, with an absolute IP
  120. rather than DNS/netbios name of the file. This parameter cannot be retrieved
  121. but can only be used for matching a particular value.</para>
  122. <para>Example:</para>
  123. <programlisting format="linespecific">EventName := 'MyFileEvent';
  124. FileName := 'c:\\test\\myfile';
  125. LZ := '10.150.50.14';
  126. STD.File.MonitorFile(EventName,LZ,FileName);
  127. OUTPUT('File Found') : WHEN(EVENT(EventName,'*'),COUNT(1));
  128. </programlisting>
  129. </sect1>