Exemplo n.º 1
0
        private static void BuildProcedureFromPlan(Procedure procedure, ProcedurePlan plan)
        {
            foreach (var stepNode in plan.ProcedureStepNodes)
            {
                var className = stepNode.GetAttribute("class");
                if (string.IsNullOrEmpty(className))
                {
                    throw new ProcedureBuilderException("Required attribute 'class' is missing.");
                }

                var stepClass = Type.GetType(className);
                if (stepClass == null)
                {
                    throw new ProcedureBuilderException(string.Format("Unable to resolve class {0}.", className));
                }

                var builder = GetBuilderForClass(stepClass);
                var step    = builder.CreateInstance(stepNode, procedure);

                if (procedure.DowntimeRecoveryMode && !step.CreateInDowntimeMode)
                {
                    continue;
                }

                procedure.AddProcedureStep(step);
            }
        }
Exemplo n.º 2
0
        private static void BuildProcedureFromPlan(Procedure procedure, ProcedureType type)
        {
            // if the type specifies a base type, apply it first
            if (type.BaseType != null)
            {
                BuildProcedureFromPlan(procedure, type.BaseType);
            }
            else
            {
                // otherwise use the root plan as the base plan
                BuildProcedureFromPlan(procedure, ProcedurePlan.GetRootPlan());
            }

            BuildProcedureFromPlan(procedure, type.Plan);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the plan for this procedure type from the specified prototype procedure.
 /// </summary>
 /// <param name="prototype"></param>
 public virtual void SetPlanFromPrototype(Procedure prototype)
 {
     this.Plan = ProcedurePlan.CreateFromProcedure(prototype);
 }