3.2.1.12.3 Running File Management Task
A Running File Management Task is a task performed by the server during the execution of the associated file management job. For a given file management job, the execution of a running file management task can be triggered in response to a client IFsrmFileManagementJob::Run (section 3.2.4.2.48.41) request. At any given moment in time, there can be at most one running file management task for every file management job configured on the server.
The Running File Management Task is a task that runs continuously, in a loop, and monitors the Running File Management Job Queue. Because the server maintains only one Running File Management Job Queue, there is only one Running File Management Task on the server.
Whenever the Running File Management Job Queue is not empty, the task searches for one or more Running Jobs in the queue for which the parent Non-persisted File Management Job Instance – identified by the Running Job.Parent reference – has a Running status of FsrmReportRunningStatus_Queued.
The task processes each such object by performing the following actions in sequence:
For the parent instance (as identified by the Running Job.Parent reference)
Set the Running status to FsrmReportRunningStatus_Running.
Set the Last run time to the current time.
Generate a unique file name prefix string, and store it in File Management Job.Last report path without extension. See Reports (section 3.2.1.5.2) for information about how to generate this prefix.
Scan the namespaces specified in the parent instance's Namespace Roots to obtain the list of files within these namespaces. On each of these files, perform the File Condition, Property Condition, Future Notification, Date Condition, Action, and Action Notification steps listed below in sequence for each file:
File Condition step:
If the Running Job's Running Job.Cancel property is true, skip the File Condition, Property Condition, Future Notification, Date Condition, Action, and Action Notification steps for all remaining files.
If the parent instance has File name pattern set to something other than Null and the file name does not match the wildcard pattern (for more information about matching wildcard characters, see [MSDN-WLD]) in File name pattern, the server MUST skip the rest of the File Condition, Property Condition, Future Notification, Date Condition, Action, and Action Notification steps for this file.
Property Condition step (in sequence):
If the parent instance has one or more Property conditions as part of its Conditions, the following steps will be performed in sequence.
Perform the Retrieve stored classification properties for the file.
Perform the Generate new classification properties action for the file given the list of Property Definition Instances from the previous action. If the property definition instance.flags of any of the resulting Property Definition Instances contains FsrmPropertyFlags_SetByClassifier, add the file to the Report item list.
Perform the Store classification properties action for the file given the list of Property Definition Instances from the previous action.
For each Property condition in the parent instance's Conditions, the server MUST perform the following steps in sequence:
For the rest of this sequence, associated property definition instance will refer to the Property Definition Instance in property definition instances where Property condition.Name is equal to property definition instance.Name.
For the rest of this sequence, associated property definition will refer to the property definition in the server's property definitions with the same Property Definition.Name as the associated property definition.Name.
If Property condition.Type is FsrmPropertyConditionType_Unknown, an error SHOULD be generated and the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
If Property condition.Type is FsrmPropertyConditionType_Exist and there is an associated property definition instance, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
If Property condition.Type is FsrmPropertyConditionType_Not exist and there is an associated property definition instance, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
If Property condition.Type is FsrmPropertyConditionType_Equal, there is an associated property definition instance, and the Property condition.Value is equal to the associated property definition instance.Value, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
If Property condition.Type is FsrmPropertyConditionType_NotEqual, there is an associated property definition instance, and the Property condition.Value is not equal to the associated property definition instance.Value, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
If Property condition.Type is FsrmPropertyConditionType_LessThan and one or more of the following are true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is FsrmPropertyDefinitionType_String, FsrmPropertyDefinitionType_Int, FsrmPropertyDefinitionType_Bool, or FsrmPropertyDefinitionType_Date and associated property definition instance.Value is not less than Property condition.Value.
The associated property definition.Type is FsrmPropertyDefinitionType_OrderedList and associated property definition instance.Value does not appear as a Property Value Definition.Name before Property condition.Value in the associated property definition.Possible values list.
The associated property definition.Type is FsrmPropertyDefinitionType_Unknown, FsrmPropertyDefinitionType_SingleChoiceList, or FsrmPropertyDefinitionType_MultiChoiceList.
If Property condition.Type is FsrmPropertyConditionType_GreaterThan and one or more of the following are true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is FsrmPropertyDefinitionType_String, FsrmPropertyDefinitionType_Int, FsrmPropertyDefinitionType_Bool, or FsrmPropertyDefinitionType_Date and associated property definition instance.Value is not greater than Property condition.Value.
The associated property definition.Type is FsrmPropertyDefinitionType_OrderedList and associated property definition instance.Value does not appear as a Property Value Definition.Name after Property condition.Value in the associated property definition.Possible values list.
The associated property definition.Type is FsrmPropertyDefinitionType_Unknown, FsrmPropertyDefinitionType_SingleChoiceList, or FsrmPropertyDefinitionType_MultiChoiceList.
If Property condition.Type is FsrmPropertyConditionType_Contain and one or more of the following are true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiChoiceList.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiString.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiChoiceList or FsrmPropertyDefinitionType_MultiString and associated property definition instance.Value does not contain Property condition.Value.
If Property condition.Type is FsrmPropertyConditionType_ContainedIn and one or more of the following are true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiChoiceList.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiString.
The associated property definition.Type is not FsrmPropertyDefinitionType_MultiChoiceList or FsrmPropertyDefinitionType_MultiString and associated property definition instance.Value is not contained in Property condition.Value.
If Property condition.Type is FsrmPropertyConditionType_StartWith and the following is true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_String or associated property definition instance.Value does not begin with Property condition.Value.
If Property condition.Type is FsrmPropertyConditionType_EndWith and the following is true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_String or associated property definition instance.Value does not end with Property condition.Value.
If Property condition.Type is FsrmPropertyConditionType_PrefixOf and the following is true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_String or associated property definition instance.Value is not the prefix of Property condition.Value.
If Property condition.Type is FsrmPropertyConditionType_SuffixOf and the following is true, the Future Notification, Date Condition, Action, and Action Notification steps are skipped for this file.
The associated property definition.Type is not FsrmPropertyDefinitionType_String or associated property definition instance.Value is not the suffix of Property condition.Value.
Future Notification step:
For each of the parent instance's Notification periods, the server performs the following steps in sequence:
If the notification period's Notification interval is 0, skip to the next Notification period.
If the parent instance has Days since file created set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's creation date plus the value of Days since file created minus the notification period's Notification interval is greater than the server's current date or less than the parent instance's File Management Job.Last Run Time, skip to the next Notification period.
If the parent instance has Days since file last modified set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's modification date plus the value of Days since file last modified minus the notification period's Notification interval is greater than the server's current date or less than the parent instance's File Management Job.Last Run Time, skip to the next Notification period.
If the parent instance has Days since file last accessed set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's last accessed date plus the value of Days since file last accessed minus the notification period's Notification interval is greater than the server's current date or less than the parent instance's File Management Job.Last Run Time, skip to the next Notification period.
Run the notifications in the notification period's Notification period.Notifications of the parent instance.
Date Condition step:
If the parent instance has Days since file created set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's creation date plus the value of Days since file created is greater than or equal to the server's current date, skip the Action and Action Notification steps.
If the parent instance has Days since file last modified set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's modification date plus the value of Days since file last modified is greater than or equal to the server's current date, skip the Action and Action Notification steps.
If the parent instance has Days since file last accessed set to greater than FsrmDateNotSpecified in its Conditions, and the sum of the file's last accessed date plus the value of Days since file last accessed is greater than or equal to the server's current date, skip the Action and Action Notification steps.
If the parent instance has From date set to greater than FsrmDateNotSpecified in its Conditions, and From date is less than or equal to the current date/time, skip the Action and Action Notification steps.
Action step:
If there were any errors in processing the file and the File Management Job.Parameters of the parent instance do not include a value that starts with "ActOnPartialClassification", the Action and Action Notification steps MUST be skipped for this file.
If the Operation type of the parent instance is set to FsrmFileManagementType_Expiration, the server will move the file to the location indicated by the Expiration directory of the parent instance.
If the Operation type of the parent instance is set to FsrmFileManagementType_Custom, the server will run the Custom Action of the parent instance (see section 3.2.4.4, Running Notifications).
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Error, the server logs any error that have occurred during the processing of the file in the file management job error log file.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Information, the server logs the file to the file management job information log file.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Audit, the server logs the file to the server's event log.
Action Notification step:
If the parent instance has a notification period whose Notification interval is 0 as part of its Notification periods, the server runs the notifications in the Notification period.Notifications (see section 3.2.4.4) of that notification period.
If report enabled is true, generate the file management report in each format specified in File Management Job.Formats, and store it in Reports directory.
Store all generated reports as files in Reports directory. All file names MUST begin with the parent instance's File Management Job.Last report path without extension.
Send emails with the generated reports to the email address recipient list in the parent instance's Non-Persisted File Management Job Instance's File Management Job.Mail to, as follows:
If the parent instance's Non-Persisted File Management Job Instance's File Management Job.Mail to is an empty string, the server MUST NOT email the report when the action is run.
If the parent instance's Non-Persisted File Management Job Instance's File Management Job.Mail to contains the string "[ADMIN EMAIL]", the server MUST send the report to the Administrator email address (section 3.2.1.9) returned from IFsrmSetting::AdminEmail (get) (section 3.2.4.2.11.5), in addition to other email addresses in Mail to, when emailing the report.
Set the parent instance's Last error to an empty string if no errors occurred or to a string describing the error encountered.
Set the parent instance's Last generated in directory to Reports directory. If there is an associated Persisted File Management job, also set that object's Last generated in directory to the same value.
Set the parent instance's Running status to FsrmReportRunningStatus_NotRunning.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Information, the server persists the file management job log file.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Error, the server persists the file management job error log file.
Remove the Running Job from the Running File Management Job Queue.
The order in which the task processes Running Job objects as previously described is not deterministic. Also, the task can choose to process multiple Running Jobs in parallel or just one at a time.
If the task is interrupted (for example, by IFsrmFileManagementJob::Cancel) while processing a Running Job, the following steps will be performed in sequence:
Complete the processing of the current file.
Set the parent instance's Running status to FsrmReportRunningStatus_NotRunning.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Information, the server persists the file management job log file.
If File Management Job.Logging contains FsrmFileManagementLoggingFlags_Error, the server persists the file management job error log file.
Remove the Running Job from the Running File Management Job Queue.