Commit 15f68f8

unknown <mo@.(none)>
2009-09-05 01:20:27
trimmed some more fat.
1 parent d266226
product/Gorilla.Commons.Infrastructure/CommandFactory.cs
@@ -1,25 +0,0 @@
-using Gorilla.Commons.Infrastructure.Threading;
-using Gorilla.Commons.Utility.Core;
-
-namespace Gorilla.Commons.Infrastructure
-{
-    public interface ICommandFactory
-    {
-        ICommand create_for<T>(ICallback<T> item, IQuery<T> query);
-    }
-
-    public class CommandFactory : ICommandFactory
-    {
-        readonly ISynchronizationContextFactory factory;
-
-        public CommandFactory(ISynchronizationContextFactory factory)
-        {
-            this.factory = factory;
-        }
-
-        public ICommand create_for<T>(ICallback<T> item, IQuery<T> query)
-        {
-            return new RunQueryCommand<T>(item, new ProcessQueryCommand<T>(query, factory));
-        }
-    }
-}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure/CommandPump.cs
@@ -1,56 +0,0 @@
-using Gorilla.Commons.Infrastructure.Container;
-using Gorilla.Commons.Infrastructure.Threading;
-using Gorilla.Commons.Utility.Core;
-
-namespace Gorilla.Commons.Infrastructure
-{
-    public interface ICommandPump
-    {
-        ICommandPump run<Command>() where Command : ICommand;
-        ICommandPump run<Command>(Command command) where Command : ICommand;
-        ICommandPump run<Command, T>(T input) where Command : IParameterizedCommand<T>;
-        ICommandPump run<T>(ICallback<T> item, IQuery<T> query);
-        ICommandPump run<Output, Query>(ICallback<Output> item) where Query : IQuery<Output>;
-    }
-
-    public class CommandPump : ICommandPump
-    {
-        readonly ICommandProcessor processor;
-        readonly IDependencyRegistry registry;
-        readonly ICommandFactory factory;
-
-        public CommandPump(ICommandProcessor processor, IDependencyRegistry registry, ICommandFactory factory)
-        {
-            this.processor = processor;
-            this.factory = factory;
-            this.registry = registry;
-        }
-
-        public ICommandPump run<Command>() where Command : ICommand
-        {
-            return run(registry.get_a<Command>());
-        }
-
-        public ICommandPump run<Command>(Command command) where Command : ICommand
-        {
-            processor.add(command);
-            return this;
-        }
-
-        public ICommandPump run<Command, T>(T input) where Command : IParameterizedCommand<T>
-        {
-            processor.add(() => registry.get_a<Command>().run(input));
-            return this;
-        }
-
-        public ICommandPump run<T>(ICallback<T> item, IQuery<T> query)
-        {
-            return run(factory.create_for(item, query));
-        }
-
-        public ICommandPump run<Output, Query>(ICallback<Output> item) where Query : IQuery<Output>
-        {
-            return run(item, registry.get_a<Query>());
-        }
-    }
-}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure/Gorilla.Commons.Infrastructure.csproj
@@ -66,8 +66,6 @@
     <Compile Include="Cloning\ISerializer.cs" />
     <Compile Include="Cloning\Prototype.cs" />
     <Compile Include="Cloning\Serializer.cs" />
-    <Compile Include="CommandFactory.cs" />
-    <Compile Include="CommandPump.cs" />
     <Compile Include="Container\DependencyResolutionException.cs" />
     <Compile Include="Container\IDependencyRegistry.cs" />
     <Compile Include="Container\Resolve.cs" />
@@ -79,7 +77,6 @@
     <Compile Include="Eventing\IEventSubscriber.cs" />
     <Compile Include="FileSystem\ApplicationFile.cs" />
     <Compile Include="FileSystem\IFile.cs" />
-    <Compile Include="ICallbackCommand.cs" />
     <Compile Include="Logging\TextLogger.cs" />
     <Compile Include="Logging\ILogFactory.cs" />
     <Compile Include="Logging\ILoggable.cs" />
@@ -87,7 +84,6 @@
     <Compile Include="Logging\Log.cs" />
     <Compile Include="Logging\LoggingExtensions.cs" />
     <Compile Include="Logging\LogSpecs.cs" />
-    <Compile Include="ProcessQueryCommand.cs" />
     <Compile Include="Proxies\ExceptionExtensions.cs" />
     <Compile Include="Proxies\IInterceptor.cs" />
     <Compile Include="Proxies\IInvocation.cs" />
@@ -100,7 +96,6 @@
     <Compile Include="Reflection\IAssembly.cs" />
     <Compile Include="Registries\DefaultRegistry.cs" />
     <Compile Include="Registries\DefaultRegistrySpecs.cs" />
-    <Compile Include="RunQueryCommand.cs" />
     <Compile Include="Threading\AsynchronousCommandProcessor.cs" />
     <Compile Include="Threading\BackgroundThread.cs" />
     <Compile Include="Threading\BackgroundThreadFactory.cs" />
product/Gorilla.Commons.Infrastructure/ProcessQueryCommand.cs
@@ -1,28 +0,0 @@
-using System;
-using Gorilla.Commons.Infrastructure.Threading;
-using Gorilla.Commons.Utility.Core;
-
-namespace Gorilla.Commons.Infrastructure
-{
-    public interface IProcessQueryCommand<T> : IParameterizedCommand<ICallback<T>>
-    {
-    }
-
-    public class ProcessQueryCommand<T> : IProcessQueryCommand<T>
-    {
-        readonly IQuery<T> query;
-        readonly ISynchronizationContextFactory factory;
-
-        public ProcessQueryCommand(IQuery<T> query, ISynchronizationContextFactory factory)
-        {
-            this.query = query;
-            this.factory = factory;
-        }
-
-        public void run(ICallback<T> callback)
-        {
-            var dto = query.fetch();
-            factory.create().run(new ActionCommand((Action) (() => callback.run(dto))));
-        }
-    }
-}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure/RunQueryCommand.cs
@@ -1,25 +0,0 @@
-using Gorilla.Commons.Utility.Core;
-
-namespace Gorilla.Commons.Infrastructure
-{
-    public interface IRunQueryCommand<T> : ICommand
-    {
-    }
-
-    public class RunQueryCommand<T> : IRunQueryCommand<T>
-    {
-        readonly ICallback<T> callback;
-        readonly IProcessQueryCommand<T> command;
-
-        public RunQueryCommand(ICallback<T> callback, IProcessQueryCommand<T> command)
-        {
-            this.callback = callback;
-            this.command = command;
-        }
-
-        public void run()
-        {
-            command.run(callback);
-        }
-    }
-}
\ No newline at end of file
product/Gorilla.Commons.Infrastructure/ICallbackCommand.cs → product/Gorilla.Commons.Utility/Core/ICallbackCommand.cs
@@ -1,6 +1,4 @@
-using Gorilla.Commons.Utility.Core;
-
-namespace Gorilla.Commons.Infrastructure
+namespace Gorilla.Commons.Utility.Core
 {
     public interface ICallbackCommand<T> : IParameterizedCommand<ICallback<T>>
     {
product/Gorilla.Commons.Utility/Core/INotification.cs
@@ -0,0 +1,7 @@
+namespace Gorilla.Commons.Utility.Core
+{
+    public interface INotification
+    {
+        void notify(params NotificationMessage[] messages);
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Utility/Core/NotificationMessage.cs
@@ -0,0 +1,42 @@
+namespace Gorilla.Commons.Utility.Core
+{
+    public class NotificationMessage
+    {
+        public string message { get; set; }
+
+        static public implicit operator string(NotificationMessage message)
+        {
+            return message.ToString();
+        }
+
+        static public implicit operator NotificationMessage(string message)
+        {
+            return new NotificationMessage {message = message};
+        }
+
+        public override string ToString()
+        {
+            return message;
+        }
+
+        public bool Equals(NotificationMessage obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            return Equals(obj.message, message);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != typeof (NotificationMessage)) return false;
+            return Equals((NotificationMessage) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return (message != null ? message.GetHashCode() : 0);
+        }
+    }
+}
\ No newline at end of file
product/Gorilla.Commons.Utility/Gorilla.Commons.Utility.csproj
@@ -73,6 +73,7 @@
     <Compile Include="Core\FuncSpecification.cs" />
     <Compile Include="Core\IBuilder.cs" />
     <Compile Include="Core\ICallback.cs" />
+    <Compile Include="Core\ICallbackCommand.cs" />
     <Compile Include="Core\ICommand.cs" />
     <Compile Include="Core\IConfiguration.cs" />
     <Compile Include="Core\Id.cs" />
@@ -81,6 +82,7 @@
     <Compile Include="Core\IIdentifiable.cs" />
     <Compile Include="Core\IImport.cs" />
     <Compile Include="Core\IMapper.cs" />
+    <Compile Include="Core\INotification.cs" />
     <Compile Include="Core\IParameterizedCommand.cs" />
     <Compile Include="Core\IParser.cs" />
     <Compile Include="Core\IQuery.cs" />
@@ -92,6 +94,7 @@
     <Compile Include="Core\IVisitable.cs" />
     <Compile Include="Core\IVisitor.cs" />
     <Compile Include="Core\Mapper.cs" />
+    <Compile Include="Core\NotificationMessage.cs" />
     <Compile Include="Core\NotSpecification.cs" />
     <Compile Include="Core\NotSpecificationSpecs.cs" />
     <Compile Include="Core\OrSpecification.cs" />