Пример #1
0
		public override void ReadProcessData(XmlElement xmlElement, CreationContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);

			// get the process definition for that name
			String subProcessDefinitionName = xmlElement.GetProperty("process");
			creationContext.Check(((Object) subProcessDefinitionName != null), "process is missing in the process state : " + subProcessDefinitionName);
			DbSession dbSession = creationContext.DbSession;
			dbSession.SaveOrUpdate(this._processDefinition);
			try
			{
				this._subProcess = (ProcessDefinitionImpl) dbSession.FindOne(queryFindProcessDefinitionByName, subProcessDefinitionName, DbType.STRING);
			}
			catch (SystemException e)
			{
				creationContext.AddError("process '" + subProcessDefinitionName + "' was not deployed while it is referenced in a process-state. Exception: " + e.Message);
			}

			// parse the processInvokerDelegation
			creationContext.DelegatingObject = this;
			this._processInvokerDelegation = new DelegationImpl();
			XmlElement invocationElement = xmlElement.GetChildElement("process-invocation");
			creationContext.Check((invocationElement != null), "process-invocation is missing in the process-state : " + xmlElement);
			this._processInvokerDelegation.ReadProcessData(invocationElement, creationContext);

			creationContext.DelegatingObject = null;

			// parse the actorExpression
			this._actorExpression = xmlElement.GetProperty("actor-expression");
			creationContext.Check(((Object) _actorExpression != null), "actor-expression is missing in the process-state : " + xmlElement);
		}
Пример #2
0
		public void ReadProcessData(XmlElement xmlElement, CreationContext creationContext)
		{
			DefinitionObjectImpl definitionObject = creationContext.DefinitionObject;

			// first make sure the definitionObject has got an id
			DbSession dbSession = creationContext.DbSession;
			dbSession.SaveOrUpdate(definitionObject);

			// store the reference link to the definitionObject 
			this._definitionObjectId = definitionObject.Id;

			log.Debug("adding action : ");
			log.Debug("  definitionObjectId: " + _definitionObjectId);
			log.Debug("  definitionObject: " + definitionObject);

			this._eventType = EventTypeHelper.fromText(xmlElement.GetAttribute("event"));

			log.Debug("action on eventType '" + _eventType + "' and definitionObject " + creationContext.DefinitionObject);

			// reading the action delegation
			creationContext.DelegatingObject = this;
			this._actionDelegation = new DelegationImpl();
			this._actionDelegation.ReadProcessData(xmlElement, creationContext);
			creationContext.DelegatingObject = null;

			dbSession.SaveOrUpdate(this);
		}
Пример #3
0
        public IDictionary ParseConfiguration(DelegationImpl delegationImpl)
        {
            IDictionary parameters = new Hashtable();
            try
            {
                String configuration = delegationImpl.Configuration;
                if ((Object)configuration != null)
                {
                    XmlParser xmlParser = new XmlParser(configuration);
                    xmlParser.Validation = false;
                    XmlElement configurationXmlElement = xmlParser.Parse();
                    IList parameterXmlElements = configurationXmlElement.GetChildElements("parameter");
                    IEnumerator iter = parameterXmlElements.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        XmlElement parameterXmlElement = (XmlElement)iter.Current;

                        String name = parameterXmlElement.GetProperty("name");
                        if ((Object)name == null)
                        {
                            throw new SystemException("invalid delegation-configuration : " + configurationXmlElement);
                        }

                        parameters[name] = GetObject(parameterXmlElement);
                    }
                }
            }
            catch (Exception t)
            {
                log.Error("can't parse configuration : ", t);
                throw new SystemException("can't parse configuration : " + t.Message);
            }

            return parameters;
        }
Пример #4
0
		public TransitionImpl DelegateDecision(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			TransitionImpl selectedTransition = null;

			try
			{
				IDecisionHandler decision = (IDecisionHandler) GetDelegate(delegation);
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				String transitionName = decision.Decide(executionContext);

				if ((Object) transitionName == null)
				{
					throw new SystemException("Decision-delegate for decision '" + executionContext.GetNode() + "' returned null instead of a transition-name : " + decision.GetType().FullName);
				}

				try
				{
					Object[] args = new Object[] {executionContext.GetNode().Id, transitionName};
					IType[] types = new IType[] {DbType.LONG, DbType.STRING};
					selectedTransition = (TransitionImpl) executionContext.DbSession.FindOne(queryFindLeavingTransitionByName, args, types);
				}
				catch (Exception t)
				{
					throw new SystemException("couldn't find transition '" + transitionName + "' that was selected by the decision-delegate of activity '" + executionContext.GetNode().Name + "' : " + t.Message);
				}
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}

			return selectedTransition;
		}
Пример #5
0
        public TransitionImpl DelegateDecision(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            TransitionImpl selectedTransition = null;

            try
            {
                IDecisionHandler decision = (IDecisionHandler)GetDelegate(delegation);
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                String transitionName = decision.Decide(executionContext);

                if ((Object)transitionName == null)
                {
                    throw new SystemException("Decision-delegate for decision '" + executionContext.GetNode() + "' returned null instead of a transition-name : " + decision.GetType().FullName);
                }

                try
                {
                    Object[] args  = new Object[] { executionContext.GetNode().Id, transitionName };
                    IType[]  types = new IType[] { DbType.LONG, DbType.STRING };
                    selectedTransition = (TransitionImpl)executionContext.DbSession.FindOne(queryFindLeavingTransitionByName, args, types);
                }
                catch (Exception t)
                {
                    throw new SystemException("couldn't find transition '" + transitionName + "' that was selected by the decision-delegate of activity '" + executionContext.GetNode().Name + "' : " + t.Message);
                }
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(selectedTransition);
        }
Пример #6
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);
			creationContext.DelegatingObject = this;
			this._decisionDelegation = new DelegationImpl();
			this._decisionDelegation.ReadProcessData(xmlElement, creationContext);
			creationContext.DelegatingObject = null;
		}
Пример #7
0
        private IAuthorizationHandler GetAuthorizationHandler(ProcessDefinitionImpl processDefinition)
        {
            IAuthorizationHandler authorizationHandler = null;
            DelegationImpl        delegation           = processDefinition.AuthorizationDelegation;

            if (delegation != null)
            {
                authorizationHandler = (IAuthorizationHandler)delegation.GetDelegate();
            }
            return(authorizationHandler);
        }
Пример #8
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);
			this._scope = creationContext.ProcessBlock;
			this._initialValue = xmlElement.GetProperty("initial-value");

			creationContext.DelegatingObject = this;
			this._serializerDelegation = new DelegationImpl();
			this._serializerDelegation.ReadProcessData(xmlElement, creationContext);
			creationContext.DelegatingObject = null;
			creationContext.AddReferencableObject(_name, (ProcessBlockImpl) this._scope, typeof (IAttribute), this);
		}
Пример #9
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);

			if ((Object) xmlElement.GetAttribute("handler") != null)
			{
				creationContext.DelegatingObject = this;
				this._forkDelegation = new DelegationImpl();
				this._forkDelegation.ReadProcessData(xmlElement, creationContext);
				creationContext.DelegatingObject = null;
			}
		}
Пример #10
0
		public Object CreateObject(DelegationImpl delegationImpl)
		{
			Object delegateClass = null;
			try
			{
				log.Debug("creating delegate '" + delegationImpl.ClassName + "'");
				if (delegationImpl.ClassName.IndexOf(",") != -1)
				{
					int index = delegationImpl.ClassName.IndexOf(",");
					string className = delegationImpl.ClassName.Substring(0, index).Trim();
					string assemblyName = delegationImpl.ClassName.Substring(index + 1).Trim();

					DbSession dbSession = null;
					AssemblyFileImpl assemblyFile = null;
					try
					{
						dbSession = OpenSession();
						Object[] args = new Object[] {delegationImpl.ProcessDefinition.Id, assemblyName};
						IType[] types = new IType[] {DbType.LONG, DbType.STRING};
						assemblyFile = (AssemblyFileImpl) dbSession.FindOne(queryFindAssemblyFile, args, types);
					} 
					catch (ObjectNotFoundException onfe){}
					finally
					{
						if (dbSession!=null)
						{
							dbSession.Close();
						}
					}

					if (assemblyFile != null)
					{
						Assembly loaded = Assembly.Load(assemblyFile.Bytes);
						Type dbDelegationType =  loaded.GetType(className);
						delegateClass = Activator.CreateInstance(dbDelegationType, false);
						return delegateClass;
					}

				}
				//load Assembly from environment
				log.Debug("load Assembly from environment");
				Type delegationType = Type.GetType(delegationImpl.ClassName);
				delegateClass = Activator.CreateInstance(delegationType, false);

				return delegateClass;
			}
			catch (Exception t)
			{
				log.Error("can't instantiate delegate '" + delegationImpl.ClassName + "' : ", t);
				throw new SystemException("can't instantiate delegate '" + delegationImpl.ClassName + "' : " + t.Message);
			}
		}
Пример #11
0
		public JobImpl(Job job, String reference)
		{
			_processDefinition = job.ProcessDefinition;
			_context = job.Context;
			_date = job.Date;
			_userId = job.UserId;
			_pwd = job.Pwd;

			this._reference = reference;
			_actionDelegation = new DelegationImpl();
			_actionDelegation.ProcessDefinition = job.ProcessDefinition;
			_actionDelegation.ClassName = job.TaskClassName;
			_actionDelegation.Configuration = job.Configuration;
		}
Пример #12
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			base.ReadProcessData(xmlElement, creationContext);

			XmlElement assignmentElement = xmlElement.GetChildElement("assignment");
			if (assignmentElement != null)
			{
				creationContext.DelegatingObject = this;
				this._assignmentDelegation = new DelegationImpl();
				this._assignmentDelegation.ReadProcessData(assignmentElement, creationContext);
				creationContext.DelegatingObject = null;
			}
			this._actorRoleName = xmlElement.GetProperty("role");
		}
Пример #13
0
 public void DelegateFork(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     try
     {
         // delegate the fork
         IForkHandler forker = (IForkHandler)delegation.GetDelegate();
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         forker.Fork(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
 }
Пример #14
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);
			}
		}
Пример #15
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);
     }
 }
Пример #16
0
 public Object[] DelegateProcessTermination(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     Object[] completionData = new Object[2];
     try
     {
         IProcessInvocationHandler processInvoker = (IProcessInvocationHandler)delegation.GetDelegate();
         log.Debug("collecting results from the sub-process...");
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         completionData[0] = processInvoker.CollectResults(executionContext);
         completionData[1] = processInvoker.GetCompletionTransitionName(executionContext);
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
     return(completionData);
 }
Пример #17
0
        public bool DelegateJoin(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            bool reactivateParent = false;

            try
            {
                IJoinHandler joiner = (IJoinHandler)delegation.GetDelegate();
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                reactivateParent = joiner.Join(executionContext);
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(reactivateParent);
        }
Пример #18
0
        public String DelegateAssignment(DelegationImpl delegation, ExecutionContextImpl executionContext)
        {
            String actorId = null;

            try
            {
                IAssignmentHandler assigner = (IAssignmentHandler)delegation.GetDelegate();
                executionContext.SetConfiguration(ParseConfiguration(delegation));
                actorId = assigner.SelectActor(executionContext);
            }
            catch (Exception t)
            {
                HandleException(delegation, executionContext, t);
            }

            return(actorId);
        }
Пример #19
0
 public Object[] DelegateProcessInvocation(DelegationImpl delegation, ExecutionContextImpl executionContext)
 {
     Object[] invocationData = new Object[2];
     try
     {
         IProcessInvocationHandler processInvoker = (IProcessInvocationHandler)delegation.GetDelegate();
         log.Debug("requesting the attributeValues from the process invoker...");
         executionContext.SetConfiguration(ParseConfiguration(delegation));
         invocationData[0] = processInvoker.GetStartTransitionName(executionContext);
         invocationData[1] = processInvoker.GetStartAttributeValues(executionContext);
         log.Debug("process invoker specified transition '" + invocationData[0] + "' and supplied attributeValues '" + invocationData[1] + "'");
     }
     catch (Exception t)
     {
         HandleException(delegation, executionContext, t);
     }
     return(invocationData);
 }
Пример #20
0
		public Object CreateObject(DelegationImpl delegationImpl)
		{
			Object delegateClass = null;
			try
			{
				log.Debug("creating delegate '" + delegationImpl.ClassName + "'");
				Type delegationType = Type.GetType(delegationImpl.ClassName);

				delegateClass = Activator.CreateInstance(delegationType, false);

			}
			catch (Exception t)
			{
				log.Error("can't instantiate delegate '" + delegationImpl.ClassName + "' : ", t);
				throw new SystemException("can't instantiate delegate '" + delegationImpl.ClassName + "' : " + t.Message);
			}
			return delegateClass;
		}
Пример #21
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);
			}
		}
Пример #22
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);
     }
 }
Пример #23
0
 //public String DelegateAssignment(DelegationImpl delegation)
 //{
 //    String actorId = null;
 //    IAssignmentHandler assigner = (IAssignmentHandler)delegation.GetDelegate();
 //    IDictionary expression = this.ParseConfiguration(delegation);
 //    actorExpressionResolverService = new ActorExpressionResolverService();
 //    actorId = actorExpressionResolverService.ResolveArgument(expression["expression"].ToString()).Id;
 //    return actorId;
 //}
 public Object GetDelegate(DelegationImpl delegationImpl)
 {
     Object delegateClass = null;
     IClassLoader classLoader = null;
     try
     {
         classLoader = (IClassLoader)ServiceLocator.Instance.GetService(typeof(IClassLoader));
         delegateClass = classLoader.CreateObject(delegationImpl);
     }
     finally
     {
         ServiceLocator.Instance.Release(classLoader);
     }
     // configure class
     if (delegateClass is IConfigurable)
     {
         IConfigurable configurable = (IConfigurable)delegateClass;
         IDictionary parameters = ParseConfiguration(delegationImpl);
         configurable.SetConfiguration(parameters);
     }
     return delegateClass;
 }
Пример #24
0
        public Object GetDelegate(DelegationImpl delegationImpl)
        {
            Object       delegateClass = null;
            IClassLoader classLoader   = null;

            try
            {
                classLoader   = (IClassLoader)ServiceLocator.Instance.GetService(typeof(IClassLoader));
                delegateClass = classLoader.CreateObject(delegationImpl);
            }
            finally
            {
                ServiceLocator.Instance.Release(classLoader);
            }
            // configure class
            if (delegateClass is IConfigurable)
            {
                IConfigurable configurable = (IConfigurable)delegateClass;
                IDictionary   parameters   = ParseConfiguration(delegationImpl);
                configurable.SetConfiguration(parameters);
            }
            return(delegateClass);
        }
Пример #25
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));
            }
        }
Пример #26
0
        private IDictionary ParseConfiguration(DelegationImpl delegationImpl)
        {
            IDictionary parameters = new Hashtable();

            try
            {
                String configuration = delegationImpl.Configuration;
                if ((Object)configuration != null)
                {
                    XmlParser xmlParser = new XmlParser(configuration);
                    xmlParser.Validation = false;
                    XmlElement  configurationXmlElement = xmlParser.Parse();
                    IList       parameterXmlElements    = configurationXmlElement.GetChildElements("parameter");
                    IEnumerator iter = parameterXmlElements.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        XmlElement parameterXmlElement = (XmlElement)iter.Current;

                        String name = parameterXmlElement.GetProperty("name");
                        if ((Object)name == null)
                        {
                            throw new SystemException("invalid delegation-configuration : " + configurationXmlElement);
                        }

                        parameters[name] = GetObject(parameterXmlElement);
                    }
                }
            }
            catch (Exception t)
            {
                log.Error("can't parse configuration : ", t);
                throw new SystemException("can't parse configuration : " + t.Message);
            }

            return(parameters);
        }
Пример #27
0
		public Object[] DelegateProcessInvocation(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			Object[] invocationData = new Object[2];
			try
			{
				IProcessInvocationHandler processInvoker = (IProcessInvocationHandler) delegation.GetDelegate();
				log.Debug("requesting the attributeValues from the process invoker...");
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				invocationData[0] = processInvoker.GetStartTransitionName(executionContext);
				invocationData[1] = processInvoker.GetStartAttributeValues(executionContext);
				log.Debug("process invoker specified transition '" + invocationData[0] + "' and supplied attributeValues '" + invocationData[1] + "'");
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}
			return invocationData;
		}
Пример #28
0
        public virtual DelegationImpl CreateDecisionDelegation()
		{
			_decisionDelegation = new DelegationImpl(_processDefinition);
			return _decisionDelegation;
		}
Пример #29
0
        public virtual DelegationImpl CreateJoinDelegation()
		{
			_joinDelegation = new DelegationImpl(_processDefinition);
			return _joinDelegation;
		}
Пример #30
0
        public virtual DelegationImpl CreateForkDelegation()
		{
			_forkDelegation = new DelegationImpl(_processDefinition);
			return _forkDelegation;
		}
Пример #31
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			this._endState = new EndStateImpl();
			this._startState = new StartStateImpl();

			// read the process-block contents, the start- and the end-state 
			creationContext.ProcessBlock = this;
			base.ReadProcessData(xmlElement, creationContext);
			XmlElement startElement = xmlElement.GetChildElement("start-state");
			creationContext.Check((startElement != null), "element start-state is missing");
			XmlElement endElement = xmlElement.GetChildElement("end-state");
			creationContext.Check((endElement != null), "element end-state is missing");
			_startState.ReadProcessData(startElement, creationContext);
			_endState.ReadProcessData(endElement, creationContext);
			creationContext.ProcessBlock = null;

			// add the start & end state to the nodes of this process definition
			this._nodes.Add(_startState);
			this._nodes.Add(_endState);

			// add the end state as referencable object
			creationContext.AddReferencableObject(this._endState.Name, this, typeof (INode), this._endState);

			// read the optional authorization handler
			XmlElement authorizationElement = xmlElement.GetChildElement("authorization");
			if (authorizationElement != null)
			{
				creationContext.DelegatingObject = this;
				this.authorizationDelegation = new DelegationImpl();
				this.authorizationDelegation.ReadProcessData(authorizationElement, creationContext);
				creationContext.DelegatingObject = null;
			}

			// read the optional responsible for this process definition
			this._responsibleUserName = xmlElement.GetProperty("responsible");

			// calculate the version of this process definition
            //todo 這行應該移到ProcessDefinitionService
			//this._version = GetVersionNr(creationContext);

			// attach the class files to this process definitions
            //todo 這行應該移到ProcessDefinitionService
			//this._classFiles = GetAssemblyFiles(creationContext);
		}
Пример #32
0
		public DelegationImpl CreateProcessInvocationDelegation()
		{
			_processInvokerDelegation = new DelegationImpl(_processDefinition);
			return _processInvokerDelegation;
		}
Пример #33
0
        public virtual DelegationImpl CreateAssignmentDelegation()
		{
			_assignmentDelegation = new DelegationImpl(_processDefinition);
			return _assignmentDelegation;
		}
Пример #34
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));
			}
		}
Пример #35
0
		public String DelegateAssignment(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			String actorId = null;

			try
			{
				IAssignmentHandler assigner = (IAssignmentHandler) delegation.GetDelegate();
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				actorId = assigner.SelectActor(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}

			return actorId;
		}
Пример #36
0
		public bool DelegateJoin(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			bool reactivateParent = false;

			try
			{
				IJoinHandler joiner = (IJoinHandler) delegation.GetDelegate();
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				reactivateParent = joiner.Join(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}

			return reactivateParent;
		}
Пример #37
0
		public void DelegateFork(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			try
			{
				// delegate the fork
				IForkHandler forker = (IForkHandler) delegation.GetDelegate();
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				forker.Fork(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}
		}
Пример #38
0
		public Object[] DelegateProcessTermination(DelegationImpl delegation, ExecutionContextImpl executionContext)
		{
			Object[] completionData = new Object[2];
			try
			{
				IProcessInvocationHandler processInvoker = (IProcessInvocationHandler) delegation.GetDelegate();
				log.Debug("collecting results from the sub-process...");
				executionContext.SetConfiguration(ParseConfiguration(delegation));
				completionData[0] = processInvoker.CollectResults(executionContext);
				completionData[1] = processInvoker.GetCompletionTransitionName(executionContext);
			}
			catch (Exception t)
			{
				HandleException(delegation, executionContext, t);
			}
			return completionData;
		}
Пример #39
0
		public void ReadWebData(XmlElement xmlElement, CreationContext creationContext)
		{
			this._name = xmlElement.GetProperty("name");
			this._description = xmlElement.GetProperty("description");
			this._index = creationContext.Index;

			log.Debug("paring web information for field " + _name);

			creationContext.DelegatingObject = this;
			XmlElement formatterElement = xmlElement.GetChildElement("htmlformatter");
			if (formatterElement != null)
			{
				this._htmlFormatterDelegation = new DelegationImpl();
				this._htmlFormatterDelegation.ReadProcessData(formatterElement, creationContext);
			}
			creationContext.DelegatingObject = null;
		}
Пример #40
0
        public virtual DelegationImpl CreateSerializerDelegation()
		{
			_serializerDelegation = new DelegationImpl(_processDefinition);
			return _serializerDelegation;
		}