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); }
/// <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; }
/// <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; }
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); }