← Files Computable Systems EngineeringARCHIVED FILE
tools/sysml/ReferenceVizProbe.java
1.91 KB · Dec 3, 2026 · 18:30 UTC
import org.omg.sysml.interactive.*;
import java.nio.file.*;
import java.util.*;
import net.sourceforge.plantuml.*;
import java.io.*;
public class ReferenceVizProbe {
public static void main(String[] args)throws Exception {
var session=SysMLInteractive.getInstance();
session.loadLibrary(Path.of(args[0]).toAbsolutePath().toString());
var result=session.process(Files.readString(Path.of(args[1])));
if(result.hasErrors())throw new IllegalStateException(result.formatIssues());
var viz=session.viz(List.of(args[2]),List.of(args[3]),List.of("PUMLCODE"),List.of());
if(viz.hasException())throw new IllegalStateException(viz.formatException());
var code=viz.getPlantUML();
if(code==null||!code.contains("@startuml"))throw new IllegalStateException("No model-generated PlantUML");
Files.writeString(Path.of(args[4]+".puml"),code);
// Installed PlantUML Smetana is an explicit layout fallback; diagram semantics remain generated by the pinned pilot.
var rendering=code.replaceFirst("@startuml","@startuml\n!pragma layout smetana");
Files.writeString(Path.of(args[4]+".layout.puml"),rendering);
var reader=new SourceStringReader(rendering);
var svg=new ByteArrayOutputStream();
var description=reader.outputImage(svg,new FileFormatOption(FileFormat.SVG));
if(description==null||description.getDescription().toLowerCase().contains("error"))throw new IllegalStateException("PlantUML render error "+description);
Files.writeString(Path.of(args[4]+".svg"),svg.toString("UTF-8"));
var png=new ByteArrayOutputStream();
var pngDescription=reader.outputImage(png,new FileFormatOption(FileFormat.PNG));
if(pngDescription==null||pngDescription.getDescription().toLowerCase().contains("error"))throw new IllegalStateException("PNG render error");
Files.write(Path.of(args[4]+".png"),png.toByteArray());
System.out.println("VALIDATION=pass; PILOT_VIEW="+args[3]+"; LAYOUT=installed Smetana; "+description.getDescription());
}
}
SHA-256: 0c4353b22def9eeba72ea8489e286687f109ee4f55c2c575be9f011e936701ca