Package es.bsc.dataclay.logic.sessionmgr
Class SessionManager
- java.lang.Object
-
- es.bsc.dataclay.util.management.AbstractManager
-
- es.bsc.dataclay.logic.sessionmgr.SessionManager
-
- All Implemented Interfaces:
CommonManager
public final class SessionManager extends AbstractManager
This class is responsible to manage information related to sessions.
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
DEBUG_ENABLED
Indicates if debug is enabled.-
Fields inherited from class es.bsc.dataclay.util.management.AbstractManager
dataSource
-
-
Constructor Summary
Constructors Constructor Description SessionManager(SQLiteDataSource dataSource)
Instantiates an SessionManager that uses the Backend configuration provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanCaches()
Method that cleans the caches of the manager.void
closeExtSession(DataClayInstanceID extDataClayID)
Close external sessionvoid
closeSession(SessionID sessionID)
Close sessionvoid
finishCacheThreads()
Finish cache threads.List<Session>
getAllActiveSessionsOfAccount(AccountID accountID)
Get all active sessions of the account providedSessionManagerDB
getDbHandler()
Method used for unit testing.SessionInfo
getExtSessionInfo(DataClayInstanceID extDataClayID)
SessionInfo
getSessionInfo(SessionID sessionID)
Retrieves the info of a sessionSessionInfo
newExtSession(DataClayInstanceID extDataClayID, AccountID accountID, CommonMessages.Langs language, Calendar endDate)
Registers a new Session for the external dataClay instance only valid for shared objectsSessionInfo
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.
-
-
-
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 sessionnewSessionContracts
- Contracts (and interfaces) of the sessionnewSessionDataContracts
- Data contracts of the sessiondataContractIDofStore
- ID of the data contract for storeendDate
- the end date of the sessionlanguageForSession
- language for the sessionifaceBitmaps
- 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.
-
getExtSessionInfo
public SessionInfo getExtSessionInfo(DataClayInstanceID extDataClayID)
-
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.
-
cleanCaches
public void cleanCaches()
Description copied from interface:CommonManager
Method that cleans the caches of the manager. Used on testing.- Specified by:
cleanCaches
in interfaceCommonManager
- Specified by:
cleanCaches
in classAbstractManager
-
finishCacheThreads
public void finishCacheThreads()
Finish cache threads.
-
-