Beispiel #1
0
        public virtual void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
        {
            this._processDefinition = creationContext.ProcessDefinition;

            Type delegatingObjectClass = creationContext.DelegatingObject.GetType();

            if (delegatingObjectClass == typeof(AttributeImpl))
            {
                String type = xmlElement.GetProperty("type");
                if ((Object)type != null)
                {
                    this._className = ((String)attributeTypes[type]);
                    string suportedTypes = "supported types: ";
                    foreach (Object o in attributeTypes.Keys)
                    {
                        suportedTypes += o.ToString() + " ,";
                    }
                    creationContext.Check(((Object)this._className != null), "attribute type '" + type + "' is not supported. " + suportedTypes + " !");
                }
                else
                {
                    this._className = xmlElement.GetProperty("serializer");
                    creationContext.Check(((Object)this._className != null), "for an attribute, you must specify either a type or a serializer");
                }
            }
            else if (delegatingObjectClass == typeof(FieldImpl))
            {
                this._className = xmlElement.GetProperty("class");
                creationContext.Check(((Object)this._className != null), "no class specified for a delegation : " + xmlElement);
            }
            else
            {
                this._className = xmlElement.GetProperty("handler");
                creationContext.Check(((Object)this._className != null), "no handler specified for a delegation : " + xmlElement);
            }

            log.Debug("parsing delegation for tag '" + xmlElement.Name + "' : " + this._className);

            // parse the exception handler
            String exceptionHandlerText = xmlElement.GetAttribute("on-exception");

            if ((Object)exceptionHandlerText != null)
            {
                _exceptionHandlingType = ExceptionHandlingTypeHelper.FromText(exceptionHandlerText);
                creationContext.Check((_exceptionHandlingType != 0), "unknown exception handler '" + exceptionHandlerText + "' in delegation " + xmlElement);
            }

            // create the configuration string
            XmlElement  configurationXml = new XmlElement("cfg");
            IEnumerator iter             = xmlElement.GetChildElements("parameter").GetEnumerator();

            while (iter.MoveNext())
            {
                configurationXml.AddChild((XmlElement)iter.Current);
            }
            _configuration = configurationXml.ToString();
        }
Beispiel #2
0
        private void HandleException(DelegationDef delegation, ExecutionContext 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));
            }
        }
Beispiel #3
0
        public virtual void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			this._processDefinition = creationContext.ProcessDefinition;

			Type delegatingObjectClass = creationContext.DelegatingObject.GetType();
			if (delegatingObjectClass == typeof (AttributeImpl))
			{
				String type = xmlElement.GetProperty("type");
				if ((Object) type != null)
				{
					this._className = ((String) attributeTypes[type]);
					string suportedTypes = "supported types: ";
					foreach (Object o in attributeTypes.Keys)
					{
						suportedTypes += o.ToString() + " ,";				
					}
					creationContext.Check(((Object) this._className != null), "attribute type '" + type + "' is not supported. " + suportedTypes +" !");
				}
				else
				{
					this._className = xmlElement.GetProperty("serializer");
					creationContext.Check(((Object) this._className != null), "for an attribute, you must specify either a type or a serializer");
				}
			}
			else if (delegatingObjectClass == typeof (FieldImpl))
			{
				this._className = xmlElement.GetProperty("class");
				creationContext.Check(((Object) this._className != null), "no class specified for a delegation : " + xmlElement);
			}
			else
			{
				this._className = xmlElement.GetProperty("handler");
				creationContext.Check(((Object) this._className != null), "no handler specified for a delegation : " + xmlElement);
			}

			log.Debug("parsing delegation for tag '" + xmlElement.Name + "' : " + this._className);

			// parse the exception handler    
			String exceptionHandlerText = xmlElement.GetAttribute("on-exception");
			if ((Object) exceptionHandlerText != null)
			{
				_exceptionHandlingType = ExceptionHandlingTypeHelper.FromText(exceptionHandlerText);
				creationContext.Check((_exceptionHandlingType != 0), "unknown exception handler '" + exceptionHandlerText + "' in delegation " + xmlElement);
			}

			// create the configuration string
			XmlElement configurationXml = new XmlElement("cfg");
			IEnumerator iter = xmlElement.GetChildElements("parameter").GetEnumerator();
			while (iter.MoveNext())
			{
				configurationXml.AddChild((XmlElement) iter.Current);
			}
			_configuration = configurationXml.ToString();
		}