Class AbstractServerApplication

java.lang.Object
org.tentackle.app.AbstractApplication
org.tentackle.persist.app.AbstractServerApplication
All Implemented Interfaces:
Application, ConnectionManagerProvider, DomainContextProvider, org.tentackle.session.SessionPoolProvider, org.tentackle.session.SessionProvider
Direct Known Subclasses:
ServerApplication

public abstract class AbstractServerApplication extends AbstractApplication implements org.tentackle.session.SessionPoolProvider, ConnectionManagerProvider
Base class for server applications.
Author:
harald
  • Constructor Details

    • AbstractServerApplication

      public AbstractServerApplication(String name, String version)
      Creates a server.
      Parameters:
      name - the application name, null for default name
      version - the application version, null for default version
  • Method Details

    • getSessionPool

      public org.tentackle.session.SessionPool getSessionPool()
      Specified by:
      getSessionPool in interface org.tentackle.session.SessionPoolProvider
    • getRemoteSessionPool

      public org.tentackle.session.MultiUserSessionPool getRemoteSessionPool()
      Specified by:
      getRemoteSessionPool in interface org.tentackle.session.SessionPoolProvider
    • isServer

      public boolean isServer()
      Specified by:
      isServer in interface Application
      Overrides:
      isServer in class AbstractApplication
    • setSessionInfo

      protected void setSessionInfo(org.tentackle.session.SessionInfo sessionInfo)

      Overridden to protect the SessionInfo once it is set.

      Overrides:
      setSessionInfo in class AbstractApplication
    • configurePreferences

      protected void configurePreferences()
      Overrides:
      configurePreferences in class AbstractApplication
    • configureModificationTracker

      protected void configureModificationTracker()
      Overrides:
      configureModificationTracker in class AbstractApplication
    • initializeScripting

      protected void initializeScripting()
      Overrides:
      initializeScripting in class AbstractApplication
    • validateValidators

      protected void validateValidators()
      Validates the validators.
      The default implementation loads all Validators of all PDO classes and invokes Validator.validate(). This will load all CompoundValues and compiles the scripts, if any.
    • finishStartup

      protected void finishStartup()
      Overrides:
      finishStartup in class AbstractApplication
    • createSessionPool

      public org.tentackle.session.SessionPool createSessionPool()
      Creates the session pool to serve the client sessions.
      Returns:
      the session pool
    • createRemoteSessionPool

      public org.tentackle.session.MultiUserSessionPool createRemoteSessionPool()
      Creates the remote session pool to serve the client sessions.
      Returns:
      the session pool
    • getSession

      public Db getSession()
      Specified by:
      getSession in interface org.tentackle.session.SessionProvider
      Overrides:
      getSession in class AbstractApplication
    • createConnectionManager

      protected ConnectionManager createConnectionManager()
      Creates the connection manager for the client sessions. The default creates an MpxConnectionManager.
      Returns:
      the connection manager
    • getConnectionManager

      public ConnectionManager getConnectionManager()
      Specified by:
      getConnectionManager in interface ConnectionManagerProvider
    • configureSessionInfo

      protected void configureSessionInfo(org.tentackle.session.SessionInfo sessionInfo)
      Configures the session info.
      Parameters:
      sessionInfo - the session info
    • startup

      protected void startup()
      Specified by:
      startup in class AbstractApplication
    • login

      protected void login()
      Connects the server to the database backend or another remote server.
    • cleanup

      protected void cleanup()
      Overrides:
      cleanup in class AbstractApplication
    • isRunningInContainer

      public boolean isRunningInContainer()
      Indicates whether this application is running within a container.
      Returns:
      true if running in a container, false if not
    • isSystemExitNecessaryToStop

      protected boolean isSystemExitNecessaryToStop()
      Overrides:
      isSystemExitNecessaryToStop in class AbstractApplication
    • detectContainer

      protected void detectContainer()
      Detects whether this application is running within a container.
      The result can be retrieved by isRunningInContainer().
    • deregisterJdbcDrivers

      protected void deregisterJdbcDrivers(ClassLoader cl)
      De-registers all JDBC-Drivers loaded by the app's classloader.
      Necessary in containers only (in case connected directly via JDBC and not via JNDI). Avoids memory leaks.
      Parameters:
      cl - the app's classloader
    • activateStatistics

      protected void activateStatistics()
      Overrides:
      activateStatistics in class AbstractApplication
    • logStatistics

      public void logStatistics()
      Logs and clears the statistics.
      Overrides:
      logStatistics in class AbstractApplication