public override void ExecuteTask(IClientTask task, IBatchContext batchContext) { URL = task.BatchNode.StepData.StepConfiguration.ReadString("BlazonURL"); DIR = task.BatchNode.StepData.StepConfiguration.ReadString("BlazonTempDIR"); WaitTime = task.BatchNode.StepData.StepConfiguration.ReadInt("WaitTime", 5); CleanUp = task.BatchNode.StepData.StepConfiguration.ReadBoolean("CleanUp", false); CurrentTask = task; try { //First read the file from the Batch if (task.BatchNode.RootLevel != 0) { //throw new System.ArgumentException("Module should run at Page Level"); IBatchNodeCollection pages = task.BatchNode.GetDescendantNodes(0); int numpages = pages.Count(); int i = 0; while (i < numpages) { IBatchNode page = pages[i]; SendFileToBlazon(page); i++; } task.CompleteTask(); } else { SendFileToBlazon(task.BatchNode); task.CompleteTask(); } } catch (Exception e) { task.FailTask(FailTaskReasonCode.GenericRecoverableError, e); } }
public override void ExecuteTask(IClientTask task, IBatchContext batchContext) { try { //--------------------------------------------------------------------------------------------------------- // Output some initial trace information about this task. //--------------------------------------------------------------------------------------------------------- _startInfo.Trace("Jpeg Compression - ExecuteTask called."); _startInfo.Trace("Jpeg Compression - Date={0} -------------Step={1}, Batch={2}, Node={3}------------", DateTime.Now.ToString(), task.BatchNode.StepData.StepName, task.BatchNode.NodeData.BatchName, task.BatchNode.NodeData.NodeId); //Read the configuration values string TempPath = task.BatchNode.StepData.StepConfiguration.ReadString("TempPath"); double Compression = task.BatchNode.StepData.StepConfiguration.ReadDouble("Compression"); _startInfo.Trace("Using Temp Storage " + TempPath); _startInfo.Trace("Compression Set to " + Compression.ToString()); //First try to see at what level the module is running at int RootLevel = task.BatchNode.RootLevel; if (RootLevel == 0) { CompressNode(task.BatchNode, TempPath, Compression); task.CompleteTask(); } else { //Loop through all of the nodes foreach (IBatchNode node in task.BatchNode.GetDescendantNodes(0)) { CompressNode(node, TempPath, Compression); } task.CompleteTask(); } } catch (Exception e) { //--------------------------------------------------------------------------------------------------------- // Trace the exception and then fail the task. //--------------------------------------------------------------------------------------------------------- _startInfo.Trace("Jpeg Compression - An exception occured. {0}", e.ToString()); if (task != null) { task.FailTask(FailTaskReasonCode.GenericUnrecoverableError, e); } } }
public override void ExecuteTask(IClientTask task, IBatchContext batchContext) { //First Get the name of the current Step String StepName = task.BatchNode.StepData.StepName; //Now get the inputfiles for each page if (task.BatchNode.RootLevel > 0) { foreach (IBatchNode p in task.BatchNode.GetDescendantNodes(0)) { ReadPageXML(p); } } else { IBatchNode p = task.BatchNode; ReadPageXML(p); } //Now end task.CompleteTask(); }