import os
# Define presentation data
SLIDES_DATA = [
{
"type": "title",
"title": "Automated Legacy Java Library<br>Decompilation Pipeline",
"subtitle": "Modernizing Source Artifacts for Java 21+ Environments",
"footer": "Presenter: Systems Architecture Team | Platform: Git Bash / MSYS2 on Windows"
},
{
"type": "bullets",
"title": "The Challenge of Legacy Black Boxes",
"bullets": [
"<strong>System Dependencies:</strong> Upgrading core infrastructure (like the COMET and CPLS systems) requires modernizing outdated libraries (such as the Java 6 ETSF library).",
"<strong>Lost Context:</strong> Source repositories for older .jar files are often missing, corrupt, or unmaintained across historical project structures.",
"<strong>The Objective:</strong> Safely disassemble binary .jar artifacts back into clean, high-concurrency-ready Java 21+ source code structures without introducing structural regression."
]
},
{
"type": "bullets",
"title": "Pipeline Architecture Blueprint",
"bullets": [
"<strong>1. Version Control Audit:</strong> Peeks inside bytecode headers to identify compliance states before processing.",
"<strong>2. Auto-Discovery Engine:</strong> Dynamically maps the local filesystem to locate the IDE decompiler runtime.",
"<strong>3. Fernflower Decompilation:</strong> Disassembles compiled binary classes into highly structured source code.",
"<strong>4. Extraction & Housekeeping:</strong> Unpacks the generated archives and automatically drops intermediate artifacts."
]
},
{
"type": "bullets",
"title": "Phase 1: Version Control Audit",
"bullets": [
"<strong>Source Inspection via 'javap':</strong> The script targets the first .class file inside the archive and extracts the binary major version header directly from the bytecode.",
"<strong>Dynamic Matrix Mapping:</strong> Maps internal bytecode numbers to human-readable names (e.g., major version 50 -> Java 6; 65 -> Java 21).",
"<strong>Target Runtime Verification:</strong> Queries the discovered IntelliJ Java binary via 'java -version' to ensure destination alignment.",
"<strong>Deterministic Logging:</strong> Outputs a dedicated [VERSION CONTROL] console block detailing the exact transition path before processing."
]
},
{
"type": "bullets",
"title": "Phase 2: Dynamic Environment Discovery",
"bullets": [
"<strong>The Fragility Problem:</strong> Hardcoding specific IDE versions (e.g., 'IntelliJ IDEA 2024.3.3') breaks when software updates patch or push paths forward.",
"<strong>The Automated Discovery Solution:</strong> The script dynamically scans standard corporate installation spaces (C:/Program Files/JetBrains and local AppData).",
"<strong>Smart Selection Matrix:</strong> Employs an alphanumeric reverse sort ('sort -r') to guarantee that the newest available IDE version and runtime engine are utilized automatically.",
"<strong>Fail-Safe Containment:</strong> Gracefully interrupts execution with a unique exit code if critical binaries (java.exe or java-decompiler.jar) cannot be resolved."
]
},
{
"type": "bullets",
"title": "Phase 3: Decompilation Execution",
"bullets": [
"<strong>Target Directory Enforcement:</strong> Checks for the presence of the output folder, instantly spinning up the destination directories via 'mkdir -p' if they do not exist.",
"<strong>Absolute Path Mapping ('realpath'):</strong> Upgrades input strings to fully qualified filesystem paths to prevent context loss during terminal directory switching.",
"<strong>Preserving Type Signatures:</strong> Applies the critical generic signature flag (-dgs=true) to preserve advanced structural syntax patterns during decompilation."
]
},
{
"type": "bullets",
"title": "Phase 4: Extraction & Validation",
"bullets": [
"<strong>Unpacking the Payload:</strong> The Fernflower engine packages its results as a nested .jar file inside your destination folder.",
"<strong>Native Unpacking:</strong> Uses the JDK utility ('jar -xvf') to extract the structural directories cleanly into the local folder context.",
"<b>Automated Housekeeping:</b> Automatically removes the duplicate intermediate archive file to prevent build-path conflicts or git history clutter.",
"<strong>Deterministic Inventory Report:</strong> Runs a localized filesystem discovery ('find . -type f') to output a scannable inventory summary of all reconstructed files."
]
},
{
"type": "bullets",
"title": "Built-In Resiliency Matrix",
"bullets": [
"<strong>Strict Error Containment ('set -eo pipefail'):</strong> Ensures that if any individual command or sub-pipe breaks, execution halts instantly instead of continuing blindly down the line.",
"<strong>Context Traps ('trap cleanup_on_err EXIT'):</strong> Captures the exact line number and failing command, outputting a highly readable troubleshooting message upon an unexpected crash.",
"<strong>Idempotent Behavior:</strong> Overwrites older directory traces cleanly on retry without interactive human prompts, making the script fully compatible with automated CI/CD integration pipelines."
]
},
{
"type": "terminal",
"title": "Execution Walkthrough & Console Output",
"console": (
"<span class='cmd'>$ ./decompile_lib.sh ../etsf-1.0_A20.jar lib</span>\n"
"[INFO] Locating IntelliJ installation environment...\n"
"[INFO] Found Runtime: /c/Program Files/JetBrains/IntelliJ IDEA 2026.1/jbr/bin/java.exe\n"
"------------------------------------------------------------\n"
"<span class='vc'>[VERSION CONTROL] Pipeline Architecture Mapping:\n"
"[VERSION CONTROL] >> SOURCE bytecode format: Java 6\n"
"[VERSION CONTROL] >> TARGET decompiler runtime: Java 21.0.2</span>\n"
"------------------------------------------------------------\n"
"[INFO] Destination folder 'lib' does not exist. Creating it now...\n"
"[INFO] Executing ConsoleDecompiler against etsf-1.0_A20.jar...\n"
"[INFO] Extracting generated source archive inside target folder...\n"
" extracted: com/etsf/core/Parser.java\n"
" extracted: com/etsf/core/Validator.java\n"
"[INFO] --- Disassembled File Inventory Summary ---\n"
"./com/etsf/core/Parser.java\n"
"./com/etsf/core/Validator.java\n"
"[INFO] Decompilation pipeline successfully completed."
]
}
]
html_template = """<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Java Decompilation Presentation</title>
<style>
body {
font-family: 'Segoe UI', Calibri, sans-serif;
background: #f4f6f9;
margin: 0;
padding: 40px 0;
display: flex;
flex-direction: column;
align-items: center;
}
.slide {
background: white;
width: 1100px;
height: 618px; /* Strict 16:9 Aspect Ratio */
margin-bottom: 40px;
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
border-radius: 8px;
box-sizing: border-box;
padding: 50px 60px;
position: relative;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.title-slide {
justify-content: center;
background: linear-gradient(135deg, #0C2340 0%, #1a3a60 100%);
color: white;
}
.title-slide h1 {
font-size: 46px;
margin: 0 0 20px 0;
color: white;
line-height: 1.2;
}
.title-slide h2 {
font-size: 22px;
font-weight: 400;
color: #009698;
margin: 0 0 60px 0;
}
.title-slide .footer {
font-size: 14px;
color: #a0b2c6;
}
h2.slide-title {
font-size: 34px;
color: #0C2340;
margin: 0 0 30px 0;
border-bottom: 2px solid #f0f2f5;
padding-bottom: 15px;
}
ul.bullet-list {
margin: 0;
padding-left: 25px;
}
ul.bullet-list li {
font-size: 18px;
color: #282828;
margin-bottom: 22px;
line-height: 1.5;
}
ul.bullet-list li strong {
color: #009698;
}
.terminal-box {
background: #1E1E1E;
color: #FFFFFF;
font-family: 'Consolas', monospace;
font-size: 14px;
padding: 20px;
border-radius: 6px;
flex-grow: 1;
white-space: pre;
overflow-y: auto;
line-height: 1.4;
box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}
.terminal-box .cmd { color: #FFFF00; font-weight: bold; }
.terminal-box .vc { color: #00FF00; }
.page-badge {
position: absolute;
bottom: 25px;
right: 40px;
font-size: 12px;
color: #999;
}
@media print {
body { background: white; padding: 0; }
.slide { box-shadow: none; margin: 0; page-break-after: always; border-radius: 0; }
}
</style>
</head>
<body>
"""
for idx, slide in enumerate(SLIDES_DATA):
page_num = idx + 1
if slide["type"] == "title":
html_template += f"""
<div class="slide title-slide">
<h1>{slide["title"]}</h1>
<h2>{slide["subtitle"]}</h2>
<div class="footer">{slide["footer"]}</div>
</div>
"""
elif slide["type"] == "terminal":
html_template += f"""
<div class="slide">
<h2 class="slide-title">{slide["title"]}</h2>
<div class="terminal-box">{slide["console"]}</div>
<div class="page-badge">{page_num}</div>
</div>
"""
else:
bullets_html = "".join([f"<li>{b}</li>" for b in slide["bullets"]])
html_template += f"""
<div class="slide">
<h2 class="slide-title">{slide["title"]}</h2>
<ul class="bullet-list">
{bullets_html}
</ul>
<div class="page-badge">{page_num}</div>
</div>
"""
html_template += """
</body>
</html>
"""
with open("presentation.html", "w", encoding="utf-8") as f:
f.write(html_template)
print("Successfully generated 'presentation.html'. Open it directly in your browser!")
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)