cs-codex-dist-tests/Framework/Core/EntryPoint.cs

53 lines
1.5 KiB
C#
Raw Normal View History

2023-09-13 08:03:11 +00:00
using KubernetesWorkflow;
using Logging;
namespace Core
{
2023-09-13 08:03:11 +00:00
public class EntryPoint
{
private readonly IToolsFactory toolsFactory;
private readonly PluginManager manager = new PluginManager();
public EntryPoint(ILog log, Configuration configuration, string fileManagerRootFolder, ITimeSet timeSet)
{
toolsFactory = new ToolsFactory(log, configuration, fileManagerRootFolder, timeSet);
Tools = toolsFactory.CreateTools();
manager.InstantiatePlugins(PluginFinder.GetPluginTypes(), toolsFactory);
}
public EntryPoint(ILog log, Configuration configuration, string fileManagerRootFolder)
: this(log, configuration, fileManagerRootFolder, new DefaultTimeSet())
{
}
2023-09-13 08:03:11 +00:00
public IPluginTools Tools { get; }
2023-09-13 08:03:11 +00:00
public void Announce()
{
2023-09-13 08:03:11 +00:00
manager.AnnouncePlugins();
}
2023-09-13 14:06:05 +00:00
public Dictionary<string, string> GetPluginMetadata()
{
return manager.GatherPluginMetadata().Get();
}
public CoreInterface CreateInterface()
{
return new CoreInterface(this);
}
2023-09-21 08:33:09 +00:00
public void Decommission(bool deleteKubernetesResources, bool deleteTrackedFiles)
{
2023-09-21 08:33:09 +00:00
manager.DecommissionPlugins(deleteKubernetesResources, deleteTrackedFiles);
Tools.Decommission(deleteKubernetesResources, deleteTrackedFiles);
}
internal T GetPlugin<T>() where T : IProjectPlugin
{
return manager.GetPlugin<T>();
}
}
}