Class MissionZipBuilder

java.lang.Object
io.fleetcoreplatform.Builders.MissionZipBuilder
All Implemented Interfaces:
Closeable, AutoCloseable

public class MissionZipBuilder extends Object implements Closeable
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

    Constructors
    Constructor
    Description
    Initializes the builder by creating a temporary archive container on the host filesystem.
  • Method Summary

    Modifier and Type
    Method
    Description
    Seals the archive, finalizing the zip structure and flushing all pending writes to disk.
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MissionZipBuilder

      public MissionZipBuilder(String missionUUID) throws IOException
      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

      public File build() throws IOException
      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

      public void close() throws IOException
      Ensures all internal zip streams are safely terminated when the builder context exits.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - If the underlying stream throws during closure.