Interface GatewayConnection
- All Known Implementing Classes:
AbstractGatewayConnection, ClientGatewayConnection, DesignerGatewayConnection
public interface GatewayConnection
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringBoolean property fired to interested property change listeners whenconnect(List)is called (false -> true) and whendisconnect()is called (true -> false).static final StringInteger property fired to interested property change listeners when the connection mode changes.static final StringString property fired to interested property change listeners when the WebSocket connection is opened (false -> true) and when it is closed (true -> false).static final StringString property fired to interested property change listeners when the address of the Gateway to which this GatewayConnection is targeted changes.static final StringString property fired to interested property change listeners when the Redundancy Role of the Gateway targeted by this connection changes.static final StringTimeZoneproperty fired to interested property change listeners when the Timezone of the Gateway to which this GatewayConnection is targeted changes.static final StringString property fired to interested property change listeners when the project for this GatewayConnection changes.static final StringString array property fired to interested property change listeners when the roles of the user logged into the Gateway targeted by this connection changes.static final StringString property fired to interested property change listeners when the WebSocket connection is opened (false -> true) and when it is closed (true -> false).static final StringString property fired to interested property change listeners when the username of the user logged into the Gateway targeted by this connection changes.static final StringString array property fired to interested property change listeners when the security zones of the user logged into the Gateway targeted by this connection changes. -
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) default voidAdds a handler for empty push notifications, where the message itself is the only signal.<T> voidaddPushNotificationListener(PushNotificationListener<T> listener, PushNotificationDeserializer<T> deserializer) Adds a handler for push notifications.authChallengeLogin(@Nullable String projectName, AuthChallenge challenge) voidConnect to the gateway(s) specifiedvoidReturns a list of all possible Gateway addresses that are known to the client.The AuditActor of the actively logged in user, if any.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.getRoles()The set of roles that the actively logged in user has, if any.static <T> TgetRpcInterface(@NonNull GatewayConnection connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface, whose remote calls go toconnectionrather than to the connectionGatewayConnectionManagerholds, with theDESIGNER_SESSION_TIMEOUTtimeout, 60 seconds by default.static <T> TgetRpcInterface(@NonNull GatewayConnection connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface, int timeoutMillis) Returns a proxy object that implements the given interface, whose remote calls go toconnectionrather than to the connectionGatewayConnectionManagerholds.static <T> TgetRpcInterface(@NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface.static <T> TgetRpcInterface(@NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface, int timeoutMillis) Returns a proxy object that implements the given interface.static <T> TgetRpcInterface(@NonNull Supplier<GatewayConnection> connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface, whose remote calls go to the connectionconnectionyields at the time of each call, with theDESIGNER_SESSION_TIMEOUTtimeout, 60 seconds by default.Returns "http" or "https" depending on our transport schemeThe set of security zones that the actively logged in user has, if any.intThe username of the actively logged in user, if any.@Nullable AuthenticatedUseridpLoginFinish(String projectName) @Nullable URIidpLoginStart(String projectName, @Nullable String idp) Begins an IdP login.booleanbooleanbooleanbooleanvoidlogout()voidvoidvoidremovePropertyChangeListener(String propName, PropertyChangeListener l) voidremovePushNotificationListener(PushNotificationListener<?> listener) voidsetConnectionMode(int connectionMode) voidsetConnectTimeout(int connectTimeout) voidsetHttpConcurrency(int concurrency) voidsetOpcBrowseTimeout(int opcBrowseTimeout) voidsetSocketTimeout(int socketTimeout) voidManually update the status of all connection listeners.
-
Field Details
-
CONNECTED
Boolean property fired to interested property change listeners whenconnect(List)is called (false -> true) and whendisconnect()is called (true -> false).- See Also:
-
GATEWAY_ADDRESS
String property fired to interested property change listeners when the address of the Gateway to which this GatewayConnection is targeted changes. The String is the result fromHttpURL.toString().- See Also:
-
GATEWAY_TIME_ZONE
-
PROJECT_NAME
String property fired to interested property change listeners when the project for this GatewayConnection changes.- See Also:
-
USERNAME
String property fired to interested property change listeners when the username of the user logged into the Gateway targeted by this connection changes.- See Also:
-
ROLES
String array property fired to interested property change listeners when the roles of the user logged into the Gateway targeted by this connection changes.- See Also:
-
ZONES
String array property fired to interested property change listeners when the security zones of the user logged into the Gateway targeted by this connection changes.- See Also:
-
GATEWAY_NODE_ROLE
String property fired to interested property change listeners when the Redundancy Role of the Gateway targeted by this connection changes. The String is the result fromEnum.toString().- See Also:
-
CONNECTION_MODE
Integer property fired to interested property change listeners when the connection mode changes. The value could be one ofGatewayConstants.MODE_DISCONNECTED,GatewayConstants.MODE_READ_ONLY, orGatewayConstants.MODE_FULL.- See Also:
-
CONNECTION_UP
String property fired to interested property change listeners when the WebSocket connection is opened (false -> true) and when it is closed (true -> false).- See Also:
-
SESSION_VALID
String property fired to interested property change listeners when the WebSocket connection is opened (false -> true) and when it is closed (true -> false).- See Also:
-
-
Method Details
-
connect
-
disconnect
void disconnect() -
getGatewayAddress
HttpURL getGatewayAddress()Returns the address of the gateway that is currently being communicated with. -
getAllAddresses
-
getGatewayInterface
GatewayInterface getGatewayInterface() -
getGatewayWebURL
String getGatewayWebURL()Returns the url to the web portion of the gateway, like "http[s]://<address>:<port>[/context]" -
getScheme
String getScheme()Returns "http" or "https" depending on our transport scheme -
getGatewayNodeRole
String getGatewayNodeRole()Returns the string version of the currently connected gateway's "Node Role", which will be one of:- Independent
- Master
- Backup
-
getGatewayTimeZone
TimeZone getGatewayTimeZone() -
authChallengeLogin
AuthenticatedUser authChallengeLogin(@Nullable String projectName, AuthChallenge challenge) throws GatewayException - Throws:
GatewayException
-
idpLoginStart
Begins an IdP login.- Parameters:
projectName- the project to log in to, or nullidp- the specific identity provider to authenticate against (e.g. chosen from the multi-IdP chooser), or null to let the gateway decide (single IdP, or return the chooser interstitial when more than one is configured)- Returns:
- the URI the browser should be sent to, or null if no authentication is required
- Throws:
GatewayException
-
idpLoginFinish
- Throws:
GatewayException
-
logout
void logout() -
getConnectionMode
int getConnectionMode()Returns the current connection mode- See Also:
-
setConnectionMode
void setConnectionMode(int connectionMode) -
isConnected
boolean isConnected() -
isConnectionUp
boolean isConnectionUp() -
isSessionValid
boolean isSessionValid() -
addPushNotificationListener
<T> void addPushNotificationListener(PushNotificationListener<T> listener, PushNotificationDeserializer<T> deserializer) Adds a handler for push notifications. The provided deserializer is used to convert incoming raw binary bytes into your handler's expected message type.- Parameters:
listener- The listener to add.deserializer- The deserializer to use.
-
addPushNotificationListener
Adds a handler for empty push notifications, where the message itself is the only signal. -
removePushNotificationListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-
getProjectName
String getProjectName()The name of the project that we are currently logged into, if any. -
getUsername
String getUsername()The username of the actively logged in user, if any. -
getAuditActor
Optional<AuditActor> getAuditActor()The AuditActor of the actively logged in user, if any. -
getAuthChallenge
AuthChallenge getAuthChallenge()The encrypted auth challenge that was used to log in -
getRoles
-
getSecurityZones
-
getConnectTimeout
int getConnectTimeout() -
setConnectTimeout
void setConnectTimeout(int connectTimeout) -
getSocketTimeout
int getSocketTimeout() -
setSocketTimeout
void setSocketTimeout(int socketTimeout) -
getOpcBrowseTimeout
int getOpcBrowseTimeout() -
setOpcBrowseTimeout
void setOpcBrowseTimeout(int opcBrowseTimeout) -
getHttpConcurrency
int getHttpConcurrency()The number of concurrent HTTP connections allowed. 0 or less means unlimited. -
setHttpConcurrency
void setHttpConcurrency(int concurrency) -
addConnectionStatusListener
Different 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. -
removeConnectionStatusListener
-
triggerConnectionStatusListeners
void triggerConnectionStatusListeners()Manually 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). -
getEdgeProjectName
String getEdgeProjectName()- Returns:
- the name of the Edge project as defined by the user on the edge gateway settings
-
isPlatformLicensed
boolean isPlatformLicensed() -
getRpcInterface
static <T> T getRpcInterface(@NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface, int timeoutMillis) Returns a proxy object that implements the given interface. The proxy object will make remote calls to the gateway to execute the methods of the interface.- Parameters:
serializer- The serializer to use for the RPC calls.moduleId- The module ID that defines the RPC interface, orResource.PLATFORM_MODULE_IDfor platformrpcInterface- The interface to implement.timeoutMillis- The timeout in milliseconds for the RPC calls.
-
getRpcInterface
static <T> T getRpcInterface(@NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface. The proxy object will make remote calls to the gateway to execute the methods of the interface. This overload is hardcoded to theDESIGNER_SESSION_TIMEOUTvalue, default of 60 seconds.- Parameters:
serializer- The serializer to use for the RPC calls.moduleId- The module ID that defines the RPC interface, orResource.PLATFORM_MODULE_IDfor platformrpcInterface- The interface to implement.
-
getRpcInterface
static <T> T getRpcInterface(@NonNull GatewayConnection connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface, int timeoutMillis) Returns a proxy object that implements the given interface, whose remote calls go toconnectionrather than to the connectionGatewayConnectionManagerholds. Use it to call a gateway other than the one this process is connected to.- Parameters:
connection- the connection to call the gateway over.serializer- the serializer to use for the RPC calls.moduleId- the module ID that defines the RPC interface, orResource.PLATFORM_MODULE_IDfor platform.rpcInterface- the interface to implement.timeoutMillis- the timeout in milliseconds for the RPC calls.
-
getRpcInterface
static <T> T getRpcInterface(@NonNull GatewayConnection connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface, whose remote calls go toconnectionrather than to the connectionGatewayConnectionManagerholds, with theDESIGNER_SESSION_TIMEOUTtimeout, 60 seconds by default.- Parameters:
connection- the connection to call the gateway over.serializer- the serializer to use for the RPC calls.moduleId- the module ID that defines the RPC interface, orResource.PLATFORM_MODULE_IDfor platform.rpcInterface- the interface to implement.
-
getRpcInterface
static <T> T getRpcInterface(@NonNull Supplier<GatewayConnection> connection, @NonNull ClientRpcSerializer serializer, @NonNull String moduleId, @NonNull Class<T> rpcInterface) Returns a proxy object that implements the given interface, whose remote calls go to the connectionconnectionyields at the time of each call, with theDESIGNER_SESSION_TIMEOUTtimeout, 60 seconds by default. Use it for a proxy that outlives any one connection or is created before its connection exists, as the platform's own RPC instances are.- Parameters:
connection- yields the connection to call the gateway over, on each call.serializer- the serializer to use for the RPC calls.moduleId- the module ID that defines the RPC interface, orResource.PLATFORM_MODULE_IDfor platform.rpcInterface- the interface to implement.
-