Ejemplo n.º 1
0
        public void DefineExecuteAndRollbackActions()
        {
            Frost.EngineLogger.WriteLog(LoggingLevel.TRACE, "Defining ExecuteState and RollbackState for ", this.PackageID);

            string RequestStateKey = "";

            switch (this.RequestedState)
            {
            case PKG_REQUEST_STATE.PKG_REQUEST_STATE_ABSENT:
                RequestStateKey = "absent";
                break;

            case PKG_REQUEST_STATE.PKG_REQUEST_STATE_CACHE:
                RequestStateKey = "cache";
                break;

            case PKG_REQUEST_STATE.PKG_REQUEST_STATE_NONE:
                RequestStateKey = "none";
                break;

            case PKG_REQUEST_STATE.PKG_REQUEST_STATE_PRESENT:
                RequestStateKey = "present";
                break;

            case PKG_REQUEST_STATE.PKG_REQUEST_STATE_REPAIR:
                RequestStateKey = "repair";
                break;
            }

            Frost.EngineLogger.WriteLog(LoggingLevel.INFO, "RequestedState: ", RequestStateKey);

            this.ExecuteState  = GetActionValue(this.ExecuteStateDescriptor, RequestStateKey);
            this.RollbackState = GetActionValue(this.RollbackStateDescriptor, RequestStateKey);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        /// <param name="PackageDescriptor">The <see cref="XmlNode"/> in the manifest which describes the package.</param>
        public Package(XmlNode PackageDescriptor)
        {
            if (PackageDescriptor.Attributes["ID"] == null)
            {
                throw new FrostConfigException("Package descriptor node must define an ID attribute");
            }

            PackageID = PackageDescriptor.Attributes["ID"].Value;

            if (string.IsNullOrEmpty(PackageID))
            {
                throw new FrostConfigException("Package ID must be defined, cant be null/emtpy");
            }

            XmlNode NodeChecker = PackageDescriptor.SelectSingleNode("CurrentState");

            if (NodeChecker == null)
            {
                throw new FrostConfigException("Package ", PackageID, " does not define a CurrentState node");
            }
            CurrentState = (CUR_PACKAGE_STATE)Variables.ValueParser(NodeChecker);

            ExecuteStateDescriptor  = PackageDescriptor.SelectSingleNode("ExecuteState");
            RollbackStateDescriptor = PackageDescriptor.SelectSingleNode("RollbackState");
            RequestedState          = PKG_REQUEST_STATE.PKG_REQUEST_STATE_NONE;
            ExecuteState            = PKG_ACTION_STATE.PKG_ACTION_STATE_NONE;
            RollbackState           = PKG_ACTION_STATE.PKG_ACTION_STATE_NONE;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        /// <param name="PackageDescriptor">The <see cref="XmlNode"/> in the manifest which describes the package.</param>
        public Package(XmlNode PackageDescriptor)
        {
            if (PackageDescriptor.Attributes["ID"] == null)
            {
                throw new FrostConfigException("Package descriptor node must define an ID attribute");
            }

            PackageID = PackageDescriptor.Attributes["ID"].Value;

            if (string.IsNullOrEmpty(PackageID))
            {
                throw new FrostConfigException("Package ID must be defined, cant be null/emtpy");
            }

            XmlNode NodeChecker = PackageDescriptor.SelectSingleNode("CurrentState");
            if(NodeChecker == null)
            {
                throw new FrostConfigException("Package ", PackageID, " does not define a CurrentState node");
            }
            CurrentState = (CUR_PACKAGE_STATE)Variables.ValueParser(NodeChecker);

            ExecuteStateDescriptor = PackageDescriptor.SelectSingleNode("ExecuteState");
            RollbackStateDescriptor = PackageDescriptor.SelectSingleNode("RollbackState");
            RequestedState = PKG_REQUEST_STATE.PKG_REQUEST_STATE_NONE;
            ExecuteState = PKG_ACTION_STATE.PKG_ACTION_STATE_NONE;
            RollbackState = PKG_ACTION_STATE.PKG_ACTION_STATE_NONE;
        }
Ejemplo n.º 4
0
        public void DefineExecuteAndRollbackActions()
        {
            Frost.EngineLogger.WriteLog(LoggingLevel.TRACE, "Defining ExecuteState and RollbackState for ", this.PackageID);

            string RequestStateKey = "";
            switch (this.RequestedState)
            {
                case PKG_REQUEST_STATE.PKG_REQUEST_STATE_ABSENT:
                    RequestStateKey = "absent";
                    break;
                case PKG_REQUEST_STATE.PKG_REQUEST_STATE_CACHE:
                    RequestStateKey = "cache";
                    break;
                case PKG_REQUEST_STATE.PKG_REQUEST_STATE_NONE:
                    RequestStateKey = "none";
                    break;
                case PKG_REQUEST_STATE.PKG_REQUEST_STATE_PRESENT:
                    RequestStateKey = "present";
                    break;
                case PKG_REQUEST_STATE.PKG_REQUEST_STATE_REPAIR:
                    RequestStateKey = "repair";
                    break;
            }

            Frost.EngineLogger.WriteLog(LoggingLevel.INFO, "RequestedState: ", RequestStateKey);

            this.ExecuteState = GetActionValue(this.ExecuteStateDescriptor, RequestStateKey);
            this.RollbackState = GetActionValue(this.RollbackStateDescriptor, RequestStateKey);
        }