Removed IEvents interface

- Replaced by IEventHandler and IEventBus

--HG--
branch : dev
This commit is contained in:
Sébastien Ros
2010-09-03 17:52:53 -07:00
parent b03a29ad42
commit b5ed08edea
11 changed files with 19 additions and 16 deletions

View File

@@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Logging; using Orchard.Logging;
@@ -48,7 +46,7 @@ namespace Orchard.Tests {
public object[] LogArgs { get; set; } public object[] LogArgs { get; set; }
} }
private interface ITestEvents : IEvents { private interface ITestEvents : IDependency {
void Hello(string name); void Hello(string name);
} }

View File

@@ -1,7 +1,7 @@
using Orchard.Core.Feeds.Models; using Orchard.Core.Feeds.Models;
namespace Orchard.Core.Feeds { namespace Orchard.Core.Feeds {
public interface IFeedQueryProvider : IEvents { public interface IFeedQueryProvider : IDependency {
FeedQueryMatch Match(FeedContext context); FeedQueryMatch Match(FeedContext context);
} }

View File

@@ -2,6 +2,7 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.Handlers;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Utility.Extensions;
namespace Orchard.ContentManagement.Drivers.Coordinators { namespace Orchard.ContentManagement.Drivers.Coordinators {
[UsedImplicitly] [UsedImplicitly]

View File

@@ -3,7 +3,7 @@ using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentManagement.Drivers { namespace Orchard.ContentManagement.Drivers {
public interface IContentFieldDriver : IEvents { public interface IContentFieldDriver : IDependency {
DriverResult BuildDisplayModel(BuildDisplayModelContext context); DriverResult BuildDisplayModel(BuildDisplayModelContext context);
DriverResult BuildEditorModel(BuildEditorModelContext context); DriverResult BuildEditorModel(BuildEditorModelContext context);
DriverResult UpdateEditorModel(UpdateEditorModelContext context); DriverResult UpdateEditorModel(UpdateEditorModelContext context);

View File

@@ -2,7 +2,7 @@ using System.Collections.Generic;
using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.Handlers;
namespace Orchard.ContentManagement.Drivers { namespace Orchard.ContentManagement.Drivers {
public interface IContentItemDriver : IEvents { public interface IContentItemDriver : IDependency {
IEnumerable<ContentType> GetContentTypes(); IEnumerable<ContentType> GetContentTypes();
void GetContentItemMetadata(GetContentItemMetadataContext context); void GetContentItemMetadata(GetContentItemMetadataContext context);

View File

@@ -3,7 +3,7 @@ using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.MetaData;
namespace Orchard.ContentManagement.Drivers { namespace Orchard.ContentManagement.Drivers {
public interface IContentPartDriver : IEvents { public interface IContentPartDriver : IDependency {
DriverResult BuildDisplayModel(BuildDisplayModelContext context); DriverResult BuildDisplayModel(BuildDisplayModelContext context);
DriverResult BuildEditorModel(BuildEditorModelContext context); DriverResult BuildEditorModel(BuildEditorModelContext context);
DriverResult UpdateEditorModel(UpdateEditorModelContext context); DriverResult UpdateEditorModel(UpdateEditorModelContext context);

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Orchard.ContentManagement.Handlers { namespace Orchard.ContentManagement.Handlers {
public interface IContentHandler : IEvents { public interface IContentHandler : IDependency {
IEnumerable<ContentType> GetContentTypes(); IEnumerable<ContentType> GetContentTypes();
void Activating(ActivatingContentContext context); void Activating(ActivatingContentContext context);

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Orchard.Events { namespace Orchard.Events {
public interface IEventBusHandler : IEvents { public interface IEventBusHandler : IDependency {
void Process(string messageName, IDictionary<string, string> eventData); void Process(string messageName, IDictionary<string, string> eventData);
} }
} }

View File

@@ -1,5 +1,7 @@
namespace Orchard.Indexing { using Orchard.Events;
public interface IIndexNotifierHandler : IEvents {
namespace Orchard.Indexing {
public interface IIndexNotifierHandler : IEventHandler {
void UpdateIndex(string indexName); void UpdateIndex(string indexName);
} }
} }

View File

@@ -7,11 +7,13 @@ using Orchard.Logging;
using Orchard.Security; using Orchard.Security;
namespace Orchard { namespace Orchard {
public interface IEvents : IDependency {
}
public static class EventsExtensions { public static class InvokeExtensions {
public static void Invoke<TEvents>(this IEnumerable<TEvents> events, Action<TEvents> dispatch, ILogger logger) where TEvents : IEvents {
/// <summary>
/// Safely invoke methods by catching non fatal exceptions and logging them
/// </summary>
public static void Invoke<TEvents>(this IEnumerable<TEvents> events, Action<TEvents> dispatch, ILogger logger) {
foreach (var sink in events) { foreach (var sink in events) {
try { try {
dispatch(sink); dispatch(sink);

View File

@@ -649,7 +649,7 @@
<Compile Include="Environment\Extensions\Loaders\PrecompiledExtensionLoader.cs" /> <Compile Include="Environment\Extensions\Loaders\PrecompiledExtensionLoader.cs" />
<Compile Include="Environment\Extensions\Loaders\ReferencedExtensionLoader.cs" /> <Compile Include="Environment\Extensions\Loaders\ReferencedExtensionLoader.cs" />
<Compile Include="Environment\Extensions\Folders\ThemeFolders.cs" /> <Compile Include="Environment\Extensions\Folders\ThemeFolders.cs" />
<Compile Include="IEvents.cs" /> <Compile Include="InvokeExtensions.cs" />
<Compile Include="Localization\IText.cs" /> <Compile Include="Localization\IText.cs" />
<Compile Include="Localization\LocalizationModule.cs" /> <Compile Include="Localization\LocalizationModule.cs" />
<Compile Include="Localization\LocalizationUtilities.cs" /> <Compile Include="Localization\LocalizationUtilities.cs" />