Class NamedResourceHandler<R>

java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.ignition.gateway.config.NamedResourceHandler<R>
Type Parameters:
R - The type of the configuration object that is stored in the resources.
All Implemented Interfaces:
Lifecycle
Direct Known Subclasses:
FontManagerImpl, IconManagerImpl, ThemeManagerImpl

public abstract class NamedResourceHandler<R> extends AbstractLifecycle

This class acts as an abstraction layer for handling named configuration resources. These resources are stored using the gateway's ConfigurationManager, and could be accessed directly using that API, but most subsystems find it more convenient to use this class to interact with their resources.

This class takes care of details like the following:

  • Loading resources from the correct resource collection, so that subsystems don't need to worry about details like loading from core, local, or what the active deployment mode is.
  • Using a ResourceCollectionLifecycleFactory to correctly listen for resource changes. These changes are packaged up and delivered to subclasses using the various on* methods (like onInitialResources(List) and onResourcesUpdated(List))
  • Using the ResourceTypeMeta and it's ResourceCodec to encode and decode the configuration stored within the resource's config.json data file. By the time resources are delivered to subclasses of this method, they are already decoded into the appropriate configuration object and wrapped in a DecodedResource object. If resources cannot be decoded because of a DecodingException, they are simply treated as if they don't exist. This means that if a resource is updated and becomes un-decodable, it will be as if the resource was deleted (onResourceRemoved(DecodedResource) will be invoked. If the resource is later modified and becomes decode-able, it will be presented as if it is an added resource. (onResourceAdded(DecodedResource) will be invoked).
  • Gracefully handles renaming resources, including detection and updating any references to the renamed resource.
  • Understands and listens for changes to the gateway's redundancy role, and will automatically switch to using backup configuration objects (backupConfig.json) when the gateway is in a backup role.

To use this class, you can either:

See Also: