Skip to content

Commit 090e3c3

Browse files
committed
Add UML diagram
1 parent e2f45b4 commit 090e3c3

2 files changed

Lines changed: 195 additions & 0 deletions

File tree

docs/classDiagram.png

248 KB
Loading

docs/classDiagram.txt

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
@startuml Fedora Setup Script - Class Diagram
2+
3+
!define TITLE_COLOR #FFD700
4+
!define CLASS_COLOR #E1F5FF
5+
!define UTILITY_COLOR #F0F4C3
6+
7+
skinparam backgroundColor #FAFAFA
8+
skinparam classBackgroundColor CLASS_COLOR
9+
skinparam classBorderColor #01579B
10+
skinparam arrowColor #00695C
11+
skinparam stereotypeCBackgroundColor UTILITY_COLOR
12+
13+
title Fedora Setup Script - UML Class Diagram
14+
15+
' ============================================================================
16+
' MAIN CLASS
17+
' ============================================================================
18+
class Main {
19+
{static} -OS_USERNAME_PROP: String
20+
{static} -CMD_RPM_IMPORT: List<String>
21+
{static} -CMD_DNF_INST_REPOS: List<String>
22+
{static} -CMD_DNF_INST: List<String>
23+
{static} -CMD_DNF_RM: List<String>
24+
{static} -CMD_DNF_MARK: List<String>
25+
{static} -CMD_DNF_AUTORM: List<String>
26+
{static} -CMD_FLATPAK_REMOTE_ADD: List<String>
27+
{static} -CMD_FLATPAK_INST: List<String>
28+
{static} -CMD_ADD_GROUP: List<String>
29+
{static} -CMD_ADD_USER_TO_GROUP: List<String>
30+
{static} -CMD_SYSTEMCTL_ENABLE: List<String>
31+
--
32+
{static} +main(args: String[]): void
33+
{static} +run(args: String[], updater: PostInstallUpdater): void
34+
}
35+
36+
' ============================================================================
37+
' CONFIG MANAGER CLASS
38+
' ============================================================================
39+
class ConfigManager {
40+
{static} -CONFIG_DIR: String
41+
{static} -DNF_INSTALL_FILE: String
42+
{static} -DNF_REMOVE_FILE: String
43+
{static} -FLATPAK_INSTALL_FILE
44+
{static} -HELP_FILE: String
45+
{static} -gpgKeys: List<String>
46+
{static} -rpmFusionRepos: List<String>
47+
{static} -flatpakRemoteName: String
48+
{static} -flatpakRemoteUrl: String
49+
{static} -adminGroups: List<String>
50+
--
51+
{static} +readResourceLines(filename: String): List<String>
52+
{static} +loadPackageNamesFrom(filename: String): List<String>
53+
{static} +getRPMFusionGpgKeys(): List<String>
54+
{static} +getRPMFusionRepos(): List<String>
55+
{static} +getFlatpakRemoteName(): String
56+
{static} +getFlatpakRemoteUrl(): String
57+
{static} +getAdminGroups(): List<String>
58+
{static} +getDnfInstallPackages(): List<String>
59+
{static} +getDnfRemovePackages(): List<String>
60+
{static} +getFlatpakInstallPackages(): List<String>
61+
{static} +getHelpText(): List<String>
62+
}
63+
64+
' ============================================================================
65+
' CONSOLE IO HELPER CLASS
66+
' ============================================================================
67+
class ConsoleIOHelper {
68+
{static} -RESET: String
69+
{static} -YELLOW: String
70+
{static} -GREEN: String
71+
{static} -RED: String
72+
{static} -BLUE: String
73+
{static} -EXCLUDE_PROMPT: String
74+
--
75+
{static} +confirm(scanner: Scanner, prompt: String): boolean
76+
{static} +promptForExclusions(packages: List<String>, scanner: Scanner): List<String>
77+
{static} +printHelp(): void
78+
{static} +color(str: String, ansiColorCode: String): String
79+
{static} +isANSISupported(term: String, console: Console): boolean
80+
}
81+
82+
' ============================================================================
83+
' POST INSTALL UPDATER CLASS
84+
' ============================================================================
85+
class PostInstallUpdater {
86+
-dryRun: boolean
87+
--
88+
+isDryRun(): boolean
89+
+setDryRun(dryRun: boolean): void
90+
+createProcessBuilder(cmd: String[]): ProcessBuilder
91+
+runCommand(baseCmd: List<String>, args: List<String>): int
92+
}
93+
94+
' ============================================================================
95+
' RELATIONSHIPS AND DEPENDENCIES
96+
' ============================================================================
97+
98+
' Main uses ConfigManager for static configuration retrieval
99+
Main ..> ConfigManager : "reads config from"
100+
101+
' Main uses ConsoleIOHelper for console I/O and coloring
102+
Main ..> ConsoleIOHelper : "uses for console I/O"
103+
104+
' Main orchestrates PostInstallUpdater
105+
Main --> PostInstallUpdater : "delegates command execution to"
106+
107+
' ConsoleIOHelper depends on ConfigManager for help text
108+
ConsoleIOHelper ..> ConfigManager : "reads help from"
109+
110+
' PostInstallUpdater uses Java standard library classes
111+
PostInstallUpdater ..> "java.lang.ProcessBuilder" : "creates"
112+
PostInstallUpdater ..> "java.io.BufferedReader" : "uses"
113+
114+
' Main uses Java Scanner for user input
115+
Main --> "java.util.Scanner" : "reads user input from"
116+
117+
' ============================================================================
118+
' NOTES AND DOCUMENTATION
119+
' ============================================================================
120+
121+
note right of Main
122+
**Orchestrator Pattern**
123+
Entry point that coordinates:
124+
- Configuration loading (ConfigManager)
125+
- User interaction (ConsoleIOHelper)
126+
- Command execution (PostInstallUpdater)
127+
128+
Workflow:
129+
1. Accepts command-line arguments
130+
2. Prompts user for options
131+
3. Delegates task execution to PostInstallUpdater
132+
end note
133+
134+
note right of ConfigManager
135+
**Singleton-like Utility**
136+
Static methods for:
137+
- Configuration data access
138+
- Resource file loading
139+
- Package list management
140+
141+
Key Features:
142+
- Reads from filesystem first
143+
- Falls back to classpath resources
144+
- Filters comments in config files
145+
end note
146+
147+
note right of ConsoleIOHelper
148+
**Utility Class**
149+
Static methods for:
150+
- User confirmation prompts
151+
- Package selection filtering
152+
- ANSI color support detection
153+
- Help documentation display
154+
155+
Color Support:
156+
- Detects terminal capability
157+
- Applies ANSI codes when available
158+
end note
159+
160+
note right of PostInstallUpdater
161+
**Command Executor**
162+
Responsible for:
163+
- Command composition
164+
- Process creation & execution
165+
- Output handling & display
166+
- Exit code reporting
167+
168+
Features:
169+
- Dry-run mode support
170+
- Error stream merging
171+
- Real-time output display
172+
end note
173+
174+
' ============================================================================
175+
' LEGEND
176+
' ============================================================================
177+
178+
note bottom
179+
**Package Structure**: cf.maybelambda.fedora
180+
181+
**Key Patterns**:
182+
- Orchestrator (Main)
183+
- Singleton-like Utilities (ConfigManager, ConsoleIOHelper)
184+
- Command Pattern (PostInstallUpdater)
185+
- Dependency Injection (PostInstallUpdater passed to Main.run())
186+
187+
**Data Flow**:
188+
1. Main receives user input via Scanner
189+
2. Reads configuration from ConfigManager
190+
3. Presents options via ConsoleIOHelper
191+
4. Delegates execution to PostInstallUpdater
192+
5. PostInstallUpdater creates and runs system processes
193+
end note
194+
195+
@enduml

0 commit comments

Comments
 (0)