Class AppSessionGyro

java.lang.Object
com.iizix.server.gyro.AppSessionGyro
All Implemented Interfaces:
IPrivateStorage, IAppSessionGyro, IFocusEngineProvider, IMessageBox, IRuntimeImageCache, IToaster, IRuntimeReferenceLookup, IVirtualizedReferenceLookup, IGyroFocusEngineOwner, ILocaleString

Gyro instance that is used for a single user running one application. If parallel client sessions is enabled or allowed, a single AppSessionGyro is shared among all client sessions and their transaction processors.
Author:
Christopher Mindus
  • Constructor Details

    • AppSessionGyro

      public AppSessionGyro(ServerShell server, SessionInfo appSessionInfo, UserSessions userSessions, ClientParams clientParams, AuthenticatedUser authUser) throws UserException
      Constructs the instance of the application for the first user session. Subsequent parallel user sessions do not construct this instance.
      Parameters:
      server - The Server.
      appSessionInfo - The application session information.
      userSessions - The user sessions.
      clientParams - The client parameters.
      authUser - The authenticated user information.
      Throws:
      UserException - If the user is not allowed access.
  • Method Details

    • getSessionInstance

      public static AppSessionGyro getSessionInstance()
      Gets the AppSessionGyro instance for the current thread in an application session.
      Returns:
      The AppSessionGyro instance when called from a thread of the client session, null otherwise.
    • getSessionInstance

      public static AppSessionGyro getSessionInstance(SessionInfo sessionInfo)
      Gets the AppSessionGyro instance for the current thread in a client session.
      Parameters:
      sessionInfo - A session information instance, or null for none.
      Returns:
      The AppSessionGyro instance when called from a thread of the application session, null otherwise.
    • addDisposeListener

      public boolean addDisposeListener(IAppSessionDisposeListener listener)
      Adds a dispose listener for the application session. Calling this method multiple times with the same listener will have no effect (but to return false).
      Specified by:
      addDisposeListener in interface IAppSessionGyro
      Parameters:
      listener - The listener to add.
      Returns:
      true if the listener was added, false otherwise.
      Throws:
      NullPointerException - If the listener is null.
    • removeDisposeListener

      public boolean removeDisposeListener(IAppSessionDisposeListener listener)
      Removes a dispose listener for the application session.
      Specified by:
      removeDisposeListener in interface IAppSessionGyro
      Parameters:
      listener - The listener to remove.
      Returns:
      true if listener is successfully removed, false otherwise.
    • addClientConnectionListener

      public boolean addClientConnectionListener(IClientSessionConnectionListener listener)
      Adds a client connection listener for the application session. Calling this method multiple times with the same listener will have no effect (but to return false).
      Specified by:
      addClientConnectionListener in interface IAppSessionGyro
      Parameters:
      listener - The listener to add.
      Returns:
      true if the listener was added, false otherwise.
      Throws:
      NullPointerException - If the listener is null.
    • removeClientConnectionListener

      public boolean removeClientConnectionListener(IClientSessionConnectionListener listener)
      Removes a client connection listener for the application session.
      Specified by:
      removeClientConnectionListener in interface IAppSessionGyro
      Parameters:
      listener - The listener to remove.
      Returns:
      true if listener is successfully removed, false otherwise.
    • dispose

      public boolean dispose()
      Disposes of the Application session gyro, and effectively closes all the client sessions and end point connections.
      Specified by:
      dispose in interface IAppSessionGyro
      Returns:
      true for dispose success, false if already disposed of.
    • isDisposed

      public boolean isDisposed()
      Checks if the application session Gyro is disposed of.
      Specified by:
      isDisposed in interface IAppSessionGyro
      Returns:
      true if the user's app-session is disposed of along with all client sessions, false otherwise.
    • getVirtuals

      public <T extends PropCnr> VirtualsContainer<T> getVirtuals(IPluginDescriptor<T> serverPluginDescriptor)
      Gets the instance of the VirtualsContainer for the plug-in. The instance is allocated if not yet created. This instance will be disposed of when the application session is disposed of.
      Parameters:
      serverPluginDescriptor - The server plug-in descriptor.
      Returns:
      The instance of the virtuals container, or null if appGyro is disposed of.
      Throws:
      NullPointerException - If the plug-ins server ID is null from IPluginDescriptor.getServerID().
    • getServer

      public ServerShell getServer()
      Gets the server of this session.
    • getAppSessionInfo

      public SessionInfo getAppSessionInfo()
      Gets the application session info.
      Specified by:
      getAppSessionInfo in interface IAppSessionGyro
      Returns:
      The original session information that initiated the application session.
    • getAppThreadGroup

      public VirtualThreadGroup getAppThreadGroup()
      Gets the AppSessionGyro's Thread Group.
      Specified by:
      getAppThreadGroup in interface IAppSessionGyro
      Returns:
      The Virtual Thread Group.
    • getEnvironment

      public EnvProps getEnvironment()
      Gets the original environment properties for Selector's or Value's.

      This is NOT the same instance as the one available from the ClientSessionGyro.getEnvironment().

      Specified by:
      getEnvironment in interface IAppSessionGyro
      Specified by:
      getEnvironment in interface IRuntimeReferenceLookup
      Returns:
      The original environment properties for selectors, null if never initialized.
    • getServerConfigurationEnvironment

      public ServerConfigEnvProps getServerConfigurationEnvironment()
      Gets the selected Server configuration environment for the Application Session.
      Returns:
      The Server configuration environment to use for the sessions, null for none.
    • getFocusEngine

      public IFocusEngine getFocusEngine(IFocusComp comp)
      Returns the focus engine instance for the specified component.
      Specified by:
      getFocusEngine in interface IAppSessionGyro
      Specified by:
      getFocusEngine in interface IFocusEngineProvider
      Parameters:
      comp - The component requesting the focus engine. For the AppSessionGyro, the focus engine returns an instance of the VirtualSpace focus engine if the component instance is a IVSComponent (VSTable, VSField, etc) or a VirtualSpace, for now.
      Returns:
      The focus engine instance, or null if not found.
    • getCreationTime

      public long getCreationTime()
      Gets the creation time in milliseconds.
      Specified by:
      getCreationTime in interface IAppSessionGyro
      Returns:
      Milliseconds since the epoch.
    • getAppID

      public String getAppID()
      Gets the application ID.
      Specified by:
      getAppID in interface IAppSessionGyro
      Returns:
      The AppID is an upper case string.
    • getAppFactory

      public AppFactory getAppFactory()
      Gets the application factory.
      Specified by:
      getAppFactory in interface IRuntimeReferenceLookup
      Returns:
      The AppFactory.
    • getCustomAppValue

      public String getCustomAppValue(String key)
      Gets a value for a key in the custom app properties.
      Specified by:
      getCustomAppValue in interface IAppSessionGyro
      Parameters:
      key - The key or name of the property to retrieve.
      Returns:
      The value, or null if no value is defined for the key, or the custom map is not defined.
    • getTransactionCoordinator

      public ITXPCoordinator getTransactionCoordinator()
      Gets the transaction coordinator of the session.
      Specified by:
      getTransactionCoordinator in interface IAppSessionGyro
      Returns:
      The TXP coordinator, or null for none.
    • getVirtualSpaceVirtualsContainer

      public IVirtualsContainer<VirtualSpace> getVirtualSpaceVirtualsContainer()
      The VirtualsContainer instance for VirtualSpace. This instance is shared for all parallel client sessions (if this is enabled or allowed).
    • getSessionUserIdentifier

      public SessionUserIdentifier getSessionUserIdentifier()
      Gets the SessionUserIdentifier.
      Specified by:
      getSessionUserIdentifier in interface IAppSessionGyro
      Returns:
      The user identifier of the session.
    • getAuthenticatedUser

      public AuthenticatedUser getAuthenticatedUser()
      Gets the authenticated user information.
      Specified by:
      getAuthenticatedUser in interface IAppSessionGyro
      Returns:
      The authenticated user instance, or null for none.
    • changeExternallyAuthenticatedUser

      public SigninResult changeExternallyAuthenticatedUser(AuthenticatedUser authUser)
      Changes the authenticated user due an external authentication mechanism such as LinkedIn.
      Parameters:
      authUser - The new authenticated user.
      Returns:
      The authentication result, perhaps error "user is disabled".
      Throws:
      NullPointerException - If the client gyro or authUser parameter is null.
    • getAppPropCnr

      public AppPropCnr getAppPropCnr()
      Gets the application root for static references look-up.
    • getVirtualizedPropFromReference

      public GProp<?> getVirtualizedPropFromReference(String reference)
      Attempts to look up a virtualized property from a reference to the VirtualSpace only.
      Specified by:
      getVirtualizedPropFromReference in interface IVirtualizedReferenceLookup
      Parameters:
      reference - The reference to look-up.
      Returns:
      The virtualized instance of the property, null if not found.
    • getRuntimePropFromReference

      public GProp<?> getRuntimePropFromReference(String reference)
      Gets a reference for runtime use to get the reference of an item. The reference must be fully qualified such as "*ALIAS:/type/path" or "MODULE:/type/path" and cannot be relative.

      Note: The reference can be to the static or virtualized properties, but if a property type is virtualized and the property is not found, a fall-back to search the application for the static non-virtualized property IS NOT PERFORMED.

      Calling this method is the same as calling getRuntimePropFromReference(reference, false)}.

      Specified by:
      getRuntimePropFromReference in interface IAppSessionGyro
      Specified by:
      getRuntimePropFromReference in interface IRuntimeReferenceLookup
      Parameters:
      reference - The reference to look-up.
      Returns:
      The property found, or null for reference not found.
    • getRuntimePropFromReference

      public GProp<?> getRuntimePropFromReference(String reference, boolean fallBackToNonVirtualized)
      Gets a reference for runtime use to get the reference of an item. The reference must be fully qualified such as "*ALIAS:/type/path" or "MODULE:/type/path" and cannot be relative.

      If the flag fallBackToNonVirtualized is false, the search will not fallback to searching for the non-virtualized property in the runtime app. The result will only returned virtualized properties, i.e. for a reference as e.g. "module:/vs/someVS", and depending on where this method is called (the client session), also includes other virtualized properties such as panels as e.g. "module:/panel/somePanel".

      To always fallback to also searching the runtime app, specify fallBackToNonVirtualized to true.

      Specified by:
      getRuntimePropFromReference in interface IAppSessionGyro
      Specified by:
      getRuntimePropFromReference in interface IRuntimeReferenceLookup
      Parameters:
      reference - The reference to look-up.
      fallBackToNonVirtualized - Flag indicating a fallback to non-virtualized properties.
      Returns:
      The property found, or null for reference not found.
    • getRootFromName

      public PropCnr getRootFromName(GProp<?> requestor, String module)
      Gets the module root for a name. In the Editor, the module is the project, and that root container is returned. In the Server, the module doesn't matter, so the real root returns itself.

      When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.

      Specified by:
      getRootFromName in interface IAppSessionGyro
      Specified by:
      getRootFromName in interface IRuntimeReferenceLookup
      Parameters:
      requestor - The requestor property.
      module - The module name (without colon), i.e. the project name in the Designer.
      Returns:
      The root property container, or null if this container is not the root, or if the module name is not found. The default implementation returns null.
    • createClientSessionGyro

      public ClientSessionGyro createClientSessionGyro(ClientEndPoint clientEndPoint, Worker worker, EnvProps envProps)
      Called to create the ClientSessionGyro for the first client session or for parallel client sessions.
      Parameters:
      clientEndPoint - The client end point.
      worker - The worker.
      Returns:
      The client session gyro
    • getClientSessionGyros

      public ClientSessionGyro[] getClientSessionGyros()
      Gets the active client session Gyro's for this application session Gyro.
      Specified by:
      getClientSessionGyros in interface IAppSessionGyro
      Returns:
      The array of active client session Gyro's.
    • getClientSessionsCount

      public int getClientSessionsCount()
      Gets the count of client sessions.
      Specified by:
      getClientSessionsCount in interface IAppSessionGyro
    • toString

      public String toString()
      Formats the instance to a String.
      Overrides:
      toString in class Object
    • initialize

      public boolean initialize(EnvProps envProps, ClientSessionGyro clientGyro)
      Initiates the application for the client session. This is done only once for the same user and will remain in that state, e.g. languages, etc.
      Parameters:
      envProps - The client environment properties.
      clientGyro - The client session gyro used to place an additional session according to the current VirtualSpace.
      Returns:
      true for success, false if configuration is unsupported.
    • isVirtualized

      public boolean isVirtualized(VirtualSpace virtualSpace)
      Returns if a VirtualSpace already is virtualized for the application.
      Specified by:
      isVirtualized in interface IAppSessionGyro
      Parameters:
      virtualSpace - The VirtualSpace.
      Returns:
      true if vs already is virtualized or a virtualized instance is present, false otherwise.
    • getVirtualizedVirtualSpace

      public VirtualSpace getVirtualizedVirtualSpace(VirtualSpace virtualSpace, boolean doVirtualize)
      Gets the virtualized counterpart of a VirtualSpace. If the VirtualSpace is not virtualized, it will be done. If the VirtualSpace parameter already is a virtualized VirtualSpace, that instance is returned.

      This method is typically used by data connectors as action actors that have another target VirtualSpace. Focus can be set to a component in another VirtualSpace once virtualized.

      Specified by:
      getVirtualizedVirtualSpace in interface IAppSessionGyro
      Parameters:
      virtualSpace - The VirtualSpace.
      doVirtualize - Flag to virtualize the VirtualSpace if not already virtualized or not.
      Returns:
      A virtualized VirtualSpace for the virtualSpace parameter, or the virtualSpace parameter instance if it was virtualized.
    • getVirtualizedVSComponent

      public IVSComponent getVirtualizedVSComponent(IVSComponent component)
      Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent. If the component's VirtualSpace is not virtualized, it will be done. If the component parameter already is virtualized, that instance is returned. This method can also process a VirtualSpace instance as it is implementing the IVSComponent interface.
      Specified by:
      getVirtualizedVSComponent in interface IAppSessionGyro
      Parameters:
      component - A VS component.
      Returns:
      A virtualized component for the component parameter, or the component parameter instance if it was virtualized. null is returned if the VirtualSpace is virtualized and the VSComponent counterpart doesn't exist or the class instance is not the same as the original component, or if the component parameter is null.
    • getVirtualizedVSComponent

      public <VSC extends VSComponent> VSC getVirtualizedVSComponent(VSC component)
      Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent. If the component's VirtualSpace is not virtualized, it will be done. If the component parameter already is virtualized, that instance is returned.
      Specified by:
      getVirtualizedVSComponent in interface IAppSessionGyro
      Parameters:
      component - A VS component.
      Returns:
      A virtualized component for the component parameter, or the component parameter instance if it was virtualized. null is returned if the VirtualSpace is virtualized and the VSComponent counterpart doesn't exist or the class instance is not the same as the original component, or if the component parameter is null.
    • onFocusVetoChange

      public void onFocusVetoChange(FocusEvent event) throws FocusVetoException
      Called to perform veto.
      Specified by:
      onFocusVetoChange in interface IGyroFocusEngineOwner
      Parameters:
      event - The focus event, InternalFocusEvent perhaps.
      Throws:
      FocusVetoException - When the focus is veto'ed.
    • onFocusChanged

      public void onFocusChanged(IFocusComp newComp, IFocusComp oldComp, IGProp<?> trigger, boolean isRemoteInduced, boolean isInternal)
      Called when focus changes.
      Specified by:
      onFocusChanged in interface IGyroFocusEngineOwner
      Parameters:
      newComp - New focus component.
      oldComp - Old focus component.
      trigger - The trigger property, null for none.
      isRemoteInduced - If the event is remote induced.
      isInternal - The internal flag as specified in the setFocus method to the focus engine.
    • getCurrentFocus

      public IVSComponent getCurrentFocus()
      Returns the current focus in the VirtualSpace. If no particular component is in focus, the VirtualSpace that last had focus is returned.
      Specified by:
      getCurrentFocus in interface IAppSessionGyro
      Returns:
      The component in focus, or null if no focus is currently set.
    • setVirtualizeSupportFocus

      public String setVirtualizeSupportFocus(IVSComponent vsComp)
      Sets the focus to the specified VS component, regardless if the VS component is virtualized or not. If not virtualized, it will be prior to setting the focus.
      Specified by:
      setVirtualizeSupportFocus in interface IAppSessionGyro
      Parameters:
      vsComp - The VS component to focus.
      Returns:
      Error message, or null for success.
    • setVirtualizeSupportFocus

      public String setVirtualizeSupportFocus(IVSComponent vsComp, IGProp<?> trigger)
      Sets the focus to the specified VS component, regardless if the VS component is virtualized or not. If not virtualized, it will be prior to setting the focus.
      Specified by:
      setVirtualizeSupportFocus in interface IAppSessionGyro
      Parameters:
      vsComp - The VS component to focus.
      trigger - The trigger component, null for none.
      Returns:
      Error message, or null for success.
    • getApplicationTimerEngine

      public ITimerEngine getApplicationTimerEngine()
      Gets the application timer engine. All timer tasks as disposed of automatically when the application session exits.
      Specified by:
      getApplicationTimerEngine in interface IAppSessionGyro
      Returns:
      The application session implementation of the timeout engine.
    • getAppWorker

      public Worker getAppWorker()
      Gets the Worker for the Application.
      Specified by:
      getAppWorker in interface IAppSessionGyro
      Returns:
      The Application Worker.
    • getPrivateStorageMap

      public Map<String,Object> getPrivateStorageMap()
      Gets the concurrent hash map used to store the private data.
      Specified by:
      getPrivateStorageMap in interface IPrivateStorage
      Returns:
      The private storage map.
    • requestUILock

      public ILockState requestUILock()
      Requests a UI lock state. The object returned can be used to set a message below the lock spinner. It can also be used to set a progress indicator, also below the spinner. A progress indicator can also be handled using the lock object.

      Note: You MUST call the objects {link @ILockState#release()} method to release the lock state.

      Specified by:
      requestUILock in interface IAppSessionGyro
      Returns:
      The lock state object.
    • isUILocked

      public boolean isUILocked()
      Get the current UI lock state.

      You may also query the incremental lock state using getLockCount().

      Specified by:
      isUILocked in interface IAppSessionGyro
      Returns:
      true if busy state is on, false otherwise.
    • lockUI

      public boolean lockUI(KString waitMsg, ProgressIndicatorDelay delay)
      Locks the UI with a message and a delay.

      Consider using the method requestUILock() to handle UI locking along with optional message, wait delay and progress indicator.

      This call will not change the potential wait message or wait message delay if the method is not successful.

      Also consider using the method decrementUILock() in case multiple operations and threads can toggle the lock state.

      Specified by:
      lockUI in interface IAppSessionGyro
      Parameters:
      waitMsg - The wait message, null for none.
      delay - Delay before the message is shown in the Client.
      Returns:
      Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
    • lockUI

      public boolean lockUI(KString waitMsg, int delay)
      Locks the UI with a message and a delay.

      Consider using the method requestUILock() to handle UI locking along with optional message, wait delay and progress indicator.

      This call will not change the potential wait message or wait message delay if the method is not successful.

      Also consider using the method decrementUILock() in case multiple operations and threads can toggle the lock state.

      Specified by:
      lockUI in interface IAppSessionGyro
      Parameters:
      waitMsg - The wait message, null for none.
      delay - Delay of lock spinner: -2 for default (1.5 second), -1 disabled, 0=no delay, >0 wait time in milliseconds (1-20_000, i.e. 20 seconds).
      Returns:
      Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
      Throws:
      IllegalArgumentException - If the delay value is not -1 to 20_000 milliseconds (20 seconds).
    • unlockUI

      public boolean unlockUI()
      Unlocks the UI.

      Consider using the method requestUILock() to handle UI locking along with optional message, wait delay and progress indicator.

      This call will not change the potential wait message or wait message delay if the method is not successful.

      Also consider using the method decrementUILock() in case multiple operations and threads can toggle the lock state.

      Specified by:
      unlockUI in interface IAppSessionGyro
      Returns:
      Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
    • getLockCount

      public int getLockCount()
      Returns the incremental lock count that governs the UI locking state. Note that the lock state may be in effect even if the lock count is zero.
      Specified by:
      getLockCount in interface IAppSessionGyro
      Returns:
      The lock count, zero or positive value.
    • incrementUILock

      public int incrementUILock()
      Increases the incremental lock state. If it was zero, it will UI lock the session. Each call to this method must match a call to decrementUILock().

      Consider using the method requestUILock() to handle UI locking along with optional message, wait delay and progress indicator.

      Specified by:
      incrementUILock in interface IAppSessionGyro
      Returns:
      The lock count, i.e. the number of calls that has been made to this method minus the number of calls to decrementUILock(), after the call to this method.
    • decrementUILock

      public int decrementUILock()
      Decreases the incremental lock state. If it becomes zero, it will UI unlock the session. Each call to this method must match a call to incrementUILock().

      If this method is called and the lock count is zero, nothing will happen, but a warning event with a call stack will be logged.

      Specified by:
      decrementUILock in interface IAppSessionGyro
      Returns:
      The lock count, i.e. the number of calls that has been made to incrementUILock() minus the number of calls to this method.
    • setLockMessage

      public boolean setLockMessage(KString msg)
      Sets the message to display for the lock state, above the indicator.
      Specified by:
      setLockMessage in interface IAppSessionGyro
      Parameters:
      msg - The message to display, or null to remove it.
      Returns:
      true for changed, or false if busy state is not present or no change of message.
    • setLockMessage

      public boolean setLockMessage(KString msg, int progress)
      Sets the message to display for the lock state, above the indicator, along with a progress value.
      Specified by:
      setLockMessage in interface IAppSessionGyro
      Parameters:
      msg - The message to display, or null to remove it.
      progress - The progress value between 0 and 100, or -1 to remove it.
      Returns:
      true for changed, or false if busy state is not present or no change of values.
      Throws:
      IllegalArgumentException - If the progress value is not -1 or 0 to 100.
    • setLockMessage

      public boolean setLockMessage(KString msg, int delay, int progress)
      Sets the message to display for the lock state, above the indicator, along with a progress value.
      Specified by:
      setLockMessage in interface IAppSessionGyro
      Parameters:
      msg - The message to display, or null to remove it.
      delay - Delay of lock spinner: -2 for default (1.5 second), -1 disabled, 0=no delay, >0 wait time in milliseconds (1-20000, i.e. 20 seconds).
      progress - The progress value between 0 and 100, or -1 to remove it.
      Returns:
      true for changed, or false if busy state is not present or no change of values.
      Throws:
      IllegalArgumentException - If progress value is not -1 or 0 to 100, or delay is smaller than -2 or larger than 20_000.
    • setLockProgress

      public boolean setLockProgress(int progress)
      Sets the current progress bar value. This method will not do anything if the lock state is not present.
      Specified by:
      setLockProgress in interface IAppSessionGyro
      Parameters:
      progress - The progress value between 0 and 100, or -1 to remove it.
      Returns:
      true for changes, false for no change or no lock state.
      Throws:
      IllegalArgumentException - If the progress value is not -1 or 0 to 100.
    • getAppHistory

      public IAppHistory getAppHistory()
      Returns the application session history used for backward and forward navigation.
      Specified by:
      getAppHistory in interface IAppSessionGyro
      Returns:
      The application session history instance.
    • getLanguageCode

      public String getLanguageCode()
      Gets the language code of the application session. This language may very well not be the one requested by the end user device, but rather one of the languages the application supports.
      Specified by:
      getLanguageCode in interface IAppSessionGyro
      Returns:
      The language code.
    • getAppKStringInfoProvider

      public IKStringInfoProvider getAppKStringInfoProvider()
      Retrieves the KStringInfoProvider for the application session.

      Note: it is recommended to use the IClientSessionGyro.getKStringInfoProvider() when available as it has more precise information available for the client session.

      Specified by:
      getAppKStringInfoProvider in interface IAppSessionGyro
      Returns:
      The KString information provider instance, or null if not possible.
    • getKStringInfoProvider

      public IKStringInfoProvider getKStringInfoProvider()
      Retrieves the KStringInfoProvider for the application session.

      Note: it is recommended to use the IClientSessionGyro.getKStringInfoProvider() when available as it has more precise information available for the client session.

      Specified by:
      getKStringInfoProvider in interface IAppSessionGyro
      Specified by:
      getKStringInfoProvider in interface ILocaleString
      Returns:
      The KString information provider instance, or null if not possible. This method returns the same value as getAppKStringInfoProvider().
    • getLocale

      public LocaleInfo getLocale()
      Gets the local info class instance.
      Specified by:
      getLocale in interface ILocaleString
      Returns:
      The locale info class instance when the client environment has been set, otherwise the default client locale info instance specified for the server.
    • setLocale

      public LocaleInfo setLocale(LocaleInfo locale)
      Changes or sets the LocaleInfo for the environment.
      Specified by:
      setLocale in interface IAppSessionGyro
      Parameters:
      locale - localeInfo The locale information to use.
      Returns:
      The old LocaleInfo, or null if not set.
    • getLocaleKString

      public KString getLocaleKString(String id, boolean system)
      Gets the KString of a particular ID from the app's text tables that are flagged to also handle LocaleString's depending on the flag.
      Specified by:
      getLocaleKString in interface ILocaleString
      Parameters:
      id - The text ID.
      system - Flagged to handle system strings for LocaleString's.
      Returns:
      The KString for the text ID in current locale, null if not found.
    • getPrettyLocaledTexts

      public PrettyLocaledTexts getPrettyLocaledTexts()
      Gets the locale'd texts instance for the sessions language and text tables.
      Specified by:
      getPrettyLocaledTexts in interface IAppSessionGyro
      Returns:
      The instance used to create locale'd strings for e.g. duration and distances.
    • getAppSessionFileProvider

      public WSFileProvider getAppSessionFileProvider() throws IOException
      Get the web server file provider for the application session.
      Returns:
      The web server file provider.
      Throws:
      IOException - If the directory for the application session files failed to be created.
      IllegalStateException - If the application session is disposed of.
    • requestOAuthCallbackDisplay

      public IOAuthCallbackProvider requestOAuthCallbackDisplay(IOAuthService service)
      Requests the OAuth (1.0a or 2.0) authentication callback provider to show an URL to the user in order to be accepted.
      Returns:
      The authentication callback.
    • closeAuthenticationWindows

      public void closeAuthenticationWindows()
      Closes the remote windows for authentication.
    • getImage

      public RuntimeImageDefinition getImage(String name)
      Gets an image definition from the image container for the client session.
      Specified by:
      getImage in interface IRuntimeImageCache
      Parameters:
      name - The image name.
      Returns:
      The predefined image definition, or null if not found.
    • setImage

      public boolean setImage(RuntimeImageDefinition image)
      Adds the image definition to the image container for the client session. If the image already exists, it is replaced with the new definition.
      Specified by:
      setImage in interface IRuntimeImageCache
      Parameters:
      image - The image definition.
      Returns:
      true if the container was changed, i.e. image was added or replaced, false for no change.
    • removeImage

      public boolean removeImage(String name)
      Removes an image with a name from the client session.
      Specified by:
      removeImage in interface IRuntimeImageCache
      Parameters:
      name - The image to remove.
      Returns:
      true for removed, false if not found.
    • clearImageCache

      public void clearImageCache()
      Clears the entire cache.
      Specified by:
      clearImageCache in interface IRuntimeImageCache
    • messageBox

      public void messageBox(IMessageBoxReply reply, IMessageBox.Icon icon, KString title, KString message, KString... buttons)
      Displays a message box with the specified title and message.

      The callback is done in the application worker thread.

      Specified by:
      messageBox in interface IMessageBox
      Parameters:
      reply - The reply callback that is called when the user chooses a button or session is closed, null for none.
      icon - Icon to display, see the {link Icon} enumeration.
      title - The title string, must be non-null.
      message - The message to display, must be non-null.
      buttons - The strings for the buttons to display, if none, just an OK button is displayed. This array of buttons defined the index value returned by this method.
      Throws:
      NullPointerException - If icon or message is null, or if any of the elements in buttons array is null.
      IllegalStateException - If the application session is disposed of.
    • toast

      public void toast(KString message, IToaster.Position position, IToaster.Direction direction, IToaster.Type type, int duration)
      Displays a simple, unobstructive and ephemeral text message to the user.
      Specified by:
      toast in interface IToaster
      Parameters:
      message - The message to display.
      position - Position of toast, default value is Position.BOTTOM_CENTER if null.
      direction - Direction of the toast animation, default Direction.UP if null.
      type - Type of message style: message, warning, error of fatal, default is message if null
      duration - Duration of the toast message being shown in ms. Valid values are in the interval [0, 10000], 0 for a sticky toast.
    • getLocationService

      public ILocationService getLocationService()
      Returns the location service for the application session.
      Specified by:
      getLocationService in interface IAppSessionGyro
      Returns:
      The "application singleton" instance of the location service.
    • getAuthenticatedUserUUID

      public String getAuthenticatedUserUUID()
      Gets the user ID for background location service identification.
      Specified by:
      getAuthenticatedUserUUID in interface IAppSessionGyro
      Returns:
      String made up of the authenticated user's UUID, null if the user is not yet authenticated or undefined.
    • getUserAuthenticationUI

      public IUserAuthenticationUI getUserAuthenticationUI()
      Gets the user authentication UI interface used for the initial login.
      Specified by:
      getUserAuthenticationUI in interface IAppSessionGyro
      Returns:
      The user authentication interface.