Class GatewayHook
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook
-
- com.inductiveautomation.perspective.gateway.GatewayHook
-
- All Implemented Interfaces:
com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
,GatewayModuleHook
public class GatewayHook extends AbstractGatewayModuleHook implements com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
This class is the gateway hook for loading into the Ignition platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GatewayHook.PerspectiveGatewayContext
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CACHE_CONTROL_PROPERTY_KEY
If VM argument is provided with this key, the string value will be applied to the Cache-Control header instead of the default settings defined byDEFAULT_RESOURCE_CACHE_CONTROL
.
-
Constructor Summary
Constructors Constructor Description GatewayHook()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GatewayHook
get(GatewayContext context)
ComponentModelDelegateRegistry
getComponentModelDelegateRegistry()
GatewayHook.PerspectiveGatewayContext
getContext()
PerspectiveLicenseState
getLicenseState()
java.util.Optional<java.lang.String>
getMountedResourceFolder()
java.util.Optional<java.lang.String>
getMountPathAlias()
Used by the mounting underneath /res/module-id/* and /main/data/module-id/* as an alternate mounting path instead of your module id, if present.RedundancyStatus
getRedundancyStatus()
PerspectiveModuleRpc
getRPCHandler(ClientReqSession session, java.lang.String projectName)
A class whose functions will become exposed automatically through reflection to the Designer and the Client through RPCjava.util.Optional<OverviewContributor>
getStatusOverviewContributor()
Implement this method to contribute meta data to the Status section's Systems / Overview page.java.util.List<? extends INamedTab>
getStatusPanels()
A list (may be null or empty) of panels to display in the status sectionjava.util.List<java.lang.String>
handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
void
initializeScriptManager(ScriptManager manager)
Initialize a newly-instantiated script manager.static boolean
isClientCacheEnabled()
boolean
isMakerEditionCompatible()
void
mountRouteHandlers(RouteGroup routes)
Provides a chance for the module to mount any route handlers it wants.void
notifyLicenseStateChanged(LicenseState platformLicense)
Notify module hook when the license state has changed.void
onMountedResourceRequest(java.lang.String resourcePath, javax.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/ ifGatewayModuleHook.getMountPathAlias()
is implemented).void
setup(GatewayContext gatewayContext)
Called to before startup.void
shutdown()
Called to shutdown this module.void
startup(LicenseState activationState)
Called to initialize the module.-
Methods inherited from class com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook
configureDeserializer, configureFunctionFactory, configureSerializer, getHomepagePanels
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.gateway.model.GatewayModuleHook
getConfigCategories, getConfigOverviewContributor, getConfigPanels, initializeResourceTypeAdapterRegistry, isFreeModule, updateSystemMap
-
-
-
-
Field Detail
-
CACHE_CONTROL_PROPERTY_KEY
public static final java.lang.String CACHE_CONTROL_PROPERTY_KEY
If VM argument is provided with this key, the string value will be applied to the Cache-Control header instead of the default settings defined byDEFAULT_RESOURCE_CACHE_CONTROL
.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static GatewayHook get(@Nonnull GatewayContext context)
-
getComponentModelDelegateRegistry
public ComponentModelDelegateRegistry getComponentModelDelegateRegistry()
-
setup
public void setup(GatewayContext gatewayContext)
Description copied from interface:GatewayModuleHook
Called to before startup. This is the chance for the module to add its extension points and update persistent records and schemas. None of the managers will be started up at this point, but the extension point managers will accept extension point types.- Specified by:
setup
in interfaceGatewayModuleHook
-
startup
public void startup(LicenseState activationState)
Description copied from interface:GatewayModuleHook
Called to initialize the module. Will only be called once. Persistence interface is available, but only in read-only mode.- Specified by:
startup
in interfaceGatewayModuleHook
-
shutdown
public 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.- Specified by:
shutdown
in interfaceGatewayModuleHook
-
isMakerEditionCompatible
public boolean isMakerEditionCompatible()
- Specified by:
isMakerEditionCompatible
in interfaceGatewayModuleHook
- Returns:
true
if 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.
-
handleMessage
public java.util.List<java.lang.String> handleMessage(com.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchEvent event)
- Specified by:
handleMessage
in interfacecom.inductiveautomation.ignition.gateway.clientcomm.scriptmsg.event.SessionMessageDispatchHandler
-
getContext
public GatewayHook.PerspectiveGatewayContext getContext()
-
getRedundancyStatus
@Nullable public RedundancyStatus getRedundancyStatus()
-
notifyLicenseStateChanged
public void notifyLicenseStateChanged(LicenseState platformLicense)
Description copied from interface:GatewayModuleHook
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...)- Specified by:
notifyLicenseStateChanged
in interfaceGatewayModuleHook
- Overrides:
notifyLicenseStateChanged
in classAbstractGatewayModuleHook
-
getLicenseState
public PerspectiveLicenseState getLicenseState()
-
getMountedResourceFolder
public java.util.Optional<java.lang.String> getMountedResourceFolder()
- Specified by:
getMountedResourceFolder
in interfaceGatewayModuleHook
- Returns:
- the path to a folder in one of the module's gateway jar files that should be mounted at /main/res/module-id/foldername
-
getMountPathAlias
public java.util.Optional<java.lang.String> getMountPathAlias()
Description copied from interface:GatewayModuleHook
Used by the mounting underneath /res/module-id/* and /main/data/module-id/* as an alternate mounting path instead of your module id, if present.- Specified by:
getMountPathAlias
in interfaceGatewayModuleHook
-
mountRouteHandlers
public void mountRouteHandlers(RouteGroup routes)
Provides a chance for the module to mount any route handlers it wants. These will be active at /main/data/module-id/* SeeRouteGroup
for details. Will be called after startup().- Specified by:
mountRouteHandlers
in interfaceGatewayModuleHook
- Parameters:
routes
- the routes group, used to serve data via http requests to the Ignition Gateway
-
getStatusOverviewContributor
public java.util.Optional<OverviewContributor> getStatusOverviewContributor()
Description copied from interface:GatewayModuleHook
Implement this method to contribute meta data to the Status section's Systems / Overview page.- Specified by:
getStatusOverviewContributor
in interfaceGatewayModuleHook
-
initializeScriptManager
public void initializeScriptManager(ScriptManager manager)
Description copied from interface:GatewayModuleHook
Initialize a newly-instantiated script manager. This will be called exactly once for any givenScriptManager
instance. 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
GatewayModuleHook.startup(LicenseState)
, but never beforeGatewayModuleHook.setup(GatewayContext)
.- Specified by:
initializeScriptManager
in interfaceGatewayModuleHook
- Overrides:
initializeScriptManager
in classAbstractGatewayModuleHook
-
getStatusPanels
public java.util.List<? extends INamedTab> getStatusPanels()
Description copied from interface:GatewayModuleHook
A list (may be null or empty) of panels to display in the status section- Specified by:
getStatusPanels
in interfaceGatewayModuleHook
- Overrides:
getStatusPanels
in classAbstractGatewayModuleHook
-
getRPCHandler
public PerspectiveModuleRpc getRPCHandler(ClientReqSession session, java.lang.String projectName)
Description copied from interface:GatewayModuleHook
A class whose functions will become exposed automatically through reflection to the Designer and the Client through RPC- Specified by:
getRPCHandler
in interfaceGatewayModuleHook
- Overrides:
getRPCHandler
in classAbstractGatewayModuleHook
-
onMountedResourceRequest
public void onMountedResourceRequest(java.lang.String resourcePath, javax.servlet.http.HttpServletResponse response)
Description copied from interface:GatewayModuleHook
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/ ifGatewayModuleHook.getMountPathAlias()
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. By default, Ignition sets no additional headers on a resource request.
- Specified by:
onMountedResourceRequest
in interfaceGatewayModuleHook
- Parameters:
resourcePath
- path to the resource being returned by the mounted resource requestresponse
- the response to read/amend.
-
isClientCacheEnabled
public static boolean isClientCacheEnabled()
-
-