Interface GatewayModuleHook
- All Known Implementing Classes:
AbstractDeviceModuleHook, AbstractGatewayModuleHook, EventStreamGatewayHook, GatewayHook, HistorianModule, ReportingGatewayHook, SfcGatewayHook
<hook scope="G">com.example.module.gateway.SuperHookClass</hook>
Best practice: Instead of implementing this interface directly, subclass your hook
class from AbstractGatewayModuleHook instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureDeserializer(XMLDeserializer deserializer) Provides the module a chance to configure the deserializer with any custom handlersvoidProvides the module with an opportunity to define its own expression functionsvoidconfigureSerializer(XMLSerializer serializer) Provides the module a chance to add serialization delegates to the serializer custom for classes that might be encountered when serializing objects provided by this moduledefault List<? extends ExtensionPoint<?>> Used by the mounting underneath /res/module-id/* and /data/module-id/* as an alternate mounting path instead of your module id, if present.Returns the RPC implementation for this module, if any.voidinitializeScriptManager(ScriptManager manager) Initialize a newly-instantiated script manager.default booleandefault booleandefault voidmountRouteHandlers(RouteGroup routes) Provides a chance for the module to mount any route handlers it wants.voidnotifyLicenseStateChanged(LicenseState licenseState) Notify module hook when the license state has changed.default voidonMountedResourceRequest(String resourcePath, jakarta.servlet.http.HttpServletResponse response) Called prior to a 'mounted resource request' being fulfilled by requests to the mounted resource servlet serving resources from /res/module-id/ (or /res/alias/ ifgetMountPathAlias()is implemented).voidsetup(GatewayContext context) Called before register.voidshutdown()Called to shutdown this module.voidstartup(LicenseState activationState) Called to initialize the module.
-
Method Details
-
setup
Called before register. The module can create data structures, loggers, etc. The module should not reach out to other parts of the system and expect them to be ready or created yet. -
startup
Called to initialize the module. Will only be called once. Persistence interface is available, but only in read-only mode. -
shutdown
void shutdown()Called to shutdown this module. Note that this instance will never be started back up - a new one will be created if a restart is desired -
getExtensionPoints
- Returns:
- a list of any extension points this module wants to add to any extension point systems. This list will be a mixed-type list. Extension point managers will filter through the list and find the types that they are interested in.
-
getRpcImplementation
Optional<GatewayRpcImplementation> getRpcImplementation()Returns the RPC implementation for this module, if any. This is the recommended way to expose RPC functions to the Designer or Vision Client if required. The return value will be cached for the lifetime of the Gateway.- See Also:
-
notifyLicenseStateChanged
Notify module hook when the license state has changed. This could only contain changes for the module or it could contain a change to the platform license (version, restrictions such as expiration date, sqltag count...) -
configureSerializer
Provides the module a chance to add serialization delegates to the serializer custom for classes that might be encountered when serializing objects provided by this module -
configureDeserializer
Provides the module a chance to configure the deserializer with any custom handlers -
configureFunctionFactory
Provides the module with an opportunity to define its own expression functions -
initializeScriptManager
Initialize a newly-instantiated script manager. This will be called exactly once for any givenScriptManagerinstance. Usually this will involve callingScriptManager.addScriptModule(String, Object), which reflectively loads the public (instance and static) java functions from the given object into the scripting environment, at the provided path.This function may be called before
startup(LicenseState), but never beforesetup(GatewayContext). -
getMountedResourceFolder
-
mountRouteHandlers
Provides a chance for the module to mount any route handlers it wants. These will be active at /main/data/module-id/* SeeRouteGroupfor details. Will be called after startup(). -
getMountPathAlias
-
isFreeModule
default boolean isFreeModule()- Returns:
trueif this is a "free" module, i.e. it does not participate in the licensing system. This is equivalent to the now defunct FreeModule attribute that could be specified in module.xml.
-
isMakerEditionCompatible
default boolean isMakerEditionCompatible()- Returns:
trueif this module opts-in to participating in Ignition Maker Edition. Default isfalse. If you override this and return true, your module will become activated when running in a Maker Edition installation.
-
onMountedResourceRequest
default void onMountedResourceRequest(String resourcePath, jakarta.servlet.http.HttpServletResponse response) Called prior to a 'mounted resource request' being fulfilled by requests to the mounted resource servlet serving resources from /res/module-id/ (or /res/alias/ ifgetMountPathAlias()is implemented). It is called after the target resource has been successfully located.Primarily intended as an opportunity to amend/alter the response's headers for purposes such as establishing Cache-Control. Ignition sets no additional headers on most resource requests. The exception is Web UI bundles, meaning URLs registered in the SystemJS import map and any request carrying an
ia-hashquery parameter. After this method returns, the platform applies its own cache policy to them: it replaces anyCache-Controlset here unless that containsno-storeorno-cache, setsETagandVary, and answers a matchingIf-None-Matchwith304 Not Modifiedinstead of the resource. Bundles served from disk during development, rather than from a module jar, get onlyCache-Control: no-cache: noETagorVary, and never a304.- Parameters:
resourcePath- path to the resource being returned by the mounted resource requestresponse- the response to read/amend.
-