java.lang.Object
com.inductiveautomation.ignition.gateway.storeforward.engine.EngineManifest

public final class EngineManifest extends Object
The manifest for a store and forward engine, representing the engine id and all the associated data flavors tracked within.
  • Field Details

  • Method Details

    • from

      public static EngineManifest from(String engineId)
      Creates a new EngineManifest with the specified engine ID.

      The engine ID is normalized to lowercase to match the behavior of StorageKey.

      Parameters:
      engineId - the engine identifier
      Returns:
      a new EngineManifest
    • withRenamedEngineId

      public EngineManifest withRenamedEngineId(String newEngineId)
      Creates a new EngineManifest with a renamed engine ID. All flavor-to-sink mappings are copied over with their storage keys updated to reference the new engine ID.

      For engine-bound sinks, both engineId and sinkId are updated to the new engine ID. For independent sinks, only the engineId is updated while the sinkId is preserved.

      Parameters:
      newEngineId - the new engine ID to use
      Returns:
      a new EngineManifest with the updated engine ID and storage keys
    • withRenamedSinkId

      public EngineManifest withRenamedSinkId(String oldSinkId, String newSinkId)
      Creates a new EngineManifest with a renamed sink ID. All flavor-to-sink mappings are copied over with their storage keys updated to reference the new sink ID where the old sink ID matches.

      This method only renames the sinkId in storage keys. For engine-bound sinks where the entire engine should be renamed, use withRenamedEngineId(String) instead. The caller is responsible for determining which method to use based on the sink type.

      Parameters:
      oldSinkId - the old sink ID to rename
      newSinkId - the new sink ID to use
      Returns:
      a new EngineManifest with the updated sink IDs
    • withRenamedSinkIdForFlavors

      public EngineManifest withRenamedSinkIdForFlavors(Set<String> flavorSignatures, String oldSinkId, String newSinkId)
      Creates a new EngineManifest with a renamed sink ID, scoped to specific flavor signatures. Only entries whose flavor signature is in the given set are renamed; all other entries are copied unchanged.
      Parameters:
      flavorSignatures - the set of flavor signatures to scope the rename to
      oldSinkId - the old sink ID to rename
      newSinkId - the new sink ID to use
      Returns:
      a new EngineManifest with the scoped sink ID rename applied
      Since:
      8.3.4
    • addFlavorStoragePair

      public boolean addFlavorStoragePair(String flavorSignature, StorageKey storageKey)
      Adds a flavor-to-sink mapping with automatic engine-bound detection.

      This method infers whether the sink is engine-bound based on the storage key pattern. If the storage key has matching engineId and sinkId (the StorageKey.repeated(String) pattern), the sink is marked as engine-bound. Otherwise, it's treated as independent.

      For explicit control over engine-bound status (e.g., when a sink has independent identity even though its name matches the engine), use addFlavorStoragePair(String, StorageKey, boolean).

      Parameters:
      flavorSignature - the data flavor signature
      storageKey - the storage key identifying the sink
      Returns:
      true if the mapping was added
    • addFlavorStoragePair

      public boolean addFlavorStoragePair(String flavorSignature, StorageKey storageKey, boolean engineBound)
      Adds a flavor-to-sink mapping and optionally marks the sink as engine-bound.

      Engine-bound sinks have their sinkId renamed when the engine is renamed. This is appropriate for sinks like DatasourceQuerySink that are inherently tied to the datasource/engine. Independent sinks have their own identity separate from the engine.

      Parameters:
      flavorSignature - the data flavor signature
      storageKey - the storage key identifying the sink
      engineBound - true if this sink is bound to the engine's lifecycle
      Returns:
      true if the mapping was added
    • addFlavorStoragePair

      public boolean addFlavorStoragePair(String flavorSignature, EngineManifest.SinkRegistration registration)
      Adds or updates a flavor-to-sink mapping.

      If a registration with the same storage key already exists for this flavor, it will be replaced. This ensures that when a sink registers with an explicit engine-bound value, it overwrites any previously inferred value (e.g., from data storage before the sink registered).

      Use this method when the engine-bound value is authoritative (e.g., from sink registration). Use addFlavorStoragePairIfAbsent(java.lang.String, com.inductiveautomation.ignition.gateway.storeforward.StorageKey, boolean) when the engine-bound value is inferred and should not overwrite an existing authoritative value.

      Parameters:
      flavorSignature - the data flavor signature
      registration - the sink registration containing storage key and engine-bound status
      Returns:
      true if the mapping was added or updated (changed)
    • addFlavorStoragePairIfAbsent

      public boolean addFlavorStoragePairIfAbsent(String flavorSignature, StorageKey storageKey, boolean engineBound)
      Adds a flavor-to-sink mapping only if no registration with the same storage key exists.

      This method is intended for cases where the engine-bound value is inferred (e.g., from data storage) and should not overwrite an existing authoritative value from sink registration.

      Parameters:
      flavorSignature - the data flavor signature
      storageKey - the storage key identifying the sink
      engineBound - true if this sink is bound to the engine's lifecycle
      Returns:
      true if the mapping was added, false if a registration with the same storage key already exists
    • addFlavorStoragePairIfAbsent

      public boolean addFlavorStoragePairIfAbsent(String flavorSignature, EngineManifest.SinkRegistration registration)
      Adds a flavor-to-sink mapping only if no registration with the same storage key exists.

      This method is intended for cases where the engine-bound value is inferred (e.g., from data storage) and should not overwrite an existing authoritative value from sink registration.

      Parameters:
      flavorSignature - the data flavor signature
      registration - the sink registration containing storage key and engine-bound status
      Returns:
      true if the mapping was added, false if a registration with the same storage key already exists
    • getEngineBoundSinkIds

      public Set<String> getEngineBoundSinkIds()
      Returns the set of sink IDs that are bound to the engine's lifecycle in at least one flavor. These sinks will have their directories renamed when the engine is renamed.
      Returns:
      unmodifiable set of engine-bound sink IDs
    • isEngineBound

      public boolean isEngineBound(String flavorSignature, String sinkId)
      Checks if a sink is bound to the engine's lifecycle for a specific flavor.
      Parameters:
      flavorSignature - the flavor signature
      sinkId - the sink ID to check
      Returns:
      true if the sink is engine-bound for this flavor
    • isEngineBound

      public boolean isEngineBound(String sinkId)
      Checks if a sink is bound to the engine's lifecycle in any flavor.
      Parameters:
      sinkId - the sink ID to check
      Returns:
      true if the sink is engine-bound in at least one flavor
    • removeFlavorStoragePair

      public boolean removeFlavorStoragePair(String flavorSignature, StorageKey storageKey)
      Removes a flavor-to-sink mapping by storage key.
      Parameters:
      flavorSignature - the data flavor signature
      storageKey - the storage key identifying the sink to remove
      Returns:
      true if a mapping was removed
    • removeAllStoragePairs

      public void removeAllStoragePairs(String flavorSignature)
      Removes all sink mappings for a flavor.
      Parameters:
      flavorSignature - the data flavor signature
    • containsFlavors

      public boolean containsFlavors()
      Returns whether this manifest contains any flavor mappings.
      Returns:
      true if there are flavor mappings
    • getFlavorCount

      public int getFlavorCount()
      Returns the number of distinct flavors in this manifest.
      Returns:
      the flavor count
    • getSinksByFlavor

      Returns a map of flavor signatures to their sink registrations.
      Returns:
      unmodifiable map of flavor to sink registrations
    • getStorageKeysByFlavor

      public Map<String,Collection<StorageKey>> getStorageKeysByFlavor()
      Returns a map of flavor signatures to their storage keys. This is a convenience method that extracts just the storage keys from the sink registrations.
      Returns:
      unmodifiable map of flavor to storage keys
    • getEngineId

      public String getEngineId()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • fromGson

      public static EngineManifest fromGson(com.inductiveautomation.ignition.common.gson.JsonElement json)
    • fromJson

      public static EngineManifest fromJson(String json)
    • toGson

      public static com.inductiveautomation.ignition.common.gson.JsonObject toGson(EngineManifest manifest)
    • toJson

      public static String toJson(EngineManifest manifest)