protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey)
        {
            string taskType = reader.GetAttribute("type");

            if (string.IsNullOrEmpty(taskType))
            {
                taskType = TaskType.command.ToString();
            }
            TaskType type = (TaskType)Enum.Parse(typeof(TaskType), taskType);

            switch (type)
            {
            case TaskType.snapshot:
                _config = new SnapshotTaskConfig(_when);
                break;

            case TaskType.virtualmachine:
                _config = new VirtualMachineTaskConfig(_when);
                break;

            case TaskType.command:
            default:
                _config = new CommandTaskConfig(_when);
                break;
            }

            _config.ProxyDeserializeElement(reader, serializeCollectionKey);
        }
示例#2
0
        /// <summary>
        /// Execute during additional sequence.
        /// </summary>
        public override List <XmlResult> ExecuteSequence(SequenceWhen when)
        {
            List <XmlResult> results = new List <XmlResult>();

            foreach (TasksConfig executes in _configs)
            {
                foreach (TaskConfigProxy proxy in executes)
                {
                    TaskConfigInstance execute = proxy.Instance;
                    if (execute.ExecuteCommandWhen == when)
                    {
                        if (execute is CommandTaskConfig)
                        {
                            results.Add(Execute((CommandTaskConfig)execute));
                        }
                        else if (execute is SnapshotTaskConfig)
                        {
                            results.Add(Execute((SnapshotTaskConfig)execute));
                        }
                        else if (execute is VirtualMachineTaskConfig)
                        {
                            results.Add(Execute((VirtualMachineTaskConfig)execute));
                        }
                        else
                        {
                            throw new NotImplementedException(string.Format("Unsupported task type: {0}",
                                                                            execute.GetType().Name));
                        }
                    }
                }
            }
            return(results);
        }
示例#3
0
 public void Add(TaskConfigInstance value)
 {
     BaseAdd(new TaskConfigProxy(value));
 }
示例#4
0
 public void Add(TaskConfigInstance value)
 {
     BaseAdd(new TaskConfigProxy(value));
 }
 public TaskConfigProxy(TaskConfigInstance instance)
 {
     _when   = instance.ExecuteCommandWhen;
     _config = instance;
 }
示例#6
0
        protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey)
        {
            string taskType = reader.GetAttribute("type");
            if (string.IsNullOrEmpty(taskType)) taskType = TaskType.command.ToString();
            TaskType type = (TaskType)Enum.Parse(typeof(TaskType), taskType);
            switch (type)
            {
                case TaskType.snapshot:
                    _config = new SnapshotTaskConfig(_when);
                    break;
                case TaskType.virtualmachine:
                    _config = new VirtualMachineTaskConfig(_when);
                    break;
                case TaskType.command:
                default:
                    _config = new CommandTaskConfig(_when);
                    break;
            }

            _config.ProxyDeserializeElement(reader, serializeCollectionKey);
        }
示例#7
0
 public TaskConfigProxy(TaskConfigInstance instance)
 {
     _when = instance.ExecuteCommandWhen;
     _config = instance;
 }