From 373ce41e76556979fef03c6bd4a9d00105a539c5 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Sat, 14 Dec 2013 19:09:27 +0200 Subject: [PATCH] SPRNET-1564 Remove code marked as obsolete --- BreakingChanges.txt | 1 + .../Factory/Support/AbstractObjectFactory.cs | 18 - .../Objects/Factory/Xml/ParserContext.cs | 28 -- .../Reflection/Dynamic/DynamicIndexer.cs | 186 +--------- .../Spring.Core/Spring.Core.2010.csproj | 2 +- .../Spring.Core/Util/ReflectionUtils.cs | 3 - .../Config/TxAdviceObjectDefinitionParser.cs | 328 +++++++++--------- .../Messaging/Ems/Common/EmsSession.cs | 6 - .../Messaging/Ems/Common/ISession.cs | 27 +- .../Ems/Connections/CachedSession.cs | 38 +- .../Connections/CachingConnectionFactory.cs | 22 +- .../ServicedComponentContextHandler.cs | 55 --- .../Spring.Services.2010.csproj | 1 - .../Conversation/WebConversationManager.cs | 45 +-- src/Spring/Spring.Web/Web/UI/Page.cs | 38 -- .../Reflection/Dynamic/DynamicIndexerTests.cs | 157 --------- .../Spring.Core.Tests.2010.csproj | 1 - .../ValidationNamespaceParserTests.cs | 10 +- 18 files changed, 215 insertions(+), 751 deletions(-) delete mode 100644 src/Spring/Spring.Services/EnterpriseServices/ServicedComponentContextHandler.cs delete mode 100644 test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs diff --git a/BreakingChanges.txt b/BreakingChanges.txt index aa650162..a1af2c80 100644 --- a/BreakingChanges.txt +++ b/BreakingChanges.txt @@ -2,6 +2,7 @@ Changes (1.3.2 to 2.0) ======================== Protected fields were changed to private. Access is now allowed via public/protected property member. +Members marked as Obsolete before 2.0 release were removed. Changes (1.3.1 to 1.3.2) diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs index 0f26d298..ce98aff3 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs @@ -910,24 +910,6 @@ namespace Spring.Objects.Factory.Support return ResolveObjectType(mod, objectName); } - /// - /// Get the object for the given object instance, either the object - /// instance itself or its created object in case of an - /// . - /// - /// - /// The name that may include the factory dereference prefix. - /// - /// The object instance. - /// - /// The singleton instance of the object. - /// - [Obsolete("")] - protected internal virtual object GetObjectForInstance(string name, object instance) - { - return GetObjectForInstance(instance, name, TransformedObjectName(name), null); - } - /// /// Get the object for the given object instance, either the object /// instance itself or its created object in case of an diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs index ecc2d3c8..338985ea 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs @@ -62,34 +62,6 @@ namespace Spring.Objects.Factory.Xml this.containingObjectDefinition = containingObjectDefinition; } - /// - /// Initializes a new instance of the class. - /// - /// The reader context. - /// The parser helper. - [Obsolete("consider using ParserContext(ObjectDefinitionParserHelper) instead", false)] - public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper) - { - this.readerContext = readerContext; - this.parserHelper = parserHelper; - } - - - /// - /// Initializes a new instance of the class. - /// - /// The reader context. - /// The parser helper. - /// The containing object definition. - [Obsolete("consider using ParserContext(ObjectDefinitionParserHelper, IObjectDefinition) instead", false)] - public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper, IObjectDefinition containingObjectDefinition) - { - this.readerContext = readerContext; - this.parserHelper = parserHelper; - this.containingObjectDefinition = containingObjectDefinition; - } - - /// /// Gets the reader context. /// diff --git a/src/Spring/Spring.Core/Reflection/Dynamic/DynamicIndexer.cs b/src/Spring/Spring.Core/Reflection/Dynamic/DynamicIndexer.cs index 763cb6df..8668149b 100644 --- a/src/Spring/Spring.Core/Reflection/Dynamic/DynamicIndexer.cs +++ b/src/Spring/Spring.Core/Reflection/Dynamic/DynamicIndexer.cs @@ -18,21 +18,8 @@ #endregion -#region Imports - -using System; -using System.Collections; -using System.Reflection; -using System.Reflection.Emit; -using Spring.Reflection.Dynamic; -using Spring.Util; - -#endregion - namespace Spring.Reflection.Dynamic { - #region IDynamicIndexer interface - /// /// Defines methods that dynamic indexer class has to implement. /// @@ -122,175 +109,4 @@ namespace Spring.Reflection.Dynamic /// void SetValue( object target, object[] index, object value ); } - - #endregion - - #region Safe wrapper - - /// - /// Safe wrapper for the dynamic indexer. - /// - /// - /// will attempt to use dynamic - /// indexer if possible, but it will fall back to standard - /// reflection if necessary. - /// - [Obsolete("Use SafeProperty instead", false)] - public class SafeIndexer : IDynamicIndexer - { - private PropertyInfo indexerProperty; - - /// - /// Internal PropertyInfo accessor. - /// - internal PropertyInfo IndexerProperty - { - get { return indexerProperty; } - } - - private SafeProperty property; - - /// - /// Creates a new instance of the safe indexer wrapper. - /// - /// Indexer to wrap. - public SafeIndexer( PropertyInfo indexerInfo ) - { - AssertUtils.ArgumentNotNull( indexerInfo, "You cannot create a dynamic indexer for a null value." ); - - this.indexerProperty = indexerInfo; - this.property = new SafeProperty( indexerInfo ); - } - - /// - /// Gets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to get indexer value from. - /// - /// - /// Indexer arguments. - /// - /// - /// A indexer value. - /// - public object GetValue( object target, int index ) - { - return property.GetValue( target, index ); - } - - /// - /// Gets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to get the indexer value from. - /// - /// - /// Indexer argument. - /// - /// - /// A indexer value. - /// - public object GetValue( object target, object index ) - { - return property.GetValue( target, index ); - } - - /// - /// Gets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to get indexer value from. - /// - /// - /// Indexer arguments. - /// - /// - /// A indexer value. - /// - public object GetValue( object target, object[] index ) - { - return property.GetValue( target, index ); - } - - /// - /// Sets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to set indexer value on. - /// - /// - /// Indexer arguments. - /// - /// - /// A new indexer value. - /// - public void SetValue( object target, int index, object value ) - { - property.SetValue( target, value, index ); - } - - /// - /// Sets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to set indexer value on. - /// - /// - /// Indexer arguments. - /// - /// - /// A new indexer value. - /// - public void SetValue( object target, object index, object value ) - { - property.SetValue( target, value, index ); - } - - /// - /// Sets the value of the dynamic indexer for the specified target object. - /// - /// - /// Target object to set indexer value on. - /// - /// - /// Indexer arguments. - /// - /// - /// A new indexer value. - /// - public void SetValue( object target, object[] index, object value ) - { - property.SetValue( target, value, index ); - } - } - - #endregion - - /// - /// Factory class for dynamic indexers. - /// - /// Aleksandar Seovic - [Obsolete( "Use DynamicProperty instead", false )] - public sealed class DynamicIndexer : BaseDynamicMember - { - /// - /// Prevent instantiation - /// - private DynamicIndexer() { } - - /// - /// Creates dynamic indexer instance for the specified . - /// - /// Indexer info to create dynamic indexer for. - /// Dynamic indexer for the specified . - public static IDynamicIndexer Create( PropertyInfo indexer ) - { - AssertUtils.ArgumentNotNull( indexer, "You cannot create a dynamic indexer for a null value." ); - - IDynamicIndexer dynamicIndexer = new SafeIndexer( indexer ); - return dynamicIndexer; - } - } - -} // namespace +} diff --git a/src/Spring/Spring.Core/Spring.Core.2010.csproj b/src/Spring/Spring.Core/Spring.Core.2010.csproj index 83f4d0b1..b33234ac 100644 --- a/src/Spring/Spring.Core/Spring.Core.2010.csproj +++ b/src/Spring/Spring.Core/Spring.Core.2010.csproj @@ -764,6 +764,7 @@ + @@ -1156,7 +1157,6 @@ - diff --git a/src/Spring/Spring.Core/Util/ReflectionUtils.cs b/src/Spring/Spring.Core/Util/ReflectionUtils.cs index 240ea2c1..9dc5d73f 100644 --- a/src/Spring/Spring.Core/Util/ReflectionUtils.cs +++ b/src/Spring/Spring.Core/Util/ReflectionUtils.cs @@ -1102,11 +1102,8 @@ namespace Spring.Util // In case of using List the above note makes // no sense (SD:) IList propertiesToSet = new ArrayList(); - int k = 0; IList fieldsToSet = new ArrayList(); - int n = 0; - // Fills arrays of the constructor named parameters foreach (CustomAttributeNamedArgument namedArgument in attributeData.NamedArguments) diff --git a/src/Spring/Spring.Data/Transaction/Config/TxAdviceObjectDefinitionParser.cs b/src/Spring/Spring.Data/Transaction/Config/TxAdviceObjectDefinitionParser.cs index b2b2e6cb..41f38f1e 100644 --- a/src/Spring/Spring.Data/Transaction/Config/TxAdviceObjectDefinitionParser.cs +++ b/src/Spring/Spring.Data/Transaction/Config/TxAdviceObjectDefinitionParser.cs @@ -1,174 +1,174 @@ -#region License - -/* - * Copyright 2002-2010 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 - -using System; -using System.Collections; -using System.Data; -using System.Xml; -using Spring.Collections; -using Spring.Objects.Factory.Config; -using Spring.Objects.Factory.Support; -using Spring.Objects.Factory.Xml; -using Spring.Transaction.Interceptor; -using Spring.Util; - -namespace Spring.Transaction.Config -{ - /// - /// The for the <tx:advice> tag. - /// - /// Rob Harrop - /// Juergen Hoeller - /// Adrian Colyer - /// Mark Pollack (.NET) - public class TxAdviceObjectDefinitionParser : AbstractSingleObjectDefinitionParser - { - private static string TIMEOUT = "timeout"; - - private static string READ_ONLY = "read-only"; - - private static string NAME_MAP = "nameMap"; - - private static string PROPAGATION = "propagation"; - - private static string ISOLATION = "isolation"; - - private static string ROLLBACK_FOR = "rollback-for"; - - private static string NO_ROLLBACK_FOR = "no-rollback-for"; - - protected override Type GetObjectType(XmlElement element) - { - return typeof (TransactionInterceptor); - } - - protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder) - { - +#region License + +/* + * Copyright 2002-2010 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 + +using System; +using System.Collections; +using System.Data; +using System.Xml; +using Spring.Collections; +using Spring.Objects.Factory.Config; +using Spring.Objects.Factory.Support; +using Spring.Objects.Factory.Xml; +using Spring.Transaction.Interceptor; +using Spring.Util; + +namespace Spring.Transaction.Config +{ + /// + /// The for the <tx:advice> tag. + /// + /// Rob Harrop + /// Juergen Hoeller + /// Adrian Colyer + /// Mark Pollack (.NET) + public class TxAdviceObjectDefinitionParser : AbstractSingleObjectDefinitionParser + { + private static string TIMEOUT = "timeout"; + + private static string READ_ONLY = "read-only"; + + private static string NAME_MAP = "nameMap"; + + private static string PROPAGATION = "propagation"; + + private static string ISOLATION = "isolation"; + + private static string ROLLBACK_FOR = "rollback-for"; + + private static string NO_ROLLBACK_FOR = "no-rollback-for"; + + protected override Type GetObjectType(XmlElement element) + { + return typeof (TransactionInterceptor); + } + + protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder) + { + builder.AddPropertyReference(TxNamespaceUtils.TRANSACTION_MANAGER_PROPERTY, - GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE)); - XmlNodeList txAttributes = element.SelectNodes("*[local-name()='attributes' and namespace-uri()='" + element.NamespaceURI + "']"); - if (txAttributes.Count > 1 ) - { - parserContext.ReaderContext.ReportException(element, "tx advice", "Element is allowed at most once inside element "); - } - else if (txAttributes.Count == 1) - { - //using xml defined source - XmlElement attributeSourceElement = txAttributes[0] as XmlElement; - AbstractObjectDefinition attributeSourceDefinition = - ParseAttributeSource(attributeSourceElement, parserContext); - builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, attributeSourceDefinition); - } - else - { - //Assume attibutes source - ObjectDefinitionBuilder txAttributeSourceBuilder = - parserContext.ParserHelper.CreateRootObjectDefinitionBuilder(typeof (AttributesTransactionAttributeSource)); - - builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, - txAttributeSourceBuilder.ObjectDefinition); - - } - } - - private AbstractObjectDefinition ParseAttributeSource(XmlElement element, ParserContext parserContext) - { - XmlNodeList methods = element.SelectNodes("*[local-name()='method' and namespace-uri()='" + element.NamespaceURI + "']"); - ManagedDictionary transactionAttributeMap = new ManagedDictionary(); - foreach (XmlElement methodElement in methods) + GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE)); + XmlNodeList txAttributes = element.SelectNodes("*[local-name()='attributes' and namespace-uri()='" + element.NamespaceURI + "']"); + if (txAttributes.Count > 1 ) { - string name = GetAttributeValue(methodElement, "name"); - TypedStringValue nameHolder = new TypedStringValue(name); - + parserContext.ReaderContext.ReportException(element, "tx advice", "Element is allowed at most once inside element "); + } + else if (txAttributes.Count == 1) + { + //using xml defined source + XmlElement attributeSourceElement = txAttributes[0] as XmlElement; + AbstractObjectDefinition attributeSourceDefinition = + ParseAttributeSource(attributeSourceElement, parserContext); + builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, attributeSourceDefinition); + } + else + { + //Assume attibutes source + ObjectDefinitionBuilder txAttributeSourceBuilder = + parserContext.ParserHelper.CreateRootObjectDefinitionBuilder(typeof (AttributesTransactionAttributeSource)); + + builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, + txAttributeSourceBuilder.ObjectDefinition); + + } + } + + private AbstractObjectDefinition ParseAttributeSource(XmlElement element, ParserContext parserContext) + { + XmlNodeList methods = element.SelectNodes("*[local-name()='method' and namespace-uri()='" + element.NamespaceURI + "']"); + ManagedDictionary transactionAttributeMap = new ManagedDictionary(); + foreach (XmlElement methodElement in methods) + { + string name = GetAttributeValue(methodElement, "name"); + TypedStringValue nameHolder = new TypedStringValue(name); + RuleBasedTransactionAttribute attribute = new RuleBasedTransactionAttribute(); string propagation = GetAttributeValue(methodElement, PROPAGATION); string isolation = GetAttributeValue(methodElement, ISOLATION); string timeout = GetAttributeValue(methodElement, TIMEOUT); - string readOnly = GetAttributeValue(methodElement, READ_ONLY); - if (StringUtils.HasText(propagation)) - { - attribute.PropagationBehavior = (TransactionPropagation) Enum.Parse(typeof (TransactionPropagation), propagation, true); - } - if (StringUtils.HasText(isolation)) - { - attribute.TransactionIsolationLevel = - (IsolationLevel) Enum.Parse(typeof (IsolationLevel), isolation, true); - } - if (StringUtils.HasText(timeout)) - { - try - { - attribute.TransactionTimeout = Int32.Parse(timeout); - } - catch (FormatException ex) - { - parserContext.ReaderContext.ReportException(methodElement,"tx advice","timeout must be an integer value: [" + timeout + "]", ex); - } - } - if (StringUtils.HasText(readOnly)) + string readOnly = GetAttributeValue(methodElement, READ_ONLY); + if (StringUtils.HasText(propagation)) { - attribute.ReadOnly = Boolean.Parse(GetAttributeValue(methodElement, READ_ONLY)); - } - IList rollbackRules = new LinkedList(); - if (methodElement.HasAttribute(ROLLBACK_FOR)) + attribute.PropagationBehavior = (TransactionPropagation) Enum.Parse(typeof (TransactionPropagation), propagation, true); + } + if (StringUtils.HasText(isolation)) { - string rollbackForValue = GetAttributeValue(methodElement, ROLLBACK_FOR); - AddRollbackRuleAttributesTo(rollbackRules, rollbackForValue); - } - if (methodElement.HasAttribute(NO_ROLLBACK_FOR)) + attribute.TransactionIsolationLevel = + (IsolationLevel) Enum.Parse(typeof (IsolationLevel), isolation, true); + } + if (StringUtils.HasText(timeout)) { - string noRollbackForValue = GetAttributeValue(methodElement, NO_ROLLBACK_FOR); - AddNoRollbackRuleAttributesTo(rollbackRules, noRollbackForValue); - } - attribute.RollbackRules = rollbackRules; - - transactionAttributeMap[nameHolder] = attribute; - } - - ObjectDefinitionBuilder builder = parserContext - .ParserHelper - .CreateRootObjectDefinitionBuilder(typeof (NameMatchTransactionAttributeSource)); - builder.AddPropertyValue(NAME_MAP, transactionAttributeMap); - return builder.ObjectDefinition; - - } - - - - private void AddRollbackRuleAttributesTo(IList rollbackRules, string rollbackForValue) - { - string[] exceptionTypeNames = StringUtils.CommaDelimitedListToStringArray(rollbackForValue); - foreach (string exceptionTypeName in exceptionTypeNames) - { - rollbackRules.Add(new RollbackRuleAttribute(exceptionTypeName.Trim())); - } - } - - private void AddNoRollbackRuleAttributesTo(IList rollbackRules, string noRollbackForValue) - { - string[] exceptionTypeNames = StringUtils.CommaDelimitedListToStringArray(noRollbackForValue); - foreach (string exceptionTypeName in exceptionTypeNames) - { - rollbackRules.Add(new NoRollbackRuleAttribute(exceptionTypeName.Trim())); - } - } - } + try + { + attribute.TransactionTimeout = Int32.Parse(timeout); + } + catch (FormatException ex) + { + parserContext.ReaderContext.ReportException(methodElement,"tx advice","timeout must be an integer value: [" + timeout + "]", ex); + } + } + if (StringUtils.HasText(readOnly)) + { + attribute.ReadOnly = Boolean.Parse(GetAttributeValue(methodElement, READ_ONLY)); + } + IList rollbackRules = new LinkedList(); + if (methodElement.HasAttribute(ROLLBACK_FOR)) + { + string rollbackForValue = GetAttributeValue(methodElement, ROLLBACK_FOR); + AddRollbackRuleAttributesTo(rollbackRules, rollbackForValue); + } + if (methodElement.HasAttribute(NO_ROLLBACK_FOR)) + { + string noRollbackForValue = GetAttributeValue(methodElement, NO_ROLLBACK_FOR); + AddNoRollbackRuleAttributesTo(rollbackRules, noRollbackForValue); + } + attribute.RollbackRules = rollbackRules; + + transactionAttributeMap[nameHolder] = attribute; + } + + ObjectDefinitionBuilder builder = parserContext + .ParserHelper + .CreateRootObjectDefinitionBuilder(typeof (NameMatchTransactionAttributeSource)); + builder.AddPropertyValue(NAME_MAP, transactionAttributeMap); + return builder.ObjectDefinition; + + } + + + + private void AddRollbackRuleAttributesTo(IList rollbackRules, string rollbackForValue) + { + string[] exceptionTypeNames = StringUtils.CommaDelimitedListToStringArray(rollbackForValue); + foreach (string exceptionTypeName in exceptionTypeNames) + { + rollbackRules.Add(new RollbackRuleAttribute(exceptionTypeName.Trim())); + } + } + + private void AddNoRollbackRuleAttributesTo(IList rollbackRules, string noRollbackForValue) + { + string[] exceptionTypeNames = StringUtils.CommaDelimitedListToStringArray(noRollbackForValue); + foreach (string exceptionTypeName in exceptionTypeNames) + { + rollbackRules.Add(new NoRollbackRuleAttribute(exceptionTypeName.Trim())); + } + } + } } \ No newline at end of file diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsSession.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsSession.cs index b73f6664..71d606e8 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsSession.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsSession.cs @@ -190,12 +190,6 @@ namespace Spring.Messaging.Ems.Common get { return nativeSession.IsTransacted; } } - public IMessageListener MessageListener - { - get { return nativeSession.MessageListener; } - set { nativeSession.MessageListener = value; } - } - public long SessID { get { return nativeSession.SessID; } diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/ISession.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/ISession.cs index a67b31d9..1f18b0f3 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/ISession.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/ISession.cs @@ -20,6 +20,7 @@ using System; using System.ComponentModel; + using TIBCO.EMS; namespace Spring.Messaging.Ems.Common @@ -27,49 +28,65 @@ namespace Spring.Messaging.Ems.Common public interface ISession { Session NativeSession { get; } + void Close(); + void Commit(); + QueueBrowser CreateBrowser(Queue queue); + QueueBrowser CreateBrowser(Queue queue, string messageSelector); IMessageConsumer CreateConsumer(Destination dest); + IMessageConsumer CreateConsumer(Destination dest, string messageSelector); + IMessageConsumer CreateConsumer(Destination dest, string messageSelector, bool noLocal); + ITopicSubscriber CreateDurableSubscriber(Topic topic, string name); + ITopicSubscriber CreateDurableSubscriber(Topic topic, string name, string messageSelector, bool noLocal); + IMessageProducer CreateProducer(Destination dest); - Queue CreateQueue(string queueName); + Topic CreateTopic(string topicName); + TemporaryQueue CreateTemporaryQueue(); + TemporaryTopic CreateTemporaryTopic(); Message CreateMessage(); + TextMessage CreateTextMessage(); + TextMessage CreateTextMessage(string text); + MapMessage CreateMapMessage(); + BytesMessage CreateBytesMessage(); + ObjectMessage CreateObjectMessage(); + ObjectMessage CreateObjectMessage(object obj); + StreamMessage CreateStreamMessage(); - void Recover(); + void Rollback(); [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Ordinary JMS clients should not use this method.")] void Run(); void Unsubscribe(string name); + int AcknowledgeMode { get; } TIBCO.EMS.Connection Connection { get; } bool IsClosed { get; } bool IsTransacted { get; } - [Obsolete("Use MessageConsumer.MessageListener instead.")] - IMessageListener MessageListener { get; set; } - long SessID { get; } SessionMode SessionAcknowledgeMode { get; } bool Transacted { get; } diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs index 69d71a8a..e3758c2e 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs @@ -18,7 +18,6 @@ #endregion -using System; using System.Collections; using Spring.Messaging.Ems.Common; using TIBCO.EMS; @@ -45,15 +44,15 @@ namespace Spring.Messaging.Ems.Connections #endregion - private ISession target; - private LinkedList sessionList; - private int sessionCacheSize; - private IDictionary cachedProducers = new Hashtable(); - private IDictionary cachedConsumers = new Hashtable(); - private bool shouldCacheProducers; - private bool shouldCacheConsumers; + private readonly ISession target; + private readonly LinkedList sessionList; + private readonly int sessionCacheSize; + private readonly IDictionary cachedProducers = new Hashtable(); + private readonly IDictionary cachedConsumers = new Hashtable(); + private readonly bool shouldCacheProducers; + private readonly bool shouldCacheConsumers; private bool transactionOpen = false; - private CachingConnectionFactory ccf; + private readonly CachingConnectionFactory ccf; /// /// Initializes a new instance of the class. @@ -592,19 +591,6 @@ namespace Spring.Messaging.Ems.Connections } } - public IMessageListener MessageListener - { - get { - this.transactionOpen = true; - return target.MessageListener; - } - set - { - this.transactionOpen = true; - target.MessageListener = value; - } - } - #endregion /// @@ -621,10 +607,10 @@ namespace Spring.Messaging.Ems.Connections internal class ConsumerCacheKey { - private Destination destination; - private string selector; - private bool noLocal; - private string subscription; + private readonly Destination destination; + private readonly string selector; + private readonly bool noLocal; + private readonly string subscription; public ConsumerCacheKey(Destination destination, string selector, bool noLocal, string subscription) { diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs index e758ee9e..ec4a131c 100644 --- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs @@ -20,9 +20,13 @@ using System; using System.Collections; + using Spring.Messaging.Ems.Common; + using TIBCO.EMS; + using Common.Logging; + using Spring.Collections; using Spring.Util; @@ -61,7 +65,7 @@ namespace Spring.Messaging.Ems.Connections { #region Logging Definition - private static readonly ILog LOG = LogManager.GetLogger(typeof(CachingConnectionFactory)); + private static readonly ILog LOG = LogManager.GetLogger(typeof (CachingConnectionFactory)); #endregion @@ -75,7 +79,6 @@ namespace Spring.Messaging.Ems.Connections private IDictionary cachedSessions = new Hashtable(); - /// /// Initializes a new instance of the class. /// and sets the ReconnectOnException to true @@ -95,7 +98,6 @@ namespace Spring.Messaging.Ems.Connections ReconnectOnException = true; } - /// /// Gets or sets the size of the session cache. /// @@ -122,7 +124,6 @@ namespace Spring.Messaging.Ems.Connections } } - /// /// Gets or sets a value indicating whether to cache MessageProducers per /// Session instance. (more specifically: one MessageProducer per Destination @@ -140,7 +141,6 @@ namespace Spring.Messaging.Ems.Connections set { cacheProducers = value; } } - /// /// Gets or sets a value indicating whether o cache JMS MessageConsumers per /// EMS Session instance. @@ -197,7 +197,7 @@ namespace Spring.Messaging.Ems.Connections } } } - cachedSessions.Clear(); + cachedSessions.Clear(); } this.active = true; // Now proceed with actual closing of the shared Connection... @@ -240,9 +240,10 @@ namespace Spring.Messaging.Ems.Connections LOG.Debug("Found cached Session for mode " + mode + ": " + (session is IDecoratorSession ? ((IDecoratorSession) session).TargetSession : session)); } - } else + } + else { - ISession targetSession = CreateSession(con, mode); + ISession targetSession = CreateSession(con, mode); if (LOG.IsDebugEnabled) { LOG.Debug("Creating cached Session for mode " + mode + ": " + targetSession); @@ -259,11 +260,10 @@ namespace Spring.Messaging.Ems.Connections return con.CreateSession(transacted, ackMode); } - /// /// Wraps the given Session so that it delegates every method call to the target session but /// adapts close calls. This is useful for allowing application code to - /// handle a special framework Session just like an ordinary Session. + /// handle a special framework Session just like an ordinary Session. /// /// The original Session to wrap. /// The List of cached Sessions that the given Session belongs to. @@ -273,6 +273,4 @@ namespace Spring.Messaging.Ems.Connections return new CachedSession(targetSession, sessionList, this); } } - - } \ No newline at end of file diff --git a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentContextHandler.cs b/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentContextHandler.cs deleted file mode 100644 index de66f829..00000000 --- a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentContextHandler.cs +++ /dev/null @@ -1,55 +0,0 @@ -#region License - -/* - * Copyright 2002-2010 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 !MONO - -#region Imports - -using System; -using System.EnterpriseServices; -using Spring.Context.Support; - -#endregion - -namespace Spring.EnterpriseServices -{ - /// - /// Handles loading of <spring/context> configuration sections for - /// in-process s generated by - /// . - /// - /// Erich Eichinger - [Obsolete("not used anymore")] - public class ServicedComponentContextHandler : ContextHandler - { - /// - /// Prevent auto-registering the context with the global ContextRegistry - /// - protected override bool AutoRegisterWithContextRegistry - { - get - { - return false; - } - } - } -} - -#endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/Spring.Services.2010.csproj b/src/Spring/Spring.Services/Spring.Services.2010.csproj index 42b0fe3c..9523d3d5 100644 --- a/src/Spring/Spring.Services/Spring.Services.2010.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2010.csproj @@ -107,7 +107,6 @@ - diff --git a/src/Spring/Spring.Web.Conversation.NHibernate32/Web/Conversation/WebConversationManager.cs b/src/Spring/Spring.Web.Conversation.NHibernate32/Web/Conversation/WebConversationManager.cs index 156b5262..4695fb0e 100644 --- a/src/Spring/Spring.Web.Conversation.NHibernate32/Web/Conversation/WebConversationManager.cs +++ b/src/Spring/Spring.Web.Conversation.NHibernate32/Web/Conversation/WebConversationManager.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using System.Threading; -using System.Web; + using Common.Logging; using NHibernate; using Spring.Context; @@ -39,13 +39,12 @@ namespace Spring.Web.Conversation { private static readonly ILog LOG = LogManager.GetLogger(typeof(WebConversationManager)); - private static readonly String CONVERSATION_COOKIE_ID = "WebConversationManager.activeConversationId"; - /// /// Semaphore to synchronize writes to the dictionary. /// [NonSerialized] private Mutex mutexEditDic = new Mutex(); + private Mutex MutexEditDic { get @@ -212,46 +211,6 @@ namespace Spring.Web.Conversation } } } - - /// - /// - /// - [Obsolete("Not used, the active conversation is defined by call 'IConversationManager.SetActiveConversation' on 'IConversationState.StartResumeConversation'")] - public void LoadActiveConversation() - { - //reset this.activeConversation - this.activeConversation = null; - - if (LOG.IsDebugEnabled) LOG.Debug("LoadActiveConversation"); - - HttpCookie activeConveCookie = HttpContext.Current.Request.Cookies[CONVERSATION_COOKIE_ID]; - if (activeConveCookie != null && !String.IsNullOrEmpty(activeConveCookie.Value)) - { - if (LOG.IsDebugEnabled) LOG.Debug(String.Format("LoadActiveConversation: cooking found for current active conversation: [{0}]", activeConveCookie.ToString())); - if (this.conversations.ContainsKey(activeConveCookie.Value)) - { - if (LOG.IsDebugEnabled) LOG.Debug(String.Format("LoadActiveConversation: active conversation found for id: '{0}'", activeConveCookie.Value)); - IConversationState conversation = this.conversations[activeConveCookie.Value]; - if (conversation != null) - { - if (LOG.IsDebugEnabled) LOG.Debug(String.Format("LoadActiveConversation: conversation found: '{0}'", conversation.Id)); - //find root conversation. - IConversationState rootConversation = conversation; - while (rootConversation.ParentConversation != null) - { - rootConversation = rootConversation.ParentConversation; - } - rootConversation.StartResumeConversation(); - this.SetActiveConversation(rootConversation); - } - } - else - { - if (LOG.IsDebugEnabled) LOG.Debug(String.Format("LoadActiveConversation: conversation NOT found for id on the cookie: '{0}'", activeConveCookie.Value)); - HttpContext.Current.Response.Cookies.Remove(CONVERSATION_COOKIE_ID); - } - } - } /// /// diff --git a/src/Spring/Spring.Web/Web/UI/Page.cs b/src/Spring/Spring.Web/Web/UI/Page.cs index 9d27c960..7dd6b22d 100644 --- a/src/Spring/Spring.Web/Web/UI/Page.cs +++ b/src/Spring/Spring.Web/Web/UI/Page.cs @@ -719,18 +719,6 @@ namespace Spring.Web.UI RegisterHeadScriptBlock( key, Script.DefaultType, script ); } - /// - /// Registers script block that should be rendered within the head HTML element. - /// - /// Script key. - /// Script language. - /// Script text. - [Obsolete( "The 'language' attribute is deprecated. Please use RegisterHeadScriptBlock(string key, MimeMediaType type, string script) instead", false )] - public void RegisterHeadScriptBlock( string key, string language, string script ) - { - headScripts[key] = new ScriptBlock( language, script ); - } - /// /// Registers script block that should be rendered within the head HTML element. /// @@ -752,18 +740,6 @@ namespace Spring.Web.UI RegisterHeadScriptFile( key, Script.DefaultType, fileName ); } - /// - /// Registers script file that should be referenced within the head HTML element. - /// - /// Script key. - /// Script language. - /// Script file name. - [Obsolete( "The 'language' attribute is deprecated. Please use RegisterHeadScriptFile(string key, MimeMediaType type, string filename) instead", false )] - public void RegisterHeadScriptFile( string key, string language, string fileName ) - { - headScripts[key] = new ScriptFile( language, fileName ); - } - /// /// Registers script file that should be referenced within the head HTML element. /// @@ -787,20 +763,6 @@ namespace Spring.Web.UI RegisterHeadScriptEvent( key, Script.DefaultType, element, eventName, script ); } - /// - /// Registers script block that should be rendered within the head HTML element. - /// - /// Script key. - /// Script language. - /// Element ID of the event source. - /// Name of the event to handle. - /// Script text. - [Obsolete( "The 'language' attribute is deprecated. Please use RegisterHeadScriptEvent(string key, MimeMediaType mimeType, string element, string eventName, string script) instead" )] - public void RegisterHeadScriptEvent( string key, string language, string element, string eventName, string script ) - { - headScripts[key] = new ScriptEvent( language, element, eventName, script ); - } - /// /// Registers script block that should be rendered within the head HTML element. /// diff --git a/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs b/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs deleted file mode 100644 index 78d89225..00000000 --- a/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs +++ /dev/null @@ -1,157 +0,0 @@ -#region License - -/* - * Copyright 2004 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 - -#region Imports - -using System; -using System.Collections; -using System.Diagnostics; -using System.Reflection; -using NUnit.Framework; -using Spring.Context.Support; - -#endregion - -#pragma warning disable 618 - -namespace Spring.Reflection.Dynamic -{ - /// - /// Unit tests for the DynamicIndexer class. - /// - /// Aleksandar Seovic - [TestFixture] - public sealed class DynamicIndexerTests - { - private Inventor tesla; - private Inventor pupin; - private Society ieee; - - #region SetUp and TearDown - - /// - /// The setup logic executed before the execution of each individual test. - /// - [SetUp] - public void SetUp() - { - ContextRegistry.Clear(); - tesla = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian"); - tesla.Inventions = new string[] - { - "Telephone repeater", "Rotating magnetic field principle", - "Polyphase alternating-current system", "Induction motor", - "Alternating-current power transmission", "Tesla coil transformer", - "Wireless communication", "Radio", "Fluorescent lights" - }; - tesla.PlaceOfBirth.City = "Smiljan"; - - pupin = new Inventor("Mihajlo Pupin", new DateTime(1854, 10, 9), "Serbian"); - pupin.Inventions = new string[] { "Long distance telephony & telegraphy", "Secondary X-Ray radiation", "Sonar" }; - pupin.PlaceOfBirth.City = "Idvor"; - pupin.PlaceOfBirth.Country = "Serbia"; - - ieee = new Society(); - ieee.Members.Add(tesla); - ieee.Members.Add(pupin); - ieee.Officers["president"] = pupin; - ieee.Officers["advisors"] = new Inventor[] { tesla, pupin }; // not historically accurate, but I need an array in the map ;-) - } - - [TestFixtureTearDown] - public void TearDown() - { - //DynamicReflectionManager.SaveAssembly(); - } - - #endregion - - [Test] - public void TestIndexers() - { - IDynamicIndexer members = DynamicIndexer.Create(typeof(ArrayList).GetProperty("Item")); - Inventor nikola = (Inventor) members.GetValue(ieee.Members, new object[] { 0 }); - Assert.AreEqual(tesla, nikola); - members.SetValue(ieee.Members, new object[] { 0 }, new Inventor("Ana Maria Seovic", new DateTime(2004, 8, 14), "Serbian")); - Assert.AreEqual("Ana Maria Seovic", ((Inventor) members.GetValue(ieee.Members, 0)).Name); - members.SetValue(ieee.Members, 1, tesla); - Assert.AreEqual("Nikola Tesla", ((Inventor) members.GetValue(ieee.Members, 1)).Name); - - IDynamicIndexer officers = DynamicIndexer.Create(typeof(Hashtable).GetProperty("Item")); - Assert.AreEqual(pupin, officers.GetValue(ieee.Officers, new object[] {"president"})); - officers.SetValue(ieee.Officers, "president", - new Inventor("Aleksandar Seovic", new DateTime(1974, 8, 24), "Serbian")); - Assert.AreEqual("Aleksandar Seovic", ((Inventor)officers.GetValue(ieee.Officers, "president")).Name); - } - - #region Performance tests - - private DateTime start, stop; - - //[Test] - public void PerformanceTests() - { - int n = 10000000; - object x = null; - - // ieee.Members[0] - start = DateTime.Now; - for (int i = 0; i < n; i++) - { - x = ieee.Members[0]; - } - stop = DateTime.Now; - PrintTest("ieee.Members[0] (direct)", n, Elapsed); - - start = DateTime.Now; - IDynamicIndexer members = DynamicIndexer.Create(typeof(ArrayList).GetProperty("Item")); - for (int i = 0; i < n; i++) - { - x = members.GetValue(ieee.Members, 0); - } - stop = DateTime.Now; - PrintTest("ieee.Members[0] (dynamic reflection)", n, Elapsed); - - start = DateTime.Now; - PropertyInfo membersPi = typeof(ArrayList).GetProperty("Item"); - object[] indexArgs = new object[] { 0 }; - for (int i = 0; i < n; i++) - { - x = membersPi.GetValue(ieee.Members, indexArgs); - } - stop = DateTime.Now; - PrintTest("ieee.Members[0] (standard reflection)", n, Elapsed); - } - - private double Elapsed - { - get { return (stop.Ticks - start.Ticks) / 10000000f; } - } - - private void PrintTest(string name, int iterations, double duration) - { - Debug.WriteLine(String.Format("{0,-60} {1,12:#,###} {2,12:##0.000} {3,12:#,###}", name, iterations, duration, iterations / duration)); - } - - #endregion - - } -} -#pragma warning restore 618 diff --git a/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj b/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj index 5b109d44..2aa479a1 100644 --- a/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj +++ b/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj @@ -708,7 +708,6 @@ - diff --git a/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs b/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs index a32227a3..f93826a9 100644 --- a/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs +++ b/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs @@ -50,14 +50,11 @@ namespace Spring.Validation XmlDocument doc = GetValidatedXmlResource("_WhenConfigFileIsValid.xml"); MockObjectDefinitionRegistry registry = new MockObjectDefinitionRegistry(); - IObjectDefinitionDocumentReader reader = new DefaultObjectDefinitionDocumentReader(); XmlReaderContext readerContext = new XmlReaderContext(null, new XmlObjectDefinitionReader(registry)); ObjectDefinitionParserHelper helper = new ObjectDefinitionParserHelper(readerContext); helper.InitDefaults(doc.DocumentElement); -#pragma warning disable 618 - ParserContext parserContext = new ParserContext(helper.ReaderContext, helper); -#pragma warning restore 618 + ParserContext parserContext = new ParserContext(helper); ValidationNamespaceParser parser = new ValidationNamespaceParser(); foreach (XmlElement element in doc.DocumentElement.ChildNodes) @@ -159,14 +156,11 @@ namespace Spring.Validation XmlDocument doc = GetValidatedXmlResource("_WhenConfigFileIsNotValid.xml"); MockObjectDefinitionRegistry registry = new MockObjectDefinitionRegistry(); - IObjectDefinitionDocumentReader reader = new DefaultObjectDefinitionDocumentReader(); XmlReaderContext readerContext = new XmlReaderContext(null, new XmlObjectDefinitionReader(registry)); ObjectDefinitionParserHelper helper = new ObjectDefinitionParserHelper(readerContext); helper.InitDefaults(doc.DocumentElement); -#pragma warning disable 618 - ParserContext parserContext = new ParserContext(helper.ReaderContext, helper); -#pragma warning restore 618 + ParserContext parserContext = new ParserContext(helper); ValidationNamespaceParser parser = new ValidationNamespaceParser(); foreach (XmlElement element in doc.DocumentElement.ChildNodes)