Example #1
0
 public void DelegateAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         executionContext.CreateLog(EventType.ACTION);
         executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof(IAction)));
         IActionHandler actionHandler = (IActionHandler)GetDelegate(delegation);
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         actionHandler.Run(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }
Example #2
0
        private void HandleException(DelegationImpl delegation, ExecutionContextImpl executionContext, Exception exception)
        {
            log.Debug("handling delegation exception :", exception);

            String exceptionClassName  = exception.GetType().FullName;
            String delegationClassName = delegation.ClassName;

            ExceptionHandlingType exceptionHandlingType = delegation.ExceptionHandlingType;

            if (exceptionHandlingType != 0)
            {
                if (exceptionHandlingType == ExceptionHandlingType.IGNORE)
                {
                    log.Debug("ignoring '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
                }
                else if (exceptionHandlingType == ExceptionHandlingType.LOG)
                {
                    log.Debug("logging '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
                    executionContext.AddLogDetail(new ExceptionReportImpl(exception));
                }
                else if (exceptionHandlingType == ExceptionHandlingType.ROLLBACK)
                {
                    log.Debug("rolling back for '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
                    throw new SystemException("rolling back for '" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
                }
                else
                {
                    throw new SystemException("unknown exception handler '" + exceptionHandlingType + "' : " + exception.Message);
                }
            }
            else
            {
                log.Debug("'" + exceptionClassName + "' in delegation '" + delegationClassName + "' : " + exception.Message);
                executionContext.AddLogDetail(new ExceptionReportImpl(exception));
            }
        }
Example #3
0
 public void DelegateScheduledAction(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         /* can't add logs because of a integritiy constraint violation...
          * can you find why ?
          */
         if (executionContext.GetFlow() != null)
         {
             executionContext.CreateLog(EventType.ACTION);
             executionContext.AddLogDetail(new DelegateCallImpl(delegation, typeof(IAction)));
         }
         IActionHandler actionHandler = (IActionHandler)GetDelegate(delegation);
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         actionHandler.Run(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }