springnet-commits Mailing List for Spring Framework .NET (Page 30)
Brought to you by:
aseovic,
markpollack
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(163) |
Sep
(491) |
Oct
(289) |
Nov
(336) |
Dec
(84) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(227) |
Feb
(413) |
Mar
(128) |
Apr
(232) |
May
(92) |
Jun
(299) |
Jul
(386) |
Aug
(228) |
Sep
(237) |
Oct
(426) |
Nov
(325) |
Dec
(405) |
2006 |
Jan
(315) |
Feb
(311) |
Mar
(152) |
Apr
(177) |
May
(443) |
Jun
(92) |
Jul
(88) |
Aug
(80) |
Sep
(288) |
Oct
(515) |
Nov
(1049) |
Dec
(440) |
2007 |
Jan
(179) |
Feb
(406) |
Mar
(294) |
Apr
(80) |
May
(432) |
Jun
(242) |
Jul
(452) |
Aug
(710) |
Sep
(206) |
Oct
(240) |
Nov
(65) |
Dec
(227) |
2008 |
Jan
(80) |
Feb
(90) |
Mar
(98) |
Apr
(136) |
May
(101) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Erich E. <oak...@us...> - 2007-12-03 16:03:20
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20603/Support Log Message: Directory /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Data/Spring/Web/Support added to the repository |
From: Erich E. <oak...@us...> - 2007-12-03 16:03:11
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Data/Spring/Web In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20453/Web Log Message: Directory /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Data/Spring/Web added to the repository |
From: Erich E. <oak...@us...> - 2007-12-03 16:02:28
|
Update of /cvsroot/springnet/Spring.Net/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/DataBinding/EasyEmployeeInfo In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20141/EasyEmployeeInfo Log Message: Directory /cvsroot/springnet/Spring.Net/examples/Spring/Spring.WebQuickStart/src/Spring.WebQuickStart.2005/DataBinding/EasyEmployeeInfo added to the repository |
From: Bruno B. <bb...@us...> - 2007-12-03 09:08:10
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Web/Services In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17502 Modified Files: WebServiceExporterTests.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: WebServiceExporterTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Web.Tests/Web/Services/WebServiceExporterTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WebServiceExporterTests.cs 8 Aug 2007 17:49:38 -0000 1.4 --- WebServiceExporterTests.cs 3 Dec 2007 09:08:07 -0000 1.5 *************** *** 25,32 **** --- 25,34 ---- using System.Text; using System.Reflection; + using System.Reflection.Emit; using System.Web.Services; using NUnit.Framework; + using Spring.Util; using Spring.Core.IO; using Spring.Objects.Factory.Xml; *************** *** 216,219 **** --- 218,241 ---- } + + [Test] + public void AppliesCustomAttributeBuilderToType() + { + wse.ObjectName = "AppliesCustomAttributeBuilderToType"; + wse.TargetName = "noDecoratedService"; + wse.TypeAttributes = new CustomAttributeBuilder[] { + new CustomAttributeBuilder(typeof(WebServiceAttribute).GetConstructor(Type.EmptyTypes), ObjectUtils.EmptyObjects) }; + wse.AfterPropertiesSet(); + + Type proxyType = wse.ObjectType; + + object[] attrs = proxyType.GetCustomAttributes(typeof(WebServiceAttribute), true); + Assert.IsNotEmpty(attrs); + Assert.AreEqual(1, attrs.Length); + + WebServiceAttribute wsa = attrs[0] as WebServiceAttribute; + Assert.AreEqual("AppliesCustomAttributeBuilderToType", wsa.Name); + } + #region Test classes |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:58
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Proxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17146 Modified Files: AbstractProxyTypeBuilderTests.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: AbstractProxyTypeBuilderTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AbstractProxyTypeBuilderTests.cs 31 Jul 2007 23:37:48 -0000 1.17 --- AbstractProxyTypeBuilderTests.cs 3 Dec 2007 09:07:54 -0000 1.18 *************** *** 23,28 **** --- 23,30 ---- using System; using System.Reflection; + using System.Reflection.Emit; using System.Collections; using System.Diagnostics; + using System.Web.Services; using System.Runtime.InteropServices; *************** *** 65,70 **** --- 67,74 ---- builder.TargetType = typeof(MarkerClass); builder.TypeAttributes = new Attribute[] { new MarkerAttribute() }; + Type proxy = builder.BuildProxyType(); Assert.IsNotNull(proxy, "The proxy generated by a (valid) call to BuildProxy() was null."); + object[] atts = proxy.GetCustomAttributes(false); Assert.IsNotNull(atts, "Should have had 1 custom attribute applied to the generated proxy type."); *************** *** 205,208 **** --- 209,236 ---- } + // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=161522 + // should not fail + // Use CustomAttributeData if patch applied (.NET 2.0 SP1). + // Use Attribute instance if patch not applied (.NET 2.0 SP1). + [Test] + public void ProxyWebServiceAttribute() + { + IProxyTypeBuilder builder = GetProxyBuilder(); + builder.TargetType = typeof(ClassWithWebServiceAttribute); + + Type proxy = builder.BuildProxyType(); + Assert.IsNotNull(proxy, "The proxy generated by a (valid) call to BuildProxy() was null."); + + object[] attrs = proxy.GetCustomAttributes(false); + Assert.IsNotNull(attrs, "Should have had 1 attribute applied to the target type."); + Assert.AreEqual(1, attrs.Length, "Should have had 1 attribute applied to the target type."); + Assert.AreEqual(typeof(WebServiceAttribute), attrs[0].GetType(), "Wrong System.Type of Attribute applied to the target type."); + + WebServiceAttribute wsa = attrs[0] as WebServiceAttribute; + Assert.AreEqual("blah", wsa.Name); + Assert.AreEqual("http://mynamespace.com", wsa.Namespace); + } + + [Test] public void ProxyTargetTypeAttributes() *************** *** 598,601 **** --- 626,635 ---- } + // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=161522 + [WebService(Namespace = "http://mynamespace.com", Name = "blah")] + public class ClassWithWebServiceAttribute : IMarkerInterface + { + } + [FakeGenerateScriptType("ScriptName")] public class ClassWithFakeGenerateScriptTypeAttribute : IMarkerInterface |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:46
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Services In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17117 Modified Files: WebServiceExporter.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: WebServiceExporter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** WebServiceExporter.cs 9 Nov 2007 15:42:48 -0000 1.26 --- WebServiceExporter.cs 3 Dec 2007 09:07:43 -0000 1.27 *************** *** 33,38 **** using Spring.Objects; using Spring.Objects.Factory; - using Spring.Proxy; using Spring.Util; #endregion --- 33,38 ---- using Spring.Objects; using Spring.Objects.Factory; using Spring.Util; + using Spring.Proxy; #endregion *************** *** 314,318 **** private void GenerateProxy() { ! IProxyTypeBuilder builder = new WebServiceProxyTypeBuilder(TargetName, CreateWebServiceAttribute()); builder.Name = this.objectName; builder.TargetType = objectFactory.GetType(TargetName); --- 314,318 ---- private void GenerateProxy() { ! IProxyTypeBuilder builder = new WebServiceProxyTypeBuilder(TargetName, Description, Name, Namespace); builder.Name = this.objectName; builder.TargetType = objectFactory.GetType(TargetName); *************** *** 327,340 **** } - private WebServiceAttribute CreateWebServiceAttribute() - { - WebServiceAttribute wsa = new WebServiceAttribute(); - wsa.Description = Description; - wsa.Name = Name; - wsa.Namespace = Namespace; - - return wsa; - } - #endregion --- 327,330 ---- *************** *** 352,356 **** private string targetName; ! private WebServiceAttribute webServiceAttribute; #endregion --- 342,346 ---- private string targetName; ! private CustomAttributeBuilder webServiceAttribute; #endregion *************** *** 358,370 **** #region Constructor(s) / Destructor ! public WebServiceProxyTypeBuilder(string targetName, ! WebServiceAttribute webServiceAttribute) { this.targetName = targetName; - this.webServiceAttribute = webServiceAttribute; BaseType = typeof(WebService); } #endregion --- 348,382 ---- #region Constructor(s) / Destructor ! public WebServiceProxyTypeBuilder( ! string targetName, string description, string name, string ns) { this.targetName = targetName; + // Creates a WebServiceAttribute from configuration info + this.webServiceAttribute = CreateWebServiceAttribute(description, name, ns); + + // Optional BaseType = typeof(WebService); } + private static CustomAttributeBuilder CreateWebServiceAttribute(string description, string name, string ns) + { + ReflectionUtils.CustomAttributeBuilderBuilder cabb = + new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(WebServiceAttribute)); + if (StringUtils.HasText(description)) + { + cabb.AddPropertyValue("Description", description); + } + if (StringUtils.HasText(name)) + { + cabb.AddPropertyValue("Name", name); + } + if (StringUtils.HasText(ns)) + { + cabb.AddPropertyValue("Namespace", ns); + } + return cabb.Build(); + } + #endregion *************** *** 409,421 **** for (int i = 0; i < attrs.Count; i++) { ! ExtendedAttributeBuilder attrBuilder = ! attrs[i] as ExtendedAttributeBuilder; ! if ((attrBuilder != null) && ! attrBuilder.AttributeType == typeof(WebServiceAttribute)) ! { ! attrs[i] = webServiceAttribute; ! return attrs; ! } ! if (attrs[i] is WebServiceAttribute) { // override existing WebServiceAttribute --- 421,425 ---- for (int i = 0; i < attrs.Count; i++) { ! if (IsAttributeMatchingType(attrs[i], typeof(WebServiceAttribute))) { // override existing WebServiceAttribute *************** *** 427,431 **** // add missing WebServiceAttribute ! attrs.Add(ReflectionUtils.CreateCustomAttribute(webServiceAttribute)); return attrs; --- 431,435 ---- // add missing WebServiceAttribute ! attrs.Add(webServiceAttribute); return attrs; *************** *** 437,451 **** bool containsWebMethodAttribute = false; ! for (int i = 0; i < attrs.Count; i++) { ! ExtendedAttributeBuilder attrBuilder = ! attrs[i] as ExtendedAttributeBuilder; ! if ((attrBuilder != null) && ! attrBuilder.AttributeType == typeof(WebMethodAttribute)) ! { ! containsWebMethodAttribute = true; ! break; ! } ! if (attrs[i] is WebMethodAttribute) { containsWebMethodAttribute = true; --- 441,447 ---- bool containsWebMethodAttribute = false; ! foreach (object attr in attrs) { ! if (IsAttributeMatchingType(attr, typeof(WebMethodAttribute))) { containsWebMethodAttribute = true; |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:35
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Web/Services In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17100 Modified Files: WebServiceProxyFactory.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: WebServiceProxyFactory.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** WebServiceProxyFactory.cs 29 Nov 2007 13:13:14 -0000 1.27 --- WebServiceProxyFactory.cs 3 Dec 2007 09:07:31 -0000 1.28 *************** *** 570,582 **** } #if NET_2_0 ! protected override void ApplyMethodReturnTypeAttributes( ! MethodBuilder methodBuilder, MethodInfo targetMethod) { ! base.ApplyMethodReturnTypeAttributes(methodBuilder, targetMethod); if (operation.Messages.Output != null) { ! if (targetMethod.ReturnType != typeof(void)) { if (outputMembersMapping.Count > 0) --- 570,610 ---- } + protected override IList GetTypeAttributes(Type type) + { + IList attrs = base.GetTypeAttributes(type); + + // Add the WebServiceBindingAttribute + attrs.Add(CreateWebServiceBindingAttribute(this.wsBinding)); + + return attrs; + } + + protected override IList GetMethodAttributes(MethodInfo method) + { + IList attrs = base.GetMethodAttributes(method); + + // Add the SoapHeaderAttribute (Only SoapHeaders with Direction=SoapHeaderDirection.In are supported) + foreach (SoapHeaderBinding soapHeaderBinding in operationBinding.Input.Extensions.FindAll(typeof(SoapHeaderBinding))) + { + soapHeaderFieldNames.Add(soapHeaderBinding.Part); + attrs.Add(CreateSoapHeaderAttribute(soapHeaderBinding.Part, SoapHeaderDirection.In)); + } + + // Add the SoapMethodAttribute + attrs.Add(CreateSoapMethodAttribute( + operation, operationBinding, soapOperationBinding, inputMembersMapping, outputMembersMapping)); + + return attrs; + } + #if NET_2_0 ! protected override IList GetMethodReturnTypeAttributes(MethodInfo method) { ! IList attrs = base.GetMethodReturnTypeAttributes(method); + // Add the XmlElementAttribute if needed if (operation.Messages.Output != null) { ! if (method.ReturnType != typeof(void)) { if (outputMembersMapping.Count > 0) *************** *** 587,594 **** if (useMemberName || useNamespace) { ! ParameterBuilder parameterBuilder = methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null); ! ! CustomAttributeBuilderBuilder cabb = ! new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); if (useMemberName) { --- 615,620 ---- if (useMemberName || useNamespace) { ! ReflectionUtils.CustomAttributeBuilderBuilder cabb = ! new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); if (useMemberName) { *************** *** 600,662 **** } ! parameterBuilder.SetCustomAttribute(cabb.Build()); } } } } } #endif /* ! protected override void ApplyMethodParameterAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) { ! base.ApplyMethodParameterAttributes(methodBuilder, targetMethod); ! foreach (ParameterInfo paramInfo in targetMethod.GetParameters()) { ! XmlMemberMapping inMemberMapping = inputMembersMapping[paramInfo.Position]; ! if (inMemberMapping.Namespace != inputMembersMapping.Namespace) ! { ! ParameterBuilder parameterBuilder = methodBuilder.DefineParameter((paramInfo.Position + 1), paramInfo.Attributes, paramInfo.Name); ! ! CustomAttributeBuilderBuilder cabb = ! new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); ! cabb.AddPropertyValue("Namespace", inMemberMapping.Namespace); ! ! parameterBuilder.SetCustomAttribute(cabb.Build()); ! } ! } ! } ! */ ! ! protected override IList GetTypeAttributes(Type type) ! { ! IList attrs = base.GetTypeAttributes(type); ! ! attrs.Add(CreateWebServiceBindingAttribute(this.wsBinding)); ! ! return attrs; ! } ! ! protected override IList GetMethodAttributes(MethodInfo method) ! { ! IList attrs = base.GetMethodAttributes(method); ! // SoapHeaderAttribute (Only SoapHeaders with Direction=SoapHeaderDirection.In are supported) ! foreach (SoapHeaderBinding soapHeaderBinding in operationBinding.Input.Extensions.FindAll(typeof(SoapHeaderBinding))) ! { ! soapHeaderFieldNames.Add(soapHeaderBinding.Part); ! attrs.Add(CreateSoapHeaderAttribute(soapHeaderBinding.Part, SoapHeaderDirection.In)); } - // SoapMethodAttribute - attrs.Add(CreateSoapMethodAttribute( - operation, operationBinding, soapOperationBinding, inputMembersMapping, outputMembersMapping)); - return attrs; } #endregion ! #region Private Helper Methods private void Initialize(DiscoveryClientDocumentCollection wsDocuments, string bindingName) --- 626,661 ---- } ! attrs.Add(cabb.Build()); } } } } + + return attrs; } #endif /* ! protected override IList GetMethodParameterAttributes(MethodInfo method, ParameterInfo paramInfo) { ! IList attrs = base.GetMethodParameterAttributes(method, paramInfo); ! // Add the XmlElementAttribute if needed ! XmlMemberMapping inMemberMapping = inputMembersMapping[paramInfo.Position]; ! if (inMemberMapping.Namespace != inputMembersMapping.Namespace) { ! CustomAttributeBuilderBuilder cabb = ! new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); ! cabb.AddPropertyValue("Namespace", inMemberMapping.Namespace); ! attrs.Add(cabb.Build()); } return attrs; } + */ #endregion ! #region Private Methods private void Initialize(DiscoveryClientDocumentCollection wsDocuments, string bindingName) *************** *** 857,862 **** private CustomAttributeBuilder CreateWebServiceBindingAttribute(Binding wsBinding) { ! CustomAttributeBuilderBuilder cabb = ! new CustomAttributeBuilderBuilder(typeof(WebServiceBindingAttribute)); cabb.AddContructorArgument(this.wsBinding.Name); --- 856,861 ---- private CustomAttributeBuilder CreateWebServiceBindingAttribute(Binding wsBinding) { ! ReflectionUtils.CustomAttributeBuilderBuilder cabb = ! new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(WebServiceBindingAttribute)); cabb.AddContructorArgument(this.wsBinding.Name); *************** *** 880,885 **** string memberName, SoapHeaderDirection direction) { ! CustomAttributeBuilderBuilder cabb = ! new CustomAttributeBuilderBuilder(typeof(SoapHeaderAttribute)); cabb.AddContructorArgument(memberName); --- 879,884 ---- string memberName, SoapHeaderDirection direction) { ! ReflectionUtils.CustomAttributeBuilderBuilder cabb = ! new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(SoapHeaderAttribute)); cabb.AddContructorArgument(memberName); *************** *** 897,901 **** XmlMembersMapping inputMembersMapping, XmlMembersMapping outputMembersMapping) { ! CustomAttributeBuilderBuilder cabb; #if !NET_2_0 --- 896,900 ---- XmlMembersMapping inputMembersMapping, XmlMembersMapping outputMembersMapping) { ! ReflectionUtils.CustomAttributeBuilderBuilder cabb; #if !NET_2_0 *************** *** 910,918 **** if (soapOperationBinding.Style == SoapBindingStyle.Rpc) { ! cabb = new CustomAttributeBuilderBuilder(typeof(SoapRpcMethodAttribute)); } else { ! cabb = new CustomAttributeBuilderBuilder(typeof(SoapDocumentMethodAttribute)); cabb.AddPropertyValue("ParameterStyle", SoapParameterStyle.Wrapped); } --- 909,917 ---- if (soapOperationBinding.Style == SoapBindingStyle.Rpc) { ! cabb = new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(SoapRpcMethodAttribute)); } else { ! cabb = new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(SoapDocumentMethodAttribute)); cabb.AddPropertyValue("ParameterStyle", SoapParameterStyle.Wrapped); } *************** *** 1115,1242 **** #endregion - - #region CustomAttributeBuilderBuilder inner class implementation - - /// <summary> - /// Creates a <see cref=" CustomAttributeBuilder"/>. - /// </summary> - private sealed class CustomAttributeBuilderBuilder - { - #region Fields - - private Type type; - private ArrayList constructorArgs; - private ArrayList namedProperties; - private ArrayList propertyValues; - - #endregion - - #region Constructor(s) / Destructor - - /// <summary> - /// Creates a new instance of the - /// <see cref="CustomAttributeBuilderBuilder"/> class. - /// </summary> - /// <param name="attributeType">The custom attribute type.</param> - public CustomAttributeBuilderBuilder(Type attributeType) - : - this(attributeType, ObjectUtils.EmptyObjects) - { - } - - /// <summary> - /// Creates a new instance of the - /// <see cref="CustomAttributeBuilderBuilder"/> class. - /// </summary> - /// <param name="attributeType">The custom attribute type.</param> - /// <param name="constructorArgs">The custom attribute constructor arguments.</param> - public CustomAttributeBuilderBuilder(Type attributeType, ICollection constructorArgs) - { - AssertUtils.ArgumentNotNull(attributeType, "attributeType"); - if (!typeof(Attribute).IsAssignableFrom(attributeType)) - { - throw new ArgumentException( - string.Format("[{0}] does not derive from the [System.Attribute] class.", - attributeType.FullName)); - } - this.type = attributeType; - this.constructorArgs = new ArrayList(constructorArgs); - this.namedProperties = new ArrayList(); - this.propertyValues = new ArrayList(); - } - - #endregion - - #region Public Methods - - /// <summary> - /// Adds the specified object to the constructor argument list - /// used to create the custom attribute. - /// </summary> - /// <param name="value">The property value.</param> - public void AddContructorArgument(object value) - { - this.constructorArgs.Add(value); - } - - /// <summary> - /// Adds the specified collection to the constructor argument list - /// used to create the custom attribute. - /// </summary> - /// <param name="values">An array of argument values.</param> - public void AddContructorArgument(ICollection values) - { - this.constructorArgs.AddRange(values); - } - - /// <summary> - /// Adds a property value to the custom attribute. - /// </summary> - /// <param name="name">The property name.</param> - /// <param name="value">The property value.</param> - public void AddPropertyValue(string name, object value) - { - PropertyInfo propertyInfo = this.type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public); - if (propertyInfo == null) - { - throw new ArgumentException( - String.Format("The property '{0}' does no exist in the attribute '{1}'.", name, this.type)); - } - - this.namedProperties.Add(propertyInfo); - this.propertyValues.Add(value); - } - - /// <summary> - /// Creates the <see cref="CustomAttributeBuilderBuilder"/>. - /// </summary> - /// <returns>The created <see cref="CustomAttributeBuilderBuilder"/>.</returns> - public CustomAttributeBuilder Build() - { - object[] caArray = (object[])this.constructorArgs.ToArray(typeof(object)); - ConstructorInfo ci = this.type.GetConstructor(ReflectionUtils.GetTypes(caArray)); - if (ci == null && caArray.Length == 0) - { - ci = this.type.GetConstructors()[0]; - caArray = ReflectionUtils.GetDefaultValues(ReflectionUtils.GetParameterTypes(ci.GetParameters())); - } - - if (namedProperties.Count > 0) - { - PropertyInfo[] npArray = (PropertyInfo[])this.namedProperties.ToArray(typeof(PropertyInfo)); - object[] pvArray = (object[])this.propertyValues.ToArray(typeof(object)); - return new CustomAttributeBuilder(ci, caArray, npArray, pvArray); - } - else - { - return new CustomAttributeBuilder(ci, caArray); - } - - } - - #endregion - } - - #endregion } --- 1114,1117 ---- |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:27
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Proxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17044/Proxy Modified Files: AbstractProxyTypeBuilder.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: AbstractProxyTypeBuilder.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Proxy/AbstractProxyTypeBuilder.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AbstractProxyTypeBuilder.cs 11 Oct 2007 05:57:25 -0000 1.29 --- AbstractProxyTypeBuilder.cs 3 Dec 2007 09:07:18 -0000 1.30 *************** *** 68,72 **** private IList _typeAttributes = new ArrayList(); private IDictionary _memberAttributes = new Hashtable(); - private readonly IList _typeAttributesToExclude = new ArrayList(); #endregion --- 68,71 ---- *************** *** 235,242 **** typeBuilder.SetCustomAttribute((CustomAttributeBuilder)attr); } else if (attr is Attribute) { typeBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((Attribute) attr)); } } --- 234,248 ---- typeBuilder.SetCustomAttribute((CustomAttributeBuilder)attr); } + #if NET_2_0 + else if (attr is CustomAttributeData) + { + typeBuilder.SetCustomAttribute( + ReflectionUtils.CreateCustomAttribute((CustomAttributeData)attr)); + } + #endif else if (attr is Attribute) { typeBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((Attribute)attr)); } } *************** *** 258,261 **** --- 264,274 ---- methodBuilder.SetCustomAttribute((CustomAttributeBuilder)attr); } + #if NET_2_0 + else if (attr is CustomAttributeData) + { + methodBuilder.SetCustomAttribute( + ReflectionUtils.CreateCustomAttribute((CustomAttributeData)attr)); + } + #endif else if (attr is Attribute) { *************** *** 264,267 **** --- 277,281 ---- } } + #if NET_2_0 ApplyMethodReturnTypeAttributes(methodBuilder, targetMethod); *************** *** 279,298 **** protected virtual void ApplyMethodReturnTypeAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) { ! if (this.ProxyTargetAttributes) { ! #if !NET_1_0 && !NET_1_1 ! // First, try to apply the CustomAttributeData approach ! if (SafeAttributeUtils.ApplyMethodReturnTypeAttributes(methodBuilder, targetMethod)) { ! // if succeeded with CustomAttributeData solution, return. ! return; } ! #endif ! // If didn't succeed with the CustomAttributeData, apply the old approach ! foreach (Attribute attr in targetMethod.ReturnTypeCustomAttributes.GetCustomAttributes(true)) { - ParameterBuilder parameterBuilder = methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null); parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute(attr)); } } --- 293,312 ---- protected virtual void ApplyMethodReturnTypeAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) { ! foreach (object attr in GetMethodReturnTypeAttributes(targetMethod)) { ! ParameterBuilder parameterBuilder = methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null); ! if (attr is CustomAttributeBuilder) { ! parameterBuilder.SetCustomAttribute((CustomAttributeBuilder)attr); } ! else if (attr is CustomAttributeData) { parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((CustomAttributeData)attr)); ! } ! else if (attr is Attribute) ! { ! parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((Attribute)attr)); } } *************** *** 308,331 **** protected virtual void ApplyMethodParameterAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) { ! if (this.ProxyTargetAttributes) { ! foreach (ParameterInfo paramInfo in targetMethod.GetParameters()) { ! #if !NET_1_0 && !NET_1_1 ! // First, try to apply the CustomAttributeData approach ! if (SafeAttributeUtils.ApplyMethodParameterAttributes(methodBuilder, targetMethod, ! paramInfo)) { ! // if succeeded with CustomAttributeData solution, continue with the ! // next parameter. ! continue; } #endif ! // If didn't succeed with the CustomAttributeData, apply the old approach ! foreach (Attribute attr in paramInfo.GetCustomAttributes(true)) { - ParameterBuilder parameterBuilder = methodBuilder.DefineParameter((paramInfo.Position + 1), paramInfo.Attributes, paramInfo.Name); parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute(attr)); } } --- 322,346 ---- protected virtual void ApplyMethodParameterAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) { ! foreach (ParameterInfo paramInfo in targetMethod.GetParameters()) { ! foreach (object attr in GetMethodParameterAttributes(targetMethod, paramInfo)) { ! ParameterBuilder parameterBuilder = methodBuilder.DefineParameter( ! (paramInfo.Position + 1), paramInfo.Attributes, paramInfo.Name); ! if (attr is CustomAttributeBuilder) { ! parameterBuilder.SetCustomAttribute((CustomAttributeBuilder)attr); ! } ! #if NET_2_0 ! else if (attr is CustomAttributeData) ! { ! parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((CustomAttributeData)attr)); } #endif ! else if (attr is Attribute) { parameterBuilder.SetCustomAttribute( ! ReflectionUtils.CreateCustomAttribute((Attribute)attr)); } } *************** *** 345,367 **** protected virtual IList GetTypeAttributes(Type type) { - // TODO : attributes override - ArrayList attributes = new ArrayList(); if (this.ProxyTargetAttributes) { ! #if !NET_1_0 && !NET_1_1 ! // Try the CustomAttributeData approach first ! CustomAttributeBuilder[] attrBuilders = ! SafeAttributeUtils.GetMemberAttributes(type, TypeAttributesToExclude); ! ! if (attrBuilders != null) { ! attributes.AddRange(attrBuilders); } ! else // If CustomAttributeData approach failed use the old solution { ! ! // add attributes that apply to the target type attributes.AddRange(type.GetCustomAttributes(false)); } --- 360,379 ---- protected virtual IList GetTypeAttributes(Type type) { ArrayList attributes = new ArrayList(); if (this.ProxyTargetAttributes) { ! // add attributes that apply to the target type ! #if NET_2_0 ! try { ! foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type)) ! { ! attributes.Add(cad); ! } } ! catch(CustomAttributeFormatException) { ! // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=161522 attributes.AddRange(type.GetCustomAttributes(false)); } *************** *** 369,376 **** attributes.AddRange(type.GetCustomAttributes(false)); #endif - } ! // add specified attributes attributes.AddRange(TypeAttributes); --- 381,387 ---- attributes.AddRange(type.GetCustomAttributes(false)); #endif } ! // add attributes defined by configuration attributes.AddRange(TypeAttributes); *************** *** 390,412 **** protected virtual IList GetMethodAttributes(MethodInfo method) { - // TODO : attributes override - ArrayList attributes = new ArrayList(); if (this.ProxyTargetAttributes) { ! #if !NET_1_0 && !NET_1_1 ! // Try the CustomAttributeData approach first ! CustomAttributeBuilder[] attrBuilders = ! SafeAttributeUtils.GetMemberAttributes(method); ! ! if (attrBuilders != null) ! { ! attributes.AddRange(attrBuilders); ! } ! else // If CustomAttributeData approach failed use the old solution { ! // add attributes that apply to the target method ! attributes.AddRange(method.GetCustomAttributes(false)); } #else --- 401,413 ---- protected virtual IList GetMethodAttributes(MethodInfo method) { ArrayList attributes = new ArrayList(); if (this.ProxyTargetAttributes) { ! // add attributes that apply to the target method ! #if NET_2_0 ! foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(method)) { ! attributes.Add(cad); } #else *************** *** 434,437 **** --- 435,546 ---- } + #if NET_2_0 + /// <summary> + /// Calculates and returns the list of attributes that apply to the + /// specified method's return type. + /// </summary> + /// <param name="method">The method to find attributes for.</param> + /// <returns> + /// A list of custom attributes that should be applied to method's return type. + /// </returns> + /// <see cref="IProxyTypeBuilder.ProxyTargetAttributes"/> + protected virtual IList GetMethodReturnTypeAttributes(MethodInfo method) + { + ArrayList attributes = new ArrayList(); + + if (this.ProxyTargetAttributes) + { + // add attributes that apply to the target method' return type + foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(method.ReturnParameter)) + { + attributes.Add(cad); + } + } + + // TODO: add attributes defined by configuration + + return attributes; + } + #endif + + /// <summary> + /// Calculates and returns the list of attributes that apply to the + /// specified method's parameters. + /// </summary> + /// <param name="method">The method to find attributes for.</param> + /// <param name="paramInfo">The method's parameter to find attributes for.</param> + /// <returns> + /// A list of custom attributes that should be applied to the specified method's parameter. + /// </returns> + /// <see cref="IProxyTypeBuilder.ProxyTargetAttributes"/> + protected virtual IList GetMethodParameterAttributes(MethodInfo method, ParameterInfo paramInfo) + { + ArrayList attributes = new ArrayList(); + + if (this.ProxyTargetAttributes) + { + // add attributes that apply to the target method's parameter + #if NET_2_0 + foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(paramInfo)) + { + attributes.Add(cad); + } + #else + attributes.AddRange(paramInfo.GetCustomAttributes(false)); + #endif + } + + // TODO: add attributes defined by configuration + + return attributes; + } + + /// <summary> + /// Check that the specified object is matching the passed attribute type. + /// </summary> + /// <remarks> + /// <p> + /// The specified object can be of different type : + /// </p> + /// <list type="bullet"> + /// <item> + /// <see cref="System.Attribute"/> + /// </item> + /// <item> + /// System.Reflection.CustomAttributeData (Only with .NET 2.0) + /// </item> + /// <item> + /// <see cref="System.Reflection.Emit.CustomAttributeBuilder"/> + /// </item> + /// </list> + /// </remarks> + /// <param name="attr">The object instance to check.</param> + /// <param name="attrType">The attribute type to test against.</param> + /// <returns> + /// <see langword="true"/> if the object instance matches the attribute type; + /// otherwise <see langword="false"/>. + /// </returns> + protected virtual bool IsAttributeMatchingType(object attr, Type attrType) + { + if (attr is Attribute) + { + return (attrType == attr.GetType()); + } + #if NET_2_0 + else if (attr is CustomAttributeData) + { + return (attrType == ((CustomAttributeData)attr).Constructor.DeclaringType); + } + #endif + else if (attr is CustomAttributeBuilder) + { + return (attrType == ((ConstructorInfo)CustomAttributeConstructorField.GetValue(attr)).DeclaringType); + } + return false; + } + + private static readonly FieldInfo CustomAttributeConstructorField = + typeof(CustomAttributeBuilder).GetField("m_con", BindingFlags.Instance | BindingFlags.NonPublic); + #endregion *************** *** 805,825 **** #endregion - - #region Protected Properties - - /// <summary> - /// Gets the type attributes to exclude. - /// </summary> - /// <value>The type attributes to exclude.</value> - protected virtual IList TypeAttributesToExclude - { - get - { - return _typeAttributesToExclude; - } - } - - #endregion - } } \ No newline at end of file --- 914,917 ---- |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:24
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17044/Util Modified Files: ReflectionUtils.cs Removed Files: AttributeUtils.cs ExtendedAttributeBuilder.cs SafeAttributeUtils.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: ReflectionUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/ReflectionUtils.cs,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ReflectionUtils.cs 11 Oct 2007 05:57:25 -0000 1.52 --- ReflectionUtils.cs 3 Dec 2007 09:07:18 -0000 1.53 *************** *** 23,26 **** --- 23,30 ---- using System; using System.Collections; + #if NET_2_0 + using System.Collections.Generic; + using System.Collections.ObjectModel; + #endif using System.Globalization; using System.Reflection; *************** *** 38,42 **** /// <author>Rod Johnson</author> /// <author>Juergen Hoeller</author> ! /// <author>Aleksandar Seovic (.Net)</author> /// <version>$Id$</version> public sealed class ReflectionUtils --- 42,48 ---- /// <author>Rod Johnson</author> /// <author>Juergen Hoeller</author> ! /// <author>Aleksandar Seovic (.NET)</author> ! /// <author>Stan Dvoychenko (.NET)</author> ! /// <author>Bruno Baia (.NET)</author> /// <version>$Id$</version> public sealed class ReflectionUtils *************** *** 654,661 **** string name = criteria as string; return String.Compare(method.Name, name, true, CultureInfo.InvariantCulture) == 0; ! } ! /// <summary> ! /// Creates a custom <see cref="System.Attribute"/>. /// </summary> /// <remarks> --- 660,667 ---- string name = criteria as string; return String.Compare(method.Name, name, true, CultureInfo.InvariantCulture) == 0; ! } ! /// <summary> ! /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. /// </summary> /// <remarks> *************** *** 777,781 **** /// <summary> ! /// Creates a custom <see cref="System.Attribute"/>. /// </summary> /// <param name="type"> --- 783,787 ---- /// <summary> ! /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. /// </summary> /// <param name="type"> *************** *** 793,797 **** /// <summary> ! /// Creates a custom <see cref="System.Attribute"/>. /// </summary> /// <param name="sourceAttribute"> --- 799,803 ---- /// <summary> ! /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. /// </summary> /// <param name="sourceAttribute"> *************** *** 809,813 **** /// <summary> ! /// Creates a custom <see cref="System.Attribute"/>. /// </summary> /// <param name="type"> --- 815,819 ---- /// <summary> ! /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. /// </summary> /// <param name="type"> *************** *** 821,825 **** /// <summary> ! /// Creates a custom <see cref="System.Attribute"/>. /// </summary> /// <param name="type"> --- 827,831 ---- /// <summary> ! /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. /// </summary> /// <param name="type"> *************** *** 837,840 **** --- 843,959 ---- } + #if NET_2_0 + /// <summary> + /// Creates a <see cref="System.Reflection.Emit.CustomAttributeBuilder"/>. + /// </summary> + /// <param name="attributeData"> + /// The <see cref="System.Reflection.CustomAttributeData"/> to create + /// the custom attribute builder from. + /// </param> + /// <returns>A custom attribute builder.</returns> + public static CustomAttributeBuilder CreateCustomAttribute(CustomAttributeData attributeData) + { + object[] parameterValues = new object[attributeData.ConstructorArguments.Count]; + Type[] parameterTypes = new Type[attributeData.ConstructorArguments.Count]; + object[] namedParameterValues = new object[attributeData.NamedArguments.Count]; + + // Fill arrays of the constructor parameters + for (int i = 0; i < attributeData.ConstructorArguments.Count; i++) + { + parameterTypes[i] = attributeData.ConstructorArguments[i].ArgumentType; + parameterValues[i] = attributeData.ConstructorArguments[i].Value; + } + + Type attributeType = attributeData.Constructor.DeclaringType; + PropertyInfo[] attributeProperties = attributeType.GetProperties( + BindingFlags.Instance | BindingFlags.Public); + // Not using generics bellow as probably Spring.NET tries to keep + // it on .NET1 compatibility level right now I believe (SD) + // In case of using List<CustomAttributesData> the above note makes + // no sense (SD:) + IList propertiesToSet = new ArrayList(); + int k = 0; + // Fills arrays of the constructor named parameters + foreach (CustomAttributeNamedArgument namedArgument in attributeData.NamedArguments) + { + // Now iterate through all of the PropertyInfo, find the + // one with the corresponding to the NamedProperty name + // and add it to the array of properties to set. + for (int j = 0; j < attributeProperties.Length; j++) + { + if (attributeProperties[j].Name == namedArgument.MemberInfo.Name) + { + propertiesToSet.Add(attributeProperties[j]); + namedParameterValues[k++] = ResolveValues(namedArgument.TypedValue.Value); + break; + } + else + { + if (j == attributeProperties.Length - 1) + { + // In case of no match, throw + throw new InvalidOperationException( + String.Format(CultureInfo.InvariantCulture, + "The property with name {0} can't be found in the " + + "type {1}, but is present as a named property " + + "on the attributeData {2}", namedArgument.MemberInfo.Name, + attributeType.FullName, attributeData)); + } + } + } + } + + // Get constructor corresponding to the parameters and their types + ConstructorInfo constructor = attributeType.GetConstructor(parameterTypes); + + PropertyInfo[] namedProperties = new PropertyInfo[propertiesToSet.Count]; + propertiesToSet.CopyTo(namedProperties, 0); + + return new CustomAttributeBuilder( + constructor, parameterValues, namedProperties, namedParameterValues); + } + + private static object ResolveValues(object value) + { + if (value == null) return value; + + // We are only hunting for the case of the ReadOnlyCollection<T> here. + ReadOnlyCollection<CustomAttributeTypedArgument> sourceArray = + value as ReadOnlyCollection<CustomAttributeTypedArgument>; + + if (sourceArray == null) return value; + + Type underlyingType = null; // type to be used for arguments + Type listType = null; + object list = null; + List<int> prototypeList = new List<int>(); + + foreach (CustomAttributeTypedArgument typedArgument in sourceArray) + { + if (underlyingType == null) + { + underlyingType = typedArgument.ArgumentType; + + listType = Type.GetType( + "System.Collections.Generic.List`1[[" + underlyingType.AssemblyQualifiedName + "]], " + prototypeList.GetType().Assembly.FullName, true, false); + list = Activator.CreateInstance(listType); + } + if (!underlyingType.Equals(typedArgument.ArgumentType)) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, + "Types for the same named parameter of array type are expected to be same")); + } + + MethodInfo addMethod = listType.GetMethod("Add"); + object[] addMethodParameters = new object[1]; + addMethodParameters[0] = typedArgument.Value; + addMethod.Invoke(list, addMethodParameters); + } + + MethodInfo toArrayMethod = listType.GetMethod("ToArray"); + return toArrayMethod.Invoke(list, new object[] { }); + } + #endif + /// <summary> /// Tries to find matching methods in the specified <see cref="System.Type"/> *************** *** 1090,1120 **** #endregion Field Cache Management for "MemberwiseCopy" - private static MethodInfo[] GetCandidateMethods(Type type, string methodName, BindingFlags bindingFlags, int argCount) - { - MethodInfo[] methods = type.GetMethods(bindingFlags); - ArrayList matches = new ArrayList(); ! foreach (MethodInfo method in methods) ! { ! if (method.Name == methodName) ! { ! ParameterInfo[] parameters = method.GetParameters(); ! if (parameters.Length == argCount) ! { ! matches.Add(method); ! } ! else if (parameters.Length > 0) ! { ! ParameterInfo lastParameter = parameters[parameters.Length - 1]; ! if (lastParameter.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0) ! { ! matches.Add(method); ! } ! } ! } ! } ! return (MethodInfo[]) matches.ToArray(typeof(MethodInfo)); ! } } } \ No newline at end of file --- 1209,1328 ---- #endregion Field Cache Management for "MemberwiseCopy" ! #region CustomAttributeBuilderBuilder inner class definition ! /// <summary> ! /// Creates a <see cref=" CustomAttributeBuilder"/>. ! /// </summary> ! /// <author>Bruno Baia</author> ! /// <version>$Id$</version> ! public class CustomAttributeBuilderBuilder ! { ! #region Fields ! ! private Type type; ! private ArrayList constructorArgs; ! private ArrayList namedProperties; ! private ArrayList propertyValues; ! ! #endregion ! ! #region Constructor(s) / Destructor ! ! /// <summary> ! /// Creates a new instance of the ! /// <see cref="CustomAttributeBuilderBuilder"/> class. ! /// </summary> ! /// <param name="attributeType">The custom attribute type.</param> ! public CustomAttributeBuilderBuilder(Type attributeType) ! : ! this(attributeType, ObjectUtils.EmptyObjects) ! { ! } ! ! /// <summary> ! /// Creates a new instance of the ! /// <see cref="CustomAttributeBuilderBuilder"/> class. ! /// </summary> ! /// <param name="attributeType">The custom attribute type.</param> ! /// <param name="constructorArgs">The custom attribute constructor arguments.</param> ! public CustomAttributeBuilderBuilder(Type attributeType, params object[] constructorArgs) ! { ! AssertUtils.ArgumentNotNull(attributeType, "attributeType"); ! if (!typeof(Attribute).IsAssignableFrom(attributeType)) ! { ! throw new ArgumentException( ! string.Format("[{0}] does not derive from the [System.Attribute] class.", ! attributeType.FullName)); ! } ! this.type = attributeType; ! this.constructorArgs = new ArrayList(constructorArgs); ! this.namedProperties = new ArrayList(); ! this.propertyValues = new ArrayList(); ! } ! ! #endregion ! ! #region Public Methods ! ! /// <summary> ! /// Adds the specified values to the constructor argument list ! /// used to create the custom attribute. ! /// </summary> ! /// <param name="values">An array of argument values.</param> ! public void AddContructorArgument(params object[] values) ! { ! this.constructorArgs.AddRange(values); ! } ! ! /// <summary> ! /// Adds a property value to the custom attribute. ! /// </summary> ! /// <param name="name">The property name.</param> ! /// <param name="value">The property value.</param> ! public void AddPropertyValue(string name, object value) ! { ! PropertyInfo propertyInfo = this.type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public); ! if (propertyInfo == null) ! { ! throw new ArgumentException( ! String.Format("The property '{0}' does no exist in the attribute '{1}'.", name, this.type)); ! } ! ! this.namedProperties.Add(propertyInfo); ! this.propertyValues.Add(value); ! } ! ! /// <summary> ! /// Creates the <see cref="CustomAttributeBuilderBuilder"/>. ! /// </summary> ! /// <returns>The created <see cref="CustomAttributeBuilderBuilder"/>.</returns> ! public CustomAttributeBuilder Build() ! { ! object[] caArray = (object[])this.constructorArgs.ToArray(typeof(object)); ! ConstructorInfo ci = this.type.GetConstructor(ReflectionUtils.GetTypes(caArray)); ! if (ci == null && caArray.Length == 0) ! { ! ci = this.type.GetConstructors()[0]; ! caArray = ReflectionUtils.GetDefaultValues(ReflectionUtils.GetParameterTypes(ci.GetParameters())); ! } ! ! if (namedProperties.Count > 0) ! { ! PropertyInfo[] npArray = (PropertyInfo[])this.namedProperties.ToArray(typeof(PropertyInfo)); ! object[] pvArray = (object[])this.propertyValues.ToArray(typeof(object)); ! return new CustomAttributeBuilder(ci, caArray, npArray, pvArray); ! } ! else ! { ! return new CustomAttributeBuilder(ci, caArray); ! } ! ! } ! ! #endregion ! } ! ! #endregion } } \ No newline at end of file --- AttributeUtils.cs DELETED --- --- SafeAttributeUtils.cs DELETED --- --- ExtendedAttributeBuilder.cs DELETED --- |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:23
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17044 Modified Files: Spring.Core.2003.csproj Spring.Core.2005.csproj Log Message: Refactored Stan D. contribution [SPRNET-606] Index: Spring.Core.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2005.csproj,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** Spring.Core.2005.csproj 11 Oct 2007 17:59:35 -0000 1.112 --- Spring.Core.2005.csproj 3 Dec 2007 09:07:18 -0000 1.113 *************** *** 953,962 **** <Compile Include="Util\CompareUtils.cs" /> <Compile Include="Util\ConfigurationUtils.cs" /> - <Compile Include="Util\ExtendedAttributeBuilder.cs" /> <Compile Include="Util\FatalReflectionException.cs" /> <Compile Include="Util\ObjectUtils.cs" /> <Compile Include="Util\ReflectionException.cs" /> - <Compile Include="Util\AttributeUtils.cs" /> - <Compile Include="Util\SafeAttributeUtils.cs" /> <Compile Include="Util\SystemUtils.cs" /> <Compile Include="Util\DynamicCodeManager.cs" /> --- 953,959 ---- Index: Spring.Core.2003.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Spring.Core.2003.csproj,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Spring.Core.2003.csproj 11 Oct 2007 17:59:35 -0000 1.52 --- Spring.Core.2003.csproj 3 Dec 2007 09:07:18 -0000 1.53 *************** *** 2224,2232 **** /> <File - RelPath = "Util\ExtendedAttributeBuilder.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Util\FatalReflectionException.cs" SubType = "Code" --- 2224,2227 ---- |
From: Bruno B. <bb...@us...> - 2007-12-03 09:07:06
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16667 Modified Files: AbstractAopProxyTypeBuilder.cs Log Message: Refactored Stan D. contribution [SPRNET-606] Index: AbstractAopProxyTypeBuilder.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aop/Framework/DynamicProxy/AbstractAopProxyTypeBuilder.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractAopProxyTypeBuilder.cs 11 Oct 2007 05:57:15 -0000 1.4 --- AbstractAopProxyTypeBuilder.cs 3 Dec 2007 09:06:58 -0000 1.5 *************** *** 41,68 **** AbstractProxyTypeBuilder, IAopProxyTypeGenerator { - #region Fields - - private readonly IList _typeAttributesToExclude; - - #endregion - - #region Constructors - - /// <summary> - /// Initializes a new instance of the <see cref="AbstractAopProxyTypeBuilder"/> class. - /// </summary> - protected AbstractAopProxyTypeBuilder() - : base() - { - _typeAttributesToExclude = new ArrayList( - new Type[] {typeof (SerializableAttribute)}); - foreach (Type attributeType in base.TypeAttributesToExclude) - { - _typeAttributesToExclude.Add(attributeType); - } - } - - #endregion - #region IProxyTypeGenerator Members --- 41,44 ---- *************** *** 112,116 **** while (i < attrs.Count) { ! if (attrs[i] is SerializableAttribute) { attrs.RemoveAt(i); --- 88,92 ---- while (i < attrs.Count) { ! if (IsAttributeMatchingType(attrs[i], typeof(SerializableAttribute))) { attrs.RemoveAt(i); *************** *** 127,143 **** #endregion - - #region Protected Properties - - /// <summary> - /// Gets the type of attributes to exclude form the proxy - /// </summary> - /// <value>The type of attributes to exclude from the proxy</value> - protected override IList TypeAttributesToExclude - { - get { return _typeAttributesToExclude; } - } - - #endregion } } \ No newline at end of file --- 103,106 ---- |
From: Mark P. <mar...@us...> - 2007-12-01 22:22:02
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv841 Removed Files: TxScopeTransactionManagerTypeMockTests.cs Log Message: remove typemock based tests. --- TxScopeTransactionManagerTypeMockTests.cs DELETED --- |
From: Marko L. <la...@us...> - 2007-12-01 20:37:24
|
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24781/Scheduling/Quartz Modified Files: CronTriggerObjectTest.cs JobDetailObjectTest.cs MethodInvokingJobTest.cs SimpleTriggerObjectTest.cs TriggerObjectTest.cs Log Message: Upgraded to Quartz 0.9 Index: JobDetailObjectTest.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz/JobDetailObjectTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobDetailObjectTest.cs 14 Sep 2007 12:56:10 -0000 1.2 --- JobDetailObjectTest.cs 1 Dec 2007 20:37:21 -0000 1.3 *************** *** 91,95 **** jobDetail.Group = null; jobDetail.AfterPropertiesSet(); ! Assert.AreEqual(SchedulerConstants.DEFAULT_GROUP, jobDetail.Group, "Groups differ"); Assert.AreEqual(objectName, jobDetail.Name, "Names differ"); } --- 91,95 ---- jobDetail.Group = null; jobDetail.AfterPropertiesSet(); ! Assert.AreEqual(SchedulerConstants.DefaultGroup, jobDetail.Group, "Groups differ"); Assert.AreEqual(objectName, jobDetail.Name, "Names differ"); } *************** *** 114,120 **** const string objectName = "springJobDetailObject"; jobDetail.ObjectName = objectName; ! jobDetail.ApplicationContext = new XmlApplicationContext(); ! jobDetail.ApplicationContextJobDataKey = "applicationContextJobDataKey"; jobDetail.AfterPropertiesSet(); } --- 114,124 ---- const string objectName = "springJobDetailObject"; jobDetail.ObjectName = objectName; ! XmlApplicationContext ctx = new XmlApplicationContext(); ! jobDetail.ApplicationContext = ctx; ! string key = "applicationContextJobDataKey"; ! jobDetail.ApplicationContextJobDataKey = key; jobDetail.AfterPropertiesSet(); + Assert.AreSame(ctx, jobDetail.ApplicationContext, "ApplicationContext was not set correctly"); + Assert.AreSame(ctx, jobDetail.JobDataMap[key], "ApplicationContext was not set to job data map"); } Index: SimpleTriggerObjectTest.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz/SimpleTriggerObjectTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleTriggerObjectTest.cs 12 Sep 2007 18:39:33 -0000 1.1 --- SimpleTriggerObjectTest.cs 1 Dec 2007 20:37:21 -0000 1.2 *************** *** 16,19 **** --- 16,20 ---- using System; + using System.Collections; using NUnit.Framework; *************** *** 93,96 **** --- 94,107 ---- } + [Test] + public void TestJobDataAsMap() + { + Hashtable data = new Hashtable(); + data["foo"] = "bar"; + data["number"] = 123; + simpleTrigger.JobDataAsMap = data; + CollectionAssert.AreEqual(data, simpleTrigger.JobDataMap, "Data differed"); + } + } Index: CronTriggerObjectTest.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz/CronTriggerObjectTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CronTriggerObjectTest.cs 12 Sep 2007 18:39:33 -0000 1.1 --- CronTriggerObjectTest.cs 1 Dec 2007 20:37:21 -0000 1.2 *************** *** 16,19 **** --- 16,20 ---- using System; + using System.Collections; using NUnit.Framework; *************** *** 87,90 **** --- 88,100 ---- } + [Test] + public void TestJobDataAsMap() + { + Hashtable data = new Hashtable(); + data["foo"] = "bar"; + data["number"] = 123; + cronTrigger.JobDataAsMap = data; + CollectionAssert.AreEqual(data, cronTrigger.JobDataMap, "Data differed"); + } } Index: MethodInvokingJobTest.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz/MethodInvokingJobTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MethodInvokingJobTest.cs 12 Sep 2007 18:39:33 -0000 1.1 --- MethodInvokingJobTest.cs 1 Dec 2007 20:37:21 -0000 1.2 *************** *** 93,96 **** --- 93,107 ---- } + [Test] + public void TestMethodInvoker_PrivateMethod() + { + InvocationCountingJob job = new InvocationCountingJob(); + MethodInvoker mi = new MethodInvoker(); + mi.TargetObject = job; + mi.TargetMethod = "PrivateMethod"; + mi.Prepare(); + methodInvokingJob.MethodInvoker = mi; + methodInvokingJob.Execute(CreateMinimalJobExecutionContext()); + } private static JobExecutionContext CreateMinimalJobExecutionContext() *************** *** 131,134 **** --- 142,148 ---- } + private void PrivateMethod() + { + } public int CounterValue Index: TriggerObjectTest.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz/TriggerObjectTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TriggerObjectTest.cs 12 Sep 2007 18:39:34 -0000 1.1 --- TriggerObjectTest.cs 1 Dec 2007 20:37:21 -0000 1.2 *************** *** 42,49 **** { Assert.AreEqual(TRIGGER_NAME, trigger.Name, "trigger name mismatch"); ! Assert.AreEqual(SchedulerConstants.DEFAULT_GROUP, trigger.Group, "trigger group name mismatch"); AssertDateTimesEqualityWithAllowedDelta(DateTime.UtcNow, trigger.StartTimeUtc, 1000); Assert.IsNull(trigger.JobName, "trigger job name not null"); ! Assert.AreEqual(SchedulerConstants.DEFAULT_GROUP, trigger.JobGroup, "trigger job group was not default"); } --- 42,49 ---- { Assert.AreEqual(TRIGGER_NAME, trigger.Name, "trigger name mismatch"); ! Assert.AreEqual(SchedulerConstants.DefaultGroup, trigger.Group, "trigger group name mismatch"); AssertDateTimesEqualityWithAllowedDelta(DateTime.UtcNow, trigger.StartTimeUtc, 1000); Assert.IsNull(trigger.JobName, "trigger job name not null"); ! Assert.AreEqual(SchedulerConstants.DefaultGroup, trigger.JobGroup, "trigger job group was not default"); } |
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24781 Modified Files: Spring.Scheduling.Quartz.Tests.2003.csproj Spring.Scheduling.Quartz.Tests.2005.csproj Added Files: App.config Log Message: Upgraded to Quartz 0.9 Index: Spring.Scheduling.Quartz.Tests.2003.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Spring.Scheduling.Quartz.Tests.2003.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Spring.Scheduling.Quartz.Tests.2003.csproj 12 Sep 2007 18:39:34 -0000 1.3 --- Spring.Scheduling.Quartz.Tests.2003.csproj 1 Dec 2007 20:37:21 -0000 1.4 *************** *** 115,118 **** --- 115,122 ---- <Include> <File + RelPath = "App.config" + BuildAction = "None" + /> + <File RelPath = "Scheduling\Quartz\AdaptableJobFactoryTest.cs" SubType = "Code" --- NEW FILE: App.config --- <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Common.Logging" culture="" publicKeyToken="af08829b84f0328e"/> <bindingRedirect oldVersion="1.1.0.0" newVersion="1.2.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> Index: Spring.Scheduling.Quartz.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Spring.Scheduling.Quartz.Tests.2005.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Spring.Scheduling.Quartz.Tests.2005.csproj 12 Sep 2007 18:39:34 -0000 1.3 --- Spring.Scheduling.Quartz.Tests.2005.csproj 1 Dec 2007 20:37:21 -0000 1.4 *************** *** 67,70 **** --- 67,73 ---- <Compile Include="Scheduling\Quartz\MethodInvokingJobTest.cs" /> </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
From: Marko L. <la...@us...> - 2007-12-01 20:37:12
|
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24740/Scheduling/Quartz Modified Files: CronTriggerObject.cs JobDetailObject.cs MethodInvokingJobDetailFactoryObject.cs SchedulerFactoryObject.cs SimpleTriggerObject.cs Log Message: Upgraded to Quartz 0.9 Index: CronTriggerObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/CronTriggerObject.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CronTriggerObject.cs 12 Sep 2007 18:40:46 -0000 1.3 --- CronTriggerObject.cs 1 Dec 2007 20:37:08 -0000 1.4 *************** *** 55,59 **** private JobDetail jobDetail; private string objectName; ! private readonly Constants constants = new Constants(typeof(MisfirePolicy.CronTrigger), typeof(MisfirePolicy)); --- 55,59 ---- private JobDetail jobDetail; private string objectName; ! private readonly Constants constants = new Constants(typeof(MisfireInstruction.CronTrigger), typeof(MisfireInstruction)); *************** *** 74,82 **** /// Set the misfire instruction via the name of the corresponding /// constant in the CronTrigger class. ! /// Default is <code>MISFIRE_INSTRUCTION_SMART_POLICY</code>. /// </summary> ! /// <seealso cref="MisfirePolicy.CronTrigger.FireOnceNow" /> ! /// <seealso cref="MisfirePolicy.CronTrigger.DoNothing" /> ! /// <seealso cref="MisfirePolicy.SmartPolicy" /> public virtual string MisfireInstructionName { --- 74,82 ---- /// Set the misfire instruction via the name of the corresponding /// constant in the CronTrigger class. ! /// Default is <see cref="MisfireInstruction.SmartPolicy" />. /// </summary> ! /// <seealso cref="MisfireInstruction.CronTrigger.FireOnceNow" /> ! /// <seealso cref="MisfireInstruction.CronTrigger.DoNothing" /> ! /// <seealso cref="MisfireInstruction.SmartPolicy" /> public virtual string MisfireInstructionName { *************** *** 155,159 **** if (Group == null) { ! Group = SchedulerConstants.DEFAULT_GROUP; } if (StartTimeUtc == DateTime.MinValue) --- 155,159 ---- if (Group == null) { ! Group = SchedulerConstants.DefaultGroup; } if (StartTimeUtc == DateTime.MinValue) Index: SchedulerFactoryObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/SchedulerFactoryObject.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SchedulerFactoryObject.cs 12 Sep 2007 18:40:46 -0000 1.3 --- SchedulerFactoryObject.cs 1 Dec 2007 20:37:08 -0000 1.4 *************** *** 680,689 **** if (taskExecutor != null) { ! mergedProps[StdSchedulerFactory.PROP_THREAD_POOL_CLASS] = typeof (LocalTaskExecutorThreadPool).FullName; } else { ! mergedProps.Set(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, typeof (SimpleThreadPool).Name); mergedProps[PROP_THREAD_COUNT] = Convert.ToString(DEFAULT_THREAD_COUNT); } --- 680,689 ---- if (taskExecutor != null) { ! mergedProps[StdSchedulerFactory.PropertyThreadPoolType] = typeof (LocalTaskExecutorThreadPool).FullName; } else { ! mergedProps.Set(StdSchedulerFactory.PropertyThreadPoolType, typeof(SimpleThreadPool).Name); mergedProps[PROP_THREAD_COUNT] = Convert.ToString(DEFAULT_THREAD_COUNT); } *************** *** 716,720 **** if (schedulerName != null) { ! mergedProps.Add(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, schedulerName); } --- 716,720 ---- if (schedulerName != null) { ! mergedProps.Add(StdSchedulerFactory.PropertySchedulerInstanceName, schedulerName); } Index: JobDetailObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/JobDetailObject.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobDetailObject.cs 12 Sep 2007 18:40:46 -0000 1.2 --- JobDetailObject.cs 1 Dec 2007 20:37:08 -0000 1.3 *************** *** 34,38 **** /// <seealso cref="JobDetail.Name" /> /// <seealso cref="JobDetail.Group" /> ! /// <seealso cref="SchedulerConstants.DEFAULT_GROUP" /> public class JobDetailObject : JobDetail, IObjectNameAware, IApplicationContextAware, IInitializingObject { --- 34,38 ---- /// <seealso cref="JobDetail.Name" /> /// <seealso cref="JobDetail.Group" /> ! /// <seealso cref="SchedulerConstants.DefaultGroup" /> public class JobDetailObject : JobDetail, IObjectNameAware, IApplicationContextAware, IInitializingObject { *************** *** 201,205 **** if (Group == null) { ! Group = SchedulerConstants.DEFAULT_GROUP; } if (applicationContextJobDataKey != null) --- 201,205 ---- if (Group == null) { ! Group = SchedulerConstants.DefaultGroup; } if (applicationContextJobDataKey != null) Index: MethodInvokingJobDetailFactoryObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/MethodInvokingJobDetailFactoryObject.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MethodInvokingJobDetailFactoryObject.cs 12 Sep 2007 18:40:46 -0000 1.3 --- MethodInvokingJobDetailFactoryObject.cs 1 Dec 2007 20:37:08 -0000 1.4 *************** *** 66,70 **** public MethodInvokingJobDetailFactoryObject() { ! group = SchedulerConstants.DEFAULT_GROUP; } --- 66,70 ---- public MethodInvokingJobDetailFactoryObject() { ! group = SchedulerConstants.DefaultGroup; } *************** *** 85,89 **** /// </summary> /// <seealso cref="JobDetail.Group" /> ! /// <seealso cref="SchedulerConstants.DEFAULT_GROUP" /> public virtual string Group { --- 85,89 ---- /// </summary> /// <seealso cref="JobDetail.Group" /> ! /// <seealso cref="SchedulerConstants.DefaultGroup" /> public virtual string Group { Index: SimpleTriggerObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Scheduling/Quartz/SimpleTriggerObject.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimpleTriggerObject.cs 12 Sep 2007 18:40:46 -0000 1.3 --- SimpleTriggerObject.cs 1 Dec 2007 20:37:08 -0000 1.4 *************** *** 55,59 **** private JobDetail jobDetail; private string objectName; ! private readonly Constants constants = new Constants(typeof(MisfirePolicy.SimpleTrigger), typeof(MisfirePolicy)); /// <summary> --- 55,59 ---- private JobDetail jobDetail; private string objectName; ! private readonly Constants constants = new Constants(typeof(MisfireInstruction.SimpleTrigger), typeof(MisfireInstruction)); /// <summary> *************** *** 62,66 **** public SimpleTriggerObject() { ! RepeatCount = REPEAT_INDEFINITELY; } --- 62,66 ---- public SimpleTriggerObject() { ! RepeatCount = RepeatIndefinitely; } *************** *** 81,92 **** /// Set the misfire instruction via the name of the corresponding /// constant in the SimpleTrigger class. ! /// Default is <see cref="MisfirePolicy.SmartPolicy" />. /// </summary> ! /// <seealso cref="MisfirePolicy.SimpleTrigger.FireNow" /> ! /// <seealso cref="MisfirePolicy.SimpleTrigger.RescheduleNextWithExistingCount" /> ! /// <seealso cref="MisfirePolicy.SimpleTrigger.RescheduleNextWithRemainingCount" /> ! /// <seealso cref="MisfirePolicy.SimpleTrigger.RescheduleNowWithExistingRepeatCount" /> ! /// <seealso cref="MisfirePolicy.SimpleTrigger.RescheduleNowWithRemainingRepeatCount" /> ! /// <seealso cref="MisfirePolicy.SmartPolicy" /> public virtual string MisfireInstructionName { --- 81,92 ---- /// Set the misfire instruction via the name of the corresponding /// constant in the SimpleTrigger class. ! /// Default is <see cref="MisfireInstruction.SmartPolicy" />. /// </summary> ! /// <seealso cref="MisfireInstruction.SimpleTrigger.FireNow" /> ! /// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNextWithExistingCount" /> ! /// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNextWithRemainingCount" /> ! /// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNowWithExistingRepeatCount" /> ! /// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNowWithRemainingRepeatCount" /> ! /// <seealso cref="MisfireInstruction.SmartPolicy" /> public virtual string MisfireInstructionName { *************** *** 180,184 **** if (Group == null) { ! Group = SchedulerConstants.DEFAULT_GROUP; } if (StartTimeUtc == DateTime.MinValue) --- 180,184 ---- if (Group == null) { ! Group = SchedulerConstants.DefaultGroup; } if (StartTimeUtc == DateTime.MinValue) |
From: Marko L. <la...@us...> - 2007-12-01 20:37:12
|
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24740 Modified Files: Spring.Scheduling.Quartz.2003.csproj Log Message: Upgraded to Quartz 0.9 Index: Spring.Scheduling.Quartz.2003.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/src/Spring/Spring.Scheduling.Quartz/Spring.Scheduling.Quartz.2003.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Spring.Scheduling.Quartz.2003.csproj 11 Sep 2007 09:33:50 -0000 1.2 --- Spring.Scheduling.Quartz.2003.csproj 1 Dec 2007 20:37:09 -0000 1.3 *************** *** 76,84 **** /> <Reference - Name = "Common.Logging" - AssemblyName = "Common.Logging" - HintPath = "..\..\..\lib\net\1.1\Common.Logging.dll" - /> - <Reference Name = "Quartz" AssemblyName = "Quartz" --- 76,79 ---- *************** *** 90,93 **** --- 85,94 ---- HintPath = "..\..\..\lib\net\1.1\Nullables.dll" /> + <Reference + Name = "Common.Logging" + AssemblyName = "Common.Logging" + HintPath = "..\..\..\lib\net\1.1\Common.Logging.dll" + Private = "True" + /> </References> </Build> |
From: Marko L. <la...@us...> - 2007-12-01 20:31:46
|
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/2.0 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22467/2.0 Modified Files: Common.Logging.dll Quartz.dll Quartz.xml Log Message: Upgraded to Quartz 0.9 Index: Quartz.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/2.0/Quartz.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Quartz.xml 12 Sep 2007 18:38:56 -0000 1.3 --- Quartz.xml 1 Dec 2007 20:31:41 -0000 1.4 *************** *** 361,364 **** --- 361,369 ---- <returns></returns> </member> + <member name="M:Quartz.Core.QuartzScheduler.#cctor"> + <summary> + Initializes the <see cref="T:Quartz.Core.QuartzScheduler"/> class. + </summary> + </member> <member name="M:Quartz.Core.QuartzScheduler.GetGlobalJobListener(System.String)"> <summary> [...3018 lines suppressed...] </summary> ! <param name="dateUtc">The date.</param> <param name="secondBase">The second base.</param> <returns></returns> </member> <member name="M:Quartz.TriggerUtils.ComputeFireTimes(Quartz.Trigger,Quartz.ICalendar,System.Int32)"> <summary> *************** *** 16463,16467 **** <param name="src">the original time-zone</param> <param name="dest">the destination time-zone</param> ! <returns>the translated date</returns> </member> <member name="M:Quartz.TriggerUtils.GetOffset(System.DateTime,System.TimeZone)"> --- 16445,16449 ---- <param name="src">the original time-zone</param> <param name="dest">the destination time-zone</param> ! <returns>the translated UTC date</returns> </member> <member name="M:Quartz.TriggerUtils.GetOffset(System.DateTime,System.TimeZone)"> Index: Quartz.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/2.0/Quartz.dll,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsrbrTKP and /tmp/cvsWOZt23 differ Index: Common.Logging.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/2.0/Common.Logging.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsNnUWPU and /tmp/cvsliIbc9 differ |
From: Marko L. <la...@us...> - 2007-12-01 20:31:45
|
Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/1.1 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22467/1.1 Modified Files: Common.Logging.dll Quartz.dll Quartz.xml Log Message: Upgraded to Quartz 0.9 Index: Quartz.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/1.1/Quartz.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Quartz.xml 12 Sep 2007 18:38:56 -0000 1.3 --- Quartz.xml 1 Dec 2007 20:31:41 -0000 1.4 *************** *** 361,364 **** --- 361,369 ---- <returns></returns> </member> + <member name="M:Quartz.Core.QuartzScheduler.#cctor"> + <summary> + Initializes the <see cref="T:Quartz.Core.QuartzScheduler"/> class. + </summary> + </member> <member name="M:Quartz.Core.QuartzScheduler.GetGlobalJobListener(System.String)"> <summary> [...3010 lines suppressed...] </summary> ! <param name="dateUtc">The date.</param> <param name="secondBase">The second base.</param> <returns></returns> </member> <member name="M:Quartz.TriggerUtils.ComputeFireTimes(Quartz.Trigger,Quartz.ICalendar,System.Int32)"> <summary> *************** *** 16463,16467 **** <param name="src">the original time-zone</param> <param name="dest">the destination time-zone</param> ! <returns>the translated date</returns> </member> <member name="M:Quartz.TriggerUtils.GetOffset(System.DateTime,System.TimeZone)"> --- 16445,16449 ---- <param name="src">the original time-zone</param> <param name="dest">the destination time-zone</param> ! <returns>the translated UTC date</returns> </member> <member name="M:Quartz.TriggerUtils.GetOffset(System.DateTime,System.TimeZone)"> Index: Quartz.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/1.1/Quartz.dll,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvszJfAGo and /tmp/cvsW6QT4z differ Index: Common.Logging.dll =================================================================== RCS file: /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/lib/net/1.1/Common.Logging.dll,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsQXn0is and /tmp/cvsXnHcZD differ |
From: Mark P. <mar...@us...> - 2007-12-01 20:18:12
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv17287 Modified Files: ServiceDomainPlatformTransactionManager.cs Log Message: ifdef for mapping newer Snapshot isoation level mapping in ServiceDomainPlatformTransactionManager Index: ServiceDomainPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ServiceDomainPlatformTransactionManager.cs 30 Nov 2007 22:00:19 -0000 1.2 --- ServiceDomainPlatformTransactionManager.cs 1 Dec 2007 20:18:09 -0000 1.3 *************** *** 171,181 **** serviceConfig.IsolationLevel = TransactionIsolationLevel.Serializable; break; case System.Data.IsolationLevel.Snapshot: if (log.IsInfoEnabled) { ! log.Info("IsolationLevel Snapshot does not have a direct counterpart in EnterpriseServices, using ReadUncommitted"); } ! serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadUncommitted; break; case System.Data.IsolationLevel.Unspecified: serviceConfig.IsolationLevel = TransactionIsolationLevel.Any; --- 171,183 ---- serviceConfig.IsolationLevel = TransactionIsolationLevel.Serializable; break; + #if NET_2_0 case System.Data.IsolationLevel.Snapshot: if (log.IsInfoEnabled) { ! log.Info("IsolationLevel Snapshot does not have a direct counterpart in EnterpriseServices, using ReadCommitted. Introduced in SqlServer 2005. Consider using System.Transactions for transaction management instead."); } ! serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted; //err on the side of consistency break; + #endif case System.Data.IsolationLevel.Unspecified: serviceConfig.IsolationLevel = TransactionIsolationLevel.Any; |
From: Mark P. <mar...@us...> - 2007-12-01 20:03:01
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10896 Modified Files: DefaultServiceDomainAdapter.cs IServiceDomainAdapter.cs Log Message: add ifdef for !NET_1_0 Index: IServiceDomainAdapter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support/IServiceDomainAdapter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IServiceDomainAdapter.cs 30 Nov 2007 22:00:20 -0000 1.1 --- IServiceDomainAdapter.cs 1 Dec 2007 20:02:57 -0000 1.2 *************** *** 1,2 **** --- 1,23 ---- + #region License + + /* + * Copyright © 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #endregion + + #if (!NET_1_0) using System.EnterpriseServices; *************** *** 4,21 **** namespace Spring.Data.Support { public interface IServiceDomainAdapter { void Enter(ServiceConfig config); TransactionStatus Leave(); void SetComplete(); void SetAbort(); TransactionVote MyTransactionVote { get; set;} /// <summary> ! /// Gets a value indicating whether there is a new transaction or an existing transaction. /// </summary> /// <value> --- 25,69 ---- namespace Spring.Data.Support { + /// <summary> + /// Provides the necessary transactional state and operations for ServiceDomainTransactionManager to + /// work with ServiceDomain and ContextUtil. + /// </summary> + /// <remarks>Introduced for purposes of unit testing.</remarks> + /// <author>Mark Pollack (.NET)</author> + /// <version>$Id $</version> public interface IServiceDomainAdapter { + /// <summary> + /// Creates the context specified by the ServiceConfig object and pushes it onto the context stack to + /// become the current context. + /// </summary> + /// <param name="config">A ServiceConfig that contains the configuration information for the services to be used within the enclosed code.</param> void Enter(ServiceConfig config); + /// <summary> + /// Leaves this ServiceDomain. The current context is then popped from the context stack, and the + /// context that was running when Enter was called becomes the current context. + /// </summary> + /// <returns>One of the TransactionStatus values</returns> TransactionStatus Leave(); + /// <summary> + /// Sets the consistent bit and the done bit to true in the COM+ context + /// </summary> void SetComplete(); + /// <summary> + /// Sets the consistent bit to false and the done bit to true in the COM+ context. + /// </summary> void SetAbort(); + /// <summary> + /// Gets or sets the consistent bit in the COM+ context. + /// </summary> + /// <value>My transaction vote.</value> TransactionVote MyTransactionVote { get; set;} /// <summary> ! /// Gets a value indicating whether the current context is transactional. /// </summary> /// <value> *************** *** 25,27 **** } ! } \ No newline at end of file --- 73,77 ---- } ! } ! ! #endif \ No newline at end of file Index: DefaultServiceDomainAdapter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support/DefaultServiceDomainAdapter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultServiceDomainAdapter.cs 30 Nov 2007 22:00:20 -0000 1.1 --- DefaultServiceDomainAdapter.cs 1 Dec 2007 20:02:57 -0000 1.2 *************** *** 1,12 **** - using System; using System.EnterpriseServices; namespace Spring.Data.Support { public class DefaultServiceDomainAdapter : IServiceDomainAdapter { ! public void Enter(ServiceConfig config) { --- 1,42 ---- + #region License + /* + * Copyright © 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #endregion + + #if (!NET_1_0) using System.EnterpriseServices; namespace Spring.Data.Support { + /// <summary> + /// Implementation that delegates to ServiceDomain and ContextUtil for all functionality. + /// </summary> + /// <remarks>Introduced for purposes of unit testing.</remarks> + /// <author>Mark Pollack (.NET)</author> + /// <version>$Id $</version> public class DefaultServiceDomainAdapter : IServiceDomainAdapter { ! ! /// <summary> ! /// Creates the context specified by the ServiceConfig object and pushes it onto the context stack to ! /// become the current context. ! /// </summary> ! /// <param name="config">A ServiceConfig that contains the configuration information for the services to be used within the enclosed code.</param> public void Enter(ServiceConfig config) { *************** *** 14,17 **** --- 44,52 ---- } + /// <summary> + /// Leaves this ServiceDomain. The current context is then popped from the context stack, and the + /// context that was running when Enter was called becomes the current context. + /// </summary> + /// <returns>One of the TransactionStatus values</returns> public TransactionStatus Leave() { *************** *** 19,22 **** --- 54,60 ---- } + /// <summary> + /// Sets the consistent bit and the done bit to true in the COM+ context + /// </summary> public void SetComplete() { *************** *** 24,27 **** --- 62,68 ---- } + /// <summary> + /// Sets the consistent bit to false and the done bit to true in the COM+ context. + /// </summary> public void SetAbort() { *************** *** 29,32 **** --- 70,77 ---- } + /// <summary> + /// Gets or sets the consistent bit in the COM+ context. + /// </summary> + /// <value>My transaction vote.</value> public TransactionVote MyTransactionVote { *************** *** 35,38 **** --- 80,89 ---- } + /// <summary> + /// Gets a value indicating whether the current context is transactional. + /// </summary> + /// <value> + /// <c>true</c> if this instance is existing transaction; otherwise, <c>false</c>. + /// </value> public bool IsInTransaction { *************** *** 40,42 **** } } ! } \ No newline at end of file --- 91,94 ---- } } ! } ! #endif \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-11-30 22:00:25
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12831/Data/Support Added Files: DefaultServiceDomainAdapter.cs IServiceDomainAdapter.cs Log Message: SPRNET-773 - ServiceDomainTransactionManager dev --- NEW FILE: IServiceDomainAdapter.cs --- using System.EnterpriseServices; namespace Spring.Data.Support { public interface IServiceDomainAdapter { void Enter(ServiceConfig config); TransactionStatus Leave(); void SetComplete(); void SetAbort(); TransactionVote MyTransactionVote { get; set;} /// <summary> /// Gets a value indicating whether there is a new transaction or an existing transaction. /// </summary> /// <value> /// <c>true</c> if this instance is existing transaction; otherwise, <c>false</c>. /// </value> bool IsInTransaction { get; } } } --- NEW FILE: DefaultServiceDomainAdapter.cs --- using System; using System.EnterpriseServices; namespace Spring.Data.Support { public class DefaultServiceDomainAdapter : IServiceDomainAdapter { public void Enter(ServiceConfig config) { ServiceDomain.Enter(config); } public TransactionStatus Leave() { return ServiceDomain.Leave(); } public void SetComplete() { ContextUtil.SetComplete(); } public void SetAbort() { ContextUtil.SetAbort(); } public TransactionVote MyTransactionVote { get { return ContextUtil.MyTransactionVote; } set { ContextUtil.MyTransactionVote = value; } } public bool IsInTransaction { get { return ContextUtil.IsInTransaction; } } } } |
From: Mark P. <mar...@us...> - 2007-11-30 22:00:25
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12831 Modified Files: Spring.Data.2005.csproj Log Message: SPRNET-773 - ServiceDomainTransactionManager dev Index: Spring.Data.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Spring.Data.2005.csproj,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Spring.Data.2005.csproj 30 Nov 2007 18:38:46 -0000 1.56 --- Spring.Data.2005.csproj 30 Nov 2007 22:00:20 -0000 1.57 *************** *** 198,205 **** --- 198,207 ---- <Compile Include="Data\Support\ConnectionTxPair.cs" /> <Compile Include="Data\Support\ConnectionUtils.cs" /> + <Compile Include="Data\Support\DefaultServiceDomainAdapter.cs" /> <Compile Include="Data\Support\DefaultTransactionScopeAdapter.cs" /> <Compile Include="Data\Support\ErrorCodeExceptionTranslator.cs" /> <Compile Include="Data\Support\FallbackExceptionTranslator.cs" /> <Compile Include="Data\Support\IAdoExceptionTranslator.cs" /> + <Compile Include="Data\Support\IServiceDomainAdapter.cs" /> <Compile Include="Data\Support\ITransactionScopeAdapter.cs" /> <Compile Include="Data\Support\NamedResultSetProcessor.cs" /> |
From: Mark P. <mar...@us...> - 2007-11-30 22:00:24
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12831/Data/Core Modified Files: ServiceDomainPlatformTransactionManager.cs Log Message: SPRNET-773 - ServiceDomainTransactionManager dev Index: ServiceDomainPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ServiceDomainPlatformTransactionManager.cs 3 Aug 2007 19:51:11 -0000 1.1 --- ServiceDomainPlatformTransactionManager.cs 30 Nov 2007 22:00:19 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- using System.EnterpriseServices; using System.Threading; + using Spring.Data.Support; using Spring.Objects.Factory; using Spring.Transaction; *************** *** 61,65 **** protected override object DoGetTransaction() { ! return new Object();//ServiceDomainTransactionObject(); } --- 62,66 ---- protected override object DoGetTransaction() { ! return new ServiceDomainTransactionObject(); } *************** *** 68,74 **** protected override bool IsExistingTransaction(object transaction) { ! //ServiceDomainTransactionObject txObject = ! // (ServiceDomainTransactionObject)transaction; ! if (ContextUtil.IsInTransaction) { return true; --- 69,74 ---- protected override bool IsExistingTransaction(object transaction) { ! ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)transaction; ! if (txObject.ServiceDomainAdapter.IsInTransaction) { return true; *************** *** 82,93 **** protected override void DoBegin(object transaction, ITransactionDefinition definition) { - //ServiceDomainTransactionObject txObject = - // (ServiceDomainTransactionObject)transaction; try { ! DoServiceDomainBegin(definition); } - // TODO - may want to catch some exceptions here to map into DAO - // exception hierarchy. catch (Exception e) { --- 82,95 ---- protected override void DoBegin(object transaction, ITransactionDefinition definition) { try { ! ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)transaction; ! ! DoServiceDomainBegin(txObject, definition); ! } ! catch (PlatformNotSupportedException ex) ! { ! throw new TransactionSystemException("ServiceDomain failure on begin of transaction. Platform does not support EnterpriseServices 'Services without Components'", ex); } catch (Exception e) { *************** *** 96,108 **** } ! private void DoServiceDomainBegin(ITransactionDefinition definition) { - - - //TODO investigate keeping track of how many contexts created.... ServiceConfig serviceConfig = CreateServiceConfig(definition); - //The context is created when we call Enter. ! ServiceDomain.Enter(serviceConfig); if (log.IsDebugEnabled) { --- 98,106 ---- } ! private void DoServiceDomainBegin(ServiceDomainTransactionObject serviceDomainTxObject, ITransactionDefinition definition) { ServiceConfig serviceConfig = CreateServiceConfig(definition); //The context is created when we call Enter. ! serviceDomainTxObject.ServiceDomainAdapter.Enter(serviceConfig); if (log.IsDebugEnabled) { *************** *** 110,118 **** + ", ActivityId = " + ContextUtil.ActivityId); } ! ! ! } --- 108,124 ---- + ", ActivityId = " + ContextUtil.ActivityId); } + } + protected override object DoSuspend(object transaction) + { + // Passing the current transaction object, literally an 'object' as the 'suspended resource', + // even though it is not used just to avoid passing null + // ServiceDomainPlatformTransactionManager is not binding any resources to the local thread, instead delegating to + // System.EnterpriseServices to handle thread local resources. + return transaction; + } ! protected override void DoResume(object transaction, object suspendedResources) ! { } *************** *** 129,133 **** serviceConfig.TrackingComponentName = "ServiceDomainPlatformTransactionManager"; ! #region Apply PropagationBehavior if (definition.PropagationBehavior == TransactionPropagation.Required) { --- 135,190 ---- serviceConfig.TrackingComponentName = "ServiceDomainPlatformTransactionManager"; ! ApplyPropagationBehavior(serviceConfig, definition); ! ! ApplyIsolationLevel(serviceConfig, definition); ! ! // infinite==-1 would cause transactions to be aborted immediately! ! if(definition.TransactionTimeout != Timeout.Infinite) ! { ! serviceConfig.TransactionTimeout = definition.TransactionTimeout; ! } ! return serviceConfig; ! } ! ! protected void ApplyIsolationLevel(ServiceConfig serviceConfig, ITransactionDefinition definition) ! { ! switch (definition.TransactionIsolationLevel) ! { ! ! case System.Data.IsolationLevel.Chaos: ! if (log.IsInfoEnabled) ! { ! log.Info("IsolationLevel Chaos does not have a direct counterpart in EnterpriseServices, using Any"); ! } ! serviceConfig.IsolationLevel = TransactionIsolationLevel.Any; ! break; ! case System.Data.IsolationLevel.ReadCommitted: ! serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted; ! break; ! case System.Data.IsolationLevel.ReadUncommitted: ! serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadUncommitted; ! break; ! case System.Data.IsolationLevel.RepeatableRead: ! serviceConfig.IsolationLevel = TransactionIsolationLevel.RepeatableRead; ! break; ! case System.Data.IsolationLevel.Serializable: ! serviceConfig.IsolationLevel = TransactionIsolationLevel.Serializable; ! break; ! case System.Data.IsolationLevel.Snapshot: ! if (log.IsInfoEnabled) ! { ! log.Info("IsolationLevel Snapshot does not have a direct counterpart in EnterpriseServices, using ReadUncommitted"); ! } ! serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadUncommitted; ! break; ! case System.Data.IsolationLevel.Unspecified: ! serviceConfig.IsolationLevel = TransactionIsolationLevel.Any; ! break; ! } ! ! } ! ! protected void ApplyPropagationBehavior(ServiceConfig serviceConfig, ITransactionDefinition definition) ! { if (definition.PropagationBehavior == TransactionPropagation.Required) { *************** *** 157,223 **** "Defaulting to Never(Disabled) "); } - #endregion - //TODO apply isoation level - serviceConfig.IsolationLevel = (TransactionIsolationLevel)Enum.Parse(typeof(TransactionIsolationLevel), "" + definition.TransactionIsolationLevel); - // infinite==-1 would cause transactions to be aborted immediately! - if(definition.TransactionTimeout != Timeout.Infinite) - { - serviceConfig.TransactionTimeout = definition.TransactionTimeout; - } - return serviceConfig; } - protected override object DoSuspend(object transaction) - { - throw new NotImplementedException("The DoSuspend method is not implemented."); - } - protected override void DoResume(object transaction, object suspendedResources) - { - throw new NotImplementedException("The DoResume mehtod is not implemented."); - } protected override void DoCommit(DefaultTransactionStatus status) { try { ! ContextUtil.SetComplete(); ! //TODO investigate only calling leave only the 'root', i.e. first context created. ! TransactionStatus serviceDomainTxstatus = ! ServiceDomain.Leave(); ! log.Info("ServiceDomain Transaction Status upon leaving ServiceDomain = " + serviceDomainTxstatus); } catch (Exception e) { ! throw new TransactionSystemException("Failure upon Leaving ServiceDomain (i.e. Commit)" , e); } } protected override void DoRollback(DefaultTransactionStatus status) { ! ContextUtil.SetAbort(); } protected override void DoSetRollbackOnly(DefaultTransactionStatus status) { ! throw new NotImplementedException("The DoSetRollbackOnly method is not implemented."); } ! public class ServiceDomainTransactionObjectNotUsed { ! private ServiceDomain serviceDomain; ! public ServiceDomain ServiceDomain { get { ! return serviceDomain; ! } ! set ! { ! serviceDomain = value; } } --- 214,338 ---- "Defaulting to Never(Disabled) "); } } protected override void DoCommit(DefaultTransactionStatus status) { + ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject) status.Transaction; + bool globalRollbackOnly = status.GlobalRollbackOnly; try { ! if (txObject.ServiceDomainAdapter.IsInTransaction) ! { ! if (txObject.ServiceDomainAdapter.MyTransactionVote == TransactionVote.Commit) ! { ! txObject.ServiceDomainAdapter.SetComplete(); ! } ! else ! { ! txObject.ServiceDomainAdapter.SetAbort(); ! } ! } ! TransactionStatus serviceDomainTxstatus = txObject.ServiceDomainAdapter.Leave(); ! if (log.IsDebugEnabled) ! { ! log.Debug("ServiceDomain Transaction Status upon leaving ServiceDomain = " + serviceDomainTxstatus); ! } ! txObject.TransactionStatus = serviceDomainTxstatus; ! if (!globalRollbackOnly && serviceDomainTxstatus == TransactionStatus.Aborted) ! { ! throw new UnexpectedRollbackException("Transaction unexpectedly rolled-back (maybe due to a timeout)"); ! } ! } ! catch (PlatformNotSupportedException ex) ! { ! throw new TransactionSystemException("Failure on Commit. Platform does not support EnterpriseServices 'Services without Components'", ex); } catch (Exception e) { ! throw new TransactionSystemException("Failure upon Leaving ServiceDomain (i.e. Commit)", e); } + } protected override void DoRollback(DefaultTransactionStatus status) { ! ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction; ! if (txObject.ServiceDomainAdapter.IsInTransaction) ! { ! try ! { ! txObject.ServiceDomainAdapter.SetAbort(); ! txObject.ServiceDomainAdapter.Leave(); ! } ! catch (Exception e) ! { ! throw new Spring.Transaction.TransactionSystemException("Failure on Transaction Scope rollback.", e); ! } ! } } protected override void DoSetRollbackOnly(DefaultTransactionStatus status) { ! ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction; ! if (status.Debug) ! { ! log.Debug("Setting transaction rollback-only"); ! } ! try ! { ! txObject.ServiceDomainAdapter.MyTransactionVote = TransactionVote.Abort; ! } ! catch (Exception ex) ! { ! throw new TransactionSystemException("Failure on System.Transactions.Transaction.Current.Rollback", ex); ! } ! } + protected override bool ShouldCommitOnGlobalRollbackOnly + { + get { return true; } + } ! ! public class ServiceDomainTransactionObject : ISmartTransactionObject { ! private TransactionStatus transactionStatus; ! private IServiceDomainAdapter serviceDomainAdapter; ! ! public ServiceDomainTransactionObject() ! { ! serviceDomainAdapter = new DefaultServiceDomainAdapter(); ! } ! ! public IServiceDomainAdapter ServiceDomainAdapter ! { ! get { return serviceDomainAdapter; } ! set { serviceDomainAdapter = value; } ! } ! ! public TransactionStatus TransactionStatus ! { ! get { return transactionStatus; } ! set { transactionStatus = value; } ! } ! ! public bool RollbackOnly { get { ! if ( ContextUtil.MyTransactionVote == TransactionVote.Abort) ! { ! return true; ! } ! else ! { ! return false; ! } } } |
From: Mark P. <mar...@us...> - 2007-11-30 18:42:49
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31257 Modified Files: AdoPlatformTransactionManagerTests.cs Log Message: some code cleanup. Index: AdoPlatformTransactionManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AdoPlatformTransactionManagerTests.cs 28 Nov 2007 05:54:56 -0000 1.6 --- AdoPlatformTransactionManagerTests.cs 30 Nov 2007 18:42:18 -0000 1.7 *************** *** 227,230 **** --- 227,231 ---- public void PropagationRequiresNewWithExistingTransaction() { + #region Mock Setup IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); *************** *** 244,250 **** connection.Dispose(); LastCall.On(connection).Repeat.Twice(); - //} - mocks.ReplayAll(); AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); --- 245,252 ---- connection.Dispose(); LastCall.On(connection).Repeat.Twice(); + #endregion + + mocks.ReplayAll(); AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); *************** *** 899,903 **** AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); TransactionTemplate tt = new TransactionTemplate(tm); ! Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); --- 901,905 ---- AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); TransactionTemplate tt = new TransactionTemplate(tm); ! tt.PropagationBehavior = TransactionPropagation.Nested; Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); *************** *** 944,948 **** AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); TransactionTemplate tt = new TransactionTemplate(tm); ! Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); --- 946,950 ---- AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); TransactionTemplate tt = new TransactionTemplate(tm); ! tt.PropagationBehavior = TransactionPropagation.Nested; Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); |
From: Mark P. <mar...@us...> - 2007-11-30 18:42:35
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31237 Modified Files: AdoPlatformTransactionManager.cs Log Message: some code cleanup. Index: AdoPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AdoPlatformTransactionManager.cs 12 Nov 2007 19:57:58 -0000 1.6 --- AdoPlatformTransactionManager.cs 30 Nov 2007 18:42:11 -0000 1.7 *************** *** 152,157 **** log.Debug("Acquired Connection [" + newCon + ", " + newCon.ConnectionString + "] for ADO.NET transaction"); } ! ! newCon.Open(); //TODO isolation level mgmt - will need to abstract out SQL used to specify this in DbMetaData --- 152,156 ---- log.Debug("Acquired Connection [" + newCon + ", " + newCon.ConnectionString + "] for ADO.NET transaction"); } ! newCon.Open(); //TODO isolation level mgmt - will need to abstract out SQL used to specify this in DbMetaData *************** *** 265,270 **** (DbProviderTransactionObject)status.Transaction; IDbTransaction trans = txMgrStateObject.ConnectionHolder.Transaction; ! //TODO add debug to status object ! //if (status.Debug) try { --- 264,272 ---- (DbProviderTransactionObject)status.Transaction; IDbTransaction trans = txMgrStateObject.ConnectionHolder.Transaction; ! if (status.Debug) ! { ! IDbConnection conn = txMgrStateObject.ConnectionHolder.Connection; ! log.Debug("Committing ADO.NET transaction on Connection [" + conn + ", " + conn.ConnectionString + "]"); ! } try { *************** *** 328,331 **** --- 330,334 ---- } + protected override void DoCleanupAfterCompletion(object transaction) { |