diff --git a/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Controller.java b/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Controller.java new file mode 100644 index 0000000..9ceb232 --- /dev/null +++ b/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Controller.java @@ -0,0 +1,41 @@ +/* + * VM-Operator + * Copyright (C) 2023 Michael N. Lipp + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.jdrupes.vmoperator.manager; + +import java.io.IOException; +import org.jgrapes.core.Channel; +import org.jgrapes.core.Component; + +/** + * The application class. + */ +public class Controller extends Component { + + /** + * Instantiates a new manager. + * + * @throws IOException Signals that an I/O exception has occurred. + */ + public Controller(Channel componentChannel) { + super(componentChannel); + // Prepare component tree + attach(new VmWatcher(channel())); + attach(new Reconciler(channel())); + } +} diff --git a/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Manager.java b/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Operator.java similarity index 83% rename from org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Manager.java rename to org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Operator.java index 675c11a..d87b7d1 100644 --- a/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Manager.java +++ b/org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Operator.java @@ -33,22 +33,19 @@ import org.jgrapes.io.NioDispatcher; /** * The application class. */ -public class Manager extends Component { +public class Operator extends Component { - /** The Constant APP_NAME. */ - public static final String APP_NAME = "vmoperator"; - private static Manager app; + private static Operator app; /** * Instantiates a new manager. * * @throws IOException Signals that an I/O exception has occurred. */ - public Manager() throws IOException { + public Operator() throws IOException { // Prepare component tree attach(new NioDispatcher()); - attach(new VmWatcher(channel())); - attach(new Reconciler(channel())); + attach(new Controller(channel())); } /** @@ -64,12 +61,12 @@ public class Manager extends Component { static { try { InputStream props; - var path = FsdUtils.findConfigFile(Manager.APP_NAME, + var path = FsdUtils.findConfigFile(Constants.APP_NAME, "logging.properties"); if (path.isPresent()) { props = Files.newInputStream(path.get()); } else { - props = Manager.class.getResourceAsStream("logging.properties"); + props = Operator.class.getResourceAsStream("logging.properties"); } LogManager.getLogManager().readConfiguration(props); } catch (IOException e) { @@ -85,8 +82,8 @@ public class Manager extends Component { */ @SuppressWarnings("PMD.SignatureDeclareThrowsException") public static void main(String[] args) throws Exception { - // The Manager is the root component - app = new Manager(); + // The Operator is the root component + app = new Operator(); // Prepare Stop Runtime.getRuntime().addShutdownHook(new Thread(() -> {