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 booleanDEBUG_ENABLEDIndicates 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 voidcleanCaches()Method that cleans the caches of the manager.voidcloseExtSession(DataClayInstanceID extDataClayID)Close external sessionvoidcloseSession(SessionID sessionID)Close sessionvoidfinishCacheThreads()Finish cache threads.List<Session>getAllActiveSessionsOfAccount(AccountID accountID)Get all active sessions of the account providedSessionManagerDBgetDbHandler()Method used for unit testing.SessionInfogetExtSessionInfo(DataClayInstanceID extDataClayID)SessionInfogetSessionInfo(SessionID sessionID)Retrieves the info of a sessionSessionInfonewExtSession(DataClayInstanceID extDataClayID, AccountID accountID, CommonMessages.Langs language, Calendar endDate)Registers a new Session for the external dataClay instance only valid for shared objectsSessionInfonewSession(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:CommonManagerMethod that cleans the caches of the manager. Used on testing.- Specified by:
cleanCachesin interfaceCommonManager- Specified by:
cleanCachesin classAbstractManager
-
finishCacheThreads
public void finishCacheThreads()
Finish cache threads.
-
-