Class AbstractGatewayConnection
java.lang.Object
com.inductiveautomation.ignition.client.gateway_interface.AbstractGatewayConnection
- All Implemented Interfaces:
GatewayConnection,GatewayConstants
- Direct Known Subclasses:
ClientGatewayConnection,DesignerGatewayConnection
public abstract class AbstractGatewayConnection
extends Object
implements GatewayConnection, GatewayConstants
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordfinal classThe local endpoint of the WebSocket connection.Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.client.gateway_interface.GatewayConnection
GatewayConnection.RpcNested classes/interfaces inherited from interface com.inductiveautomation.ignition.common.gateway.GatewayConstants
GatewayConstants.ClientAuthChallengeDeserializer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringprotected final GatewayConnectionContextTheGatewayConnectionContextcontaining the launch context, thread pools, WebSocket and HTTP clients.static final Stringprotected static final LoggerExUsed for internal logging ONLY.protected final ReentrantReadWriteLockstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from interface com.inductiveautomation.ignition.client.gateway_interface.GatewayConnection
CONNECTED, CONNECTION_MODE, CONNECTION_UP, GATEWAY_ADDRESS, GATEWAY_NODE_ROLE, GATEWAY_TIME_ZONE, PROJECT_NAME, ROLES, SESSION_VALID, USERNAME, ZONESFields inherited from interface com.inductiveautomation.ignition.common.gateway.GatewayConstants
BUILD_NUMBER, CONNECT_TIMEOUT, ERRNO_BROWSE_ERROR, ERRNO_COMM_ERROR, ERRNO_CONNECTION_MODE, ERRNO_DBCONNECTION_SQL, ERRNO_INTERNAL, ERRNO_INVALIDARGS, ERRNO_INVOCATION_EXCEPTION, ERRNO_LICENSE_RESTRICTED, ERRNO_LOGIN_CANCELLED, ERRNO_LOGIN_FAILED, ERRNO_LOGIN_FAILED_LICENSING, ERRNO_NO_SESSION, ERRNO_NON_ACTIVE_NODE, ERRNO_NON_MASTER_NODE, ERRNO_NOT_AUTHORIZED, ERRNO_OK, ERRNO_PARSE, ERRNO_PASSWORD_EXPIRED, ERRNO_SQL, ERRNO_TRIAL_EXPIRED, ERRNO_VERSION_INCOMPATIBILITY, ERROR_MESSAGE_TYPE, FUNCTION_NAME, GSON, LOCALE_LIST, MODE_DISCONNECTED, MODE_FULL, MODE_READ_ONLY, MODULE_ID, MTYPE_PUBLIC_PING, OPC_BROWSE_TIMEOUT, PACKAGE_ID, PROJECT_NAME, REMOTE_HOST, SCOPE_HEADER, SESSION_ID_HEADER, SOCKET_TIMEOUT, TIMEZONE_ID, WARNING_MESSAGE_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionvoidDifferent from the ConnectionListener in the sense that this listener is intended for use in redundant setups, where the status of the inactive connection must be updated along with the status of the active connection.voidvoidaddPropertyChangeListener(String propName, PropertyChangeListener l) <T> voidaddPushNotificationListener(PushNotificationListener<T> listener, PushNotificationDeserializer<T> deserializer) Adds a handler for push notifications.protected voidprotected abstract LoginResultauthChallengeLogin(GatewayInterface gatewayInterface, AuthChallenge challenge, String projectName) authChallengeLogin(String projectName, AuthChallenge challenge) voidConnect to the gateway(s) specifiedvoidprotected CompletableFuture<Void>Fire a collection of push notifications to all listeners.Returns a list of all possible Gateway addresses that are known to the client.The encrypted auth challenge that was used to log inintReturns the current connection modeintReturns the address of the gateway that is currently being communicated with.Returns the string version of the currently connected gateway's "Node Role", which will be one of: Independent Master BackupReturns the url to the web portion of the gateway, like "http[s]://<address>:<port>[/context]"intThe number of concurrent HTTP connections allowed.intThe name of the project that we are currently logged into, if any.Get the project name bound to this connection.getRoles()The set of roles that the actively logged in user has, if any.Returns "http" or "https" depending on our transport schemeprotected abstract intgetScope()The set of security zones that the actively logged in user has, if any.intThe username of the actively logged in user, if any.protected abstract HandshakeExchangehandshake(GatewayInterface gatewayInterface) protected abstract LoginResultidpLoginFinish(GatewayInterface gatewayInterface, String projectName) idpLoginFinish(String projectName) protected abstract URIidpLoginStart(GatewayInterface gatewayInterface, String projectName) idpLoginStart(String projectName) booleanstatic booleanbooleanbooleanbooleanTrue after we have logged in successfully, and before we log out.voidlogout()protected abstract voidlogout(GatewayInterface gatewayInterface) protected voidonConnect(GatewayInterface gatewayInterface) protected abstract voidprotected abstract voidprotected voidoperateOnPropertyChangeSupport(Consumer<PropertyChangeSupport> propertyChangeSupportOperation) Fire an operation against thepropertyChangeSupportinstance on theexecutionQueue.voidvoidvoidremovePropertyChangeListener(String propName, PropertyChangeListener l) voidremovePushNotificationListener(PushNotificationListener<?> listener) protected voidvoidsetConnectionMode(int newConnectionMode) voidsetConnectTimeout(int newConnectTimeout) voidsetHttpConcurrency(int newHttpConcurrency) voidsetOpcBrowseTimeout(int newOpcBrowseTimeout) voidsetSocketTimeout(int newSocketTimeout) protected abstract LoginResulttokenLogin(GatewayInterface gatewayInterface, String encodedAuthToken, String projectName) voidManually update the status of all connection listeners.voidupdateLocale(Locale newLocale) Sends a message to the gateway indicating that the session's locale changed due to some client action.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.ignition.client.gateway_interface.GatewayConnection
addPushNotificationListener
-
Field Details
-
REDUNDANT_MASTER
-
REDUNDANT_BACKUP
-
INDEPENDENT
- See Also:
-
CONNECTING
- See Also:
-
CONNECT_SUCCESS
- See Also:
-
CONNECT_FAIL
- See Also:
-
STATUS_CONNECT_UNKNOWN
public static final int STATUS_CONNECT_UNKNOWN- See Also:
-
STATUS_CONNECTING
public static final int STATUS_CONNECTING- See Also:
-
STATUS_CONNECTED
public static final int STATUS_CONNECTED- See Also:
-
STATUS_CONNECT_FAIL
public static final int STATUS_CONNECT_FAIL- See Also:
-
STATUS_CONNECT_INACTIVE
public static final int STATUS_CONNECT_INACTIVE- See Also:
-
STATUS_CONNECTED_INCOMPATIBLE
public static final int STATUS_CONNECTED_INCOMPATIBLE- See Also:
-
STATUS_CONNECT_WARNING
public static final int STATUS_CONNECT_WARNING- See Also:
-
LOG
-
LOGGER_STATUS_LOOKUP
Used for internal logging ONLY. Do not use to display messages to the user, as these strings are not internationalized. -
readWriteLock
-
context
TheGatewayConnectionContextcontaining the launch context, thread pools, WebSocket and HTTP clients.
-
-
Constructor Details
-
AbstractGatewayConnection
-
-
Method Details
-
getScope
protected abstract int getScope() -
updateLocale
Sends a message to the gateway indicating that the session's locale changed due to some client action. -
operateOnPropertyChangeSupport
protected void operateOnPropertyChangeSupport(Consumer<PropertyChangeSupport> propertyChangeSupportOperation) Fire an operation against thepropertyChangeSupportinstance on theexecutionQueue.- Parameters:
propertyChangeSupportOperation-ConsumerofPropertyChangeSupportwhich operates on thepropertyChangeSupportinstance while running on theexecutionQueue
-
getProjectNameInternal
Get the project name bound to this connection. Any time we need to log into the Gateway, we need to pass the project name bound to this connection. This method exposes the project name in a scope-dependent way assuming the read or write lock is already held by the caller.- Returns:
- the project name bound to this connection
-
authChallengeLogin
protected abstract LoginResult authChallengeLogin(GatewayInterface gatewayInterface, AuthChallenge challenge, @Nullable String projectName) throws GatewayException - Throws:
GatewayException
-
tokenLogin
protected abstract LoginResult tokenLogin(GatewayInterface gatewayInterface, String encodedAuthToken, @Nullable String projectName) throws GatewayException - Throws:
GatewayException
-
idpLoginFinish
protected abstract LoginResult idpLoginFinish(GatewayInterface gatewayInterface, @Nullable String projectName) throws GatewayException - Throws:
GatewayException
-
authChallengeLogin
public AuthenticatedUser authChallengeLogin(String projectName, AuthChallenge challenge) throws GatewayException - Specified by:
authChallengeLoginin interfaceGatewayConnection- Throws:
GatewayException
-
onConnect
-
onUnrecoverableIdpAuthSession
protected abstract void onUnrecoverableIdpAuthSession() -
handshake
-
onVersionMismatch
protected abstract void onVersionMismatch() -
addPushNotificationListeners
protected void addPushNotificationListeners() -
connect
Description copied from interface:GatewayConnectionConnect to the gateway(s) specified- Specified by:
connectin interfaceGatewayConnection
-
removePushNotificationListeners
protected void removePushNotificationListeners() -
disconnect
public void disconnect()- Specified by:
disconnectin interfaceGatewayConnection
-
getGatewayAddress
Description copied from interface:GatewayConnectionReturns the address of the gateway that is currently being communicated with.- Specified by:
getGatewayAddressin interfaceGatewayConnection
-
getAllAddresses
Description copied from interface:GatewayConnectionReturns a list of all possible Gateway addresses that are known to the client. This list includes redundant master and backup addresses. The list is used for client restarts.- Specified by:
getAllAddressesin interfaceGatewayConnection
-
getGatewayInterface
- Specified by:
getGatewayInterfacein interfaceGatewayConnection
-
getGatewayWebURL
Description copied from interface:GatewayConnectionReturns the url to the web portion of the gateway, like "http[s]://<address>:<port>[/context]"- Specified by:
getGatewayWebURLin interfaceGatewayConnection
-
getScheme
Description copied from interface:GatewayConnectionReturns "http" or "https" depending on our transport scheme- Specified by:
getSchemein interfaceGatewayConnection
-
getGatewayNodeRole
Description copied from interface:GatewayConnectionReturns the string version of the currently connected gateway's "Node Role", which will be one of:- Independent
- Master
- Backup
- Specified by:
getGatewayNodeRolein interfaceGatewayConnection
-
getGatewayTimeZone
- Specified by:
getGatewayTimeZonein interfaceGatewayConnection
-
idpLoginStart
@Nullable protected abstract URI idpLoginStart(GatewayInterface gatewayInterface, String projectName) throws GatewayException - Throws:
GatewayException
-
idpLoginStart
- Specified by:
idpLoginStartin interfaceGatewayConnection- Throws:
GatewayException
-
idpLoginFinish
- Specified by:
idpLoginFinishin interfaceGatewayConnection- Throws:
GatewayException
-
logout
-
logout
public void logout()- Specified by:
logoutin interfaceGatewayConnection
-
getConnectionMode
public int getConnectionMode()Description copied from interface:GatewayConnectionReturns the current connection mode- Specified by:
getConnectionModein interfaceGatewayConnection- See Also:
-
setConnectionMode
public void setConnectionMode(int newConnectionMode) - Specified by:
setConnectionModein interfaceGatewayConnection
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceGatewayConnection
-
isConnectionUp
public boolean isConnectionUp()- Specified by:
isConnectionUpin interfaceGatewayConnection
-
isSessionValid
public boolean isSessionValid()True after we have logged in successfully, and before we log out.- Specified by:
isSessionValidin interfaceGatewayConnection
-
addPushNotificationListener
public <T> void addPushNotificationListener(PushNotificationListener<T> listener, PushNotificationDeserializer<T> deserializer) Description copied from interface:GatewayConnectionAdds a handler for push notifications. The provided deserializer is used to convert incoming raw binary bytes into your handler's expected message type.- Specified by:
addPushNotificationListenerin interfaceGatewayConnection- Parameters:
listener- The listener to add.deserializer- The deserializer to use.
-
removePushNotificationListener
- Specified by:
removePushNotificationListenerin interfaceGatewayConnection
-
firePushNotifications
Fire a collection of push notifications to all listeners. Takes care of firing these on theexecutionQueue.- Parameters:
n- the push notifications to fire- Returns:
- a
CompletableFuturerepresenting the future completion of firing these notification on theexecutionQueue
-
addPropertyChangeListener
- Specified by:
addPropertyChangeListenerin interfaceGatewayConnection
-
removePropertyChangeListener
- Specified by:
removePropertyChangeListenerin interfaceGatewayConnection
-
addPropertyChangeListener
- Specified by:
addPropertyChangeListenerin interfaceGatewayConnection
-
removePropertyChangeListener
- Specified by:
removePropertyChangeListenerin interfaceGatewayConnection
-
getProjectName
Description copied from interface:GatewayConnectionThe name of the project that we are currently logged into, if any.- Specified by:
getProjectNamein interfaceGatewayConnection
-
getUsername
Description copied from interface:GatewayConnectionThe username of the actively logged in user, if any.- Specified by:
getUsernamein interfaceGatewayConnection
-
getAuthChallenge
Description copied from interface:GatewayConnectionThe encrypted auth challenge that was used to log in- Specified by:
getAuthChallengein interfaceGatewayConnection
-
getRoles
Description copied from interface:GatewayConnectionThe set of roles that the actively logged in user has, if any.- Specified by:
getRolesin interfaceGatewayConnection
-
getSecurityZones
Description copied from interface:GatewayConnectionThe set of security zones that the actively logged in user has, if any.- Specified by:
getSecurityZonesin interfaceGatewayConnection
-
getConnectTimeout
public int getConnectTimeout()- Specified by:
getConnectTimeoutin interfaceGatewayConnection
-
setConnectTimeout
public void setConnectTimeout(int newConnectTimeout) - Specified by:
setConnectTimeoutin interfaceGatewayConnection
-
getSocketTimeout
public int getSocketTimeout()- Specified by:
getSocketTimeoutin interfaceGatewayConnection
-
setSocketTimeout
public void setSocketTimeout(int newSocketTimeout) - Specified by:
setSocketTimeoutin interfaceGatewayConnection
-
getOpcBrowseTimeout
public int getOpcBrowseTimeout()- Specified by:
getOpcBrowseTimeoutin interfaceGatewayConnection
-
setOpcBrowseTimeout
public void setOpcBrowseTimeout(int newOpcBrowseTimeout) - Specified by:
setOpcBrowseTimeoutin interfaceGatewayConnection
-
getHttpConcurrency
public int getHttpConcurrency()Description copied from interface:GatewayConnectionThe number of concurrent HTTP connections allowed. 0 or less means unlimited.- Specified by:
getHttpConcurrencyin interfaceGatewayConnection
-
setHttpConcurrency
public void setHttpConcurrency(int newHttpConcurrency) - Specified by:
setHttpConcurrencyin interfaceGatewayConnection
-
addConnectionStatusListener
Description copied from interface:GatewayConnectionDifferent from the ConnectionListener in the sense that this listener is intended for use in redundant setups, where the status of the inactive connection must be updated along with the status of the active connection. The passed ConnectionStatusListener will be continually updated with master/independent and backup connection status every few seconds.- Specified by:
addConnectionStatusListenerin interfaceGatewayConnection
-
removeConnectionStatusListener
- Specified by:
removeConnectionStatusListenerin interfaceGatewayConnection
-
triggerConnectionStatusListeners
public void triggerConnectionStatusListeners()Description copied from interface:GatewayConnectionManually update the status of all connection listeners. Use this in situations where listeners need an immediate update without waiting for the normal thread task to fire (such as when first displaying a status panel).- Specified by:
triggerConnectionStatusListenersin interfaceGatewayConnection
-
getEdgeProjectName
- Specified by:
getEdgeProjectNamein interfaceGatewayConnection- Returns:
- the name of the Edge project as defined by the user on the edge gateway settings
-
isPlatformLicensed
public boolean isPlatformLicensed()- Specified by:
isPlatformLicensedin interfaceGatewayConnection
-
isConnectionRelated
-