Class SessionManager

  • All Implemented Interfaces:
    CommonManager

    public final class SessionManager
    extends AbstractManager
    This class is responsible to manage information related to sessions.
    • Field Detail

      • DEBUG_ENABLED

        protected static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
    • Constructor Detail

      • SessionManager

        public SessionManager​(SQLiteDataSource dataSource)
        Instantiates an SessionManager that uses the Backend configuration provided.
        Parameters:
        managerName - Manager/service name.
    • Method Detail

      • newSession

        public SessionInfo newSession​(AccountID newaccountID,
                                      Map<ContractID,​SessionContract> newSessionContracts,
                                      Map<DataContractID,​SessionDataContract> newSessionDataContracts,
                                      DataContractID dataContractIDofStore,
                                      Calendar endDate,
                                      CommonMessages.Langs languageForSession,
                                      Map<MetaClassID,​byte[]> ifaceBitmaps)
        Registers a new Session for the Account with ID provided and the information about the contracts (and interfaces,...) in the session.
        Parameters:
        newaccountID - ID of the account of the session
        newSessionContracts - Contracts (and interfaces) of the session
        newSessionDataContracts - Data contracts of the session
        dataContractIDofStore - ID of the data contract for store
        endDate - the end date of the session
        languageForSession - language for the session
        ifaceBitmaps - interface bitmaps for the session.
        Returns:
        Information new session created
        Throws:
        Exception - if an exception occurs.
      • newExtSession

        public SessionInfo newExtSession​(DataClayInstanceID extDataClayID,
                                         AccountID accountID,
                                         CommonMessages.Langs language,
                                         Calendar endDate)
        Registers a new Session for the external dataClay instance only valid for shared objects
        Parameters:
        extDataClayID - id of the external dataClay instance
        Returns:
        Information new session created
        Throws:
        Exception - if an exception occurs.
      • closeSession

        public void closeSession​(SessionID sessionID)
        Close session
        Parameters:
        sessionID - ID of the session to close
      • closeExtSession

        public void closeExtSession​(DataClayInstanceID extDataClayID)
        Close external session
        Parameters:
        extDataClayID - ID of the external dataClay instance
      • getSessionInfo

        public SessionInfo getSessionInfo​(SessionID sessionID)
        Retrieves the info of a session
        Parameters:
        sessionID - ID of the session
        Returns:
        the info of the session
        Throws:
        Exception - if an exception occurs:
        SessionIsNotActive if the session is not active. SessionNotExistException if the session does not exist.
      • getAllActiveSessionsOfAccount

        public List<Session> getAllActiveSessionsOfAccount​(AccountID accountID)
        Get all active sessions of the account provided
        Parameters:
        accountID - ID of the account
        Returns:
        all existing active sessions.
      • getDbHandler

        public SessionManagerDB getDbHandler()
        Method used for unit testing.
        Returns:
        The db handler reference of this manager.
      • finishCacheThreads

        public void finishCacheThreads()
        Finish cache threads.