public IJoinPoint synchronized(IToken tk) { IJoinPoint joinPoint = null; tk.NodeId = this.Synchronizer.Id; //log.debug("The weight of the Entering TransitionInstance is " + tk.getValue()); // 触发TokenEntered事件 NodeInstanceEvent event1 = new NodeInstanceEvent(this); event1.Token = tk; event1.EventType = NodeInstanceEventEnum.NODEINSTANCE_TOKEN_ENTERED;//token 进入 this.fireNodeEvent(event1); //汇聚检查 joinPoint = ((ProcessInstance)tk.ProcessInstance).createJoinPoint(this, tk);// JoinPoint由谁生成比较好? int value = (int)joinPoint.Value; if (value > this.Volume)//如果value大于同步器容量,那说明出错了 { KernelException exception = new KernelException(tk.ProcessInstance, this.Synchronizer, "Error:The token count of the synchronizer-instance can NOT be greater than it's volumn "); throw exception; } if (value < this.Volume) {// 如果Value小于容量则继续等待其他弧的汇聚。 (哪些状态为dead的token到此结束,不再向下传递) return(null); } return(joinPoint); }
public static void Push(KernelException ex, bool critical = true) { DrawSplash(); if (ex.Message.Length + 27 < Terminal.WindowHeight) { Terminal.CursorTop = 2; Terminal.CursorLeft = 27; Terminal.White(ex.MethodBase); Terminal.CursorTop = 4; Terminal.CursorLeft = 70; Terminal.White(ex.Message); } else { Terminal.CursorTop = 12; Terminal.CursorLeft = 2; Terminal.White(ex.MethodBase ?? "MethodBase is null"); Terminal.CursorTop = 14; Terminal.CursorLeft = 2; Terminal.White(ex.Message); } if (!critical) { Terminal.CursorTop = Terminal.WindowHeight - 3; Terminal.White("Press the [Enter]-key to resume"); Terminal.CursorTop++; Terminal.ReadLine(); Terminal.Cls(); } else { Terminal.White("").newLine(); if (ex.isSetContext) { Terminal.White("\t\t\t") .Magenta(nameof(ex.context.EAX)).White($" {ex.context.EAX} ") .Magenta(nameof(ex.context.EBX)).White($" {ex.context.EBX} ") .Magenta(nameof(ex.context.EBP)).White($" {ex.context.EBP} ") .Magenta(nameof(ex.context.ECX)).White($" {ex.context.ECX} ") .Magenta(nameof(ex.context.EDI)).White($" {ex.context.EDI} ") .newLine(); Terminal.White("\t\t\t") .Magenta(nameof(ex.context.EIP)).White($" {ex.context.EIP} ") .Magenta(nameof(ex.context.ESI)).White($" {ex.context.ESI} ") .Magenta(nameof(ex.context.ESP)).White($" {ex.context.ESP} ") .Magenta(nameof(ex.context.EDX)).White($" {ex.context.EDX} ") .Magenta(nameof(ex.context.CS)).White($" {ex.context.CS} ") .Magenta(nameof(ex.context.EFlags)).White($" {(int)ex.context.EFlags} ") .newLine(); Terminal.CursorTop = Terminal.WindowHeight - 2; } else { Terminal.CursorTop = Terminal.WindowHeight - 4; } Terminal.White("").AtColor("Press the 'RESET'-button on restart u'r controller.", ConsoleColor.White, true, false).newLine(); Terminal.ReadLine(); // ACPI.Shutdown(); while (true) { } } }
public void Get_Resolver_DoesNot_Throws_Exception_Once_SubSystem_Is_Initialised() { // arrange string path = EmbeddedResourceUtil.ExportToPath("Castle.Windsor.Extensions.Test.data", "castle.config", Path.GetTempPath()); PropertiesSubSystem subSystem = new PropertiesSubSystem(path); WindsorContainer container = new WindsorContainer(); container.Kernel.AddSubSystem(PropertiesSubSystem.SubSystemKey, subSystem); KernelException actual = null; IPropertyResolver resolver = null; // act try { resolver = subSystem.Resolver; } catch (KernelException e) { actual = e; } // assert Assert.IsNull(actual); Assert.IsNotNull(resolver); }
public override string GetUserMessage(KernelException e) { KernelTransaction transaction = SafeAcquireTransaction(TransactionSupplier); using (Statement ignore = transaction.AcquireStatement()) { return(e.GetUserMessage(new SilentTokenNameLookup(transaction.TokenRead()))); } }
private void Level_4() { UserSystem.Login("System", "010101"); Thread.Sleep(1000); try { BootScreen.Boot(); } catch (Exception e) { KernelException ess = new KernelException(e.Message + "\n IL Exception", new IRQSafeContext()); RSoD.Push(ess, true); } }
public override string GetUserMessage(TokenNameLookup tokenNameLookup) { string message = "Unable to drop " + _constraint.userDescription(tokenNameLookup); if (Cause is KernelException) { KernelException cause = ( KernelException )Cause; //JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET: //ORIGINAL LINE: return String.format("%s:%n%s", message, cause.getUserMessage(tokenNameLookup)); return(string.Format("%s:%n%s", message, cause.GetUserMessage(tokenNameLookup))); } return(message); }
public override string GetUserMessage(TokenNameLookup tokenNameLookup) { string message = "Unable to create " + _constraint.prettyPrint(tokenNameLookup); if (!string.ReferenceEquals(_cause, null)) { //JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET: //ORIGINAL LINE: message = String.format("%s:%n%s", message, cause); message = string.Format("%s:%n%s", message, _cause); } if (Cause is KernelException) { KernelException cause = ( KernelException )Cause; //JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET: //ORIGINAL LINE: return String.format("%s:%n%s", message, cause.getUserMessage(tokenNameLookup)); return(string.Format("%s:%n%s", message, cause.GetUserMessage(tokenNameLookup))); } return(message); }
public void run(IProcessInstance processInstance) { if (StartNodeInstance == null) { KernelException exception = new KernelException(processInstance, this.WorkflowProcess, "Error:NetInstance is illegal ,the startNodeInstance can NOT be NULL "); throw exception; } Token token = new Token(); //初始化token token.IsAlive = true; //活动的 token.ProcessInstance = processInstance; //对应流程实例 token.Value = StartNodeInstance.Volume; //token容量 token.StepNumber = 0; //步骤号,开始节点的第一步默认为0 token.FromActivityId = TokenFrom.FROM_START_NODE; //从哪个节点来 "FROM_START_NODE" 规定的节点。 //注意这里并没有保存token StartNodeInstance.fire(token);//启动开始节点 }
/// <summary> /// 开始节点触发 /// </summary> /// <param name="tk"></param> public override void fire(IToken tk) { if (!tk.IsAlive)//如果token是false,那么直接返回 { return;// } if (tk.Value != this.Volume) { KernelException exception = new KernelException(tk.ProcessInstance, this.startNode, "Error:Illegal StartNodeInstance,the tokenValue MUST be equal to the volume "); throw exception; } tk.NodeId = this.Synchronizer.Id;//到开始节点(同步器) IProcessInstance processInstance = tk.ProcessInstance;//从token中获得流程实例对象 //触发token_entered事件 NodeInstanceEvent event1 = new NodeInstanceEvent(this); event1.Token=tk; event1.EventType=NodeInstanceEventEnum.NODEINSTANCE_TOKEN_ENTERED;//token进入 this.fireNodeEvent(event1); //触发fired事件 NodeInstanceEvent event2 = new NodeInstanceEvent(this); event2.Token=tk; event2.EventType=NodeInstanceEventEnum.NODEINSTANCE_FIRED;//token 触发 this.fireNodeEvent(event2); //触发leaving事件 NodeInstanceEvent event4 = new NodeInstanceEvent(this); event4.Token=tk; event4.EventType=NodeInstanceEventEnum.NODEINSTANCE_LEAVING;//token 离开 this.fireNodeEvent(event4); Boolean activiateDefaultCondition = true;//激活默认弧线的标志 ITransitionInstance defaultTransInst = null; //找到所有开始节点的输出弧 for (int i = 0; LeavingTransitionInstances != null && i < LeavingTransitionInstances.Count; i++) { ITransitionInstance transInst = LeavingTransitionInstances[i];//开始节点的边的类型只能是transition String condition = transInst.Transition.Condition; //如果弧线的条件!=null 并且 =“default” ,那么弧线实例就是default的弧线了。 if (condition != null && condition.Equals(ConditionConstant.DEFAULT)) { defaultTransInst = transInst;//记录default转移线,其他条件都未false,才执行它 continue; } Token token = new Token(); // 产生新的token token.IsAlive = true; token.ProcessInstance = processInstance; token.FromActivityId = tk.FromActivityId; token.StepNumber = tk.StepNumber + 1;//步骤号+1 Boolean alive = transInst.take(token);//触发弧线的token if (alive) { activiateDefaultCondition = false; } } if (defaultTransInst != null)//如果defaultTransInst!=null ,走的是default值的弧线 { Token token = new Token(); token.IsAlive = activiateDefaultCondition;//设置token为dead token.ProcessInstance = processInstance; token.FromActivityId = token.FromActivityId; token.StepNumber = tk.StepNumber + 1; defaultTransInst.take(token); } //触发completed事件 NodeInstanceEvent event3 = new NodeInstanceEvent(this); event3.Token=tk; event3.EventType=NodeInstanceEventEnum.NODEINSTANCE_COMPLETED; this.fireNodeEvent(event3); }
private NotFoundException NewIndexNotFoundException(IndexDefinition index, KernelException e) { return(new NotFoundException("No index was found corresponding to " + index + ".", e)); }
public AutoIndexingKernelException(KernelException cause) : base(cause.Status(), cause, cause.Message) { }
public void run(IProcessInstance processInstance) { if (StartNodeInstance == null) { KernelException exception = new KernelException(processInstance, this.WorkflowProcess, "Error:NetInstance is illegal ,the startNodeInstance can NOT be NULL "); throw exception; } Token token = new Token();//初始化token token.IsAlive = true;//活动的 token.ProcessInstance = processInstance;//对应流程实例 token.Value = StartNodeInstance.Volume;//token容量 token.StepNumber = 0;//步骤号,开始节点的第一步默认为0 token.FromActivityId = TokenFrom.FROM_START_NODE;//从哪个节点来 "FROM_START_NODE" 规定的节点。 //注意这里并没有保存token StartNodeInstance.fire(token);//启动开始节点 }
public IJoinPoint synchronized(IToken tk) { IJoinPoint joinPoint = null; tk.NodeId=this.Synchronizer.Id; //log.debug("The weight of the Entering TransitionInstance is " + tk.getValue()); // 触发TokenEntered事件 NodeInstanceEvent event1 = new NodeInstanceEvent(this); event1.Token=tk; event1.EventType=NodeInstanceEventEnum.NODEINSTANCE_TOKEN_ENTERED; this.fireNodeEvent(event1); //汇聚检查 joinPoint = ((ProcessInstance)tk.ProcessInstance).createJoinPoint(this, tk);// JoinPoint由谁生成比较好? int value = (int)joinPoint.Value; //log.debug("The volume of " + this.toString() + " is " + volume); //log.debug("The value of " + this.toString() + " is " + value); if (value > this.Volume) { KernelException exception = new KernelException(tk.ProcessInstance, this.Synchronizer, "Error:The token count of the synchronizer-instance can NOT be greater than it's volumn "); throw exception; } if (value < this.Volume) {// 如果Value小于容量则继续等待其他弧的汇聚。 return null; } return joinPoint; }
/// <summary> /// 开始节点触发 /// </summary> /// <param name="tk"></param> public override void fire(IToken tk) { if (!tk.IsAlive) //如果token是false,那么直接返回 { return; // } if (tk.Value != this.Volume) { KernelException exception = new KernelException(tk.ProcessInstance, this.startNode, "Error:Illegal StartNodeInstance,the tokenValue MUST be equal to the volume "); throw exception; } tk.NodeId = this.Synchronizer.Id; //到开始节点(同步器) IProcessInstance processInstance = tk.ProcessInstance; //从token中获得流程实例对象 //触发token_entered事件 NodeInstanceEvent event1 = new NodeInstanceEvent(this); event1.Token = tk; event1.EventType = NodeInstanceEventEnum.NODEINSTANCE_TOKEN_ENTERED;//token进入 this.fireNodeEvent(event1); //触发fired事件 NodeInstanceEvent event2 = new NodeInstanceEvent(this); event2.Token = tk; event2.EventType = NodeInstanceEventEnum.NODEINSTANCE_FIRED;//token 触发 this.fireNodeEvent(event2); //触发leaving事件 NodeInstanceEvent event4 = new NodeInstanceEvent(this); event4.Token = tk; event4.EventType = NodeInstanceEventEnum.NODEINSTANCE_LEAVING;//token 离开 this.fireNodeEvent(event4); Boolean activiateDefaultCondition = true;//激活默认弧线的标志 ITransitionInstance defaultTransInst = null; //找到所有开始节点的输出弧 for (int i = 0; LeavingTransitionInstances != null && i < LeavingTransitionInstances.Count; i++) { ITransitionInstance transInst = LeavingTransitionInstances[i];//开始节点的边的类型只能是transition String condition = transInst.Transition.Condition; //如果弧线的条件!=null 并且 =“default” ,那么弧线实例就是default的弧线了。 if (condition != null && condition.Equals(ConditionConstant.DEFAULT)) { defaultTransInst = transInst;//记录default转移线,其他条件都未false,才执行它 continue; } Token token = new Token(); // 产生新的token token.IsAlive = true; token.ProcessInstance = processInstance; token.FromActivityId = tk.FromActivityId; token.StepNumber = tk.StepNumber + 1; //步骤号+1 Boolean alive = transInst.take(token); //触发弧线的token if (alive) { activiateDefaultCondition = false; } } if (defaultTransInst != null)//如果defaultTransInst!=null ,走的是default值的弧线 { Token token = new Token(); token.IsAlive = activiateDefaultCondition;//设置token为dead token.ProcessInstance = processInstance; token.FromActivityId = token.FromActivityId; token.StepNumber = tk.StepNumber + 1; defaultTransInst.take(token); } //触发completed事件 NodeInstanceEvent event3 = new NodeInstanceEvent(this); event3.Token = tk; event3.EventType = NodeInstanceEventEnum.NODEINSTANCE_COMPLETED; this.fireNodeEvent(event3); }