Ejemplo n.º 1
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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public void Add(TaskConfigInstance value)
 {
     BaseAdd(new TaskConfigProxy(value));
 }
Ejemplo n.º 4
0
 public void Add(TaskConfigInstance value)
 {
     BaseAdd(new TaskConfigProxy(value));
 }
Ejemplo n.º 5
0
 public TaskConfigProxy(TaskConfigInstance instance)
 {
     _when   = instance.ExecuteCommandWhen;
     _config = instance;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
 public TaskConfigProxy(TaskConfigInstance instance)
 {
     _when = instance.ExecuteCommandWhen;
     _config = instance;
 }