protected TaskInstance CreateTaskInstance(TaskDef td) { if (td is CompositeTaskDef) { return(new CompositeTaskInstance()); } AtomicTaskDef at = td as AtomicTaskDef; switch (at.TaskType) { case NGinnTaskType.Empty: return(new EmptyTaskInstance()); case NGinnTaskType.Timer: return(new TimerTaskInstance()); case NGinnTaskType.Debug: return(new DebugTaskInstance()); case NGinnTaskType.Manual: return(new ManualTaskInstance()); case NGinnTaskType.SendMessage: return(new SendMessageTaskInstance()); case NGinnTaskType.ReceiveMessage: return(new AwaitMessageTaskInstance()); case NGinnTaskType.Custom: if (string.IsNullOrEmpty(td.ImplementationClass)) { throw new Exception("ImplementationClass missing"); } Type t = Type.GetType(td.ImplementationClass); var ti = (TaskInstance)Activator.CreateInstance(t); return(ti); default: return(new EmptyTaskInstance()); } }
protected void task(string id, string taskType, Action act) { if (_curTask != null) { throw new Exception("Nesting atomic tasks not allowed"); } if (_currentCompositeTask == null) { throw new Exception("Tasks must be nested in a process or composite task"); } _curTask = new AtomicTaskDef { Id = id, AutoBindVariables = true }; _curTask.TaskType = (NGinnTaskType)Enum.Parse(typeof(NGinnTaskType), taskType, true); act(); if (_curTask.JoinType == TaskSplitType.OR && (_curTask.OrJoinCheckList == null || _curTask.OrJoinCheckList.Count == 0)) { throw new Exception("Define or_join_checklist for task " + _curTask.Id); } _currentCompositeTask.AddTask(_curTask); _curTask = null; }
protected void WriteAtomicTask(AtomicTaskDef t) { }
protected void GenerateScript(AtomicTaskDef td) { GenerateBaseTaskScripts(td); }