Interface GatewayConnection

All Known Implementing Classes:
AbstractGatewayConnection, ClientGatewayConnection, DesignerGatewayConnection

public interface GatewayConnection
  • Field Details

    • CONNECTED

      static final String CONNECTED
      Boolean property fired to interested property change listeners when connect(List) is called (false -> true) and when disconnect() is called (true -> false).
      See Also:
    • GATEWAY_ADDRESS

      static final String 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 from HttpURL.toString().
      See Also:
    • GATEWAY_TIME_ZONE

      static final String GATEWAY_TIME_ZONE
      TimeZone property fired to interested property change listeners when the Timezone of the Gateway to which this GatewayConnection is targeted changes.
      See Also:
    • PROJECT_NAME

      static final String PROJECT_NAME
      String property fired to interested property change listeners when the project for this GatewayConnection changes.
      See Also:
    • USERNAME

      static final String 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

      static final String 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

      static final String 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

      static final String 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 from Enum.toString().
      See Also:
    • CONNECTION_MODE

      static final String CONNECTION_MODE
      Integer property fired to interested property change listeners when the connection mode changes. The value could be one of GatewayConstants.MODE_DISCONNECTED, GatewayConstants.MODE_READ_ONLY, or GatewayConstants.MODE_FULL.
      See Also:
    • CONNECTION_UP

      static final String 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

      static final String 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

      void connect(List<HttpURL> gatewayURLs)
      Connect to the gateway(s) specified
    • disconnect

      void disconnect()
    • getGatewayAddress

      HttpURL getGatewayAddress()
      Returns the address of the gateway that is currently being communicated with.
    • getAllAddresses

      List<HttpURL> getAllAddresses()
      Returns 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.
    • 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

      @Nullable URI idpLoginStart(String projectName) throws GatewayException
      Throws:
      GatewayException
    • idpLoginFinish

      @Nullable AuthenticatedUser idpLoginFinish(String projectName) throws GatewayException
      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

      default void addPushNotificationListener(PushNotificationListener<Void> listener)
      Adds a handler for empty push notifications, where the message itself is the only signal.
    • removePushNotificationListener

      void removePushNotificationListener(PushNotificationListener<?> listener)
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      void removePropertyChangeListener(PropertyChangeListener l)
    • addPropertyChangeListener

      void addPropertyChangeListener(String propName, PropertyChangeListener l)
    • removePropertyChangeListener

      void removePropertyChangeListener(String propName, PropertyChangeListener l)
    • 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.
    • getAuthChallenge

      AuthChallenge getAuthChallenge()
      The encrypted auth challenge that was used to log in
    • getRoles

      List<String> getRoles()
      The set of roles that the actively logged in user has, if any.
    • getSecurityZones

      List<String> getSecurityZones()
      The set of security zones that the actively logged in user has, if any.
    • 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

      void addConnectionStatusListener(ConnectionStatusListener listener)
      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

      void removeConnectionStatusListener(ConnectionStatusListener listener)
    • 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(@NotNull @NotNull ClientRpcSerializer serializer, @NotNull @NotNull String moduleId, @NotNull @NotNull 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, or Resource.PLATFORM_MODULE_ID for platform
      rpcInterface - The interface to implement.
      timeoutMillis - The timeout in milliseconds for the RPC calls.
    • getRpcInterface

      static <T> T getRpcInterface(@NotNull @NotNull ClientRpcSerializer serializer, @NotNull @NotNull String moduleId, @NotNull @NotNull 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 the DESIGNER_SESSION_TIMEOUT value, default of 60 seconds.
      Parameters:
      serializer - The serializer to use for the RPC calls.
      moduleId - The module ID that defines the RPC interface, or Resource.PLATFORM_MODULE_ID for platform
      rpcInterface - The interface to implement.