From a3a9d8372f8847472001fd3f38494d2c83ce971b Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sat, 28 May 2016 12:48:14 -0500 Subject: [PATCH] (GH-198) Add ITask - rename existing messages --- src/chocolatey/chocolatey.csproj | 5 +-- .../{PostRunEvent.cs => PostRunMessage.cs} | 8 +++-- .../{PreRunEvent.cs => PreRunMessage.cs} | 8 +++-- src/chocolatey/infrastructure/tasks/ITask.cs | 33 +++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) rename src/chocolatey/infrastructure.app/events/{PostRunEvent.cs => PostRunMessage.cs} (79%) rename src/chocolatey/infrastructure.app/events/{PreRunEvent.cs => PreRunMessage.cs} (79%) create mode 100644 src/chocolatey/infrastructure/tasks/ITask.cs diff --git a/src/chocolatey/chocolatey.csproj b/src/chocolatey/chocolatey.csproj index 576d0fdc5f..d29685d021 100644 --- a/src/chocolatey/chocolatey.csproj +++ b/src/chocolatey/chocolatey.csproj @@ -130,7 +130,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -276,6 +276,7 @@ + diff --git a/src/chocolatey/infrastructure.app/events/PostRunEvent.cs b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs similarity index 79% rename from src/chocolatey/infrastructure.app/events/PostRunEvent.cs rename to src/chocolatey/infrastructure.app/events/PostRunMessage.cs index c3e8ba9471..510e5be493 100644 --- a/src/chocolatey/infrastructure.app/events/PostRunEvent.cs +++ b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs @@ -18,12 +18,16 @@ namespace chocolatey.infrastructure.app.events using infrastructure.commands; using infrastructure.events; - public class PostRunEvent : IMessage where TCommand : ICommand + public class PostRunMessage : IMessage + { + } + + public class PostRunMessage : IMessage where TCommand : ICommand { public TCommand Command { get; private set; } public object[] State { get; private set; } - public PostRunEvent(TCommand command, object[] state) + public PostRunMessage(TCommand command, object[] state) { Command = command; State = state; diff --git a/src/chocolatey/infrastructure.app/events/PreRunEvent.cs b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs similarity index 79% rename from src/chocolatey/infrastructure.app/events/PreRunEvent.cs rename to src/chocolatey/infrastructure.app/events/PreRunMessage.cs index 1b5571d69c..79cb28fa8f 100644 --- a/src/chocolatey/infrastructure.app/events/PreRunEvent.cs +++ b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs @@ -18,12 +18,16 @@ namespace chocolatey.infrastructure.app.events using infrastructure.commands; using infrastructure.events; - public class PreRunEvent : IMessage where TCommand : ICommand + public class PreRunMessage : IMessage + { + } + + public class PreRunMessage : IMessage where TCommand : ICommand { public TCommand Command { get; private set; } public object[] State { get; private set; } - public PreRunEvent(TCommand command, object[] state) + public PreRunMessage(TCommand command, object[] state) { Command = command; State = state; diff --git a/src/chocolatey/infrastructure/tasks/ITask.cs b/src/chocolatey/infrastructure/tasks/ITask.cs new file mode 100644 index 0000000000..96130c8627 --- /dev/null +++ b/src/chocolatey/infrastructure/tasks/ITask.cs @@ -0,0 +1,33 @@ +// Copyright © 2011 - Present RealDimensions Software, LLC +// +// 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. +namespace chocolatey.infrastructure.tasks +{ + /// + /// Interface for all runners. + /// + public interface ITask + { + /// + /// Initializes a task. This should be initialized to run on a schedule, a trigger, a subscription to event messages, + /// etc, or some combination of the above. + /// + void initialize(); + + /// + /// Shuts down a task that is in a waiting state. Turns off all schedules, triggers or subscriptions. + /// + void shutdown(); + } +} \ No newline at end of file