Package io.fleetcoreplatform.Builders
Class MissionZipBuilder
java.lang.Object
io.fleetcoreplatform.Builders.MissionZipBuilder
- All Implemented Interfaces:
Closeable,AutoCloseable
Aggregates distinct mission plan files into a single, deployable ZIP archive. Provides a managed
stream wrapper to incrementally add payloads targeted to specific drone units.
-
Constructor Summary
ConstructorsConstructorDescriptionMissionZipBuilder(String missionUUID) Initializes the builder by creating a temporary archive container on the host filesystem. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Seals the archive, finalizing the zip structure and flushing all pending writes to disk.voidclose()Ensures all internal zip streams are safely terminated when the builder context exits.mission(String thingName, InputStream missionInputStream) Injects a specific mission plan stream into the overarching zip bundle.
-
Constructor Details
-
MissionZipBuilder
Initializes the builder by creating a temporary archive container on the host filesystem.- Parameters:
missionUUID- A global identifier bridging the constituent missions, utilized for the archive filename.- Throws:
IOException- If the temporary file directory is inaccessible or unwritable.
-
-
Method Details
-
mission
public MissionZipBuilder mission(String thingName, InputStream missionInputStream) throws IOException Injects a specific mission plan stream into the overarching zip bundle. The entry filename is determined by the target drone's callsign or logical name.- Parameters:
thingName- The unique identifier assigned to the drone hardware (used as the zip entry name).missionInputStream- The raw byte stream of the generated `.plan` file.- Returns:
- The current builder instance for chaining.
- Throws:
IOException- If the stream fails to read or the archive write is interrupted.
-
build
Seals the archive, finalizing the zip structure and flushing all pending writes to disk.- Returns:
- The finalized `File` handle pointing to the zip archive.
- Throws:
IOException- If standard stream closing fails.
-
close
Ensures all internal zip streams are safely terminated when the builder context exits.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- If the underlying stream throws during closure.
-