Class AbstractServerApplication

  • All Implemented Interfaces:
    org.tentackle.dbms.ConnectionManagerProvider, org.tentackle.pdo.DomainContextProvider, org.tentackle.session.SessionPoolProvider, org.tentackle.session.SessionProvider
    Direct Known Subclasses:
    ServerApplication

    public abstract class AbstractServerApplication
    extends org.tentackle.app.AbstractApplication
    implements org.tentackle.session.SessionPoolProvider, org.tentackle.dbms.ConnectionManagerProvider
    Base class for server applications.
    Author:
    harald
    • Field Summary

      • Fields inherited from class org.tentackle.app.AbstractApplication

        DISABLE_MODIFICATION_TRACKER, DISABLE_SECURITY_MANAGER, ENABLE_STATISTICS, LOCALE, SCRIPTING
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractServerApplication​(java.lang.String name, java.lang.String version)
      Creates a server.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void activateStatistics()  
      protected void cleanup()  
      protected void configureModificationTracker()  
      protected void configurePreferences()  
      protected void configureSessionInfo​(org.tentackle.session.SessionInfo sessionInfo)
      Configures the session info.
      protected org.tentackle.dbms.ConnectionManager createConnectionManager()
      Creates the connection manager for the client sessions.
      org.tentackle.session.SessionPool createSessionPool()
      Creates the session pool to serve the client sessions.
      protected void deregisterJdbcDrivers​(java.lang.ClassLoader cl)
      Deregisters all JDBC-Drivers loaded by the app's classloader.
      Necessary in containers only (in case connected directly via JDBC and not via JNDI).
      protected void detectContainer()
      Detects whether this application is running within a container.
      The result can be retrieved by isRunningInContainer().
      protected void finishStartup()  
      org.tentackle.dbms.ConnectionManager getConnectionManager()  
      org.tentackle.dbms.Db getSession()  
      org.tentackle.session.SessionPool getSessionPool()  
      boolean isRunningInContainer()
      Indicates whether this application is running within a container.
      protected boolean isServerImpl()  
      protected boolean isSystemExitNecessaryToStop()  
      protected void login()
      Connects the server to the database backend.
      protected void setSessionInfo​(org.tentackle.session.SessionInfo sessionInfo)
      protected void startup()  
      • Methods inherited from class org.tentackle.app.AbstractApplication

        applyProperties, configure, configureSecurityManager, createDomainContext, createSession, createSessionInfo, getCommandLine, getCreationTime, getDomainContext, getName, getProperties, getProperty, getRunningApplication, getSessionInfo, getUser, getUser, getVersion, initialize, initializeScripting, isInteractive, isInteractiveImpl, isServer, logStackdump, register, setDomainContext, setProperties, start, start, stop, stop, toString, unregister
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.tentackle.pdo.DomainContextProvider

        on, op
    • Constructor Detail

      • AbstractServerApplication

        public AbstractServerApplication​(java.lang.String name,
                                         java.lang.String version)
        Creates a server.
        Parameters:
        name - the server's name
        version - the application version
    • Method Detail

      • getSessionPool

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

        protected boolean isServerImpl()
        Overrides:
        isServerImpl in class org.tentackle.app.AbstractApplication
      • setSessionInfo

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

        Overwridden to protect the sessioninfo once it is set.

        Overrides:
        setSessionInfo in class org.tentackle.app.AbstractApplication
      • configurePreferences

        protected void configurePreferences()
        Overrides:
        configurePreferences in class org.tentackle.app.AbstractApplication
      • configureModificationTracker

        protected void configureModificationTracker()
        Overrides:
        configureModificationTracker in class org.tentackle.app.AbstractApplication
      • finishStartup

        protected void finishStartup()
        Overrides:
        finishStartup in class org.tentackle.app.AbstractApplication
      • createSessionPool

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

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

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

        public org.tentackle.dbms.ConnectionManager getConnectionManager()
        Specified by:
        getConnectionManager in interface org.tentackle.dbms.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 org.tentackle.app.AbstractApplication
      • login

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

        protected void cleanup()
        Overrides:
        cleanup in class org.tentackle.app.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 org.tentackle.app.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​(java.lang.ClassLoader cl)
        Deregisters all JDBC-Drivers loaded by the app's classloader.
        Necessary in containers only (in case connected directly via JDBC and not via JNDI). Avoids memleaks.
        Parameters:
        cl - the app's classloader
      • activateStatistics

        protected void activateStatistics()
        Overrides:
        activateStatistics in class org.tentackle.app.AbstractApplication