Rename event.

This commit is contained in:
Michael Lipp 2023-08-08 13:22:27 +02:00
parent 0c4cb7e9b4
commit 010b6fdce6
6 changed files with 17 additions and 17 deletions

View file

@ -25,8 +25,8 @@ import java.util.concurrent.ConcurrentHashMap;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpChangeMedium; import org.jdrupes.vmoperator.runner.qemu.commands.QmpChangeMedium;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpOpenTray; import org.jdrupes.vmoperator.runner.qemu.commands.QmpOpenTray;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpRemoveMedium; import org.jdrupes.vmoperator.runner.qemu.commands.QmpRemoveMedium;
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand; import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State; import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State;
import org.jdrupes.vmoperator.runner.qemu.events.TrayMovedEvent; import org.jdrupes.vmoperator.runner.qemu.events.TrayMovedEvent;
import org.jgrapes.core.Channel; import org.jgrapes.core.Channel;
@ -68,7 +68,7 @@ public class CdMediaController extends Component {
@Handler @Handler
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition", @SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
"PMD.AvoidInstantiatingObjectsInLoops" }) "PMD.AvoidInstantiatingObjectsInLoops" })
public void onConfigureQemu(ConfigureQemu event) { public void onConfigureQemu(RunnerConfigurationUpdate event) {
if (event.state() == State.TERMINATING) { if (event.state() == State.TERMINATING) {
return; return;
} }

View file

@ -27,11 +27,11 @@ import java.util.Set;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpAddCpu; import org.jdrupes.vmoperator.runner.qemu.commands.QmpAddCpu;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu; import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus; import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus;
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
import org.jdrupes.vmoperator.runner.qemu.events.CpuAdded; import org.jdrupes.vmoperator.runner.qemu.events.CpuAdded;
import org.jdrupes.vmoperator.runner.qemu.events.CpuDeleted; import org.jdrupes.vmoperator.runner.qemu.events.CpuDeleted;
import org.jdrupes.vmoperator.runner.qemu.events.HotpluggableCpuStatus; import org.jdrupes.vmoperator.runner.qemu.events.HotpluggableCpuStatus;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand; import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State; import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State;
import org.jgrapes.core.Channel; import org.jgrapes.core.Channel;
import org.jgrapes.core.Component; import org.jgrapes.core.Component;
@ -45,7 +45,7 @@ public class CpuController extends Component {
private Integer currentCpus; private Integer currentCpus;
private Integer desiredCpus; private Integer desiredCpus;
private ConfigureQemu suspendedConfigure; private RunnerConfigurationUpdate suspendedConfigure;
/** /**
* Instantiates a new CPU controller. * Instantiates a new CPU controller.
@ -62,7 +62,7 @@ public class CpuController extends Component {
* @param event the event * @param event the event
*/ */
@Handler @Handler
public void onConfigureQemu(ConfigureQemu event) { public void onConfigureQemu(RunnerConfigurationUpdate event) {
if (event.state() == State.TERMINATING) { if (event.state() == State.TERMINATING) {
return; return;
} }

View file

@ -35,12 +35,12 @@ import java.util.logging.Level;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCapabilities; import org.jdrupes.vmoperator.runner.qemu.commands.QmpCapabilities;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand; import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpPowerdown; import org.jdrupes.vmoperator.runner.qemu.commands.QmpPowerdown;
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand; import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorEvent; import org.jdrupes.vmoperator.runner.qemu.events.MonitorEvent;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorReady; import org.jdrupes.vmoperator.runner.qemu.events.MonitorReady;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorResult; import org.jdrupes.vmoperator.runner.qemu.events.MonitorResult;
import org.jdrupes.vmoperator.runner.qemu.events.PowerdownEvent; import org.jdrupes.vmoperator.runner.qemu.events.PowerdownEvent;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
import org.jgrapes.core.Channel; import org.jgrapes.core.Channel;
import org.jgrapes.core.Component; import org.jgrapes.core.Component;
import org.jgrapes.core.Components; import org.jgrapes.core.Components;
@ -343,7 +343,7 @@ public class QemuMonitor extends Component {
* @param event the event * @param event the event
*/ */
@Handler @Handler
public void onConfigureQemu(ConfigureQemu event) { public void onConfigureQemu(RunnerConfigurationUpdate event) {
int newTimeout = event.configuration().vm.powerdownTimeout; int newTimeout = event.configuration().vm.powerdownTimeout;
if (powerdownTimeout != newTimeout) { if (powerdownTimeout != newTimeout) {
powerdownTimeout = newTimeout; powerdownTimeout = newTimeout;

View file

@ -21,8 +21,8 @@ package org.jdrupes.vmoperator.runner.qemu;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Optional; import java.util.Optional;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpSetBalloon; import org.jdrupes.vmoperator.runner.qemu.commands.QmpSetBalloon;
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand; import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
import org.jgrapes.core.Channel; import org.jgrapes.core.Channel;
import org.jgrapes.core.Component; import org.jgrapes.core.Component;
import org.jgrapes.core.annotation.Handler; import org.jgrapes.core.annotation.Handler;
@ -50,7 +50,7 @@ public class RamController extends Component {
* @param event the event * @param event the event
*/ */
@Handler @Handler
public void onConfigureQemu(ConfigureQemu event) { public void onConfigureQemu(RunnerConfigurationUpdate event) {
Optional.ofNullable(event.configuration().vm.currentRam) Optional.ofNullable(event.configuration().vm.currentRam)
.ifPresent(cr -> { .ifPresent(cr -> {
if (currentRam != null && currentRam.equals(cr)) { if (currentRam != null && currentRam.equals(cr)) {

View file

@ -51,9 +51,9 @@ import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Option; import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCont; import org.jdrupes.vmoperator.runner.qemu.commands.QmpCont;
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand; import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorReady; import org.jdrupes.vmoperator.runner.qemu.events.MonitorReady;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange; import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange;
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State; import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State;
import org.jdrupes.vmoperator.util.ExtendedObjectWrapper; import org.jdrupes.vmoperator.util.ExtendedObjectWrapper;
@ -118,8 +118,8 @@ import org.jgrapes.util.events.WatchFile;
* monitor --> configure: ClientConnected[for monitor] * monitor --> configure: ClientConnected[for monitor]
* monitor -> error: ConnectError[for monitor] * monitor -> error: ConnectError[for monitor]
* *
* configure: entry/fire ConfigureQemu * configure: entry/fire RunnerConfigurationUpdate
* configure --> success: ConfigureQemu (last handler)/fire cont command * configure --> success: RunnerConfigurationUpdate (last handler)/fire cont command
* } * }
* *
* Initializing --> which: Started * Initializing --> which: Started
@ -238,7 +238,7 @@ public class Runner extends Component {
} }
logger.fine(() -> "Updating configuration"); logger.fine(() -> "Updating configuration");
var newConf = yamlMapper.convertValue(c, Configuration.class); var newConf = yamlMapper.convertValue(c, Configuration.class);
rep.fire(new ConfigureQemu(newConf, state)); rep.fire(new RunnerConfigurationUpdate(newConf, state));
}); });
} }
@ -473,7 +473,7 @@ public class Runner extends Component {
*/ */
@Handler @Handler
public void onMonitorReady(MonitorReady event) { public void onMonitorReady(MonitorReady event) {
fire(new ConfigureQemu(config, state)); fire(new RunnerConfigurationUpdate(config, state));
} }
/** /**
@ -482,7 +482,7 @@ public class Runner extends Component {
* @param event the event * @param event the event
*/ */
@Handler(priority = -1000) @Handler(priority = -1000)
public void onConfigureQemu(ConfigureQemu event) { public void onConfigureQemu(RunnerConfigurationUpdate event) {
if (state == State.STARTING) { if (state == State.STARTING) {
fire(new MonitorCommand(new QmpCont())); fire(new MonitorCommand(new QmpCont()));
state = State.RUNNING; state = State.RUNNING;

View file

@ -31,7 +31,7 @@ import org.jgrapes.core.Event;
* on the event and only {@link Event#resumeHandling() resume handling} * on the event and only {@link Event#resumeHandling() resume handling}
* when the adaption has completed. * when the adaption has completed.
*/ */
public class ConfigureQemu extends Event<Void> { public class RunnerConfigurationUpdate extends Event<Void> {
private final Configuration configuration; private final Configuration configuration;
private final State state; private final State state;
@ -41,7 +41,7 @@ public class ConfigureQemu extends Event<Void> {
* *
* @param channels the channels * @param channels the channels
*/ */
public ConfigureQemu(Configuration configuration, State state, public RunnerConfigurationUpdate(Configuration configuration, State state,
Channel... channels) { Channel... channels) {
super(channels); super(channels);
this.state = state; this.state = state;