diff --git a/src/Spring/Spring.Core/Util/SystemUtils.cs b/src/Spring/Spring.Core/Util/SystemUtils.cs index 0f4d9fdb..4c0615b7 100644 --- a/src/Spring/Spring.Core/Util/SystemUtils.cs +++ b/src/Spring/Spring.Core/Util/SystemUtils.cs @@ -64,7 +64,7 @@ namespace Spring.Util { lock (assemblyResolverLock) { - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LoadedAssemblyResolver); + AppDomain.CurrentDomain.AssemblyResolve += LoadedAssemblyResolver; assemblyResolverRegistered = true; } } diff --git a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support/OpenSessionInViewModule.cs b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support/OpenSessionInViewModule.cs index c210df9e..2c52c15f 100644 --- a/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support/OpenSessionInViewModule.cs +++ b/src/Spring/Spring.Data.NHibernate/Data/NHibernate/Support/OpenSessionInViewModule.cs @@ -57,8 +57,8 @@ namespace Spring.Data.NHibernate.Support /// The standard HTTP application context public void Init( HttpApplication context ) { - context.BeginRequest += new EventHandler(context_BeginRequest); - context.EndRequest += new EventHandler(context_EndRequest); + context.BeginRequest += context_BeginRequest; + context.EndRequest += context_EndRequest; } /// /// A do nothing dispose method. diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs index 1d1cc4eb..e98ebc50 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs @@ -352,11 +352,11 @@ namespace Spring.Messaging.Nms.Connections if (reconnectOnException) { //add reconnect exception handler first to exception chain. - con.ExceptionListener += new ExceptionListener(this.OnException); + con.ExceptionListener += this.OnException; } if (ExceptionListener != null) { - con.ExceptionListener += new ExceptionListener(ExceptionListener.OnException); + con.ExceptionListener += ExceptionListener.OnException; } } diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs index 1e3a2694..18ed3b2b 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs @@ -180,7 +180,7 @@ namespace Spring.Messaging.Nms.Listener protected override void PrepareSharedConnection(IConnection connection) { base.PrepareSharedConnection(connection); - connection.ExceptionListener += new ExceptionListener(OnException); + connection.ExceptionListener += OnException; } @@ -313,7 +313,7 @@ namespace Spring.Messaging.Nms.Listener SimpleMessageListener listener = new SimpleMessageListener(this, session); // put in explicit registration with 'new' for compilation on .NET 1.1 - consumer.Listener += new Apache.NMS.MessageListener(listener.OnMessage); + consumer.Listener += listener.OnMessage; return consumer; } diff --git a/src/Spring/Spring.Scheduling.Quartz2/Scheduling/Quartz/SchedulerFactoryObject.cs b/src/Spring/Spring.Scheduling.Quartz2/Scheduling/Quartz/SchedulerFactoryObject.cs index 9af3f2de..b68e8ebc 100644 --- a/src/Spring/Spring.Scheduling.Quartz2/Scheduling/Quartz/SchedulerFactoryObject.cs +++ b/src/Spring/Spring.Scheduling.Quartz2/Scheduling/Quartz/SchedulerFactoryObject.cs @@ -75,14 +75,14 @@ namespace Spring.Scheduling.Quartz /// /// /// - public class SchedulerFactoryObject : SchedulerAccessor, IFactoryObject, IObjectNameAware, + public class SchedulerFactoryObject : SchedulerAccessor, IFactoryObject, IObjectNameAware, IApplicationContextAware, IApplicationEventListener, IInitializingObject, IDisposable { /// /// Default thread count to be set to thread pool. /// public const int DEFAULT_THREAD_COUNT = 10; - + /// /// Property name for thread count in thread pool. /// @@ -131,7 +131,7 @@ namespace Spring.Scheduling.Quartz private IJobFactory jobFactory; private bool jobFactorySet; private IDictionary quartzProperties; - private IScheduler scheduler; + private IScheduler scheduler; private IDictionary schedulerContextMap; private Type schedulerFactoryType; private string schedulerName; @@ -149,7 +149,6 @@ namespace Spring.Scheduling.Quartz schedulerFactoryType = typeof (StdSchedulerFactory); } - /// /// Set the Quartz SchedulerFactory implementation to use. /// @@ -286,8 +285,8 @@ namespace Spring.Scheduling.Quartz ///

/// Default is Spring's , which supports /// standard Quartz instances. Note that this default only applies - /// to a local Scheduler, not to a RemoteScheduler (where setting - /// a custom JobFactory is not supported by Quartz). + /// to a local Scheduler, not to a RemoteScheduler (where setting + /// a custom JobFactory is not supported by Quartz). ///

///

/// Specify an instance of Spring's here @@ -299,8 +298,8 @@ namespace Spring.Scheduling.Quartz /// public virtual IJobFactory JobFactory { - set - { + set + { jobFactory = value; jobFactorySet = true; } @@ -570,18 +569,17 @@ namespace Spring.Scheduling.Quartz ISchedulerFactory schedulerFactory = ObjectUtils.InstantiateType(schedulerFactoryType); InitSchedulerFactory(schedulerFactory); - - if (taskExecutor != null) - { - // Make given TaskExecutor available for SchedulerFactory configuration. - configTimeTaskExecutor = taskExecutor; - } - if (dbProvider != null) - { - // Make given db provider available for SchedulerFactory configuration. - configTimeDbProvider = dbProvider; - } + if (taskExecutor != null) + { + // Make given TaskExecutor available for SchedulerFactory configuration. + configTimeTaskExecutor = taskExecutor; + } + if (dbProvider != null) + { + // Make given db provider available for SchedulerFactory configuration. + configTimeDbProvider = dbProvider; + } try { @@ -589,12 +587,12 @@ namespace Spring.Scheduling.Quartz scheduler = CreateScheduler(schedulerFactory, schedulerName); PopulateSchedulerContext(); - if (!jobFactorySet && !(scheduler is RemoteScheduler)) + if (!jobFactorySet && !(scheduler is RemoteScheduler)) { - // Use AdaptableJobFactory as default for a local Scheduler, unless when - // explicitly given a null value through the "jobFactory" object property. - jobFactory = new AdaptableJobFactory(); - } + // Use AdaptableJobFactory as default for a local Scheduler, unless when + // explicitly given a null value through the "jobFactory" object property. + jobFactory = new AdaptableJobFactory(); + } if (jobFactory != null) { @@ -607,14 +605,14 @@ namespace Spring.Scheduling.Quartz } finally { - if (taskExecutor != null) + if (taskExecutor != null) { - configTimeTaskExecutor = null; - } - if (dbProvider != null) + configTimeTaskExecutor = null; + } + if (dbProvider != null) { - configTimeDbProvider = null; - } + configTimeDbProvider = null; + } } RegisterListeners(); @@ -634,7 +632,6 @@ namespace Spring.Scheduling.Quartz if (configLocation != null || quartzProperties != null || schedulerName != null || taskExecutor != null || dbProvider != null) { - throw new ArgumentException("StdSchedulerFactory required for applying Quartz properties: " + schedulerFactory); } // Otherwise assume that no initialization is necessary... @@ -651,7 +648,7 @@ namespace Spring.Scheduling.Quartz } else { - mergedProps.Set(StdSchedulerFactory.PropertyThreadPoolType, typeof(SimpleThreadPool).AssemblyQualifiedName); + mergedProps.Set(StdSchedulerFactory.PropertyThreadPoolType, typeof (SimpleThreadPool).AssemblyQualifiedName); mergedProps[PROP_THREAD_COUNT] = Convert.ToString(DEFAULT_THREAD_COUNT); } @@ -666,32 +663,30 @@ namespace Spring.Scheduling.Quartz string line; while ((line = sr.ReadLine()) != null) { - string[] lineItems = line.Split(new char[] { '=' }, 2); + string[] lineItems = line.Split(new char[] {'='}, 2); if (lineItems.Length == 2) { mergedProps[lineItems[0].Trim()] = lineItems[1].Trim(); } - } + } } - } if (quartzProperties != null) { // if given quartz properties, merge to them to configuration - MergePropertiesIntoMap(quartzProperties, mergedProps); + MergePropertiesIntoMap(quartzProperties, mergedProps); } - if (dbProvider != null) + if (dbProvider != null) { - mergedProps.Add(StdSchedulerFactory.PropertyJobStoreType, typeof(LocalDataSourceJobStore).AssemblyQualifiedName); - } - + mergedProps[StdSchedulerFactory.PropertyJobStoreType] = typeof (LocalDataSourceJobStore).AssemblyQualifiedName; + } // Make sure to set the scheduler name as configured in the Spring configuration. if (schedulerName != null) { - mergedProps.Add(StdSchedulerFactory.PropertySchedulerInstanceName, schedulerName); + mergedProps[StdSchedulerFactory.PropertySchedulerInstanceName] = schedulerName; } ((StdSchedulerFactory) schedulerFactory).Initialize(mergedProps); @@ -711,7 +706,6 @@ namespace Spring.Scheduling.Quartz } } - ///

/// Create the Scheduler instance for the given factory and scheduler name. /// Called by afterPropertiesSet. @@ -727,24 +721,26 @@ namespace Spring.Scheduling.Quartz /// protected virtual IScheduler CreateScheduler(ISchedulerFactory schedulerFactory, string schedName) { - SchedulerRepository repository = SchedulerRepository.Instance; - lock (repository) + SchedulerRepository repository = SchedulerRepository.Instance; + lock (repository) { - IScheduler existingScheduler = (schedulerName != null ? repository.Lookup(schedulerName) : null); - IScheduler newScheduler = schedulerFactory.GetScheduler(); - if (newScheduler == existingScheduler) { - throw new InvalidOperationException( + IScheduler existingScheduler = (schedulerName != null ? repository.Lookup(schedulerName) : null); + IScheduler newScheduler = schedulerFactory.GetScheduler(); + if (newScheduler == existingScheduler) + { + throw new InvalidOperationException( string.Format( - "Active Scheduler of name '{0}' already registered in Quartz SchedulerRepository. Cannot create a new Spring-managed Scheduler of the same name!", - schedulerName)); - } - if (!exposeSchedulerInRepository) { - // Need to explicitly remove it if not intended for exposure, - // since Quartz shares the Scheduler instance by default! - SchedulerRepository.Instance.Remove(newScheduler.SchedulerName); - } - return newScheduler; - } + "Active Scheduler of name '{0}' already registered in Quartz SchedulerRepository. Cannot create a new Spring-managed Scheduler of the same name!", + schedulerName)); + } + if (!exposeSchedulerInRepository) + { + // Need to explicitly remove it if not intended for exposure, + // since Quartz shares the Scheduler instance by default! + SchedulerRepository.Instance.Remove(newScheduler.SchedulerName); + } + return newScheduler; + } } /// @@ -772,7 +768,6 @@ namespace Spring.Scheduling.Quartz } } - /// /// Start the Quartz Scheduler, respecting the "startDelay" setting. /// @@ -796,7 +791,6 @@ namespace Spring.Scheduling.Quartz } } - //--------------------------------------------------------------------- // Implementation of Lifecycle interface //--------------------------------------------------------------------- @@ -856,4 +850,4 @@ namespace Spring.Scheduling.Quartz } } } -} +} \ No newline at end of file diff --git a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentFactory.cs b/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentFactory.cs index 605b404a..1e6a673c 100644 --- a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentFactory.cs +++ b/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentFactory.cs @@ -150,7 +150,7 @@ namespace Spring.EnterpriseServices { ValidateConfiguration(); componentType = Type.GetTypeFromProgID(Name, Server); - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } #endregion diff --git a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentHelper.cs b/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentHelper.cs index 30223d70..7efef081 100644 --- a/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentHelper.cs +++ b/src/Spring/Spring.Services/EnterpriseServices/ServicedComponentHelper.cs @@ -83,7 +83,7 @@ namespace Spring.EnterpriseServices { // this is to ensure, that assemblies placed next to the component assembly can be loaded // even when they are not strong named. - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; FileInfo componentAssemblyFile = new FileInfo(componentType.Assembly.Location); FileInfo assemblyFile = new FileInfo(componentAssemblyFile.FullName); diff --git a/src/Spring/Spring.Web.Conversation.NHibernate3/Web/Conversation/HttpModule/ConversationModule.cs b/src/Spring/Spring.Web.Conversation.NHibernate3/Web/Conversation/HttpModule/ConversationModule.cs index ed3dbded..2efd42a6 100644 --- a/src/Spring/Spring.Web.Conversation.NHibernate3/Web/Conversation/HttpModule/ConversationModule.cs +++ b/src/Spring/Spring.Web.Conversation.NHibernate3/Web/Conversation/HttpModule/ConversationModule.cs @@ -73,7 +73,7 @@ namespace Spring.Web.Conversation.HttpModule if (HttpContext.Current.Handler is Page) { Page page = (Page)HttpContext.Current.Handler; - page.Unload += new EventHandler(page_Unload); + page.Unload += page_Unload; if (HttpContext.Current.Session != null) { diff --git a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs index b95e059a..1b10f7b3 100644 --- a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs +++ b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs @@ -156,7 +156,7 @@ namespace Spring.Context.Support ILog s_weblog = LogManager.GetLogger(typeof(WebApplicationContext)); // register for ContextRegistry.Cleared event - we need to discard our cache in this case - ContextRegistry.Cleared += new EventHandler(OnContextRegistryCleared); + ContextRegistry.Cleared += OnContextRegistryCleared; #if !MONO_2_0 if (HttpRuntime.AppDomainAppVirtualPath != null) // check if we're within an ASP.NET AppDomain! diff --git a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs index b4db600f..488de064 100644 --- a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs +++ b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs @@ -145,8 +145,8 @@ namespace Spring.Context.Support VirtualEnvironment.SetInitialized(); } - app.PreRequestHandlerExecute += new EventHandler(OnConfigureHandler); - app.EndRequest += new EventHandler(VirtualEnvironment.RaiseEndRequest); + app.PreRequestHandlerExecute += OnConfigureHandler; + app.EndRequest += VirtualEnvironment.RaiseEndRequest; // TODO: this is only a workaround to get us up & running in IIS7/integrated mode // We must review all code for relative virtual paths - they must be resolved to application-relative paths diff --git a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs index 211d61ed..4520fa2f 100644 --- a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs +++ b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs @@ -87,8 +87,8 @@ namespace Spring.Objects.Factory.Support if (s_eventHandlersRegistered) return; if (log.IsDebugEnabled) log.Debug("hooking up event handlers"); - VirtualEnvironment.EndRequest += new VirtualEnvironment.RequestEventHandler(OnEndRequest); - VirtualEnvironment.EndSession += new VirtualEnvironment.SessionEventHandler(OnEndSession); + VirtualEnvironment.EndRequest += OnEndRequest; + VirtualEnvironment.EndSession += OnEndSession; s_eventHandlersRegistered = true; } diff --git a/src/Spring/Spring.Web/Web/UI/Controls/TabularMultiView.cs b/src/Spring/Spring.Web/Web/UI/Controls/TabularMultiView.cs index d5615cb7..8f194868 100644 --- a/src/Spring/Spring.Web/Web/UI/Controls/TabularMultiView.cs +++ b/src/Spring/Spring.Web/Web/UI/Controls/TabularMultiView.cs @@ -220,11 +220,11 @@ namespace Spring.Web.UI.Controls { // create menu tabstrip _tabContainer = CreateTabContainer(); - _tabContainer.Click += new TabCommandEventHandler(OnSelectTabCommand); + _tabContainer.Click += OnSelectTabCommand; // create multiview container _multiView = new MultiView(); - _multiView.ActiveViewChanged += new EventHandler(OnActiveViewChanged); + _multiView.ActiveViewChanged += OnActiveViewChanged; // add views previously parsed for (int i = 0; i < _parsedViews.Count; i++) _multiView.Controls.Add((Control) _parsedViews[i]); diff --git a/test/Spring/Spring.Web.Conversation.NHibernate3.Tests/Conversation/SerializeConversationTestModule.cs b/test/Spring/Spring.Web.Conversation.NHibernate3.Tests/Conversation/SerializeConversationTestModule.cs index 41f562db..1008ecad 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate3.Tests/Conversation/SerializeConversationTestModule.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate3.Tests/Conversation/SerializeConversationTestModule.cs @@ -61,8 +61,8 @@ namespace Spring.Web.Conversation /// public void Init(HttpApplication context) { - context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute); - context.PostRequestHandlerExecute += new EventHandler(context_PostRequestHandlerExecute); + context.PreRequestHandlerExecute += context_PreRequestHandlerExecute; + context.PostRequestHandlerExecute += context_PostRequestHandlerExecute; } ///