Skip to content

Commit

Permalink
(GH-198) Add ITask - rename existing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed May 28, 2016
1 parent f0d0342 commit a3a9d83
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/chocolatey/chocolatey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<Compile Include="infrastructure.app\domain\PackageFiles.cs" />
<Compile Include="infrastructure.app\domain\PinCommandType.cs" />
<Compile Include="infrastructure.app\domain\SourceCommandType.cs" />
<Compile Include="infrastructure.app\events\PostRunEvent.cs" />
<Compile Include="infrastructure.app\events\PostRunMessage.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyNugetCredentialProvider.cs" />
<Compile Include="infrastructure.app\nuget\NugetPush.cs" />
<Compile Include="infrastructure.app\runners\GenericRunner.cs" />
Expand Down Expand Up @@ -169,7 +169,7 @@
<Compile Include="infrastructure.app\domain\RegistryApplicationKey.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyLocalPackageRepository.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyNugetLogger.cs" />
<Compile Include="infrastructure.app\events\PreRunEvent.cs" />
<Compile Include="infrastructure.app\events\PreRunMessage.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyPackagePathResolver.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyPhysicalFileSystem.cs" />
<Compile Include="infrastructure.app\nuget\DictionaryPropertyProvider.cs" />
Expand Down Expand Up @@ -276,6 +276,7 @@
<Compile Include="infrastructure\services\RegularExpressionService.cs" />
<Compile Include="infrastructure\services\SystemDateTimeService.cs" />
<Compile Include="infrastructure\services\SystemDateTimeUtcService.cs" />
<Compile Include="infrastructure\tasks\ITask.cs" />
<Compile Include="infrastructure\tokens\TokenReplacer.cs" />
<Compile Include="ILogExtensions.cs" />
<Compile Include="infrastructure\tolerance\FaultTolerance.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ namespace chocolatey.infrastructure.app.events
using infrastructure.commands;
using infrastructure.events;

public class PreRunEvent<TCommand> : IMessage where TCommand : ICommand
public class PostRunMessage : IMessage
{
}

public class PostRunMessage<TCommand> : IMessage where TCommand : ICommand
{
public TCommand Command { get; private set; }
public object[] State { get; private set; }

public PreRunEvent(TCommand command, object[] state)
public PostRunMessage(TCommand command, object[] state)
{
Command = command;
State = state;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ namespace chocolatey.infrastructure.app.events
using infrastructure.commands;
using infrastructure.events;

public class PostRunEvent<TCommand> : IMessage where TCommand : ICommand
public class PreRunMessage : IMessage
{
}

public class PreRunMessage<TCommand> : IMessage where TCommand : ICommand
{
public TCommand Command { get; private set; }
public object[] State { get; private set; }

public PostRunEvent(TCommand command, object[] state)
public PreRunMessage(TCommand command, object[] state)
{
Command = command;
State = state;
}
}
}
}
33 changes: 33 additions & 0 deletions src/chocolatey/infrastructure/tasks/ITask.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Interface for all runners.
/// </summary>
public interface ITask
{
/// <summary>
/// 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.
/// </summary>
void initialize();

/// <summary>
/// Shuts down a task that is in a waiting state. Turns off all schedules, triggers or subscriptions.
/// </summary>
void shutdown();
}
}

0 comments on commit a3a9d83

Please sign in to comment.