Class ConfigResourceMigrations
java.lang.Object
com.inductiveautomation.ignition.gateway.config.ConfigResourceMigrations
Helpers for one-time, idempotent migrations of config resources at startup.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> booleanrewriteCanonicalSingleton(ConfigurationManager configurationManager, ResourceTypeMeta<R> meta, String actor) Re-persists a singleton config resource in its canonical form, dropping any legacy or deprecated data that the resource'scodecnormalizes away on decode (for example, a deprecated scalar property folded into a list).
-
Method Details
-
rewriteCanonicalSingleton
public static <R> boolean rewriteCanonicalSingleton(ConfigurationManager configurationManager, ResourceTypeMeta<R> meta, String actor) throws DecodingException, PushException Re-persists a singleton config resource in its canonical form, dropping any legacy or deprecated data that the resource'scodecnormalizes away on decode (for example, a deprecated scalar property folded into a list). The decode/encode round-trip is the migration, so this works for any singleton resource type whose decode normalizes legacy content - no resource-specific logic required.Only the resource's config payloads are rewritten:
config.json, plusbackupConfig.jsonwhen one is persisted and the codec canencodeit. Everything else on the resource is preserved as-is - attributes (includingenabled), the description, and auxiliary data files. This matters because the rewrite is pushed as a modify operation, which replaces the resource wholesale rather than merging into it.Idempotent and safe to call on every startup: it is a no-op when the resource is absent, lives in a read-only
externalcollection, or is already canonical (its serialized data is unchanged, ignoring last-modification metadata).- Type Parameters:
R- the decoded resource type- Parameters:
configurationManager- the configuration manager to read from and push the rewrite tometa- the singleton resource type to canonicalizeactor- the actor to attribute the rewrite to- Returns:
trueif the resource was rewritten- Throws:
DecodingException- if the existing resource cannot be decodedPushException- if the rewrite cannot be pushed
-