feat(editor): F4.6c the software installation on a computer's desktop
A new oracle, InstallRun, installs each of Java's programs on new computers, all of them on one, each installed and removed again, and a DNS and an e-mail server installed again after their removal; Java saves the result as a project. A new program is switched off (a computer's firewall is on), makes the folders and files it lacks (the web server's start page in FILIUS' language and its picture, /peer2peer, /mailserver/konten.txt, /dns/hosts), and removing it takes its settings and leaves its files; a server installed again reads its records or accounts from them. Java installs in the order of its list and starts the program at once. The document's setSoftware does the same, checked against Java's saved installation. The core knows what a program makes in the files and installs or removes a program while the simulation runs; the room watches the document's programs and hands changes to the engine, so a new command line works at once. The desktop offers Java's dialog with two lists, arrows, double click and apply changes. Also: Java's file may name a number it rolled by the result of any getter (an idref, here a thread's priority); GetterDefaults now measures the priority of the saved thread classes, which the import read as 0 before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
// Installs FILIUS' programs as its software installation does
|
||||
// (GUIInstallationsDialog.aenderungenSpeichern: installAndStartAppIfAvailable,
|
||||
// entferneSoftware) on new computers and saves them as Java saves a project
|
||||
// (SzenarioVerwaltung.speichern): what a program brings along when it is
|
||||
// installed — its settings, its folders and files — and what stays when it
|
||||
// is removed. The reference for the editor's software installation
|
||||
// (packages/doc/test/install.test.ts). One computer per program, named after
|
||||
// its class's simple name; "Alle" has them all; "Entfernt-<name>" had the
|
||||
// program installed and removed again; "Wieder-<name>" had a DNS server with
|
||||
// a record or an e-mail server with an account installed, removed and
|
||||
// installed again.
|
||||
//
|
||||
// Usage: java -cp filius.jar:lib/*:classes InstallRun <output fls>
|
||||
|
||||
import filius.gui.GUIContainer;
|
||||
import filius.gui.netzwerksicht.GUIDesignSidebar;
|
||||
import filius.gui.netzwerksicht.GUIDocuItem;
|
||||
import filius.gui.netzwerksicht.GUIKabelItem;
|
||||
import filius.gui.netzwerksicht.GUIKnotenItem;
|
||||
import filius.hardware.knoten.Rechner;
|
||||
import filius.rahmenprogramm.Information;
|
||||
import filius.rahmenprogramm.SzenarioVerwaltung;
|
||||
import filius.software.system.Betriebssystem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InstallRun {
|
||||
public static void main(String[] args) throws Exception {
|
||||
try {
|
||||
run(args);
|
||||
} catch (Throwable error) {
|
||||
error.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
static Rechner computer(List<GUIKnotenItem> items, String name, int place) {
|
||||
Rechner host = new Rechner();
|
||||
host.setName(name);
|
||||
NewDeviceRun.add(items, host, GUIDesignSidebar.RECHNER, 100 + 150 * (place % 6), 100 + 150 * (place / 6));
|
||||
return host;
|
||||
}
|
||||
|
||||
static void run(String[] args) throws Exception {
|
||||
GUIContainer.getGUIContainer();
|
||||
List<GUIKnotenItem> items = new ArrayList<>();
|
||||
List<Map<String, String>> programs = Information.getInformation().ladeProgrammListe();
|
||||
int place = 0;
|
||||
Rechner all = computer(items, "Alle", place++);
|
||||
for (Map<String, String> program : programs) {
|
||||
String className = program.get("Klasse");
|
||||
String name = className.substring(className.lastIndexOf('.') + 1);
|
||||
Betriebssystem system = (Betriebssystem) computer(items, name, place++).getSystemSoftware();
|
||||
if (!system.installAndStartAppIfAvailable(className)) throw new IllegalStateException("not installed: " + className);
|
||||
((Betriebssystem) all.getSystemSoftware()).installAndStartAppIfAvailable(className);
|
||||
Betriebssystem removed = (Betriebssystem) computer(items, "Entfernt-" + name, place++).getSystemSoftware();
|
||||
removed.installAndStartAppIfAvailable(className);
|
||||
if (!removed.entferneSoftware(className)) throw new IllegalStateException("not removed: " + className);
|
||||
}
|
||||
// Installed again where a removed program left its files: a DNS server with a record, an e-mail server with an account.
|
||||
Betriebssystem dns = (Betriebssystem) computer(items, "Wieder-DNSServer", place++).getSystemSoftware();
|
||||
dns.installAndStartAppIfAvailable("filius.software.dns.DNSServer");
|
||||
((filius.software.dns.DNSServer) dns.holeSoftware("filius.software.dns.DNSServer")).hinzuRecord("www.filius.de", "A", "1.2.3.4");
|
||||
dns.entferneSoftware("filius.software.dns.DNSServer");
|
||||
dns.installAndStartAppIfAvailable("filius.software.dns.DNSServer");
|
||||
Betriebssystem mail = (Betriebssystem) computer(items, "Wieder-EmailServer", place++).getSystemSoftware();
|
||||
mail.installAndStartAppIfAvailable("filius.software.email.EmailServer");
|
||||
((filius.software.email.EmailServer) mail.holeSoftware("filius.software.email.EmailServer")).benutzerHinzufuegen("anna", "geheim", "Muster", "Anna");
|
||||
mail.entferneSoftware("filius.software.email.EmailServer");
|
||||
mail.installAndStartAppIfAvailable("filius.software.email.EmailServer");
|
||||
// Let the programs' threads come to rest before the files are read.
|
||||
Thread.sleep(1000);
|
||||
if (!SzenarioVerwaltung.getInstance().speichern(args[0], items, new ArrayList<GUIKabelItem>(), new ArrayList<GUIDocuItem>())) {
|
||||
throw new IllegalStateException("FILIUS could not save " + args[0]);
|
||||
}
|
||||
System.out.println("computers: " + items.size());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user