<commit_before>package com.github.K0zka.kerub.planner.execution

import com.github.K0zka.kerub.host.HostCommandExecutor
import com.github.K0zka.kerub.host.HostManager
import com.github.K0zka.kerub.planner.Plan
import com.github.K0zka.kerub.planner.PlanExecutor
import com.github.K0zka.kerub.planner.StepExecutor
import com.github.K0zka.kerub.planner.steps.AbstractOperationalStep
import com.github.K0zka.kerub.planner.steps.host.ksm.DisableKsm
import com.github.K0zka.kerub.planner.steps.host.ksm.DisableKsmExecutor
import com.github.K0zka.kerub.planner.steps.host.ksm.EnableKsm
import com.github.K0zka.kerub.planner.steps.host.ksm.EnableKsmExecutor
import com.github.K0zka.kerub.planner.steps.vm.migrate.MigrateVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.migrate.MigrateVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vm.start.StartVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.start.StartVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vm.stop.StopVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.stop.StopVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vstorage.create.CreateImage
import com.github.K0zka.kerub.planner.steps.vstorage.create.CreateImageExecutor
import com.github.K0zka.kerub.utils.getLogger

public class PlanExecutorImpl(
		private val hostCommandExecutor : HostCommandExecutor,
		private val hostManager : HostManager
) : PlanExecutor {

	companion object {
		val logger = getLogger(PlanExecutorImpl::class)
	}

	val stepExecutors = mapOf<kotlin.reflect.KClass<*>, StepExecutor<*>>(
			StartVirtualMachine::class to StartVirtualMachineExecutor(hostManager),
			StopVirtualMachine::class to StopVirtualMachineExecutor(hostManager),
			MigrateVirtualMachine::class to MigrateVirtualMachineExecutor(hostManager),
			EnableKsm::class to EnableKsmExecutor(hostCommandExecutor),
	        DisableKsm::class to DisableKsmExecutor(hostCommandExecutor),
	        CreateImage::class to CreateImageExecutor(hostCommandExecutor)
	                         )

	fun execute(step : AbstractOperationalStep) {
		val executor = stepExecutors.get(step.javaClass.kotlin)
		if(executor == null) {
			throw IllegalArgumentException("No executor for step ${step}")
		} else {
			(executor as StepExecutor<AbstractOperationalStep>).execute(step)
		}<commit_msg>Added wake executor to the list<commit_after>package com.github.K0zka.kerub.planner.execution

import com.github.K0zka.kerub.host.HostCommandExecutor
import com.github.K0zka.kerub.host.HostManager
import com.github.K0zka.kerub.planner.Plan
import com.github.K0zka.kerub.planner.PlanExecutor
import com.github.K0zka.kerub.planner.StepExecutor
import com.github.K0zka.kerub.planner.steps.AbstractOperationalStep
import com.github.K0zka.kerub.planner.steps.host.ksm.DisableKsm
import com.github.K0zka.kerub.planner.steps.host.ksm.DisableKsmExecutor
import com.github.K0zka.kerub.planner.steps.host.ksm.EnableKsm
import com.github.K0zka.kerub.planner.steps.host.ksm.EnableKsmExecutor
import com.github.K0zka.kerub.planner.steps.host.startup.WakeHost
import com.github.K0zka.kerub.planner.steps.host.startup.WakeHostExecutor
import com.github.K0zka.kerub.planner.steps.vm.migrate.MigrateVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.migrate.MigrateVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vm.start.StartVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.start.StartVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vm.stop.StopVirtualMachine
import com.github.K0zka.kerub.planner.steps.vm.stop.StopVirtualMachineExecutor
import com.github.K0zka.kerub.planner.steps.vstorage.create.CreateImage
import com.github.K0zka.kerub.planner.steps.vstorage.create.CreateImageExecutor
import com.github.K0zka.kerub.utils.getLogger

public class PlanExecutorImpl(
		private val hostCommandExecutor : HostCommandExecutor,
		private val hostManager : HostManager
) : PlanExecutor {

	companion object {
		val logger = getLogger(PlanExecutorImpl::class)
	}

	val stepExecutors = mapOf<kotlin.reflect.KClass<*>, StepExecutor<*>>(
			StartVirtualMachine::class to StartVirtualMachineExecutor(hostManager),
			StopVirtualMachine::class to StopVirtualMachineExecutor(hostManager),
			MigrateVirtualMachine::class to MigrateVirtualMachineExecutor(hostManager),
			EnableKsm::class to EnableKsmExecutor(hostCommandExecutor),
	        DisableKsm::class to DisableKsmExecutor(hostCommandExecutor),
	        CreateImage::class to CreateImageExecutor(hostCommandExecutor),
			WakeHost::class to WakeHostExecutor(hostManager)
	                         )

	fun execute(step : AbstractOperationalStep) {
		val executor = stepExecutors.get(step.javaClass.kotlin)
		if(executor == null) {
			throw IllegalArgumentException("No executor for step ${step}")
		} else {
			(executor as StepExecutor<AbstractOperationalStep>).execute(step)
		}
{'fraction_non_alphanumeric': 0.09710115548347861, 'fraction_numerical': 0.008514088789783093, 'mean_word_length': 5.891061452513966, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6990073', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1599, 'n_words': 206}